@khanacademy/wonder-blocks-tokens 4.2.1 → 5.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @khanacademy/wonder-blocks-tokens
2
2
 
3
+ ## 5.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 5655b9f: Rename `semanticColor.border.focus` to `semanticColor.focus.outer`, and add `focus.inner`.
8
+ - 8f53293: Rename action tokens: `filled` -> `primary`, `outlined` -> `secondary`.
9
+ - 051f0f8: Remove `action.disabled` object in favor of `action.primary.disabled` and `action.secondary.disabled`
10
+
11
+ ### Minor Changes
12
+
13
+ - e1b78db: Add sizing primitive tokens to support the new tokens with rem units that will be used by the thunderblocks/classroom theme
14
+
15
+ ### Patch Changes
16
+
17
+ - 5655b9f: Switch to use `focus.outer` semanticColor token
18
+ - 051f0f8: Rework action.disabled tokens to include properties per kind (border, background, foreground).
19
+
3
20
  ## 4.2.1
4
21
 
5
22
  ### Patch Changes
package/dist/es/index.js CHANGED
@@ -179,6 +179,34 @@ const font = {
179
179
  }
180
180
  };
181
181
 
182
+ const baseline = 8;
183
+ function pxToRem(value) {
184
+ return `${value / baseline}rem`;
185
+ }
186
+ const sizing = {
187
+ size_0: pxToRem(0),
188
+ size_0125: pxToRem(1),
189
+ size_025: pxToRem(2),
190
+ size_050: pxToRem(4),
191
+ size_075: pxToRem(6),
192
+ size_100: pxToRem(8),
193
+ size_125: pxToRem(10),
194
+ size_150: pxToRem(12),
195
+ size_200: pxToRem(16),
196
+ size_225: pxToRem(18),
197
+ size_250: pxToRem(20),
198
+ size_300: pxToRem(24),
199
+ size_400: pxToRem(32),
200
+ size_500: pxToRem(40),
201
+ size_600: pxToRem(48),
202
+ size_700: pxToRem(56),
203
+ size_800: pxToRem(64),
204
+ size_900: pxToRem(72),
205
+ size_1000: pxToRem(80),
206
+ size_1100: pxToRem(88),
207
+ size_1200: pxToRem(96)
208
+ };
209
+
182
210
  const spacing = {
183
211
  xxxxSmall_2: 2,
184
212
  xxxSmall_4: 4,
@@ -223,12 +251,11 @@ const border = {
223
251
  primary: color.fadedOffBlack16,
224
252
  subtle: color.fadedOffBlack8,
225
253
  strong: color.fadedOffBlack50,
226
- focus: color.blue,
227
254
  inverse: color.white
228
255
  };
229
256
  const semanticColor = {
230
257
  action: {
231
- filled: {
258
+ primary: {
232
259
  progressive: {
233
260
  default: {
234
261
  border: "transparent",
@@ -262,9 +289,14 @@ const semanticColor = {
262
289
  background: color.activeRed,
263
290
  foreground: color.white
264
291
  }
292
+ },
293
+ disabled: {
294
+ border: color.fadedOffBlack32,
295
+ background: color.fadedOffBlack32,
296
+ foreground: color.offWhite
265
297
  }
266
298
  },
267
- outlined: {
299
+ secondary: {
268
300
  progressive: {
269
301
  default: {
270
302
  border: border.strong,
@@ -298,11 +330,12 @@ const semanticColor = {
298
330
  background: color.fadedRed,
299
331
  foreground: color.activeRed
300
332
  }
333
+ },
334
+ disabled: {
335
+ border: border.primary,
336
+ background: color.offWhite,
337
+ foreground: color.fadedOffBlack32
301
338
  }
302
- },
303
- disabled: {
304
- default: color.fadedOffBlack32,
305
- secondary: color.offWhite
306
339
  }
307
340
  },
308
341
  status: {
@@ -341,6 +374,10 @@ const semanticColor = {
341
374
  inverse: color.white
342
375
  },
343
376
  border: border,
377
+ focus: {
378
+ outer: color.blue,
379
+ inner: color.white
380
+ },
344
381
  icon: {
345
382
  primary: color.fadedOffBlack64,
346
383
  secondary: color.offBlack,
@@ -358,4 +395,4 @@ const semanticColor = {
358
395
  }
359
396
  };
360
397
 
361
- export { border$1 as border, breakpoint, color, fade, font, mix, semanticColor, spacing };
398
+ export { border$1 as border, breakpoint, color, fade, font, mix, semanticColor, sizing, spacing };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { border } from "./tokens/border";
2
2
  import { color } from "./tokens/color";
3
3
  import { font } from "./tokens/font";
4
+ import { sizing } from "./tokens/sizing";
4
5
  import { spacing } from "./tokens/spacing";
5
6
  import { breakpoint } from "./tokens/media-queries";
6
7
  import { semanticColor } from "./tokens/semantic-color";
@@ -9,7 +10,7 @@ export {
9
10
  /**
10
11
  * Primitive tokens for the Wonder Blocks design system.
11
12
  */
12
- border, color, font, spacing,
13
+ border, color, font, sizing, spacing,
13
14
  /**
14
15
  * Media query breakpoints.
15
16
  */
package/dist/index.js CHANGED
@@ -183,6 +183,34 @@ const font = {
183
183
  }
184
184
  };
185
185
 
186
+ const baseline = 8;
187
+ function pxToRem(value) {
188
+ return `${value / baseline}rem`;
189
+ }
190
+ const sizing = {
191
+ size_0: pxToRem(0),
192
+ size_0125: pxToRem(1),
193
+ size_025: pxToRem(2),
194
+ size_050: pxToRem(4),
195
+ size_075: pxToRem(6),
196
+ size_100: pxToRem(8),
197
+ size_125: pxToRem(10),
198
+ size_150: pxToRem(12),
199
+ size_200: pxToRem(16),
200
+ size_225: pxToRem(18),
201
+ size_250: pxToRem(20),
202
+ size_300: pxToRem(24),
203
+ size_400: pxToRem(32),
204
+ size_500: pxToRem(40),
205
+ size_600: pxToRem(48),
206
+ size_700: pxToRem(56),
207
+ size_800: pxToRem(64),
208
+ size_900: pxToRem(72),
209
+ size_1000: pxToRem(80),
210
+ size_1100: pxToRem(88),
211
+ size_1200: pxToRem(96)
212
+ };
213
+
186
214
  const spacing = {
187
215
  xxxxSmall_2: 2,
188
216
  xxxSmall_4: 4,
@@ -227,12 +255,11 @@ const border = {
227
255
  primary: color.fadedOffBlack16,
228
256
  subtle: color.fadedOffBlack8,
229
257
  strong: color.fadedOffBlack50,
230
- focus: color.blue,
231
258
  inverse: color.white
232
259
  };
233
260
  const semanticColor = {
234
261
  action: {
235
- filled: {
262
+ primary: {
236
263
  progressive: {
237
264
  default: {
238
265
  border: "transparent",
@@ -266,9 +293,14 @@ const semanticColor = {
266
293
  background: color.activeRed,
267
294
  foreground: color.white
268
295
  }
296
+ },
297
+ disabled: {
298
+ border: color.fadedOffBlack32,
299
+ background: color.fadedOffBlack32,
300
+ foreground: color.offWhite
269
301
  }
270
302
  },
271
- outlined: {
303
+ secondary: {
272
304
  progressive: {
273
305
  default: {
274
306
  border: border.strong,
@@ -302,11 +334,12 @@ const semanticColor = {
302
334
  background: color.fadedRed,
303
335
  foreground: color.activeRed
304
336
  }
337
+ },
338
+ disabled: {
339
+ border: border.primary,
340
+ background: color.offWhite,
341
+ foreground: color.fadedOffBlack32
305
342
  }
306
- },
307
- disabled: {
308
- default: color.fadedOffBlack32,
309
- secondary: color.offWhite
310
343
  }
311
344
  },
312
345
  status: {
@@ -345,6 +378,10 @@ const semanticColor = {
345
378
  inverse: color.white
346
379
  },
347
380
  border: border,
381
+ focus: {
382
+ outer: color.blue,
383
+ inner: color.white
384
+ },
348
385
  icon: {
349
386
  primary: color.fadedOffBlack64,
350
387
  secondary: color.offBlack,
@@ -369,4 +406,5 @@ exports.fade = fade;
369
406
  exports.font = font;
370
407
  exports.mix = mix;
371
408
  exports.semanticColor = semanticColor;
409
+ exports.sizing = sizing;
372
410
  exports.spacing = spacing;
@@ -4,7 +4,7 @@ export declare const semanticColor: {
4
4
  * of interaction.
5
5
  */
6
6
  action: {
7
- filled: {
7
+ primary: {
8
8
  progressive: {
9
9
  default: {
10
10
  border: string;
@@ -39,8 +39,13 @@ export declare const semanticColor: {
39
39
  foreground: string;
40
40
  };
41
41
  };
42
+ disabled: {
43
+ border: string;
44
+ background: string;
45
+ foreground: string;
46
+ };
42
47
  };
43
- outlined: {
48
+ secondary: {
44
49
  progressive: {
45
50
  default: {
46
51
  border: string;
@@ -75,10 +80,11 @@ export declare const semanticColor: {
75
80
  foreground: string;
76
81
  };
77
82
  };
78
- };
79
- disabled: {
80
- default: string;
81
- secondary: string;
83
+ disabled: {
84
+ border: string;
85
+ background: string;
86
+ foreground: string;
87
+ };
82
88
  };
83
89
  };
84
90
  /**
@@ -137,9 +143,12 @@ export declare const semanticColor: {
137
143
  primary: string;
138
144
  subtle: string;
139
145
  strong: string;
140
- focus: string;
141
146
  inverse: string;
142
147
  };
148
+ focus: {
149
+ outer: string;
150
+ inner: string;
151
+ };
143
152
  /**
144
153
  * Default icon colors that change in context (like actions).
145
154
  */
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Tokens that define the sizing of elements. These values are expressed in
3
+ * `rem` units.
4
+ *
5
+ * These tokens are multiples of 8px, the baseline for the design system.
6
+ *
7
+ * These tokens can be used for:
8
+ * - Margin and padding
9
+ * - Component sizes
10
+ * - Typography
11
+ */
12
+ export declare const sizing: {
13
+ readonly size_0: string;
14
+ readonly size_0125: string;
15
+ readonly size_025: string;
16
+ readonly size_050: string;
17
+ readonly size_075: string;
18
+ readonly size_100: string;
19
+ readonly size_125: string;
20
+ readonly size_150: string;
21
+ readonly size_200: string;
22
+ readonly size_225: string;
23
+ readonly size_250: string;
24
+ readonly size_300: string;
25
+ readonly size_400: string;
26
+ readonly size_500: string;
27
+ readonly size_600: string;
28
+ readonly size_700: string;
29
+ readonly size_800: string;
30
+ readonly size_900: string;
31
+ readonly size_1000: string;
32
+ readonly size_1100: string;
33
+ readonly size_1200: string;
34
+ };
@@ -1,3 +1,7 @@
1
+ /**
2
+ * NOTE: These tokens are going to be deprecated in favor of the new `sizing`
3
+ * tokens.
4
+ */
1
5
  export declare const spacing: {
2
6
  readonly xxxxSmall_2: 2;
3
7
  readonly xxxSmall_4: 4;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-tokens",
3
- "version": "4.2.1",
3
+ "version": "5.0.0",
4
4
  "description": "Core primitive design tokens for Web Wonder Blocks",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/es/index.js",