braid-design-system 31.0.0 → 31.2.2

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 (106) hide show
  1. package/.nvmrc +1 -1
  2. package/CHANGELOG.md +58 -0
  3. package/color-mode/index.ts +9 -0
  4. package/css/atoms.docs.tsx +26 -20
  5. package/css/colorModeStyle.docs.tsx +81 -0
  6. package/css/index.ts +5 -1
  7. package/lib/components/Alert/Alert.css.ts +19 -0
  8. package/lib/components/Alert/Alert.docs.tsx +17 -5
  9. package/lib/components/Alert/Alert.tsx +61 -30
  10. package/lib/components/Badge/Badge.tsx +11 -31
  11. package/lib/components/Box/BackgroundContext.tsx +34 -17
  12. package/lib/components/Box/Box.docs.tsx +34 -14
  13. package/lib/components/Box/Box.playroom.tsx +37 -0
  14. package/lib/components/Box/Box.tsx +38 -7
  15. package/lib/components/Box/BoxRenderer.tsx +28 -9
  16. package/lib/components/Box/ColoredBox.tsx +168 -13
  17. package/lib/components/BraidPortal/BraidPortal.tsx +4 -1
  18. package/lib/components/BraidProvider/BraidProvider.tsx +11 -3
  19. package/lib/components/BraidProvider/VanillaThemeContainer.tsx +24 -0
  20. package/lib/components/Button/Button.css.ts +38 -5
  21. package/lib/components/Button/Button.screenshots.tsx +4 -1
  22. package/lib/components/Button/Button.tsx +102 -70
  23. package/lib/components/Card/Card.tsx +2 -13
  24. package/lib/components/Checkbox/Checkbox.screenshots.tsx +17 -8
  25. package/lib/components/Divider/Divider.css.ts +45 -4
  26. package/lib/components/Divider/Divider.tsx +20 -14
  27. package/lib/components/Dropdown/Dropdown.docs.tsx +0 -1
  28. package/lib/components/FieldLabel/FieldLabel.docs.tsx +1 -1
  29. package/lib/components/FieldMessage/FieldMessage.screenshots.tsx +6 -0
  30. package/lib/components/Heading/Heading.docs.tsx +6 -4
  31. package/lib/components/Heading/Heading.screenshots.tsx +4 -1
  32. package/lib/components/Loader/Loader.css.ts +3 -4
  33. package/lib/components/Loader/Loader.screenshots.tsx +4 -1
  34. package/lib/components/Loader/Loader.tsx +27 -30
  35. package/lib/components/MenuItem/MenuItemLink.tsx +9 -2
  36. package/lib/components/MenuItem/useMenuItem.tsx +4 -4
  37. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.tsx +3 -1
  38. package/lib/components/MenuRenderer/testHelper.tsx +5 -2
  39. package/lib/components/Pagination/Pagination.css.ts +17 -3
  40. package/lib/components/Pagination/Pagination.tsx +6 -5
  41. package/lib/components/Rating/Rating.css.ts +16 -3
  42. package/lib/components/Rating/Rating.screenshots.tsx +4 -1
  43. package/lib/components/Rating/Rating.tsx +6 -1
  44. package/lib/components/Tabs/Tab.tsx +6 -2
  45. package/lib/components/Tabs/Tabs.css.ts +9 -1
  46. package/lib/components/Tabs/Tabs.tsx +4 -1
  47. package/lib/components/Text/Text.docs.tsx +4 -0
  48. package/lib/components/Text/Text.screenshots.tsx +8 -1
  49. package/lib/components/TextField/TextField.docs.tsx +0 -1
  50. package/lib/components/TextLink/TextLink.css.ts +139 -0
  51. package/lib/components/TextLink/TextLink.docs.tsx +1 -1
  52. package/lib/components/TextLink/TextLink.screenshots.tsx +3 -1
  53. package/lib/components/TextLink/TextLink.tsx +45 -37
  54. package/lib/components/Textarea/Highlight/Highlight.tsx +1 -1
  55. package/lib/components/Textarea/Textarea.docs.tsx +0 -1
  56. package/lib/components/Toggle/Toggle.css.ts +34 -7
  57. package/lib/components/Toggle/Toggle.tsx +8 -3
  58. package/lib/components/iconButtons/IconButton.css.ts +0 -32
  59. package/lib/components/iconButtons/IconButton.tsx +26 -48
  60. package/lib/components/icons/IconTip/IconTip.docs.tsx +20 -0
  61. package/lib/components/icons/IconTip/IconTip.tsx +12 -0
  62. package/lib/components/icons/IconTip/IconTipSvg.tsx +21 -0
  63. package/lib/components/icons/IconZoomIn/IconZoomIn.docs.tsx +20 -0
  64. package/lib/components/icons/IconZoomIn/IconZoomIn.tsx +12 -0
  65. package/lib/components/icons/IconZoomIn/IconZoomInSvg.tsx +20 -0
  66. package/lib/components/icons/IconZoomOut/IconZoomOut.docs.tsx +20 -0
  67. package/lib/components/icons/IconZoomOut/IconZoomOut.tsx +12 -0
  68. package/lib/components/icons/IconZoomOut/IconZoomOutSvg.tsx +20 -0
  69. package/lib/components/icons/Icons.screenshots.tsx +2 -2
  70. package/lib/components/icons/index.ts +3 -0
  71. package/lib/components/index.ts +3 -1
  72. package/lib/components/private/Field/Field.css.ts +2 -1
  73. package/lib/components/private/Field/Field.tsx +4 -6
  74. package/lib/components/private/InlineField/InlineField.css.ts +6 -6
  75. package/lib/components/private/InlineField/StyledInput.tsx +14 -9
  76. package/lib/components/private/Keyline/Keyline.css.ts +70 -0
  77. package/lib/components/private/Keyline/Keyline.tsx +38 -0
  78. package/lib/components/private/Placeholder/Placeholder.css.ts +44 -12
  79. package/lib/components/private/Placeholder/Placeholder.tsx +7 -3
  80. package/lib/components/private/touchable/debugTouchable.ts +7 -7
  81. package/lib/components/private/touchable/virtualTouchable.css.ts +12 -12
  82. package/lib/components/useToast/Toast.tsx +2 -8
  83. package/lib/css/atoms/atomicProperties.ts +7 -2
  84. package/lib/css/atoms/sprinkles.css.ts +24 -0
  85. package/lib/css/colorModeStyle.ts +33 -0
  86. package/lib/css/reset/reset.css.ts +12 -8
  87. package/lib/hooks/typography/index.ts +8 -61
  88. package/lib/hooks/typography/typography.css.ts +95 -93
  89. package/lib/hooks/useIcon/index.ts +4 -2
  90. package/lib/playroom/FrameComponent.tsx +50 -17
  91. package/lib/playroom/components.ts +1 -0
  92. package/lib/playroom/useScope.ts +44 -1
  93. package/lib/stories/all.stories.tsx +61 -30
  94. package/lib/themes/baseTokens/apac.ts +8 -0
  95. package/lib/themes/catho/tokens.ts +23 -6
  96. package/lib/themes/docs/tokens.ts +8 -0
  97. package/lib/themes/makeBraidTheme.ts +4 -1
  98. package/lib/themes/occ/tokens.ts +25 -5
  99. package/lib/themes/seekAnz/tokens.ts +25 -5
  100. package/lib/themes/tokenType.ts +8 -0
  101. package/lib/themes/wireframe/tokens.ts +22 -5
  102. package/package.json +2 -2
  103. package/sku.config.js +1 -0
  104. package/sku.routes.js +2 -0
  105. package/tsconfig.json +1 -0
  106. package/lib/components/Card/Card.css.ts +0 -6
@@ -5,15 +5,16 @@ import React, {
5
5
  AllHTMLAttributes,
6
6
  } from 'react';
7
7
  import { touchableText } from '../../hooks/typography';
8
- import { Box, BoxProps } from '../Box/Box';
8
+ import { Box, BoxBackgroundVariant, BoxProps } from '../Box/Box';
9
9
  import buildDataAttributes, {
10
10
  DataAttributeMap,
11
11
  } from '../private/buildDataAttributes';
12
12
  import { FieldOverlay } from '../private/FieldOverlay/FieldOverlay';
13
13
  import { virtualTouchable } from '../private/touchable/virtualTouchable';
14
14
  import {
15
- BackgroundContextValue,
15
+ ColorContrastValue,
16
16
  useBackgroundLightness,
17
+ useColorContrast,
17
18
  } from '../Box/BackgroundContext';
18
19
  import { Text, TextProps } from '../Text/Text';
19
20
  import { BoxShadow } from '../../css/atoms/atomicProperties';
@@ -54,18 +55,18 @@ export interface ButtonProps extends ButtonStyleProps {
54
55
  type ButtonStyles = {
55
56
  textTone: TextProps['tone'];
56
57
  background:
57
- | BackgroundContextValue
58
- | { light: BackgroundContextValue; dark: BackgroundContextValue }
58
+ | ColorContrastValue<BoxBackgroundVariant>
59
+ | BoxBackgroundVariant
59
60
  | undefined;
60
61
  backgroundHover:
61
- | BackgroundContextValue
62
- | { light: BackgroundContextValue; dark: BackgroundContextValue }
62
+ | ColorContrastValue<BoxBackgroundVariant>
63
+ | BoxBackgroundVariant
63
64
  | undefined;
64
65
  backgroundActive:
65
- | BackgroundContextValue
66
- | { light: BackgroundContextValue; dark: BackgroundContextValue }
66
+ | ColorContrastValue<BoxBackgroundVariant>
67
+ | BoxBackgroundVariant
67
68
  | undefined;
68
- boxShadow: { light: BoxShadow; dark: BoxShadow } | undefined;
69
+ boxShadow: BoxShadow | undefined;
69
70
  };
70
71
 
71
72
  const variants: Record<
@@ -105,28 +106,28 @@ const variants: Record<
105
106
  soft: {
106
107
  default: {
107
108
  textTone: 'formAccent',
108
- background: 'formAccentSoft',
109
+ background: { light: 'formAccentSoft', dark: 'customDark' },
109
110
  backgroundHover: 'formAccentSoftHover',
110
111
  backgroundActive: 'formAccentSoftActive',
111
112
  boxShadow: undefined,
112
113
  },
113
114
  brandAccent: {
114
115
  textTone: 'brandAccent',
115
- background: 'brandAccentSoft',
116
+ background: { light: 'brandAccentSoft', dark: 'customDark' },
116
117
  backgroundHover: 'brandAccentSoftHover',
117
118
  backgroundActive: 'brandAccentSoftActive',
118
119
  boxShadow: undefined,
119
120
  },
120
121
  critical: {
121
122
  textTone: 'critical',
122
- background: 'criticalSoft',
123
+ background: { light: 'criticalSoft', dark: 'customDark' },
123
124
  backgroundHover: 'criticalSoftHover',
124
125
  backgroundActive: 'criticalSoftActive',
125
126
  boxShadow: undefined,
126
127
  },
127
128
  neutral: {
128
129
  textTone: 'neutral',
129
- background: 'neutralSoft',
130
+ background: { light: 'neutralSoft', dark: 'customDark' },
130
131
  backgroundHover: 'neutralSoftHover',
131
132
  backgroundActive: 'neutralSoftActive',
132
133
  boxShadow: undefined,
@@ -168,40 +169,28 @@ const variants: Record<
168
169
  background: undefined,
169
170
  backgroundHover: 'formAccentSoftHover',
170
171
  backgroundActive: 'formAccentSoftActive',
171
- boxShadow: {
172
- light: 'borderFormAccentLarge',
173
- dark: 'borderFormAccentLightLarge',
174
- },
172
+ boxShadow: 'borderFormAccentLarge',
175
173
  },
176
174
  brandAccent: {
177
175
  textTone: 'brandAccent',
178
176
  background: undefined,
179
177
  backgroundHover: 'brandAccentSoftHover',
180
178
  backgroundActive: 'brandAccentSoftActive',
181
- boxShadow: {
182
- light: 'borderBrandAccentLarge',
183
- dark: 'borderBrandAccentLightLarge',
184
- },
179
+ boxShadow: 'borderBrandAccentLarge',
185
180
  },
186
181
  critical: {
187
182
  textTone: 'critical',
188
183
  background: undefined,
189
184
  backgroundHover: 'criticalSoftHover',
190
185
  backgroundActive: 'criticalSoftActive',
191
- boxShadow: {
192
- light: 'borderCriticalLarge',
193
- dark: 'borderCriticalLightLarge',
194
- },
186
+ boxShadow: 'borderCriticalLarge',
195
187
  },
196
188
  neutral: {
197
189
  textTone: 'neutral',
198
190
  background: undefined,
199
191
  backgroundHover: 'neutralSoftHover',
200
192
  backgroundActive: 'neutralSoftActive',
201
- boxShadow: {
202
- light: 'borderNeutralLarge',
203
- dark: 'borderNeutralInvertedLarge',
204
- },
193
+ boxShadow: 'borderNeutralLarge',
205
194
  },
206
195
  },
207
196
  } as const;
@@ -226,50 +215,76 @@ export const ButtonOverlays = ({
226
215
  tone,
227
216
  loading,
228
217
  children,
229
- }: ButtonProps) => {
218
+ keyboardFocusable = true,
219
+ labelSpacing = true,
220
+ forceActive = false,
221
+ radius = 'large',
222
+ }: ButtonProps & {
223
+ keyboardFocusable?: boolean;
224
+ radius?: 'full' | 'large';
225
+ labelSpacing?: boolean;
226
+ forceActive?: boolean;
227
+ }) => {
230
228
  const actionsContext = useContext(ActionsContext);
231
- const backgroundLightness = useBackgroundLightness();
232
- const isInverted = backgroundLightness === 'dark' && variant !== 'solid';
233
229
  const size = sizeProp ?? actionsContext?.size ?? 'standard';
234
230
  const stylesForVariant = variants[variant][tone ?? 'default'];
231
+ const colorConstrast = useColorContrast();
232
+ const lightness = useBackgroundLightness();
233
+ const labelMargin =
234
+ size === 'small' || variant === 'transparent' ? 'small' : 'medium';
235
235
 
236
236
  return (
237
237
  <>
238
+ {keyboardFocusable ? (
239
+ <FieldOverlay
240
+ borderRadius={radius}
241
+ variant="focus"
242
+ onlyVisibleForKeyboardNavigation
243
+ className={styles.focusOverlay}
244
+ />
245
+ ) : null}
238
246
  <FieldOverlay
239
- borderRadius="large"
240
- variant="focus"
241
- onlyVisibleForKeyboardNavigation
242
- className={styles.focusOverlay}
243
- />
244
- <FieldOverlay
245
- borderRadius="large"
247
+ borderRadius={radius}
246
248
  background={
247
- typeof stylesForVariant.backgroundHover === 'object'
248
- ? stylesForVariant.backgroundHover[backgroundLightness]
249
+ stylesForVariant.backgroundHover &&
250
+ typeof stylesForVariant.backgroundHover !== 'string'
251
+ ? colorConstrast(stylesForVariant.backgroundHover)
249
252
  : stylesForVariant.backgroundHover
250
253
  }
251
254
  className={[
252
255
  styles.hoverOverlay,
253
- isInverted ? styles.invertedBackgrounds.hover : undefined,
256
+ variant !== 'solid' && lightness.lightMode === 'dark'
257
+ ? styles.invertedBackgroundsLightMode.hover
258
+ : null,
259
+ variant !== 'solid' && lightness.darkMode === 'dark'
260
+ ? styles.invertedBackgroundsDarkMode.hover
261
+ : null,
254
262
  ]}
255
263
  />
256
264
  <FieldOverlay
257
- borderRadius="large"
265
+ borderRadius={radius}
258
266
  background={
259
- typeof stylesForVariant.backgroundActive === 'object'
260
- ? stylesForVariant.backgroundActive[backgroundLightness]
267
+ stylesForVariant.backgroundActive &&
268
+ typeof stylesForVariant.backgroundActive !== 'string'
269
+ ? colorConstrast(stylesForVariant.backgroundActive)
261
270
  : stylesForVariant.backgroundActive
262
271
  }
263
272
  className={[
273
+ forceActive ? styles.forceActive : undefined,
264
274
  styles.activeOverlay,
265
- isInverted ? styles.invertedBackgrounds.active : undefined,
275
+ variant !== 'solid' && lightness.lightMode === 'dark'
276
+ ? styles.invertedBackgroundsLightMode.active
277
+ : null,
278
+ variant !== 'solid' && lightness.darkMode === 'dark'
279
+ ? styles.invertedBackgroundsDarkMode.active
280
+ : null,
266
281
  ]}
267
282
  />
268
283
  {stylesForVariant.boxShadow ? (
269
284
  <Box
270
285
  component="span"
271
- boxShadow={stylesForVariant.boxShadow[backgroundLightness]}
272
- borderRadius="large"
286
+ boxShadow={stylesForVariant.boxShadow}
287
+ borderRadius={radius}
273
288
  position="absolute"
274
289
  top={0}
275
290
  bottom={0}
@@ -284,23 +299,32 @@ export const ButtonOverlays = ({
284
299
  display="block"
285
300
  overflow="hidden"
286
301
  pointerEvents="none"
287
- marginX={
288
- size === 'small' || variant === 'transparent' ? 'small' : 'medium'
289
- }
302
+ marginX={labelSpacing ? labelMargin : undefined}
290
303
  paddingY={
291
- size === 'small' ? styles.constants.smallButtonPaddingSize : undefined
304
+ labelSpacing && size === 'small'
305
+ ? styles.constants.smallButtonPaddingSize
306
+ : undefined
307
+ }
308
+ className={
309
+ labelSpacing && size === 'standard'
310
+ ? touchableText.standard
311
+ : undefined
292
312
  }
293
- className={size === 'standard' ? touchableText.standard : undefined}
294
313
  background={
295
- tone === 'neutral' &&
296
- variant !== 'solid' &&
297
- backgroundLightness === 'light'
298
- ? 'customLight'
314
+ tone === 'neutral' && variant !== 'solid'
315
+ ? {
316
+ lightMode:
317
+ lightness.lightMode === 'light'
318
+ ? 'customLight'
319
+ : 'customDark',
320
+ darkMode:
321
+ lightness.darkMode === 'light' ? 'customLight' : 'customDark',
322
+ }
299
323
  : undefined
300
324
  }
301
325
  >
302
326
  <Text
303
- tone={variant !== 'solid' ? stylesForVariant.textTone : undefined}
327
+ tone={stylesForVariant.textTone}
304
328
  weight="medium"
305
329
  size={size}
306
330
  baseline={false}
@@ -319,19 +343,18 @@ export const useButtonStyles = ({
319
343
  tone,
320
344
  bleedY,
321
345
  loading,
322
- }: ButtonProps): BoxProps => {
346
+ radius = 'large',
347
+ }: ButtonProps & {
348
+ radius?: 'full' | 'large';
349
+ }): BoxProps => {
323
350
  const actionsContext = useContext(ActionsContext);
324
- const backgroundLightness = useBackgroundLightness();
325
- const isInverted = backgroundLightness === 'dark' && variant === 'soft';
326
351
  const size = sizeProp ?? actionsContext?.size ?? 'standard';
327
352
  const stylesForVariant = variants[variant][tone ?? 'default'];
328
- const background =
329
- typeof stylesForVariant.background === 'object'
330
- ? stylesForVariant.background[backgroundLightness]
331
- : stylesForVariant.background;
353
+ const colorConstrast = useColorContrast();
354
+ const lightness = useBackgroundLightness();
332
355
 
333
356
  return {
334
- borderRadius: 'large',
357
+ borderRadius: radius,
335
358
  width: 'full',
336
359
  position: 'relative',
337
360
  display: 'block',
@@ -341,13 +364,22 @@ export const useButtonStyles = ({
341
364
  textAlign: 'center',
342
365
  userSelect: 'none',
343
366
  cursor: !loading ? 'pointer' : undefined,
344
- background: !isInverted ? background : undefined,
367
+ background:
368
+ stylesForVariant.background &&
369
+ typeof stylesForVariant.background !== 'string'
370
+ ? colorConstrast(stylesForVariant.background)
371
+ : stylesForVariant.background,
345
372
  className: [
373
+ variant === 'soft' && lightness.lightMode === 'dark'
374
+ ? styles.invertedBackgroundsLightMode.soft
375
+ : null,
376
+ variant === 'soft' && lightness.darkMode === 'dark'
377
+ ? styles.invertedBackgroundsDarkMode.soft
378
+ : null,
346
379
  styles.root,
347
- isInverted ? styles.invertedBackgrounds.soft : undefined,
348
- size === 'small' ? virtualTouchable({ xAxis: false }) : undefined,
380
+ size === 'small' ? virtualTouchable({ xAxis: false }) : null,
349
381
  size === 'standard' ? styles.standard : styles.small,
350
- bleedY ? styles.bleedY : undefined,
382
+ bleedY ? styles.bleedY : null,
351
383
  ],
352
384
  } as const;
353
385
  };
@@ -9,7 +9,7 @@ import { Box, BoxProps } from '../Box/Box';
9
9
  import buildDataAttributes, {
10
10
  DataAttributeMap,
11
11
  } from '../private/buildDataAttributes';
12
- import * as styles from './Card.css';
12
+ import { Keyline } from '../private/Keyline/Keyline';
13
13
 
14
14
  export const validCardComponents = [
15
15
  'div',
@@ -78,18 +78,7 @@ export const Card = ({
78
78
  borderRadius={resolvedRounding}
79
79
  {...(data ? buildDataAttributes(data) : undefined)}
80
80
  >
81
- {tone ? (
82
- <Box
83
- position="absolute"
84
- top={0}
85
- bottom={0}
86
- left={0}
87
- paddingLeft="xxsmall"
88
- borderRadius={resolvedRounding}
89
- background={tone}
90
- className={styles.toneKeyline}
91
- />
92
- ) : null}
81
+ {tone ? <Keyline tone={tone} borderRadius={resolvedRounding} /> : null}
93
82
  {children}
94
83
  </Box>
95
84
  );
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from 'react';
2
2
  import { ComponentScreenshot } from '../../../site/src/types';
3
- import { Badge, Checkbox, Text } from '../';
3
+ import { Badge, Checkbox, Stack, Text } from '../';
4
4
 
5
5
  export const screenshots: ComponentScreenshot = {
6
6
  screenshotWidths: [320],
@@ -49,13 +49,22 @@ export const screenshots: ComponentScreenshot = {
49
49
  {
50
50
  label: 'Disabled',
51
51
  Example: ({ id, handler }) => (
52
- <Checkbox
53
- id={id}
54
- disabled={true}
55
- checked={false}
56
- onChange={handler}
57
- label="Label"
58
- />
52
+ <Stack space="gutter">
53
+ <Checkbox
54
+ id={id}
55
+ disabled={true}
56
+ checked={false}
57
+ onChange={handler}
58
+ label="Label"
59
+ />
60
+ <Checkbox
61
+ id={id}
62
+ disabled={true}
63
+ checked={true}
64
+ onChange={handler}
65
+ label="Label"
66
+ />
67
+ </Stack>
59
68
  ),
60
69
  },
61
70
  {
@@ -1,11 +1,52 @@
1
- import { style } from '@vanilla-extract/css';
1
+ import {
2
+ assignVars,
3
+ createThemeContract,
4
+ style,
5
+ styleVariants,
6
+ } from '@vanilla-extract/css';
7
+ import { colorModeStyle } from '../../css/colorModeStyle';
2
8
  import { vars } from '../../themes/vars.css';
3
9
 
4
10
  export const base = style({
5
11
  height: vars.borderWidth.standard,
6
12
  });
7
13
 
8
- export const weight = {
9
- regular: style({ background: vars.borderColor.neutralLight }),
10
- strong: style({ background: vars.borderColor.neutral }),
14
+ const weightVars = createThemeContract({
15
+ regular: null,
16
+ strong: null,
17
+ });
18
+
19
+ export const regular = style({ background: weightVars.regular });
20
+ export const strong = style({ background: weightVars.strong });
21
+
22
+ const lightModeVars = {
23
+ vars: assignVars(weightVars, {
24
+ regular: vars.borderColor.neutralLight,
25
+ strong: vars.borderColor.neutral,
26
+ }),
27
+ };
28
+
29
+ const darkModeVars = {
30
+ vars: assignVars(weightVars, {
31
+ regular: vars.borderColor.neutral,
32
+ strong: vars.borderColor.neutralLight,
33
+ }),
11
34
  };
35
+
36
+ export const lightModeWeight = styleVariants({
37
+ light: colorModeStyle({
38
+ lightMode: lightModeVars,
39
+ }),
40
+ dark: colorModeStyle({
41
+ lightMode: darkModeVars,
42
+ }),
43
+ });
44
+
45
+ export const darkModeWeight = styleVariants({
46
+ light: colorModeStyle({
47
+ darkMode: lightModeVars,
48
+ }),
49
+ dark: colorModeStyle({
50
+ darkMode: darkModeVars,
51
+ }),
52
+ });
@@ -1,21 +1,27 @@
1
1
  import React from 'react';
2
+ import { useBackgroundLightness } from '../Box/BackgroundContext';
2
3
  import { Box } from '../Box/Box';
3
4
  import * as styles from './Divider.css';
4
5
 
5
6
  export interface DividerProps {
6
- weight?: keyof typeof styles.weight;
7
+ weight?: 'regular' | 'strong';
7
8
  }
8
9
 
9
- const defaultWeight = 'regular';
10
- export const Divider = ({ weight = defaultWeight }: DividerProps) => (
11
- <Box position="relative">
12
- <Box
13
- position="absolute"
14
- width="full"
15
- className={[
16
- styles.base,
17
- styles.weight[weight] || styles.weight[defaultWeight],
18
- ]}
19
- />
20
- </Box>
21
- );
10
+ export const Divider = ({ weight = 'regular' }: DividerProps) => {
11
+ const lightness = useBackgroundLightness();
12
+
13
+ return (
14
+ <Box position="relative">
15
+ <Box
16
+ position="absolute"
17
+ width="full"
18
+ className={[
19
+ styles.base,
20
+ weight === 'strong' ? styles.strong : styles.regular,
21
+ styles.lightModeWeight[lightness.lightMode],
22
+ styles.darkModeWeight[lightness.darkMode],
23
+ ]}
24
+ />
25
+ </Box>
26
+ );
27
+ };
@@ -202,7 +202,6 @@ const docs: ComponentDocs = {
202
202
  <Strong>disabled</Strong> prop.
203
203
  </Text>
204
204
  ),
205
- background: 'surface',
206
205
  Example: ({ id, setState }) =>
207
206
  source(
208
207
  <Dropdown
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import type { ReactNode } from 'react';
2
3
  import source from '../../utils/source.macro';
3
4
  import { ComponentDocs } from '../../../site/src/types';
4
5
  import {
@@ -13,7 +14,6 @@ import {
13
14
  Notice,
14
15
  } from '../';
15
16
  import { Placeholder } from '../../playroom/components';
16
- import { ReactNode } from 'markdown-to-jsx/node_modules/@types/react';
17
17
 
18
18
  const Container = ({ children }: { children: ReactNode }) => (
19
19
  <Box maxWidth="xsmall">{children}</Box>
@@ -25,6 +25,12 @@ export const screenshots: ComponentScreenshot = {
25
25
  />
26
26
  ),
27
27
  },
28
+ {
29
+ label: 'Neutral Field Message',
30
+ Example: ({ id }) => (
31
+ <FieldMessage id={id} message="This is a neutral message." />
32
+ ),
33
+ },
28
34
  {
29
35
  label: 'Critical with long (wrapping) message',
30
36
  Container: ({ children }) => (
@@ -133,12 +133,14 @@ const docs: ComponentDocs = {
133
133
  </Text>
134
134
  </>
135
135
  ),
136
- background: 'brand',
136
+ background: 'neutral',
137
137
  Example: () =>
138
138
  source(
139
- <Heading level="2">
140
- This Heading is inverted to improve contrast.
141
- </Heading>,
139
+ <Box background="neutral">
140
+ <Heading level="2">
141
+ This Heading is inverted to improve contrast.
142
+ </Heading>
143
+ </Box>,
142
144
  ),
143
145
  },
144
146
  ],
@@ -1,7 +1,10 @@
1
1
  import React, { ReactNode, Fragment } from 'react';
2
2
  import { ComponentScreenshot } from '../../../site/src/types';
3
3
  import { heading as headingLevels } from '../../hooks/typography/typography.css';
4
- import { Box, Heading, Stack } from '../';
4
+ import { Heading, Stack } from '../';
5
+ // TODO: COLORMODE RELEASE
6
+ // Use public import
7
+ import { Box } from '../Box/Box';
5
8
  import { backgrounds, textAlignments } from '../../utils/docsHelpers';
6
9
 
7
10
  const Container = ({ children }: { children: ReactNode }) => (
@@ -24,10 +24,9 @@ export const size = styleVariants(vars.textSize, ({ mobile, tablet }) =>
24
24
  }),
25
25
  );
26
26
 
27
- export const color = {
28
- dark: style({ fill: vars.backgroundColor.surface }),
29
- light: style({ fill: vars.backgroundColor.neutral }),
30
- };
27
+ export const currentColor = style({
28
+ fill: 'currentcolor',
29
+ });
31
30
 
32
31
  const bounce = keyframes({
33
32
  '33%': {
@@ -1,6 +1,9 @@
1
1
  import React, { Fragment } from 'react';
2
2
  import { ComponentScreenshot } from '../../../site/src/types';
3
- import { Box, Loader } from '../';
3
+ import { Loader } from '../';
4
+ // TODO: COLORMODE RELEASE
5
+ // Use public import
6
+ import { Box } from '../Box/Box';
4
7
  import { backgrounds } from '../../utils/docsHelpers';
5
8
 
6
9
  export const screenshots: ComponentScreenshot = {
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import { Box } from '../Box/Box';
3
- import { useBackgroundLightness } from '../Box/BackgroundContext';
4
3
  import buildDataAttributes, {
5
4
  DataAttributeMap,
6
5
  } from '../private/buildDataAttributes';
7
6
  import { atoms } from '../../css/atoms/atoms';
8
7
  import * as styles from './Loader.css';
8
+ import { useTextTone } from '../../hooks/typography';
9
9
 
10
10
  interface LoaderProps {
11
11
  size?: keyof typeof styles.size;
@@ -19,34 +19,31 @@ export const Loader = ({
19
19
  'aria-label': ariaLabel = 'Loading',
20
20
  delayVisibility = false,
21
21
  data,
22
- }: LoaderProps) => {
23
- const parentBackgroundColor = useBackgroundLightness();
24
-
25
- return (
26
- <Box
27
- display="flex"
28
- alignItems="center"
22
+ }: LoaderProps) => (
23
+ <Box
24
+ display="flex"
25
+ alignItems="center"
26
+ className={[
27
+ styles.rootSize[size],
28
+ delayVisibility ? styles.delay : undefined,
29
+ ]}
30
+ aria-label={ariaLabel}
31
+ {...(data ? buildDataAttributes(data) : undefined)}
32
+ >
33
+ <svg
34
+ xmlns="http://www.w3.org/2000/svg"
29
35
  className={[
30
- styles.rootSize[size],
31
- delayVisibility ? styles.delay : undefined,
32
- ]}
33
- aria-label={ariaLabel}
34
- {...(data ? buildDataAttributes(data) : undefined)}
36
+ atoms({ reset: 'svg' }),
37
+ styles.size[size],
38
+ styles.currentColor,
39
+ useTextTone({ tone: 'neutral' }),
40
+ ].join(' ')}
41
+ viewBox="0 0 300 134"
42
+ aria-hidden
35
43
  >
36
- <svg
37
- xmlns="http://www.w3.org/2000/svg"
38
- className={[
39
- atoms({ reset: 'svg' }),
40
- styles.size[size],
41
- styles.color[parentBackgroundColor],
42
- ].join(' ')}
43
- viewBox="0 0 300 134"
44
- aria-hidden
45
- >
46
- <circle className={styles.circle} cy="67" cx="40" r="40" />
47
- <circle className={styles.circle} cy="67" cx="150" r="40" />
48
- <circle className={styles.circle} cy="67" cx="260" r="40" />
49
- </svg>
50
- </Box>
51
- );
52
- };
44
+ <circle className={styles.circle} cy="67" cx="40" r="40" />
45
+ <circle className={styles.circle} cy="67" cx="150" r="40" />
46
+ <circle className={styles.circle} cy="67" cx="260" r="40" />
47
+ </svg>
48
+ </Box>
49
+ );