@automattic/vip-design-system 0.23.6 → 0.24.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.
- package/build/system/Accordion/Accordion.js +246 -0
- package/build/system/Accordion/Accordion.stories.js +83 -0
- package/build/system/Accordion/Accordion.test.js +129 -0
- package/build/system/Accordion/index.js +12 -0
- package/build/system/Form/MultiSelect.js +38 -0
- package/build/system/Link/Link.js +1 -1
- package/build/system/Notice/Notice.js +10 -1
- package/build/system/Notice/Notice.stories.js +2 -2
- package/build/system/ResourceList/ResourceList.js +1 -1
- package/build/system/UsageChart/UsageChart.js +60 -0
- package/build/system/UsageChart/index.js +7 -0
- package/build/system/Wizard/Wizard.js +3 -1
- package/build/system/Wizard/Wizard.stories.js +10 -30
- package/build/system/Wizard/WizardStep.js +10 -4
- package/build/system/Wizard/WizardStepHorizontal.js +7 -3
- package/build/system/index.js +4 -0
- package/build/system/theme/getColor.js +21 -2
- package/build/system/theme/index.js +5 -0
- package/package.json +2 -1
- package/src/system/Accordion/Accordion.js +198 -0
- package/src/system/Accordion/Accordion.stories.jsx +55 -0
- package/src/system/Accordion/Accordion.test.js +61 -0
- package/src/system/Accordion/index.js +6 -0
- package/src/system/Link/Link.js +1 -1
- package/src/system/Notice/Notice.js +10 -1
- package/src/system/Notice/Notice.stories.jsx +3 -2
- package/src/system/Wizard/Wizard.js +2 -1
- package/src/system/Wizard/Wizard.stories.jsx +5 -8
- package/src/system/Wizard/WizardStep.js +10 -3
- package/src/system/Wizard/WizardStepHorizontal.js +29 -25
- package/src/system/index.js +2 -0
- package/src/system/theme/getColor.js +14 -0
- package/src/system/theme/index.js +7 -1
|
@@ -13,7 +13,10 @@ import PropTypes from 'prop-types';
|
|
|
13
13
|
import { Card, Heading, Text, Flex } from '..';
|
|
14
14
|
|
|
15
15
|
const WizardStep = React.forwardRef(
|
|
16
|
-
(
|
|
16
|
+
(
|
|
17
|
+
{ title, subTitle, complete = false, children, active, order, titleVariant = 'h3' },
|
|
18
|
+
forwardRef
|
|
19
|
+
) => {
|
|
17
20
|
let borderLeftColor = 'border';
|
|
18
21
|
|
|
19
22
|
if ( complete ) {
|
|
@@ -32,6 +35,7 @@ const WizardStep = React.forwardRef(
|
|
|
32
35
|
|
|
33
36
|
return (
|
|
34
37
|
<Card
|
|
38
|
+
as="section"
|
|
35
39
|
sx={ {
|
|
36
40
|
boxShadow: active ? 'low' : 'none',
|
|
37
41
|
borderLeft: '2px solid',
|
|
@@ -53,12 +57,14 @@ const WizardStep = React.forwardRef(
|
|
|
53
57
|
>
|
|
54
58
|
{ typeof title === 'string' ? (
|
|
55
59
|
<Heading
|
|
56
|
-
variant=
|
|
60
|
+
variant={ titleVariant }
|
|
57
61
|
sx={ {
|
|
58
62
|
mb: 0,
|
|
59
63
|
display: 'flex',
|
|
60
64
|
alignItems: 'center',
|
|
61
|
-
color
|
|
65
|
+
color,
|
|
66
|
+
fontSize: 2,
|
|
67
|
+
fontWeight: active ? 'bold' : 'normal',
|
|
62
68
|
} }
|
|
63
69
|
>
|
|
64
70
|
<MdCheckCircle aria-hidden="true" sx={ { mr: 2 } } />
|
|
@@ -88,6 +94,7 @@ WizardStep.propTypes = {
|
|
|
88
94
|
order: PropTypes.number.isRequired,
|
|
89
95
|
subTitle: PropTypes.node,
|
|
90
96
|
title: PropTypes.node,
|
|
97
|
+
titleVariant: PropTypes.string,
|
|
91
98
|
};
|
|
92
99
|
|
|
93
100
|
export { WizardStep };
|
|
@@ -12,32 +12,35 @@ import PropTypes from 'prop-types';
|
|
|
12
12
|
*/
|
|
13
13
|
import { Heading, Flex } from '..';
|
|
14
14
|
|
|
15
|
-
const WizardStepHorizontal = React.forwardRef(
|
|
16
|
-
|
|
15
|
+
const WizardStepHorizontal = React.forwardRef(
|
|
16
|
+
( { title, active, order, titleVariant = 'h3' }, forwardRef ) => {
|
|
17
|
+
const color = active ? 'heading' : 'muted';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
19
|
+
return typeof title === 'string' ? (
|
|
20
|
+
<Heading
|
|
21
|
+
variant={ titleVariant }
|
|
22
|
+
sx={ {
|
|
23
|
+
mb: 0,
|
|
24
|
+
display: 'flex',
|
|
25
|
+
alignItems: 'center',
|
|
26
|
+
fontSize: 2,
|
|
27
|
+
color,
|
|
28
|
+
} }
|
|
29
|
+
data-step={ order }
|
|
30
|
+
data-active={ active || undefined }
|
|
31
|
+
ref={ forwardRef }
|
|
32
|
+
>
|
|
33
|
+
<MdCheckCircle aria-hidden="true" sx={ { mr: 2 } } />
|
|
34
|
+
{ title }
|
|
35
|
+
</Heading>
|
|
36
|
+
) : (
|
|
37
|
+
<Flex sx={ { alignItems: 'center', color } }>
|
|
38
|
+
<MdCheckCircle aria-hidden="true" sx={ { mr: 2 } } />
|
|
39
|
+
{ title }
|
|
40
|
+
</Flex>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
41
44
|
|
|
42
45
|
WizardStepHorizontal.displayName = 'WizardStepHorizontal';
|
|
43
46
|
|
|
@@ -46,6 +49,7 @@ WizardStepHorizontal.propTypes = {
|
|
|
46
49
|
order: PropTypes.number.isRequired,
|
|
47
50
|
subTitle: PropTypes.node,
|
|
48
51
|
title: PropTypes.node,
|
|
52
|
+
titleVariant: PropTypes.string,
|
|
49
53
|
};
|
|
50
54
|
|
|
51
55
|
export { WizardStepHorizontal };
|
package/src/system/index.js
CHANGED
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
Textarea,
|
|
39
39
|
Checkbox,
|
|
40
40
|
} from './Form';
|
|
41
|
+
import { Accordion } from './Accordion';
|
|
41
42
|
import { Grid } from './Grid';
|
|
42
43
|
import { Heading } from './Heading';
|
|
43
44
|
import { Link } from './Link';
|
|
@@ -56,6 +57,7 @@ import theme from './theme';
|
|
|
56
57
|
import { Wizard, WizardStep, WizardStepHorizontal } from './Wizard';
|
|
57
58
|
|
|
58
59
|
export {
|
|
60
|
+
Accordion,
|
|
59
61
|
Avatar,
|
|
60
62
|
Badge,
|
|
61
63
|
Box,
|
|
@@ -11,3 +11,17 @@ export const getColor = ( color, variant = 'default' ) => {
|
|
|
11
11
|
|
|
12
12
|
return Valet[ color ][ variant ].value;
|
|
13
13
|
};
|
|
14
|
+
|
|
15
|
+
const resolvePath = ( object, path, defaultValue ) => {
|
|
16
|
+
return path.split( '.' ).reduce( ( acc, property ) => {
|
|
17
|
+
return acc ? acc[ property ] : defaultValue;
|
|
18
|
+
}, object );
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const getVariants = color => {
|
|
22
|
+
const property = resolvePath( Valet, color, {} );
|
|
23
|
+
|
|
24
|
+
return Object.keys( property ).reduce( ( variants, variant ) => {
|
|
25
|
+
return { ...variants, [ variant ]: property[ variant ].value };
|
|
26
|
+
}, {} );
|
|
27
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { light, dark } from './colors';
|
|
5
|
-
import { getColor } from './getColor';
|
|
5
|
+
import { getColor, getVariants } from './getColor';
|
|
6
6
|
|
|
7
7
|
const textStyles = {
|
|
8
8
|
h1: {
|
|
@@ -90,6 +90,8 @@ export default {
|
|
|
90
90
|
text: getColor( 'text', 'secondary' ),
|
|
91
91
|
heading: getColor( 'text', 'primary' ),
|
|
92
92
|
background: getColor( 'background', 'primary' ),
|
|
93
|
+
gold: getVariants( 'color.gold' ),
|
|
94
|
+
gray: getVariants( 'color.gray' ),
|
|
93
95
|
backgroundSecondary: light.grey[ '10' ],
|
|
94
96
|
primary: light.brand[ '70' ],
|
|
95
97
|
secondary: '#30c',
|
|
@@ -160,6 +162,10 @@ export default {
|
|
|
160
162
|
'0px 2.76726px 2.21381px rgba(0, 0, 0, 0.0196802), 0px 6.6501px 5.32008px rgba(0, 0, 0, 0.0282725), 0px 12.5216px 10.0172px rgba(0, 0, 0, 0.035), 0px 22.3363px 17.869px rgba(0, 0, 0, 0.0417275), 0px 41.7776px 33.4221px rgba(0, 0, 0, 0.0503198), 0px 100px 80px rgba(0, 0, 0, 0.07)',
|
|
161
163
|
},
|
|
162
164
|
|
|
165
|
+
tag: {
|
|
166
|
+
gold: getVariants( 'tag.gold' ),
|
|
167
|
+
},
|
|
168
|
+
|
|
163
169
|
cards: {
|
|
164
170
|
primary: {
|
|
165
171
|
padding: 3,
|