@automattic/vip-design-system 0.10.2 → 0.11.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 (134) 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 +1 -1
  7. package/.storybook/preview.js +4 -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/Notification/Notification.js +24 -15
  19. package/build/system/Notification/Notification.stories.js +14 -4
  20. package/build/system/OptionRow/OptionRow.js +23 -17
  21. package/build/system/OptionRow/OptionRow.stories.js +5 -5
  22. package/build/system/OptionRow/OptionRow.test.js +4 -4
  23. package/build/system/ResourceList/ResourceList.js +34 -25
  24. package/build/system/ResourceList/ResourceList.stories.js +2 -0
  25. package/build/system/ScreenReaderText/ScreenReader.test.js +37 -0
  26. package/build/system/ScreenReaderText/ScreenReaderText.js +49 -0
  27. package/build/system/ScreenReaderText/index.js +7 -0
  28. package/build/system/Table/Table.js +15 -15
  29. package/build/system/Table/Table.stories.js +46 -3
  30. package/build/system/Table/TableCell.js +57 -0
  31. package/build/system/Table/TableRow.js +12 -57
  32. package/build/system/Table/index.js +5 -1
  33. package/build/system/Time/index.js +1 -1
  34. package/build/system/Wizard/Wizard.stories.js +1 -1
  35. package/build/system/index.js +1 -0
  36. package/package.json +8 -4
  37. package/src/system/Avatar/Avatar.js +1 -0
  38. package/src/system/Avatar/index.js +0 -1
  39. package/src/system/Badge/index.js +0 -1
  40. package/src/system/BlankState/BlankState.js +8 -5
  41. package/src/system/BlankState/BlankState.stories.jsx +5 -4
  42. package/src/system/BlankState/BlankState.test.js +21 -21
  43. package/src/system/BlankState/index.js +0 -1
  44. package/src/system/Box/Box.js +7 -1
  45. package/src/system/Box/index.js +0 -1
  46. package/src/system/Button/Button.js +3 -3
  47. package/src/system/Button/Button.stories.jsx +2 -2
  48. package/src/system/Button/index.js +0 -1
  49. package/src/system/Card/Card.js +4 -4
  50. package/src/system/Card/Card.test.js +1 -2
  51. package/src/system/Card/index.js +0 -1
  52. package/src/system/Code/Code.js +6 -2
  53. package/src/system/Code/Code.stories.jsx +10 -5
  54. package/src/system/Code/Code.test.js +3 -16
  55. package/src/system/ConfirmationDialog/ConfirmationDialog.js +8 -1
  56. package/src/system/Dialog/Dialog.js +17 -8
  57. package/src/system/Dialog/Dialog.stories.jsx +9 -13
  58. package/src/system/Dialog/DialogButton.js +18 -14
  59. package/src/system/Dialog/DialogDivider.js +1 -1
  60. package/src/system/Dialog/DialogMenu.js +1 -5
  61. package/src/system/Dialog/DialogMenuItem.js +4 -8
  62. package/src/system/Dialog/DialogTrigger.js +1 -1
  63. package/src/system/Dialog/index.js +0 -1
  64. package/src/system/Flex/Flex.js +1 -1
  65. package/src/system/Flex/index.js +0 -1
  66. package/src/system/Form/AsyncSearchSelect.js +3 -7
  67. package/src/system/Form/Checkbox.js +32 -28
  68. package/src/system/Form/InlineSelect.js +21 -17
  69. package/src/system/Form/Input.js +43 -45
  70. package/src/system/Form/Label.js +2 -2
  71. package/src/system/Form/RadioBoxGroup.js +34 -32
  72. package/src/system/Form/RadioBoxGroup.stories.jsx +8 -1
  73. package/src/system/Form/SearchSelect.js +7 -7
  74. package/src/system/Form/Select.js +21 -2
  75. package/src/system/Form/Select.stories.jsx +31 -34
  76. package/src/system/Form/Select.test.js +3 -8
  77. package/src/system/Form/Textarea.js +38 -40
  78. package/src/system/Form/Toggle.js +9 -11
  79. package/src/system/Form/ToggleGroup.js +29 -31
  80. package/src/system/Form/ToggleGroup.stories.jsx +8 -1
  81. package/src/system/Form/ToggleRow.js +6 -1
  82. package/src/system/Form/Validation.js +6 -1
  83. package/src/system/Form/index.js +13 -1
  84. package/src/system/Grid/Grid.js +1 -1
  85. package/src/system/Grid/index.js +0 -1
  86. package/src/system/Heading/Heading.js +4 -4
  87. package/src/system/Heading/index.js +0 -1
  88. package/src/system/Link/index.js +0 -1
  89. package/src/system/Notice/Notice.js +27 -13
  90. package/src/system/Notice/Notice.stories.jsx +6 -8
  91. package/src/system/Notice/index.js +0 -1
  92. package/src/system/Notification/Notification.js +25 -20
  93. package/src/system/Notification/Notification.stories.jsx +4 -4
  94. package/src/system/Notification/index.js +0 -1
  95. package/src/system/OptionRow/OptionRow.js +46 -44
  96. package/src/system/OptionRow/OptionRow.stories.jsx +10 -8
  97. package/src/system/OptionRow/OptionRow.test.js +12 -11
  98. package/src/system/OptionRow/index.js +0 -1
  99. package/src/system/Progress/Progress.js +3 -1
  100. package/src/system/Progress/Progress.stories.jsx +4 -4
  101. package/src/system/Progress/index.js +0 -1
  102. package/src/system/ResourceList/ResourceItem.js +15 -15
  103. package/src/system/ResourceList/ResourceList.js +28 -16
  104. package/src/system/ResourceList/ResourceList.stories.jsx +77 -71
  105. package/src/system/ScreenReaderText/ScreenReader.test.js +22 -0
  106. package/src/system/ScreenReaderText/ScreenReaderText.js +40 -0
  107. package/src/system/ScreenReaderText/index.js +7 -0
  108. package/src/system/Spinner/Spinner.js +4 -4
  109. package/src/system/Spinner/index.js +0 -1
  110. package/src/system/Table/Table.js +10 -9
  111. package/src/system/Table/Table.stories.jsx +39 -9
  112. package/src/system/Table/TableCell.js +48 -0
  113. package/src/system/Table/TableRow.js +10 -47
  114. package/src/system/Table/index.js +2 -2
  115. package/src/system/Tabs/Tabs.js +3 -3
  116. package/src/system/Tabs/index.js +0 -1
  117. package/src/system/Text/Text.js +3 -3
  118. package/src/system/Text/Text.stories.jsx +4 -6
  119. package/src/system/Text/index.js +0 -1
  120. package/src/system/Time/Time.stories.jsx +2 -6
  121. package/src/system/Time/index.js +5 -5
  122. package/src/system/Timeline/Timeline.js +6 -12
  123. package/src/system/Timeline/Timeline.stories.jsx +3 -12
  124. package/src/system/Timeline/index.js +0 -1
  125. package/src/system/Tooltip/Tooltip.js +4 -8
  126. package/src/system/Wizard/Wizard.js +23 -21
  127. package/src/system/Wizard/Wizard.stories.jsx +7 -12
  128. package/src/system/Wizard/WizardStep.js +8 -8
  129. package/src/system/Wizard/WizardStepHorizontal.js +4 -4
  130. package/src/system/Wizard/index.js +0 -1
  131. package/src/system/index.js +2 -1
  132. package/src/system/theme/index.js +3 -4
  133. package/tokens/valet-color.json +1919 -0
  134. package/build/system/UsageChart/UsageChart.stories.js +0 -20
@@ -32,7 +32,14 @@ const selectStyles = {
32
32
  menu: () => ( { boxShadow: 'none', borderTop: '1px solid' } ),
33
33
  };
34
34
 
35
- const InlineSelect = ( { label, value, options, noneLabel = 'All', position = 'left', ...props } ) => {
35
+ const InlineSelect = ( {
36
+ label,
37
+ value,
38
+ options,
39
+ noneLabel = 'All',
40
+ position = 'left',
41
+ ...props
42
+ } ) => {
36
43
  let valueLabel = noneLabel;
37
44
 
38
45
  if ( Array.isArray( value ) && value.length ) {
@@ -49,18 +56,18 @@ const InlineSelect = ( { label, value, options, noneLabel = 'All', position = 'l
49
56
  <Box>
50
57
  <Select
51
58
  autoFocus
52
- backspaceRemovesValue={false}
53
- components={{ Option, DropdownIndicator: null, IndicatorSeparator: null }}
54
- controlShouldRenderValue={false}
55
- hideSelectedOptions={false}
56
- isClearable={false}
59
+ backspaceRemovesValue={ false }
60
+ components={ { Option, DropdownIndicator: null, IndicatorSeparator: null } }
61
+ controlShouldRenderValue={ false }
62
+ hideSelectedOptions={ false }
63
+ isClearable={ false }
57
64
  menuIsOpen
58
- styles={selectStyles}
65
+ styles={ selectStyles }
59
66
  classNamePrefix={ 'select' }
60
- options={options}
67
+ options={ options }
61
68
  placeholder="Search..."
62
- tabSelectsValue={false}
63
- value={value}
69
+ tabSelectsValue={ false }
70
+ value={ value }
64
71
  sx={ {
65
72
  '.select__control': {
66
73
  background: 'none',
@@ -83,16 +90,16 @@ const InlineSelect = ( { label, value, options, noneLabel = 'All', position = 'l
83
90
  borderColor: 'border',
84
91
  },
85
92
  } }
86
- {...props}
93
+ { ...props }
87
94
  />
88
95
  </Box>
89
96
  );
90
97
 
91
98
  return (
92
99
  <Dialog
93
- content={Content}
100
+ content={ Content }
94
101
  position={ position }
95
- trigger={<DialogButton sx={{ width: '100%' }} label={label} value={valueLabel} />}
102
+ trigger={ <DialogButton sx={ { width: '100%' } } label={ label } value={ valueLabel } /> }
96
103
  />
97
104
  );
98
105
  };
@@ -100,10 +107,7 @@ const InlineSelect = ( { label, value, options, noneLabel = 'All', position = 'l
100
107
  InlineSelect.propTypes = {
101
108
  label: PropTypes.string,
102
109
  // https://react-select.com/props
103
- value: PropTypes.oneOfType( [
104
- PropTypes.array,
105
- PropTypes.object,
106
- ] ),
110
+ value: PropTypes.oneOfType( [ PropTypes.array, PropTypes.object ] ),
107
111
  options: PropTypes.array,
108
112
  position: PropTypes.string,
109
113
  noneLabel: PropTypes.string,
@@ -11,51 +11,49 @@ import PropTypes from 'prop-types';
11
11
  */
12
12
  import { Validation, Label } from '../';
13
13
 
14
- const Input = 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
- <input
25
- { ...props }
26
- ref={ ref }
27
- id={ forLabel }
28
- required={ required }
29
- sx={ {
30
- border: '1px solid',
31
- borderColor: 'border',
32
- backgroundColor: 'card',
33
- borderRadius: 1,
34
- lineHeight: 'inherit',
35
- px: 3,
36
- py: 2,
37
- fontSize: 2,
38
- mb: 2,
39
- color: 'text',
40
- display: 'block',
41
- width: '100%',
42
- '&:focus': {
43
- borderColor: 'brand.60',
44
- outline: 'none',
45
- },
46
- '&:disabled': {
47
- bg: 'backgroundSecondary',
48
- },
49
- '&::placeholder': {
50
- color: 'placeholder',
51
- },
52
- } }
53
- />
54
- { hasError && errorMessage &&
55
- <Validation>{ errorMessage }</Validation>
56
- }
57
- </React.Fragment>
58
- ) );
14
+ const Input = 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
+ <input
24
+ { ...props }
25
+ ref={ ref }
26
+ id={ forLabel }
27
+ required={ required }
28
+ sx={ {
29
+ border: '1px solid',
30
+ borderColor: 'border',
31
+ backgroundColor: 'card',
32
+ borderRadius: 1,
33
+ lineHeight: 'inherit',
34
+ px: 3,
35
+ py: 2,
36
+ fontSize: 2,
37
+ mb: 2,
38
+ color: 'text',
39
+ display: 'block',
40
+ width: '100%',
41
+ '&:focus': {
42
+ borderColor: 'brand.60',
43
+ outline: 'none',
44
+ },
45
+ '&:disabled': {
46
+ bg: 'backgroundSecondary',
47
+ },
48
+ '&::placeholder': {
49
+ color: 'placeholder',
50
+ },
51
+ } }
52
+ />
53
+ { hasError && errorMessage && <Validation>{ errorMessage }</Validation> }
54
+ </React.Fragment>
55
+ )
56
+ );
59
57
 
60
58
  Input.propTypes = {
61
59
  variant: PropTypes.string,
@@ -9,8 +9,8 @@ const Label = props => (
9
9
  <Heading
10
10
  variant="h4"
11
11
  as="label"
12
- sx={{ display: 'block', mb: 2, color: 'muted' }}
13
- {...props}
12
+ sx={ { display: 'block', mb: 2, color: 'muted' } }
13
+ { ...props }
14
14
  />
15
15
  );
16
16
 
@@ -20,41 +20,43 @@ const RadioBoxGroup = ( { onChange, groupLabel, value, options, ...props } ) =>
20
20
  sx={ {
21
21
  display: 'flex',
22
22
  gap: 2,
23
-
24
23
  } }
25
24
  { ...props }
26
25
  >
27
- {
28
- options.map( ( option, index ) => (
29
- <RadioGroupPrimitive.Item
30
- key={ option.value }
31
- value={ option.value }
32
- id={ `o${ index }` }
33
- sx={ {
34
- p: 3,
35
- background: 'none',
36
- cursor: 'pointer',
37
- borderRadius: 2,
38
- textAlign: 'left',
39
- border: '1px solid',
40
- borderColor: 'border',
41
- position: 'relative',
42
- '&:hover': {
43
- borderColor: 'grey.10',
44
- },
45
- '&[data-state=checked]': {
46
- borderColor: 'primary',
47
- },
48
- } }
49
- >
50
- <RadioGroupPrimitive.Indicator>
51
- <MdCheckCircle size={ 16 } sx={ { position: 'absolute', top: 2, right: 2, color: 'primary' } } />
52
- </RadioGroupPrimitive.Indicator>
53
- <Heading variant="h4" as="label" htmlFor={ `o${ index }` } sx={ { mb: 0 } }>{ option.label }</Heading>
54
- <Text sx={ { color: 'muted', mb: 0, fontSize: 1 } }>{ option.description }</Text>
55
- </RadioGroupPrimitive.Item>
56
- ) )
57
- }
26
+ { options.map( ( option, index ) => (
27
+ <RadioGroupPrimitive.Item
28
+ key={ option.value }
29
+ value={ option.value }
30
+ id={ `o${ index }` }
31
+ sx={ {
32
+ p: 3,
33
+ background: 'none',
34
+ cursor: 'pointer',
35
+ borderRadius: 2,
36
+ textAlign: 'left',
37
+ border: '1px solid',
38
+ borderColor: 'border',
39
+ position: 'relative',
40
+ '&:hover': {
41
+ borderColor: 'grey.10',
42
+ },
43
+ '&[data-state=checked]': {
44
+ borderColor: 'primary',
45
+ },
46
+ } }
47
+ >
48
+ <RadioGroupPrimitive.Indicator>
49
+ <MdCheckCircle
50
+ size={ 16 }
51
+ sx={ { position: 'absolute', top: 2, right: 2, color: 'primary' } }
52
+ />
53
+ </RadioGroupPrimitive.Indicator>
54
+ <Heading variant="h4" as="label" htmlFor={ `o${ index }` } sx={ { mb: 0 } }>
55
+ { option.label }
56
+ </Heading>
57
+ <Text sx={ { color: 'muted', mb: 0, fontSize: 1 } }>{ option.description }</Text>
58
+ </RadioGroupPrimitive.Item>
59
+ ) ) }
58
60
  </RadioGroupPrimitive.Root>
59
61
  );
60
62
 
@@ -33,5 +33,12 @@ const options = [
33
33
 
34
34
  export const Default = () => {
35
35
  const [ value, setValue ] = useState( 'one' );
36
- return <RadioBoxGroup value={ value } onChange={ newValue => setValue( newValue ) } groupLabel="group" options={ options } />;
36
+ return (
37
+ <RadioBoxGroup
38
+ value={ value }
39
+ onChange={ newValue => setValue( newValue ) }
40
+ groupLabel="group"
41
+ options={ options }
42
+ />
43
+ );
37
44
  };
@@ -14,14 +14,14 @@ import { Flex, Text } from '..';
14
14
 
15
15
  // Option component
16
16
  export const Option = ( { label, isSelected, ...props } ) => (
17
- <components.Option {...props}>
18
- <Flex sx={{ alignItems: 'center' }}>
19
- {isSelected && (
20
- <Text as="span" sx={{ mb: 0, mr: 2, color: 'green.80', svg: { display: 'block' } }}>
17
+ <components.Option { ...props }>
18
+ <Flex sx={ { alignItems: 'center' } }>
19
+ { isSelected && (
20
+ <Text as="span" sx={ { mb: 0, mr: 2, color: 'green.80', svg: { display: 'block' } } }>
21
21
  <MdDone />
22
22
  </Text>
23
- )}
24
- <Text as="span" sx={{ mb: 0, flex: '1 1 auto', color: 'heading' }}>
23
+ ) }
24
+ <Text as="span" sx={ { mb: 0, flex: '1 1 auto', color: 'heading' } }>
25
25
  { label }
26
26
  </Text>
27
27
  </Flex>
@@ -73,7 +73,7 @@ DropdownIndicator.propTypes = {
73
73
 
74
74
  // ClearIndicator component
75
75
  const ClearIndicator = ( { innerProps: { ref, ...restInnerProps }, ...props } ) => (
76
- <MdClose ref={ref} {...restInnerProps} {...props} sx={{ color: 'text', mr: 2 }} />
76
+ <MdClose ref={ ref } { ...restInnerProps } { ...props } sx={ { color: 'text', mr: 2 } } />
77
77
  );
78
78
 
79
79
  ClearIndicator.propTypes = {
@@ -13,7 +13,16 @@ import { SearchSelect } from './SearchSelect';
13
13
  import { InlineSelect } from './InlineSelect';
14
14
  import { AsyncSearchSelect } from './AsyncSearchSelect';
15
15
 
16
- const Select = ( { isMulti = false, isInline, isAsync, options, label, isSearch, usePortal, ...props } ) => {
16
+ const Select = ( {
17
+ isMulti = false,
18
+ isInline,
19
+ isAsync,
20
+ options,
21
+ label,
22
+ isSearch,
23
+ usePortal,
24
+ ...props
25
+ } ) => {
17
26
  let Component;
18
27
  const selectRef = React.useRef();
19
28
  const portalProps = {};
@@ -36,7 +45,17 @@ const Select = ( { isMulti = false, isInline, isAsync, options, label, isSearch,
36
45
  break;
37
46
  }
38
47
 
39
- return <div ref={selectRef} className="vip-select-component"><Component isMulti={isMulti} label={label} options={options} {...portalProps} {...props} /></div>;
48
+ return (
49
+ <div ref={ selectRef } className="vip-select-component">
50
+ <Component
51
+ isMulti={ isMulti }
52
+ label={ label }
53
+ options={ options }
54
+ { ...portalProps }
55
+ { ...props }
56
+ />
57
+ </div>
58
+ );
40
59
  };
41
60
 
42
61
  Select.propTypes = {
@@ -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,
@@ -8,8 +8,8 @@ import PropTypes from 'prop-types';
8
8
 
9
9
  const Toggle = ( { name = 'toggle', className = null, ...props } ) => (
10
10
  <CheckBoxWrapper className={ classNames( 'vip-checkbox-component', className ) }>
11
- <CheckBox name={name} id={name} type="checkbox" {...props} />
12
- <CheckBoxLabel htmlFor={name} />
11
+ <CheckBox name={ name } id={ name } type="checkbox" { ...props } />
12
+ <CheckBoxLabel htmlFor={ name } />
13
13
  </CheckBoxWrapper>
14
14
  );
15
15
 
@@ -20,13 +20,11 @@ Toggle.propTypes = {
20
20
 
21
21
  export { Toggle };
22
22
 
23
- const CheckBoxWrapper = props => (
24
- <div sx={{ position: 'relative' }} {...props} />
25
- );
23
+ const CheckBoxWrapper = props => <div sx={ { position: 'relative' } } { ...props } />;
26
24
 
27
25
  const CheckBoxLabel = props => (
28
26
  <label
29
- sx={{
27
+ sx={ {
30
28
  position: 'absolute',
31
29
  top: '0',
32
30
  left: '0',
@@ -46,14 +44,14 @@ const CheckBoxLabel = props => (
46
44
  boxShadow: 'low',
47
45
  transition: '0.2s',
48
46
  },
49
- }}
50
- {...props}
47
+ } }
48
+ { ...props }
51
49
  />
52
50
  );
53
51
 
54
52
  const CheckBox = props => (
55
53
  <input
56
- sx={{
54
+ sx={ {
57
55
  opacity: '0',
58
56
  zIndex: '1',
59
57
  borderRadius: '15px',
@@ -74,7 +72,7 @@ const CheckBox = props => (
74
72
  transition: '0.2s',
75
73
  },
76
74
  },
77
- }}
78
- {...props}
75
+ } }
76
+ { ...props }
79
77
  />
80
78
  );