@automattic/vip-design-system 1.2.3 → 1.3.1

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 (232) hide show
  1. package/.eslintignore +2 -1
  2. package/.prettierignore +1 -0
  3. package/.storybook/decorators/withBoundingBox.tsx +30 -4
  4. package/.storybook/decorators/withColorMode.tsx +5 -5
  5. package/CONTRIBUTING.md +1 -1
  6. package/build/system/Accordion/Accordion.js +6 -6
  7. package/build/system/Accordion/Accordion.stories.js +1 -1
  8. package/build/system/Accordion/Accordion.test.js +7 -5
  9. package/build/system/Avatar/Avatar.js +3 -2
  10. package/build/system/Badge/Badge.js +1 -0
  11. package/build/system/Button/Button.d.ts +11 -0
  12. package/build/system/Button/Button.js +12 -1
  13. package/build/system/Button/Button.stories.d.ts +2 -1
  14. package/build/system/Button/Button.stories.js +1 -2
  15. package/build/system/Button/Button.test.js +72 -45
  16. package/build/system/Button/ButtonSubmit.d.ts +17 -1
  17. package/build/system/Button/ButtonSubmit.js +58 -65
  18. package/build/system/Button/ButtonSubmit.stories.d.ts +17 -37
  19. package/build/system/Button/ButtonSubmit.stories.js +52 -0
  20. package/build/system/Button/ButtonSubmit.test.js +55 -35
  21. package/build/system/Button/index.d.ts +7 -3
  22. package/build/system/Button/index.js +8 -7
  23. package/build/system/Dropdown/DropdownContent.js +1 -1
  24. package/build/system/Dropdown/DropdownItem.js +1 -1
  25. package/build/system/Dropdown/DropdownLabel.js +1 -1
  26. package/build/system/Form/Checkbox.d.ts +9 -9
  27. package/build/system/Form/Checkbox.js +56 -61
  28. package/build/system/Form/Checkbox.stories.d.ts +6 -6
  29. package/build/system/Form/Checkbox.stories.js +71 -0
  30. package/build/system/Form/Input.d.ts +14 -1
  31. package/build/system/Form/Input.js +59 -72
  32. package/build/system/Form/Input.stories.d.ts +6 -4
  33. package/build/system/Form/Input.stories.js +53 -0
  34. package/build/system/Form/Input.styles.d.ts +23 -14
  35. package/build/system/Form/Input.styles.js +40 -28
  36. package/build/system/Form/InputWithCopyButton.stories.jsx +7 -0
  37. package/build/system/Form/Label.d.ts +19 -8
  38. package/build/system/Form/Label.js +39 -43
  39. package/build/system/Form/Label.stories.d.ts +7 -5
  40. package/build/system/Form/Label.stories.js +32 -0
  41. package/build/system/Form/Radio.js +4 -4
  42. package/build/system/Form/Radio.stories.jsx +1 -1
  43. package/build/system/Form/RadioBoxGroup.js +1 -1
  44. package/build/system/Form/RequiredLabel.d.ts +2 -1
  45. package/build/system/Form/RequiredLabel.js +16 -7
  46. package/build/system/Form/Toggle.js +2 -2
  47. package/build/system/Form/Validation.d.ts +8 -13
  48. package/build/system/Form/Validation.js +39 -35
  49. package/build/system/Heading/Heading.stories.js +3 -0
  50. package/build/system/Link/Link.js +1 -1
  51. package/build/system/NewDialog/DialogClose.js +2 -2
  52. package/build/system/NewDialog/DialogContent.js +3 -3
  53. package/build/system/NewDialog/DialogTitle.js +3 -1
  54. package/build/system/NewDialog/NewDialog.stories.d.ts +0 -1
  55. package/build/system/NewDialog/NewDialog.stories.jsx +0 -27
  56. package/build/system/NewForm/Fieldset.d.ts +12 -1
  57. package/build/system/NewForm/Fieldset.js +38 -40
  58. package/build/system/NewForm/Form.d.ts +8 -1
  59. package/build/system/NewForm/Form.js +24 -23
  60. package/build/system/NewForm/FormAutocomplete.css +0 -11
  61. package/build/system/NewForm/FormAutocomplete.js +8 -8
  62. package/build/system/NewForm/FormAutocomplete.stories.jsx +1 -3
  63. package/build/system/NewForm/FormAutocompleteMultiselect.js +10 -10
  64. package/build/system/NewForm/FormSelect.js +1 -1
  65. package/build/system/NewForm/FormSelectArrow.js +1 -1
  66. package/build/system/NewForm/FormSelectInline.js +1 -1
  67. package/build/system/NewForm/FormSelectLoading.js +1 -1
  68. package/build/system/NewForm/FormSelectSearch.js +2 -2
  69. package/build/system/NewForm/Legend.d.ts +12 -1
  70. package/build/system/NewForm/Legend.js +32 -34
  71. package/build/system/NewForm/index.d.ts +1 -1
  72. package/build/system/OptionRow/OptionRow.js +1 -1
  73. package/build/system/Progress/Progress.d.ts +9 -2
  74. package/build/system/Progress/Progress.js +75 -70
  75. package/build/system/Progress/Progress.stories.d.ts +9 -7
  76. package/build/system/Progress/Progress.stories.js +34 -0
  77. package/build/system/Progress/Progress.test.d.ts +1 -0
  78. package/build/system/Progress/Progress.test.js +65 -0
  79. package/build/system/Progress/index.d.ts +4 -2
  80. package/build/system/Progress/index.js +5 -5
  81. package/build/system/ScreenReaderText/ScreenReaderText.js +1 -2
  82. package/build/system/Tabs/TabsTrigger.js +0 -1
  83. package/build/system/Text/Text.js +1 -1
  84. package/build/system/Text/Text.stories.js +36 -0
  85. package/build/system/Tooltip/Tooltip.css +6 -2
  86. package/build/system/Tooltip/Tooltip.stories.js +2 -2
  87. package/build/system/Wizard/Wizard.d.ts +14 -1
  88. package/build/system/Wizard/Wizard.js +62 -93
  89. package/build/system/Wizard/Wizard.stories.d.ts +11 -8
  90. package/build/system/Wizard/Wizard.stories.js +167 -0
  91. package/build/system/Wizard/WizardStep.d.ts +24 -1
  92. package/build/system/Wizard/WizardStep.js +180 -190
  93. package/build/system/Wizard/index.d.ts +4 -2
  94. package/build/system/Wizard/index.js +6 -7
  95. package/build/system/index.d.ts +2 -2
  96. package/build/system/index.js +2 -1
  97. package/build/system/theme/generated/valet-theme-dark.json +1219 -476
  98. package/build/system/theme/generated/valet-theme-light.json +1217 -474
  99. package/build/system/theme/{getColor.d.ts → getPropValue.d.ts} +2 -1
  100. package/{src/system/theme/getColor.js → build/system/theme/getPropValue.js} +36 -4
  101. package/build/system/theme/index.d.ts +20 -65
  102. package/build/system/theme/index.js +27 -57
  103. package/package.json +4 -4
  104. package/src/system/Accordion/Accordion.stories.tsx +1 -1
  105. package/src/system/Accordion/Accordion.test.tsx +3 -0
  106. package/src/system/Accordion/Accordion.tsx +6 -6
  107. package/src/system/Avatar/Avatar.tsx +3 -3
  108. package/src/system/Badge/Badge.tsx +1 -1
  109. package/src/system/Button/Button.stories.tsx +2 -3
  110. package/src/system/Button/{Button.test.js → Button.test.tsx} +2 -2
  111. package/src/system/Button/Button.tsx +12 -0
  112. package/src/system/Button/ButtonSubmit.stories.tsx +31 -0
  113. package/src/system/Button/{ButtonSubmit.test.js → ButtonSubmit.test.tsx} +4 -4
  114. package/src/system/Button/{ButtonSubmit.js → ButtonSubmit.tsx} +21 -27
  115. package/src/system/Button/index.ts +8 -0
  116. package/src/system/Dropdown/DropdownContent.js +1 -1
  117. package/src/system/Dropdown/DropdownItem.js +1 -1
  118. package/src/system/Dropdown/DropdownLabel.js +1 -1
  119. package/src/system/Form/{Checkbox.stories.jsx → Checkbox.stories.tsx} +3 -2
  120. package/src/system/Form/{Checkbox.js → Checkbox.tsx} +6 -10
  121. package/src/system/Form/{Input.stories.jsx → Input.stories.tsx} +1 -0
  122. package/src/system/Form/{Input.styles.js → Input.styles.ts} +14 -5
  123. package/src/system/Form/{Input.js → Input.tsx} +10 -19
  124. package/src/system/Form/InputWithCopyButton.stories.jsx +7 -0
  125. package/src/system/Form/{Label.js → Label.tsx} +8 -13
  126. package/src/system/Form/Radio.js +4 -4
  127. package/src/system/Form/Radio.stories.jsx +1 -1
  128. package/src/system/Form/RadioBoxGroup.js +1 -1
  129. package/src/system/Form/{RequiredLabel.js → RequiredLabel.tsx} +1 -3
  130. package/src/system/Form/Toggle.js +2 -2
  131. package/src/system/Form/{Validation.js → Validation.tsx} +11 -12
  132. package/src/system/Heading/Heading.stories.tsx +1 -0
  133. package/src/system/Link/Link.tsx +1 -1
  134. package/src/system/NewDialog/DialogClose.js +2 -2
  135. package/src/system/NewDialog/DialogContent.js +3 -3
  136. package/src/system/NewDialog/DialogTitle.js +3 -1
  137. package/src/system/NewDialog/NewDialog.stories.jsx +0 -27
  138. package/src/system/NewForm/Fieldset.tsx +46 -0
  139. package/src/system/NewForm/Form.tsx +23 -0
  140. package/src/system/NewForm/FormAutocomplete.css +0 -11
  141. package/src/system/NewForm/FormAutocomplete.js +8 -8
  142. package/src/system/NewForm/FormAutocomplete.stories.jsx +1 -3
  143. package/src/system/NewForm/FormAutocompleteMultiselect.js +10 -10
  144. package/src/system/NewForm/FormSelect.js +1 -1
  145. package/src/system/NewForm/FormSelectArrow.js +1 -1
  146. package/src/system/NewForm/FormSelectInline.js +1 -1
  147. package/src/system/NewForm/FormSelectLoading.js +1 -1
  148. package/src/system/NewForm/FormSelectSearch.js +2 -2
  149. package/src/system/NewForm/Legend.tsx +40 -0
  150. package/src/system/OptionRow/OptionRow.js +1 -1
  151. package/src/system/Progress/Progress.test.tsx +33 -0
  152. package/src/system/Progress/{Progress.js → Progress.tsx} +16 -19
  153. package/src/system/Progress/index.ts +4 -0
  154. package/src/system/ScreenReaderText/ScreenReaderText.tsx +0 -2
  155. package/src/system/Tabs/TabsTrigger.js +0 -1
  156. package/src/system/Text/Text.stories.tsx +7 -0
  157. package/src/system/Text/Text.tsx +1 -1
  158. package/src/system/Tooltip/Tooltip.css +6 -2
  159. package/src/system/Tooltip/Tooltip.stories.tsx +4 -4
  160. package/{build/system/Wizard/Wizard.stories.jsx → src/system/Wizard/Wizard.stories.tsx} +18 -23
  161. package/src/system/Wizard/Wizard.tsx +62 -0
  162. package/src/system/Wizard/{WizardStep.js → WizardStep.tsx} +38 -41
  163. package/src/system/Wizard/index.ts +7 -0
  164. package/src/system/index.js +2 -1
  165. package/src/system/theme/generated/valet-theme-dark.json +1219 -476
  166. package/src/system/theme/generated/valet-theme-light.json +1217 -474
  167. package/{build/system/theme/getColor.js → src/system/theme/getPropValue.js} +36 -4
  168. package/src/system/theme/index.js +27 -57
  169. package/tokens/utilities/colors/color output/blue.json +305 -0
  170. package/tokens/utilities/colors/color output/gold.json +305 -0
  171. package/tokens/utilities/colors/color output/gray.json +305 -0
  172. package/tokens/utilities/colors/color output/green.json +305 -0
  173. package/tokens/utilities/colors/color output/orange.json +305 -0
  174. package/tokens/utilities/colors/color output/pink.json +305 -0
  175. package/tokens/utilities/colors/color output/red.json +305 -0
  176. package/tokens/utilities/colors/color output/salmon.json +305 -0
  177. package/tokens/utilities/colors/color output/yellow.json +305 -0
  178. package/tokens/utilities/colors/colorOutput.json +4062 -0
  179. package/tokens/utilities/colors/color_3d_plot.js +43 -0
  180. package/tokens/utilities/colors/color_graph.js +31 -0
  181. package/tokens/utilities/colors/colors.json +1981 -0
  182. package/tokens/utilities/colors/index.js +118 -0
  183. package/tokens/utilities/colors/package-lock.json +6749 -0
  184. package/tokens/utilities/colors/package.json +21 -0
  185. package/tokens/utilities/figma-type-calculator/responsive-type.js +98 -0
  186. package/tokens/valet-core/$metadata.json +19 -15
  187. package/tokens/valet-core/$themes.json +3323 -419
  188. package/tokens/valet-core/{figma-parsely-expressive-type.json → figma-parsely-web-type.json} +128 -128
  189. package/tokens/valet-core/{figma-valet-expressive-type.json → figma-valet-web-type.json} +126 -126
  190. package/tokens/valet-core/figma-wpvip-services-web-type.json +1267 -0
  191. package/tokens/valet-core/{figma-wpvip-expressive-type.json → figma-wpvip-web-type.json} +162 -162
  192. package/tokens/valet-core/{parsely-expressive-color.json → parsely-web-color.json} +1 -1
  193. package/tokens/valet-core/{wpvip-expressive-core.json → parsely-web-core.json} +73 -23
  194. package/tokens/valet-core/{parsely-expressive-type.json → parsely-web-type.json} +21 -9
  195. package/tokens/valet-core/valet-core.json +331 -232
  196. package/tokens/valet-core/{valet-expressive-color.json → valet-web-color.json} +1 -1
  197. package/tokens/valet-core/{parsely-expressive-core.json → valet-web-core.json} +72 -22
  198. package/tokens/valet-core/{wpvip-productive-color.json → wpvip-product-core.json} +663 -7
  199. package/tokens/valet-core/{wpvip-productive-color-dark.json → wpvip-product-dark.json} +332 -10
  200. package/tokens/valet-core/{wpvip-expressive-color.json → wpvip-services-web-color.json} +1 -1
  201. package/tokens/valet-core/{valet-expressive-core.json → wpvip-services-web-core.json} +72 -22
  202. package/tokens/valet-core/wpvip-services-web-type.json +412 -0
  203. package/tokens/valet-core/{wpvip-expressive-color-dark.json → wpvip-web-color-dark.json} +1 -1
  204. package/tokens/valet-core/wpvip-web-color.json +730 -0
  205. package/tokens/valet-core/{wpvip-expressive-type.json → wpvip-web-type.json} +24 -12
  206. package/tokens/valet-core/wpvip-web.json +1310 -0
  207. package/tsconfig.json +2 -1
  208. package/build/system/Button/ButtonSubmit.stories.jsx +0 -40
  209. package/build/system/Button/variants.d.ts +0 -2
  210. package/build/system/Button/variants.js +0 -1
  211. package/build/system/Form/Checkbox.stories.jsx +0 -54
  212. package/build/system/Form/Input.stories.jsx +0 -38
  213. package/build/system/Wizard/WizardStepHorizontal.d.ts +0 -2
  214. package/build/system/Wizard/WizardStepHorizontal.js +0 -55
  215. package/build/system/theme/textStyles.d.ts +0 -71
  216. package/build/system/theme/textStyles.js +0 -46
  217. package/src/system/Button/ButtonSubmit.stories.jsx +0 -40
  218. package/src/system/Button/index.js +0 -8
  219. package/src/system/Button/variants.js +0 -1
  220. package/src/system/Form/Label.stories.jsx +0 -36
  221. package/src/system/NewForm/Fieldset.js +0 -47
  222. package/src/system/NewForm/Form.js +0 -26
  223. package/src/system/NewForm/Legend.js +0 -41
  224. package/src/system/Progress/Progress.stories.jsx +0 -25
  225. package/src/system/Progress/index.js +0 -6
  226. package/src/system/Wizard/Wizard.js +0 -103
  227. package/src/system/Wizard/Wizard.stories.jsx +0 -145
  228. package/src/system/Wizard/WizardStepHorizontal.js +0 -55
  229. package/src/system/Wizard/index.js +0 -8
  230. package/src/system/theme/textStyles.js +0 -46
  231. /package/{build/system/Form/Label.stories.jsx → src/system/Form/Label.stories.tsx} +0 -0
  232. /package/{build/system/Progress/Progress.stories.jsx → src/system/Progress/Progress.stories.tsx} +0 -0
@@ -17,12 +17,12 @@ import { FormSelectArrow } from './FormSelectArrow';
17
17
  import { Label } from '../Form/Label';
18
18
  import { FormSelectSearch } from './FormSelectSearch';
19
19
  import { FormSelectLoading } from './FormSelectLoading';
20
- import { baseControlBorderStyle, inputBaseBackground, inputBaseText } from '../Form/Input.styles';
20
+ import { baseControlBorderStyle, inputBaseText } from '../Form/Input.styles';
21
21
  import { Validation } from '../Form';
22
22
 
23
23
  const baseBorderTextColors = {
24
24
  ...baseControlBorderStyle,
25
- backgroundColor: inputBaseBackground,
25
+ backgroundColor: 'layer.2',
26
26
  color: inputBaseText,
27
27
  borderRadius: 1,
28
28
  };
@@ -51,7 +51,7 @@ const defaultStyles = {
51
51
  '&:focus-visible': { outlineWidth: 0, boxShadow: 'none' },
52
52
  '&:focus-within': { outlineWidth: 0, boxShadow: 'none' },
53
53
  '&.autocomplete__input--focused': { outlineWidth: 0, boxShadow: 'none' },
54
- '&.autocomplete__input--show-all-values': { paddingRight: '40px' },
54
+ '&.autocomplete__input--show-all-values': { paddingRight: 7 },
55
55
  },
56
56
  '& .autocomplete__menu': {
57
57
  ...baseBorderTextColors,
@@ -66,11 +66,11 @@ const defaultStyles = {
66
66
  borderColor: baseControlBorderStyle.borderColor,
67
67
  },
68
68
  '& .autocomplete__option--odd': {
69
- bg: 'backgroundSecondary',
69
+ bg: 'layer.1',
70
70
  },
71
71
  '& .autocomplete__option:hover, & .autocomplete__option--focused': {
72
- bg: 'midnight',
73
- borderColor: 'midnight',
72
+ bg: 'input.background.primary',
73
+ borderColor: 'input.background.primary',
74
74
  },
75
75
  '& .autocomplete__input--show-all-values': {
76
76
  paddingRight: 0,
@@ -89,7 +89,7 @@ const inlineStyles = {
89
89
 
90
90
  const searchIconStyles = {
91
91
  '& .autocomplete__input.autocomplete__input': {
92
- paddingLeft: 4,
92
+ paddingLeft: 6,
93
93
  },
94
94
  };
95
95
 
@@ -345,7 +345,7 @@ const FormAutocomplete = React.forwardRef(
345
345
  { ...props }
346
346
  />
347
347
 
348
- { loading && <FormSelectLoading sx={ { right: showAllValues ? 40 : 10 } } /> }
348
+ { loading && <FormSelectLoading sx={ { right: showAllValues ? 7 : 3 } } /> }
349
349
  </FormSelectContent>
350
350
  </div>
351
351
 
@@ -151,9 +151,7 @@ WithCustomArrow.args = {
151
151
  showAllValues: true,
152
152
  // eslint-disable-next-line react/display-name
153
153
  dropdownArrow: () => (
154
- <span sx={ { position: 'absolute', top: '2px', right: '10px', pointerEvents: 'none' } }>
155
- 👇
156
- </span>
154
+ <span sx={ { position: 'absolute', top: 1, right: 3, pointerEvents: 'none' } }>👇</span>
157
155
  ),
158
156
  };
159
157
  WithCustomArrow.displayName = 'WithCustomArrow';
@@ -16,14 +16,14 @@ import { FormSelectArrow } from './FormSelectArrow';
16
16
  import { Label } from '../Form/Label';
17
17
  import { FormSelectSearch } from './FormSelectSearch';
18
18
  import { FormSelectLoading } from './FormSelectLoading';
19
- import { baseControlBorderStyle, inputBaseBackground, inputBaseText } from '../Form/Input.styles';
19
+ import { baseControlBorderStyle, inputBaseText } from '../Form/Input.styles';
20
20
  import { Validation } from '../Form';
21
21
  import { Button, Flex } from '../';
22
22
  import { MdClose } from 'react-icons/md';
23
23
 
24
24
  const baseBorderTextColors = {
25
25
  ...baseControlBorderStyle,
26
- backgroundColor: inputBaseBackground,
26
+ backgroundColor: 'layer.2',
27
27
  color: inputBaseText,
28
28
  borderRadius: 1,
29
29
  };
@@ -41,7 +41,7 @@ const defaultStyles = {
41
41
  '&.autocomplete__input--focused': theme => theme.outline,
42
42
  '& .autocomplete__input': {
43
43
  width: '100%',
44
- paddingLeft: 3,
44
+ paddingLeft: 4,
45
45
  py: 0,
46
46
  borderWidth: 0,
47
47
  color: 'text',
@@ -51,7 +51,7 @@ const defaultStyles = {
51
51
  '&:focus-visible': { outlineWidth: 0, boxShadow: 'none' },
52
52
  '&:focus-within': { outlineWidth: 0, boxShadow: 'none' },
53
53
  '&.autocomplete__input--focused': { outlineWidth: 0, boxShadow: 'none' },
54
- '&.autocomplete__input--show-all-values': { paddingRight: '40px' },
54
+ '&.autocomplete__input--show-all-values': { paddingRight: 7 },
55
55
  '&::placeholder': {
56
56
  color: 'input.text.placeholder',
57
57
  opacity: 1,
@@ -70,18 +70,18 @@ const defaultStyles = {
70
70
  borderColor: baseControlBorderStyle.borderColor,
71
71
  },
72
72
  '& .autocomplete__option--odd': {
73
- bg: 'backgroundSecondary',
73
+ bg: 'layer.1',
74
74
  },
75
75
  '& .autocomplete__option:hover, & .autocomplete__option--focused': {
76
- bg: 'midnight',
77
- borderColor: 'midnight',
76
+ bg: 'input.background.primary',
77
+ borderColor: 'input.background.primary',
78
78
  },
79
79
  '& .autocomplete__input--show-all-values': {
80
80
  paddingRight: 0,
81
81
  },
82
82
  '& .autocomplete__hint': {
83
83
  border: 'none',
84
- paddingLeft: 3,
84
+ paddingLeft: 4,
85
85
  minHeight: '27px',
86
86
  lineHeight: '27px',
87
87
  },
@@ -93,7 +93,7 @@ const inlineStyles = {
93
93
 
94
94
  const searchIconStyles = {
95
95
  '& .autocomplete__input.autocomplete__input': {
96
- paddingLeft: 4,
96
+ paddingLeft: 6,
97
97
  },
98
98
  };
99
99
 
@@ -407,7 +407,7 @@ const FormAutocompleteMultiselect = React.forwardRef(
407
407
  { ...props }
408
408
  />
409
409
  { addStatus && <AddSelectionStatus status={ addStatus } /> }
410
- { loading && <FormSelectLoading sx={ { right: showAllValues ? 40 : 10 } } /> }
410
+ { loading && <FormSelectLoading sx={ { right: showAllValues ? 7 : 3 } } /> }
411
411
  </FormSelectContent>
412
412
  </div>
413
413
  <Flex sx={ { mt: 2, justifyContent: 'space-between' } }>
@@ -21,7 +21,7 @@ const isDev = process.env.NODE_ENV !== 'production';
21
21
  const defaultStyles = {
22
22
  ...baseControlStyle,
23
23
  paddingLeft: 3,
24
- paddingRight: 40, // 40px for the icon
24
+ paddingRight: 7,
25
25
  py: 0,
26
26
  appearance: 'none',
27
27
  minHeight: '36px',
@@ -22,7 +22,7 @@ export const FormSelectArrow = React.forwardRef( ( props, forwardRef ) => (
22
22
  borderLeftWidth: borderStyle.borderWidth,
23
23
  borderLeftStyle: borderStyle.borderStyle,
24
24
  borderLeftColor: borderStyle.borderColor,
25
- right: '10px',
25
+ right: 3,
26
26
  top: '7px',
27
27
  pointerEvents: 'none',
28
28
  svg: {
@@ -14,7 +14,7 @@ export const inlineStyles = {
14
14
  gridTemplateColumns: 'auto 1fr',
15
15
  position: 'relative',
16
16
  alignItems: 'center',
17
- backgroundColor: 'input.background',
17
+ backgroundColor: 'input.background.default',
18
18
  borderRadius: 1,
19
19
  ...baseControlBorderStyle,
20
20
  paddingRight: 0,
@@ -25,7 +25,7 @@ export const FormSelectLoading = React.forwardRef( ( { sx = {}, ...rest }, forwa
25
25
  size={ 18 }
26
26
  sx={ {
27
27
  position: 'absolute',
28
- right: 10,
28
+ right: 3,
29
29
  pointerEvents: 'none',
30
30
  animation: `${ kf } 1s infinite linear`,
31
31
  opacity: 0.5,
@@ -13,8 +13,8 @@ export const FormSelectSearch = React.forwardRef( ( props, forwardRef ) => (
13
13
  size={ 24 }
14
14
  sx={ {
15
15
  position: 'absolute',
16
- paddingRight: '10px',
17
- left: '10px',
16
+ pr: 2,
17
+ left: 3,
18
18
  pointerEvents: 'none',
19
19
  } }
20
20
  { ...props }
@@ -0,0 +1,40 @@
1
+ /** @jsxImportSource theme-ui */
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import React from 'react';
7
+ import classNames from 'classnames';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+
13
+ import { baseLabelStyle } from '../Form/Label';
14
+ import { ThemeUIStyleObject } from 'theme-ui';
15
+
16
+ interface LegendProps {
17
+ children?: React.ReactNode;
18
+ sx?: ThemeUIStyleObject;
19
+ className?: string;
20
+ }
21
+ export const Legend = React.forwardRef< HTMLLegendElement, LegendProps >(
22
+ ( { children, className, sx = {}, ...props }, forwardRef ) => (
23
+ <legend
24
+ ref={ forwardRef }
25
+ className={ classNames( 'vip-form-legend-component', className ) }
26
+ sx={ {
27
+ all: 'unset',
28
+ ...baseLabelStyle,
29
+ px: 1,
30
+ mb: 0,
31
+ ...sx,
32
+ } }
33
+ { ...props }
34
+ >
35
+ { children }
36
+ </legend>
37
+ )
38
+ );
39
+
40
+ Legend.displayName = 'Legend';
@@ -77,7 +77,7 @@ const OptionRow = React.forwardRef(
77
77
  <Box
78
78
  sx={ {
79
79
  display: [ 'inline-block', 'inline-block', 'block' ],
80
- p: small ? 12 : 20,
80
+ p: small ? 3 : 5,
81
81
  flex: '0 0 auto',
82
82
  bg: `optionRow.${ variant }.background`,
83
83
  color: `optionRow.${ variant }.icon`,
@@ -0,0 +1,33 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, screen } from '@testing-library/react';
5
+ import { axe } from 'jest-axe';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { Progress } from './Progress';
11
+
12
+ const steps = [ 'Downloading Data', 'Importing Data...', 'Finalizing', 'Done' ];
13
+ describe( '<Progress />', () => {
14
+ it( 'renders the progress component', async () => {
15
+ const { container } = render( <Progress steps={ steps } activeStep={ 1 } /> );
16
+
17
+ expect( container.getElementsByClassName( 'vip-progress-component' ) ).toBeDefined();
18
+
19
+ // Check for accessibility issues
20
+ expect( await axe( container ) ).toHaveNoViolations();
21
+ } );
22
+
23
+ it( 'renders the progress component with different label text', async () => {
24
+ const { container } = render(
25
+ <Progress forLabel="My progress bar" steps={ steps } activeStep={ 1 } />
26
+ );
27
+
28
+ expect( screen.getByLabelText( 'My progress bar' ) ).toBeInTheDocument();
29
+
30
+ // Check for accessibility issues
31
+ expect( await axe( container ) ).toHaveNoViolations();
32
+ } );
33
+ } );
@@ -1,11 +1,8 @@
1
- /** @jsxImportSource theme-ui */
2
-
3
1
  /**
4
2
  * External dependencies
5
3
  */
6
- import React from 'react';
7
- import { Progress as ThemeProgress } from 'theme-ui';
8
- import PropTypes from 'prop-types';
4
+ import { forwardRef, Ref } from 'react';
5
+ import { ProgressProps, Progress as ThemeProgress } from 'theme-ui';
9
6
  import classNames from 'classnames';
10
7
 
11
8
  /**
@@ -13,13 +10,23 @@ import classNames from 'classnames';
13
10
  */
14
11
  import { Spinner } from '../Spinner';
15
12
  import { MdCheck } from 'react-icons/md';
16
- import { Box, Text, Flex } from '../';
13
+ import { Box, Text, Flex } from '..';
17
14
 
18
15
  const prefix = 'vip-progress-component';
19
16
  const uniqueID = () => Math.random().toString( 36 ).substring( 7 );
20
17
 
21
- const Progress = React.forwardRef(
22
- ( { steps, activeStep, sx, forLabel = '', className, ...props }, forwardRef ) => {
18
+ export interface ThemeProgressProps extends ProgressProps {
19
+ steps: string[];
20
+ activeStep: number;
21
+ forLabel?: string;
22
+ className?: string;
23
+ }
24
+
25
+ export const Progress = forwardRef< HTMLProgressElement, ThemeProgressProps >(
26
+ (
27
+ { steps, activeStep, sx, forLabel = '', className, ...props }: ThemeProgressProps,
28
+ ref: Ref< HTMLProgressElement >
29
+ ) => {
23
30
  const stepsTotal = steps.length;
24
31
  const isDone = activeStep === stepsTotal - 1;
25
32
  const instance = uniqueID();
@@ -38,7 +45,7 @@ const Progress = React.forwardRef(
38
45
  value={ currentValue }
39
46
  id={ htmlFor }
40
47
  aria-label={ forLabel }
41
- ref={ forwardRef }
48
+ ref={ ref }
42
49
  { ...props }
43
50
  />
44
51
 
@@ -66,13 +73,3 @@ const Progress = React.forwardRef(
66
73
  );
67
74
 
68
75
  Progress.displayName = 'Progress';
69
-
70
- Progress.propTypes = {
71
- steps: PropTypes.array,
72
- activeStep: PropTypes.number,
73
- forLabel: PropTypes.node,
74
- sx: PropTypes.object,
75
- className: PropTypes.any,
76
- };
77
-
78
- export { Progress };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ export { Progress } from './Progress';
@@ -36,5 +36,3 @@ export const ScreenReaderText = forwardRef< HTMLSpanElement, ScreenReaderTextPro
36
36
  </span>
37
37
  )
38
38
  );
39
-
40
- ScreenReaderText.displayName = 'ScreenReaderText';
@@ -25,7 +25,6 @@ const styles = {
25
25
  color: 'link',
26
26
  fontWeight: 'regular',
27
27
  boxShadow: 'inset 0 -1px 0 0, 0 1px 0 0',
28
- boxShadowColor: 'borders.accent',
29
28
  },
30
29
  '&:disabled': {
31
30
  color: 'muted',
@@ -25,6 +25,13 @@ export const Default = () => (
25
25
 
26
26
  <Text sx={ { color: 'texts.helper' } }>Text Helper</Text>
27
27
 
28
+ <Text sx={ { color: 'texts.helper', fontWeight: 'body' } }>Text Helper</Text>
29
+ <Text sx={ { color: 'texts.helper', fontWeight: 'heading' } }>Text Helper</Text>
30
+ <Text sx={ { color: 'texts.helper', fontWeight: 'regular' } }>Text Helper</Text>
31
+ <Text sx={ { color: 'texts.helper', fontWeight: 'medium' } }>Text Helper</Text>
32
+ <Text sx={ { color: 'texts.helper', fontWeight: 'bold' } }>Text Helper</Text>
33
+ <Text sx={ { color: 'texts.helper', fontWeight: 'light' } }>Text Helper</Text>
34
+
28
35
  <Text sx={ { color: 'texts.secondary' } }>Text Secondary</Text>
29
36
 
30
37
  <Text sx={ { color: 'texts.primary' } }>Text Primary</Text>
@@ -10,7 +10,7 @@ export const Text = forwardRef< HTMLDivElement, ThemeTextProps >(
10
10
  <ThemeText
11
11
  as="p"
12
12
  sx={ {
13
- lineHeight: 1.5,
13
+ lineHeight: 'body',
14
14
  marginBottom: 2,
15
15
  color: 'text',
16
16
  ...sx,
@@ -22,11 +22,15 @@
22
22
  [data-vip-tooltip]::before {
23
23
  content: attr(data-vip-tooltip);
24
24
  z-index: 9999;
25
- width: 210px;
25
+ width: max-content;
26
+ max-width: 210px;
26
27
  color: #fff;
27
28
  background: rgba(0,0,0, .7);
28
29
  border-radius: 5px;
29
- padding: 5px;
30
+ padding-left: 12px;
31
+ padding-right: 12px;
32
+ padding-top: 8px;
33
+ padding-bottom: 8px;
30
34
  }
31
35
 
32
36
  [data-vip-tooltip]::after {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { Tooltip, Button, Heading, Text, Link } from '..';
4
+ import { Tooltip, Button, Heading, Text, Link, Box } from '..';
5
5
 
6
6
  export default {
7
7
  title: 'Tooltip',
@@ -52,7 +52,7 @@ elements that appear interactive, like buttons or links.
52
52
  events.
53
53
  - <strong>Use consistently.</strong> If using tooltips in one context, use in all similar
54
54
  contexts.
55
- - <strong>Don&apos;t block content.</strong> Use the <code>data-position</code> attribute to
55
+ - <strong>Don&apos;t block content.</strong> Use the <code>vip-tooltip-position</code> attribute to
56
56
  prevent the tooltip from covering other page elements.
57
57
 
58
58
  -------
@@ -109,7 +109,7 @@ export const Container = () => (
109
109
  simply pass <code>data-vip-tooltip</code> as an HTML attribute to your component.
110
110
  </Text>
111
111
 
112
- <div sx={ { backgroundColor: 'red' } }>
112
+ <Box sx={ { backgroundColor: 'red' } }>
113
113
  <Tooltip>
114
114
  <Button data-vip-tooltip-position="top" data-vip-tooltip="Test test" sx={ { ml: 3 } }>
115
115
  This is another way
@@ -128,6 +128,6 @@ export const Container = () => (
128
128
  Use with links too
129
129
  </Link>
130
130
  </Tooltip>
131
- </div>
131
+ </Box>
132
132
  </div>
133
133
  );
@@ -8,22 +8,16 @@ import React from 'react';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
- import { Wizard, Box, Label, Input, Button, Form } from '..';
11
+ import { Wizard, Box, Label, Input, Button, Checkbox, Flex } from '..';
12
+ import { WizardStepProps } from './WizardStep';
12
13
 
13
14
  export default {
14
15
  title: 'Wizard',
15
16
  component: Wizard,
16
17
  };
17
18
 
18
- const options = [
19
- { value: 'chocolate', label: 'Chocolate' },
20
- { value: 'strawberry', label: 'Strawberry' },
21
- { value: 'vanilla', label: 'Vanilla' },
22
- { value: 'coffee', label: 'Coffee' },
23
- ];
24
-
25
19
  export const Default = () => {
26
- const steps = [
20
+ const steps: WizardStepProps[] = [
27
21
  {
28
22
  title: 'Choose Domain',
29
23
  titleVariant: 'h2',
@@ -31,8 +25,7 @@ export const Default = () => {
31
25
  children: (
32
26
  <Box>
33
27
  <Label>Domain</Label>
34
- <Input autoFocus placeholder="yourdomain.com" />
35
- <Form.Autocomplete label="Autocomplete" options={ options } />
28
+ <Input placeholder="yourdomain.com" />
36
29
  <Button sx={ { mt: 3 } }>Continue</Button>
37
30
  </Box>
38
31
  ),
@@ -62,7 +55,7 @@ export const Default = () => {
62
55
  export const WithTitleAutoFocus = () => {
63
56
  const [ activeStep, setActiveStep ] = React.useState( 0 );
64
57
  const [ autoFocus, setAutoFocus ] = React.useState( true );
65
- const steps = [
58
+ const steps: WizardStepProps[] = [
66
59
  {
67
60
  title: 'Choose Domain',
68
61
  titleVariant: 'h2',
@@ -128,17 +121,19 @@ export const WithTitleAutoFocus = () => {
128
121
  />
129
122
  </Box>
130
123
  <Box mt={ 4 }>
131
- <Form.Select
132
- id="wizard-autofocus"
133
- forLabel="wizard-autofocus"
134
- label="Autofocus status"
135
- value={ autoFocus }
136
- onChange={ e => setAutoFocus( e.value ) }
137
- options={ [
138
- { value: true, label: 'On' },
139
- { value: false, label: 'Off' },
140
- ] }
141
- />
124
+ <Flex sx={ { alignItems: 'center' } }>
125
+ <Checkbox
126
+ id="wizard-autofocus"
127
+ checked={ autoFocus }
128
+ aria-labelledby="label-check1"
129
+ onCheckedChange={ e => {
130
+ setAutoFocus( e === true );
131
+ } }
132
+ />
133
+ <Label sx={ { m: 0, ml: 2 } } htmlFor="wizard-autofocus" id="label-check1">
134
+ Autofocus enabled?
135
+ </Label>
136
+ </Flex>
142
137
  </Box>
143
138
  </React.Fragment>
144
139
  );
@@ -0,0 +1,62 @@
1
+ /** @jsxImportSource theme-ui */
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import React, { useLayoutEffect, useState } from 'react';
7
+ import classNames from 'classnames';
8
+
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+ import { Box, WizardStep } from '..';
13
+ import { WizardStepProps } from './WizardStep';
14
+
15
+ export interface WizardProps {
16
+ steps: WizardStepProps[];
17
+ activeStep?: number;
18
+ completed?: number[];
19
+ skipped?: number[];
20
+ className?: string;
21
+ titleAutofocus?: boolean;
22
+ }
23
+ export const Wizard = React.forwardRef< HTMLDivElement, WizardProps >(
24
+ (
25
+ { steps, activeStep, completed = [], skipped = [], className = null, titleAutofocus = false },
26
+ forwardRef
27
+ ) => {
28
+ const [ didMount, setDidMount ] = useState( false );
29
+ const [ initialStep ] = useState( activeStep );
30
+ // didMount helps us to track the initial render, so we can focus the title only subsequent renders
31
+ // to avoid stealing the focus from the page we're in.
32
+ useLayoutEffect( () => {
33
+ if ( ! didMount && activeStep !== initialStep ) {
34
+ setDidMount( true );
35
+ }
36
+ }, [ initialStep, activeStep, didMount, setDidMount ] );
37
+ return (
38
+ <Box className={ classNames( 'vip-wizard-component', className ) } ref={ forwardRef }>
39
+ { steps.map( ( { title, subTitle, children, titleVariant, summary, onChange }, index ) => (
40
+ <WizardStep
41
+ active={ index === activeStep }
42
+ complete={ completed.includes( index ) }
43
+ skipped={ skipped.includes( index ) }
44
+ key={ index }
45
+ order={ index + 1 }
46
+ totalSteps={ steps.length }
47
+ subTitle={ subTitle }
48
+ title={ title }
49
+ titleVariant={ titleVariant }
50
+ summary={ summary }
51
+ onChange={ onChange }
52
+ shouldFocusTitle={ titleAutofocus && didMount }
53
+ >
54
+ { children }
55
+ </WizardStep>
56
+ ) ) }
57
+ </Box>
58
+ );
59
+ }
60
+ );
61
+
62
+ Wizard.displayName = 'Wizard';