@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
@@ -1,39 +1,43 @@
1
- /** @jsxImportSource theme-ui */
2
-
3
1
  /**
4
2
  * External dependencies
5
3
  */
6
4
  import React from 'react';
7
- import PropTypes from 'prop-types';
8
- import { Button } from './Button';
5
+ import { Button, ButtonProps } from './Button';
9
6
  import { Spinner } from '../Spinner';
10
7
  import classNames from 'classnames';
11
- import variants from './variants';
12
8
 
13
- const DefaultSpinner = ( { size, color = 'link' } ) => (
14
- <Spinner size={ size } sx={ { ml: 2, color } } className="vip-button-submit-spinner" />
15
- );
9
+ interface DefaultSpinnerProps {
10
+ color?: string;
11
+ size: number;
12
+ }
16
13
 
17
- DefaultSpinner.propTypes = {
18
- size: PropTypes.number,
19
- color: PropTypes.string,
20
- };
14
+ function DefaultSpinner( { size, color = 'link' }: DefaultSpinnerProps ) {
15
+ return <Spinner size={ size } sx={ { ml: 2, color } } className="vip-button-submit-spinner" />;
16
+ }
21
17
 
22
18
  DefaultSpinner.displayName = 'DefaultSpinner';
23
19
 
24
- export const ButtonSubmit = React.forwardRef(
20
+ export interface ButtonSubmitProps extends ButtonProps {
21
+ label: React.ReactNode;
22
+ loading?: boolean;
23
+ loadingIcon?: ( props: DefaultSpinnerProps ) => JSX.Element;
24
+ loadingIconSize?: number;
25
+ show?: boolean;
26
+ }
27
+
28
+ export const ButtonSubmit = React.forwardRef< HTMLButtonElement, ButtonSubmitProps >(
25
29
  (
26
30
  {
27
31
  show = true,
28
- variant = variants[ 1 ],
32
+ variant = 'secondary',
29
33
  label,
30
34
  loading = false,
31
35
  disabled = false,
32
36
  loadingIcon = DefaultSpinner,
33
37
  loadingIconSize = 20,
34
38
  ...rest
35
- },
36
- forwardRef
39
+ }: ButtonSubmitProps,
40
+ ref: React.Ref< HTMLButtonElement >
37
41
  ) => {
38
42
  if ( ! show ) {
39
43
  return null;
@@ -41,7 +45,7 @@ export const ButtonSubmit = React.forwardRef(
41
45
 
42
46
  return (
43
47
  <Button
44
- ref={ forwardRef }
48
+ ref={ ref }
45
49
  className={ classNames( 'vip-button-submit-component', `vip-button-submit-${ variant }` ) }
46
50
  disabled={ disabled || loading }
47
51
  variant={ variant }
@@ -57,13 +61,3 @@ export const ButtonSubmit = React.forwardRef(
57
61
  );
58
62
 
59
63
  ButtonSubmit.displayName = 'ButtonSubmit';
60
-
61
- ButtonSubmit.propTypes = {
62
- label: PropTypes.node.isRequired,
63
- disabled: PropTypes.bool,
64
- loading: PropTypes.bool,
65
- variant: PropTypes.oneOf( variants ),
66
- show: PropTypes.bool,
67
- loadingIcon: PropTypes.any,
68
- loadingIconSize: PropTypes.number,
69
- };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+
5
+ export { Button, ButtonVariant } from './Button';
6
+ export type { ButtonProps } from './Button';
7
+ export { ButtonSubmit } from './ButtonSubmit';
8
+ export type { ButtonSubmitProps } from './ButtonSubmit';
@@ -10,7 +10,7 @@ import PropTypes from 'prop-types';
10
10
 
11
11
  export const styles = {
12
12
  minWidth: 220,
13
- borderRadius: 6,
13
+ borderRadius: 2,
14
14
  backgroundColor: 'background',
15
15
  boxShadow: 'high',
16
16
  px: 2,
@@ -21,7 +21,7 @@ export const styles = {
21
21
  m: 0,
22
22
  color: 'heading',
23
23
  px: 2,
24
- paddingLeft: 10,
24
+ paddingLeft: 3,
25
25
  py: 1,
26
26
  '&:hover, &:focus': {
27
27
  backgroundColor: 'hover',
@@ -9,7 +9,7 @@ import classNames from 'classnames';
9
9
  import PropTypes from 'prop-types';
10
10
 
11
11
  export const styles = {
12
- paddingLeft: 10,
12
+ paddingLeft: 3,
13
13
  fontSize: 12,
14
14
  lineHeight: '25px',
15
15
  color: 'muted',
@@ -10,6 +10,7 @@ import { Form } from '..';
10
10
  import { Checkbox } from './Checkbox';
11
11
  import { Label } from './Label';
12
12
  import { Flex } from '../Flex';
13
+ import { CheckedState } from '@radix-ui/react-checkbox';
13
14
 
14
15
  export default {
15
16
  title: 'Form/Checkbox',
@@ -17,8 +18,8 @@ export default {
17
18
  };
18
19
 
19
20
  export const Default = () => {
20
- const [ checked, setChecked ] = useState( true );
21
- const [ checked2, setChecked2 ] = useState( false );
21
+ const [ checked, setChecked ] = useState< CheckedState >( true );
22
+ const [ checked2, setChecked2 ] = useState< CheckedState >( false );
22
23
 
23
24
  return (
24
25
  <Form.Root>
@@ -4,11 +4,13 @@
4
4
  * External dependencies
5
5
  */
6
6
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
7
- import PropTypes from 'prop-types';
8
7
  import { MdDone } from 'react-icons/md';
9
8
  import { baseControlBorderStyle, baseControlFocusStyle, inputBaseBackground } from './Input.styles';
10
9
 
11
- const StyledCheckbox = props => (
10
+ export interface CheckboxProps extends CheckboxPrimitive.CheckboxProps {
11
+ disabled?: boolean;
12
+ }
13
+ const StyledCheckbox = ( props: CheckboxProps ) => (
12
14
  <CheckboxPrimitive.Root
13
15
  sx={ {
14
16
  all: 'unset',
@@ -33,7 +35,7 @@ const StyledCheckbox = props => (
33
35
  />
34
36
  );
35
37
 
36
- const StyledIndicator = props => (
38
+ const StyledIndicator = ( props: CheckboxPrimitive.CheckboxIndicatorProps ) => (
37
39
  <CheckboxPrimitive.Indicator
38
40
  sx={ {
39
41
  color: 'white',
@@ -42,7 +44,7 @@ const StyledIndicator = props => (
42
44
  />
43
45
  );
44
46
 
45
- const Checkbox = ( { disabled, ...props } ) => (
47
+ export const Checkbox = ( { disabled, ...props }: CheckboxProps ) => (
46
48
  <StyledCheckbox
47
49
  sx={ {
48
50
  opacity: disabled ? 0.4 : 1,
@@ -55,9 +57,3 @@ const Checkbox = ( { disabled, ...props } ) => (
55
57
  </StyledIndicator>
56
58
  </StyledCheckbox>
57
59
  );
58
-
59
- Checkbox.propTypes = {
60
- disabled: PropTypes.bool,
61
- };
62
-
63
- export { Checkbox };
@@ -34,5 +34,6 @@ export const Default = () => (
34
34
 
35
35
  <Form.Label htmlFor="input-with-custom-label">Custom Label outside the Input</Form.Label>
36
36
  <Form.Input forLabel="input-with-custom-label" required />
37
+ <Form.Input forLabel="input-readonly" readOnly value="This is a readonly input" />
37
38
  </Form.Root>
38
39
  );
@@ -1,15 +1,21 @@
1
+ import { Theme } from 'theme-ui';
2
+
1
3
  export const baseControlBorderStyle = {
2
4
  borderWidth: '1px',
3
5
  borderStyle: 'solid',
4
6
  borderColor: 'input.border.default',
5
7
  };
8
+ // Temporary interface until we add types to the theme definition.
9
+ interface InputTheme extends Theme {
10
+ outline?: Record< string, string >;
11
+ }
6
12
 
7
13
  export const inputBaseText = 'input.text.default';
8
- export const inputBaseBackground = 'input.background';
14
+ export const inputBaseBackground = 'input.background.default';
9
15
  export const baseControlFocusStyle = {
10
- '&:focus': theme => theme.outline,
11
- '&:focus-visible': theme => theme.outline,
12
- '&:focus-within': theme => theme.outline,
16
+ '&:focus': ( theme: InputTheme ) => theme.outline,
17
+ '&:focus-visible': ( theme: InputTheme ) => theme.outline,
18
+ '&:focus-within': ( theme: InputTheme ) => theme.outline,
13
19
  };
14
20
 
15
21
  export const baseControlStyle = {
@@ -24,7 +30,10 @@ export const baseControlStyle = {
24
30
  '&:disabled': {
25
31
  borderColor: 'input.border.disabled',
26
32
  },
27
-
33
+ '&:read-only': {
34
+ borderColor: 'input.border.disabled',
35
+ backgroundColor: 'input.background.read-only',
36
+ },
28
37
  '&::placeholder': {
29
38
  color: 'input.text.placeholder',
30
39
  opacity: 1,
@@ -4,13 +4,12 @@
4
4
  * External dependencies
5
5
  */
6
6
  import React from 'react';
7
- import PropTypes from 'prop-types';
8
7
 
9
8
  /**
10
9
  * Internal dependencies
11
10
  */
12
11
  import { Validation, Label } from '../';
13
- import { Input as ThemeInput } from 'theme-ui';
12
+ import { Input as ThemeInput, InputProps as ThemeInputProps } from 'theme-ui';
14
13
  import { baseControlStyle } from './Input.styles';
15
14
 
16
15
  const inputStyles = {
@@ -25,11 +24,15 @@ const inputStyles = {
25
24
  variant: 'inputs.default',
26
25
  };
27
26
 
28
- const Input = React.forwardRef(
29
- (
30
- { variant, label, forLabel, hasError = false, required, sx = {}, errorMessage, ...props },
31
- ref
32
- ) => (
27
+ interface InputProps extends ThemeInputProps {
28
+ label?: string;
29
+ hasError?: boolean;
30
+ required?: boolean;
31
+ forLabel?: string;
32
+ errorMessage?: string;
33
+ }
34
+ export const Input = React.forwardRef< HTMLInputElement, InputProps >(
35
+ ( { label, forLabel, hasError = false, required, sx = {}, errorMessage, ...props }, ref ) => (
33
36
  <React.Fragment>
34
37
  { label && (
35
38
  <Label required={ required } htmlFor={ forLabel }>
@@ -58,16 +61,4 @@ const Input = React.forwardRef(
58
61
  )
59
62
  );
60
63
 
61
- Input.propTypes = {
62
- variant: PropTypes.string,
63
- label: PropTypes.string,
64
- hasError: PropTypes.bool,
65
- required: PropTypes.bool,
66
- forLabel: PropTypes.string,
67
- errorMessage: PropTypes.string,
68
- sx: PropTypes.object,
69
- };
70
-
71
64
  Input.displayName = 'Input';
72
-
73
- export { Input };
@@ -25,6 +25,13 @@ export const Default = () => {
25
25
  forLabel="input-simple"
26
26
  copyHandler={ value => setCopiedText( value ) }
27
27
  />
28
+ <Form.InputWithCopyButton
29
+ value="Copy me!"
30
+ label="This is a readonly input"
31
+ forLabel="input-simple"
32
+ readOnly
33
+ copyHandler={ value => setCopiedText( value ) }
34
+ />
28
35
  </Form.Root>
29
36
  );
30
37
  };
@@ -4,8 +4,7 @@
4
4
  * External dependencies
5
5
  */
6
6
  import React from 'react';
7
- import PropTypes from 'prop-types';
8
- import { Box } from 'theme-ui';
7
+ import { Box, BoxProps } from 'theme-ui';
9
8
  /**
10
9
  * Internal dependencies
11
10
  */
@@ -13,13 +12,18 @@ import { RequiredLabel } from './RequiredLabel';
13
12
 
14
13
  export const baseLabelColor = 'input.label.default';
15
14
  export const baseLabelStyle = {
16
- fontWeight: 500,
15
+ fontWeight: 'heading',
17
16
  fontSize: 2,
18
17
  lineHeight: 1.5,
19
18
  color: baseLabelColor,
20
19
  };
20
+ interface LabelProps extends BoxProps {
21
+ children?: React.ReactNode;
22
+ required?: boolean;
23
+ htmlFor?: string;
24
+ }
21
25
 
22
- const Label = React.forwardRef(
26
+ export const Label = React.forwardRef< HTMLLabelElement, LabelProps >(
23
27
  ( { sx, children, required, as = 'label', ...rest }, forwardRef ) => (
24
28
  <Box
25
29
  as={ as }
@@ -39,13 +43,4 @@ const Label = React.forwardRef(
39
43
  )
40
44
  );
41
45
 
42
- Label.propTypes = {
43
- children: PropTypes.any,
44
- required: PropTypes.bool,
45
- sx: PropTypes.object,
46
- as: PropTypes.node,
47
- };
48
-
49
46
  Label.displayName = 'Label';
50
-
51
- export { Label };
@@ -20,7 +20,7 @@ const itemStyle = {
20
20
  my: 2,
21
21
  };
22
22
 
23
- const radioPosition = mainTheme.space[ 4 ] - mainTheme.space[ 1 ];
23
+ const radioPosition = mainTheme.space[ 5 ];
24
24
 
25
25
  const inputStyle = {
26
26
  ...screenReaderTextClass,
@@ -47,11 +47,11 @@ const labelStyle = {
47
47
  marginBottom: 0,
48
48
  userSelect: 'none',
49
49
  color: inputBaseText,
50
- lineHeight: 1.5,
50
+ lineHeight: 'body',
51
51
  '&:before, &:after': {
52
- borderRadius: '50%',
52
+ borderRadius: '100%',
53
53
  position: 'absolute',
54
- top: 0,
54
+ top: 1,
55
55
  left: `${ -1 * radioPosition }px`,
56
56
  transition: 'all .3s ease-out',
57
57
  zIndex: 2,
@@ -69,7 +69,7 @@ export const Default = () => {
69
69
  <Label
70
70
  htmlFor="option-custom-a"
71
71
  className="custom-class"
72
- sx={ { color: '#bf2a23' } }
72
+ sx={ { color: 'error' } }
73
73
  >
74
74
  (Custom) All domains listed on this environment, and all subdomains
75
75
  </Label>
@@ -64,7 +64,7 @@ const RadioOption = ( {
64
64
  id={ forLabel }
65
65
  onChange={ onChangeHandler }
66
66
  value={ `${ value }` }
67
- sx={ { mr: 3, mt: 3 } }
67
+ sx={ { mr: 5, mt: 3 } }
68
68
  aria-describedby={ describedById }
69
69
  { ...restOption }
70
70
  />
@@ -4,10 +4,8 @@
4
4
  * External dependencies
5
5
  */
6
6
 
7
- const RequiredLabel = () => (
7
+ export const RequiredLabel = () => (
8
8
  <span sx={ { color: 'texts.helper', display: 'inline-block', ml: 2, fontSize: 1 } }>
9
9
  (Required)
10
10
  </span>
11
11
  );
12
-
13
- export { RequiredLabel };
@@ -23,7 +23,7 @@ export const Toggle = React.forwardRef(
23
23
  position: 'relative',
24
24
  width: 40,
25
25
  height: 20,
26
- borderRadius: '32px',
26
+ borderRadius: 5,
27
27
  backgroundColor: 'muted',
28
28
  backgroundRepeat: 'no-repeat',
29
29
  backgroundPosition: 'right 2px top 2px',
@@ -54,7 +54,7 @@ export const Toggle = React.forwardRef(
54
54
  width: 16,
55
55
  height: 16,
56
56
  backgroundColor: 'white',
57
- borderRadius: '50%',
57
+ borderRadius: '100%',
58
58
  boxShadow: 'rgb(0 0 0 / 5%) 0px 1px 5px, rgb(0 0 0 / 15%) 0px 1px 1px',
59
59
  transition: 'transform 100ms',
60
60
  transform: 'translateX(2px)',
@@ -3,15 +3,18 @@
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import PropTypes from 'prop-types';
7
6
  import { MdErrorOutline, MdCheckCircle } from 'react-icons/md';
8
7
 
9
8
  const errorColor = 'texts.error';
10
9
  const helperColor = 'texts.helper';
11
10
 
12
- const Validation = ( { children, isValid, describedId = null, ...props } ) => {
13
- const Icon = isValid ? MdCheckCircle : MdErrorOutline;
11
+ interface ValidationProps {
12
+ children?: React.ReactNode;
13
+ isValid?: boolean;
14
+ describedId?: string;
15
+ }
14
16
 
17
+ export const Validation = ( { children, isValid, describedId, ...props }: ValidationProps ) => {
15
18
  return (
16
19
  <p
17
20
  sx={ {
@@ -24,16 +27,12 @@ const Validation = ( { children, isValid, describedId = null, ...props } ) => {
24
27
  id={ describedId ? `describe-${ describedId }-validation` : undefined }
25
28
  { ...props }
26
29
  >
27
- <Icon sx={ { mr: 1 } } aria-hidden="true" />
30
+ { isValid ? (
31
+ <MdCheckCircle sx={ { mr: 1 } } aria-hidden="true" />
32
+ ) : (
33
+ <MdErrorOutline sx={ { mr: 1 } } aria-hidden="true" />
34
+ ) }
28
35
  { children }
29
36
  </p>
30
37
  );
31
38
  };
32
-
33
- Validation.propTypes = {
34
- children: PropTypes.node,
35
- isValid: PropTypes.bool,
36
- describedId: PropTypes.string,
37
- };
38
-
39
- export { Validation };
@@ -15,5 +15,6 @@ export const Default = () => (
15
15
  <Heading variant="h3">Heading Three</Heading>
16
16
  <Heading variant="h4">Heading Four</Heading>
17
17
  <Heading variant="h5">Heading Five</Heading>
18
+ <Heading variant="h6">Heading Six</Heading>
18
19
  </Box>
19
20
  );
@@ -17,7 +17,7 @@ export const Link = forwardRef< HTMLAnchorElement, LinkProps >(
17
17
  ( { active = false, sx, ...props }: LinkProps, ref: Ref< HTMLAnchorElement > ) => (
18
18
  <ThemeLink
19
19
  sx={ {
20
- textDdecorationThickness: '0.1em',
20
+ textDecorationThickness: '0.1em',
21
21
  textUnderlineOffset: '0.1em',
22
22
  color: active ? 'links.active' : 'link',
23
23
  '&:visited': {
@@ -39,8 +39,8 @@ export const DialogCloseDefault = React.forwardRef( ( props, forwardedRef ) => (
39
39
  justifyContent: 'center',
40
40
  color: 'icon.primary',
41
41
  position: 'absolute',
42
- top: 10,
43
- right: 10,
42
+ top: 3,
43
+ right: 3,
44
44
 
45
45
  '&:hover': {
46
46
  backgroundColor: 'borders.2',
@@ -3,8 +3,8 @@
3
3
  export const contentStyles = {
4
4
  background: 'dialog',
5
5
  variant: 'dialog.modal',
6
- borderRadius: 10,
7
- boxShadow: 'hsl(206 22% 7% / 35%) 0px 10px 38px -10px, hsl(206 22% 7% / 20%) 0px 10px 20px -15px',
6
+ borderRadius: 2,
7
+ boxShadow: 'medium',
8
8
  position: 'fixed',
9
9
  top: '50%',
10
10
  left: '50%',
@@ -12,6 +12,6 @@ export const contentStyles = {
12
12
  width: '90vw',
13
13
  maxWidth: '640px',
14
14
  maxHeight: '85vh',
15
- padding: 32,
15
+ padding: 6,
16
16
  '> h1, > h2': { marginTop: '0 !important' },
17
17
  };
@@ -19,7 +19,9 @@ export const DialogTitle = ( { title, hidden = false } ) => {
19
19
  }
20
20
 
21
21
  return (
22
- <DialogPrimitive.Title sx={ { margin: 0, fontSize: 3, fontWeight: 500, color: 'heading' } }>
22
+ <DialogPrimitive.Title
23
+ sx={ { margin: 0, fontSize: 3, fontWeight: 'medium', color: 'heading' } }
24
+ >
23
25
  { titleNode }
24
26
  </DialogPrimitive.Title>
25
27
  );
@@ -10,7 +10,6 @@ import { useState } from 'react';
10
10
  * Internal dependencies
11
11
  */
12
12
  import { Button, Text, Input, Label } from '../../system';
13
- import ScreenReaderText from '../ScreenReaderText';
14
13
  import * as NewDialog from '.';
15
14
 
16
15
  export default {
@@ -33,31 +32,6 @@ export const Default = () => (
33
32
  </>
34
33
  );
35
34
 
36
- export const AutoOpen = () => (
37
- <>
38
- <Text sx={ { fontSize: 3, mb: 3 } }>Auto Opens when rendered. Press escape to close it.</Text>
39
- <NewDialog.Root
40
- { ...defaultProps }
41
- defaultOpen={ true }
42
- content={
43
- <div>
44
- <h3>Test</h3>
45
- <p>
46
- Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum
47
- has been the industry standard dummy text ever since the 1500s, when an unknown printer
48
- took a galley of type and scrambled it to make a type specimen book. It has survived not
49
- only five centuries, but also the leap into electronic typesetting, remaining
50
- essentially unchanged. It was popularised in the 1960s with the release of Letraset
51
- sheets containing Lorem Ipsum passages, and more recently with desktop publishing
52
- software like Aldus PageMaker including versions of Lorem Ipsum.
53
- </p>
54
- </div>
55
- }
56
- trigger={ <ScreenReaderText>hey</ScreenReaderText> }
57
- />
58
- </>
59
- );
60
-
61
35
  export const HiddenHeadings = () => (
62
36
  <>
63
37
  <Text sx={ { fontSize: 3, mb: 3 } }>
@@ -96,7 +70,6 @@ export const CustomStyling = () => (
96
70
 
97
71
  <NewDialog.Root
98
72
  { ...defaultProps }
99
- defaultOpen
100
73
  trigger={ <Button>Trigger Dialog</Button> }
101
74
  title="Custom dialog title"
102
75
  style={ {
@@ -0,0 +1,46 @@
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 { baseControlBorderStyle, inputBaseBackground, inputBaseText } from '../Form/Input.styles';
14
+ import { ThemeUIStyleObject } from 'theme-ui';
15
+
16
+ interface FieldsetProps {
17
+ children?: React.ReactNode;
18
+ sx?: ThemeUIStyleObject;
19
+ className?: string;
20
+ }
21
+ export const Fieldset = React.forwardRef< HTMLFieldSetElement, FieldsetProps >(
22
+ ( { children, className, sx = {}, ...props }, forwardRef ) => (
23
+ <fieldset
24
+ ref={ forwardRef }
25
+ className={ classNames( 'vip-form-fieldset-component', className ) }
26
+ sx={ {
27
+ all: 'unset',
28
+ ...baseControlBorderStyle,
29
+ backgroundColor: inputBaseBackground,
30
+ color: inputBaseText,
31
+ borderRadius: 1,
32
+ display: 'block',
33
+ pt: 1,
34
+ pb: 2,
35
+ px: 3,
36
+ mb: 3,
37
+ ...sx,
38
+ } }
39
+ { ...props }
40
+ >
41
+ { children }
42
+ </fieldset>
43
+ )
44
+ );
45
+
46
+ Fieldset.displayName = 'Fieldset';
@@ -0,0 +1,23 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import React from 'react';
5
+ import classNames from 'classnames';
6
+ export interface FormProps {
7
+ children?: React.ReactNode;
8
+ className?: string;
9
+ }
10
+ export const Form = React.forwardRef< HTMLFormElement, FormProps >(
11
+ ( { children, className, ...props }, forwardRef ) => (
12
+ <form
13
+ ref={ forwardRef }
14
+ className={ classNames( 'vip-form-component', className ) }
15
+ noValidate
16
+ { ...props }
17
+ >
18
+ { children }
19
+ </form>
20
+ )
21
+ );
22
+
23
+ Form.displayName = 'Form';
@@ -38,17 +38,6 @@
38
38
  cursor: pointer;
39
39
  }
40
40
 
41
- /* .autocomplete__dropdown-arrow-down {
42
- z-index: -1;
43
- display: inline-block;
44
- position: absolute;
45
- right: 8px;
46
- width: 24px;
47
- height: 24px;
48
- top: 10px;
49
- pointer-events: none;
50
- } */
51
-
52
41
  .autocomplete__menu {
53
42
  background-color: #fff;
54
43
  border: 2px solid #0b0c0c;