From 7032b5be88cdd1a7c27225c566043d426f7076d9 Mon Sep 17 00:00:00 2001 From: Corban Riley Date: Mon, 23 Sep 2024 11:13:14 -0400 Subject: [PATCH] Adding z-index design tokens to css variables --- src/css/sprinkles.css.ts | 12 +------- .../design-system/DesignTokens.stories.mdx | 29 ++++++++++++++----- src/tokens/index.ts | 2 ++ src/tokens/z-index.ts | 11 +++++++ 4 files changed, 35 insertions(+), 19 deletions(-) create mode 100644 src/tokens/z-index.ts diff --git a/src/css/sprinkles.css.ts b/src/css/sprinkles.css.ts index b65f2dfad..ba485e185 100644 --- a/src/css/sprinkles.css.ts +++ b/src/css/sprinkles.css.ts @@ -139,17 +139,7 @@ const unresponsiveProperties = defineProperties({ whiteSpace: ['normal', 'nowrap', 'initial', 'inherit'], wordBreak: ['break-word'], wordWrap: ['normal', 'break-word', 'initial', 'inherit'], - zIndex: { - '-1': -1, - '0': 0, - '1': 1, - '10': 10, - '20': 20, - '30': 30, - '40': 40, - '50': 50, - auto: 'auto', - }, + zIndex: vars.zIndex, aspectRatio: { '1/1': '1 / 1', '16/9': '16 / 9', diff --git a/src/docs/design-system/DesignTokens.stories.mdx b/src/docs/design-system/DesignTokens.stories.mdx index d42374af6..06bb59c24 100644 --- a/src/docs/design-system/DesignTokens.stories.mdx +++ b/src/docs/design-system/DesignTokens.stories.mdx @@ -7,10 +7,11 @@ import { tokens } from '../../tokens' # Design Tokens Design tokens are the data representaion, the base properties and their values, on which design system is constructed. These tokens define spacing, typography, weights, colors, animation, shadows, etc. +The tokens map to CSS variables and are used to maintain consistency across the design system. ### Space -**tokens.space** +**tokens.space** --seq-space-[value]
{Object.entries(tokens.space).map(([key, value]) => ( @@ -22,7 +23,7 @@ Design tokens are the data representaion, the base properties and their values, ### Border -**tokens.radii** +**tokens.radii** --seq-radii-[value]
{Object.entries(tokens.radii).map(([key, value]) => ( @@ -32,7 +33,7 @@ Design tokens are the data representaion, the base properties and their values, ))}
-**tokens.borderWidths** +**tokens.borderWidths** --seq-border-widths-[value]
{Object.entries(tokens.borderWidths).map(([key, value]) => ( @@ -42,9 +43,21 @@ Design tokens are the data representaion, the base properties and their values, ))}
+### Z-Index + +**tokens.zIndex** --seq-z-index-[value] + +
+ {Object.entries(tokens.zIndex).map(([key, value]) => ( +
  • + {key}: {value} (--seq-z-index-{value}) +
  • + ))} +
    + ### Typography -**tokens.fonts** +**tokens.fonts** --seq-fonts-[value]
    {Object.entries(tokens.fonts).map(([key, value]) => ( @@ -54,7 +67,7 @@ Design tokens are the data representaion, the base properties and their values, ))}
    -**tokens.fontSizes** +**tokens.fontSizes** --seq-font-sizes-[value]
    {Object.entries(tokens.fontSizes).map(([key, value]) => ( @@ -64,7 +77,7 @@ Design tokens are the data representaion, the base properties and their values, ))}
    -**tokens.fontWeights** +**tokens.fontWeights** --seq-font-weights-[value]
    {Object.entries(tokens.fontWeights).map(([key, value]) => ( @@ -74,7 +87,7 @@ Design tokens are the data representaion, the base properties and their values, ))}
    -**tokens.letterSpacings** +**tokens.letterSpacings** --seq-letterSpacings-[value]
    {Object.entries(tokens.letterSpacings).map(([key, value]) => ( @@ -84,7 +97,7 @@ Design tokens are the data representaion, the base properties and their values, ))}
    -**tokens.lineHeights** +**tokens.lineHeights** --seq-line-heights-[value]
    {Object.entries(tokens.lineHeights).map(([key, value]) => ( diff --git a/src/tokens/index.ts b/src/tokens/index.ts index 83b51e6ff..2898996ae 100644 --- a/src/tokens/index.ts +++ b/src/tokens/index.ts @@ -10,6 +10,7 @@ import { letterSpacings, lineHeights, } from './typography' +import { zIndex } from './z-index' export const tokens = { blur, @@ -23,6 +24,7 @@ export const tokens = { opacity, radii, space, + zIndex, } export { colors } from './color' diff --git a/src/tokens/z-index.ts b/src/tokens/z-index.ts new file mode 100644 index 000000000..a56b7e533 --- /dev/null +++ b/src/tokens/z-index.ts @@ -0,0 +1,11 @@ +export const zIndex = { + '-1': '-1', + '0': '0', + '1': '1', + '10': '10', + '20': '20', + '30': '30', + '40': '40', + '50': '50', + auto: 'auto', +}