@automattic/vip-design-system 0.7.0 → 0.9.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 (121) 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 +6 -2
  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 +8 -5
  17. package/build/system/Code/Code.js +4 -4
  18. package/build/system/ConfirmationDialog/ConfirmationDialog.js +2 -2
  19. package/build/system/Dialog/Dialog.js +3 -0
  20. package/build/system/Dialog/DialogButton.js +2 -4
  21. package/build/system/Dialog/DialogContent.js +5 -5
  22. package/build/system/Form/Checkbox.js +52 -5
  23. package/build/system/Form/InlineSelect.js +32 -16
  24. package/build/system/Form/Input.js +9 -6
  25. package/build/system/Form/Label.js +2 -2
  26. package/build/system/Form/RadioBoxGroup.js +101 -0
  27. package/build/system/Form/SearchSelect.js +36 -56
  28. package/build/system/Form/Select.js +3 -3
  29. package/build/system/Form/Textarea.js +9 -6
  30. package/build/system/Form/Toggle.js +1 -1
  31. package/build/system/Form/ToggleGroup.js +78 -0
  32. package/build/system/Form/ToggleRow.js +6 -5
  33. package/build/system/Form/Validation.js +4 -4
  34. package/build/system/Form/index.js +8 -0
  35. package/build/system/Notice/Notice.js +58 -54
  36. package/build/system/Notification/Notification.js +4 -4
  37. package/build/system/OptionRow/OptionRow.js +12 -11
  38. package/build/system/ResourceList/ResourceItem.js +89 -0
  39. package/build/system/ResourceList/ResourceList.js +121 -0
  40. package/build/system/ResourceList/index.js +11 -0
  41. package/build/system/Table/TableRow.js +2 -2
  42. package/build/system/Tabs/TabItem.js +3 -3
  43. package/build/system/Tabs/Tabs.js +1 -1
  44. package/build/system/Time/index.js +91 -0
  45. package/build/system/Tooltip/Tooltip.js +49 -47
  46. package/build/system/Wizard/WizardStep.js +5 -5
  47. package/build/system/Wizard/WizardStepHorizontal.js +2 -2
  48. package/build/system/index.js +9 -2
  49. package/build/system/theme/colors.js +235 -131
  50. package/build/system/theme/index.js +140 -107
  51. package/package.json +48 -11
  52. package/src/system/Avatar/Avatar.js +6 -2
  53. package/src/system/Avatar/Avatar.stories.js +0 -5
  54. package/src/system/Avatar/Avatar.test.js +31 -0
  55. package/src/system/Badge/Badge.js +3 -3
  56. package/src/system/Badge/Badge.stories.js +0 -5
  57. package/src/system/BlankState/BlankState.js +5 -5
  58. package/src/system/BlankState/BlankState.stories.js +0 -5
  59. package/src/system/Box/Box.stories.js +0 -5
  60. package/src/system/Button/Button.js +6 -2
  61. package/src/system/Card/Card.js +6 -4
  62. package/src/system/Card/Card.stories.js +0 -5
  63. package/src/system/Code/Code.js +4 -4
  64. package/src/system/Code/Code.stories.js +4 -1
  65. package/src/system/ConfirmationDialog/ConfirmationDialog.js +2 -2
  66. package/src/system/ConfirmationDialog/ConfirmationDialog.stories.js +0 -5
  67. package/src/system/Dialog/Dialog.js +1 -1
  68. package/src/system/Dialog/Dialog.stories.js +0 -5
  69. package/src/system/Dialog/DialogButton.js +2 -3
  70. package/src/system/Dialog/DialogContent.js +17 -4
  71. package/src/system/Flex/Flex.stories.js +0 -5
  72. package/src/system/Form/Checkbox.js +44 -2
  73. package/src/system/Form/InlineSelect.js +30 -15
  74. package/src/system/Form/Input.js +6 -4
  75. package/src/system/Form/Input.stories.js +0 -5
  76. package/src/system/Form/Label.js +2 -2
  77. package/src/system/Form/RadioBoxGroup.js +68 -0
  78. package/src/system/Form/RadioBoxGroup.stories.js +37 -0
  79. package/src/system/Form/SearchSelect.js +35 -42
  80. package/src/system/Form/Select.js +18 -18
  81. package/src/system/Form/Select.stories.js +1 -1
  82. package/src/system/Form/Textarea.js +6 -4
  83. package/src/system/Form/Toggle.js +1 -1
  84. package/src/system/Form/ToggleGroup.js +63 -0
  85. package/src/system/Form/ToggleGroup.stories.js +34 -0
  86. package/src/system/Form/ToggleRow.js +5 -5
  87. package/src/system/Form/Validation.js +2 -2
  88. package/src/system/Form/index.js +3 -1
  89. package/src/system/Grid/Grid.stories.js +0 -5
  90. package/src/system/Heading/Heading.stories.js +0 -5
  91. package/src/system/Link/Link.stories.js +0 -5
  92. package/src/system/Notice/Notice.js +33 -28
  93. package/src/system/Notification/Notification.js +6 -6
  94. package/src/system/Notification/Notification.stories.js +0 -5
  95. package/src/system/OptionRow/OptionRow.js +37 -32
  96. package/src/system/OptionRow/OptionRow.stories.js +0 -5
  97. package/src/system/Progress/Progress.stories.js +0 -5
  98. package/src/system/ResourceList/ResourceItem.js +66 -0
  99. package/src/system/ResourceList/ResourceList.js +96 -0
  100. package/src/system/ResourceList/ResourceList.stories.js +300 -0
  101. package/src/system/ResourceList/index.js +7 -0
  102. package/src/system/Spinner/Spinner.stories.js +0 -5
  103. package/src/system/Table/Table.stories.js +0 -5
  104. package/src/system/Table/TableRow.js +3 -3
  105. package/src/system/Tabs/TabItem.js +3 -3
  106. package/src/system/Tabs/Tabs.js +1 -1
  107. package/src/system/Tabs/Tabs.stories.js +0 -5
  108. package/src/system/Text/Text.stories.js +0 -5
  109. package/src/system/{Timeline/Timeline.stories.js → Time/Time.stories.js} +5 -5
  110. package/src/system/Time/index.js +62 -0
  111. package/src/system/Tooltip/Tooltip.js +40 -35
  112. package/src/system/Tooltip/Tooltip.stories.js +0 -5
  113. package/src/system/Wizard/Wizard.js +7 -7
  114. package/src/system/Wizard/WizardStep.js +10 -10
  115. package/src/system/Wizard/WizardStepHorizontal.js +3 -3
  116. package/src/system/index.js +29 -4
  117. package/src/system/theme/colors.js +233 -129
  118. package/src/system/theme/index.js +298 -256
  119. package/test/setupAfterEnv.js +13 -0
  120. package/test/setupTests.js +4 -0
  121. 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,8 +35,8 @@ const ConfirmationDialogContent = ( { title, body, onClose, label = 'Confirm', o
35
35
  );
36
36
 
37
37
  ConfirmationDialogContent.propTypes = {
38
- title: PropTypes.string,
39
- body: PropTypes.string,
38
+ title: PropTypes.node,
39
+ body: PropTypes.node,
40
40
  label: PropTypes.string,
41
41
  onClose: PropTypes.func,
42
42
  onConfirm: 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
  */
@@ -46,7 +46,7 @@ const Dialog = ( { trigger, position = 'left', startOpen = false, content, disab
46
46
  };
47
47
 
48
48
  return (
49
- <div sx={ { position: 'relative' } } ref={ dialogRef }>
49
+ <div onClick={ e => e.stopPropagation() } sx={ { position: 'relative' } } ref={ dialogRef }>
50
50
  <DialogTrigger
51
51
  tabIndex="0"
52
52
  sx={ { display: 'inline' } }
@@ -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
  */
@@ -3,11 +3,53 @@
3
3
  /**
4
4
  * External dependencies
5
5
  */
6
- import { Checkbox as ThemeCheckbox } from 'theme-ui';
6
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
7
7
  import PropTypes from 'prop-types';
8
+ import { MdDone } from 'react-icons/md';
9
+
10
+ const StyledCheckbox = props => <CheckboxPrimitive.Root
11
+ sx={ {
12
+ all: 'unset',
13
+ backgroundColor: 'grey.10',
14
+ width: 16,
15
+ height: 16,
16
+ borderRadius: 1,
17
+ display: 'flex',
18
+ alignItems: 'center',
19
+ justifyContent: 'center',
20
+ '&:hover': { backgroundColor: 'grey.20' },
21
+ '&:focus': { boxShadow: '0 0 0 2px black' },
22
+ '&[data-state=checked]': {
23
+ backgroundColor: 'primary',
24
+ color: 'brand.0',
25
+ },
26
+ svg: {
27
+ display: 'block',
28
+ },
29
+ } }
30
+ { ...props }
31
+ />;
32
+
33
+ const StyledIndicator = props => <CheckboxPrimitive.Indicator
34
+ sx={ {
35
+ color: 'brand.0',
36
+ } }
37
+ { ...props }
38
+ />;
8
39
 
9
40
  const Checkbox = ( { disabled, ...props } ) => (
10
- <ThemeCheckbox sx={ { opacity: disabled ? 0.4 : 1 } } disabled={ disabled } { ...props } />
41
+ <StyledCheckbox
42
+ sx={ {
43
+ opacity: disabled ? 0.4 : 1,
44
+ border: 'none',
45
+ } }
46
+ disabled={ disabled }
47
+ { ...props }
48
+ >
49
+ <StyledIndicator>
50
+ <MdDone />
51
+ </StyledIndicator>
52
+ </StyledCheckbox>
11
53
  );
12
54
 
13
55
  Checkbox.propTypes = {
@@ -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', ...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', ...props } )
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
  );
@@ -78,6 +91,7 @@ const InlineSelect = ( { label, value, options, noneLabel = 'All', ...props } )
78
91
  return (
79
92
  <Dialog
80
93
  content={Content}
94
+ position={ position }
81
95
  trigger={<DialogButton sx={{ width: '100%' }} label={label} value={valueLabel} />}
82
96
  />
83
97
  );
@@ -86,11 +100,12 @@ const InlineSelect = ( { label, value, options, noneLabel = 'All', ...props } )
86
100
  InlineSelect.propTypes = {
87
101
  label: PropTypes.string,
88
102
  // https://react-select.com/props
89
- value: PropTypes.oneOfType([
103
+ value: PropTypes.oneOfType( [
90
104
  PropTypes.array,
91
105
  PropTypes.object,
92
- ]),
106
+ ] ),
93
107
  options: PropTypes.array,
108
+ position: PropTypes.string,
94
109
  noneLabel: PropTypes.string,
95
110
  };
96
111
 
@@ -11,7 +11,7 @@ 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 ) => (
14
+ const InputComponent = ( { variant, label, forLabel, hasError, required, errorMessage, ...props }, ref ) => (
15
15
  <React.Fragment>
16
16
  { label &&
17
17
  <Label htmlFor={ forLabel }>
@@ -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',
@@ -55,9 +55,9 @@ const Input = React.forwardRef( ( { variant, label, forLabel, hasError, required
55
55
  <Validation>{ errorMessage }</Validation>
56
56
  }
57
57
  </React.Fragment>
58
- ) );
58
+ );
59
59
 
60
- Input.propTypes = {
60
+ InputComponent.propTypes = {
61
61
  variant: PropTypes.string,
62
62
  label: PropTypes.string,
63
63
  hasError: PropTypes.bool,
@@ -66,4 +66,6 @@ Input.propTypes = {
66
66
  errorMessage: PropTypes.string,
67
67
  };
68
68
 
69
+ const Input = React.forwardRef( InputComponent );
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
  );
@@ -0,0 +1,68 @@
1
+ /** @jsxImportSource theme-ui */
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import PropTypes from 'prop-types';
7
+ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
8
+ import { MdCheckCircle } from 'react-icons/md';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import { Heading, Text } from '../';
14
+
15
+ const RadioBoxGroup = ( { onChange, groupLabel, value, options, ...props } ) => (
16
+ <RadioGroupPrimitive.Root
17
+ onValueChange={ onChange }
18
+ value={ value }
19
+ aria-label={ groupLabel }
20
+ sx={ {
21
+ display: 'flex',
22
+ gap: 2,
23
+
24
+ } }
25
+ { ...props }
26
+ >
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
+ }
58
+ </RadioGroupPrimitive.Root>
59
+ );
60
+
61
+ RadioBoxGroup.propTypes = {
62
+ onChange: PropTypes.func,
63
+ options: PropTypes.array,
64
+ value: PropTypes.string,
65
+ groupLabel: PropTypes.string,
66
+ };
67
+
68
+ export { RadioBoxGroup };
@@ -0,0 +1,37 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { useState } from 'react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { RadioBoxGroup } from '..';
10
+
11
+ export default {
12
+ title: 'RadioBoxGroup',
13
+ component: RadioBoxGroup,
14
+ };
15
+
16
+ const options = [
17
+ {
18
+ label: 'One',
19
+ value: 'one',
20
+ description: 'This is a description',
21
+ },
22
+ {
23
+ label: 'Two',
24
+ value: 'two',
25
+ description: 'This is a description',
26
+ },
27
+ {
28
+ label: 'Three',
29
+ value: 'three',
30
+ description: 'This is a description',
31
+ },
32
+ ];
33
+
34
+ export const Default = () => {
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
@@ -11,10 +11,10 @@ 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 ) => (
14
+ const TextareaComponent = ( { 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
  '*'
@@ -50,9 +50,9 @@ const Textarea = React.forwardRef( ( { variant, label, forLabel, hasError, requi
50
50
  <Validation>{ errorMessage }</Validation>
51
51
  }
52
52
  </React.Fragment>
53
- ) );
53
+ );
54
54
 
55
- Textarea.propTypes = {
55
+ TextareaComponent.propTypes = {
56
56
  variant: PropTypes.string,
57
57
  label: PropTypes.string,
58
58
  hasError: PropTypes.bool,
@@ -61,4 +61,6 @@ Textarea.propTypes = {
61
61
  errorMessage: PropTypes.string,
62
62
  };
63
63
 
64
+ const Textarea = React.forwardRef( TextareaComponent );
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',