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.
- package/.nvmrc +1 -1
- package/CHANGELOG.md +58 -0
- package/color-mode/index.ts +9 -0
- package/css/atoms.docs.tsx +26 -20
- package/css/colorModeStyle.docs.tsx +81 -0
- package/css/index.ts +5 -1
- package/lib/components/Alert/Alert.css.ts +19 -0
- package/lib/components/Alert/Alert.docs.tsx +17 -5
- package/lib/components/Alert/Alert.tsx +61 -30
- package/lib/components/Badge/Badge.tsx +11 -31
- package/lib/components/Box/BackgroundContext.tsx +34 -17
- package/lib/components/Box/Box.docs.tsx +34 -14
- package/lib/components/Box/Box.playroom.tsx +37 -0
- package/lib/components/Box/Box.tsx +38 -7
- package/lib/components/Box/BoxRenderer.tsx +28 -9
- package/lib/components/Box/ColoredBox.tsx +168 -13
- package/lib/components/BraidPortal/BraidPortal.tsx +4 -1
- package/lib/components/BraidProvider/BraidProvider.tsx +11 -3
- package/lib/components/BraidProvider/VanillaThemeContainer.tsx +24 -0
- package/lib/components/Button/Button.css.ts +38 -5
- package/lib/components/Button/Button.screenshots.tsx +4 -1
- package/lib/components/Button/Button.tsx +102 -70
- package/lib/components/Card/Card.tsx +2 -13
- package/lib/components/Checkbox/Checkbox.screenshots.tsx +17 -8
- package/lib/components/Divider/Divider.css.ts +45 -4
- package/lib/components/Divider/Divider.tsx +20 -14
- package/lib/components/Dropdown/Dropdown.docs.tsx +0 -1
- package/lib/components/FieldLabel/FieldLabel.docs.tsx +1 -1
- package/lib/components/FieldMessage/FieldMessage.screenshots.tsx +6 -0
- package/lib/components/Heading/Heading.docs.tsx +6 -4
- package/lib/components/Heading/Heading.screenshots.tsx +4 -1
- package/lib/components/Loader/Loader.css.ts +3 -4
- package/lib/components/Loader/Loader.screenshots.tsx +4 -1
- package/lib/components/Loader/Loader.tsx +27 -30
- package/lib/components/MenuItem/MenuItemLink.tsx +9 -2
- package/lib/components/MenuItem/useMenuItem.tsx +4 -4
- package/lib/components/MenuItemCheckbox/MenuItemCheckbox.tsx +3 -1
- package/lib/components/MenuRenderer/testHelper.tsx +5 -2
- package/lib/components/Pagination/Pagination.css.ts +17 -3
- package/lib/components/Pagination/Pagination.tsx +6 -5
- package/lib/components/Rating/Rating.css.ts +16 -3
- package/lib/components/Rating/Rating.screenshots.tsx +4 -1
- package/lib/components/Rating/Rating.tsx +6 -1
- package/lib/components/Tabs/Tab.tsx +6 -2
- package/lib/components/Tabs/Tabs.css.ts +9 -1
- package/lib/components/Tabs/Tabs.tsx +4 -1
- package/lib/components/Text/Text.docs.tsx +4 -0
- package/lib/components/Text/Text.screenshots.tsx +8 -1
- package/lib/components/TextField/TextField.docs.tsx +0 -1
- package/lib/components/TextLink/TextLink.css.ts +139 -0
- package/lib/components/TextLink/TextLink.docs.tsx +1 -1
- package/lib/components/TextLink/TextLink.screenshots.tsx +3 -1
- package/lib/components/TextLink/TextLink.tsx +45 -37
- package/lib/components/Textarea/Highlight/Highlight.tsx +1 -1
- package/lib/components/Textarea/Textarea.docs.tsx +0 -1
- package/lib/components/Toggle/Toggle.css.ts +34 -7
- package/lib/components/Toggle/Toggle.tsx +8 -3
- package/lib/components/iconButtons/IconButton.css.ts +0 -32
- package/lib/components/iconButtons/IconButton.tsx +26 -48
- package/lib/components/icons/IconTip/IconTip.docs.tsx +20 -0
- package/lib/components/icons/IconTip/IconTip.tsx +12 -0
- package/lib/components/icons/IconTip/IconTipSvg.tsx +21 -0
- package/lib/components/icons/IconZoomIn/IconZoomIn.docs.tsx +20 -0
- package/lib/components/icons/IconZoomIn/IconZoomIn.tsx +12 -0
- package/lib/components/icons/IconZoomIn/IconZoomInSvg.tsx +20 -0
- package/lib/components/icons/IconZoomOut/IconZoomOut.docs.tsx +20 -0
- package/lib/components/icons/IconZoomOut/IconZoomOut.tsx +12 -0
- package/lib/components/icons/IconZoomOut/IconZoomOutSvg.tsx +20 -0
- package/lib/components/icons/Icons.screenshots.tsx +2 -2
- package/lib/components/icons/index.ts +3 -0
- package/lib/components/index.ts +3 -1
- package/lib/components/private/Field/Field.css.ts +2 -1
- package/lib/components/private/Field/Field.tsx +4 -6
- package/lib/components/private/InlineField/InlineField.css.ts +6 -6
- package/lib/components/private/InlineField/StyledInput.tsx +14 -9
- package/lib/components/private/Keyline/Keyline.css.ts +70 -0
- package/lib/components/private/Keyline/Keyline.tsx +38 -0
- package/lib/components/private/Placeholder/Placeholder.css.ts +44 -12
- package/lib/components/private/Placeholder/Placeholder.tsx +7 -3
- package/lib/components/private/touchable/debugTouchable.ts +7 -7
- package/lib/components/private/touchable/virtualTouchable.css.ts +12 -12
- package/lib/components/useToast/Toast.tsx +2 -8
- package/lib/css/atoms/atomicProperties.ts +7 -2
- package/lib/css/atoms/sprinkles.css.ts +24 -0
- package/lib/css/colorModeStyle.ts +33 -0
- package/lib/css/reset/reset.css.ts +12 -8
- package/lib/hooks/typography/index.ts +8 -61
- package/lib/hooks/typography/typography.css.ts +95 -93
- package/lib/hooks/useIcon/index.ts +4 -2
- package/lib/playroom/FrameComponent.tsx +50 -17
- package/lib/playroom/components.ts +1 -0
- package/lib/playroom/useScope.ts +44 -1
- package/lib/stories/all.stories.tsx +61 -30
- package/lib/themes/baseTokens/apac.ts +8 -0
- package/lib/themes/catho/tokens.ts +23 -6
- package/lib/themes/docs/tokens.ts +8 -0
- package/lib/themes/makeBraidTheme.ts +4 -1
- package/lib/themes/occ/tokens.ts +25 -5
- package/lib/themes/seekAnz/tokens.ts +25 -5
- package/lib/themes/tokenType.ts +8 -0
- package/lib/themes/wireframe/tokens.ts +22 -5
- package/package.json +2 -2
- package/sku.config.js +1 -0
- package/sku.routes.js +2 -0
- package/tsconfig.json +1 -0
- 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
|
-
|
|
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
|
-
|
|
|
58
|
-
|
|
|
58
|
+
| ColorContrastValue<BoxBackgroundVariant>
|
|
59
|
+
| BoxBackgroundVariant
|
|
59
60
|
| undefined;
|
|
60
61
|
backgroundHover:
|
|
61
|
-
|
|
|
62
|
-
|
|
|
62
|
+
| ColorContrastValue<BoxBackgroundVariant>
|
|
63
|
+
| BoxBackgroundVariant
|
|
63
64
|
| undefined;
|
|
64
65
|
backgroundActive:
|
|
65
|
-
|
|
|
66
|
-
|
|
|
66
|
+
| ColorContrastValue<BoxBackgroundVariant>
|
|
67
|
+
| BoxBackgroundVariant
|
|
67
68
|
| undefined;
|
|
68
|
-
boxShadow:
|
|
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
|
-
|
|
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=
|
|
240
|
-
variant="focus"
|
|
241
|
-
onlyVisibleForKeyboardNavigation
|
|
242
|
-
className={styles.focusOverlay}
|
|
243
|
-
/>
|
|
244
|
-
<FieldOverlay
|
|
245
|
-
borderRadius="large"
|
|
247
|
+
borderRadius={radius}
|
|
246
248
|
background={
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
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=
|
|
265
|
+
borderRadius={radius}
|
|
258
266
|
background={
|
|
259
|
-
|
|
260
|
-
|
|
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
|
-
|
|
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
|
|
272
|
-
borderRadius=
|
|
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'
|
|
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
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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={
|
|
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
|
-
|
|
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
|
|
329
|
-
|
|
330
|
-
? stylesForVariant.background[backgroundLightness]
|
|
331
|
-
: stylesForVariant.background;
|
|
353
|
+
const colorConstrast = useColorContrast();
|
|
354
|
+
const lightness = useBackgroundLightness();
|
|
332
355
|
|
|
333
356
|
return {
|
|
334
|
-
borderRadius:
|
|
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:
|
|
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
|
-
|
|
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 :
|
|
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
|
|
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
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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 {
|
|
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
|
-
|
|
9
|
-
regular:
|
|
10
|
-
strong:
|
|
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?:
|
|
7
|
+
weight?: 'regular' | 'strong';
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
};
|
|
@@ -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: '
|
|
136
|
+
background: 'neutral',
|
|
137
137
|
Example: () =>
|
|
138
138
|
source(
|
|
139
|
-
<
|
|
140
|
-
|
|
141
|
-
|
|
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 {
|
|
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
|
|
28
|
-
|
|
29
|
-
|
|
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 {
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
+
);
|