@automattic/vip-design-system 0.10.3 → 0.12.0

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 (141) hide show
  1. package/.eslines.json +8 -8
  2. package/.eslintrc.json +9 -4
  3. package/.github/PULL_REQUEST_TEMPLATE.md +1 -1
  4. package/.github/workflows/nodejs.yaml +14 -14
  5. package/.prettierrc +1 -2
  6. package/.storybook/main.js +2 -1
  7. package/.storybook/preview.js +5 -8
  8. package/README.md +1 -0
  9. package/babel.config.js +1 -1
  10. package/build/system/Avatar/Avatar.js +2 -1
  11. package/build/system/BlankState/BlankState.stories.js +3 -3
  12. package/build/system/BlankState/BlankState.test.js +2 -2
  13. package/build/system/Card/Card.test.js +0 -2
  14. package/build/system/Code/Code.js +7 -2
  15. package/build/system/Code/Code.test.js +22 -57
  16. package/build/system/Form/Select.stories.js +3 -4
  17. package/build/system/Form/Select.test.js +2 -2
  18. package/build/system/Form/Toggle.js +45 -72
  19. package/build/system/Form/Toggle.stories.js +63 -0
  20. package/build/system/Form/Toggle.test.js +55 -0
  21. package/build/system/Notification/Notification.js +24 -15
  22. package/build/system/Notification/Notification.stories.js +14 -4
  23. package/build/system/OptionRow/OptionRow.js +23 -17
  24. package/build/system/OptionRow/OptionRow.stories.js +5 -5
  25. package/build/system/OptionRow/OptionRow.test.js +4 -4
  26. package/build/system/ResourceList/ResourceList.js +34 -25
  27. package/build/system/ResourceList/ResourceList.stories.js +2 -0
  28. package/build/system/ScreenReaderText/ScreenReader.test.js +37 -0
  29. package/build/system/ScreenReaderText/ScreenReaderText.js +49 -0
  30. package/build/system/ScreenReaderText/index.js +7 -0
  31. package/build/system/Table/Table.stories.js +46 -3
  32. package/build/system/Table/TableCell.js +57 -0
  33. package/build/system/Table/TableRow.js +12 -57
  34. package/build/system/Table/index.js +5 -1
  35. package/build/system/Time/index.js +1 -1
  36. package/build/system/Wizard/Wizard.stories.js +1 -1
  37. package/build/system/index.js +1 -0
  38. package/package.json +10 -4
  39. package/src/system/Avatar/Avatar.js +1 -0
  40. package/src/system/Avatar/index.js +0 -1
  41. package/src/system/Badge/index.js +0 -1
  42. package/src/system/BlankState/BlankState.js +8 -5
  43. package/src/system/BlankState/BlankState.stories.jsx +5 -4
  44. package/src/system/BlankState/BlankState.test.js +21 -21
  45. package/src/system/BlankState/index.js +0 -1
  46. package/src/system/Box/Box.js +7 -1
  47. package/src/system/Box/index.js +0 -1
  48. package/src/system/Button/Button.js +3 -3
  49. package/src/system/Button/Button.stories.jsx +2 -2
  50. package/src/system/Button/index.js +0 -1
  51. package/src/system/Card/Card.js +4 -4
  52. package/src/system/Card/Card.test.js +1 -2
  53. package/src/system/Card/index.js +0 -1
  54. package/src/system/Code/Code.js +6 -2
  55. package/src/system/Code/Code.stories.jsx +10 -5
  56. package/src/system/Code/Code.test.js +3 -16
  57. package/src/system/ConfirmationDialog/ConfirmationDialog.js +8 -1
  58. package/src/system/Dialog/Dialog.js +17 -8
  59. package/src/system/Dialog/Dialog.stories.jsx +9 -13
  60. package/src/system/Dialog/DialogButton.js +18 -14
  61. package/src/system/Dialog/DialogDivider.js +1 -1
  62. package/src/system/Dialog/DialogMenu.js +1 -5
  63. package/src/system/Dialog/DialogMenuItem.js +4 -8
  64. package/src/system/Dialog/DialogTrigger.js +1 -1
  65. package/src/system/Dialog/index.js +0 -1
  66. package/src/system/Flex/Flex.js +1 -1
  67. package/src/system/Flex/index.js +0 -1
  68. package/src/system/Form/AsyncSearchSelect.js +3 -7
  69. package/src/system/Form/Checkbox.js +32 -28
  70. package/src/system/Form/InlineSelect.js +21 -17
  71. package/src/system/Form/Input.js +43 -45
  72. package/src/system/Form/Label.js +2 -2
  73. package/src/system/Form/RadioBoxGroup.js +34 -32
  74. package/src/system/Form/RadioBoxGroup.stories.jsx +8 -1
  75. package/src/system/Form/SearchSelect.js +7 -7
  76. package/src/system/Form/Select.js +21 -2
  77. package/src/system/Form/Select.stories.jsx +31 -34
  78. package/src/system/Form/Select.test.js +3 -8
  79. package/src/system/Form/Textarea.js +38 -40
  80. package/src/system/Form/Toggle.js +37 -65
  81. package/src/system/Form/Toggle.stories.jsx +42 -0
  82. package/src/system/Form/Toggle.test.js +23 -0
  83. package/src/system/Form/ToggleGroup.js +29 -31
  84. package/src/system/Form/ToggleGroup.stories.jsx +8 -1
  85. package/src/system/Form/ToggleRow.js +6 -1
  86. package/src/system/Form/Validation.js +6 -1
  87. package/src/system/Form/index.js +13 -1
  88. package/src/system/Grid/Grid.js +1 -1
  89. package/src/system/Grid/index.js +0 -1
  90. package/src/system/Heading/Heading.js +4 -4
  91. package/src/system/Heading/index.js +0 -1
  92. package/src/system/Link/index.js +0 -1
  93. package/src/system/Notice/Notice.js +27 -13
  94. package/src/system/Notice/Notice.stories.jsx +6 -8
  95. package/src/system/Notice/index.js +0 -1
  96. package/src/system/Notification/Notification.js +25 -20
  97. package/src/system/Notification/Notification.stories.jsx +4 -4
  98. package/src/system/Notification/index.js +0 -1
  99. package/src/system/OptionRow/OptionRow.js +46 -44
  100. package/src/system/OptionRow/OptionRow.stories.jsx +10 -8
  101. package/src/system/OptionRow/OptionRow.test.js +12 -11
  102. package/src/system/OptionRow/index.js +0 -1
  103. package/src/system/Progress/Progress.js +3 -1
  104. package/src/system/Progress/Progress.stories.jsx +4 -4
  105. package/src/system/Progress/index.js +0 -1
  106. package/src/system/ResourceList/ResourceItem.js +15 -15
  107. package/src/system/ResourceList/ResourceList.js +28 -16
  108. package/src/system/ResourceList/ResourceList.stories.jsx +77 -71
  109. package/src/system/ScreenReaderText/ScreenReader.test.js +22 -0
  110. package/src/system/ScreenReaderText/ScreenReaderText.js +40 -0
  111. package/src/system/ScreenReaderText/index.js +7 -0
  112. package/src/system/Spinner/Spinner.js +4 -4
  113. package/src/system/Spinner/index.js +0 -1
  114. package/src/system/Table/Table.js +5 -5
  115. package/src/system/Table/Table.stories.jsx +39 -9
  116. package/src/system/Table/TableCell.js +48 -0
  117. package/src/system/Table/TableRow.js +10 -47
  118. package/src/system/Table/index.js +2 -2
  119. package/src/system/Tabs/Tabs.js +3 -3
  120. package/src/system/Tabs/index.js +0 -1
  121. package/src/system/Text/Text.js +3 -3
  122. package/src/system/Text/Text.stories.jsx +4 -6
  123. package/src/system/Text/index.js +0 -1
  124. package/src/system/Time/Time.stories.jsx +2 -6
  125. package/src/system/Time/index.js +5 -5
  126. package/src/system/Timeline/Timeline.js +6 -12
  127. package/src/system/Timeline/Timeline.stories.jsx +3 -12
  128. package/src/system/Timeline/index.js +0 -1
  129. package/src/system/Tooltip/Tooltip.js +4 -8
  130. package/src/system/Wizard/Wizard.js +23 -21
  131. package/src/system/Wizard/Wizard.stories.jsx +7 -12
  132. package/src/system/Wizard/WizardStep.js +8 -8
  133. package/src/system/Wizard/WizardStepHorizontal.js +4 -4
  134. package/src/system/Wizard/index.js +0 -1
  135. package/src/system/index.js +2 -1
  136. package/src/system/theme/index.js +3 -4
  137. package/tokens/valet-color.json +1919 -0
  138. package/build/system/Form/MultiSelect.js +0 -38
  139. package/build/system/UsageChart/UsageChart.js +0 -60
  140. package/build/system/UsageChart/UsageChart.stories.js +0 -20
  141. package/build/system/UsageChart/index.js +0 -7
@@ -39,32 +39,32 @@ export const Multi = () => {
39
39
  const [ value, setValue ] = useState( [] );
40
40
 
41
41
  return (
42
- <Box sx={{ mr: 2, width: 400 }}>
42
+ <Box sx={ { mr: 2, width: 400 } }>
43
43
  <Select
44
44
  label="Type"
45
- value={value}
45
+ value={ value }
46
46
  isMulti
47
47
  placeholder="Select domains..."
48
- options={options}
49
- onChange={newValue => setValue( newValue )}
48
+ options={ options }
49
+ onChange={ newValue => setValue( newValue ) }
50
50
  />
51
51
  </Box>
52
52
  );
53
53
  };
54
54
 
55
- export const usePortal = () => {
55
+ export const UsePortal = () => {
56
56
  const [ value, setValue ] = useState( [] );
57
57
 
58
58
  return (
59
- <Box sx={{ mr: 2, width: 400 }}>
59
+ <Box sx={ { mr: 2, width: 400 } }>
60
60
  <Select
61
61
  label="Type"
62
- value={value}
62
+ value={ value }
63
63
  isMulti
64
64
  placeholder="Select domains..."
65
65
  usePortal
66
- options={options}
67
- onChange={newValue => setValue( newValue )}
66
+ options={ options }
67
+ onChange={ newValue => setValue( newValue ) }
68
68
  />
69
69
  </Box>
70
70
  );
@@ -74,13 +74,13 @@ export const Single = () => {
74
74
  const [ value, setValue ] = useState( [] );
75
75
 
76
76
  return (
77
- <Box sx={{ mr: 2, width: 200 }}>
77
+ <Box sx={ { mr: 2, width: 200 } }>
78
78
  <Select
79
79
  label="User"
80
- value={value}
80
+ value={ value }
81
81
  placeholder="Select a domain..."
82
- options={options}
83
- onChange={newValue => setValue( newValue )}
82
+ options={ options }
83
+ onChange={ newValue => setValue( newValue ) }
84
84
  />
85
85
  </Box>
86
86
  );
@@ -90,16 +90,16 @@ export const Inline = () => {
90
90
  const [ value, setValue ] = useState( [] );
91
91
 
92
92
  return (
93
- <Box sx={{ mr: 2, width: 200 }}>
93
+ <Box sx={ { mr: 2, width: 200 } }>
94
94
  <Select
95
95
  label="User"
96
- value={value}
96
+ value={ value }
97
97
  isInline
98
98
  isMulti
99
99
  noneLabel="Everyone"
100
100
  placeholder="Filter by user..."
101
- options={options}
102
- onChange={newValue => setValue( newValue )}
101
+ options={ options }
102
+ onChange={ newValue => setValue( newValue ) }
103
103
  />
104
104
  </Box>
105
105
  );
@@ -107,29 +107,26 @@ export const Inline = () => {
107
107
 
108
108
  export const Async = () => {
109
109
  const [ value, setValue ] = useState( [] );
110
- const loadOptions = async () => new Promise( resolve => {
111
- setTimeout( () => {
112
- resolve( {
113
- options: [
114
- ...options,
115
- { value: 'newvanilla', label: 'New Vanilla' },
116
- ],
117
- } );
118
- }, 2000 );
119
- } );
110
+ const loadOptions = async () =>
111
+ new Promise( resolve => {
112
+ setTimeout( () => {
113
+ resolve( {
114
+ options: [ ...options, { value: 'newvanilla', label: 'New Vanilla' } ],
115
+ } );
116
+ }, 2000 );
117
+ } );
120
118
 
121
119
  return (
122
- <Box sx={{ mr: 2, width: 200 }}>
120
+ <Box sx={ { mr: 2, width: 200 } }>
123
121
  <Select
124
122
  label="Async Select"
125
- value={value}
123
+ value={ value }
126
124
  isAsync
127
- usePortal
128
125
  loadOptions={ loadOptions }
129
126
  noneLabel="Everyone"
130
127
  placeholder="Load async..."
131
- options={options}
132
- onChange={newValue => setValue( newValue )}
128
+ options={ options }
129
+ onChange={ newValue => setValue( newValue ) }
133
130
  />
134
131
  </Box>
135
132
  );
@@ -137,8 +134,8 @@ export const Async = () => {
137
134
 
138
135
  export const DropdownMenu = () => {
139
136
  return (
140
- <Box sx={{ mr: 2, width: 200 }}>
141
- <Dialog trigger={DropdownTrigger} content={DropdownContent} sx={{ width: 200 }} />
137
+ <Box sx={ { mr: 2, width: 200 } }>
138
+ <Dialog trigger={ DropdownTrigger } content={ DropdownContent } sx={ { width: 200 } } />
142
139
  </Box>
143
140
  );
144
141
  };
@@ -5,18 +5,13 @@ import { render, screen } from '@testing-library/react';
5
5
  import { axe } from 'jest-axe';
6
6
 
7
7
  /**
8
- * Internal dependencies
9
- */
8
+ * Internal dependencies
9
+ */
10
10
  import { Select } from './Select';
11
11
 
12
12
  describe( '<Select />', () => {
13
13
  it( 'renders the Select component with the specified placeholder', () => {
14
- render(
15
- <Select
16
- inputId={ 'search-select' }
17
- placeholder={ 'Search...' }
18
- />
19
- );
14
+ render( <Select inputId={ 'search-select' } placeholder={ 'Search...' } /> );
20
15
 
21
16
  // Can't use `getByPlaceholderText` here since it's not actually being rendered as a placeholder element
22
17
  const placeholder = screen.getByText( 'Search...' );
@@ -11,46 +11,44 @@ import PropTypes from 'prop-types';
11
11
  */
12
12
  import { Validation, Label } from '../';
13
13
 
14
- const Textarea = React.forwardRef( ( { variant, label, forLabel, hasError, required, errorMessage, ...props }, ref ) => (
15
- <React.Fragment>
16
- { label &&
17
- <Label htmlFor={ forLabel }>
18
- { label }
19
- { required &&
20
- '*'
21
- }
22
- </Label>
23
- }
24
- <textarea
25
- { ...props }
26
- ref={ ref }
27
- sx={ {
28
- border: '1px solid',
29
- borderColor: 'border',
30
- backgroundColor: 'card',
31
- borderRadius: 1,
32
- lineHeight: 'inherit',
33
- px: 3,
34
- py: 2,
35
- fontSize: 2,
36
- mb: 2,
37
- color: 'text',
38
- display: 'block',
39
- width: '100%',
40
- '&:focus': {
41
- borderColor: 'brand.60',
42
- outline: 'none',
43
- },
44
- '&:disabled': {
45
- backgroundColor: 'background',
46
- },
47
- } }
48
- />
49
- { hasError && errorMessage &&
50
- <Validation>{ errorMessage }</Validation>
51
- }
52
- </React.Fragment>
53
- ) );
14
+ const Textarea = React.forwardRef(
15
+ ( { variant, label, forLabel, hasError, required, errorMessage, ...props }, ref ) => (
16
+ <React.Fragment>
17
+ { label && (
18
+ <Label htmlFor={ forLabel }>
19
+ { label }
20
+ { required && '*' }
21
+ </Label>
22
+ ) }
23
+ <textarea
24
+ { ...props }
25
+ ref={ ref }
26
+ sx={ {
27
+ border: '1px solid',
28
+ borderColor: 'border',
29
+ backgroundColor: 'card',
30
+ borderRadius: 1,
31
+ lineHeight: 'inherit',
32
+ px: 3,
33
+ py: 2,
34
+ fontSize: 2,
35
+ mb: 2,
36
+ color: 'text',
37
+ display: 'block',
38
+ width: '100%',
39
+ '&:focus': {
40
+ borderColor: 'brand.60',
41
+ outline: 'none',
42
+ },
43
+ '&:disabled': {
44
+ backgroundColor: 'background',
45
+ },
46
+ } }
47
+ />
48
+ { hasError && errorMessage && <Validation>{ errorMessage }</Validation> }
49
+ </React.Fragment>
50
+ )
51
+ );
54
52
 
55
53
  Textarea.propTypes = {
56
54
  variant: PropTypes.string,
@@ -6,75 +6,47 @@
6
6
  import classNames from 'classnames';
7
7
  import PropTypes from 'prop-types';
8
8
 
9
- const Toggle = ( { name = 'toggle', className = null, ...props } ) => (
10
- <CheckBoxWrapper className={ classNames( 'vip-checkbox-component', className ) }>
11
- <CheckBox name={name} id={name} type="checkbox" {...props} />
12
- <CheckBoxLabel htmlFor={name} />
13
- </CheckBoxWrapper>
14
- );
15
-
16
- Toggle.propTypes = {
17
- name: PropTypes.string,
18
- className: PropTypes.any,
19
- };
9
+ import * as Switch from '@radix-ui/react-switch';
20
10
 
21
- export { Toggle };
22
-
23
- const CheckBoxWrapper = props => (
24
- <div sx={{ position: 'relative' }} {...props} />
25
- );
11
+ // Documentation for Radix Switch component
12
+ // https://www.radix-ui.com/docs/primitives/components/switch
26
13
 
27
- const CheckBoxLabel = props => (
28
- <label
29
- sx={{
30
- position: 'absolute',
31
- top: '0',
32
- left: '0',
33
- width: '42px',
34
- height: '24px',
35
- borderRadius: '15px',
14
+ export const Toggle = ( { name = 'toggle', onChange, className = null, ...rest } ) => (
15
+ <Switch.Root
16
+ className={ classNames( 'vip-toggle-component', className ) }
17
+ sx={ {
18
+ all: 'unset',
19
+ width: 42,
20
+ height: 24,
36
21
  backgroundColor: 'muted',
37
- cursor: 'pointer',
38
- '&::after': {
39
- content: "''",
22
+ borderRadius: '15px',
23
+ position: 'relative',
24
+ WebkitTapHighlightColor: 'rgba(0, 0, 0, 0)',
25
+ '&[data-state="checked"]': { backgroundColor: 'success' },
26
+ } }
27
+ name={ name }
28
+ onCheckedChange={ onChange || undefined }
29
+ { ...rest }
30
+ >
31
+ <Switch.Thumb
32
+ sx={ {
40
33
  display: 'block',
34
+ width: 18,
35
+ height: 18,
36
+ backgroundColor: 'white',
41
37
  borderRadius: '50%',
42
- width: '18px',
43
- height: '18px',
44
- margin: '3px',
45
- backgroundColor: 'card',
46
- boxShadow: 'low',
47
- transition: '0.2s',
48
- },
49
- }}
50
- {...props}
51
- />
38
+ boxShadow: 'rgb(0 0 0 / 5%) 0px 1px 5px, rgb(0 0 0 / 15%) 0px 1px 1px',
39
+ transition: 'transform 100ms',
40
+ transform: 'translateX(3px)',
41
+ willChange: 'transform',
42
+ '&[data-state="checked"]': { transform: 'translateX(21px)' },
43
+ } }
44
+ />
45
+ </Switch.Root>
52
46
  );
53
47
 
54
- const CheckBox = props => (
55
- <input
56
- sx={{
57
- opacity: '0',
58
- zIndex: '1',
59
- borderRadius: '15px',
60
- width: '42px',
61
- height: '24px',
62
- padding: 0,
63
- margin: 0,
64
- display: 'block',
65
- '&:checked + label': {
66
- backgroundColor: 'success',
67
- '&::after': {
68
- content: "''",
69
- display: 'block',
70
- borderRadius: '50%',
71
- width: '18px',
72
- height: '18px',
73
- marginLeft: '21px',
74
- transition: '0.2s',
75
- },
76
- },
77
- }}
78
- {...props}
79
- />
80
- );
48
+ Toggle.propTypes = {
49
+ name: PropTypes.string,
50
+ className: PropTypes.any,
51
+ onChange: PropTypes.func,
52
+ };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import { Toggle, Label } from '..';
9
+
10
+ export default {
11
+ title: 'Toggle',
12
+ component: Toggle,
13
+ argTypes: {
14
+ checked: {
15
+ options: [ true, false ],
16
+ default: true,
17
+ control: { type: 'radio' },
18
+ },
19
+ },
20
+ };
21
+
22
+ const Default = args => (
23
+ <form>
24
+ <Toggle defaultChecked checked={ args.checked } aria-label="Feature flag" />
25
+ </form>
26
+ );
27
+
28
+ const WithLabel = args => (
29
+ <form>
30
+ <Label htmlFor="custom-label-input">Custom Label here</Label>
31
+
32
+ <Toggle
33
+ id="custom-label-input"
34
+ defaultChecked
35
+ checked={ args.checked }
36
+ aria-label="Feature flag"
37
+ />
38
+ </form>
39
+ );
40
+
41
+ export const Primary = Default.bind( { checked: true } );
42
+ export const ExternalLabel = WithLabel.bind( { checked: true } );
@@ -0,0 +1,23 @@
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 { Toggle } from './Toggle';
11
+
12
+ describe( '<Toggle />', () => {
13
+ it( 'renders the Toggle component', async () => {
14
+ const { container } = render(
15
+ <Toggle aria-label="Dinner room Light" defaultChecked name="my-toggle" />
16
+ );
17
+
18
+ expect( screen.getByRole( 'switch' ) ).toBeInTheDocument();
19
+
20
+ // Check for accessibility issues
21
+ await expect( await axe( container ) ).toHaveNoViolations();
22
+ } );
23
+ } );
@@ -19,37 +19,35 @@ const ToggleGroup = ( { onChange, groupLabel, value, options, ...props } ) => (
19
19
  } }
20
20
  { ...props }
21
21
  >
22
- {
23
- options.map( ( option, index ) => (
24
- <RadioGroupPrimitive.Item
25
- key={ option.value }
26
- value={ option.value }
27
- id={ `o${ index }` }
28
- sx={ {
29
- fontSize: 1,
30
- color: 'muted',
31
- background: 'none',
32
- border: 'none',
33
- cursor: 'pointer',
34
- borderRadius: 1,
35
- py: 1,
36
- px: 2,
37
- flex: '1 1 auto',
38
- textAlign: 'center',
39
- '&:hover': {
40
- color: 'heading',
41
- },
42
- '&[data-state=checked]': {
43
- backgroundColor: 'card',
44
- boxShadow: 'low',
45
- color: 'heading',
46
- },
47
- } }
48
- >
49
- { option.label }
50
- </RadioGroupPrimitive.Item>
51
- ) )
52
- }
22
+ { options.map( ( option, index ) => (
23
+ <RadioGroupPrimitive.Item
24
+ key={ option.value }
25
+ value={ option.value }
26
+ id={ `o${ index }` }
27
+ sx={ {
28
+ fontSize: 1,
29
+ color: 'muted',
30
+ background: 'none',
31
+ border: 'none',
32
+ cursor: 'pointer',
33
+ borderRadius: 1,
34
+ py: 1,
35
+ px: 2,
36
+ flex: '1 1 auto',
37
+ textAlign: 'center',
38
+ '&:hover': {
39
+ color: 'heading',
40
+ },
41
+ '&[data-state=checked]': {
42
+ backgroundColor: 'card',
43
+ boxShadow: 'low',
44
+ color: 'heading',
45
+ },
46
+ } }
47
+ >
48
+ { option.label }
49
+ </RadioGroupPrimitive.Item>
50
+ ) ) }
53
51
  </RadioGroupPrimitive.Root>
54
52
  );
55
53
 
@@ -30,5 +30,12 @@ const options = [
30
30
 
31
31
  export const Default = () => {
32
32
  const [ value, setValue ] = useState( 'one' );
33
- return <ToggleGroup value={ value } onChange={ newValue => setValue( newValue ) } groupLabel="group" options={ options } />;
33
+ return (
34
+ <ToggleGroup
35
+ value={ value }
36
+ onChange={ newValue => setValue( newValue ) }
37
+ groupLabel="group"
38
+ options={ options }
39
+ />
40
+ );
34
41
  };
@@ -36,7 +36,12 @@ 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' } } alt="Icon representing a toggle" />
39
+ <img
40
+ src={ image }
41
+ width={ 32 }
42
+ sx={ { display: 'block' } }
43
+ alt="Icon representing a toggle"
44
+ />
40
45
  </Card>
41
46
  </Box>
42
47
  ) }
@@ -15,7 +15,12 @@ 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 ? 'success' : 'error', display: 'flex', alignItems: 'center' } } { ...props }>
18
+ <Heading
19
+ variant="h5"
20
+ as="p"
21
+ sx={ { color: isValid ? 'success' : 'error', display: 'flex', alignItems: 'center' } }
22
+ { ...props }
23
+ >
19
24
  <Icon sx={ { mr: 1 } } />
20
25
  { children }
21
26
  </Heading>
@@ -13,4 +13,16 @@ import { RadioBoxGroup } from './RadioBoxGroup';
13
13
  import { Textarea } from './Textarea';
14
14
  import { Checkbox } from './Checkbox';
15
15
 
16
- export { Input, Label, Radio, RadioBoxGroup, ToggleGroup, Select, Textarea, Toggle, ToggleRow, Validation, Checkbox };
16
+ export {
17
+ Input,
18
+ Label,
19
+ Radio,
20
+ RadioBoxGroup,
21
+ ToggleGroup,
22
+ Select,
23
+ Textarea,
24
+ Toggle,
25
+ ToggleRow,
26
+ Validation,
27
+ Checkbox,
28
+ };
@@ -8,7 +8,7 @@ import { Grid as ThemeGrid } from 'theme-ui';
8
8
  import { forwardRef } from 'react';
9
9
 
10
10
  const Grid = forwardRef( ( props, ref ) => {
11
- return <ThemeGrid {...props} ref={ref} />;
11
+ return <ThemeGrid { ...props } ref={ ref } />;
12
12
  } );
13
13
 
14
14
  Grid.displayName = 'Grid';
@@ -1,4 +1,3 @@
1
-
2
1
  /**
3
2
  * Internal dependencies
4
3
  */
@@ -9,15 +9,15 @@ import classNames from 'classnames';
9
9
 
10
10
  const Heading = ( { variant = 'h3', sx, className = null, ...props } ) => (
11
11
  <ThemeHeading
12
- as={variant}
13
- sx={{
12
+ as={ variant }
13
+ sx={ {
14
14
  color: 'heading',
15
15
  // pass variant prop to sx
16
16
  variant: `text.${ variant }`,
17
17
  ...sx,
18
- }}
18
+ } }
19
19
  className={ classNames( 'vip-heading-component', className ) }
20
- {...props}
20
+ { ...props }
21
21
  />
22
22
  );
23
23
 
@@ -1,4 +1,3 @@
1
-
2
1
  /**
3
2
  * Internal dependencies
4
3
  */
@@ -1,4 +1,3 @@
1
-
2
1
  /**
3
2
  * Internal dependencies
4
3
  */
@@ -8,8 +8,8 @@ import PropTypes from 'prop-types';
8
8
  import { MdError, MdWarning, MdCheckCircle, MdInfo } from 'react-icons/md';
9
9
 
10
10
  /**
11
- * Internal dependencies
12
- */
11
+ * Internal dependencies
12
+ */
13
13
  import { Box, Flex, Heading, Card } from '../';
14
14
 
15
15
  const NoticeIcon = ( { color, variant } ) => {
@@ -27,9 +27,7 @@ const NoticeIcon = ( { color, variant } ) => {
27
27
  break;
28
28
  }
29
29
 
30
- return (
31
- <Icon sx={ { marginRight: 2, color, flex: '0 0 auto' } }/>
32
- );
30
+ return <Icon sx={ { marginRight: 2, color, flex: '0 0 auto' } } />;
33
31
  };
34
32
 
35
33
  NoticeIcon.propTypes = {
@@ -37,7 +35,15 @@ NoticeIcon.propTypes = {
37
35
  variant: PropTypes.string,
38
36
  };
39
37
 
40
- const Notice = ( { variant = 'warning', inline = false, children, title, sx = {}, className = null, ...props } ) => {
38
+ const Notice = ( {
39
+ variant = 'warning',
40
+ inline = false,
41
+ children,
42
+ title,
43
+ sx = {},
44
+ className = null,
45
+ ...props
46
+ } ) => {
41
47
  let color = 'yellow';
42
48
 
43
49
  switch ( variant ) {
@@ -70,17 +76,25 @@ const Notice = ( { variant = 'warning', inline = false, children, title, sx = {}
70
76
  className={ classNames( 'vip-notice-component', className ) }
71
77
  { ...props }
72
78
  >
73
- <Flex sx={ {
74
- alignItems: 'center',
75
- } }>
76
- <Flex sx={ {
79
+ <Flex
80
+ sx={ {
77
81
  alignItems: 'center',
78
- } }>
79
- <NoticeIcon color={`${ color }.100`} variant={ variant } />
82
+ } }
83
+ >
84
+ <Flex
85
+ sx={ {
86
+ alignItems: 'center',
87
+ } }
88
+ >
89
+ <NoticeIcon color={ `${ color }.100` } variant={ variant } />
80
90
  </Flex>
81
91
 
82
92
  <Box sx={ { ml: 23 } }>
83
- { title && <Heading variant="h4" as="p" sx={ { color: `${ color }.100`, mb: 0 } }>{ title }</Heading> }
93
+ { title && (
94
+ <Heading variant="h4" as="p" sx={ { color: `${ color }.100`, mb: 0 } }>
95
+ { title }
96
+ </Heading>
97
+ ) }
84
98
  { children }
85
99
  </Box>
86
100
  </Flex>