@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
|
@@ -29,6 +29,7 @@ exports["default"] = _default;
|
|
|
29
29
|
var Default = function Default() {
|
|
30
30
|
var steps = [{
|
|
31
31
|
title: 'Choose Domain',
|
|
32
|
+
titleVariant: 'h2',
|
|
32
33
|
subTitle: 'You can bring a domain name you already own, or buy a new one.',
|
|
33
34
|
children: (0, _jsxRuntime.jsxs)(_.Box, {
|
|
34
35
|
children: [(0, _jsxRuntime.jsx)(_.Label, {
|
|
@@ -41,45 +42,24 @@ var Default = function Default() {
|
|
|
41
42
|
})]
|
|
42
43
|
})
|
|
43
44
|
}, {
|
|
44
|
-
title: 'Configure DNS'
|
|
45
|
+
title: 'Configure DNS',
|
|
46
|
+
titleVariant: 'h2'
|
|
45
47
|
}, {
|
|
46
|
-
title: 'Configure Certificate'
|
|
48
|
+
title: 'Configure Certificate',
|
|
49
|
+
titleVariant: 'h2'
|
|
47
50
|
}, {
|
|
48
|
-
title: 'Verify Domain'
|
|
51
|
+
title: 'Verify Domain',
|
|
52
|
+
titleVariant: 'h2'
|
|
49
53
|
}];
|
|
50
|
-
return (0, _jsxRuntime.
|
|
51
|
-
children:
|
|
52
|
-
sx: {
|
|
53
|
-
alignItems: 'center'
|
|
54
|
-
},
|
|
55
|
-
children: (0, _jsxRuntime.jsx)(_.Box, {
|
|
56
|
-
sx: {
|
|
57
|
-
flex: '1 1 auto'
|
|
58
|
-
},
|
|
59
|
-
children: (0, _jsxRuntime.jsxs)(_.Heading, {
|
|
60
|
-
variant: "h1",
|
|
61
|
-
sx: {
|
|
62
|
-
display: 'flex',
|
|
63
|
-
alignItems: 'center',
|
|
64
|
-
mb: 1
|
|
65
|
-
},
|
|
66
|
-
children: ["Add Domain: ", (0, _jsxRuntime.jsx)("span", {
|
|
67
|
-
sx: {
|
|
68
|
-
color: 'muted',
|
|
69
|
-
ml: 2
|
|
70
|
-
},
|
|
71
|
-
children: "Production"
|
|
72
|
-
})]
|
|
73
|
-
})
|
|
74
|
-
})
|
|
75
|
-
}), (0, _jsxRuntime.jsx)(_.Box, {
|
|
54
|
+
return (0, _jsxRuntime.jsx)(_react["default"].Fragment, {
|
|
55
|
+
children: (0, _jsxRuntime.jsx)(_.Box, {
|
|
76
56
|
mt: 4,
|
|
77
57
|
children: (0, _jsxRuntime.jsx)(_.Wizard, {
|
|
78
58
|
activeStep: 0,
|
|
79
59
|
steps: steps,
|
|
80
60
|
className: "vip-wizard-xyz"
|
|
81
61
|
})
|
|
82
|
-
})
|
|
62
|
+
})
|
|
83
63
|
});
|
|
84
64
|
};
|
|
85
65
|
|
|
@@ -31,7 +31,9 @@ var WizardStep = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwa
|
|
|
31
31
|
complete = _ref$complete === void 0 ? false : _ref$complete,
|
|
32
32
|
children = _ref.children,
|
|
33
33
|
active = _ref.active,
|
|
34
|
-
order = _ref.order
|
|
34
|
+
order = _ref.order,
|
|
35
|
+
_ref$titleVariant = _ref.titleVariant,
|
|
36
|
+
titleVariant = _ref$titleVariant === void 0 ? 'h3' : _ref$titleVariant;
|
|
35
37
|
var borderLeftColor = 'border';
|
|
36
38
|
|
|
37
39
|
if (complete) {
|
|
@@ -49,6 +51,7 @@ var WizardStep = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwa
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
return (0, _jsxRuntime.jsxs)(_.Card, {
|
|
54
|
+
as: "section",
|
|
52
55
|
sx: {
|
|
53
56
|
boxShadow: active ? 'low' : 'none',
|
|
54
57
|
borderLeft: '2px solid',
|
|
@@ -68,12 +71,14 @@ var WizardStep = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwa
|
|
|
68
71
|
"data-active": active || undefined,
|
|
69
72
|
ref: forwardRef,
|
|
70
73
|
children: [typeof title === 'string' ? (0, _jsxRuntime.jsxs)(_.Heading, {
|
|
71
|
-
variant:
|
|
74
|
+
variant: titleVariant,
|
|
72
75
|
sx: {
|
|
73
76
|
mb: 0,
|
|
74
77
|
display: 'flex',
|
|
75
78
|
alignItems: 'center',
|
|
76
|
-
color: color
|
|
79
|
+
color: color,
|
|
80
|
+
fontSize: 2,
|
|
81
|
+
fontWeight: active ? 'bold' : 'normal'
|
|
77
82
|
},
|
|
78
83
|
children: [(0, _jsxRuntime.jsx)(_md.MdCheckCircle, {
|
|
79
84
|
"aria-hidden": "true",
|
|
@@ -109,5 +114,6 @@ WizardStep.propTypes = {
|
|
|
109
114
|
complete: _propTypes["default"].bool,
|
|
110
115
|
order: _propTypes["default"].number.isRequired,
|
|
111
116
|
subTitle: _propTypes["default"].node,
|
|
112
|
-
title: _propTypes["default"].node
|
|
117
|
+
title: _propTypes["default"].node,
|
|
118
|
+
titleVariant: _propTypes["default"].string
|
|
113
119
|
};
|
|
@@ -27,14 +27,17 @@ var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
|
27
27
|
var WizardStepHorizontal = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
|
|
28
28
|
var title = _ref.title,
|
|
29
29
|
active = _ref.active,
|
|
30
|
-
order = _ref.order
|
|
30
|
+
order = _ref.order,
|
|
31
|
+
_ref$titleVariant = _ref.titleVariant,
|
|
32
|
+
titleVariant = _ref$titleVariant === void 0 ? 'h3' : _ref$titleVariant;
|
|
31
33
|
var color = active ? 'heading' : 'muted';
|
|
32
34
|
return typeof title === 'string' ? (0, _jsxRuntime.jsxs)(_.Heading, {
|
|
33
|
-
variant:
|
|
35
|
+
variant: titleVariant,
|
|
34
36
|
sx: {
|
|
35
37
|
mb: 0,
|
|
36
38
|
display: 'flex',
|
|
37
39
|
alignItems: 'center',
|
|
40
|
+
fontSize: 2,
|
|
38
41
|
color: color
|
|
39
42
|
},
|
|
40
43
|
"data-step": order,
|
|
@@ -66,5 +69,6 @@ WizardStepHorizontal.propTypes = {
|
|
|
66
69
|
active: _propTypes["default"].bool,
|
|
67
70
|
order: _propTypes["default"].number.isRequired,
|
|
68
71
|
subTitle: _propTypes["default"].node,
|
|
69
|
-
title: _propTypes["default"].node
|
|
72
|
+
title: _propTypes["default"].node,
|
|
73
|
+
titleVariant: _propTypes["default"].string
|
|
70
74
|
};
|
package/build/system/index.js
CHANGED
|
@@ -81,6 +81,10 @@ exports.Select = _Form.Select;
|
|
|
81
81
|
exports.Textarea = _Form.Textarea;
|
|
82
82
|
exports.Checkbox = _Form.Checkbox;
|
|
83
83
|
|
|
84
|
+
var _Accordion = require("./Accordion");
|
|
85
|
+
|
|
86
|
+
exports.Accordion = _Accordion.Accordion;
|
|
87
|
+
|
|
84
88
|
var _Grid = require("./Grid");
|
|
85
89
|
|
|
86
90
|
exports.Grid = _Grid.Grid;
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports.getColor = void 0;
|
|
6
|
+
exports.getVariants = exports.getColor = void 0;
|
|
7
|
+
|
|
8
|
+
var _extends3 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
9
|
|
|
8
10
|
var _valetTheme = _interopRequireDefault(require("./generated/valet-theme.json"));
|
|
9
11
|
|
|
@@ -22,4 +24,21 @@ var getColor = function getColor(color, variant) {
|
|
|
22
24
|
return _valetTheme["default"][color][variant].value;
|
|
23
25
|
};
|
|
24
26
|
|
|
25
|
-
exports.getColor = getColor;
|
|
27
|
+
exports.getColor = getColor;
|
|
28
|
+
|
|
29
|
+
var resolvePath = function resolvePath(object, path, defaultValue) {
|
|
30
|
+
return path.split('.').reduce(function (acc, property) {
|
|
31
|
+
return acc ? acc[property] : defaultValue;
|
|
32
|
+
}, object);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
var getVariants = function getVariants(color) {
|
|
36
|
+
var property = resolvePath(_valetTheme["default"], color, {});
|
|
37
|
+
return Object.keys(property).reduce(function (variants, variant) {
|
|
38
|
+
var _extends2;
|
|
39
|
+
|
|
40
|
+
return (0, _extends3["default"])({}, variants, (_extends2 = {}, _extends2[variant] = property[variant].value, _extends2));
|
|
41
|
+
}, {});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.getVariants = getVariants;
|
|
@@ -98,6 +98,8 @@ var _default = {
|
|
|
98
98
|
text: (0, _getColor.getColor)('text', 'secondary'),
|
|
99
99
|
heading: (0, _getColor.getColor)('text', 'primary'),
|
|
100
100
|
background: (0, _getColor.getColor)('background', 'primary'),
|
|
101
|
+
gold: (0, _getColor.getVariants)('color.gold'),
|
|
102
|
+
gray: (0, _getColor.getVariants)('color.gray'),
|
|
101
103
|
backgroundSecondary: _colors.light.grey['10'],
|
|
102
104
|
primary: _colors.light.brand['70'],
|
|
103
105
|
secondary: '#30c',
|
|
@@ -163,6 +165,9 @@ var _default = {
|
|
|
163
165
|
high: // eslint-disable-next-line max-len
|
|
164
166
|
'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)'
|
|
165
167
|
},
|
|
168
|
+
tag: {
|
|
169
|
+
gold: (0, _getColor.getVariants)('tag.gold')
|
|
170
|
+
},
|
|
166
171
|
cards: {
|
|
167
172
|
primary: {
|
|
168
173
|
padding: 3,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/vip-design-system",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"main": "build/system/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build-storybook": "build-storybook",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"watch": "npm run build -- --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"@radix-ui/react-accordion": "^1.0.1",
|
|
23
24
|
"@radix-ui/react-checkbox": "^1.0.0",
|
|
24
25
|
"@radix-ui/react-dialog": "^1.0.0",
|
|
25
26
|
"@radix-ui/react-dropdown-menu": "^1.0.1-rc.6",
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { MdChevronRight } from 'react-icons/md';
|
|
9
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
10
|
+
import { keyframes } from '@emotion/react';
|
|
11
|
+
import classNames from 'classnames';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import { Heading } from '../Heading';
|
|
17
|
+
|
|
18
|
+
const slideDown = keyframes( {
|
|
19
|
+
from: { height: 0 },
|
|
20
|
+
to: { height: 'var(--radix-accordion-content-height)' },
|
|
21
|
+
} );
|
|
22
|
+
|
|
23
|
+
const slideUp = keyframes( {
|
|
24
|
+
from: { height: 'var(--radix-accordion-content-height)' },
|
|
25
|
+
to: { height: 0 },
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
export const Item = ( { children, ...props } ) => (
|
|
29
|
+
<AccordionPrimitive.Item
|
|
30
|
+
{ ...props }
|
|
31
|
+
sx={ {
|
|
32
|
+
overflow: 'hidden',
|
|
33
|
+
borderWidth: '0 1px 1px 1px',
|
|
34
|
+
borderStyle: 'solid',
|
|
35
|
+
borderColor: 'border',
|
|
36
|
+
|
|
37
|
+
'&:first-of-type': {
|
|
38
|
+
borderTopWidth: '1px',
|
|
39
|
+
borderTopLeftRadius: 4,
|
|
40
|
+
borderTopRightRadius: 4,
|
|
41
|
+
},
|
|
42
|
+
'&:last-child': {
|
|
43
|
+
borderBottomLeftRadius: 4,
|
|
44
|
+
borderBottomRightRadius: 4,
|
|
45
|
+
},
|
|
46
|
+
'&:focus-within': theme => theme.outline,
|
|
47
|
+
} }
|
|
48
|
+
>
|
|
49
|
+
{ children }
|
|
50
|
+
</AccordionPrimitive.Item>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
Item.displayName = 'Accordion.Item';
|
|
54
|
+
|
|
55
|
+
Item.propTypes = {
|
|
56
|
+
children: PropTypes.node.isRequired,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const Trigger = React.forwardRef(
|
|
60
|
+
( { children, headingVariant = 'h3', ...props }, forwardedRef ) => (
|
|
61
|
+
<Heading
|
|
62
|
+
sx={ {
|
|
63
|
+
all: 'unset',
|
|
64
|
+
display: 'flex',
|
|
65
|
+
} }
|
|
66
|
+
variant={ headingVariant }
|
|
67
|
+
>
|
|
68
|
+
<AccordionPrimitive.Trigger
|
|
69
|
+
sx={ {
|
|
70
|
+
color: 'heading',
|
|
71
|
+
cursor: 'pointer',
|
|
72
|
+
all: 'unset',
|
|
73
|
+
fontFamily: 'inherit',
|
|
74
|
+
px: 3,
|
|
75
|
+
height: 45,
|
|
76
|
+
flex: 1,
|
|
77
|
+
display: 'flex',
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
justifyContent: 'space-between',
|
|
80
|
+
fontSize: 1,
|
|
81
|
+
fontWeight: 600,
|
|
82
|
+
textTransform: 'uppercase',
|
|
83
|
+
|
|
84
|
+
'&[data-state="closed"]': { backgroundColor: 'transparent' },
|
|
85
|
+
'&[data-state="open"]': {
|
|
86
|
+
backgroundColor: 'backgroundSecondary',
|
|
87
|
+
borderBottom: theme => `1px solid ${ theme.colors.border }`,
|
|
88
|
+
},
|
|
89
|
+
'&:hover': { backgroundColor: 'backgroundSecondary' },
|
|
90
|
+
} }
|
|
91
|
+
{ ...props }
|
|
92
|
+
ref={ forwardedRef }
|
|
93
|
+
>
|
|
94
|
+
{ children }
|
|
95
|
+
<MdChevronRight
|
|
96
|
+
sx={ {
|
|
97
|
+
fontSize: 3,
|
|
98
|
+
color: 'text',
|
|
99
|
+
transform: 'rotate(90deg)',
|
|
100
|
+
transition: 'transform 300ms cubic-bezier(0.87, 0, 0.13, 1)',
|
|
101
|
+
'[data-state=open] &': { transform: 'rotate(270deg)' },
|
|
102
|
+
} }
|
|
103
|
+
aria-hidden
|
|
104
|
+
/>
|
|
105
|
+
</AccordionPrimitive.Trigger>
|
|
106
|
+
</Heading>
|
|
107
|
+
)
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
Trigger.displayName = 'Accordion.Trigger';
|
|
111
|
+
|
|
112
|
+
Trigger.propTypes = {
|
|
113
|
+
children: PropTypes.node.isRequired,
|
|
114
|
+
headingVariant: PropTypes.string,
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const TriggerWithIcon = React.forwardRef( ( { children, icon, ...props }, forwardedRef ) => (
|
|
118
|
+
<Trigger { ...props } ref={ forwardedRef }>
|
|
119
|
+
<span sx={ { color: 'text', fontSize: 3 } }>{ icon }</span>
|
|
120
|
+
<div sx={ { color: 'heading', flexGrow: 1, textAlign: 'left', ml: 3 } }>{ children }</div>
|
|
121
|
+
</Trigger>
|
|
122
|
+
) );
|
|
123
|
+
|
|
124
|
+
TriggerWithIcon.displayName = 'Accordion.TriggerWithIcon';
|
|
125
|
+
|
|
126
|
+
TriggerWithIcon.propTypes = {
|
|
127
|
+
children: PropTypes.node.isRequired,
|
|
128
|
+
icon: PropTypes.node.isRequired,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const Content = React.forwardRef( ( { children, sx = {}, ...props }, forwardedRef ) => {
|
|
132
|
+
return (
|
|
133
|
+
<AccordionPrimitive.Content
|
|
134
|
+
sx={ {
|
|
135
|
+
backgroundColor: 'transparent',
|
|
136
|
+
color: 'text',
|
|
137
|
+
fontSize: 2,
|
|
138
|
+
overflow: 'hidden',
|
|
139
|
+
|
|
140
|
+
'&[data-state="open"]': {
|
|
141
|
+
animation: `${ slideDown } 300ms cubic-bezier(0.87, 0, 0.13, 1)`,
|
|
142
|
+
},
|
|
143
|
+
'&[data-state="closed"]': {
|
|
144
|
+
animation: `${ slideUp } 300ms cubic-bezier(0.87, 0, 0.13, 1)`,
|
|
145
|
+
},
|
|
146
|
+
...sx,
|
|
147
|
+
} }
|
|
148
|
+
{ ...props }
|
|
149
|
+
ref={ forwardedRef }
|
|
150
|
+
>
|
|
151
|
+
<div
|
|
152
|
+
sx={ {
|
|
153
|
+
px: 3,
|
|
154
|
+
py: 2,
|
|
155
|
+
} }
|
|
156
|
+
>
|
|
157
|
+
{ children }
|
|
158
|
+
</div>
|
|
159
|
+
</AccordionPrimitive.Content>
|
|
160
|
+
);
|
|
161
|
+
} );
|
|
162
|
+
|
|
163
|
+
Content.displayName = 'Accordion.Content';
|
|
164
|
+
|
|
165
|
+
Content.propTypes = {
|
|
166
|
+
children: PropTypes.node.isRequired,
|
|
167
|
+
sx: PropTypes.object,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const Root = React.forwardRef(
|
|
171
|
+
( { sx = {}, defaultValue, type, children, className }, forwardRef ) => (
|
|
172
|
+
<AccordionPrimitive.Root
|
|
173
|
+
className={ classNames( 'vip-accordion-component', className ) }
|
|
174
|
+
collapsible
|
|
175
|
+
defaultValue={ defaultValue }
|
|
176
|
+
ref={ forwardRef }
|
|
177
|
+
sx={ {
|
|
178
|
+
borderRadius: 6,
|
|
179
|
+
...sx,
|
|
180
|
+
} }
|
|
181
|
+
type={ type }
|
|
182
|
+
>
|
|
183
|
+
{ children }
|
|
184
|
+
</AccordionPrimitive.Root>
|
|
185
|
+
)
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
Root.displayName = 'Accordion';
|
|
189
|
+
|
|
190
|
+
Root.propTypes = {
|
|
191
|
+
children: PropTypes.node,
|
|
192
|
+
className: PropTypes.any,
|
|
193
|
+
defaultValue: PropTypes.any,
|
|
194
|
+
sx: PropTypes.object,
|
|
195
|
+
type: PropTypes.oneOf( [ 'single', 'multiple' ] ),
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export { Root };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { RiUserAddLine, RiCodeSSlashFill } from 'react-icons/ri';
|
|
7
|
+
import { BiBookContent } from 'react-icons/bi';
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { Box, Accordion } from '..';
|
|
12
|
+
|
|
13
|
+
export default {
|
|
14
|
+
title: 'Accordion',
|
|
15
|
+
component: Accordion,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const ExampleContent = () => (
|
|
19
|
+
<Box>
|
|
20
|
+
<p sx={ { mt: 0 } }>Add your key team members to the VIP Dashboard.</p>
|
|
21
|
+
<p>Add developers to GitHub.</p>
|
|
22
|
+
<p sx={ { mb: 0 } }>Add content editors and developers to WordPress admin.</p>
|
|
23
|
+
</Box>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const Default = () => (
|
|
27
|
+
<Box>
|
|
28
|
+
<Accordion.Root defaultValue="teamPermissions" sx={ { width: '450px' } }>
|
|
29
|
+
<Accordion.Item value="teamPermissions">
|
|
30
|
+
<Accordion.TriggerWithIcon icon={ <RiUserAddLine /> }>
|
|
31
|
+
Team & Permissions
|
|
32
|
+
</Accordion.TriggerWithIcon>
|
|
33
|
+
<Accordion.Content>
|
|
34
|
+
<ExampleContent />
|
|
35
|
+
</Accordion.Content>
|
|
36
|
+
</Accordion.Item>
|
|
37
|
+
<Accordion.Item value="addContentMedia">
|
|
38
|
+
<Accordion.TriggerWithIcon icon={ <BiBookContent /> }>
|
|
39
|
+
Add Content & Media
|
|
40
|
+
</Accordion.TriggerWithIcon>
|
|
41
|
+
<Accordion.Content>
|
|
42
|
+
<ExampleContent />
|
|
43
|
+
</Accordion.Content>
|
|
44
|
+
</Accordion.Item>
|
|
45
|
+
<Accordion.Item value="addCode">
|
|
46
|
+
<Accordion.TriggerWithIcon icon={ <RiCodeSSlashFill /> }>
|
|
47
|
+
Add Code
|
|
48
|
+
</Accordion.TriggerWithIcon>
|
|
49
|
+
<Accordion.Content>
|
|
50
|
+
<ExampleContent />
|
|
51
|
+
</Accordion.Content>
|
|
52
|
+
</Accordion.Item>
|
|
53
|
+
</Accordion.Root>
|
|
54
|
+
</Box>
|
|
55
|
+
);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
7
|
+
import { axe } from 'jest-axe';
|
|
8
|
+
import { ThemeProvider } from 'theme-ui';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import * as Accordion from './Accordion';
|
|
14
|
+
import { theme } from '../';
|
|
15
|
+
|
|
16
|
+
const renderWithTheme = children =>
|
|
17
|
+
render( <ThemeProvider theme={ theme }>{ children }</ThemeProvider> );
|
|
18
|
+
|
|
19
|
+
const renderComponent = () =>
|
|
20
|
+
renderWithTheme(
|
|
21
|
+
<Accordion.Root defaultValue="one" sx={ { width: '400px' } }>
|
|
22
|
+
<Accordion.Item value="one">
|
|
23
|
+
<Accordion.Trigger>trigger one</Accordion.Trigger>
|
|
24
|
+
<Accordion.Content>content one</Accordion.Content>
|
|
25
|
+
</Accordion.Item>
|
|
26
|
+
<Accordion.Item value="two">
|
|
27
|
+
<Accordion.Trigger>trigger two</Accordion.Trigger>
|
|
28
|
+
<Accordion.Content>content two</Accordion.Content>
|
|
29
|
+
</Accordion.Item>
|
|
30
|
+
</Accordion.Root>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
describe( '<Accordion />', () => {
|
|
34
|
+
it( 'renders the Accordion component with default value visible', async () => {
|
|
35
|
+
const { container } = renderComponent();
|
|
36
|
+
|
|
37
|
+
// Should find the open content
|
|
38
|
+
expect( screen.getByText( 'content one' ) ).toBeInTheDocument();
|
|
39
|
+
|
|
40
|
+
// Should not find the closed content
|
|
41
|
+
expect( screen.queryByText( 'content two' ) ).toBeNull();
|
|
42
|
+
|
|
43
|
+
// Check for accessibility issues
|
|
44
|
+
await expect( await axe( container ) ).toHaveNoViolations();
|
|
45
|
+
} );
|
|
46
|
+
|
|
47
|
+
it( 'should open the content when clicking on its trigger', async () => {
|
|
48
|
+
const { container } = renderComponent();
|
|
49
|
+
|
|
50
|
+
fireEvent.click( screen.getByRole( 'button', { name: 'trigger two' } ) );
|
|
51
|
+
|
|
52
|
+
// Should find the open content
|
|
53
|
+
expect( screen.queryByText( 'content one' ) ).toBeNull();
|
|
54
|
+
|
|
55
|
+
// Should not find the closed content
|
|
56
|
+
expect( screen.queryByText( 'content two' ) ).toBeInTheDocument();
|
|
57
|
+
|
|
58
|
+
// Check for accessibility issues
|
|
59
|
+
await expect( await axe( container ) ).toHaveNoViolations();
|
|
60
|
+
} );
|
|
61
|
+
} );
|
package/src/system/Link/Link.js
CHANGED
|
@@ -10,9 +10,9 @@ import PropTypes from 'prop-types';
|
|
|
10
10
|
const Link = React.forwardRef( ( { active = false, sx, ...props }, forwardRef ) => (
|
|
11
11
|
<ThemeLink
|
|
12
12
|
sx={ {
|
|
13
|
-
color: active ? 'links.active' : 'link',
|
|
14
13
|
textDdecorationThickness: '0.1em',
|
|
15
14
|
textUnderlineOffset: '0.1em',
|
|
15
|
+
color: active ? 'links.active' : 'link',
|
|
16
16
|
'&:visited': {
|
|
17
17
|
color: 'links.visited',
|
|
18
18
|
},
|
|
@@ -74,7 +74,16 @@ const Notice = React.forwardRef(
|
|
|
74
74
|
color: `${ color }.90`,
|
|
75
75
|
a: {
|
|
76
76
|
color: `${ color }.90`,
|
|
77
|
-
|
|
77
|
+
'&:visited': {
|
|
78
|
+
color: `${ color }.90`,
|
|
79
|
+
},
|
|
80
|
+
'&:active': {
|
|
81
|
+
color: `${ color }.90`,
|
|
82
|
+
},
|
|
83
|
+
'&:hover, &:focus': {
|
|
84
|
+
color: `${ color }.90`,
|
|
85
|
+
textDecoration: 'none',
|
|
86
|
+
},
|
|
78
87
|
},
|
|
79
88
|
...sx,
|
|
80
89
|
} }
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Internal dependencies
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import { Notice, Text } from '..';
|
|
9
|
+
import { Notice, Text, Link } from '..';
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
title: 'Notice',
|
|
@@ -27,7 +27,8 @@ export const Default = () => (
|
|
|
27
27
|
</Notice>
|
|
28
28
|
|
|
29
29
|
<Notice variant="success" sx={ { mb: 4 } }>
|
|
30
|
-
It looks like you‘re ready to share your
|
|
30
|
+
It looks like you‘re ready to share your{ ' ' }
|
|
31
|
+
<Link href="https://google.com/">application with the world.</Link>
|
|
31
32
|
</Notice>
|
|
32
33
|
|
|
33
34
|
<Notice sx={ { mb: 4 } } title="This notice has only the title prop passed" />
|
|
@@ -43,7 +43,7 @@ const Wizard = React.forwardRef(
|
|
|
43
43
|
{ steps[ activeStep ].children }
|
|
44
44
|
</Box>
|
|
45
45
|
) : (
|
|
46
|
-
steps.map( ( { title, subTitle, children }, index ) => (
|
|
46
|
+
steps.map( ( { title, subTitle, children, titleVariant }, index ) => (
|
|
47
47
|
<WizardStep
|
|
48
48
|
active={ index === activeStep }
|
|
49
49
|
complete={ completed.includes( index ) }
|
|
@@ -51,6 +51,7 @@ const Wizard = React.forwardRef(
|
|
|
51
51
|
order={ index + 1 }
|
|
52
52
|
subTitle={ subTitle }
|
|
53
53
|
title={ title }
|
|
54
|
+
titleVariant={ titleVariant }
|
|
54
55
|
>
|
|
55
56
|
{ children }
|
|
56
57
|
</WizardStep>
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
-
import { Wizard,
|
|
11
|
+
import { Wizard, Box, Label, Input, Button } from '..';
|
|
12
12
|
|
|
13
13
|
export default {
|
|
14
14
|
title: 'Wizard',
|
|
@@ -19,6 +19,7 @@ export const Default = () => {
|
|
|
19
19
|
const steps = [
|
|
20
20
|
{
|
|
21
21
|
title: 'Choose Domain',
|
|
22
|
+
titleVariant: 'h2',
|
|
22
23
|
subTitle: 'You can bring a domain name you already own, or buy a new one.',
|
|
23
24
|
children: (
|
|
24
25
|
<Box>
|
|
@@ -30,23 +31,19 @@ export const Default = () => {
|
|
|
30
31
|
},
|
|
31
32
|
{
|
|
32
33
|
title: 'Configure DNS',
|
|
34
|
+
titleVariant: 'h2',
|
|
33
35
|
},
|
|
34
36
|
{
|
|
35
37
|
title: 'Configure Certificate',
|
|
38
|
+
titleVariant: 'h2',
|
|
36
39
|
},
|
|
37
40
|
{
|
|
38
41
|
title: 'Verify Domain',
|
|
42
|
+
titleVariant: 'h2',
|
|
39
43
|
},
|
|
40
44
|
];
|
|
41
45
|
return (
|
|
42
46
|
<React.Fragment>
|
|
43
|
-
<Flex sx={ { alignItems: 'center' } }>
|
|
44
|
-
<Box sx={ { flex: '1 1 auto' } }>
|
|
45
|
-
<Heading variant="h1" sx={ { display: 'flex', alignItems: 'center', mb: 1 } }>
|
|
46
|
-
Add Domain: <span sx={ { color: 'muted', ml: 2 } }>Production</span>
|
|
47
|
-
</Heading>
|
|
48
|
-
</Box>
|
|
49
|
-
</Flex>
|
|
50
47
|
<Box mt={ 4 }>
|
|
51
48
|
<Wizard activeStep={ 0 } steps={ steps } className="vip-wizard-xyz" />
|
|
52
49
|
</Box>
|