Animation
Installation
yarn add @chewy/kib-foundationsImport
@use '~@chewy/kib-foundations/src/animation';Functions
get-properties
@function get-properties() { ... }@function get-properties() { $result: (); @each $key, $value in settings.$animations { $result: map.set($result, 'animation', $key, $value); } @return common.flatten-map($result); }
Description
Returns animation tokens as a flattened map with 'animation-' prefixed keys. Used by the custom-properties mixin to generate CSS custom properties.
Parameters
None.
Returns
Map —Final flattened map
Requires
- [function]
flatten-map - [variable]
animations
Used by
- [mixin]
custom-properties - [mixin]
custom-properties - [mixin]
custom-properties
-get-animation-value
@function -get-animation-value($path...) { ... }@function -get-animation-value($path...) { $has-key: map.has-key(settings.$animations, $path...); @if not $has-key { @error "Animation value (#{$path}) not found."; } @return map.get(settings.$animations, $path...); }
Description
Retrieves an animation value from the token map.
Parameters
| parameter Name | parameter Description | parameter Type | parameter Default value |
|---|---|---|---|
$path... | Path to the animation value | List | — none |
Returns
Number or String —Animation value from the token map
Throws
Animation value (#{$path}) not found.
Requires
- [function]
get - [variable]
animations
Used by
- [function]
-get-animation-property
-get-animation-property
@function -get-animation-property($path) { ... }@function -get-animation-property($path) { @if not map.has-key(settings.$animations, $path...) { @error "The animation property (#{$path}) does not exist."; } $property: common.get-property-name('animation', $path...); $fallback: -get-animation-value($path...); @return string.unquote('var(#{$property}, #{$fallback})'); }
Description
Get a single animation style property definition.
Parameters
| parameter Name | parameter Description | parameter Type | parameter Default value |
|---|---|---|---|
$path | The map path to the desired property definition. | List | — none |
Returns
List or String or Number —Return the value of the animation property.
Throws
The animation property (#{$path}) does not exist.
Requires
- [function]
get-property-name - [function]
-get-animation-value - [variable]
animations
get
@function get($path...) { ... }@function get($path...) { @return get-property($path...); }
Description
Creates a custom property reference from an animation path
Parameters
| parameter Name | parameter Description | parameter Type | parameter Default value |
|---|---|---|---|
$path... | Comma separated path to an animation property | List | — none |
Returns
String —CSS var() function with a fallback value
Used by
- [mixin]
title - [mixin]
actions - [mixin]
actions-dismissible - [mixin]
action-trigger - [function]
-get-animation-value - [mixin]
apply - [mixin]
root - [mixin]
variant - [mixin]
landscape-layout - [mixin]
landscape-condensed - [mixin]
full-border-radius - [mixin]
top-border-radius - [mixin]
root - [mixin]
eyebrow - [mixin]
author - [mixin]
author-image - [mixin]
link - [mixin]
transparent-landscape - [mixin]
landscape - [mixin]
transparent - [mixin]
root - [mixin]
landscape - [mixin]
transparent - [mixin]
landscape-transparent - [mixin]
font-styles-x - [function]
-get-fallback - [function]
-get-nested-fallback - [function]
-get-themes - [mixin]
root-container - [mixin]
list - [mixin]
item - [function]
height-calc - [mixin]
root - [mixin]
base - [mixin]
text - [mixin]
focus - [mixin]
halo - [mixin]
default-button-styles - [mixin]
button-styles - [mixin]
size-large - [mixin]
size-medium - [mixin]
size-small - [mixin]
overlay-focus-size-small - [mixin]
root - [mixin]
base - [mixin]
siblings - [mixin]
default-button-styles - [mixin]
button-styles - [mixin]
size-medium - [mixin]
size-small - [mixin]
icon - [mixin]
icon-position-end - [mixin]
button-padding - [mixin]
base - [mixin]
header - [mixin]
controls - [mixin]
view-all-link - [mixin]
view-all-button - [mixin]
chip-base-styles - [mixin]
chip-container-styles - [mixin]
chip-enabled-styles - [mixin]
legacy-chip-base-styles - [mixin]
legacy-base-styles-adjacent - [mixin]
legacy-chip-disabled-styles - [mixin]
legacy-chip-icon-styles - [mixin]
chip-deselected-styles - [mixin]
generate-styles - [mixin]
generate-icon-styles - [mixin]
icon-only - [mixin]
chip-choice-base-styles - [mixin]
chip-choice-selected-styles - [mixin]
chip-choice-active-styles - [mixin]
chip-choice-hover-styles - [mixin]
chip-choices-container-styles - [mixin]
chip-choices-child-styles - [mixin]
generate-styles - [mixin]
transition-out - [mixin]
generate-icon-styles - [mixin]
generate-styles - [mixin]
icon - [mixin]
chip-selected-styles - [mixin]
container-styles - [mixin]
child-styles - [mixin]
choice-root - [mixin]
choice-label - [mixin]
choice-append-container - [mixin]
checkbox-control-state - [mixin]
-checkbox-control-checkmark - [mixin]
checkbox-fill-state - [mixin]
checkbox-label-state - [mixin]
checkbox-control-custom-base - [mixin]
checkbox-control - [mixin]
radio-control-state - [mixin]
radio-fill-state - [mixin]
radio-label-state - [mixin]
radio-control-custom-base - [mixin]
radio-control-custom - [mixin]
radio-fill - [mixin]
range-label - [mixin]
rating-heading - [mixin]
rating-control - [mixin]
icon-focus-indicator - [mixin]
active-colors - [mixin]
inactive-colors - [mixin]
count - [mixin]
action - [mixin]
checkbox-control - [mixin]
control-fill - [mixin]
label-state - [mixin]
label - [mixin]
primary-text - [function]
-get-color - [function]
-get-valid-path - [function]
try-get - [function]
get-shadow-property - [mixin]
root - [mixin]
media-container - [mixin]
body - [mixin]
bottom - [mixin]
root - [mixin]
title - [mixin]
overline - [mixin]
content - [mixin]
source - [mixin]
swipe-affordance - [mixin]
text-shadow - [mixin]
has-source - [mixin]
controls-container - [mixin]
rotate-control - [function]
-get-fallback - [mixin]
input-adornment - [mixin]
picker-calendar-container - [mixin]
picker-controls-bar - [mixin]
picker-toolbar - [mixin]
picker-toolbar-title - [mixin]
picker-toolbar-selected-date - [mixin]
picker-dialog-content - [mixin]
picker-dialog-content-input - [mixin]
sm-margin-styles - [mixin]
elevation - [function]
get-value - [function]
-get-elevation-var - [mixin]
content - [mixin]
heading - [mixin]
messaging - [mixin]
heading-lg - [mixin]
root-container - [mixin]
root-container-with-border-focus - [mixin]
field - [mixin]
control-state - [mixin]
control-state-error-focus-halo - [mixin]
control-read-only - [mixin]
icon - [mixin]
icon-on-state - [mixin]
icon-with-action-states - [mixin]
action-area-divider-styles - [mixin]
action-area-divider-color - [mixin]
action-label-divider-control-state-styles - [mixin]
action-label-divider-color - [mixin]
error-message - [mixin]
error-icon - [mixin]
action-area-divider-interaction-border-width - [mixin]
field-root-container - [mixin]
field-control - [mixin]
field-icon - [mixin]
field-label-content - [mixin]
field-messages-container - [mixin]
field-messages-common - [mixin]
autocomplete-menu - [mixin]
autocomplete-option - [mixin]
root-container - [mixin]
label - [mixin]
label-with-message - [mixin]
help - [mixin]
help-bottom - [mixin]
content - [mixin]
alert - [mixin]
icon - [mixin]
error-message - [mixin]
error-icon - [mixin]
group-label - [mixin]
group-messages-above - [mixin]
group-messages-below - [function]
get-theme-map - [function]
prepare-typography-theme-map - [mixin]
variation - [mixin]
nav - [mixin]
control-icon - [mixin]
font-styles-x - [mixin]
icon-size - [mixin]
icon-circle - [mixin]
label - [mixin]
root-container - [mixin]
root-container-with-subtitle - [mixin]
image-wrapper - [mixin]
icon-wrapper - [mixin]
compact - [mixin]
subtitle - [mixin]
icon-container - [mixin]
dismiss-button - [mixin]
default - [function]
get-map-by-key-safe - [mixin]
root-container - [mixin]
icon - [mixin]
root-container - [mixin]
status - [mixin]
no-results - [mixin]
item - [mixin]
label - [mixin]
menu-link - [mixin]
menu-link-icon-wrapper - [mixin]
menu-group-link - [mixin]
menu-group-toggle - [mixin]
header - [mixin]
title - [mixin]
content - [mixin]
actions - [mixin]
base - [mixin]
content - [mixin]
title-container - [mixin]
title - [mixin]
metadata - [mixin]
description - [mixin]
attributes - [mixin]
attribute - [mixin]
base - [mixin]
content - [mixin]
pseudo-styles - [mixin]
navigation-tile-has-media - [mixin]
navigation-tile-vertical - [mixin]
navigation-tile-vertical-content - [mixin]
carousel-content-override - [mixin]
row - [mixin]
normalize-blocks - [mixin]
normalize-text - [mixin]
normalize-lists - [mixin]
normalize-code - [mixin]
section-margin-top - [mixin]
section-margin-bottom - [mixin]
page-padding-inline - [mixin]
list-item-previous - [mixin]
list-item-next - [mixin]
card-root - [mixin]
avatar-wrapper - [mixin]
caption - [mixin]
list-item - [mixin]
badge - [mixin]
icon-wrapper - [mixin]
icon-restricted - [mixin]
icon-promotion - [mixin]
icon-chewy-plus - [mixin]
canvas-landscape-extended - [mixin]
canvas-content - [mixin]
choices-landscape - [mixin]
actions-flat - [mixin]
label - [mixin]
flag - [mixin]
canvas - [mixin]
append - [mixin]
root-container - [mixin]
autoship-logo-condensed - [mixin]
row - [mixin]
append-content - [mixin]
root-container - [mixin]
count-wrapper - [mixin]
rating-display - [mixin]
row - [mixin]
sponsor - [mixin]
subtitle - [mixin]
title - [mixin]
content - [mixin]
button - [mixin]
card-heading - [mixin]
card-heading-airy - [mixin]
card-content - [mixin]
card-content-airy - [mixin]
label - [mixin]
content - [mixin]
detail - [mixin]
stacked-detail-airy - [mixin]
stacked-detail - [mixin]
avatar-airy - [mixin]
avatar - [mixin]
name-airy - [mixin]
metadata-airy - [mixin]
name - [mixin]
metadata - [mixin]
static - [mixin]
root-container - [mixin]
count-wrapper - [mixin]
action - [mixin]
root-container - [mixin]
control-on-focus - [mixin]
control-on-hover - [mixin]
error-state-control-on-focus - [mixin]
error-state-control-on-hover - [mixin]
icon-container - [mixin]
icon-container-error-state - [mixin]
input-container - [mixin]
helper-text - [mixin]
title - [mixin]
read-only-input - [mixin]
header-wrapper - [mixin]
header-small - [mixin]
subheading - [mixin]
card-root - [mixin]
card-disabled - [mixin]
selected - [mixin]
selected-hover - [mixin]
selected-pressed - [mixin]
append-container-indent - [mixin]
header - [mixin]
title-icon - [mixin]
control-back - [mixin]
content-shadows - [mixin]
content - [mixin]
content-single-panel-actions - [mixin]
step-content - [mixin]
step-actions - [mixin]
base - [mixin]
base-styles - [mixin]
text-skeleton - [mixin]
label - [mixin]
actions - [mixin]
actions-stacked - [mixin]
action - [function]
-get-themes - [mixin]
standalone-link - [mixin]
standalone-link-icon-svg - [mixin]
standalone-link-label - [mixin]
heading - [mixin]
group - [mixin]
text-swatch - [mixin]
text-swatch-header - [mixin]
text-swatch-details - [mixin]
selected - [mixin]
unavailable - [mixin]
both-selected-unavailable - [mixin]
indeterminate - [mixin]
both-selected-indeterminate - [mixin]
unavailable-text-with-strikethru - [mixin]
unavailable-text-indeterminate - [mixin]
image-swatch - [mixin]
image-swatch-header - [mixin]
image-strikethrough - [mixin]
swatch-shared-styles - [mixin]
wrap-layout - [mixin]
nav - [mixin]
nav-list - [mixin]
trigger - [mixin]
trigger-condensed - [mixin]
trigger-active - [mixin]
trigger-close-icon - [mixin]
trigger-icon - [mixin]
nav-list-divider - [mixin]
tag-variant - [mixin]
secondary-variant - [mixin]
button-variant - [mixin]
button-variant-hover - [mixin]
-visual-state - [mixin]
state - [mixin]
toggle - [mixin]
size-medium - [mixin]
size-large - [mixin]
tooltip - [mixin]
trigger - [mixin]
content - [function]
get-weight - [function]
get-type-style-with-fallback - [function]
get-type-style - [function]
-get-base-font-weight-var - [function]
get-type-style-variant-weight - [function]
-get-type-style-value - [function]
-get-type-style-property - [mixin]
style-as - [mixin]
root-container - [mixin]
meta-data - [mixin]
item - [mixin]
item-content - [mixin]
root - [mixin]
legend - [mixin]
required-indicator - [mixin]
choices - [mixin]
messages - [mixin]
help-text - [mixin]
error-message - [mixin]
error-icon - [function]
-get-spacing-value - [function]
-extract-typography - [mixin]
header - [mixin]
title-icon - [mixin]
control-back - [mixin]
content-shadows - [mixin]
content-single-panel-actions - [mixin]
step-content - [mixin]
step-content-with-sheet - [mixin]
step-actions - [mixin]
base - [mixin]
item-base
Variables
preferred-theme
Single theme per SCSS file.
$preferred-theme: common.$preferred-theme !default;Description
Name of the preferred theme to look for properties first. If not found it will fallback to common.$default-theme.
Type
String
Used by
- [function]
weight-variant-token-exists - [function]
type-style-exists - [function]
get-type-style-with-fallback - [function]
get-type-style-variant-weight - [function]
-get-type-style-property
page-entry-movement
$page-entry-movement: unit.rem(170px);Description
Page top starting position
Type
Number
page-fade-transition-duration
$page-fade-transition-duration: 1000ms !default;Description
Page fade transitions duration
Type
Number
page-slide-transition-duration
$page-slide-transition-duration: 500ms !default;Description
Page slide Group transitions duration
Type
Number
animation-press-scale-amount-initial
$animation-press-scale-amount-initial: 1 !default;animations
$animations: (...);$animations: map.get(tokens.$chirp-theme, 'animation');
Description
Animation tokens map from the base theme. The new $chirp-theme has animation tokens under the 'animation' key directly.
Type
Map
Used by
- [function]
get-properties - [function]
-get-animation-value - [function]
-get-animation-property - [mixin]
apply
aliases
$aliases: (...);$aliases: ();
Description
Map of animation style aliases to facilitate deprecation and removal of animation styles Currently a placeholder.
Type
Map
Used by
- [function]
-get-valid-path - [function]
get-type-style - [function]
-get-type-style-property - [mixin]
style-as
deprecated-property-names
$deprecated-property-names: (...);$deprecated-property-names: ();
Mixins
custom-properties
Use prebuilt CSS theme files from @chewy/chirp-design-tokens instead.
Generates CSS Custom Properties for animation tokens. Prefer importing theme files directly:
```css
@mixin custom-properties($overrides: null) { ... }@mixin custom-properties($overrides: null) { @warn "animation.custom-properties() is deprecated. Import CSS theme files from @chewy/chirp-design-tokens/web/css (for example, theme-base-light.css and theme-base-dark.css)."; $animation-properties: functions.get-properties(); @if $overrides { $animation-properties: map.deep-merge($animation-properties, $overrides); } @each $key, $value in $animation-properties { #{common.get-property-name($key)}: $value; } }
Parameters
| parameter Name | parameter Description | parameter Type | parameter Default value |
|---|---|---|---|
$overrides | Map that overrides matching custom property values. | Map | null |
Requires
- [function]
get-properties - [function]
get-property-name
apply
@mixin apply($animation-style...) { ... }@mixin apply($animation-style...) { $variant: functions.get-last-item($animation-style); $animation-style: functions.remove-last-item($animation-style); $style: map.get(settings.$animations, $animation-style...); $not-rendered: true; @each $name in map.keys($style) { $is-variant-match: string.index($name, '-#{$variant}') != null; $is-subtle: string.index($name, '-subtle') != null; $is-standard: string.index($name, '-standard') != null; $value: map.get($style, $name); $valueType: ''; @if $is-variant-match { @if $is-subtle { $valueType: common.str-replace($name, '-subtle', ''); } @else if $is-standard { $valueType: common.str-replace($name, '-standard', ''); } @else { $valueType: $name; } } @if $valueType == 'duration' or $valueType == 'function' { $fallback: #{map.get($style, $name)}; $value: string.unquote('var(#{$value}, #{$fallback})'); --animation-press-scale-#{$valueType}: #{$value}; } @else if ($valueType == 'amount' or $valueType == 'amount-hover') and $is-variant-match { $property: common.get-property-name('animation', list.append($animation-style, $name)); $fallback: #{map.get($style, $name)}; $value: string.unquote('var(#{$property}, #{$fallback})'); --animation-press-scale-#{$valueType}: #{$value}; } } $animation-press-scale-amount-standard: 0; $animation-press-scale-amount-subtle: 0; $animation-press-scale-amount-standard-hover: 0; $animation-press-scale-amount-subtle-hover: 0; @each $name in map.keys($style) { $is-variant-match: string.index($name, '-#{$variant}') != null; $is-variant-match-string: 'false'; @if string.index($name, '-#{$variant}') { $is-variant-match-string: 'true'; } $is-subtle: string.index($name, '-subtle') != null; $is-standard: string.index($name, '-standard') != null; $value: map.get($style, $name); $valueType: ''; @if $is-variant-match { @if $is-subtle { $valueType: common.str-replace($name, '-subtle', ''); } @else if $is-standard { $valueType: common.str-replace($name, '-standard', ''); } @else { $valueType: $name; } } @if ($is-subtle or $is-standard) { @if $is-variant-match { --animation-press-scale-#{$valueType}: #{map.get($style, $name)}; } } @else { --animation-press-scale-#{$name}: #{map.get($style, $name)}; } } // initial - important for iOS transform: scale3d( settings.$animation-press-scale-amount-initial, settings.$animation-press-scale-amount-initial, 1 ); // duration transition: transform var(--animation-press-scale-duration, #{map.get($style, 'duration')}) var(--animation-press-scale-function, #{map.get($style, 'function')}); @media (hover: hover) and (pointer: fine) { &:hover { transform: scale3d( var(--animation-press-scale-amount-hover), var(--animation-press-scale-amount-hover), 1 ); } } // normal &:active { transform: scale3d(var(--animation-press-scale-amount), var(--animation-press-scale-amount), 1); } // reduced motion @media (prefers-reduced-motion: reduce) { transition: none; } @each $name in map.keys($style) { $is-variant-match: string.index($name, '-#{$variant}') != null; $is-variant-match-string: 'false'; @if string.index($name, '-#{$variant}') { $is-variant-match-string: 'true'; } $is-subtle: string.index($name, '-subtle') != null; $is-standard: string.index($name, '-standard') != null; $value: map.get($style, $name); $valueType: ''; $newNewName: string.quote(common.str-replace(string.quote($name), '-subtle', '')); @if $is-variant-match { @if $is-subtle { $valueType: common.str-replace($name, '-subtle', ''); } @else if $is-standard { $valueType: common.str-replace($name, '-standard', ''); } @else { $valueType: $name; } } } }
Description
Generate styles using custom properties from a defined animation style. The apply mixin reads animation token values from the Sass map and sets local --animation-press-scale-* custom properties inline.
Parameters
| parameter Name | parameter Description | parameter Type | parameter Default value |
|---|---|---|---|
$animation-style... | The animation style path and variant | String | — none |
Example
Apply styles for a animation style definition
@use '~@chewy/kib-foundations/src/animation';
.my-custom-class {
@include animation.apply('press', 'scale', 'standard');
}Requires
- [function]
get - [function]
str-replace - [function]
get-property-name - [variable]
animations - [variable]
animation-press-scale-amount-initial
Used by
- [mixin]
elevation
page-entry-common
@mixin page-entry-common($delay: '0') { ... }@mixin page-entry-common($delay: '0') { animation-delay: $delay; animation-fill-mode: both; }
Description
Page entry shared attributes
Parameters
| parameter Name | parameter Description | parameter Type | parameter Default value |
|---|---|---|---|
$delay | delay preset | Number | '0' |
Requires
- [variable]
delay
Used by
- [mixin]
page-entry-fade-up - [mixin]
page-entry-fade-in - [mixin]
page-entry-slide-up
page-entry-fade-up
@mixin page-entry-fade-up($delay: '0', $fade-duration: 'settings.$fade-transition-duration', $slide-duration: 'settings.$slide-transition-duration') { ... }@mixin page-entry-fade-up($delay: '0', $fade-duration: 'settings.$fade-transition-duration', $slide-duration: 'settings.$slide-transition-duration') { @include page-entry-common($delay); animation-name: kib-animation-page-entry-fade-in, kib-animation-page-entry-slide-up; animation-duration: $fade-duration, $slide-duration; @media (prefers-reduced-motion: reduce) { animation: none; } }
Description
Page entry fade up transition
Parameters
| parameter Name | parameter Description | parameter Type | parameter Default value |
|---|---|---|---|
$delay | delay preset | Number | '0' |
$fade-duration | fade duration preset | Number | 'settings.$fade-transition-duration' |
$slide-duration | slide duration preset | Number | 'settings.$slide-transition-duration' |
Requires
- [mixin]
page-entry-common - [variable]
delay
page-entry-fade-in
@mixin page-entry-fade-in($delay: '0', $duration: 'settings.$fade-transition-duration') { ... }@mixin page-entry-fade-in($delay: '0', $duration: 'settings.$fade-transition-duration') { @include page-entry-common($delay); animation-name: kib-animation-page-entry-fade-in; animation-duration: $duration; @media (prefers-reduced-motion: reduce) { animation: none; } }
Description
Page entry fade in transition
Parameters
| parameter Name | parameter Description | parameter Type | parameter Default value |
|---|---|---|---|
$delay | delay preset | Number | '0' |
$duration | duration preset | Number | 'settings.$fade-transition-duration' |
Requires
- [mixin]
page-entry-common - [variable]
delay - [variable]
duration
page-entry-slide-up
@mixin page-entry-slide-up($delay: '0', $duration: 'settings.$slide-transition-duration') { ... }@mixin page-entry-slide-up($delay: '0', $duration: 'settings.$slide-transition-duration') { @include page-entry-common($delay); animation-name: kib-animation-page-entry-slide-up; animation-duration: $duration; @media (prefers-reduced-motion: reduce) { animation: none; } }
Description
Page entry slide up transition
Parameters
| parameter Name | parameter Description | parameter Type | parameter Default value |
|---|---|---|---|
$delay | delay preset | Number | '0' |
$duration | duration preset | Number | 'settings.$slide-transition-duration' |
Requires
- [mixin]
page-entry-common - [variable]
delay - [variable]
duration