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
@@ -3,6 +3,8 @@ import { calc } from '@vanilla-extract/css-utils';
3
3
  import { vars } from '../../themes/vars.css';
4
4
  import { hitArea } from '../private/touchable/hitArea';
5
5
  import { debugTouchable } from '../private/touchable/debugTouchable';
6
+ import { rgba } from 'polished';
7
+ import { colorModeStyle } from '../../css/colorModeStyle';
6
8
 
7
9
  const sizes = {
8
10
  standard: 'standard',
@@ -21,12 +23,12 @@ export const root = style({
21
23
  },
22
24
  });
23
25
 
24
- export const realField = style({
25
- height: hitArea,
26
- selectors: {
27
- ...debugTouchable(),
26
+ export const realField = style([
27
+ {
28
+ height: hitArea,
28
29
  },
29
- });
30
+ debugTouchable(),
31
+ ]);
30
32
 
31
33
  export const realFieldPosition = styleVariants(sizes, (size) => ({
32
34
  top: calc(hitArea)
@@ -61,8 +63,33 @@ export const slideTrack = styleVariants(sizes, (size) => ({
61
63
  height: calc.subtract(vars.inlineFieldSize[size], vars.grid),
62
64
  }));
63
65
 
64
- export const slideTrackBackground = style({
65
- backgroundColor: vars.borderColor.neutralLight,
66
+ export const slideTrackBgLightMode = styleVariants({
67
+ light: colorModeStyle({
68
+ lightMode: {
69
+ background: rgba('#000', 0.08),
70
+ },
71
+ }),
72
+ dark: colorModeStyle({
73
+ lightMode: {
74
+ background: rgba('#fff', 0.12),
75
+ },
76
+ }),
77
+ });
78
+
79
+ export const slideTrackBgDarkMode = styleVariants({
80
+ light: colorModeStyle({
81
+ darkMode: {
82
+ background: rgba('#000', 0.08),
83
+ },
84
+ }),
85
+ dark: colorModeStyle({
86
+ darkMode: {
87
+ background: rgba('#fff', 0.12),
88
+ },
89
+ }),
90
+ });
91
+
92
+ export const slideTrackMask = style({
66
93
  // Fix for Safari border-radius, overflow hidden, transform bug:
67
94
  // https://gist.github.com/ayamflow/b602ab436ac9f05660d9c15190f4fd7b
68
95
  WebkitMaskImage: '-webkit-radial-gradient(white, black)',
@@ -40,7 +40,7 @@ export const Toggle = forwardRef<HTMLInputElement, ToggleProps>(
40
40
  { id, on, onChange, label, align = 'left', size = 'standard', data },
41
41
  forwardedRef,
42
42
  ) => {
43
- const showBorder = useBackgroundLightness() === 'light';
43
+ const lightness = useBackgroundLightness();
44
44
 
45
45
  return (
46
46
  <Box
@@ -84,7 +84,12 @@ export const Toggle = forwardRef<HTMLInputElement, ToggleProps>(
84
84
  width="full"
85
85
  overflow="hidden"
86
86
  borderRadius="full"
87
- className={[styles.slideTrack[size], styles.slideTrackBackground]}
87
+ className={[
88
+ styles.slideTrack[size],
89
+ styles.slideTrackMask,
90
+ styles.slideTrackBgLightMode[lightness.lightMode],
91
+ styles.slideTrackBgDarkMode[lightness.darkMode],
92
+ ]}
88
93
  >
89
94
  <Box
90
95
  position="absolute"
@@ -98,7 +103,7 @@ export const Toggle = forwardRef<HTMLInputElement, ToggleProps>(
98
103
  <Box
99
104
  position="absolute"
100
105
  background="surface"
101
- boxShadow={showBorder ? 'borderField' : undefined}
106
+ boxShadow="borderField"
102
107
  transition="fast"
103
108
  display="flex"
104
109
  alignItems="center"
@@ -10,35 +10,3 @@ export const button = style({
10
10
  },
11
11
  },
12
12
  });
13
-
14
- export const forceActive = style({});
15
- export const darkBackground = style({});
16
-
17
- export const hoverOverlay = style({
18
- selectors: {
19
- [`${button}:hover &, ${button}:focus &`]: {
20
- opacity: 1,
21
- },
22
- [`${button}:hover &${darkBackground}, ${button}:focus &${darkBackground}`]:
23
- {
24
- opacity: 0.2,
25
- },
26
- [`${button}:active &, ${forceActive}&`]: {
27
- opacity: 0.8,
28
- },
29
- [`${button}:active &${darkBackground}, ${forceActive}&${darkBackground}`]: {
30
- opacity: 0.075,
31
- },
32
- },
33
- });
34
-
35
- export const focusOverlay = style({
36
- selectors: {
37
- [`${button}:focus &`]: {
38
- opacity: 1,
39
- },
40
- [`${button}:focus &${darkBackground}`]: {
41
- opacity: 0.15,
42
- },
43
- },
44
- });
@@ -6,16 +6,12 @@ import React, {
6
6
  forwardRef,
7
7
  } from 'react';
8
8
  import { Box } from '../Box/Box';
9
- import { Overlay } from '../private/Overlay/Overlay';
10
9
  import buildDataAttributes, {
11
10
  DataAttributeMap,
12
11
  } from '../private/buildDataAttributes';
13
- import { iconSize, iconContainerSize, UseIconProps } from '../../hooks/useIcon';
12
+ import { iconContainerSize, UseIconProps } from '../../hooks/useIcon';
14
13
  import { virtualTouchable } from '../private/touchable/virtualTouchable';
15
- import {
16
- useBackground,
17
- useBackgroundLightness,
18
- } from '../Box/BackgroundContext';
14
+ import { ButtonOverlays, useButtonStyles } from '../Button/Button';
19
15
  import * as styles from './IconButton.css';
20
16
 
21
17
  type NativeButtonProps = AllHTMLAttributes<HTMLButtonElement>;
@@ -52,9 +48,6 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
52
48
  },
53
49
  forwardedRef,
54
50
  ) => {
55
- const background = useBackground();
56
- const backgroundLightness = useBackgroundLightness();
57
-
58
51
  const handleMouseDown = useCallback(
59
52
  (event: MouseEvent<HTMLButtonElement>) => {
60
53
  if (typeof onMouseDown !== 'function') {
@@ -80,14 +73,18 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
80
73
  [onClick, onMouseDown],
81
74
  );
82
75
 
76
+ const { className, ...buttonStyles } = useButtonStyles({
77
+ variant: 'transparent',
78
+ tone: 'neutral',
79
+ size: 'standard',
80
+ radius: 'full',
81
+ });
82
+
83
83
  return (
84
84
  <Box
85
85
  component="button"
86
86
  type="button"
87
87
  ref={forwardedRef}
88
- cursor="pointer"
89
- outline="none"
90
- className={[styles.button, virtualTouchable()]}
91
88
  zIndex={0}
92
89
  aria-label={label}
93
90
  aria-haspopup={ariaHasPopUp}
@@ -97,46 +94,27 @@ export const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
97
94
  onKeyUp={onKeyUp}
98
95
  onKeyDown={onKeyDown}
99
96
  onMouseDown={handleMouseDown}
100
- transform={{ active: 'touchable' }}
101
- transition="touchable"
102
97
  tabIndex={!keyboardAccessible ? -1 : undefined}
103
98
  {...(data ? buildDataAttributes(data) : undefined)}
99
+ {...buttonStyles}
100
+ className={[
101
+ className,
102
+ styles.button,
103
+ virtualTouchable(),
104
+ iconContainerSize(),
105
+ ]}
104
106
  >
105
- <Box
106
- position="relative"
107
- display="flex"
108
- className={iconContainerSize()}
109
- alignItems="center"
110
- justifyContent="center"
111
- pointerEvents="none"
107
+ <ButtonOverlays
108
+ variant="transparent"
109
+ tone="neutral"
110
+ size="standard"
111
+ radius="full"
112
+ keyboardFocusable={keyboardAccessible}
113
+ labelSpacing={false}
114
+ forceActive={active}
112
115
  >
113
- <Overlay
114
- background={
115
- background === 'body' || background === 'surface'
116
- ? 'neutralLight'
117
- : 'surface'
118
- }
119
- transition="fast"
120
- borderRadius="full"
121
- className={[
122
- styles.hoverOverlay,
123
- active && styles.forceActive,
124
- backgroundLightness === 'dark' && styles.darkBackground,
125
- ]}
126
- />
127
- {keyboardAccessible ? (
128
- <Overlay
129
- boxShadow="outlineFocus"
130
- transition="fast"
131
- borderRadius="full"
132
- className={styles.focusOverlay}
133
- onlyVisibleForKeyboardNavigation
134
- />
135
- ) : null}
136
- <Box position="relative" className={iconSize()}>
137
- {children({ size: 'fill', tone })}
138
- </Box>
139
- </Box>
116
+ {children({ tone })}
117
+ </ButtonOverlays>
140
118
  </Box>
141
119
  );
142
120
  },
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { ComponentDocs } from '../../../../site/src/types';
3
+ import source from '../../../utils/source.macro';
4
+ import { IconTip, Heading, Stack } from '../../';
5
+
6
+ const docs: ComponentDocs = {
7
+ category: 'Icon',
8
+ migrationGuide: true,
9
+ Example: () =>
10
+ source(
11
+ <Stack space="none" align="center">
12
+ <Heading component="div" level="1">
13
+ <IconTip />
14
+ </Heading>
15
+ </Stack>,
16
+ ),
17
+ alternatives: [],
18
+ };
19
+
20
+ export default docs;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Box } from '../../Box/Box';
3
+ import useIcon, { UseIconProps } from '../../../hooks/useIcon';
4
+ import { IconTipSvg } from './IconTipSvg';
5
+
6
+ export type IconTipProps = UseIconProps;
7
+
8
+ export const IconTip = (props: IconTipProps) => {
9
+ const iconProps = useIcon(props);
10
+
11
+ return <Box component={IconTipSvg} {...iconProps} />;
12
+ };
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+
3
+ import type { SVGProps } from '../SVGTypes';
4
+
5
+ export const IconTipSvg = ({ title, titleId, ...props }: SVGProps) => (
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ width={16}
9
+ height={16}
10
+ viewBox="0 0 24 24"
11
+ focusable="false"
12
+ fill="currentColor"
13
+ aria-labelledby={titleId}
14
+ {...props}
15
+ >
16
+ {title ? <title id={titleId}>{title}</title> : null}
17
+ <path d="M9 18.957a1 1 0 0 1-1-1V16a8.96 8.96 0 0 0-1.485-2.633l-.277-.391a7 7 0 1 1 11.524 0l-.277.391A8.96 8.96 0 0 0 16 16v1.932a1 1 0 0 1-2 0V16c0-1.095.878-2.419 1.856-3.793l.261-.368a5 5 0 1 0-8.234 0l.26.368C9.124 13.581 10 14.905 10 16v1.957a1 1 0 0 1-1 1z" />
18
+ <path d="M13.286 22h-2.572A2.761 2.761 0 0 1 8 19.2V17a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v2.2a2.761 2.761 0 0 1-2.714 2.8zM10 18v1.2a.761.761 0 0 0 .714.8h2.572a.761.761 0 0 0 .714-.8V18zm13-8h-2a1 1 0 0 1 0-2h2a1 1 0 0 1 0 2zm-1.475 5.5a.994.994 0 0 1-.499-.134l-1.732-1a1 1 0 1 1 1-1.732l1.732 1a1 1 0 0 1-.5 1.866zm-1.73-10a1 1 0 0 1-.501-1.866l1.732-1a1 1 0 1 1 1 1.732l-1.732 1a.994.994 0 0 1-.5.134zM3 10H1a1 1 0 0 1 0-2h2a1 1 0 0 1 0 2zm-.525 5.5a1 1 0 0 1-.501-1.866l1.732-1a1 1 0 1 1 1 1.732l-1.732 1a.994.994 0 0 1-.5.134zm1.73-10a.994.994 0 0 1-.499-.134l-1.732-1a1 1 0 0 1 1-1.732l1.732 1a1 1 0 0 1-.5 1.866zM15 10a1 1 0 0 1-1-1 2.003 2.003 0 0 0-2-2 1 1 0 0 1 0-2 4.004 4.004 0 0 1 4 4 1 1 0 0 1-1 1z" />
19
+ <path d="M14 21a2 2 0 0 1-4 0" />
20
+ </svg>
21
+ );
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { ComponentDocs } from '../../../../site/src/types';
3
+ import source from '../../../utils/source.macro';
4
+ import { IconZoomIn, Heading, Stack } from '../../';
5
+
6
+ const docs: ComponentDocs = {
7
+ category: 'Icon',
8
+ migrationGuide: true,
9
+ Example: () =>
10
+ source(
11
+ <Stack space="none" align="center">
12
+ <Heading component="div" level="1">
13
+ <IconZoomIn />
14
+ </Heading>
15
+ </Stack>,
16
+ ),
17
+ alternatives: [],
18
+ };
19
+
20
+ export default docs;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Box } from '../../Box/Box';
3
+ import useIcon, { UseIconProps } from '../../../hooks/useIcon';
4
+ import { IconZoomInSvg } from './IconZoomInSvg';
5
+
6
+ export type IconZoomInProps = UseIconProps;
7
+
8
+ export const IconZoomIn = (props: IconZoomInProps) => {
9
+ const iconProps = useIcon(props);
10
+
11
+ return <Box component={IconZoomInSvg} {...iconProps} />;
12
+ };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+
3
+ import type { SVGProps } from '../SVGTypes';
4
+
5
+ export const IconZoomInSvg = ({ title, titleId, ...props }: SVGProps) => (
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ width={16}
9
+ height={16}
10
+ viewBox="0 0 24 24"
11
+ focusable="false"
12
+ fill="currentColor"
13
+ aria-labelledby={titleId}
14
+ {...props}
15
+ >
16
+ {title ? <title id={titleId}>{title}</title> : null}
17
+ <path d="m21.707 20.293-3.682-3.682a9.022 9.022 0 1 0-1.414 1.414l3.682 3.682a1 1 0 0 0 1.414-1.414zM4 11a7 7 0 1 1 11.962 4.93c-.006.006-.013.008-.019.013s-.007.013-.012.02A6.995 6.995 0 0 1 4 11z" />
18
+ <path d="M14 10h-2V8a1 1 0 0 0-2 0v2H8a1 1 0 0 0 0 2h2v2a1 1 0 0 0 2 0v-2h2a1 1 0 0 0 0-2z" />
19
+ </svg>
20
+ );
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { ComponentDocs } from '../../../../site/src/types';
3
+ import source from '../../../utils/source.macro';
4
+ import { IconZoomOut, Heading, Stack } from '../../';
5
+
6
+ const docs: ComponentDocs = {
7
+ category: 'Icon',
8
+ migrationGuide: true,
9
+ Example: () =>
10
+ source(
11
+ <Stack space="none" align="center">
12
+ <Heading component="div" level="1">
13
+ <IconZoomOut />
14
+ </Heading>
15
+ </Stack>,
16
+ ),
17
+ alternatives: [],
18
+ };
19
+
20
+ export default docs;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { Box } from '../../Box/Box';
3
+ import useIcon, { UseIconProps } from '../../../hooks/useIcon';
4
+ import { IconZoomOutSvg } from './IconZoomOutSvg';
5
+
6
+ export type IconZoomOutProps = UseIconProps;
7
+
8
+ export const IconZoomOut = (props: IconZoomOutProps) => {
9
+ const iconProps = useIcon(props);
10
+
11
+ return <Box component={IconZoomOutSvg} {...iconProps} />;
12
+ };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+
3
+ import type { SVGProps } from '../SVGTypes';
4
+
5
+ export const IconZoomOutSvg = ({ title, titleId, ...props }: SVGProps) => (
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ width={16}
9
+ height={16}
10
+ viewBox="0 0 24 24"
11
+ focusable="false"
12
+ fill="currentColor"
13
+ aria-labelledby={titleId}
14
+ {...props}
15
+ >
16
+ {title ? <title id={titleId}>{title}</title> : null}
17
+ <path d="m21.707 20.293-3.682-3.682a9.022 9.022 0 1 0-1.414 1.414l3.682 3.682a1 1 0 0 0 1.414-1.414zM4 11a7 7 0 1 1 11.962 4.93c-.006.006-.013.008-.019.013s-.007.013-.012.02A6.995 6.995 0 0 1 4 11z" />
18
+ <path d="M14 10H8a1 1 0 0 0 0 2h6a1 1 0 0 0 0-2z" />
19
+ </svg>
20
+ );
@@ -75,8 +75,8 @@ export const screenshots: ComponentScreenshot = {
75
75
  {
76
76
  label: 'Auto Tone (via TextContext)',
77
77
  Example: () => {
78
- const iconTones = ['neutral', ...Object.keys(tones)].sort() as Array<
79
- keyof typeof tones | 'neutral'
78
+ const iconTones = Object.keys(tones).sort() as Array<
79
+ keyof typeof tones
80
80
  >;
81
81
 
82
82
  return (
@@ -69,7 +69,10 @@ export { IconTag } from './IconTag/IconTag';
69
69
  export { IconThumb } from './IconThumb/IconThumb';
70
70
  export { IconTick } from './IconTick/IconTick';
71
71
  export { IconTime } from './IconTime/IconTime';
72
+ export { IconTip } from './IconTip/IconTip';
72
73
  export { IconUpload } from './IconUpload/IconUpload';
73
74
  export { IconVideo } from './IconVideo/IconVideo';
74
75
  export { IconVisibility } from './IconVisibility/IconVisibility';
75
76
  export { IconWorkExperience } from './IconWorkExperience/IconWorkExperience';
77
+ export { IconZoomIn } from './IconZoomIn/IconZoomIn';
78
+ export { IconZoomOut } from './IconZoomOut/IconZoomOut';
@@ -19,7 +19,9 @@ export { Alert } from './Alert/Alert';
19
19
  export { Autosuggest } from './Autosuggest/Autosuggest';
20
20
  export { filterSuggestions } from './Autosuggest/filterSuggestions';
21
21
  export { Badge } from './Badge/Badge';
22
- export { Box } from './Box/Box';
22
+ // TODO: COLORMODE RELEASE
23
+ // Expose internal Box
24
+ export { PublicBox as Box } from './Box/Box';
23
25
  export { BoxRenderer } from './Box/BoxRenderer';
24
26
  export { Button } from './Button/Button';
25
27
  export { ButtonLink } from './ButtonLink/ButtonLink';
@@ -40,5 +40,6 @@ export const hoverOverlay = style({
40
40
 
41
41
  export const verticalDivider = style({
42
42
  width: vars.borderWidth.standard,
43
- background: vars.borderColor.neutralLight,
43
+ background: vars.borderColor.field,
44
+ opacity: 0.4,
44
45
  });
@@ -2,7 +2,6 @@ import assert from 'assert';
2
2
  import React, { Fragment, ReactNode, AllHTMLAttributes } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { Box, BoxProps } from '../../Box/Box';
5
- import { useBackgroundLightness } from '../../Box/BackgroundContext';
6
5
  import { FieldLabel, FieldLabelProps } from '../../FieldLabel/FieldLabel';
7
6
  import {
8
7
  FieldMessage,
@@ -122,9 +121,9 @@ export const Field = ({
122
121
  'description' in restProps && restProps.description
123
122
  ? `${id}-description`
124
123
  : undefined;
125
- const fieldBackground = disabled ? 'neutralSoft' : 'surface';
126
- const showFieldBorder =
127
- useBackgroundLightness() === 'light' && (tone !== 'critical' || disabled);
124
+ const fieldBackground: BoxProps['background'] = disabled
125
+ ? { lightMode: 'neutralSoft', darkMode: 'neutral' }
126
+ : { lightMode: 'surface' };
128
127
 
129
128
  const hasValue = typeof value === 'string' ? value.length > 0 : value != null;
130
129
  const hasVisualLabel = 'label' in restProps;
@@ -135,7 +134,7 @@ export const Field = ({
135
134
  <Fragment>
136
135
  <FieldOverlay
137
136
  variant={disabled ? 'disabled' : 'default'}
138
- visible={showFieldBorder}
137
+ visible={tone !== 'critical' || disabled}
139
138
  />
140
139
  <FieldOverlay
141
140
  variant="critical"
@@ -207,7 +206,6 @@ export const Field = ({
207
206
  styles.field,
208
207
  styles.placeholderColor,
209
208
  useText({
210
- backgroundContext: fieldBackground,
211
209
  tone: hasValue && !disabled ? 'neutral' : 'secondary',
212
210
  size: 'standard',
213
211
  baseline: false,
@@ -19,13 +19,13 @@ export const root = style({
19
19
  },
20
20
  });
21
21
 
22
- export const realField = style({
23
- width: hitArea,
24
- height: hitArea,
25
- selectors: {
26
- ...debugTouchable(),
22
+ export const realField = style([
23
+ {
24
+ width: hitArea,
25
+ height: hitArea,
27
26
  },
28
- });
27
+ debugTouchable(),
28
+ ]);
29
29
 
30
30
  export const realFieldPosition = styleVariants(sizes, (size: Size) => {
31
31
  const offset = calc(hitArea)
@@ -6,11 +6,10 @@ import React, {
6
6
  AllHTMLAttributes,
7
7
  } from 'react';
8
8
 
9
- import { useBackgroundLightness } from '../../Box/BackgroundContext';
10
9
  import { FieldOverlay } from '../FieldOverlay/FieldOverlay';
11
10
  import { IconMinus, IconTick } from '../../icons';
12
11
  import buildDataAttributes, { DataAttributeMap } from '../buildDataAttributes';
13
- import { Box } from '../../Box/Box';
12
+ import { Box, BoxProps } from '../../Box/Box';
14
13
  import * as styles from './InlineField.css';
15
14
  import type { Size } from './InlineField.css';
16
15
 
@@ -98,7 +97,11 @@ const Indicator = ({
98
97
  </Box>
99
98
  ) : (
100
99
  <Box
101
- background={disabled ? 'neutralLight' : 'formAccent'}
100
+ background={
101
+ disabled
102
+ ? { lightMode: 'neutralLight', darkMode: 'surfaceDark' }
103
+ : 'formAccent'
104
+ }
102
105
  transition="fast"
103
106
  width="full"
104
107
  height="full"
@@ -144,11 +147,13 @@ export const StyledInput = forwardRef<
144
147
 
145
148
  const isCheckbox = type === 'checkbox';
146
149
  const fieldBorderRadius = isCheckbox ? 'standard' : 'full';
147
- const accentBackground = disabled ? 'neutralLight' : 'formAccent';
148
- const showFieldBorder =
149
- useBackgroundLightness() === 'light' && (tone !== 'critical' || disabled);
150
-
150
+ const accentBackground: BoxProps['background'] = disabled
151
+ ? 'neutralLight'
152
+ : 'formAccent';
151
153
  const isMixed = isCheckbox && checked === 'mixed';
154
+ const fieldBackground: BoxProps['background'] = disabled
155
+ ? { lightMode: 'neutralSoft', darkMode: 'neutral' }
156
+ : { lightMode: 'surface' };
152
157
 
153
158
  useEffect(() => {
154
159
  if (ref && typeof ref === 'object' && ref.current && isCheckbox) {
@@ -205,13 +210,13 @@ export const StyledInput = forwardRef<
205
210
  flexShrink={0}
206
211
  position="relative"
207
212
  className={[styles.fakeField, styles.fakeFieldSize[size]]}
208
- background={disabled ? 'neutralSoft' : 'surface'}
213
+ background={fieldBackground}
209
214
  borderRadius={fieldBorderRadius}
210
215
  >
211
216
  <FieldOverlay
212
217
  variant={disabled ? 'disabled' : 'default'}
213
218
  borderRadius={fieldBorderRadius}
214
- visible={showFieldBorder}
219
+ visible={tone !== 'critical' || disabled}
215
220
  />
216
221
  <FieldOverlay
217
222
  variant="critical"
@@ -0,0 +1,70 @@
1
+ import {
2
+ assignVars,
3
+ createThemeContract,
4
+ style,
5
+ styleVariants,
6
+ } from '@vanilla-extract/css';
7
+ import { colorModeStyle } from '../../../css/colorModeStyle';
8
+ import { vars } from '../../../themes/vars.css';
9
+
10
+ const keylineVars = createThemeContract({
11
+ promote: null,
12
+ info: null,
13
+ positive: null,
14
+ caution: null,
15
+ critical: null,
16
+ formAccent: null,
17
+ });
18
+
19
+ const lightModeVars = {
20
+ vars: assignVars(keylineVars, {
21
+ promote: vars.borderColor.promote,
22
+ info: vars.borderColor.info,
23
+ positive: vars.borderColor.positive,
24
+ caution: vars.borderColor.caution,
25
+ critical: vars.borderColor.critical,
26
+ formAccent: vars.borderColor.formAccent,
27
+ }),
28
+ };
29
+
30
+ const darkModeVars = {
31
+ vars: assignVars(keylineVars, {
32
+ promote: vars.borderColor.promoteLight,
33
+ info: vars.borderColor.infoLight,
34
+ positive: vars.borderColor.positiveLight,
35
+ caution: vars.borderColor.cautionLight,
36
+ critical: vars.borderColor.criticalLight,
37
+ formAccent: vars.borderColor.formAccentLight,
38
+ }),
39
+ };
40
+
41
+ export const tone = styleVariants(keylineVars, (_, name) => ({
42
+ background: keylineVars[name],
43
+ }));
44
+
45
+ export const lightMode = styleVariants({
46
+ light: colorModeStyle({
47
+ lightMode: lightModeVars,
48
+ }),
49
+ dark: colorModeStyle({
50
+ lightMode: darkModeVars,
51
+ }),
52
+ });
53
+
54
+ export const darkMode = styleVariants({
55
+ light: colorModeStyle({
56
+ darkMode: lightModeVars,
57
+ }),
58
+ dark: colorModeStyle({
59
+ darkMode: darkModeVars,
60
+ }),
61
+ });
62
+
63
+ export const noRadiusOnRight = style({
64
+ borderTopRightRadius: '0 !important',
65
+ borderBottomRightRadius: '0 !important',
66
+ });
67
+
68
+ export const largestWidth = style({
69
+ width: vars.borderRadius.xlarge,
70
+ });