Swatch

Mixins

heading

@mixin heading() { ... }@mixin heading() { 
  @include typography.style-as('paragraph-2');

  color: color.get('text', 'secondary');
  margin-bottom: spacing.get('s2');
 }
Description

Group section heading styles

Parameters

None.

Requires

group

@mixin group() { ... }@mixin group() { 
  display: flex;
  gap: spacing.get('s2');
  flex-wrap: wrap;
  padding: spacing.get('s1');
  margin-left: calc(spacing.get('s1') * -1);
  margin-right: calc(spacing.get('s1') * -1);
  position: relative;

  // Small screens like mweb, vertical tablet
  @include media.query('max-md') {
    @include horizontal-scroll;
  }
 }
Description

Group section child container

Parameters

None.

Requires

text-swatch

@mixin text-swatch() { ... }@mixin text-swatch() { 
  @include swatch-shared-styles;

  min-width: settings.$text-swatch-container-min-width;
  max-width: settings.$text-swatch-container-max-width;
  min-height: settings.$text-swatch-container-min-height;
  position: relative;
  padding: spacing.get('s2', 's3');
  text-align: left;
  flex: 0 0 auto;
 }
Description

Text swatch base styles

Parameters

None.

text-swatch-header

@mixin text-swatch-header() { ... }@mixin text-swatch-header() { 
  @include typography.style-as('paragraph-2');

  color: color.get('link', 'active', 'primary');
 }
Description

Text swatch header section

Parameters

None.

Requires

text-swatch-details

@mixin text-swatch-details() { ... }@mixin text-swatch-details() { 
  @include typography.style-as('caption');

  color: color.get('text', 'secondary');

  &:not(:last-child) {
    margin-bottom: spacing.get('s2');
  }
 }
Description

Swatch details section

Parameters

None.

Requires

meta

@mixin meta() { ... }@mixin meta() { 
  @include typography.style-as('caption');

  // Floats text to bottom
  margin-top: auto;
 }
Description

Swatch meta section

Parameters

None.

selected

@mixin selected() { ... }@mixin selected() { 
  --kib-swatch-border-width: #{settings.$selected-border-width};
  --kib-swatch-border-color: #{color.get('action', 'selection-control', 'on', 'primary')};

  &:focus {
    --kib-swatch-border-color: #{color.get('action', 'selection-control', 'on', 'primary')};
  }

  &:active {
    --kib-swatch-background-color: #{color.get('action', 'cta', 'alternate', '02')};
  }

  @media (forced-colors: active) {
    border-color: Highlight !important;
  }
 }
Description

Selected swatch styles

Parameters

None.

Requires

unavailable

@mixin unavailable() { ... }@mixin unavailable() { 
  --kib-swatch-border-color: #{color.get('ui-bg', '07')};

  color: color.get('text', 'secondary');

  &:hover {
    --kib-swatch-border-color: #{color.get('ui-bg', '05')};
    --kib-swatch-background-color: #{color.get('action', 'utility', 'alternate', '03')};
  }

  &:focus {
    --kib-swatch-border-color: #{color.get('ui-bg', '05')};
    --kib-swatch-outline-color: #{color.get('action', 'cta', 'alternate', '02')};
  }

  &:active {
    --kib-swatch-border-color: #{color.get('action', 'selection-control', 'off', '02')};
    --kib-swatch-background-color: #{color.get('action', 'utility', 'alternate', '02')};
  }
 }
Description

Unavailable swatch styles

Parameters

None.

Requires

both-selected-unavailable

@mixin both-selected-unavailable() { ... }@mixin both-selected-unavailable() { 
  --kib-swatch-border-color: #{color.get('ui-bg', '05')};

  &:hover,
  &:focus {
    --kib-swatch-border-color: #{color.get('ui-bg', '06')};
  }
 }
Description

Swatch is selected and unavailable

Parameters

None.

Requires

unavailable-text-with-strikethru

@mixin unavailable-text-with-strikethru() { ... }@mixin unavailable-text-with-strikethru() { 
  @include typography.style-as('price-x-small-strikethrough');

  color: color.get('text', 'secondary');

  @media (forced-colors: active) {
    color: GrayText;
  }
 }
Description

Text decorator for unavailable items

Parameters

None.

Requires

unavailable-text-indeterminate

@mixin unavailable-text-indeterminate() { ... }@mixin unavailable-text-indeterminate() { 
  color: color.get('text', 'secondary');

  @media (forced-colors: active) {
    color: GrayText;
  }
 }
Description

Text decorator for indeterminate items

Parameters

None.

Requires

text-swatch-text-only

@mixin text-swatch-text-only() { ... }@mixin text-swatch-text-only() { 
  text-align: center;
  justify-content: center;
 }
Description

Text-only styles, no extra content in swatch

Parameters

None.

image-swatch

@mixin image-swatch() { ... }@mixin image-swatch() { 
  @include swatch-shared-styles;

  width: min-content;
  min-width: settings.$image-swatch-min-width;
  padding: spacing.get('s2');
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;

  img {
    display: block;
    max-height: 100%;
    max-width: 100%;
    width: settings.$image-swatch-image-width;
    border-radius: settings.$inner-border-radius;
    margin-left: auto;
    margin-right: auto;
  }
 }
Description

Base styles for image swatch

Parameters

None.

Requires

image-swatch-header

@mixin image-swatch-header() { ... }@mixin image-swatch-header() { 
  @include typography.style-as('caption');

  margin-bottom: unit.rem(2px);
  color: color.get('text', 'primary');
 }
Description

Swatch header section

Parameters

None.

Requires

image-strikethrough

@mixin image-strikethrough() { ... }@mixin image-strikethrough() { 
  position: relative;
  width: 100%;
  background-color: transparent;

  img {
    opacity: 0.5;
  }

  &::before {
    content: '';
    position: absolute;
    top: spacing.get('s1');
    left: spacing.get('s1');
    right: spacing.get('s1');
    bottom: spacing.get('s1');
    background-image: linear-gradient(
      to top right,
      transparent calc(50% - #{settings.$strikethrough-height}),
      #{color.get('static', 'gray1', '900')},
      transparent calc(50% + #{settings.$strikethrough-height})
    );
    forced-color-adjust: none;
    z-index: 2;
  }
 }
Description

Creates a slash that can be overlaid on an image

Parameters

None.

Requires

swatch-shared-styles

@mixin swatch-shared-styles() { ... }@mixin swatch-shared-styles() { 
  display: flex;
  gap: unit.rem(2px);
  align-items: stretch;
  flex-direction: column;
  justify-content: flex-start;
  text-align: left;
  border: 0;
  outline: transparent;
  box-shadow: 0 0 0 var(--kib-swatch-border-width, #{settings.$unselected-border-width})
      var(--kib-swatch-border-color, #{color.get('ui-bg', '05')}) inset,
    0 0 0 var(--kib-swatch-outline-width, 0)
      var(--kib-swatch-outline-color, #{color.get('action', 'cta', 'alternate', '02')});
  background-color: var(
    --kib-swatch-background-color,
    #{color.get('action', 'utility', 'alternate', 'primary')}
  );
  border-radius: settings.$border-radius;
  color: color.get('text', 'primary');
  cursor: pointer;

  &:hover {
    --kib-swatch-border-color: #{color.get('action', 'selection-control', 'off', '02')};
    --kib-swatch-background-color: #{color.get('action', 'cta', 'alternate', '03')};
  }

  &:focus {
    --kib-swatch-outline-width: #{settings.$text-swatch-box-shadow-focus};
    --kib-swatch-border-color: #{color.get('action', 'selection-control', 'off', '02')};
  }

  &:active {
    --kib-swatch-background-color: #{color.get('action', 'cta', 'alternate', '02')};
    --kib-swatch-outline-width: 0;
  }
 }
Description

Shared styles between text and image swatch

Parameters

None.

Requires
Used by

large

@mixin large() { ... }@mixin large() { 
  min-width: settings.$large-min-width;

  img {
    width: settings.$large-image-width;
  }
 }
Description

Specifications for large-format swatch

Parameters

None.

Requires

horizontal-scroll

@mixin horizontal-scroll() { ... }@mixin horizontal-scroll() { 
  display: flex;
  flex-wrap: nowrap;
  overflow: auto hidden;

  // Hide scrollbar but still allow horizontal scroll
  @include kib-scroller.hide-scrollbar;
 }
Description

Allows horizontal scroll and hides the scrollbar

Parameters

None.

Used by

wrap-layout

@mixin wrap-layout() { ... }@mixin wrap-layout() { 
  @include media.query('max-md') {
    display: flex;
    gap: spacing.get('s2');
    flex-wrap: wrap;
  }
 }
Description

Overrides the default responsive layout to force swatch container to always wrap and never scroll

Parameters

None.

Requires

row-layout

@mixin row-layout() { ... }@mixin row-layout() { 
  @include media.query('min-lg') {
    @include horizontal-scroll;
  }
 }
Description

Overrides the default responsive layout to force swatch container to scroll horizontally

Parameters

None.

Requires

Variables

unselected-border-width

$unselected-border-width: unit.rem(1px);
Description

Unselected border width

Type

Number

Used by
Author
  • CDS

selected-border-width

$selected-border-width: unit.rem(2px);
Description

Selected border width

Type

Number

Used by
Author
  • CDS

border-radius

$border-radius: unit.rem(8px);
Description

Border radius

Type

Number

Author
  • CDS

inner-border-radius

$inner-border-radius: unit.rem(4px);
Description

Inner border radius for image swatch

Type

Number

Used by
Author
  • CDS

text-swatch-container-min-width

$text-swatch-container-min-width: unit.rem(60px);
Description

Text Swatch container minimum width

Type

Number

Used by
Author
  • CDS

text-swatch-container-max-width

$text-swatch-container-max-width: unit.rem(200px);
Description

Text Swatch container maximum width

Type

Number

Used by
Author
  • CDS

text-swatch-container-min-height

$text-swatch-container-min-height: unit.rem(45px);
Description

Text Swatch container minimum height

Type

Number

Used by
Author
  • CDS

text-swatch-box-shadow-focus

$text-swatch-box-shadow-focus: unit.rem(3px);
Description

Text Swatch box focus box shadow

Type

Number

Used by
Author
  • CDS

text-swatch-small-container-width

$text-swatch-small-container-width: calc(100vw - spacing.get('s7'));
Description

Text swatch small container width

Type

Number

Author
  • CDS

image-swatch-min-width

$image-swatch-min-width: unit.rem(78px);
Description

Image swatch minimum width

Type

Number

Used by
Author
  • CDS

image-swatch-image-width

$image-swatch-image-width: unit.rem(62px);
Description

Image swatch image width

Type

Number

Used by
Author
  • CDS

large-min-width

$large-min-width: unit.rem(100px);
Description

Swatch minimum width large override

Type

Number

Used by
Author
  • CDS

large-image-width

$large-image-width: unit.rem(84px);
Description

Large image swatch width override

Type

Number

Used by
Author
  • CDS

strikethrough-height

$strikethrough-height: unit.rem(1px);
Description

Swatch strikethrough height

Type

Number

Used by
Author
  • CDS