@esri/calcite-design-tokens 1.1.1-next.0 → 2.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/README.md +7 -9
  2. package/dist/css/breakpoint.css +29 -0
  3. package/dist/css/classes.css +327 -0
  4. package/dist/css/core.css +344 -0
  5. package/dist/css/dark.css +45 -0
  6. package/dist/css/global.css +103 -0
  7. package/dist/css/index.css +176 -0
  8. package/dist/css/light.css +45 -0
  9. package/dist/es6/core.d.ts +342 -0
  10. package/dist/es6/core.js +342 -0
  11. package/dist/es6/global.d.ts +207 -0
  12. package/dist/es6/global.js +207 -0
  13. package/dist/js/core.d.ts +466 -0
  14. package/dist/js/core.js +8795 -0
  15. package/dist/js/global.d.ts +331 -0
  16. package/dist/js/global.js +6597 -0
  17. package/dist/scss/breakpoints.scss +37 -0
  18. package/dist/scss/core.scss +342 -0
  19. package/dist/scss/dark.scss +43 -0
  20. package/dist/scss/index.scss +92 -0
  21. package/dist/scss/light.scss +43 -0
  22. package/dist/scss/mixins.scss +342 -0
  23. package/package.json +28 -21
  24. package/.eslintrc.cjs +0 -85
  25. package/.turbo/turbo-build.log +0 -7036
  26. package/.turbo/turbo-test.log +0 -14
  27. package/CHANGELOG.md +0 -25
  28. package/CONTRIBUTING.md +0 -41
  29. package/dist/css/brand-light.css +0 -9
  30. package/dist/css/calcite-dark.css +0 -504
  31. package/dist/css/calcite-headless.css +0 -2615
  32. package/dist/css/calcite-light.css +0 -507
  33. package/dist/es6/brand-light.d.ts +0 -7
  34. package/dist/es6/brand-light.js +0 -7
  35. package/dist/es6/calcite-dark.d.ts +0 -502
  36. package/dist/es6/calcite-dark.js +0 -502
  37. package/dist/es6/calcite-headless.d.ts +0 -2613
  38. package/dist/es6/calcite-headless.js +0 -2613
  39. package/dist/es6/calcite-light.d.ts +0 -505
  40. package/dist/es6/calcite-light.js +0 -505
  41. package/dist/js/brand-light.d.ts +0 -72
  42. package/dist/js/brand-light.js +0 -95
  43. package/dist/js/calcite-dark.d.ts +0 -563
  44. package/dist/js/calcite-dark.js +0 -10024
  45. package/dist/js/calcite-headless.d.ts +0 -1730
  46. package/dist/js/calcite-headless.js +0 -50082
  47. package/dist/js/calcite-light.d.ts +0 -544
  48. package/dist/js/calcite-light.js +0 -10090
  49. package/dist/scss/calcite-dark.scss +0 -535
  50. package/dist/scss/calcite-headless.scss +0 -3012
  51. package/dist/scss/calcite-light.scss +0 -538
  52. package/jest.config.json +0 -16
  53. package/src/$metadata.json +0 -76
  54. package/src/$themes.json +0 -2363
  55. package/src/brand/dark.json +0 -1
  56. package/src/brand/global.json +0 -1
  57. package/src/brand/light.json +0 -20
  58. package/src/calcite/dark.json +0 -2488
  59. package/src/calcite/light.json +0 -2508
  60. package/src/component/accordion-item.json +0 -172
  61. package/src/component/accordion.json +0 -192
  62. package/src/component/action-bar-grid.json +0 -66
  63. package/src/component/action-bar.json +0 -66
  64. package/src/component/action-pad-grid.json +0 -80
  65. package/src/component/action-pad.json +0 -80
  66. package/src/component/action.json +0 -156
  67. package/src/component/alert.json +0 -258
  68. package/src/component/avatar.json +0 -140
  69. package/src/component/block-section.json +0 -124
  70. package/src/component/block.json +0 -198
  71. package/src/component/button.json +0 -650
  72. package/src/component/card.json +0 -116
  73. package/src/component/checkbox.json +0 -110
  74. package/src/component/chip.json +0 -382
  75. package/src/component/color-picker.json +0 -148
  76. package/src/component/combobox.json +0 -152
  77. package/src/component/date-picker.json +0 -354
  78. package/src/component/dropdown-item.json +0 -384
  79. package/src/component/dropdown.json +0 -58
  80. package/src/component/fab.json +0 -490
  81. package/src/component/filter.json +0 -174
  82. package/src/component/icon.json +0 -18
  83. package/src/component/input-date-picker.json +0 -224
  84. package/src/component/input-datetime-local.json +0 -230
  85. package/src/component/input-email.json +0 -244
  86. package/src/component/input-file.json +0 -244
  87. package/src/component/input-message.json +0 -72
  88. package/src/component/input-month.json +0 -244
  89. package/src/component/input-number.json +0 -244
  90. package/src/component/input-password.json +0 -244
  91. package/src/component/input-search.json +0 -244
  92. package/src/component/input-telephone.json +0 -244
  93. package/src/component/input-text.json +0 -244
  94. package/src/component/input-time.json +0 -1
  95. package/src/component/input-week.json +0 -244
  96. package/src/component/label.json +0 -26
  97. package/src/component/link.json +0 -44
  98. package/src/component/loader.json +0 -130
  99. package/src/component/modal.json +0 -278
  100. package/src/component/notice.json +0 -280
  101. package/src/component/pagination.json +0 -152
  102. package/src/component/panel-header.json +0 -88
  103. package/src/component/popover.json +0 -170
  104. package/src/component/radio.json +0 -124
  105. package/src/component/rating.json +0 -243
  106. package/src/component/scrim.json +0 -18
  107. package/src/component/segmented-control.json +0 -154
  108. package/src/component/slider-histogram-range.json +0 -284
  109. package/src/component/slider-histogram.json +0 -280
  110. package/src/component/slider-range.json +0 -226
  111. package/src/component/slider.json +0 -226
  112. package/src/component/split-button.json +0 -830
  113. package/src/component/stepper-item.json +0 -372
  114. package/src/component/stepper.json +0 -152
  115. package/src/component/switch.json +0 -178
  116. package/src/component/tab-title.json +0 -228
  117. package/src/component/tabs.json +0 -242
  118. package/src/component/textarea.json +0 -200
  119. package/src/component/time-picker.json +0 -138
  120. package/src/component/tip-manager.json +0 -118
  121. package/src/component/tip.json +0 -114
  122. package/src/component/tooltip.json +0 -66
  123. package/src/component/tree-item.json +0 -176
  124. package/src/core.json +0 -1833
  125. package/src/semantic.json +0 -1709
  126. package/support/run.ts +0 -16
  127. package/support/token-transformer/format/javascript.ts +0 -22
  128. package/support/token-transformer/format/scss.ts +0 -81
  129. package/support/token-transformer/getThemes.ts +0 -41
  130. package/support/token-transformer/parse/expandComposites.test.ts +0 -144
  131. package/support/token-transformer/parse/expandComposites.ts +0 -72
  132. package/support/token-transformer/sd-run.ts +0 -191
  133. package/support/token-transformer/transform/nameCamelCase.test.ts +0 -36
  134. package/support/token-transformer/transform/nameCamelCase.ts +0 -15
  135. package/support/token-transformer/transform/nameKebabCase.test.ts +0 -36
  136. package/support/token-transformer/transform/nameKebabCase.ts +0 -26
  137. package/support/token-transformer/utils/compositeTokens.test.ts +0 -133
  138. package/support/token-transformer/utils/compositeTokens.ts +0 -103
  139. package/support/token-transformer/utils/convertTokenToStyleDictionaryFormat.ts +0 -20
  140. package/support/token-transformer/utils/matchList.ts +0 -11
  141. package/support/token-transformer/utils/parseName.ts +0 -18
  142. package/support/token-transformer/utils/parseTokenPath.ts +0 -19
  143. package/support/token-transformer/utils/regex.ts +0 -9
  144. package/support/token-transformer/utils/sortAllTokens.ts +0 -12
  145. package/support/token-transformer/utils/transformOptions.ts +0 -31
  146. package/tsconfig-base.json +0 -17
  147. package/tsconfig-eslint.json +0 -4
  148. package/tsconfig.json +0 -4
@@ -1,133 +0,0 @@
1
- import { expandToken, shouldExpand } from "./compositeTokens";
2
-
3
- const mockHandleValue = jest.fn((val) => val);
4
-
5
- describe("expand composite token", () => {
6
- it("should expand a non-shadow token", () => {
7
- const mockTypographyToken = {
8
- value: {
9
- fontFamily: "$core.font.font-family.primary",
10
- fontWeight: "$core.font.font-weight.light",
11
- lineHeight: "$core.font.line-height.fixed.0",
12
- fontSize: "$core.font.font-size.0",
13
- letterSpacing: "$core.font.letter-spacing.normal",
14
- paragraphSpacing: "$core.font.paragraph-spacing.normal",
15
- textDecoration: "$core.font.text-decoration.none",
16
- textCase: "$core.font.text-case.none",
17
- },
18
- type: "typography",
19
- };
20
- const mockExpandedTypographyToken = {
21
- "font-family": {
22
- value: "$core.font.font-family.primary",
23
- type: "font-family",
24
- },
25
- "font-weight": {
26
- value: "$core.font.font-weight.light",
27
- type: "font-weights",
28
- },
29
- "line-height": {
30
- value: "$core.font.line-height.fixed.0",
31
- type: "line-heights",
32
- },
33
- "font-size": {
34
- value: "$core.font.font-size.0",
35
- type: "font-size",
36
- },
37
- "letter-spacing": {
38
- value: "$core.font.letter-spacing.normal",
39
- type: "letter-spacing",
40
- },
41
- "paragraph-spacing": {
42
- value: "$core.font.paragraph-spacing.normal",
43
- type: "paragraph-spacing",
44
- },
45
- "text-decoration": {
46
- value: "$core.font.text-decoration.none",
47
- type: "font-style",
48
- },
49
- "text-case": {
50
- value: "$core.font.text-case.none",
51
- type: "text-case",
52
- },
53
- };
54
- const testExpandToken = expandToken(mockTypographyToken, false, mockHandleValue);
55
- expect(testExpandToken).toMatchObject(mockExpandedTypographyToken);
56
- });
57
- it("should expand a shadow token", () => {
58
- const mockShadowToken = {
59
- value: [
60
- {
61
- x: "0",
62
- y: "2",
63
- blur: "8",
64
- spread: "0",
65
- color: "rgba($core.color.neutral.blk-240, $core.opacity.4)",
66
- type: "dropShadow",
67
- },
68
- {
69
- x: "0",
70
- y: "4",
71
- blur: "16",
72
- spread: "0",
73
- color: "rgba($core.color.neutral.blk-240, $core.opacity.8)",
74
- type: "dropShadow",
75
- },
76
- ],
77
- type: "boxShadow",
78
- };
79
- const mockExpandedShadowToken = {
80
- "1": {
81
- x: {
82
- type: "dimension",
83
- value: "0",
84
- },
85
- y: {
86
- type: "dimension",
87
- value: "2",
88
- },
89
- blur: {
90
- type: "dimension",
91
- value: "8",
92
- },
93
- spread: {
94
- type: "dimension",
95
- value: "0",
96
- },
97
- color: {
98
- type: "color",
99
- value: "rgba($core.color.neutral.blk-240, $core.opacity.4)",
100
- },
101
- },
102
- };
103
- const testExpandToken = expandToken(mockShadowToken, true, mockHandleValue);
104
- expect(testExpandToken).toMatchObject(mockExpandedShadowToken);
105
- });
106
- });
107
-
108
- describe("shouldExpand", () => {
109
- const filePath = "./mockFile.json";
110
- const mockToken = {
111
- name: "testToken",
112
- type: "fontFamilies",
113
- value: "san-serif",
114
- };
115
-
116
- it("should return true", () => {
117
- // @ts-expect-error - type is fine here.
118
- const testExpand = shouldExpand(mockToken, true, filePath);
119
- expect(testExpand).toBe(true);
120
- });
121
- it("should return false", () => {
122
- // @ts-expect-error - type is fine here.
123
- const testExpand = shouldExpand(mockToken, false, filePath);
124
- expect(testExpand).toBe(false);
125
- });
126
- it("should use condition function", () => {
127
- const mockExpandFunction = jest.fn(() => true);
128
- // @ts-expect-error - type is fine here.
129
- const testExpand = shouldExpand(mockToken, mockExpandFunction, filePath);
130
- expect(testExpand).toBe(true);
131
- expect(mockExpandFunction).toHaveBeenCalled();
132
- });
133
- });
@@ -1,103 +0,0 @@
1
- import { ExpandFilter } from "../utils/transformOptions";
2
- import { matchPlaceholderElement } from "./regex.js";
3
- import { DesignToken } from "style-dictionary/types/DesignToken";
4
- import { SingleToken } from "@tokens-studio/types";
5
- import { paramCase } from "change-case";
6
-
7
- // A customized type map based off Token Studio.
8
- // This determines the applied "type" associated with each Style Dictionary token value
9
- const typeMaps = {
10
- boxShadow: {
11
- x: "dimension",
12
- y: "dimension",
13
- blur: "dimension",
14
- spread: "dimension",
15
- type: "other",
16
- color: "color",
17
- },
18
- border: {
19
- width: "border-width",
20
- style: "other",
21
- },
22
- composition: {
23
- typography: "font-size",
24
- fontWeight: "font-weight",
25
- },
26
- typography: {
27
- fontFamily: "font-family",
28
- fontWeight: "font-weights",
29
- lineHeight: "line-heights",
30
- fontSize: "font-size",
31
- letterSpacing: "letter-spacing",
32
- paragraphSpacing: "paragraph-spacing",
33
- textDecoration: "font-style",
34
- textCase: "text-case",
35
- },
36
- };
37
-
38
- /**
39
- * Get type from type map
40
- *
41
- * @param {string} key type
42
- * @param {DesignToken} compositeToken a Style Dictionary token
43
- * @returns {string} approved token type
44
- */
45
- export const getType = (key: string, compositeToken: DesignToken): string => typeMaps[compositeToken.type][key] ?? key;
46
-
47
- /**
48
- * This is a recursive function to dig into composite tokens and lift up the token values in a Style Dictionary format.
49
- *
50
- * @param {DesignToken} compositeToken the composite token object
51
- * @param {boolean} isShadow is a drop shadow?
52
- * @param {Function} handleValue a function to determine how the final token value string should be passed to Style Dictionary
53
- * @returns {DesignToken} a single Style Dictionary token object
54
- */
55
- export function expandToken(compositeToken: DesignToken, isShadow = false, handleValue = (v) => v): DesignToken {
56
- const expandedObj = {} as DesignToken;
57
-
58
- if (isShadow && Array.isArray(compositeToken.value)) {
59
- compositeToken.value.forEach((shadow, index) => {
60
- expandedObj[index + 1] = {};
61
- Object.entries(shadow).forEach(([key, value]) => {
62
- if (matchPlaceholderElement.test(`${value}`) || key === "type") {
63
- return;
64
- }
65
- expandedObj[index + 1][key] = {
66
- value: `${handleValue(value)}`,
67
- type: getType(key, compositeToken),
68
- };
69
- });
70
- });
71
- } else {
72
- Object.entries(compositeToken.value).forEach(([key, value]) => {
73
- const newKey = paramCase(key);
74
- if (matchPlaceholderElement.test(`${value}`)) {
75
- return;
76
- }
77
- expandedObj[newKey] = {
78
- value: `${handleValue(value)}`,
79
- type: getType(key, compositeToken),
80
- };
81
- });
82
- }
83
-
84
- return expandedObj;
85
- }
86
-
87
- /**
88
- *
89
- * @param {DesignToken} token Style Dictionary token object
90
- * @param {boolean | ExpandFilter<SingleToken>} condition check if the token should be expanded or not
91
- * @param {string} filePath the file path where the token came from
92
- * @returns {boolean} if the token should be expanded
93
- */
94
- export function shouldExpand<T extends SingleToken>(
95
- token: T,
96
- condition: boolean | ExpandFilter<T>,
97
- filePath: string
98
- ): boolean {
99
- if (typeof condition === "function") {
100
- return condition(token, filePath);
101
- }
102
- return condition;
103
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Some tokens defined in Figma Token Studio do not used the common { [variable.name] } for token references.
3
- * This function loops over each value, finds custom token references and converts them to the expected Style Dictionary format.
4
- *
5
- * @param {RegExp} customReferenceTokenIndicator a regex to find the token references
6
- * @returns {Function} to convert the token to the reference format expected by Style Dictionary "{ [variable.name] }"
7
- */
8
- export function convertTokenToStyleDictionaryFormat(
9
- customReferenceTokenIndicator: RegExp
10
- ): (value: string | number) => string {
11
- return (value: string | number): string => {
12
- let newValue = `${value}`;
13
- const matchesArr = [...newValue.matchAll(customReferenceTokenIndicator)];
14
- matchesArr.forEach((match) => {
15
- const figmaVariable = match[0];
16
- newValue = newValue.replace(figmaVariable, `{${figmaVariable.slice(1)}}`);
17
- });
18
- return newValue;
19
- };
20
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Find the string in a list
3
- *
4
- * @param {string} str the string to find in the list
5
- * @param {string[]} list the list of strings to match with the provided string
6
- * @param {RegExp} regexExclude a regular expression defining strings that should always be excluded
7
- * @returns {boolean} does the string match the items in the list
8
- */
9
- export const matchList = (str: string, list: string[], regexExclude: RegExp): boolean => {
10
- return list.some((value) => str.includes(value) && !regexExclude.test(str));
11
- };
@@ -1,18 +0,0 @@
1
- import { paramCase } from "change-case";
2
-
3
- /**
4
- * Used to set the file name for the generated theme file.
5
- *
6
- * @param {string} name the file name passed from the themes object
7
- * @param {string} prefix an optional prefix for each file name
8
- * @returns {string} a kebab-case file name from the passed name, optionally starting with a prefix
9
- */
10
- export function parseName(name: string, prefix?: string): string {
11
- const regexWord = /^\w+$/;
12
- const themeName = `${prefix || ""} ${name}`
13
- .split(" ")
14
- .filter((word) => regexWord.test(word))
15
- .join(" ");
16
-
17
- return paramCase(themeName);
18
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Replaces the word "color" with "ui" when it is the first value in the path and removes the word "default" from the final token names.
3
- * This puts generated tokens in alignment with the theme variable names in Calcite-Colors
4
- *
5
- * @param {string[]} path the path to each token value in the Style Dictionary token object
6
- * @returns {string[]} an updated token path
7
- */
8
- export const parseTokenPath = (path: string[]): string[] =>
9
- path.reduce((acc, p, idx) => {
10
- if (idx === 0 && p === "color") {
11
- acc.push("ui");
12
- } else if (p === "default") {
13
- return acc;
14
- } else {
15
- acc.push(p);
16
- }
17
-
18
- return acc;
19
- }, []);
@@ -1,9 +0,0 @@
1
- // Match files and tokens which include "[" or "]"
2
- export const matchPlaceholderElement = new RegExp(/[\[\]]/, "g");
3
-
4
- // Match custom variable indicator created by Designers in Token Studio.
5
- // Using the ${token.name} format in Token Studio makes it much easier for Designers to search for token references while doing their work.
6
- export const tokenStudioCustomVariableIndicator = new RegExp(/\$[.\w-]+/, "g");
7
-
8
- // Match files and tokens which include "backup", "[", "]", or file extensions
9
- export const matchExclusions = /(backup|\[|\])(?=\.\w+$)/;
@@ -1,12 +0,0 @@
1
- import { Dictionary } from "style-dictionary/types/Dictionary";
2
- import { default as StyleDictionary } from "style-dictionary";
3
- import { TransformedToken } from "style-dictionary/types/TransformedToken";
4
-
5
- export function sortAllTokens(dictionary: Dictionary, outputReferences: boolean): TransformedToken[] {
6
- let tokens = dictionary.allTokens;
7
- if (outputReferences) {
8
- tokens = [...dictionary.allTokens].sort(StyleDictionary.formatHelpers["sortByReference"](dictionary));
9
- }
10
-
11
- return tokens;
12
- }
@@ -1,31 +0,0 @@
1
- import {
2
- SingleBorderToken,
3
- SingleBoxShadowToken,
4
- SingleCompositionToken,
5
- SingleToken,
6
- SingleTypographyToken,
7
- } from "@tokens-studio/types";
8
-
9
- /**
10
- * Copied from https://github.com/tokens-studio/sd-transforms/blob/main/src/TransformOptions.ts
11
- * This is needed for correct type setting and is not exported by Token Studio SD Transforms.
12
- */
13
-
14
- export type Expandables = SingleCompositionToken | SingleTypographyToken | SingleBorderToken | SingleBoxShadowToken;
15
-
16
- export const expandablesAsStringsArr = ["composition", "typography", "border", "boxShadow"];
17
- export type ExpandablesAsStrings = (typeof expandablesAsStringsArr)[number];
18
-
19
- export type ExpandFilter<T extends SingleToken> = (token: T, filePath: string) => boolean;
20
-
21
- export interface ExpandOptions {
22
- typography?: boolean | ExpandFilter<SingleTypographyToken>;
23
- border?: boolean | ExpandFilter<SingleBorderToken>;
24
- shadow?: boolean | ExpandFilter<SingleBoxShadowToken>;
25
- composition?: boolean | ExpandFilter<SingleCompositionToken>;
26
- }
27
-
28
- export interface TransformOptions {
29
- expand?: ExpandOptions | false;
30
- excludeParentKeys?: boolean;
31
- }
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "allowSyntheticDefaultImports": true,
4
- "allowUnreachableCode": false,
5
- "declaration": false,
6
- "esModuleInterop": true,
7
- "experimentalDecorators": true,
8
- "lib": ["dom", "dom.iterable", "ES2021"],
9
- "module": "esnext",
10
- "moduleResolution": "node",
11
- "noUnusedLocals": true,
12
- "noUnusedParameters": true,
13
- "resolveJsonModule": true,
14
- "target": "ES2021"
15
- },
16
- "exclude": ["node_modules", "dist"]
17
- }
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "./tsconfig-base.json",
3
- "include": ["./**/*"]
4
- }
package/tsconfig.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "extends": "./tsconfig-base",
3
- "include": ["support", "src"]
4
- }