@automattic/vip-design-system 1.2.3 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -1
- package/.prettierignore +1 -0
- package/.storybook/decorators/withBoundingBox.tsx +30 -4
- package/.storybook/decorators/withColorMode.tsx +5 -5
- package/CONTRIBUTING.md +1 -1
- package/build/system/Accordion/Accordion.js +6 -6
- package/build/system/Accordion/Accordion.stories.js +1 -1
- package/build/system/Accordion/Accordion.test.js +7 -5
- package/build/system/Avatar/Avatar.js +3 -2
- package/build/system/Badge/Badge.js +1 -0
- package/build/system/Button/Button.d.ts +11 -0
- package/build/system/Button/Button.js +12 -1
- package/build/system/Button/Button.stories.d.ts +2 -1
- package/build/system/Button/Button.stories.js +1 -2
- package/build/system/Button/Button.test.js +72 -45
- package/build/system/Button/ButtonSubmit.d.ts +17 -1
- package/build/system/Button/ButtonSubmit.js +58 -65
- package/build/system/Button/ButtonSubmit.stories.d.ts +17 -37
- package/build/system/Button/ButtonSubmit.stories.js +52 -0
- package/build/system/Button/ButtonSubmit.test.js +55 -35
- package/build/system/Button/index.d.ts +7 -3
- package/build/system/Button/index.js +8 -7
- package/build/system/Dropdown/DropdownContent.js +1 -1
- package/build/system/Dropdown/DropdownItem.js +1 -1
- package/build/system/Dropdown/DropdownLabel.js +1 -1
- package/build/system/Form/Checkbox.d.ts +9 -9
- package/build/system/Form/Checkbox.js +56 -61
- package/build/system/Form/Checkbox.stories.d.ts +6 -6
- package/build/system/Form/Checkbox.stories.js +71 -0
- package/build/system/Form/Input.d.ts +14 -1
- package/build/system/Form/Input.js +59 -72
- package/build/system/Form/Input.stories.d.ts +6 -4
- package/build/system/Form/Input.stories.js +53 -0
- package/build/system/Form/Input.styles.d.ts +23 -14
- package/build/system/Form/Input.styles.js +40 -28
- package/build/system/Form/InputWithCopyButton.stories.jsx +7 -0
- package/build/system/Form/Label.d.ts +19 -8
- package/build/system/Form/Label.js +39 -43
- package/build/system/Form/Label.stories.d.ts +7 -5
- package/build/system/Form/Label.stories.js +32 -0
- package/build/system/Form/Radio.js +4 -4
- package/build/system/Form/Radio.stories.jsx +1 -1
- package/build/system/Form/RadioBoxGroup.js +1 -1
- package/build/system/Form/RequiredLabel.d.ts +2 -1
- package/build/system/Form/RequiredLabel.js +16 -7
- package/build/system/Form/Toggle.js +2 -2
- package/build/system/Form/Validation.d.ts +8 -13
- package/build/system/Form/Validation.js +39 -35
- package/build/system/Heading/Heading.stories.js +3 -0
- package/build/system/Link/Link.js +1 -1
- package/build/system/NewDialog/DialogClose.js +2 -2
- package/build/system/NewDialog/DialogContent.js +3 -3
- package/build/system/NewDialog/DialogTitle.js +3 -1
- package/build/system/NewDialog/NewDialog.stories.d.ts +0 -1
- package/build/system/NewDialog/NewDialog.stories.jsx +0 -27
- package/build/system/NewForm/Fieldset.d.ts +12 -1
- package/build/system/NewForm/Fieldset.js +38 -40
- package/build/system/NewForm/Form.d.ts +8 -1
- package/build/system/NewForm/Form.js +24 -23
- package/build/system/NewForm/FormAutocomplete.css +0 -11
- package/build/system/NewForm/FormAutocomplete.js +8 -8
- package/build/system/NewForm/FormAutocomplete.stories.jsx +1 -3
- package/build/system/NewForm/FormAutocompleteMultiselect.js +10 -10
- package/build/system/NewForm/FormSelect.js +1 -1
- package/build/system/NewForm/FormSelectArrow.js +1 -1
- package/build/system/NewForm/FormSelectInline.js +1 -1
- package/build/system/NewForm/FormSelectLoading.js +1 -1
- package/build/system/NewForm/FormSelectSearch.js +2 -2
- package/build/system/NewForm/Legend.d.ts +12 -1
- package/build/system/NewForm/Legend.js +32 -34
- package/build/system/NewForm/index.d.ts +1 -1
- package/build/system/OptionRow/OptionRow.js +1 -1
- package/build/system/Progress/Progress.d.ts +9 -2
- package/build/system/Progress/Progress.js +75 -70
- package/build/system/Progress/Progress.stories.d.ts +9 -7
- package/build/system/Progress/Progress.stories.js +34 -0
- package/build/system/Progress/Progress.test.d.ts +1 -0
- package/build/system/Progress/Progress.test.js +65 -0
- package/build/system/Progress/index.d.ts +4 -2
- package/build/system/Progress/index.js +5 -5
- package/build/system/ScreenReaderText/ScreenReaderText.js +1 -2
- package/build/system/Tabs/TabsTrigger.js +0 -1
- package/build/system/Text/Text.js +1 -1
- package/build/system/Text/Text.stories.js +36 -0
- package/build/system/Tooltip/Tooltip.css +6 -2
- package/build/system/Tooltip/Tooltip.stories.js +2 -2
- package/build/system/Wizard/Wizard.d.ts +14 -1
- package/build/system/Wizard/Wizard.js +62 -93
- package/build/system/Wizard/Wizard.stories.d.ts +11 -8
- package/build/system/Wizard/Wizard.stories.js +167 -0
- package/build/system/Wizard/WizardStep.d.ts +24 -1
- package/build/system/Wizard/WizardStep.js +180 -190
- package/build/system/Wizard/index.d.ts +4 -2
- package/build/system/Wizard/index.js +6 -7
- package/build/system/index.d.ts +2 -2
- package/build/system/index.js +2 -1
- package/build/system/theme/generated/valet-theme-dark.json +1219 -476
- package/build/system/theme/generated/valet-theme-light.json +1217 -474
- package/build/system/theme/{getColor.d.ts → getPropValue.d.ts} +2 -1
- package/{src/system/theme/getColor.js → build/system/theme/getPropValue.js} +36 -4
- package/build/system/theme/index.d.ts +20 -65
- package/build/system/theme/index.js +27 -57
- package/package.json +4 -4
- package/src/system/Accordion/Accordion.stories.tsx +1 -1
- package/src/system/Accordion/Accordion.test.tsx +3 -0
- package/src/system/Accordion/Accordion.tsx +6 -6
- package/src/system/Avatar/Avatar.tsx +3 -3
- package/src/system/Badge/Badge.tsx +1 -1
- package/src/system/Button/Button.stories.tsx +2 -3
- package/src/system/Button/{Button.test.js → Button.test.tsx} +2 -2
- package/src/system/Button/Button.tsx +12 -0
- package/src/system/Button/ButtonSubmit.stories.tsx +31 -0
- package/src/system/Button/{ButtonSubmit.test.js → ButtonSubmit.test.tsx} +4 -4
- package/src/system/Button/{ButtonSubmit.js → ButtonSubmit.tsx} +21 -27
- package/src/system/Button/index.ts +8 -0
- package/src/system/Dropdown/DropdownContent.js +1 -1
- package/src/system/Dropdown/DropdownItem.js +1 -1
- package/src/system/Dropdown/DropdownLabel.js +1 -1
- package/src/system/Form/{Checkbox.stories.jsx → Checkbox.stories.tsx} +3 -2
- package/src/system/Form/{Checkbox.js → Checkbox.tsx} +6 -10
- package/src/system/Form/{Input.stories.jsx → Input.stories.tsx} +1 -0
- package/src/system/Form/{Input.styles.js → Input.styles.ts} +14 -5
- package/src/system/Form/{Input.js → Input.tsx} +10 -19
- package/src/system/Form/InputWithCopyButton.stories.jsx +7 -0
- package/src/system/Form/{Label.js → Label.tsx} +8 -13
- package/src/system/Form/Radio.js +4 -4
- package/src/system/Form/Radio.stories.jsx +1 -1
- package/src/system/Form/RadioBoxGroup.js +1 -1
- package/src/system/Form/{RequiredLabel.js → RequiredLabel.tsx} +1 -3
- package/src/system/Form/Toggle.js +2 -2
- package/src/system/Form/{Validation.js → Validation.tsx} +11 -12
- package/src/system/Heading/Heading.stories.tsx +1 -0
- package/src/system/Link/Link.tsx +1 -1
- package/src/system/NewDialog/DialogClose.js +2 -2
- package/src/system/NewDialog/DialogContent.js +3 -3
- package/src/system/NewDialog/DialogTitle.js +3 -1
- package/src/system/NewDialog/NewDialog.stories.jsx +0 -27
- package/src/system/NewForm/Fieldset.tsx +46 -0
- package/src/system/NewForm/Form.tsx +23 -0
- package/src/system/NewForm/FormAutocomplete.css +0 -11
- package/src/system/NewForm/FormAutocomplete.js +8 -8
- package/src/system/NewForm/FormAutocomplete.stories.jsx +1 -3
- package/src/system/NewForm/FormAutocompleteMultiselect.js +10 -10
- package/src/system/NewForm/FormSelect.js +1 -1
- package/src/system/NewForm/FormSelectArrow.js +1 -1
- package/src/system/NewForm/FormSelectInline.js +1 -1
- package/src/system/NewForm/FormSelectLoading.js +1 -1
- package/src/system/NewForm/FormSelectSearch.js +2 -2
- package/src/system/NewForm/Legend.tsx +40 -0
- package/src/system/OptionRow/OptionRow.js +1 -1
- package/src/system/Progress/Progress.test.tsx +33 -0
- package/src/system/Progress/{Progress.js → Progress.tsx} +16 -19
- package/src/system/Progress/index.ts +4 -0
- package/src/system/ScreenReaderText/ScreenReaderText.tsx +0 -2
- package/src/system/Tabs/TabsTrigger.js +0 -1
- package/src/system/Text/Text.stories.tsx +7 -0
- package/src/system/Text/Text.tsx +1 -1
- package/src/system/Tooltip/Tooltip.css +6 -2
- package/src/system/Tooltip/Tooltip.stories.tsx +4 -4
- package/{build/system/Wizard/Wizard.stories.jsx → src/system/Wizard/Wizard.stories.tsx} +18 -23
- package/src/system/Wizard/Wizard.tsx +62 -0
- package/src/system/Wizard/{WizardStep.js → WizardStep.tsx} +38 -41
- package/src/system/Wizard/index.ts +7 -0
- package/src/system/index.js +2 -1
- package/src/system/theme/generated/valet-theme-dark.json +1219 -476
- package/src/system/theme/generated/valet-theme-light.json +1217 -474
- package/{build/system/theme/getColor.js → src/system/theme/getPropValue.js} +36 -4
- package/src/system/theme/index.js +27 -57
- package/tokens/utilities/colors/color output/blue.json +305 -0
- package/tokens/utilities/colors/color output/gold.json +305 -0
- package/tokens/utilities/colors/color output/gray.json +305 -0
- package/tokens/utilities/colors/color output/green.json +305 -0
- package/tokens/utilities/colors/color output/orange.json +305 -0
- package/tokens/utilities/colors/color output/pink.json +305 -0
- package/tokens/utilities/colors/color output/red.json +305 -0
- package/tokens/utilities/colors/color output/salmon.json +305 -0
- package/tokens/utilities/colors/color output/yellow.json +305 -0
- package/tokens/utilities/colors/colorOutput.json +4062 -0
- package/tokens/utilities/colors/color_3d_plot.js +43 -0
- package/tokens/utilities/colors/color_graph.js +31 -0
- package/tokens/utilities/colors/colors.json +1981 -0
- package/tokens/utilities/colors/index.js +118 -0
- package/tokens/utilities/colors/package-lock.json +6749 -0
- package/tokens/utilities/colors/package.json +21 -0
- package/tokens/utilities/figma-type-calculator/responsive-type.js +98 -0
- package/tokens/valet-core/$metadata.json +19 -15
- package/tokens/valet-core/$themes.json +3323 -419
- package/tokens/valet-core/{figma-parsely-expressive-type.json → figma-parsely-web-type.json} +128 -128
- package/tokens/valet-core/{figma-valet-expressive-type.json → figma-valet-web-type.json} +126 -126
- package/tokens/valet-core/figma-wpvip-services-web-type.json +1267 -0
- package/tokens/valet-core/{figma-wpvip-expressive-type.json → figma-wpvip-web-type.json} +162 -162
- package/tokens/valet-core/{parsely-expressive-color.json → parsely-web-color.json} +1 -1
- package/tokens/valet-core/{wpvip-expressive-core.json → parsely-web-core.json} +73 -23
- package/tokens/valet-core/{parsely-expressive-type.json → parsely-web-type.json} +21 -9
- package/tokens/valet-core/valet-core.json +331 -232
- package/tokens/valet-core/{valet-expressive-color.json → valet-web-color.json} +1 -1
- package/tokens/valet-core/{parsely-expressive-core.json → valet-web-core.json} +72 -22
- package/tokens/valet-core/{wpvip-productive-color.json → wpvip-product-core.json} +663 -7
- package/tokens/valet-core/{wpvip-productive-color-dark.json → wpvip-product-dark.json} +332 -10
- package/tokens/valet-core/{wpvip-expressive-color.json → wpvip-services-web-color.json} +1 -1
- package/tokens/valet-core/{valet-expressive-core.json → wpvip-services-web-core.json} +72 -22
- package/tokens/valet-core/wpvip-services-web-type.json +412 -0
- package/tokens/valet-core/{wpvip-expressive-color-dark.json → wpvip-web-color-dark.json} +1 -1
- package/tokens/valet-core/wpvip-web-color.json +730 -0
- package/tokens/valet-core/{wpvip-expressive-type.json → wpvip-web-type.json} +24 -12
- package/tokens/valet-core/wpvip-web.json +1310 -0
- package/tsconfig.json +2 -1
- package/build/system/Button/ButtonSubmit.stories.jsx +0 -40
- package/build/system/Button/variants.d.ts +0 -2
- package/build/system/Button/variants.js +0 -1
- package/build/system/Form/Checkbox.stories.jsx +0 -54
- package/build/system/Form/Input.stories.jsx +0 -38
- package/build/system/Wizard/WizardStepHorizontal.d.ts +0 -2
- package/build/system/Wizard/WizardStepHorizontal.js +0 -55
- package/build/system/theme/textStyles.d.ts +0 -71
- package/build/system/theme/textStyles.js +0 -46
- package/src/system/Button/ButtonSubmit.stories.jsx +0 -40
- package/src/system/Button/index.js +0 -8
- package/src/system/Button/variants.js +0 -1
- package/src/system/Form/Label.stories.jsx +0 -36
- package/src/system/NewForm/Fieldset.js +0 -47
- package/src/system/NewForm/Form.js +0 -26
- package/src/system/NewForm/Legend.js +0 -41
- package/src/system/Progress/Progress.stories.jsx +0 -25
- package/src/system/Progress/index.js +0 -6
- package/src/system/Wizard/Wizard.js +0 -103
- package/src/system/Wizard/Wizard.stories.jsx +0 -145
- package/src/system/Wizard/WizardStepHorizontal.js +0 -55
- package/src/system/Wizard/index.js +0 -8
- package/src/system/theme/textStyles.js +0 -46
- /package/{build/system/Form/Label.stories.jsx → src/system/Form/Label.stories.tsx} +0 -0
- /package/{build/system/Progress/Progress.stories.jsx → src/system/Progress/Progress.stories.tsx} +0 -0
|
@@ -17,12 +17,12 @@ import { FormSelectArrow } from './FormSelectArrow';
|
|
|
17
17
|
import { Label } from '../Form/Label';
|
|
18
18
|
import { FormSelectSearch } from './FormSelectSearch';
|
|
19
19
|
import { FormSelectLoading } from './FormSelectLoading';
|
|
20
|
-
import { baseControlBorderStyle,
|
|
20
|
+
import { baseControlBorderStyle, inputBaseText } from '../Form/Input.styles';
|
|
21
21
|
import { Validation } from '../Form';
|
|
22
22
|
|
|
23
23
|
const baseBorderTextColors = {
|
|
24
24
|
...baseControlBorderStyle,
|
|
25
|
-
backgroundColor:
|
|
25
|
+
backgroundColor: 'layer.2',
|
|
26
26
|
color: inputBaseText,
|
|
27
27
|
borderRadius: 1,
|
|
28
28
|
};
|
|
@@ -51,7 +51,7 @@ const defaultStyles = {
|
|
|
51
51
|
'&:focus-visible': { outlineWidth: 0, boxShadow: 'none' },
|
|
52
52
|
'&:focus-within': { outlineWidth: 0, boxShadow: 'none' },
|
|
53
53
|
'&.autocomplete__input--focused': { outlineWidth: 0, boxShadow: 'none' },
|
|
54
|
-
'&.autocomplete__input--show-all-values': { paddingRight:
|
|
54
|
+
'&.autocomplete__input--show-all-values': { paddingRight: 7 },
|
|
55
55
|
},
|
|
56
56
|
'& .autocomplete__menu': {
|
|
57
57
|
...baseBorderTextColors,
|
|
@@ -66,11 +66,11 @@ const defaultStyles = {
|
|
|
66
66
|
borderColor: baseControlBorderStyle.borderColor,
|
|
67
67
|
},
|
|
68
68
|
'& .autocomplete__option--odd': {
|
|
69
|
-
bg: '
|
|
69
|
+
bg: 'layer.1',
|
|
70
70
|
},
|
|
71
71
|
'& .autocomplete__option:hover, & .autocomplete__option--focused': {
|
|
72
|
-
bg: '
|
|
73
|
-
borderColor: '
|
|
72
|
+
bg: 'input.background.primary',
|
|
73
|
+
borderColor: 'input.background.primary',
|
|
74
74
|
},
|
|
75
75
|
'& .autocomplete__input--show-all-values': {
|
|
76
76
|
paddingRight: 0,
|
|
@@ -89,7 +89,7 @@ const inlineStyles = {
|
|
|
89
89
|
|
|
90
90
|
const searchIconStyles = {
|
|
91
91
|
'& .autocomplete__input.autocomplete__input': {
|
|
92
|
-
paddingLeft:
|
|
92
|
+
paddingLeft: 6,
|
|
93
93
|
},
|
|
94
94
|
};
|
|
95
95
|
|
|
@@ -345,7 +345,7 @@ const FormAutocomplete = React.forwardRef(
|
|
|
345
345
|
{ ...props }
|
|
346
346
|
/>
|
|
347
347
|
|
|
348
|
-
{ loading && <FormSelectLoading sx={ { right: showAllValues ?
|
|
348
|
+
{ loading && <FormSelectLoading sx={ { right: showAllValues ? 7 : 3 } } /> }
|
|
349
349
|
</FormSelectContent>
|
|
350
350
|
</div>
|
|
351
351
|
|
|
@@ -151,9 +151,7 @@ WithCustomArrow.args = {
|
|
|
151
151
|
showAllValues: true,
|
|
152
152
|
// eslint-disable-next-line react/display-name
|
|
153
153
|
dropdownArrow: () => (
|
|
154
|
-
<span sx={ { position: 'absolute', top:
|
|
155
|
-
👇
|
|
156
|
-
</span>
|
|
154
|
+
<span sx={ { position: 'absolute', top: 1, right: 3, pointerEvents: 'none' } }>👇</span>
|
|
157
155
|
),
|
|
158
156
|
};
|
|
159
157
|
WithCustomArrow.displayName = 'WithCustomArrow';
|
|
@@ -16,14 +16,14 @@ import { FormSelectArrow } from './FormSelectArrow';
|
|
|
16
16
|
import { Label } from '../Form/Label';
|
|
17
17
|
import { FormSelectSearch } from './FormSelectSearch';
|
|
18
18
|
import { FormSelectLoading } from './FormSelectLoading';
|
|
19
|
-
import { baseControlBorderStyle,
|
|
19
|
+
import { baseControlBorderStyle, inputBaseText } from '../Form/Input.styles';
|
|
20
20
|
import { Validation } from '../Form';
|
|
21
21
|
import { Button, Flex } from '../';
|
|
22
22
|
import { MdClose } from 'react-icons/md';
|
|
23
23
|
|
|
24
24
|
const baseBorderTextColors = {
|
|
25
25
|
...baseControlBorderStyle,
|
|
26
|
-
backgroundColor:
|
|
26
|
+
backgroundColor: 'layer.2',
|
|
27
27
|
color: inputBaseText,
|
|
28
28
|
borderRadius: 1,
|
|
29
29
|
};
|
|
@@ -41,7 +41,7 @@ const defaultStyles = {
|
|
|
41
41
|
'&.autocomplete__input--focused': theme => theme.outline,
|
|
42
42
|
'& .autocomplete__input': {
|
|
43
43
|
width: '100%',
|
|
44
|
-
paddingLeft:
|
|
44
|
+
paddingLeft: 4,
|
|
45
45
|
py: 0,
|
|
46
46
|
borderWidth: 0,
|
|
47
47
|
color: 'text',
|
|
@@ -51,7 +51,7 @@ const defaultStyles = {
|
|
|
51
51
|
'&:focus-visible': { outlineWidth: 0, boxShadow: 'none' },
|
|
52
52
|
'&:focus-within': { outlineWidth: 0, boxShadow: 'none' },
|
|
53
53
|
'&.autocomplete__input--focused': { outlineWidth: 0, boxShadow: 'none' },
|
|
54
|
-
'&.autocomplete__input--show-all-values': { paddingRight:
|
|
54
|
+
'&.autocomplete__input--show-all-values': { paddingRight: 7 },
|
|
55
55
|
'&::placeholder': {
|
|
56
56
|
color: 'input.text.placeholder',
|
|
57
57
|
opacity: 1,
|
|
@@ -70,18 +70,18 @@ const defaultStyles = {
|
|
|
70
70
|
borderColor: baseControlBorderStyle.borderColor,
|
|
71
71
|
},
|
|
72
72
|
'& .autocomplete__option--odd': {
|
|
73
|
-
bg: '
|
|
73
|
+
bg: 'layer.1',
|
|
74
74
|
},
|
|
75
75
|
'& .autocomplete__option:hover, & .autocomplete__option--focused': {
|
|
76
|
-
bg: '
|
|
77
|
-
borderColor: '
|
|
76
|
+
bg: 'input.background.primary',
|
|
77
|
+
borderColor: 'input.background.primary',
|
|
78
78
|
},
|
|
79
79
|
'& .autocomplete__input--show-all-values': {
|
|
80
80
|
paddingRight: 0,
|
|
81
81
|
},
|
|
82
82
|
'& .autocomplete__hint': {
|
|
83
83
|
border: 'none',
|
|
84
|
-
paddingLeft:
|
|
84
|
+
paddingLeft: 4,
|
|
85
85
|
minHeight: '27px',
|
|
86
86
|
lineHeight: '27px',
|
|
87
87
|
},
|
|
@@ -93,7 +93,7 @@ const inlineStyles = {
|
|
|
93
93
|
|
|
94
94
|
const searchIconStyles = {
|
|
95
95
|
'& .autocomplete__input.autocomplete__input': {
|
|
96
|
-
paddingLeft:
|
|
96
|
+
paddingLeft: 6,
|
|
97
97
|
},
|
|
98
98
|
};
|
|
99
99
|
|
|
@@ -407,7 +407,7 @@ const FormAutocompleteMultiselect = React.forwardRef(
|
|
|
407
407
|
{ ...props }
|
|
408
408
|
/>
|
|
409
409
|
{ addStatus && <AddSelectionStatus status={ addStatus } /> }
|
|
410
|
-
{ loading && <FormSelectLoading sx={ { right: showAllValues ?
|
|
410
|
+
{ loading && <FormSelectLoading sx={ { right: showAllValues ? 7 : 3 } } /> }
|
|
411
411
|
</FormSelectContent>
|
|
412
412
|
</div>
|
|
413
413
|
<Flex sx={ { mt: 2, justifyContent: 'space-between' } }>
|
|
@@ -22,7 +22,7 @@ export const FormSelectArrow = React.forwardRef( ( props, forwardRef ) => (
|
|
|
22
22
|
borderLeftWidth: borderStyle.borderWidth,
|
|
23
23
|
borderLeftStyle: borderStyle.borderStyle,
|
|
24
24
|
borderLeftColor: borderStyle.borderColor,
|
|
25
|
-
right:
|
|
25
|
+
right: 3,
|
|
26
26
|
top: '7px',
|
|
27
27
|
pointerEvents: 'none',
|
|
28
28
|
svg: {
|
|
@@ -14,7 +14,7 @@ export const inlineStyles = {
|
|
|
14
14
|
gridTemplateColumns: 'auto 1fr',
|
|
15
15
|
position: 'relative',
|
|
16
16
|
alignItems: 'center',
|
|
17
|
-
backgroundColor: 'input.background',
|
|
17
|
+
backgroundColor: 'input.background.default',
|
|
18
18
|
borderRadius: 1,
|
|
19
19
|
...baseControlBorderStyle,
|
|
20
20
|
paddingRight: 0,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { baseLabelStyle } from '../Form/Label';
|
|
14
|
+
import { ThemeUIStyleObject } from 'theme-ui';
|
|
15
|
+
|
|
16
|
+
interface LegendProps {
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
sx?: ThemeUIStyleObject;
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export const Legend = React.forwardRef< HTMLLegendElement, LegendProps >(
|
|
22
|
+
( { children, className, sx = {}, ...props }, forwardRef ) => (
|
|
23
|
+
<legend
|
|
24
|
+
ref={ forwardRef }
|
|
25
|
+
className={ classNames( 'vip-form-legend-component', className ) }
|
|
26
|
+
sx={ {
|
|
27
|
+
all: 'unset',
|
|
28
|
+
...baseLabelStyle,
|
|
29
|
+
px: 1,
|
|
30
|
+
mb: 0,
|
|
31
|
+
...sx,
|
|
32
|
+
} }
|
|
33
|
+
{ ...props }
|
|
34
|
+
>
|
|
35
|
+
{ children }
|
|
36
|
+
</legend>
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
Legend.displayName = 'Legend';
|
|
@@ -77,7 +77,7 @@ const OptionRow = React.forwardRef(
|
|
|
77
77
|
<Box
|
|
78
78
|
sx={ {
|
|
79
79
|
display: [ 'inline-block', 'inline-block', 'block' ],
|
|
80
|
-
p: small ?
|
|
80
|
+
p: small ? 3 : 5,
|
|
81
81
|
flex: '0 0 auto',
|
|
82
82
|
bg: `optionRow.${ variant }.background`,
|
|
83
83
|
color: `optionRow.${ variant }.icon`,
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { Progress } from './Progress';
|
|
11
|
+
|
|
12
|
+
const steps = [ 'Downloading Data', 'Importing Data...', 'Finalizing', 'Done' ];
|
|
13
|
+
describe( '<Progress />', () => {
|
|
14
|
+
it( 'renders the progress component', async () => {
|
|
15
|
+
const { container } = render( <Progress steps={ steps } activeStep={ 1 } /> );
|
|
16
|
+
|
|
17
|
+
expect( container.getElementsByClassName( 'vip-progress-component' ) ).toBeDefined();
|
|
18
|
+
|
|
19
|
+
// Check for accessibility issues
|
|
20
|
+
expect( await axe( container ) ).toHaveNoViolations();
|
|
21
|
+
} );
|
|
22
|
+
|
|
23
|
+
it( 'renders the progress component with different label text', async () => {
|
|
24
|
+
const { container } = render(
|
|
25
|
+
<Progress forLabel="My progress bar" steps={ steps } activeStep={ 1 } />
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
expect( screen.getByLabelText( 'My progress bar' ) ).toBeInTheDocument();
|
|
29
|
+
|
|
30
|
+
// Check for accessibility issues
|
|
31
|
+
expect( await axe( container ) ).toHaveNoViolations();
|
|
32
|
+
} );
|
|
33
|
+
} );
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
/** @jsxImportSource theme-ui */
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* External dependencies
|
|
5
3
|
*/
|
|
6
|
-
import
|
|
7
|
-
import { Progress as ThemeProgress } from 'theme-ui';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
4
|
+
import { forwardRef, Ref } from 'react';
|
|
5
|
+
import { ProgressProps, Progress as ThemeProgress } from 'theme-ui';
|
|
9
6
|
import classNames from 'classnames';
|
|
10
7
|
|
|
11
8
|
/**
|
|
@@ -13,13 +10,23 @@ import classNames from 'classnames';
|
|
|
13
10
|
*/
|
|
14
11
|
import { Spinner } from '../Spinner';
|
|
15
12
|
import { MdCheck } from 'react-icons/md';
|
|
16
|
-
import { Box, Text, Flex } from '
|
|
13
|
+
import { Box, Text, Flex } from '..';
|
|
17
14
|
|
|
18
15
|
const prefix = 'vip-progress-component';
|
|
19
16
|
const uniqueID = () => Math.random().toString( 36 ).substring( 7 );
|
|
20
17
|
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
export interface ThemeProgressProps extends ProgressProps {
|
|
19
|
+
steps: string[];
|
|
20
|
+
activeStep: number;
|
|
21
|
+
forLabel?: string;
|
|
22
|
+
className?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const Progress = forwardRef< HTMLProgressElement, ThemeProgressProps >(
|
|
26
|
+
(
|
|
27
|
+
{ steps, activeStep, sx, forLabel = '', className, ...props }: ThemeProgressProps,
|
|
28
|
+
ref: Ref< HTMLProgressElement >
|
|
29
|
+
) => {
|
|
23
30
|
const stepsTotal = steps.length;
|
|
24
31
|
const isDone = activeStep === stepsTotal - 1;
|
|
25
32
|
const instance = uniqueID();
|
|
@@ -38,7 +45,7 @@ const Progress = React.forwardRef(
|
|
|
38
45
|
value={ currentValue }
|
|
39
46
|
id={ htmlFor }
|
|
40
47
|
aria-label={ forLabel }
|
|
41
|
-
ref={
|
|
48
|
+
ref={ ref }
|
|
42
49
|
{ ...props }
|
|
43
50
|
/>
|
|
44
51
|
|
|
@@ -66,13 +73,3 @@ const Progress = React.forwardRef(
|
|
|
66
73
|
);
|
|
67
74
|
|
|
68
75
|
Progress.displayName = 'Progress';
|
|
69
|
-
|
|
70
|
-
Progress.propTypes = {
|
|
71
|
-
steps: PropTypes.array,
|
|
72
|
-
activeStep: PropTypes.number,
|
|
73
|
-
forLabel: PropTypes.node,
|
|
74
|
-
sx: PropTypes.object,
|
|
75
|
-
className: PropTypes.any,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
export { Progress };
|
|
@@ -25,6 +25,13 @@ export const Default = () => (
|
|
|
25
25
|
|
|
26
26
|
<Text sx={ { color: 'texts.helper' } }>Text Helper</Text>
|
|
27
27
|
|
|
28
|
+
<Text sx={ { color: 'texts.helper', fontWeight: 'body' } }>Text Helper</Text>
|
|
29
|
+
<Text sx={ { color: 'texts.helper', fontWeight: 'heading' } }>Text Helper</Text>
|
|
30
|
+
<Text sx={ { color: 'texts.helper', fontWeight: 'regular' } }>Text Helper</Text>
|
|
31
|
+
<Text sx={ { color: 'texts.helper', fontWeight: 'medium' } }>Text Helper</Text>
|
|
32
|
+
<Text sx={ { color: 'texts.helper', fontWeight: 'bold' } }>Text Helper</Text>
|
|
33
|
+
<Text sx={ { color: 'texts.helper', fontWeight: 'light' } }>Text Helper</Text>
|
|
34
|
+
|
|
28
35
|
<Text sx={ { color: 'texts.secondary' } }>Text Secondary</Text>
|
|
29
36
|
|
|
30
37
|
<Text sx={ { color: 'texts.primary' } }>Text Primary</Text>
|
package/src/system/Text/Text.tsx
CHANGED
|
@@ -22,11 +22,15 @@
|
|
|
22
22
|
[data-vip-tooltip]::before {
|
|
23
23
|
content: attr(data-vip-tooltip);
|
|
24
24
|
z-index: 9999;
|
|
25
|
-
width:
|
|
25
|
+
width: max-content;
|
|
26
|
+
max-width: 210px;
|
|
26
27
|
color: #fff;
|
|
27
28
|
background: rgba(0,0,0, .7);
|
|
28
29
|
border-radius: 5px;
|
|
29
|
-
padding:
|
|
30
|
+
padding-left: 12px;
|
|
31
|
+
padding-right: 12px;
|
|
32
|
+
padding-top: 8px;
|
|
33
|
+
padding-bottom: 8px;
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
[data-vip-tooltip]::after {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { Tooltip, Button, Heading, Text, Link } from '..';
|
|
4
|
+
import { Tooltip, Button, Heading, Text, Link, Box } from '..';
|
|
5
5
|
|
|
6
6
|
export default {
|
|
7
7
|
title: 'Tooltip',
|
|
@@ -52,7 +52,7 @@ elements that appear interactive, like buttons or links.
|
|
|
52
52
|
events.
|
|
53
53
|
- <strong>Use consistently.</strong> If using tooltips in one context, use in all similar
|
|
54
54
|
contexts.
|
|
55
|
-
- <strong>Don't block content.</strong> Use the <code>
|
|
55
|
+
- <strong>Don't block content.</strong> Use the <code>vip-tooltip-position</code> attribute to
|
|
56
56
|
prevent the tooltip from covering other page elements.
|
|
57
57
|
|
|
58
58
|
-------
|
|
@@ -109,7 +109,7 @@ export const Container = () => (
|
|
|
109
109
|
simply pass <code>data-vip-tooltip</code> as an HTML attribute to your component.
|
|
110
110
|
</Text>
|
|
111
111
|
|
|
112
|
-
<
|
|
112
|
+
<Box sx={ { backgroundColor: 'red' } }>
|
|
113
113
|
<Tooltip>
|
|
114
114
|
<Button data-vip-tooltip-position="top" data-vip-tooltip="Test test" sx={ { ml: 3 } }>
|
|
115
115
|
This is another way
|
|
@@ -128,6 +128,6 @@ export const Container = () => (
|
|
|
128
128
|
Use with links too
|
|
129
129
|
</Link>
|
|
130
130
|
</Tooltip>
|
|
131
|
-
</
|
|
131
|
+
</Box>
|
|
132
132
|
</div>
|
|
133
133
|
);
|
|
@@ -8,22 +8,16 @@ import React from 'react';
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
-
import { Wizard, Box, Label, Input, Button,
|
|
11
|
+
import { Wizard, Box, Label, Input, Button, Checkbox, Flex } from '..';
|
|
12
|
+
import { WizardStepProps } from './WizardStep';
|
|
12
13
|
|
|
13
14
|
export default {
|
|
14
15
|
title: 'Wizard',
|
|
15
16
|
component: Wizard,
|
|
16
17
|
};
|
|
17
18
|
|
|
18
|
-
const options = [
|
|
19
|
-
{ value: 'chocolate', label: 'Chocolate' },
|
|
20
|
-
{ value: 'strawberry', label: 'Strawberry' },
|
|
21
|
-
{ value: 'vanilla', label: 'Vanilla' },
|
|
22
|
-
{ value: 'coffee', label: 'Coffee' },
|
|
23
|
-
];
|
|
24
|
-
|
|
25
19
|
export const Default = () => {
|
|
26
|
-
const steps = [
|
|
20
|
+
const steps: WizardStepProps[] = [
|
|
27
21
|
{
|
|
28
22
|
title: 'Choose Domain',
|
|
29
23
|
titleVariant: 'h2',
|
|
@@ -31,8 +25,7 @@ export const Default = () => {
|
|
|
31
25
|
children: (
|
|
32
26
|
<Box>
|
|
33
27
|
<Label>Domain</Label>
|
|
34
|
-
<Input
|
|
35
|
-
<Form.Autocomplete label="Autocomplete" options={ options } />
|
|
28
|
+
<Input placeholder="yourdomain.com" />
|
|
36
29
|
<Button sx={ { mt: 3 } }>Continue</Button>
|
|
37
30
|
</Box>
|
|
38
31
|
),
|
|
@@ -62,7 +55,7 @@ export const Default = () => {
|
|
|
62
55
|
export const WithTitleAutoFocus = () => {
|
|
63
56
|
const [ activeStep, setActiveStep ] = React.useState( 0 );
|
|
64
57
|
const [ autoFocus, setAutoFocus ] = React.useState( true );
|
|
65
|
-
const steps = [
|
|
58
|
+
const steps: WizardStepProps[] = [
|
|
66
59
|
{
|
|
67
60
|
title: 'Choose Domain',
|
|
68
61
|
titleVariant: 'h2',
|
|
@@ -128,17 +121,19 @@ export const WithTitleAutoFocus = () => {
|
|
|
128
121
|
/>
|
|
129
122
|
</Box>
|
|
130
123
|
<Box mt={ 4 }>
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
124
|
+
<Flex sx={ { alignItems: 'center' } }>
|
|
125
|
+
<Checkbox
|
|
126
|
+
id="wizard-autofocus"
|
|
127
|
+
checked={ autoFocus }
|
|
128
|
+
aria-labelledby="label-check1"
|
|
129
|
+
onCheckedChange={ e => {
|
|
130
|
+
setAutoFocus( e === true );
|
|
131
|
+
} }
|
|
132
|
+
/>
|
|
133
|
+
<Label sx={ { m: 0, ml: 2 } } htmlFor="wizard-autofocus" id="label-check1">
|
|
134
|
+
Autofocus enabled?
|
|
135
|
+
</Label>
|
|
136
|
+
</Flex>
|
|
142
137
|
</Box>
|
|
143
138
|
</React.Fragment>
|
|
144
139
|
);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import React, { useLayoutEffect, useState } from 'react';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { Box, WizardStep } from '..';
|
|
13
|
+
import { WizardStepProps } from './WizardStep';
|
|
14
|
+
|
|
15
|
+
export interface WizardProps {
|
|
16
|
+
steps: WizardStepProps[];
|
|
17
|
+
activeStep?: number;
|
|
18
|
+
completed?: number[];
|
|
19
|
+
skipped?: number[];
|
|
20
|
+
className?: string;
|
|
21
|
+
titleAutofocus?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export const Wizard = React.forwardRef< HTMLDivElement, WizardProps >(
|
|
24
|
+
(
|
|
25
|
+
{ steps, activeStep, completed = [], skipped = [], className = null, titleAutofocus = false },
|
|
26
|
+
forwardRef
|
|
27
|
+
) => {
|
|
28
|
+
const [ didMount, setDidMount ] = useState( false );
|
|
29
|
+
const [ initialStep ] = useState( activeStep );
|
|
30
|
+
// didMount helps us to track the initial render, so we can focus the title only subsequent renders
|
|
31
|
+
// to avoid stealing the focus from the page we're in.
|
|
32
|
+
useLayoutEffect( () => {
|
|
33
|
+
if ( ! didMount && activeStep !== initialStep ) {
|
|
34
|
+
setDidMount( true );
|
|
35
|
+
}
|
|
36
|
+
}, [ initialStep, activeStep, didMount, setDidMount ] );
|
|
37
|
+
return (
|
|
38
|
+
<Box className={ classNames( 'vip-wizard-component', className ) } ref={ forwardRef }>
|
|
39
|
+
{ steps.map( ( { title, subTitle, children, titleVariant, summary, onChange }, index ) => (
|
|
40
|
+
<WizardStep
|
|
41
|
+
active={ index === activeStep }
|
|
42
|
+
complete={ completed.includes( index ) }
|
|
43
|
+
skipped={ skipped.includes( index ) }
|
|
44
|
+
key={ index }
|
|
45
|
+
order={ index + 1 }
|
|
46
|
+
totalSteps={ steps.length }
|
|
47
|
+
subTitle={ subTitle }
|
|
48
|
+
title={ title }
|
|
49
|
+
titleVariant={ titleVariant }
|
|
50
|
+
summary={ summary }
|
|
51
|
+
onChange={ onChange }
|
|
52
|
+
shouldFocusTitle={ titleAutofocus && didMount }
|
|
53
|
+
>
|
|
54
|
+
{ children }
|
|
55
|
+
</WizardStep>
|
|
56
|
+
) ) }
|
|
57
|
+
</Box>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
Wizard.displayName = 'Wizard';
|