@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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
declare function _default(theme: any): {
|
|
2
2
|
ValetTheme: any;
|
|
3
|
-
|
|
3
|
+
getPropValue: (prop: any, variant?: string) => any;
|
|
4
4
|
getVariants: (color: any) => {};
|
|
5
5
|
traverse: (root: any) => any;
|
|
6
6
|
resolvePath: (object: any, path: any, defaultValue: any) => any;
|
|
7
|
+
getHeadingStyles: () => {};
|
|
7
8
|
};
|
|
8
9
|
export default _default;
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
// https://www.figma.com/file/sILtW5Cs2tAnPWrSOEVyER/Productive-Color?node-id=1%3A17&t=4kHdpoprxntk5Ilw-0
|
|
7
7
|
|
|
8
8
|
export default theme => {
|
|
9
|
-
const
|
|
10
|
-
if ( ! theme[
|
|
9
|
+
const getPropValue = ( prop, variant = 'default' ) => {
|
|
10
|
+
if ( ! theme[ prop ] ) {
|
|
11
11
|
return '#000000';
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
return theme[
|
|
14
|
+
return theme[ prop ][ variant ].value;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
const resolvePath = ( object, path, defaultValue ) => {
|
|
@@ -43,11 +43,43 @@ export default theme => {
|
|
|
43
43
|
);
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
// We get the following format: '1', '2', '3', 'caps'.
|
|
47
|
+
// We need to build h1: {}, h2: {}, h3: {}, caps: {}.
|
|
48
|
+
const getHeadingStyles = () => {
|
|
49
|
+
const variantValues = getVariants( 'heading' );
|
|
50
|
+
|
|
51
|
+
const headingStyles = {};
|
|
52
|
+
const baseProps = {
|
|
53
|
+
fontWeight: 'heading',
|
|
54
|
+
color: 'heading',
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
Object.keys( variantValues ).forEach( variant => {
|
|
58
|
+
if ( variant === 'caps' ) {
|
|
59
|
+
headingStyles.caps = {
|
|
60
|
+
...variantValues[ variant ],
|
|
61
|
+
...baseProps,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if ( parseInt( variant, 10 ) > 0 ) {
|
|
66
|
+
headingStyles[ `h${ variant }` ] = {
|
|
67
|
+
...variantValues[ variant ],
|
|
68
|
+
...baseProps,
|
|
69
|
+
fontFamily: variant.toString() === '1' ? 'serif' : 'body',
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
} );
|
|
73
|
+
|
|
74
|
+
return headingStyles;
|
|
75
|
+
};
|
|
76
|
+
|
|
46
77
|
return {
|
|
47
78
|
ValetTheme: traverse( theme ),
|
|
48
|
-
|
|
79
|
+
getPropValue,
|
|
49
80
|
getVariants,
|
|
50
81
|
traverse,
|
|
51
82
|
resolvePath,
|
|
83
|
+
getHeadingStyles,
|
|
52
84
|
};
|
|
53
85
|
};
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
2
|
export { outline };
|
|
3
|
-
export let space:
|
|
3
|
+
export let space: {};
|
|
4
4
|
export { fonts };
|
|
5
|
-
export let fontSizes:
|
|
5
|
+
export let fontSizes: {};
|
|
6
6
|
export namespace fontWeights {
|
|
7
|
-
let body:
|
|
8
|
-
let heading:
|
|
9
|
-
let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
export { body_1 as body };
|
|
14
|
-
let heading_1: number;
|
|
15
|
-
export { heading_1 as heading };
|
|
7
|
+
let body: any;
|
|
8
|
+
let heading: any;
|
|
9
|
+
let regular: any;
|
|
10
|
+
let bold: any;
|
|
11
|
+
let medium: any;
|
|
12
|
+
let light: any;
|
|
16
13
|
}
|
|
14
|
+
export let lineHeights: {};
|
|
17
15
|
export namespace sizes {
|
|
18
16
|
let sidebar: number;
|
|
19
17
|
}
|
|
20
|
-
export let radii:
|
|
18
|
+
export let radii: {};
|
|
21
19
|
export namespace config {
|
|
22
20
|
let useColorSchemeMediaQuery: boolean;
|
|
23
21
|
}
|
|
24
22
|
export let initialColorModeName: string;
|
|
25
23
|
export let colors: any;
|
|
26
24
|
export namespace shadows {
|
|
27
|
-
let low: string;
|
|
28
|
-
let
|
|
29
|
-
|
|
25
|
+
export let low: string;
|
|
26
|
+
let medium_1: string;
|
|
27
|
+
export { medium_1 as medium };
|
|
28
|
+
export let high: string;
|
|
30
29
|
}
|
|
31
30
|
export namespace tag {
|
|
32
31
|
let gold: {};
|
|
@@ -182,7 +181,8 @@ declare namespace _default {
|
|
|
182
181
|
};
|
|
183
182
|
};
|
|
184
183
|
}
|
|
185
|
-
|
|
184
|
+
let text_1: {};
|
|
185
|
+
export { text_1 as text };
|
|
186
186
|
export namespace dialog {
|
|
187
187
|
export namespace modal {
|
|
188
188
|
export let position: string;
|
|
@@ -232,50 +232,6 @@ declare namespace _default {
|
|
|
232
232
|
}
|
|
233
233
|
export namespace styles {
|
|
234
234
|
let root: {
|
|
235
|
-
h1: {
|
|
236
|
-
fontSize: number;
|
|
237
|
-
marginBottom: number;
|
|
238
|
-
letterSpacing: string;
|
|
239
|
-
fontWeight: string;
|
|
240
|
-
fontFamily: string;
|
|
241
|
-
color: string;
|
|
242
|
-
};
|
|
243
|
-
h2: {
|
|
244
|
-
fontSize: number;
|
|
245
|
-
marginBottom: number;
|
|
246
|
-
letterSpacing: string;
|
|
247
|
-
fontWeight: number;
|
|
248
|
-
color: string;
|
|
249
|
-
};
|
|
250
|
-
h3: {
|
|
251
|
-
fontSize: number;
|
|
252
|
-
marginBottom: number;
|
|
253
|
-
letterSpacing: string;
|
|
254
|
-
lineHeight: number;
|
|
255
|
-
fontWeight: string;
|
|
256
|
-
color: string;
|
|
257
|
-
};
|
|
258
|
-
h4: {
|
|
259
|
-
fontSize: number;
|
|
260
|
-
marginBottom: number;
|
|
261
|
-
lineHeight: number;
|
|
262
|
-
fontWeight: string;
|
|
263
|
-
color: string;
|
|
264
|
-
};
|
|
265
|
-
h5: {
|
|
266
|
-
fontSize: number;
|
|
267
|
-
marginBottom: number;
|
|
268
|
-
lineHeight: number;
|
|
269
|
-
fontWeight: string;
|
|
270
|
-
color: string;
|
|
271
|
-
};
|
|
272
|
-
caps: {
|
|
273
|
-
fontSize: number;
|
|
274
|
-
marginBottom: number;
|
|
275
|
-
color: string;
|
|
276
|
-
fontWeight: string;
|
|
277
|
-
letterSpacing: string;
|
|
278
|
-
};
|
|
279
235
|
fontFamily: string;
|
|
280
236
|
lineHeight: string;
|
|
281
237
|
fontWeight: string;
|
|
@@ -312,11 +268,10 @@ declare namespace outline {
|
|
|
312
268
|
export { boxShadow_5 as boxShadow };
|
|
313
269
|
}
|
|
314
270
|
declare namespace fonts {
|
|
315
|
-
let
|
|
316
|
-
export {
|
|
317
|
-
let
|
|
318
|
-
export {
|
|
271
|
+
let body_1: string;
|
|
272
|
+
export { body_1 as body };
|
|
273
|
+
let heading_1: string;
|
|
274
|
+
export { heading_1 as heading };
|
|
319
275
|
export let monospace: string;
|
|
320
276
|
export let serif: string;
|
|
321
277
|
}
|
|
322
|
-
import { textStyles } from './textStyles';
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import ThemeBuilder from './
|
|
4
|
+
import ThemeBuilder from './getPropValue';
|
|
5
5
|
|
|
6
6
|
import Valet from './generated/valet-theme-light.json';
|
|
7
7
|
import ValetDark from './generated/valet-theme-dark.json';
|
|
8
8
|
import ColorBuilder from './colors';
|
|
9
|
-
import { textStyles } from './textStyles';
|
|
10
9
|
|
|
11
10
|
// Light
|
|
12
|
-
const {
|
|
11
|
+
const { getPropValue, getVariants, ValetTheme, getHeadingStyles } = ThemeBuilder( Valet );
|
|
13
12
|
const light = ColorBuilder( ValetTheme );
|
|
14
13
|
|
|
15
14
|
// Dark
|
|
16
15
|
const {
|
|
17
|
-
|
|
16
|
+
getPropValue: getPropValueDark,
|
|
18
17
|
getVariants: getVariantsDark,
|
|
19
18
|
ValetTheme: ValetThemeDark,
|
|
20
19
|
} = ThemeBuilder( ValetDark );
|
|
@@ -23,15 +22,17 @@ const dark = ColorBuilder( ValetThemeDark );
|
|
|
23
22
|
|
|
24
23
|
const outline = {
|
|
25
24
|
outlineStyle: 'solid',
|
|
26
|
-
outlineColor:
|
|
25
|
+
outlineColor: getPropValue( 'focus', 'inset' ),
|
|
27
26
|
outlineWidth: '1px',
|
|
28
|
-
boxShadow: `0 0 0 1px ${
|
|
27
|
+
boxShadow: `0 0 0 1px ${ getPropValue( 'focus', 'inset' ) }, 0 0 0 3px ${ getPropValue(
|
|
28
|
+
'focus'
|
|
29
|
+
) }`,
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
const fonts = {
|
|
32
|
-
body: '
|
|
33
|
+
body: '-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',
|
|
33
34
|
heading: 'inherit',
|
|
34
|
-
monospace: '
|
|
35
|
+
monospace: 'inherit',
|
|
35
36
|
serif: 'recoletaregular, Georgia, serif',
|
|
36
37
|
};
|
|
37
38
|
|
|
@@ -41,7 +42,6 @@ const getComponentColors = ( theme, gColor, gVariants ) => ( {
|
|
|
41
42
|
// This has to be in the plural because we already have a flag: text
|
|
42
43
|
texts: {
|
|
43
44
|
...theme.text,
|
|
44
|
-
disabled: '#716e6e',
|
|
45
45
|
},
|
|
46
46
|
|
|
47
47
|
button: {
|
|
@@ -175,18 +175,11 @@ const getComponentColors = ( theme, gColor, gVariants ) => ( {
|
|
|
175
175
|
secondary: light.gray[ '70' ],
|
|
176
176
|
muted: gColor( 'text', 'helper' ),
|
|
177
177
|
border: gColor( 'border', '1' ),
|
|
178
|
-
borders:
|
|
179
|
-
1: gColor( 'border', '1' ),
|
|
180
|
-
2: gColor( 'border', '2' ),
|
|
181
|
-
3: gColor( 'border', '3' ),
|
|
182
|
-
4: gColor( 'border', '4' ),
|
|
183
|
-
inverse: gColor( 'border', 'inverse' ),
|
|
184
|
-
accent: gColor( 'border', 'accent' ),
|
|
185
|
-
},
|
|
178
|
+
borders: gVariants( 'border' ),
|
|
186
179
|
hover: 'rgba(0,0,0,.02)',
|
|
187
180
|
darken: 'rgba(0,0,0,.05)',
|
|
188
181
|
placeholder: gVariants( 'input.text' ).placeholder,
|
|
189
|
-
midnight: '
|
|
182
|
+
midnight: gVariants( 'input.background' ).primary,
|
|
190
183
|
dialog: light.gray[ '0' ],
|
|
191
184
|
backgroundMuted: gColor( 'layer', '1' ),
|
|
192
185
|
|
|
@@ -201,60 +194,37 @@ const getComponentColors = ( theme, gColor, gVariants ) => ( {
|
|
|
201
194
|
|
|
202
195
|
// Link
|
|
203
196
|
link: gColor( 'link', 'default' ),
|
|
204
|
-
links:
|
|
205
|
-
default: gColor( 'link', 'default' ),
|
|
206
|
-
hover: gColor( 'link', 'hover' ),
|
|
207
|
-
active: gColor( 'link', 'active' ),
|
|
208
|
-
visited: gColor( 'link', 'visited' ),
|
|
209
|
-
},
|
|
197
|
+
links: gVariants( 'link' ),
|
|
210
198
|
} );
|
|
211
199
|
|
|
212
200
|
export default {
|
|
213
201
|
outline,
|
|
214
|
-
space:
|
|
202
|
+
space: getVariants( 'space' ),
|
|
215
203
|
fonts,
|
|
216
|
-
fontSizes:
|
|
204
|
+
fontSizes: getVariants( 'fontSize.static' ),
|
|
217
205
|
fontWeights: {
|
|
218
|
-
body:
|
|
219
|
-
heading:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
heading: 1.125,
|
|
206
|
+
body: getPropValue( 'fontWeight', 'body' ),
|
|
207
|
+
heading: getPropValue( 'fontWeight', 'heading' ),
|
|
208
|
+
regular: getPropValue( 'fontWeight', 'regular' ),
|
|
209
|
+
bold: getPropValue( 'fontWeight', 'bold' ),
|
|
210
|
+
medium: getPropValue( 'fontWeight', 'medium' ),
|
|
211
|
+
light: getPropValue( 'fontWeight', 'light' ),
|
|
225
212
|
},
|
|
213
|
+
lineHeights: getVariants( 'lineHeight' ),
|
|
226
214
|
sizes: {
|
|
227
215
|
sidebar: 260,
|
|
228
216
|
},
|
|
229
|
-
radii:
|
|
217
|
+
radii: getVariants( 'borderRadius.static' ),
|
|
230
218
|
config: {
|
|
231
219
|
useColorSchemeMediaQuery: false,
|
|
232
220
|
},
|
|
233
221
|
initialColorModeName: 'light',
|
|
234
222
|
colors: {
|
|
235
|
-
...getComponentColors( ValetTheme,
|
|
223
|
+
...getComponentColors( ValetTheme, getPropValue, getVariants ),
|
|
236
224
|
...light,
|
|
237
225
|
modes: {
|
|
238
226
|
dark: {
|
|
239
|
-
...getComponentColors( ValetThemeDark,
|
|
240
|
-
// text: dark.grey[ '90' ],
|
|
241
|
-
// heading: dark.grey[ '100' ],
|
|
242
|
-
// background: dark.grey[ '5' ],
|
|
243
|
-
// backgroundSecondary: dark.grey[ '10' ],
|
|
244
|
-
// primary: light.brand[ '70' ],
|
|
245
|
-
// secondary: '#30c',
|
|
246
|
-
// muted: dark.grey[ '90' ],
|
|
247
|
-
// link: dark.brand[ '90' ],
|
|
248
|
-
// card: dark.grey[ '20' ],
|
|
249
|
-
// placeholder: dark.grey[ '70' ],
|
|
250
|
-
// border: dark.grey[ '30' ],
|
|
251
|
-
// hover: 'rgba(255,255,255,.02)',
|
|
252
|
-
// midnight: dark.grey[ '90' ],
|
|
253
|
-
// success: dark.green[ '90' ],
|
|
254
|
-
// error: dark.red[ '90' ],
|
|
255
|
-
// warning: dark.yellow[ '90' ],
|
|
256
|
-
// dialog: dark.grey[ '40' ],
|
|
257
|
-
// backgroundMuted: dark.grey[ '10' ],
|
|
227
|
+
...getComponentColors( ValetThemeDark, getPropValueDark, getVariantsDark ),
|
|
258
228
|
...dark,
|
|
259
229
|
},
|
|
260
230
|
},
|
|
@@ -304,7 +274,7 @@ export default {
|
|
|
304
274
|
bg: 'button.primary.background.default',
|
|
305
275
|
border: '1px solid transparent',
|
|
306
276
|
cursor: 'pointer',
|
|
307
|
-
fontWeight: '
|
|
277
|
+
fontWeight: 'medium',
|
|
308
278
|
boxShadow: 'none',
|
|
309
279
|
borderRadius: 1,
|
|
310
280
|
'&:hover, &:focus': {
|
|
@@ -433,7 +403,7 @@ export default {
|
|
|
433
403
|
},
|
|
434
404
|
},
|
|
435
405
|
|
|
436
|
-
text:
|
|
406
|
+
text: getHeadingStyles(),
|
|
437
407
|
|
|
438
408
|
dialog: {
|
|
439
409
|
modal: {
|
|
@@ -494,7 +464,7 @@ export default {
|
|
|
494
464
|
p: {
|
|
495
465
|
color: 'text',
|
|
496
466
|
},
|
|
497
|
-
...
|
|
467
|
+
...getHeadingStyles(),
|
|
498
468
|
},
|
|
499
469
|
},
|
|
500
470
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/vip-design-system",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"main": "build/system/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build-storybook": "storybook build",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"theme-builder-copy-light": "mkdir -p build/system/theme/generated/ && cp src/system/theme/generated/valet-theme-light.json build/system/theme/generated/valet-theme-light.json",
|
|
21
21
|
"theme-builder-copy-dark": "mkdir -p build/system/theme/generated/ && cp src/system/theme/generated/valet-theme-dark.json build/system/theme/generated/valet-theme-dark.json",
|
|
22
22
|
"theme-update": "npm run theme-update-light && npm run theme-update-dark",
|
|
23
|
-
"theme-update-light": "token-transformer tokens/valet-core src/system/theme/generated/valet-theme-light.json valet-core,wpvip-
|
|
24
|
-
"theme-update-dark": "token-transformer tokens/valet-core src/system/theme/generated/valet-theme-dark.json valet-core,wpvip-
|
|
23
|
+
"theme-update-light": "token-transformer tokens/valet-core src/system/theme/generated/valet-theme-light.json valet-core,wpvip-product-core",
|
|
24
|
+
"theme-update-dark": "token-transformer tokens/valet-core src/system/theme/generated/valet-theme-dark.json valet-core,wpvip-product-core,wpvip-product-dark",
|
|
25
25
|
"lint": "npm run cmd:lint .",
|
|
26
26
|
"lint:fix": "npm run cmd:lint . -- --fix",
|
|
27
27
|
"storybook": "storybook dev -p 6006",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"react-dom": "18.2.0",
|
|
107
107
|
"storybook": "7.4.5",
|
|
108
108
|
"theme-ui": "0.16.0",
|
|
109
|
-
"token-transformer": "
|
|
109
|
+
"token-transformer": "0.0.33",
|
|
110
110
|
"typescript": "5.2.2"
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -53,7 +53,7 @@ const ExampleAccordion = () => (
|
|
|
53
53
|
export const Default = () => <ExampleAccordion />;
|
|
54
54
|
|
|
55
55
|
export const WithLargeText = () => (
|
|
56
|
-
<Box sx={ { '.vip-heading-component > button': { fontSize:
|
|
56
|
+
<Box sx={ { '.vip-heading-component > button': { fontSize: 4 } } }>
|
|
57
57
|
<ExampleAccordion />
|
|
58
58
|
</Box>
|
|
59
59
|
);
|
|
@@ -66,12 +66,12 @@ export const Item = ( { children, ...props }: AccordionItemProps ) => (
|
|
|
66
66
|
|
|
67
67
|
'&:first-of-type': {
|
|
68
68
|
borderTopWidth: '1px',
|
|
69
|
-
borderTopLeftRadius:
|
|
70
|
-
borderTopRightRadius:
|
|
69
|
+
borderTopLeftRadius: 1,
|
|
70
|
+
borderTopRightRadius: 1,
|
|
71
71
|
},
|
|
72
72
|
'&:last-child': {
|
|
73
|
-
borderBottomLeftRadius:
|
|
74
|
-
borderBottomRightRadius:
|
|
73
|
+
borderBottomLeftRadius: 1,
|
|
74
|
+
borderBottomRightRadius: 1,
|
|
75
75
|
},
|
|
76
76
|
'&:focus-within': ( theme: AccordionTheme ) => theme.outline,
|
|
77
77
|
} }
|
|
@@ -104,7 +104,7 @@ export const Trigger = React.forwardRef< HTMLButtonElement, TriggerProps >(
|
|
|
104
104
|
alignItems: 'center',
|
|
105
105
|
justifyContent: 'space-between',
|
|
106
106
|
fontSize: 1,
|
|
107
|
-
fontWeight:
|
|
107
|
+
fontWeight: 'bold',
|
|
108
108
|
|
|
109
109
|
'&[data-state="closed"]': {
|
|
110
110
|
backgroundColor: 'accordion.background.closed',
|
|
@@ -193,7 +193,7 @@ export const Root = React.forwardRef< HTMLDivElement, RootProps >(
|
|
|
193
193
|
type="single"
|
|
194
194
|
ref={ forwardRef }
|
|
195
195
|
sx={ {
|
|
196
|
-
borderRadius:
|
|
196
|
+
borderRadius: 2,
|
|
197
197
|
...sx,
|
|
198
198
|
} }
|
|
199
199
|
{ ...props }
|
|
@@ -27,7 +27,7 @@ export const Avatar = forwardRef< HTMLElement, AvatarImageProps >(
|
|
|
27
27
|
) => (
|
|
28
28
|
<Box
|
|
29
29
|
sx={ {
|
|
30
|
-
borderRadius:
|
|
30
|
+
borderRadius: '100%',
|
|
31
31
|
height: size + 2, // +2 to compensate padding on both sides
|
|
32
32
|
width: size + 2, // +2 to compensate padding on both sides
|
|
33
33
|
border: '2px solid',
|
|
@@ -38,7 +38,7 @@ export const Avatar = forwardRef< HTMLElement, AvatarImageProps >(
|
|
|
38
38
|
alignItems: 'center',
|
|
39
39
|
justifyContent: 'center',
|
|
40
40
|
color: 'white',
|
|
41
|
-
padding: '1px',
|
|
41
|
+
padding: '1px', // this should probably be replaced with a token
|
|
42
42
|
textAlign: 'center',
|
|
43
43
|
} }
|
|
44
44
|
className={ classNames( 'vip-avatar-component', className ) }
|
|
@@ -51,7 +51,7 @@ export const Avatar = forwardRef< HTMLElement, AvatarImageProps >(
|
|
|
51
51
|
src={ src }
|
|
52
52
|
alt={ `Avatar image from ${ name }` }
|
|
53
53
|
sx={ {
|
|
54
|
-
borderRadius:
|
|
54
|
+
borderRadius: '100%',
|
|
55
55
|
width: '100%',
|
|
56
56
|
display: 'block',
|
|
57
57
|
} }
|
|
@@ -10,8 +10,7 @@ import { BiCalendarHeart } from 'react-icons/bi';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import ScreenReaderText from '../ScreenReaderText';
|
|
13
|
-
import { Button } from '..';
|
|
14
|
-
import variants from './variants';
|
|
13
|
+
import { Button, ButtonVariant } from '..';
|
|
15
14
|
|
|
16
15
|
export default {
|
|
17
16
|
title: 'Button',
|
|
@@ -23,7 +22,7 @@ export default {
|
|
|
23
22
|
},
|
|
24
23
|
variant: {
|
|
25
24
|
type: 'select',
|
|
26
|
-
options:
|
|
25
|
+
options: Object.values( ButtonVariant ),
|
|
27
26
|
},
|
|
28
27
|
},
|
|
29
28
|
parameters: {
|
|
@@ -23,7 +23,7 @@ describe( '<Button />', () => {
|
|
|
23
23
|
expect( onClick ).toHaveBeenCalledTimes( 1 );
|
|
24
24
|
|
|
25
25
|
// Check for accessibility issues
|
|
26
|
-
|
|
26
|
+
expect( await axe( container ) ).toHaveNoViolations();
|
|
27
27
|
} );
|
|
28
28
|
|
|
29
29
|
it( 'renders the Button with disabled prop', async () => {
|
|
@@ -43,6 +43,6 @@ describe( '<Button />', () => {
|
|
|
43
43
|
expect( onClick ).toHaveBeenCalledTimes( 0 );
|
|
44
44
|
|
|
45
45
|
// Check for accessibility issues
|
|
46
|
-
|
|
46
|
+
expect( await axe( container ) ).toHaveNoViolations();
|
|
47
47
|
} );
|
|
48
48
|
} );
|
|
@@ -11,9 +11,21 @@ interface ButtonTheme extends Theme {
|
|
|
11
11
|
outline?: Record< string, string >;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
export enum ButtonVariant {
|
|
15
|
+
'danger',
|
|
16
|
+
'display',
|
|
17
|
+
'ghost',
|
|
18
|
+
'icon',
|
|
19
|
+
'primary',
|
|
20
|
+
'secondary',
|
|
21
|
+
'tertiary',
|
|
22
|
+
'text',
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
export interface ButtonProps extends ThemeButtonProps {
|
|
15
26
|
disabled?: boolean;
|
|
16
27
|
onClick?: ( event: ButtonClickType ) => void;
|
|
28
|
+
variant?: keyof typeof ButtonVariant; // converts the enum to a string union type
|
|
17
29
|
}
|
|
18
30
|
|
|
19
31
|
const Button = forwardRef< HTMLButtonElement, ButtonProps >(
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import type { StoryObj } from '@storybook/react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { ButtonSubmit } from '..';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: 'ButtonSubmit',
|
|
14
|
+
component: ButtonSubmit,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
type Story = StoryObj< typeof ButtonSubmit >;
|
|
18
|
+
|
|
19
|
+
export const Primary: Story = {
|
|
20
|
+
render: () => <ButtonSubmit label="Primary" variant="primary" sx={ { ml: 2 } } />,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Secondary: Story = {
|
|
24
|
+
render: () => <ButtonSubmit label="Secondary" variant="secondary" sx={ { ml: 2 } } />,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const Loading: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<ButtonSubmit label="Loading" loading={ true } variant="primary" sx={ { ml: 2 } } />
|
|
30
|
+
),
|
|
31
|
+
};
|
|
@@ -17,15 +17,15 @@ describe( '<ButtonSubmit />', () => {
|
|
|
17
17
|
it( 'renders the ButtonSubmit component', async () => {
|
|
18
18
|
const { container } = render( <ButtonSubmit { ...defaultProps } /> );
|
|
19
19
|
|
|
20
|
-
expect( screen.getByRole( 'button', {
|
|
20
|
+
expect( screen.getByRole( 'button', { name: 'Load more items' } ) ).toBeInTheDocument();
|
|
21
21
|
|
|
22
22
|
// Check for accessibility issues
|
|
23
|
-
|
|
23
|
+
expect( await axe( container ) ).toHaveNoViolations();
|
|
24
24
|
} );
|
|
25
25
|
|
|
26
|
-
it( 'renders the ButtonSubmit loading',
|
|
26
|
+
it( 'renders the ButtonSubmit loading', () => {
|
|
27
27
|
render( <ButtonSubmit { ...defaultProps } loading={ true } /> );
|
|
28
|
-
const button = screen.getByRole( 'button', {
|
|
28
|
+
const button = screen.getByRole( 'button', { name: 'Load more items Loading' } );
|
|
29
29
|
|
|
30
30
|
// Button
|
|
31
31
|
expect( button ).toHaveAttribute( 'aria-disabled', 'true' );
|