@atlaskit/ds-explorations 0.1.0 → 0.1.3

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 (81) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/components/box.partial.js +220 -182
  3. package/dist/cjs/components/inline.partial.js +28 -24
  4. package/dist/cjs/components/interaction-surface.partial.js +253 -0
  5. package/dist/cjs/components/stack.partial.js +26 -22
  6. package/dist/cjs/components/surface-provider.js +31 -0
  7. package/dist/cjs/components/text.partial.js +79 -36
  8. package/dist/cjs/constants.js +1 -0
  9. package/dist/cjs/index.js +17 -1
  10. package/dist/cjs/internal/color-map.js +42 -0
  11. package/dist/cjs/internal/role-to-element.js +36 -0
  12. package/dist/cjs/version.json +1 -1
  13. package/dist/es2019/components/box.partial.js +91 -60
  14. package/dist/es2019/components/inline.partial.js +6 -2
  15. package/dist/es2019/components/interaction-surface.partial.js +243 -0
  16. package/dist/es2019/components/stack.partial.js +6 -2
  17. package/dist/es2019/components/surface-provider.js +20 -0
  18. package/dist/es2019/components/text.partial.js +48 -9
  19. package/dist/es2019/constants.js +1 -0
  20. package/dist/es2019/index.js +3 -1
  21. package/dist/es2019/internal/color-map.js +34 -0
  22. package/dist/es2019/internal/role-to-element.js +28 -0
  23. package/dist/es2019/version.json +1 -1
  24. package/dist/esm/components/box.partial.js +100 -62
  25. package/dist/esm/components/inline.partial.js +6 -2
  26. package/dist/esm/components/interaction-surface.partial.js +242 -0
  27. package/dist/esm/components/stack.partial.js +6 -2
  28. package/dist/esm/components/surface-provider.js +20 -0
  29. package/dist/esm/components/text.partial.js +49 -9
  30. package/dist/esm/constants.js +1 -0
  31. package/dist/esm/index.js +3 -1
  32. package/dist/esm/internal/color-map.js +34 -0
  33. package/dist/esm/internal/role-to-element.js +28 -0
  34. package/dist/esm/version.json +1 -1
  35. package/dist/types/components/box.partial.d.ts +99 -78
  36. package/dist/types/components/inline.partial.d.ts +7 -7
  37. package/dist/types/components/interaction-surface.partial.d.ts +45 -0
  38. package/dist/types/components/stack.partial.d.ts +7 -7
  39. package/dist/types/components/surface-provider.d.ts +15 -0
  40. package/dist/types/components/text.partial.d.ts +58 -34
  41. package/dist/types/components/types.d.ts +1 -1
  42. package/dist/types/constants.d.ts +1 -0
  43. package/dist/types/index.d.ts +4 -0
  44. package/dist/types/internal/color-map.d.ts +34 -0
  45. package/dist/types/internal/role-to-element.d.ts +32 -0
  46. package/examples/02-text.tsx +34 -13
  47. package/examples/05-badge.tsx +1 -1
  48. package/examples/06-section-message.tsx +1 -1
  49. package/examples/07-comment.tsx +1 -1
  50. package/examples/08-lozenge.tsx +2 -2
  51. package/examples/99-interactions.tsx +175 -0
  52. package/package.json +8 -5
  53. package/report.api.md +223 -136
  54. package/scripts/__tests__/__snapshots__/codegen.test.tsx.snap +164 -3
  55. package/scripts/__tests__/codegen.test.tsx +5 -0
  56. package/scripts/codegen-styles.tsx +46 -14
  57. package/scripts/color-codegen-template.tsx +1 -1
  58. package/scripts/color-map-template.tsx +52 -0
  59. package/scripts/interaction-codegen.tsx +109 -0
  60. package/scripts/utils.tsx +5 -1
  61. package/src/components/__tests__/unit/box.test.tsx +31 -1
  62. package/src/components/__tests__/unit/interaction-suface.test.tsx +70 -0
  63. package/src/components/__tests__/unit/text.test.tsx +16 -0
  64. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-block-should-match-snapshot-1-snap.png +2 -2
  65. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-inline-should-match-snapshot-1-snap.png +2 -2
  66. package/src/components/__tests__/visual-regression/__image_snapshots__/box-snapshot-test-tsx-box-example-with-background-and-padding-should-match-snapshot-1-snap.png +2 -2
  67. package/src/components/__tests__/visual-regression/__image_snapshots__/inline-snapshot-test-tsx-inline-spacing-example-should-match-snapshot-1-snap.png +2 -2
  68. package/src/components/__tests__/visual-regression/__image_snapshots__/stack-snapshot-test-tsx-stack-spacing-example-should-match-snapshot-1-snap.png +2 -2
  69. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-font-sizes-should-match-snapshot-1-snap.png +2 -2
  70. package/src/components/__tests__/visual-regression/__image_snapshots__/text-snapshot-test-tsx-text-example-with-testing-should-match-snapshot-1-snap.png +2 -2
  71. package/src/components/box.partial.tsx +112 -71
  72. package/src/components/inline.partial.tsx +5 -2
  73. package/src/components/interaction-surface.partial.tsx +237 -0
  74. package/src/components/stack.partial.tsx +5 -2
  75. package/src/components/surface-provider.tsx +25 -0
  76. package/src/components/text.partial.tsx +62 -26
  77. package/src/components/types.tsx +1 -1
  78. package/src/constants.tsx +1 -0
  79. package/src/index.tsx +4 -0
  80. package/src/internal/color-map.tsx +34 -0
  81. package/src/internal/role-to-element.tsx +34 -0
package/report.api.md CHANGED
@@ -4,15 +4,20 @@
4
4
 
5
5
  [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
6
6
 
7
- ```ts
8
- import { CSSProperties } from 'react';
7
+ ````ts
8
+ import type { CSSProperties } from 'react';
9
9
  import { ElementType } from 'react';
10
10
  import { FC } from 'react';
11
11
  import { ForwardRefExoticComponent } from 'react';
12
12
  import { HTMLAttributes } from 'react';
13
+ import { jsx } from '@emotion/react';
13
14
  import { ReactNode } from 'react';
14
15
  import { RefAttributes } from 'react';
15
- import { SerializedStyles } from '@emotion/utils';
16
+ import { SerializedStyles } from '@emotion/react';
17
+
18
+ declare const asAllowlist: readonly ['span', 'div', 'p'];
19
+
20
+ declare type AsElement = typeof asAllowlist[number];
16
21
 
17
22
  declare type BackgroundColor = keyof typeof backgroundColorMap;
18
23
 
@@ -45,6 +50,27 @@ declare const backgroundColorMap: {
45
50
  'elevation.surface.overlay': SerializedStyles;
46
51
  };
47
52
 
53
+ declare const backgroundHoverColorMap: {
54
+ 'inverse.subtle': SerializedStyles;
55
+ input: SerializedStyles;
56
+ neutral: SerializedStyles;
57
+ 'neutral.subtle': SerializedStyles;
58
+ 'neutral.bold': SerializedStyles;
59
+ 'brand.bold': SerializedStyles;
60
+ selected: SerializedStyles;
61
+ 'selected.bold': SerializedStyles;
62
+ danger: SerializedStyles;
63
+ 'danger.bold': SerializedStyles;
64
+ warning: SerializedStyles;
65
+ 'warning.bold': SerializedStyles;
66
+ success: SerializedStyles;
67
+ 'success.bold': SerializedStyles;
68
+ discovery: SerializedStyles;
69
+ 'discovery.bold': SerializedStyles;
70
+ information: SerializedStyles;
71
+ 'information.bold': SerializedStyles;
72
+ };
73
+
48
74
  declare interface BasePrimitiveProps {
49
75
  /**
50
76
  * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
@@ -62,7 +88,7 @@ declare type BorderColor = keyof typeof borderColorMap;
62
88
 
63
89
  /**
64
90
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
65
- * @codegen <<SignedSource::e3f27406477352f51168b4108558f051>>
91
+ * @codegen <<SignedSource::ebb55786a54803214357d0eef0cac448>>
66
92
  * @codegenId colors
67
93
  * @codegenCommand yarn codegen-styles
68
94
  * @codegenParams ["border", "background"]
@@ -109,78 +135,6 @@ declare const borderWidthMap: {
109
135
  '3px': SerializedStyles;
110
136
  };
111
137
 
112
- declare interface BoxProps
113
- extends Omit<HTMLAttributes<HTMLElement>, 'style'>,
114
- BasePrimitiveProps {
115
- /**
116
- * The DOM element to render as the Box. Defaults to `div`.
117
- */
118
- as?: ElementType;
119
- /**
120
- * Elements to be rendered inside the Box.
121
- */
122
- children: ReactNode;
123
- /**
124
- * Token representing background color with a fallback.
125
- */
126
- backgroundColor?: [BackgroundColor, string];
127
- /**
128
- * Defines border style.
129
- */
130
- borderStyle?: BorderStyle;
131
- /**
132
- * Defines border width.
133
- */
134
- borderWidth?: BorderWidth;
135
- /**
136
- * Token representing border color with a fallback.
137
- */
138
- borderColor?: [BorderColor, string];
139
- /**
140
- * Defines border radius.
141
- */
142
- borderRadius?: BorderRadius;
143
- /**
144
- * Defines the main axis direction.
145
- */
146
- flexDirection?: FlexDirection;
147
- /**
148
- * Used to align children along the cross axis.
149
- */
150
- alignItems?: FlexAlignItems;
151
- /**
152
- * Used to align children along the main axis.
153
- */
154
- justifyContent?: FlexJustifyContent;
155
- /**
156
- * Shorthand for `paddingBlock` and `paddingInline` together.
157
- *
158
- * @see paddingBlock
159
- * @see paddingInline
160
- */
161
- padding?: GlobalSpacingToken;
162
- /**
163
- * Token representing CSS `padding-block`.
164
- */
165
- paddingBlock?: GlobalSpacingToken;
166
- /**
167
- * Token representing CSS `padding-inline`.
168
- */
169
- paddingInline?: GlobalSpacingToken;
170
- /**
171
- * Token representing width.
172
- */
173
- width?: GlobalSpacingToken;
174
- /**
175
- * Token representing height.
176
- */
177
- height?: GlobalSpacingToken;
178
- /**
179
- * Defines display type and layout. Defaults to `flex`.
180
- */
181
- display?: Display;
182
- }
183
-
184
138
  declare type Display = keyof typeof displayMap;
185
139
 
186
140
  declare const displayMap: {
@@ -251,9 +205,9 @@ declare const flexJustifyContentMap_3: {
251
205
  declare type FontSize = keyof typeof fontSizeMap;
252
206
 
253
207
  declare const fontSizeMap: {
254
- '11': SerializedStyles;
255
- '12': SerializedStyles;
256
- '14': SerializedStyles;
208
+ '11px': SerializedStyles;
209
+ '12px': SerializedStyles;
210
+ '14px': SerializedStyles;
257
211
  };
258
212
 
259
213
  declare type FontWeight = keyof typeof fontWeightMap;
@@ -261,9 +215,10 @@ declare type FontWeight = keyof typeof fontWeightMap;
261
215
  declare const fontWeightMap: {
262
216
  '400': SerializedStyles;
263
217
  '500': SerializedStyles;
218
+ '700': SerializedStyles;
264
219
  };
265
220
 
266
- declare type GlobalSpacingToken = keyof typeof SPACING_SCALE;
221
+ declare type GlobalSpacingToken = keyof typeof UNSAFE_SPACING_SCALE;
267
222
 
268
223
  declare interface InlineProps extends BasePrimitiveProps {
269
224
  /**
@@ -289,6 +244,13 @@ declare interface InlineProps extends BasePrimitiveProps {
289
244
  children: ReactNode;
290
245
  }
291
246
 
247
+ declare type InteractionBackgroundColor = keyof typeof backgroundHoverColorMap;
248
+
249
+ declare interface InteractionSurfaceProps extends BasePrimitiveProps {
250
+ children?: ReactNode;
251
+ appearance?: InteractionBackgroundColor;
252
+ }
253
+
292
254
  declare type LineHeight = keyof typeof lineHeightMap;
293
255
 
294
256
  declare const lineHeightMap: {
@@ -301,18 +263,10 @@ declare const lineHeightMap: {
301
263
  '40px': SerializedStyles;
302
264
  };
303
265
 
304
- declare const SPACING_SCALE: {
305
- 'sp-0': number;
306
- 'sp-25': number;
307
- 'sp-50': number;
308
- 'sp-75': number;
309
- 'sp-100': number;
310
- 'sp-200': number;
311
- 'sp-300': number;
312
- 'sp-400': number;
313
- 'sp-500': number;
314
- 'sp-600': number;
315
- 'sp-800': number;
266
+ declare const positionMap: {
267
+ absolute: SerializedStyles;
268
+ relative: SerializedStyles;
269
+ static: SerializedStyles;
316
270
  };
317
271
 
318
272
  declare interface StackProps extends BasePrimitiveProps {
@@ -346,7 +300,7 @@ declare type TextColor = keyof typeof textColorMap;
346
300
 
347
301
  /**
348
302
  * THIS SECTION WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
349
- * @codegen <<SignedSource::85a0a0bc073c7af8fd63101d6c88d59e>>
303
+ * @codegen <<SignedSource::140ffff6e1310c1c37e2067e2c232b92>>
350
304
  * @codegenId colors
351
305
  * @codegenCommand yarn codegen-styles
352
306
  * @codegenParams ["text"]
@@ -367,65 +321,114 @@ declare const textColorMap: {
367
321
  information: SerializedStyles;
368
322
  };
369
323
 
370
- declare interface TextProps extends BasePrimitiveProps {
324
+ declare type TextTransform = keyof typeof textTransformMap;
325
+
326
+ declare const textTransformMap: {
327
+ none: SerializedStyles;
328
+ lowercase: SerializedStyles;
329
+ uppercase: SerializedStyles;
330
+ };
331
+
332
+ /**
333
+ * __Box__
334
+ *
335
+ * Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
336
+ * Renders a `div` by default.
337
+ *
338
+ * @internal
339
+ */
340
+ export declare const UNSAFE_Box: ForwardRefExoticComponent<
341
+ UNSAFE_BoxProps<HTMLElement> & RefAttributes<HTMLElement>
342
+ >;
343
+
344
+ export declare interface UNSAFE_BoxProps<T extends HTMLElement = HTMLElement>
345
+ extends Omit<HTMLAttributes<T>, 'style' | 'as' | 'className'>,
346
+ BasePrimitiveProps {
371
347
  /**
372
- * HTML tag to be rendered. Defaults to `span`.
348
+ * The DOM element to render as the Box. Defaults to `div`.
373
349
  */
374
- as?:
375
- | 'span'
376
- | 'h1'
377
- | 'h2'
378
- | 'h3'
379
- | 'h4'
380
- | 'h5'
381
- | 'h6'
382
- | 'label'
383
- | 'a'
384
- | 'ul'
385
- | 'ol'
386
- | 'p';
350
+ as?: ElementType;
387
351
  /**
388
- * Elements rendered within the Text element
352
+ * Elements to be rendered inside the Box.
389
353
  */
390
- children: ReactNode;
354
+ children?: ReactNode;
391
355
  /**
392
- * Text color
356
+ * The html className attribute.
357
+ *
358
+ * Before using this prop please ensure:
359
+ * - The styles cannot otherwise be achieved through `Box` directly.
360
+ * - The use case needs custom styles that cannot be designed or implemented differently
361
+ *
362
+ * Ensure you're using the `@atlaskit/eslint-plugin-design-system` with this prop to prevent unbounded usage.
363
+ *
364
+ * @see `@atlaskit/eslint-plugin-design-system`
393
365
  */
394
- color?: [TextColor, string];
366
+ className?: string;
395
367
  /**
396
- * Font size https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
368
+ * Token representing background color with a fallback.
397
369
  */
398
- fontSize?: FontSize;
370
+ backgroundColor?: [BackgroundColor, string];
399
371
  /**
400
- * Font weight https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
372
+ * Defines border style.
401
373
  */
402
- fontWeight?: FontWeight;
374
+ borderStyle?: BorderStyle;
403
375
  /**
404
- * Line height https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
376
+ * Defines border width.
405
377
  */
406
- lineHeight?: LineHeight;
378
+ borderWidth?: BorderWidth;
407
379
  /**
408
- * Text align https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
380
+ * Token representing border color with a fallback.
409
381
  */
410
- textAlign?: TextAlign;
382
+ borderColor?: [BorderColor, string];
383
+ /**
384
+ * Defines border radius.
385
+ */
386
+ borderRadius?: BorderRadius;
387
+ /**
388
+ * Defines the main axis direction.
389
+ */
390
+ flexDirection?: FlexDirection;
391
+ /**
392
+ * Used to align children along the cross axis.
393
+ */
394
+ alignItems?: FlexAlignItems;
411
395
  /**
412
- * For use with `a` link tags.
396
+ * Used to align children along the main axis.
413
397
  */
414
- href?: string;
398
+ justifyContent?: FlexJustifyContent;
399
+ /**
400
+ * Shorthand for `paddingBlock` and `paddingInline` together.
401
+ *
402
+ * @see paddingBlock
403
+ * @see paddingInline
404
+ */
405
+ padding?: GlobalSpacingToken;
406
+ /**
407
+ * Token representing CSS `padding-block`.
408
+ */
409
+ paddingBlock?: GlobalSpacingToken;
410
+ /**
411
+ * Token representing CSS `padding-inline`.
412
+ */
413
+ paddingInline?: GlobalSpacingToken;
414
+ /**
415
+ * Token representing width.
416
+ */
417
+ width?: GlobalSpacingToken;
418
+ /**
419
+ * Token representing height.
420
+ */
421
+ height?: GlobalSpacingToken;
422
+ /**
423
+ * Defines display type and layout. Defaults to `flex`.
424
+ */
425
+ display?: Display;
426
+ /**
427
+ * CSS position property.
428
+ */
429
+ position?: keyof typeof positionMap;
415
430
  }
416
431
 
417
- /**
418
- * __Box__
419
- *
420
- * Box is a primitive component that has the design decisions of the Atlassian Design System baked in.
421
- * Renders a `div` by default.
422
- *
423
- * @internal
424
- */
425
- export declare const UNSAFE_Box: ForwardRefExoticComponent<
426
- BoxProps & RefAttributes<HTMLElement>
427
- >;
428
-
429
432
  /**
430
433
  * __Inline__
431
434
  *
@@ -437,6 +440,38 @@ export declare const UNSAFE_Inline: ForwardRefExoticComponent<
437
440
  InlineProps & RefAttributes<HTMLDivElement>
438
441
  >;
439
442
 
443
+ /**
444
+ *
445
+ * @example
446
+ * ```js
447
+ * // a minimal icon button
448
+ * <Box as="button">
449
+ * <InteractionSurface />
450
+ * <WarningIcon label="icon button" />
451
+ * </Box>
452
+ * ```
453
+ */
454
+ export declare const UNSAFE_InteractionSurface: ({
455
+ appearance,
456
+ children,
457
+ testId,
458
+ }: InteractionSurfaceProps) => jsx.JSX.Element;
459
+
460
+ export declare const UNSAFE_SPACING_SCALE: {
461
+ 'sp-0': number;
462
+ 'sp-25': number;
463
+ 'sp-50': number;
464
+ 'sp-75': number;
465
+ 'sp-100': number;
466
+ 'sp-150': number;
467
+ 'sp-200': number;
468
+ 'sp-300': number;
469
+ 'sp-400': number;
470
+ 'sp-500': number;
471
+ 'sp-600': number;
472
+ 'sp-800': number;
473
+ };
474
+
440
475
  /**
441
476
  * __Stack__
442
477
  *
@@ -457,7 +492,59 @@ export declare const UNSAFE_Stack: ForwardRefExoticComponent<
457
492
  *
458
493
  * @internal
459
494
  */
460
- export declare const UNSAFE_Text: FC<TextProps>;
495
+ export declare const UNSAFE_Text: FC<UNSAFE_TextProps>;
496
+
497
+ export declare interface UNSAFE_TextProps extends BasePrimitiveProps {
498
+ /**
499
+ * HTML tag to be rendered. Defaults to `span`.
500
+ */
501
+ as?: AsElement;
502
+ /**
503
+ * Elements rendered within the Text element
504
+ */
505
+ children: ReactNode;
506
+ /**
507
+ * Text color
508
+ */
509
+ color?: [TextColor, string];
510
+ /**
511
+ * Font size https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
512
+ */
513
+ fontSize?: FontSize;
514
+ /**
515
+ * Font weight https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
516
+ */
517
+ fontWeight?: FontWeight;
518
+ /**
519
+ * Line height https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
520
+ */
521
+ lineHeight?: LineHeight;
522
+ /**
523
+ * Truncates text with an ellipsis when text overflows its parent container
524
+ * (i.e. `width` has been set on parent that is shorter than text length).
525
+ */
526
+ shouldTruncate?: boolean;
527
+ /**
528
+ * Text align https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
529
+ */
530
+ textAlign?: TextAlign;
531
+ /**
532
+ * Text transform https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform
533
+ */
534
+ textTransform?: TextTransform;
535
+ /**
536
+ * Vertical align https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align
537
+ */
538
+ verticalAlign?: VerticalAlign;
539
+ }
540
+
541
+ declare type VerticalAlign = keyof typeof verticalAlignMap;
542
+
543
+ declare const verticalAlignMap: {
544
+ top: SerializedStyles;
545
+ middle: SerializedStyles;
546
+ bottom: SerializedStyles;
547
+ };
461
548
 
462
549
  export {};
463
- ```
550
+ ````
@@ -94,7 +94,7 @@ exports[`@atlaskit/design-system-explorations bg styles are generated correctly
94
94
  }),
95
95
  };
96
96
 
97
- type BackgroundColor = keyof typeof backgroundColorMap;
97
+ export type BackgroundColor = keyof typeof backgroundColorMap;
98
98
  "
99
99
  `;
100
100
 
@@ -141,7 +141,168 @@ exports[`@atlaskit/design-system-explorations border styles are generated correc
141
141
  }),
142
142
  };
143
143
 
144
- type BorderColor = keyof typeof borderColorMap;
144
+ export type BorderColor = keyof typeof borderColorMap;
145
+ "
146
+ `;
147
+
148
+ exports[`@atlaskit/design-system-explorations border styles are generated correctly 2`] = `
149
+ "const backgroundActiveColorMap = {
150
+ 'inverse.subtle': css({
151
+ ':active': {
152
+ backgroundColor: token('color.background.inverse.subtle.pressed'),
153
+ },
154
+ }),
155
+ input: css({
156
+ ':active': { backgroundColor: token('color.background.input.pressed') },
157
+ }),
158
+ neutral: css({
159
+ ':active': { backgroundColor: token('color.background.neutral.pressed') },
160
+ }),
161
+ 'neutral.subtle': css({
162
+ ':active': {
163
+ backgroundColor: token('color.background.neutral.subtle.pressed'),
164
+ },
165
+ }),
166
+ 'neutral.bold': css({
167
+ ':active': {
168
+ backgroundColor: token('color.background.neutral.bold.pressed'),
169
+ },
170
+ }),
171
+ 'brand.bold': css({
172
+ ':active': {
173
+ backgroundColor: token('color.background.brand.bold.pressed'),
174
+ },
175
+ }),
176
+ selected: css({
177
+ ':active': { backgroundColor: token('color.background.selected.pressed') },
178
+ }),
179
+ 'selected.bold': css({
180
+ ':active': {
181
+ backgroundColor: token('color.background.selected.bold.pressed'),
182
+ },
183
+ }),
184
+ danger: css({
185
+ ':active': { backgroundColor: token('color.background.danger.pressed') },
186
+ }),
187
+ 'danger.bold': css({
188
+ ':active': {
189
+ backgroundColor: token('color.background.danger.bold.pressed'),
190
+ },
191
+ }),
192
+ warning: css({
193
+ ':active': { backgroundColor: token('color.background.warning.pressed') },
194
+ }),
195
+ 'warning.bold': css({
196
+ ':active': {
197
+ backgroundColor: token('color.background.warning.bold.pressed'),
198
+ },
199
+ }),
200
+ success: css({
201
+ ':active': { backgroundColor: token('color.background.success.pressed') },
202
+ }),
203
+ 'success.bold': css({
204
+ ':active': {
205
+ backgroundColor: token('color.background.success.bold.pressed'),
206
+ },
207
+ }),
208
+ discovery: css({
209
+ ':active': { backgroundColor: token('color.background.discovery.pressed') },
210
+ }),
211
+ 'discovery.bold': css({
212
+ ':active': {
213
+ backgroundColor: token('color.background.discovery.bold.pressed'),
214
+ },
215
+ }),
216
+ information: css({
217
+ ':active': {
218
+ backgroundColor: token('color.background.information.pressed'),
219
+ },
220
+ }),
221
+ 'information.bold': css({
222
+ ':active': {
223
+ backgroundColor: token('color.background.information.bold.pressed'),
224
+ },
225
+ }),
226
+ };
227
+
228
+ const backgroundHoverColorMap = {
229
+ 'inverse.subtle': css({
230
+ ':hover': {
231
+ backgroundColor: token('color.background.inverse.subtle.hovered'),
232
+ },
233
+ }),
234
+ input: css({
235
+ ':hover': { backgroundColor: token('color.background.input.hovered') },
236
+ }),
237
+ neutral: css({
238
+ ':hover': { backgroundColor: token('color.background.neutral.hovered') },
239
+ }),
240
+ 'neutral.subtle': css({
241
+ ':hover': {
242
+ backgroundColor: token('color.background.neutral.subtle.hovered'),
243
+ },
244
+ }),
245
+ 'neutral.bold': css({
246
+ ':hover': {
247
+ backgroundColor: token('color.background.neutral.bold.hovered'),
248
+ },
249
+ }),
250
+ 'brand.bold': css({
251
+ ':hover': { backgroundColor: token('color.background.brand.bold.hovered') },
252
+ }),
253
+ selected: css({
254
+ ':hover': { backgroundColor: token('color.background.selected.hovered') },
255
+ }),
256
+ 'selected.bold': css({
257
+ ':hover': {
258
+ backgroundColor: token('color.background.selected.bold.hovered'),
259
+ },
260
+ }),
261
+ danger: css({
262
+ ':hover': { backgroundColor: token('color.background.danger.hovered') },
263
+ }),
264
+ 'danger.bold': css({
265
+ ':hover': {
266
+ backgroundColor: token('color.background.danger.bold.hovered'),
267
+ },
268
+ }),
269
+ warning: css({
270
+ ':hover': { backgroundColor: token('color.background.warning.hovered') },
271
+ }),
272
+ 'warning.bold': css({
273
+ ':hover': {
274
+ backgroundColor: token('color.background.warning.bold.hovered'),
275
+ },
276
+ }),
277
+ success: css({
278
+ ':hover': { backgroundColor: token('color.background.success.hovered') },
279
+ }),
280
+ 'success.bold': css({
281
+ ':hover': {
282
+ backgroundColor: token('color.background.success.bold.hovered'),
283
+ },
284
+ }),
285
+ discovery: css({
286
+ ':hover': { backgroundColor: token('color.background.discovery.hovered') },
287
+ }),
288
+ 'discovery.bold': css({
289
+ ':hover': {
290
+ backgroundColor: token('color.background.discovery.bold.hovered'),
291
+ },
292
+ }),
293
+ information: css({
294
+ ':hover': {
295
+ backgroundColor: token('color.background.information.hovered'),
296
+ },
297
+ }),
298
+ 'information.bold': css({
299
+ ':hover': {
300
+ backgroundColor: token('color.background.information.bold.hovered'),
301
+ },
302
+ }),
303
+ };
304
+
305
+ type InteractionBackgroundColor = keyof typeof backgroundHoverColorMap;
145
306
  "
146
307
  `;
147
308
 
@@ -188,6 +349,6 @@ exports[`@atlaskit/design-system-explorations text styles are generated correctl
188
349
  }),
189
350
  };
190
351
 
191
- type TextColor = keyof typeof textColorMap;
352
+ export type TextColor = keyof typeof textColorMap;
192
353
  "
193
354
  `;
@@ -1,4 +1,5 @@
1
1
  import { createColorStylesFromTemplate } from '../color-codegen-template';
2
+ import { createInteractionStylesFromTemplate } from '../interaction-codegen';
2
3
  describe('@atlaskit/design-system-explorations', () => {
3
4
  test('text styles are generated correctly', () => {
4
5
  expect(createColorStylesFromTemplate('text')).toMatchSnapshot();
@@ -12,6 +13,10 @@ describe('@atlaskit/design-system-explorations', () => {
12
13
  expect(createColorStylesFromTemplate('border')).toMatchSnapshot();
13
14
  });
14
15
 
16
+ test('border styles are generated correctly', () => {
17
+ expect(createInteractionStylesFromTemplate('background')).toMatchSnapshot();
18
+ });
19
+
15
20
  test('incorrect config throws', () => {
16
21
  expect(() =>
17
22
  createColorStylesFromTemplate('fizzbuzz' as any),