Skip to content

Convert Tokens to Style Dictionary 4 and Token Studio 1 #11391

@alisonailea

Description

@alisonailea

Check existing issues

Description

Requires a major refactor of calcite-design-tokens

This will remove several (now unnecessary) custom token transformer functions. Align with the latest Token Studio and Style Dictionary versions.

Blocked issues: #10051

Requirements checkoff

  • Reorganize files to align with the new StyleDictionary config format
  • Create new config files
  • Refactor or (re)write StyleDictionary functions
    • Transformers to match SD format
      • Calcite Transformation Group
      • Transform name to replace "-" with "minus" and "+" with "plus"
      • Transform name to remove the Tier
      • Transform name to remove the word "default"
      • Transform value of boxshadow for CSS platforms
      • Transform any number value to calculate sum
      • Transform px value to rem for space, size, font-size, etc.
      • Transform breakpoint value to px
    • Headers to match SD format
      • Default Calcite header for generated files
      • Calcite header for deprecated generated files
    • Formats to match SD format & normalize file names (aka "global --> semantic")
      • /css
        • breakpoints.css
        • classes.css (typography classes)
        • core.css
        • dark.css
        • light.css
        • semantic.css
        • global.css (deprecate)
        • index.css
          • import semantic.css and classes.css
          • Set light vars at :root
          • @media (prefers-color-scheme: light) { .calcite-mode-auto { …light vars } }
          • @media (prefers-color-scheme: dark) { .calcite-mode-auto { …dark vars } }
          • .calcite-mode-light { …light vars }
          • .calcite-mode-dark { …dark vars }
      • /scss
        • breakpoints.scss
        • classes.scss (typography mixins)
        • core.scss
        • dark.scss
        • light.scss
        • semantic.scss
        • global.css
          • Deprecate
          • merge semantic, light, & dark
        • index.scss
          • Import breakpoints.scss, global.scss, & mixins.scss
          • @mixin calcite-mode-light { …light vars }
          • @mixin calcite-mode-dark { …dark vars }
      • /es6
        • breakpoints.js
        • core.js
        • dark.js
        • light.js
        • semantic.js
        • global.js
          • merge semantic, light, & dark
          • deprecate
      • /js (internal)
        • core.js
        • global.js
          • merge semantic, light, & dark
          • deprecate
        • dark.js
        • light.js
        • semantic.js
      • /docs (internal)
        • core.json
        • global.json
          • merge semantic, light, & dark
          • deprecate
        • light.json
        • dark.json
        • semantic.json
    • Filters to match SD format
      • Source
      • Core
      • Breakpoints
      • Global
      • Light
      • Dark
      • Typography
  • Setup calcite color themes in Token Studio in Figma

Acceptance Criteria

@tokens-studio/sd-transforms is at or above v1.2.9
style-dictionary is at or above v4.3.2

Run npm run build

packages/calcite-design-tokens/dist includes the following assets

/css
  breakpoints.css
  core.css
  dark.css
  index.css
  light.css
  semantic.css
/scss
  breakpoints.scss
  core.scss
  dark.scss
  index.scss
  light.scss
  semantic.scss
/es6
  breakpoints.js
  core.js
  dark.js
  global.js
  light.js
  semantic.js
/js
  core.js
  dark.js
  global.js
  light.js
  semantic.js
/docs
  core.json
  dark.json
  global.json
  light.json
  semantic.json

Relevant Info

Required to resolve:

#10618
#10993
#8856

Which Component

tokens

Example Use Case

No response

Priority impact

impact - p2 - want for an upcoming milestone

Calcite package

  • @esri/calcite-components
  • @esri/calcite-components-react
  • @esri/calcite-design-tokens
  • @esri/calcite-ui-icons
  • @esri/eslint-plugin-calcite-components

Esri team

N/A

Metadata

Metadata

Labels

4 - verifiedIssues that have been tested, confirmed as mitigated, and are ready to close.enhancementIssues tied to a new feature or request.estimate - 8Requires input from team, consider smaller steps.p - highIssue should be addressed in the current milestone, impacts component or core functionality

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions