Border
Installation
yarn add @chewy/kib-foundations
Import
@use '~@chewy/kib-foundations/src/border';
Functions
get-properties
@function get-properties($theme: common.$default-theme) { ... }
@function get-properties($theme: common.$default-theme) { $theme-map: common.get-theme-map(settings.$themes, $theme); @return common.flatten-map($theme-map); }
Description
Returns a border tokens theme as a flattened map
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$theme | Name of the theme | String | common.$default-theme |
Returns
Map
—Flattened map
Requires
- [function]
get-theme-map
- [function]
flatten-map
- [variable]
themes
Used by
- [mixin]
custom-properties
- [mixin]
custom-properties
get
@function get($alias) { ... }
@function get($alias) { $theme-map: common.get-theme-map(settings.$themes, common.$default-theme); $property: common.get-property-name('border', $alias); $fallback: -get-fallback($alias); @return var(#{$property}, #{$fallback}); }
Description
Creates a border custom property with the fallback value from the default theme.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$alias | Border token alias | String | — none |
Returns
Customproperty
—CSS var()
function with fallback value
Example
Basic usage
@use '~@chewy/kib-foundations/src/border';
.example {
border-radius: border.get('br01');
}
Requires
- [function]
get-theme-map
- [function]
get-property-name
- [function]
-get-fallback
- [variable]
themes
- [variable]
default-theme
Used by
- [mixin]
root-container
- [mixin]
item-header-wrapper
- [mixin]
item-trigger-wrapper
- [mixin]
item-content
- [mixin]
item-content-open
- [mixin]
item-close-button-focused
- [mixin]
title
- [mixin]
actions
- [mixin]
actions-dismissible
- [mixin]
action-trigger
- [mixin]
font-styles-x
- [function]
-get-fallback
- [function]
-get-themes
- [mixin]
root-container
- [mixin]
list
- [mixin]
item
- [function]
height-calc
- [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-deselected-styles
- [mixin]
chip-action-disabled-styles
- [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]
chip-selected-styles
- [mixin]
container-styles
- [mixin]
child-styles
- [mixin]
choice-root
- [mixin]
choice-append-container
- [mixin]
range-label
- [mixin]
rating-heading
- [mixin]
rating-control
- [mixin]
icon-focus-indicator
- [mixin]
active-colors
- [mixin]
inactive-colors
- [mixin]
count
- [mixin]
action
- [mixin]
control-fill
- [mixin]
label
- [function]
-get-color
- [function]
-get-valid-path
- [function]
get-theme-colorset-properties
- [mixin]
controls-container
- [mixin]
rotate-control
- [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
- [mixin]
content
- [mixin]
heading
- [mixin]
messaging
- [mixin]
heading-lg
- [mixin]
root-container
- [mixin]
label-required
- [mixin]
field
- [mixin]
icon-with-action
- [mixin]
action-wrapper
- [mixin]
action
- [mixin]
error-message
- [mixin]
error-icon
- [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
- [mixin]
nav
- [mixin]
pagination-button
- [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]
content
- [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]
item-active
- [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]
normalize-blocks
- [mixin]
normalize-text
- [mixin]
normalize-lists
- [mixin]
normalize-code
- [mixin]
root-container
- [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]
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]
icon
- [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]
root-container
- [mixin]
count-wrapper
- [mixin]
action
- [mixin]
root-container
- [mixin]
icon-container
- [mixin]
input-container
- [mixin]
helper-text
- [mixin]
title
- [mixin]
read-only-input
- [mixin]
header-wrapper
- [mixin]
header-small
- [mixin]
subheading
- [mixin]
card-root
- [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-styles
- [mixin]
text-skeleton
- [mixin]
label
- [mixin]
actions
- [mixin]
actions-stacked
- [mixin]
action
- [function]
-get-themes
- [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]
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-active
- [mixin]
tag-variant
- [mixin]
secondary-variant
- [mixin]
button-variant
- [mixin]
button-variant-hover
- [mixin]
tooltip
- [mixin]
trigger
- [mixin]
content
- [function]
get-weight
- [function]
get-type-style-with-fallback
- [function]
get-type-style-variant-weight
- [function]
-get-type-style-value
- [mixin]
style-as
- [function]
-get-spacing-value
- [mixin]
base
- [mixin]
item-base
-get-fallback
@function -get-fallback($alias, $theme: common.$default-theme) { ... }
@function -get-fallback($alias, $theme: common.$default-theme) { $theme-map: common.get-theme-map(settings.$themes, common.$default-theme); $has-key: map.has-key($theme-map, $alias); @if not $has-key { @error "Border token not found: '#{$alias}'"; } @return map.get($theme-map, $alias); }
Description
Retrieves a border token fallback value from the default theme
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$alias | Alias of spacing unit | String | — none |
$theme | Name of the theme | String | common.$default-theme |
Returns
Number
—Fallback value in rem unit
Throws
Border token not found:
Requires
- [function]
get-theme-map
- [function]
get
- [variable]
themes
- [variable]
default-theme
Used by
- [function]
get
-get-themes
@function -get-themes($tokens) { ... }
@function -get-themes($tokens) { $themes: (); @each $name, $theme in $tokens { $themes: map.set($themes, $name, map.get($theme, 'border')); } @return $themes; }
Description
Returns only border groups from spacing tokens map. Defined here to avoid a module loop.
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$tokens | Spacing tokens map | Map | — none |
Returns
Map
—Border themes definitions map
Mixins
custom-properties
@mixin custom-properties($overrides) { ... }
@mixin custom-properties($overrides) { $border-properties: functions.get-properties($theme); @if $overrides { $border-properties: map.deep-merge($border-properties, $overrides); } @each $key, $value in $border-properties { #{common.get-property-name('border', $key)}: $value; } }
Description
Generates CSS Custom Properties for a Chirp's theme set of border tokens
Parameters
parameter Name | parameter Description | parameter Type | parameter Default value |
---|---|---|---|
$overrides | Map of overrides that should match values within the theme map | Map | — none |
Example
Apply all available properties to the :root
of the page
@use '~@chewy/kib-foundations/src/border';
:root {
@include border.custom-properties;
}
Apply properties to a selector
@use '~@chewy/kib-foundations/src/border';
.chirp-theme {
@include border.custom-properties;
}
Override a property
@use '~@chewy/kib-foundations/src/border';
.custom-properties {
@include border.custom-properties($overrides: ('br02': 1.2rem));
}
Requires
- [function]
get-properties
- [function]
get-property-name
Variables
themes
$themes: (...);
$themes: -get-themes(tokens.$chirp-spacings);
Description
Map of border token themes
Type
Map
Used by
- [function]
get-properties
- [function]
get
- [function]
-get-fallback
- [function]
-get-themes
- [function]
get-theme-map
- [function]
-get-themes
- [function]
get-type-style-with-fallback
- [function]
get-type-style-variant-weight
- [function]
get-properties
- [function]
-get-type-style-value
- [function]
-get-type-style-property
- [function]
-get-spacing-value
- [function]
get-properties