Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tooltip): custom animation distance overrides overlay value #2266

Merged
merged 4 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions components/tokens/custom-spectrum/custom-large-vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,6 @@ governing permissions and limitations under the License.
--spectrum-assetcard-title-font-size: var(--spectrum-heading-size-xxs);
--spectrum-assetcard-header-content-font-size: var(--spectrum-heading-size-xxs);
--spectrum-assetcard-content-font-size: var(--spectrum-body-size-xs);

--spectrum-tooltip-animation-distance: 5px;
}
2 changes: 2 additions & 0 deletions components/tokens/custom-spectrum/custom-medium-vars.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,6 @@ governing permissions and limitations under the License.
--spectrum-assetcard-title-font-size: var(--spectrum-heading-size-xs);
--spectrum-assetcard-header-content-font-size: var(--spectrum-heading-size-xs);
--spectrum-assetcard-content-font-size: var(--spectrum-body-size-s);

--spectrum-tooltip-animation-distance: var(--spectrum-spacing-75);
}
19 changes: 8 additions & 11 deletions components/tooltip/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ governing permissions and limitations under the License.
.spectrum-Tooltip {
--spectrum-tooltip-animation-duration: var(--spectrum-animation-duration-100);

/* animation distance is equal to spacing to source */
--spectrum-tooltip-animation-distance: var(--spectrum-spacing-75);

/* override if additional spacing to source is required */
--spectrum-tooltip-margin: 0px;

Expand Down Expand Up @@ -399,7 +396,7 @@ governing permissions and limitations under the License.

/* tooltip animates upward ⬆ */
&.is-open {
@inherit: %spectrum-overlay--top--open;
transform: translateY(calc(-1 * var(--mod-tooltip-animation-distance, var(--spectrum-tooltip-animation-distance))));
}
}

Expand All @@ -414,7 +411,7 @@ governing permissions and limitations under the License.

/* Tooltip animates downward ⬇ */
&.is-open {
@inherit: %spectrum-overlay--bottom--open;
transform: translateY(var(--mod-tooltip-animation-distance, var(--spectrum-tooltip-animation-distance)));
}
}

Expand All @@ -427,7 +424,7 @@ governing permissions and limitations under the License.

/* Tooltip animates to right ⮕ */
&.is-open {
@inherit: %spectrum-overlay--right--open;
transform: translateX(var(--mod-tooltip-animation-distance, var(--spectrum-tooltip-animation-distance)));
}
}

Expand All @@ -440,7 +437,7 @@ governing permissions and limitations under the License.

/* Tooltip animates to left ⬅ */
&.is-open {
@inherit: %spectrum-overlay--left--open;
transform: translateX(calc(-1 * var(--mod-tooltip-animation-distance, var(--spectrum-tooltip-animation-distance))));
}
}

Expand All @@ -453,13 +450,13 @@ governing permissions and limitations under the License.

/* LTR read, tooltip animates towards left ⬅ */
&.is-open {
@inherit: %spectrum-overlay--left--open;
transform: translateX(calc(-1 * var(--mod-tooltip-animation-distance, var(--spectrum-tooltip-animation-distance))));
}

/* RTL read, tooltip animates towards right ⮕ */
[dir="rtl"] & {
&.is-open {
@inherit: %spectrum-overlay--right--open;
transform: translateX(var(--mod-tooltip-animation-distance, var(--spectrum-tooltip-animation-distance)));
}
}
}
Expand All @@ -473,13 +470,13 @@ governing permissions and limitations under the License.

/* LTR read, tooltip animates towards right ⮕ */
&.is-open {
@inherit: %spectrum-overlay--right--open;
transform: translateX(var(--mod-tooltip-animation-distance, var(--spectrum-tooltip-animation-distance)));
}

/* RTL read, tooltip animates towards left ⬅ */
[dir="rtl"] & {
&.is-open {
@inherit: %spectrum-overlay--left--open;
transform: translateX(calc(-1 * var(--mod-tooltip-animation-distance, var(--spectrum-tooltip-animation-distance))));
}
}
}
Expand Down