@automattic/vip-design-system 0.7.1 → 0.9.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 (115) hide show
  1. package/.eslines.json +10 -0
  2. package/.eslintignore +7 -0
  3. package/.eslintrc.json +23 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  5. package/.github/workflows/codeql-analysis.yml +71 -0
  6. package/.github/workflows/nodejs.yaml +29 -0
  7. package/.prettierrc +9 -0
  8. package/.storybook/preview.js +8 -7
  9. package/README.md +52 -2
  10. package/babel.config.js +10 -10
  11. package/build/system/Avatar/Avatar.js +5 -1
  12. package/build/system/Avatar/Avatar.test.js +54 -0
  13. package/build/system/Badge/Badge.js +2 -2
  14. package/build/system/BlankState/BlankState.js +5 -4
  15. package/build/system/Button/Button.js +5 -1
  16. package/build/system/Card/Card.js +2 -1
  17. package/build/system/Code/Code.js +4 -4
  18. package/build/system/ConfirmationDialog/ConfirmationDialog.js +1 -1
  19. package/build/system/Dialog/DialogButton.js +2 -4
  20. package/build/system/Dialog/DialogContent.js +5 -5
  21. package/build/system/Form/InlineSelect.js +28 -16
  22. package/build/system/Form/Input.js +3 -2
  23. package/build/system/Form/Label.js +2 -2
  24. package/build/system/Form/RadioBoxGroup.js +0 -2
  25. package/build/system/Form/SearchSelect.js +36 -56
  26. package/build/system/Form/Select.js +3 -3
  27. package/build/system/Form/Textarea.js +3 -2
  28. package/build/system/Form/Toggle.js +1 -1
  29. package/build/system/Form/ToggleGroup.js +0 -4
  30. package/build/system/Form/ToggleRow.js +5 -4
  31. package/build/system/Form/Validation.js +4 -4
  32. package/build/system/Notice/Notice.js +58 -54
  33. package/build/system/Notification/Notification.js +3 -3
  34. package/build/system/OptionRow/OptionRow.js +11 -10
  35. package/build/system/ResourceList/ResourceItem.js +89 -0
  36. package/build/system/ResourceList/ResourceList.js +121 -0
  37. package/build/system/ResourceList/index.js +11 -0
  38. package/build/system/Table/TableRow.js +1 -1
  39. package/build/system/Tabs/TabItem.js +2 -2
  40. package/build/system/Tabs/Tabs.js +1 -1
  41. package/build/system/Time/index.js +91 -0
  42. package/build/system/Tooltip/Tooltip.js +49 -47
  43. package/build/system/Wizard/WizardStep.js +4 -4
  44. package/build/system/Wizard/WizardStepHorizontal.js +2 -2
  45. package/build/system/index.js +7 -2
  46. package/build/system/theme/colors.js +235 -131
  47. package/build/system/theme/index.js +128 -107
  48. package/package.json +48 -13
  49. package/src/system/Avatar/Avatar.js +5 -1
  50. package/src/system/Avatar/Avatar.stories.js +0 -5
  51. package/src/system/Avatar/Avatar.test.js +31 -0
  52. package/src/system/Badge/Badge.js +3 -3
  53. package/src/system/Badge/Badge.stories.js +0 -5
  54. package/src/system/BlankState/BlankState.js +5 -5
  55. package/src/system/BlankState/BlankState.stories.js +0 -5
  56. package/src/system/Box/Box.stories.js +0 -5
  57. package/src/system/Button/Button.js +6 -2
  58. package/src/system/Card/Card.js +16 -12
  59. package/src/system/Card/Card.stories.js +0 -5
  60. package/src/system/Code/Code.js +4 -4
  61. package/src/system/Code/Code.stories.js +4 -1
  62. package/src/system/ConfirmationDialog/ConfirmationDialog.js +1 -1
  63. package/src/system/ConfirmationDialog/ConfirmationDialog.stories.js +0 -5
  64. package/src/system/Dialog/Dialog.stories.js +0 -5
  65. package/src/system/Dialog/DialogButton.js +2 -3
  66. package/src/system/Dialog/DialogContent.js +17 -4
  67. package/src/system/Flex/Flex.stories.js +0 -5
  68. package/src/system/Form/InlineSelect.js +28 -15
  69. package/src/system/Form/Input.js +3 -1
  70. package/src/system/Form/Input.stories.js +0 -5
  71. package/src/system/Form/Label.js +2 -2
  72. package/src/system/Form/RadioBoxGroup.js +1 -2
  73. package/src/system/Form/RadioBoxGroup.stories.js +4 -5
  74. package/src/system/Form/SearchSelect.js +35 -42
  75. package/src/system/Form/Select.js +18 -18
  76. package/src/system/Form/Select.stories.js +1 -1
  77. package/src/system/Form/Textarea.js +3 -1
  78. package/src/system/Form/Toggle.js +1 -1
  79. package/src/system/Form/ToggleGroup.js +34 -37
  80. package/src/system/Form/ToggleGroup.stories.js +30 -32
  81. package/src/system/Form/ToggleRow.js +4 -4
  82. package/src/system/Form/Validation.js +2 -2
  83. package/src/system/Grid/Grid.stories.js +0 -5
  84. package/src/system/Heading/Heading.stories.js +0 -5
  85. package/src/system/Link/Link.stories.js +0 -5
  86. package/src/system/Notice/Notice.js +33 -28
  87. package/src/system/Notification/Notification.js +5 -5
  88. package/src/system/Notification/Notification.stories.js +0 -5
  89. package/src/system/OptionRow/OptionRow.js +36 -31
  90. package/src/system/OptionRow/OptionRow.stories.js +0 -5
  91. package/src/system/Progress/Progress.stories.js +0 -5
  92. package/src/system/ResourceList/ResourceItem.js +66 -0
  93. package/src/system/ResourceList/ResourceList.js +96 -0
  94. package/src/system/ResourceList/ResourceList.stories.js +300 -0
  95. package/src/system/ResourceList/index.js +7 -0
  96. package/src/system/Spinner/Spinner.stories.js +0 -5
  97. package/src/system/Table/Table.stories.js +0 -5
  98. package/src/system/Table/TableRow.js +2 -2
  99. package/src/system/Tabs/TabItem.js +2 -2
  100. package/src/system/Tabs/Tabs.js +1 -1
  101. package/src/system/Tabs/Tabs.stories.js +0 -5
  102. package/src/system/Text/Text.stories.js +0 -5
  103. package/src/system/{Timeline/Timeline.stories.js → Time/Time.stories.js} +5 -5
  104. package/src/system/Time/index.js +62 -0
  105. package/src/system/Tooltip/Tooltip.js +40 -35
  106. package/src/system/Tooltip/Tooltip.stories.js +0 -5
  107. package/src/system/Wizard/Wizard.js +7 -7
  108. package/src/system/Wizard/WizardStep.js +9 -9
  109. package/src/system/Wizard/WizardStepHorizontal.js +3 -3
  110. package/src/system/index.js +27 -4
  111. package/src/system/theme/colors.js +233 -129
  112. package/src/system/theme/index.js +290 -260
  113. package/test/setupAfterEnv.js +13 -0
  114. package/test/setupTests.js +4 -0
  115. package/src/system/Timeline/index.js +0 -40
@@ -17,6 +17,9 @@ export const Default = () => (
17
17
  <React.Fragment>
18
18
  <Code>Code</Code>
19
19
  <Code showCopy={true}>Code with Icon</Code>
20
- <Code showCopy={true} onCopy={ () => console.info('Hello world') }>Code with Icon and Click callback — console.info</Code>
20
+ <Code showCopy={true} onCopy={
21
+ // eslint-disable-next-line no-console
22
+ () => console.info( 'Hello world' )
23
+ }>Code with Icon and Click callback — console.info</Code>
21
24
  </React.Fragment>
22
25
  );
@@ -35,7 +35,7 @@ const ConfirmationDialogContent = ( { title, body, onClose, label = 'Confirm', o
35
35
  );
36
36
 
37
37
  ConfirmationDialogContent.propTypes = {
38
- title: PropTypes.string,
38
+ title: PropTypes.node,
39
39
  body: PropTypes.node,
40
40
  label: PropTypes.string,
41
41
  onClose: PropTypes.func,
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
@@ -4,7 +4,6 @@
4
4
  * External dependencies
5
5
  */
6
6
  import PropTypes from 'prop-types';
7
- import React from 'react';
8
7
  import { MdExpandMore } from 'react-icons/md';
9
8
 
10
9
  /**
@@ -33,10 +32,10 @@ const DialogButton = ( { label, variant = 'secondary', value, children, ...props
33
32
  sx={ {
34
33
  mb: 0,
35
34
  flex: '1 1 auto',
36
- 'white-space': 'nowrap',
35
+ whiteSpace: 'nowrap',
37
36
  overflow: 'hidden',
38
37
  color: 'heading',
39
- 'text-overflow': 'ellipsis',
38
+ textOverflow: 'ellipsis',
40
39
  } }
41
40
  >
42
41
  { value }
@@ -38,8 +38,21 @@ const DialogContent = ( { position = 'left', variant = 'dropdown', onClose, ...p
38
38
  left: 0,
39
39
  right: 0,
40
40
  bottom: 0,
41
- backgroundColor: 'grey.50',
42
41
  opacity: 0.7,
42
+ background: `linear-gradient(
43
+ 198.09deg,
44
+ #E5F0F6 2.01%,
45
+ rgba(235, 238, 242, 0) 43.18%,
46
+ rgba(249, 234, 232, 0) 47.86%,
47
+ #FFE9D1 94.31%
48
+ ),
49
+ linear-gradient(
50
+ 98.65deg,
51
+ #FFE8E6 0.58%,
52
+ rgba(255, 233, 214, 0) 52.45%,
53
+ rgba(255, 233, 219, 0) 53.76%,
54
+ #FFE9D1 105.86%
55
+ ), #F5F2F1`,
43
56
  } }
44
57
  />
45
58
  ) }
@@ -68,8 +81,8 @@ const SidebarMotion = props => (
68
81
  sx={ {
69
82
  marginTop: 2,
70
83
  borderRadius: 2,
71
- backgroundColor: 'card',
72
- boxShadow: 'low',
84
+ backgroundColor: 'dialog',
85
+ boxShadow: 'medium',
73
86
  position: 'absolute',
74
87
  top: '100%',
75
88
  zIndex: 100,
@@ -110,7 +123,7 @@ const DialogMotion = ( { variant, position, ...props } ) => {
110
123
  marginTop: 2,
111
124
  transformOrigin: transformOrigin,
112
125
  borderRadius: 2,
113
- backgroundColor: 'card',
126
+ backgroundColor: 'dialog',
114
127
  boxShadow: 'low',
115
128
  position: 'absolute',
116
129
  top: '100%',
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
@@ -20,7 +20,6 @@ const selectStyles = {
20
20
  border: 0,
21
21
  padding: 0,
22
22
  boxShadow: 'none',
23
- fontSize: vipTheme.fontSizes[ 2 ],
24
23
  } ),
25
24
  container: provided => ( { ...provided, padding: 0 } ),
26
25
  input: provided => ( { ...provided, padding: 0 } ),
@@ -30,10 +29,10 @@ const selectStyles = {
30
29
  paddingBottom: vipTheme.space[ 1 ],
31
30
  paddingLeft: vipTheme.space[ 2 ],
32
31
  } ),
33
- menu: () => ( { boxShadow: 'none', borderTop: `1px solid ${ vipTheme.colors.border }` } ),
32
+ menu: () => ( { boxShadow: 'none', borderTop: '1px solid' } ),
34
33
  };
35
34
 
36
- const InlineSelect = ( { label, value, options, noneLabel = 'All', position = "left", ...props } ) => {
35
+ const InlineSelect = ( { label, value, options, noneLabel = 'All', position = 'left', ...props } ) => {
37
36
  let valueLabel = noneLabel;
38
37
 
39
38
  if ( Array.isArray( value ) && value.length ) {
@@ -56,21 +55,35 @@ const InlineSelect = ( { label, value, options, noneLabel = 'All', position = "l
56
55
  hideSelectedOptions={false}
57
56
  isClearable={false}
58
57
  menuIsOpen
59
- options={options}
60
58
  styles={selectStyles}
59
+ classNamePrefix={ 'select' }
60
+ options={options}
61
61
  placeholder="Search..."
62
62
  tabSelectsValue={false}
63
63
  value={value}
64
- {...props}
65
- theme={theme => ( {
66
- ...theme,
67
- colors: {
68
- ...theme.colors,
69
- primary25: vipTheme.colors.hover,
70
- primary50: vipTheme.colors.brand[ '7' ],
71
- primary: vipTheme.colors.heading,
64
+ sx={ {
65
+ '.select__control': {
66
+ background: 'none',
67
+ color: 'heading',
68
+ },
69
+ '.select__single-value': {
70
+ color: 'heading',
71
+ px: 1,
72
72
  },
73
- } )}
73
+ '.react-select__option': {
74
+ bg: 'grey.10',
75
+ '&:hover': {
76
+ bg: 'grey.10',
77
+ },
78
+ },
79
+ '.select__option--is-focused': {
80
+ bg: 'grey.10',
81
+ },
82
+ '.select__menu': {
83
+ borderColor: 'border',
84
+ },
85
+ } }
86
+ {...props}
74
87
  />
75
88
  </Box>
76
89
  );
@@ -87,10 +100,10 @@ const InlineSelect = ( { label, value, options, noneLabel = 'All', position = "l
87
100
  InlineSelect.propTypes = {
88
101
  label: PropTypes.string,
89
102
  // https://react-select.com/props
90
- value: PropTypes.oneOfType([
103
+ value: PropTypes.oneOfType( [
91
104
  PropTypes.array,
92
105
  PropTypes.object,
93
- ]),
106
+ ] ),
94
107
  options: PropTypes.array,
95
108
  position: PropTypes.string,
96
109
  noneLabel: PropTypes.string,
@@ -28,7 +28,7 @@ const Input = React.forwardRef( ( { variant, label, forLabel, hasError, required
28
28
  required={ required }
29
29
  sx={ {
30
30
  border: '1px solid',
31
- borderColor: 'border',
31
+ borderColor: 'grey.60',
32
32
  backgroundColor: 'card',
33
33
  borderRadius: 1,
34
34
  lineHeight: 'inherit',
@@ -66,4 +66,6 @@ Input.propTypes = {
66
66
  errorMessage: PropTypes.string,
67
67
  };
68
68
 
69
+ Input.displayName = 'Input';
70
+
69
71
  export { Input };
@@ -1,10 +1,5 @@
1
1
  /** @jsxImportSource theme-ui */
2
2
 
3
- /**
4
- * External dependencies
5
- */
6
- import React from 'react';
7
-
8
3
  /**
9
4
  * Internal dependencies
10
5
  */
@@ -7,9 +7,9 @@ import { Heading } from '..';
7
7
 
8
8
  const Label = props => (
9
9
  <Heading
10
- variant="caps"
10
+ variant="h4"
11
11
  as="label"
12
- sx={{ display: 'block', mb: 2, color: 'text' }}
12
+ sx={{ display: 'block', mb: 2, color: 'muted' }}
13
13
  {...props}
14
14
  />
15
15
  );
@@ -3,7 +3,6 @@
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import React from 'react';
7
6
  import PropTypes from 'prop-types';
8
7
  import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
9
8
  import { MdCheckCircle } from 'react-icons/md';
@@ -21,7 +20,7 @@ const RadioBoxGroup = ( { onChange, groupLabel, value, options, ...props } ) =>
21
20
  sx={ {
22
21
  display: 'flex',
23
22
  gap: 2,
24
-
23
+
25
24
  } }
26
25
  { ...props }
27
26
  >
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import React, { useState } from 'react';
4
+ import { useState } from 'react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -32,7 +32,6 @@ const options = [
32
32
  ];
33
33
 
34
34
  export const Default = () => {
35
- const [ value, setValue ] = useState('one');
36
- return <RadioBoxGroup value={ value } onChange={ newValue => setValue( newValue ) } groupLabel="group" options={ options } />
37
-
38
- }
35
+ const [ value, setValue ] = useState( 'one' );
36
+ return <RadioBoxGroup value={ value } onChange={ newValue => setValue( newValue ) } groupLabel="group" options={ options } />;
37
+ };
@@ -10,42 +10,13 @@ import PropTypes from 'prop-types';
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
- import { theme as vipTheme, Flex, Text } from '..';
14
-
15
- export const selectStyles = {
16
- control: provided => ( {
17
- ...provided,
18
- border: `1px solid ${ vipTheme.colors.border }`,
19
- margin: 0,
20
- padding: 0,
21
- boxShadow: 'none',
22
- fontSize: vipTheme.fontSizes[ 2 ],
23
- } ),
24
- option: provided => ( {
25
- ...provided,
26
- paddingTop: vipTheme.space[ 1 ],
27
- paddingBottom: vipTheme.space[ 1 ],
28
- paddingLeft: vipTheme.space[ 2 ],
29
- } ),
30
- menu: provided => ( { ...provided, boxShadow: vipTheme.shadows.low } ),
31
- indicatorSeparator: () => ( { display: 'none' } ),
32
- valueContainer: provided => ( {
33
- ...provided,
34
- paddingLeft: vipTheme.space[ 1 ],
35
- paddingRight: vipTheme.space[ 1 ],
36
- } ),
37
- singleValue: provided => ( {
38
- ...provided,
39
- paddingLeft: vipTheme.space[ 1 ],
40
- paddingRight: vipTheme.space[ 1 ],
41
- } ),
42
- };
13
+ import { Flex, Text } from '..';
43
14
 
44
15
  export const Option = ( { label, isSelected, ...props } ) => (
45
16
  <components.Option {...props}>
46
17
  <Flex sx={{ alignItems: 'center' }}>
47
18
  {isSelected && (
48
- <Text as="span" sx={{ mb: 0, mr: 2, color: 'green.60', svg: { display: 'block' } }}>
19
+ <Text as="span" sx={{ mb: 0, mr: 2, color: 'green.80', svg: { display: 'block' } }}>
49
20
  <MdDone />
50
21
  </Text>
51
22
  )}
@@ -73,19 +44,41 @@ ClearIndicator.propTypes = {
73
44
  const SearchSelect = props => (
74
45
  <Select
75
46
  {...props}
47
+ classNamePrefix={ 'select' }
76
48
  components={{ Option, DropdownIndicator, ClearIndicator }}
77
- styles={selectStyles}
78
- theme={theme => ( {
79
- ...theme,
80
- colors: {
81
- ...theme.colors,
82
- primary25: vipTheme.colors.hover,
83
- primary50: vipTheme.colors.brand[ '7' ],
84
- primary: vipTheme.colors.heading,
85
- dangerLight: vipTheme.colors.red[ '10' ],
86
- danger: vipTheme.colors.red[ '70' ],
49
+ sx={ {
50
+ '.select__control': {
51
+ background: 'none',
52
+ color: 'heading',
53
+ border: '1px solid',
54
+ borderColor: 'border',
55
+ margin: 0,
56
+ padding: 0,
57
+ boxShadow: 'none',
58
+ fontSize: 2,
59
+ },
60
+ '.select__single-value': {
61
+ color: 'heading',
62
+ px: 1,
63
+ },
64
+ '.select__menu': {
65
+ bg: 'dialog',
66
+ boxShadow: 'medium',
67
+ },
68
+ '.react-select__option': {
69
+ color: 'text',
70
+ paddingTop: 1,
71
+ paddingBottom: 1,
72
+ paddingLeft: 2,
73
+ bg: 'hover',
74
+ '&:hover': {
75
+ bg: 'hover',
76
+ },
77
+ },
78
+ '.select__option--is-focused': {
79
+ bg: 'hover',
87
80
  },
88
- } )}
81
+ } }
89
82
  />
90
83
  );
91
84
 
@@ -3,27 +3,27 @@
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import PropTypes from 'prop-types';
6
+ import PropTypes from 'prop-types';
7
7
 
8
- /**
8
+ /**
9
9
  * Internal dependencies
10
10
  */
11
- import { SearchSelect } from './SearchSelect';
12
- import { InlineSelect } from './InlineSelect';
11
+ import { SearchSelect } from './SearchSelect';
12
+ import { InlineSelect } from './InlineSelect';
13
13
 
14
- const Select = ( { isMulti = false, isInline, options, label, isSearch, ...props } ) => {
15
- if ( isInline ) {
16
- return <InlineSelect isMulti={ isMulti } label={ label } options={ options } { ...props } />;
17
- }
18
- return <SearchSelect isMulti={ isMulti } label={ label } options={ options } { ...props } />;
19
- };
14
+ const Select = ( { isMulti = false, isInline, options, label, isSearch, ...props } ) => {
15
+ if ( isInline ) {
16
+ return <InlineSelect isMulti={ isMulti } label={ label } options={ options } { ...props } />;
17
+ }
18
+ return <SearchSelect isMulti={ isMulti } label={ label } options={ options } { ...props } />;
19
+ };
20
20
 
21
- Select.propTypes = {
22
- isMulti: PropTypes.bool,
23
- isInline: PropTypes.bool,
24
- isSearch: PropTypes.bool,
25
- options: PropTypes.array,
26
- label: PropTypes.string,
27
- };
21
+ Select.propTypes = {
22
+ isInline: PropTypes.bool,
23
+ isMulti: PropTypes.bool,
24
+ isSearch: PropTypes.bool,
25
+ label: PropTypes.string,
26
+ options: PropTypes.array,
27
+ };
28
28
 
29
- export { Select };
29
+ export { Select };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import React, { useState } from 'react';
4
+ import { useState } from 'react';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
@@ -14,7 +14,7 @@ import { Validation, Label } from '../';
14
14
  const Textarea = React.forwardRef( ( { variant, label, forLabel, hasError, required, errorMessage, ...props }, ref ) => (
15
15
  <React.Fragment>
16
16
  { label &&
17
- <Label for={ forLabel }>
17
+ <Label htmlFor={ forLabel }>
18
18
  { label }
19
19
  { required &&
20
20
  '*'
@@ -61,4 +61,6 @@ Textarea.propTypes = {
61
61
  errorMessage: PropTypes.string,
62
62
  };
63
63
 
64
+ Textarea.displayName = 'Textarea';
65
+
64
66
  export { Textarea };
@@ -61,7 +61,7 @@ const CheckBox = props => (
61
61
  margin: 0,
62
62
  display: 'block',
63
63
  '&:checked + label': {
64
- backgroundColor: 'green.50',
64
+ backgroundColor: 'success',
65
65
  '&::after': {
66
66
  content: "''",
67
67
  display: 'block',
@@ -3,31 +3,29 @@
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import React from 'react';
7
- import PropTypes from 'prop-types';
8
- import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
9
- import { MdCheckCircle } from "react-icons/md";
10
-
11
- const ToggleGroup = ( { onChange, groupLabel, value, options, ...props } ) => (
12
- <RadioGroupPrimitive.Root
13
- onValueChange={ onChange }
14
- value={ value }
15
- aria-label={ groupLabel }
16
- sx={ {
6
+ import PropTypes from 'prop-types';
7
+ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
8
+
9
+ const ToggleGroup = ( { onChange, groupLabel, value, options, ...props } ) => (
10
+ <RadioGroupPrimitive.Root
11
+ onValueChange={ onChange }
12
+ value={ value }
13
+ aria-label={ groupLabel }
14
+ sx={ {
17
15
  bg: 'backgroundSecondary',
18
16
  p: 1,
19
17
  display: 'flex',
20
18
  alignItems: 'center',
21
19
  } }
22
- { ...props }
23
- >
24
- {
25
- options.map( ( option, index ) => (
26
- <RadioGroupPrimitive.Item
27
- key={ option.value }
28
- value={ option.value }
29
- id={ `o${ index }` }
30
- sx={ {
20
+ { ...props }
21
+ >
22
+ {
23
+ options.map( ( option, index ) => (
24
+ <RadioGroupPrimitive.Item
25
+ key={ option.value }
26
+ value={ option.value }
27
+ id={ `o${ index }` }
28
+ sx={ {
31
29
  fontSize: 1,
32
30
  color: 'muted',
33
31
  background: 'none',
@@ -47,20 +45,19 @@
47
45
  color: 'heading',
48
46
  },
49
47
  } }
50
- >
51
- { option.label }
52
- </RadioGroupPrimitive.Item>
53
- ) )
54
- }
55
- </RadioGroupPrimitive.Root>
56
- );
57
-
58
- ToggleGroup.propTypes = {
59
- onChange: PropTypes.func,
60
- options: PropTypes.array,
61
- value: PropTypes.string,
62
- groupLabel: PropTypes.string,
63
- };
64
-
65
- export { ToggleGroup };
66
-
48
+ >
49
+ { option.label }
50
+ </RadioGroupPrimitive.Item>
51
+ ) )
52
+ }
53
+ </RadioGroupPrimitive.Root>
54
+ );
55
+
56
+ ToggleGroup.propTypes = {
57
+ onChange: PropTypes.func,
58
+ options: PropTypes.array,
59
+ value: PropTypes.string,
60
+ groupLabel: PropTypes.string,
61
+ };
62
+
63
+ export { ToggleGroup };
@@ -1,36 +1,34 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import React, { useState } from 'react';
4
+ import { useState } from 'react';
5
5
 
6
- /**
7
- * Internal dependencies
8
- */
9
- import { ToggleGroup } from '..';
10
-
11
- export default {
12
- title: 'ToggleGroup',
13
- component: ToggleGroup,
14
- };
15
-
16
- const options = [
17
- {
18
- label: 'One',
19
- value: 'one',
20
- },
21
- {
22
- label: 'Two',
23
- value: 'two',
24
- },
25
- {
26
- label: 'Three',
27
- value: 'three',
28
- },
29
- ];
30
-
31
- export const Default = () => {
32
- const [ value, setValue ] = useState('one');
33
- return <ToggleGroup value={ value } onChange={ newValue => setValue( newValue ) } groupLabel="group" options={ options } />
34
-
35
- }
36
-
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { ToggleGroup } from '..';
10
+
11
+ export default {
12
+ title: 'ToggleGroup',
13
+ component: ToggleGroup,
14
+ };
15
+
16
+ const options = [
17
+ {
18
+ label: 'One',
19
+ value: 'one',
20
+ },
21
+ {
22
+ label: 'Two',
23
+ value: 'two',
24
+ },
25
+ {
26
+ label: 'Three',
27
+ value: 'three',
28
+ },
29
+ ];
30
+
31
+ export const Default = () => {
32
+ const [ value, setValue ] = useState( 'one' );
33
+ return <ToggleGroup value={ value } onChange={ newValue => setValue( newValue ) } groupLabel="group" options={ options } />;
34
+ };
@@ -36,7 +36,7 @@ const ToggleRow = ( { image, badge, title, subTitle, body, meta, sx, ...props }
36
36
  flex: '0 0 auto',
37
37
  } }
38
38
  >
39
- <img src={ image } width={ 32 } sx={ { display: 'block' } } />
39
+ <img src={ image } width={ 32 } sx={ { display: 'block' } } alt="Icon representing a toggle" />
40
40
  </Card>
41
41
  </Box>
42
42
  ) }
@@ -57,10 +57,10 @@ const ToggleRow = ( { image, badge, title, subTitle, body, meta, sx, ...props }
57
57
  );
58
58
 
59
59
  ToggleRow.propTypes = {
60
- image: PropTypes.string,
60
+ image: PropTypes.oneOfType( [ PropTypes.object, PropTypes.string ] ),
61
61
  badge: PropTypes.string,
62
- title: PropTypes.string,
63
- subTitle: PropTypes.string,
62
+ title: PropTypes.node,
63
+ subTitle: PropTypes.node,
64
64
  body: PropTypes.node,
65
65
  meta: PropTypes.node,
66
66
  sx: PropTypes.object,
@@ -15,8 +15,8 @@ const Validation = ( { children, isValid, ...props } ) => {
15
15
  const Icon = isValid ? MdCheckCircle : MdErrorOutline;
16
16
 
17
17
  return (
18
- <Heading variant="h5" as="p" sx={ { color: isValid ? 'green.50' : 'red.50' } } { ...props }>
19
- <Icon sx={ { mr: 1, position: 'relative', top: '0.125em' } } />
18
+ <Heading variant="h5" as="p" sx={ { color: isValid ? 'success' : 'error', display: 'flex', alignItems: 'center' } } { ...props }>
19
+ <Icon sx={ { mr: 1 } } />
20
20
  { children }
21
21
  </Heading>
22
22
  );
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import React from 'react';
5
-
6
1
  /**
7
2
  * Internal dependencies
8
3
  */