@automattic/vip-design-system 0.33.2 → 0.33.4
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 +4 -2
- package/build/system/Accordion/Accordion.stories.js +48 -33
- package/build/system/Form/Label.js +12 -4
- package/build/system/Form/RadioBoxGroup.js +7 -7
- package/build/system/NewForm/FormAutocompleteMultiselect.js +0 -5
- package/build/system/Table/Table.js +19 -2
- package/build/system/Table/Table.stories.js +1 -2
- package/build/system/Wizard/Wizard.js +11 -2
- package/build/system/Wizard/Wizard.stories.js +35 -32
- package/build/system/Wizard/WizardStep.js +132 -46
- package/build/system/theme/generated/valet-theme.json +8 -26
- package/build/system/theme/index.js +27 -0
- package/build/system/utils/random.js +8 -0
- package/package.json +2 -2
- package/src/system/Accordion/Accordion.js +3 -1
- package/src/system/Accordion/Accordion.stories.jsx +32 -28
- package/src/system/Form/Label.js +21 -16
- package/src/system/Form/RadioBoxGroup.js +6 -3
- package/src/system/NewForm/FormAutocompleteMultiselect.js +0 -6
- package/src/system/Table/Table.js +24 -4
- package/src/system/Table/Table.stories.jsx +0 -1
- package/src/system/Wizard/Wizard.js +7 -1
- package/src/system/Wizard/Wizard.stories.jsx +29 -18
- package/src/system/Wizard/WizardStep.js +113 -38
- package/src/system/theme/index.js +27 -0
- package/src/system/utils/random.js +3 -0
- package/build/system/ResourceList/ResourceItem.js +0 -89
- package/build/system/ResourceList/ResourceList.js +0 -140
- package/build/system/ResourceList/ResourceList.stories.js +0 -379
- package/build/system/ResourceList/index.js +0 -11
|
@@ -104,7 +104,7 @@ var Trigger = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, forward
|
|
|
104
104
|
all: 'unset',
|
|
105
105
|
fontFamily: 'inherit',
|
|
106
106
|
px: 3,
|
|
107
|
-
|
|
107
|
+
minHeight: 45,
|
|
108
108
|
flex: 1,
|
|
109
109
|
display: 'flex',
|
|
110
110
|
alignItems: 'center',
|
|
@@ -134,7 +134,9 @@ var Trigger = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, forward
|
|
|
134
134
|
fontSize: 3,
|
|
135
135
|
color: 'icon.primary',
|
|
136
136
|
transform: 'rotate(90deg)',
|
|
137
|
-
transition: 'transform 300ms cubic-bezier(0.87, 0, 0.13, 1)'
|
|
137
|
+
transition: 'transform 300ms cubic-bezier(0.87, 0, 0.13, 1)',
|
|
138
|
+
minHeight: '20px',
|
|
139
|
+
minWidth: '20px'
|
|
138
140
|
},
|
|
139
141
|
"aria-hidden": true
|
|
140
142
|
})]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Default = void 0;
|
|
4
|
+
exports["default"] = exports.WithLargeText = exports.Default = void 0;
|
|
5
5
|
|
|
6
6
|
var _ri = require("react-icons/ri");
|
|
7
7
|
|
|
@@ -44,40 +44,55 @@ var ExampleContent = function ExampleContent() {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
var ExampleAccordion = function ExampleAccordion() {
|
|
48
|
+
return (0, _jsxRuntime.jsxs)(_.Accordion.Root, {
|
|
49
|
+
defaultValue: "teamPermissions",
|
|
50
|
+
sx: {
|
|
51
|
+
width: '250px'
|
|
52
|
+
},
|
|
53
|
+
children: [(0, _jsxRuntime.jsxs)(_.Accordion.Item, {
|
|
54
|
+
value: "teamPermissions",
|
|
55
|
+
children: [(0, _jsxRuntime.jsx)(_.Accordion.TriggerWithIcon, {
|
|
56
|
+
icon: (0, _jsxRuntime.jsx)(_ri.RiUserAddLine, {}),
|
|
57
|
+
children: "Team & Permissions"
|
|
58
|
+
}), (0, _jsxRuntime.jsx)(_.Accordion.Content, {
|
|
59
|
+
children: (0, _jsxRuntime.jsx)(ExampleContent, {})
|
|
60
|
+
})]
|
|
61
|
+
}), (0, _jsxRuntime.jsxs)(_.Accordion.Item, {
|
|
62
|
+
value: "addContentMedia",
|
|
63
|
+
children: [(0, _jsxRuntime.jsx)(_.Accordion.TriggerWithIcon, {
|
|
64
|
+
icon: (0, _jsxRuntime.jsx)(_bi.BiBookContent, {}),
|
|
65
|
+
children: "Add Content & Media"
|
|
66
|
+
}), (0, _jsxRuntime.jsx)(_.Accordion.Content, {
|
|
67
|
+
children: (0, _jsxRuntime.jsx)(ExampleContent, {})
|
|
68
|
+
})]
|
|
69
|
+
}), (0, _jsxRuntime.jsxs)(_.Accordion.Item, {
|
|
70
|
+
value: "addCode",
|
|
71
|
+
children: [(0, _jsxRuntime.jsx)(_.Accordion.TriggerWithIcon, {
|
|
72
|
+
icon: (0, _jsxRuntime.jsx)(_ri.RiCodeSSlashFill, {}),
|
|
73
|
+
children: "Add Code"
|
|
74
|
+
}), (0, _jsxRuntime.jsx)(_.Accordion.Content, {
|
|
75
|
+
children: (0, _jsxRuntime.jsx)(ExampleContent, {})
|
|
76
|
+
})]
|
|
77
|
+
})]
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
|
|
47
81
|
var Default = function Default() {
|
|
82
|
+
return (0, _jsxRuntime.jsx)(ExampleAccordion, {});
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
exports.Default = Default;
|
|
86
|
+
|
|
87
|
+
var WithLargeText = function WithLargeText() {
|
|
48
88
|
return (0, _jsxRuntime.jsx)(_.Box, {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
value: "teamPermissions",
|
|
56
|
-
children: [(0, _jsxRuntime.jsx)(_.Accordion.TriggerWithIcon, {
|
|
57
|
-
icon: (0, _jsxRuntime.jsx)(_ri.RiUserAddLine, {}),
|
|
58
|
-
children: "Team & Permissions"
|
|
59
|
-
}), (0, _jsxRuntime.jsx)(_.Accordion.Content, {
|
|
60
|
-
children: (0, _jsxRuntime.jsx)(ExampleContent, {})
|
|
61
|
-
})]
|
|
62
|
-
}), (0, _jsxRuntime.jsxs)(_.Accordion.Item, {
|
|
63
|
-
value: "addContentMedia",
|
|
64
|
-
children: [(0, _jsxRuntime.jsx)(_.Accordion.TriggerWithIcon, {
|
|
65
|
-
icon: (0, _jsxRuntime.jsx)(_bi.BiBookContent, {}),
|
|
66
|
-
children: "Add Content & Media"
|
|
67
|
-
}), (0, _jsxRuntime.jsx)(_.Accordion.Content, {
|
|
68
|
-
children: (0, _jsxRuntime.jsx)(ExampleContent, {})
|
|
69
|
-
})]
|
|
70
|
-
}), (0, _jsxRuntime.jsxs)(_.Accordion.Item, {
|
|
71
|
-
value: "addCode",
|
|
72
|
-
children: [(0, _jsxRuntime.jsx)(_.Accordion.TriggerWithIcon, {
|
|
73
|
-
icon: (0, _jsxRuntime.jsx)(_ri.RiCodeSSlashFill, {}),
|
|
74
|
-
children: "Add Code"
|
|
75
|
-
}), (0, _jsxRuntime.jsx)(_.Accordion.Content, {
|
|
76
|
-
children: (0, _jsxRuntime.jsx)(ExampleContent, {})
|
|
77
|
-
})]
|
|
78
|
-
})]
|
|
79
|
-
})
|
|
89
|
+
sx: {
|
|
90
|
+
'.vip-heading-component > button': {
|
|
91
|
+
fontSize: '25px'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
children: (0, _jsxRuntime.jsx)(ExampleAccordion, {})
|
|
80
95
|
});
|
|
81
96
|
};
|
|
82
97
|
|
|
83
|
-
exports.
|
|
98
|
+
exports.WithLargeText = WithLargeText;
|
|
@@ -13,11 +13,13 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
13
13
|
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
|
|
16
|
+
var _themeUi = require("theme-ui");
|
|
17
|
+
|
|
16
18
|
var _RequiredLabel = require("./RequiredLabel");
|
|
17
19
|
|
|
18
20
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
19
21
|
|
|
20
|
-
var _excluded = ["sx", "children", "required"];
|
|
22
|
+
var _excluded = ["sx", "children", "required", "as"];
|
|
21
23
|
var baseLabelColor = 'input.label.default';
|
|
22
24
|
exports.baseLabelColor = baseLabelColor;
|
|
23
25
|
var baseLabelStyle = {
|
|
@@ -32,9 +34,14 @@ var Label = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef
|
|
|
32
34
|
var sx = _ref.sx,
|
|
33
35
|
children = _ref.children,
|
|
34
36
|
required = _ref.required,
|
|
37
|
+
_ref$as = _ref.as,
|
|
38
|
+
as = _ref$as === void 0 ? 'label' : _ref$as,
|
|
35
39
|
rest = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
36
|
-
return (0, _jsxRuntime.jsxs)(
|
|
37
|
-
|
|
40
|
+
return (0, _jsxRuntime.jsxs)(_themeUi.Box, (0, _extends2["default"])({
|
|
41
|
+
as: as,
|
|
42
|
+
sx: (0, _extends2["default"])({
|
|
43
|
+
all: 'unset'
|
|
44
|
+
}, baseLabelStyle, {
|
|
38
45
|
display: 'block',
|
|
39
46
|
mb: 2
|
|
40
47
|
}, sx),
|
|
@@ -48,6 +55,7 @@ exports.Label = Label;
|
|
|
48
55
|
Label.propTypes = {
|
|
49
56
|
children: _propTypes["default"].any,
|
|
50
57
|
required: _propTypes["default"].bool,
|
|
51
|
-
sx: _propTypes["default"].object
|
|
58
|
+
sx: _propTypes["default"].object,
|
|
59
|
+
as: _propTypes["default"].node
|
|
52
60
|
};
|
|
53
61
|
Label.displayName = 'Label';
|
|
@@ -15,10 +15,10 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
15
15
|
|
|
16
16
|
var _ScreenReaderText = _interopRequireDefault(require("../ScreenReaderText"));
|
|
17
17
|
|
|
18
|
-
var _Label = require("./Label");
|
|
19
|
-
|
|
20
18
|
var _Validation = require("./Validation");
|
|
21
19
|
|
|
20
|
+
var _RequiredLabel = require("./RequiredLabel");
|
|
21
|
+
|
|
22
22
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
23
23
|
|
|
24
24
|
var _excluded = ["id", "value", "className", "label", "description", "labelProps"],
|
|
@@ -171,15 +171,15 @@ var RadioBoxGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, f
|
|
|
171
171
|
borderColor: 'input.border.error',
|
|
172
172
|
borderRadius: 2
|
|
173
173
|
} : {}),
|
|
174
|
-
ref: forwardRef
|
|
174
|
+
ref: forwardRef,
|
|
175
|
+
"aria-required": required,
|
|
176
|
+
role: "radiogroup"
|
|
175
177
|
}, props, {
|
|
176
|
-
children: [groupLabel ? (0, _jsxRuntime.
|
|
177
|
-
as: "legend",
|
|
178
|
+
children: [groupLabel ? (0, _jsxRuntime.jsxs)("legend", {
|
|
178
179
|
sx: {
|
|
179
180
|
mb: 2
|
|
180
181
|
},
|
|
181
|
-
|
|
182
|
-
children: groupLabel
|
|
182
|
+
children: [groupLabel, required ? (0, _jsxRuntime.jsx)(_RequiredLabel.RequiredLabel, {}) : null]
|
|
183
183
|
}) : (0, _jsxRuntime.jsx)(_ScreenReaderText["default"], {
|
|
184
184
|
children: "Choose an option"
|
|
185
185
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
@@ -33,8 +33,6 @@ var _Form = require("../Form");
|
|
|
33
33
|
|
|
34
34
|
var _ = require("../");
|
|
35
35
|
|
|
36
|
-
var _ScreenReaderText = _interopRequireDefault(require("../ScreenReaderText"));
|
|
37
|
-
|
|
38
36
|
var _md = require("react-icons/md");
|
|
39
37
|
|
|
40
38
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
@@ -195,10 +193,7 @@ var SelectedOptions = function SelectedOptions(_ref2) {
|
|
|
195
193
|
textOverflow: 'ellipsis',
|
|
196
194
|
whiteSpace: 'nowrap'
|
|
197
195
|
},
|
|
198
|
-
"aria-hidden": "true",
|
|
199
196
|
children: option
|
|
200
|
-
}), (0, _jsxRuntime.jsxs)(_ScreenReaderText["default"], {
|
|
201
|
-
children: [option + " selected. Press Space or Enter to remove.", index === 0 ? ' Press Shift Tab to add more.' : '']
|
|
202
197
|
}), (0, _jsxRuntime.jsx)(_md.MdClose, {
|
|
203
198
|
sx: {
|
|
204
199
|
ml: 2
|
|
@@ -9,7 +9,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
|
|
12
|
-
var _react =
|
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
|
|
@@ -19,10 +19,16 @@ var _ScreenReaderText = require("../ScreenReaderText/ScreenReaderText");
|
|
|
19
19
|
|
|
20
20
|
var _ = require("../");
|
|
21
21
|
|
|
22
|
+
var _random = require("../utils/random");
|
|
23
|
+
|
|
22
24
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
23
25
|
|
|
24
26
|
var _excluded = ["sx", "className", "children", "caption"];
|
|
25
27
|
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
26
32
|
var Table = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
|
|
27
33
|
var sx = _ref.sx,
|
|
28
34
|
className = _ref.className,
|
|
@@ -36,21 +42,32 @@ var Table = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef
|
|
|
36
42
|
console.warn('[A11Y] Please, add a caption to your table.');
|
|
37
43
|
}
|
|
38
44
|
|
|
45
|
+
var captionId = (0, _react.useMemo)(function () {
|
|
46
|
+
return "table_caption_" + (0, _random.generateId)();
|
|
47
|
+
}, []);
|
|
39
48
|
return (0, _jsxRuntime.jsx)(_.Box, {
|
|
49
|
+
className: (0, _classnames["default"])('vip-table-component', className),
|
|
40
50
|
sx: {
|
|
41
51
|
width: '100%',
|
|
42
52
|
overflowX: 'auto'
|
|
43
53
|
},
|
|
54
|
+
role: "region",
|
|
55
|
+
ariaLabelledby: captionId // Because this container is scrollable, it needs to be focusable.
|
|
56
|
+
// A tabIndex value of 0 makes it focusable by keyboard and does not
|
|
57
|
+
// interfere with the tab order.
|
|
58
|
+
,
|
|
59
|
+
tabIndex: 0,
|
|
44
60
|
children: (0, _jsxRuntime.jsxs)("table", (0, _extends2["default"])({
|
|
45
61
|
sx: (0, _extends2["default"])({
|
|
46
62
|
width: '100%',
|
|
47
63
|
minWidth: '1024px',
|
|
48
64
|
borderSpacing: 0
|
|
49
65
|
}, sx),
|
|
50
|
-
className: (0, _classnames["default"])('vip-table-component', className),
|
|
66
|
+
className: (0, _classnames["default"])('vip-table-component-element', className),
|
|
51
67
|
ref: forwardRef
|
|
52
68
|
}, props, {
|
|
53
69
|
children: [caption && (0, _jsxRuntime.jsx)("caption", {
|
|
70
|
+
id: captionId,
|
|
54
71
|
sx: _ScreenReaderText.screenReaderTextClass,
|
|
55
72
|
children: caption
|
|
56
73
|
}), children]
|
|
@@ -51,8 +51,7 @@ var ExampleTable = function ExampleTable(_ref) {
|
|
|
51
51
|
children: "2s"
|
|
52
52
|
}, "duration"), (0, _jsxRuntime.jsx)(_.Text, {
|
|
53
53
|
children: "11th Mar 2020, 16:49:22"
|
|
54
|
-
}, "time")]
|
|
55
|
-
gbc: true
|
|
54
|
+
}, "time")]
|
|
56
55
|
}), (0, _jsxRuntime.jsxs)(_.TableRow, {
|
|
57
56
|
children: [(0, _jsxRuntime.jsx)(_.TableCell, {
|
|
58
57
|
children: (0, _jsxRuntime.jsx)(_.Flex, {
|
|
@@ -21,7 +21,7 @@ var _ = require("..");
|
|
|
21
21
|
|
|
22
22
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
23
23
|
|
|
24
|
-
var _excluded = ["steps", "activeStep", "variant", "completed", "className", "titleAutofocus"];
|
|
24
|
+
var _excluded = ["steps", "activeStep", "variant", "completed", "skipped", "className", "titleAutofocus"];
|
|
25
25
|
|
|
26
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
27
|
|
|
@@ -33,6 +33,8 @@ var Wizard = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRe
|
|
|
33
33
|
variant = _ref.variant,
|
|
34
34
|
_ref$completed = _ref.completed,
|
|
35
35
|
completed = _ref$completed === void 0 ? [] : _ref$completed,
|
|
36
|
+
_ref$skipped = _ref.skipped,
|
|
37
|
+
skipped = _ref$skipped === void 0 ? [] : _ref$skipped,
|
|
36
38
|
_ref$className = _ref.className,
|
|
37
39
|
className = _ref$className === void 0 ? null : _ref$className,
|
|
38
40
|
_ref$titleAutofocus = _ref.titleAutofocus,
|
|
@@ -86,14 +88,20 @@ var Wizard = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRe
|
|
|
86
88
|
var title = _ref3.title,
|
|
87
89
|
subTitle = _ref3.subTitle,
|
|
88
90
|
children = _ref3.children,
|
|
89
|
-
titleVariant = _ref3.titleVariant
|
|
91
|
+
titleVariant = _ref3.titleVariant,
|
|
92
|
+
summary = _ref3.summary,
|
|
93
|
+
onChange = _ref3.onChange;
|
|
90
94
|
return (0, _jsxRuntime.jsx)(_.WizardStep, {
|
|
91
95
|
active: index === activeStep,
|
|
92
96
|
complete: completed.includes(index),
|
|
97
|
+
skipped: skipped.includes(index),
|
|
93
98
|
order: index + 1,
|
|
99
|
+
totalSteps: steps.length,
|
|
94
100
|
subTitle: subTitle,
|
|
95
101
|
title: title,
|
|
96
102
|
titleVariant: titleVariant,
|
|
103
|
+
summary: summary,
|
|
104
|
+
onChange: onChange,
|
|
97
105
|
shouldFocusTitle: titleAutofocus && didMount,
|
|
98
106
|
children: children
|
|
99
107
|
}, index);
|
|
@@ -108,6 +116,7 @@ Wizard.propTypes = {
|
|
|
108
116
|
activeStep: _propTypes["default"].number,
|
|
109
117
|
variant: _propTypes["default"].string,
|
|
110
118
|
completed: _propTypes["default"].array,
|
|
119
|
+
skipped: _propTypes["default"].array,
|
|
111
120
|
className: _propTypes["default"].any,
|
|
112
121
|
titleAutofocus: _propTypes["default"].bool
|
|
113
122
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports["default"] = exports.WithTitleAutoFocus = exports.Default =
|
|
6
|
+
exports["default"] = exports.WithTitleAutoFocus = exports.Default = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -76,6 +76,7 @@ var Default = function Default() {
|
|
|
76
76
|
children: (0, _jsxRuntime.jsx)(_.Wizard, {
|
|
77
77
|
activeStep: 0,
|
|
78
78
|
steps: steps,
|
|
79
|
+
completed: [1],
|
|
79
80
|
className: "vip-wizard-xyz"
|
|
80
81
|
})
|
|
81
82
|
})
|
|
@@ -96,6 +97,13 @@ var WithTitleAutoFocus = function WithTitleAutoFocus() {
|
|
|
96
97
|
var steps = [{
|
|
97
98
|
title: 'Choose Domain',
|
|
98
99
|
titleVariant: 'h2',
|
|
100
|
+
summary: [{
|
|
101
|
+
label: 'Demo Label',
|
|
102
|
+
value: 'Demo value'
|
|
103
|
+
}],
|
|
104
|
+
onChange: function onChange() {
|
|
105
|
+
return setActiveStep(0);
|
|
106
|
+
},
|
|
99
107
|
children: (0, _jsxRuntime.jsxs)(_.Box, {
|
|
100
108
|
children: [(0, _jsxRuntime.jsx)(_.Label, {
|
|
101
109
|
children: "Domain"
|
|
@@ -114,6 +122,9 @@ var WithTitleAutoFocus = function WithTitleAutoFocus() {
|
|
|
114
122
|
}, {
|
|
115
123
|
title: 'Configure DNS',
|
|
116
124
|
titleVariant: 'h2',
|
|
125
|
+
onChange: function onChange() {
|
|
126
|
+
return setActiveStep(1);
|
|
127
|
+
},
|
|
117
128
|
children: (0, _jsxRuntime.jsxs)(_.Box, {
|
|
118
129
|
children: [(0, _jsxRuntime.jsx)(_.Label, {
|
|
119
130
|
children: "DNS"
|
|
@@ -127,11 +138,33 @@ var WithTitleAutoFocus = function WithTitleAutoFocus() {
|
|
|
127
138
|
children: "back"
|
|
128
139
|
})]
|
|
129
140
|
})
|
|
141
|
+
}, {
|
|
142
|
+
title: 'Certificate',
|
|
143
|
+
titleVariant: 'h2',
|
|
144
|
+
summary: [{
|
|
145
|
+
label: 'Certificate status',
|
|
146
|
+
value: 'Not found'
|
|
147
|
+
}],
|
|
148
|
+
onChange: function onChange() {
|
|
149
|
+
return setActiveStep(2);
|
|
150
|
+
},
|
|
151
|
+
children: (0, _jsxRuntime.jsxs)(_.Box, {
|
|
152
|
+
children: [(0, _jsxRuntime.jsx)(_.Label, {
|
|
153
|
+
children: "Certificate validation"
|
|
154
|
+
}), (0, _jsxRuntime.jsx)(_.Button, {
|
|
155
|
+
sx: {
|
|
156
|
+
mt: 3
|
|
157
|
+
},
|
|
158
|
+
children: "Check certificate"
|
|
159
|
+
})]
|
|
160
|
+
})
|
|
130
161
|
}];
|
|
131
162
|
return (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
|
|
132
163
|
children: [(0, _jsxRuntime.jsx)(_.Box, {
|
|
133
164
|
mt: 4,
|
|
134
165
|
children: (0, _jsxRuntime.jsx)(_.Wizard, {
|
|
166
|
+
completed: [0, 1],
|
|
167
|
+
skipped: [2],
|
|
135
168
|
activeStep: activeStep,
|
|
136
169
|
steps: steps,
|
|
137
170
|
titleAutofocus: autoFocus,
|
|
@@ -159,34 +192,4 @@ var WithTitleAutoFocus = function WithTitleAutoFocus() {
|
|
|
159
192
|
});
|
|
160
193
|
};
|
|
161
194
|
|
|
162
|
-
exports.WithTitleAutoFocus = WithTitleAutoFocus;
|
|
163
|
-
|
|
164
|
-
var CustomTitle = function CustomTitle() {
|
|
165
|
-
var steps = [{
|
|
166
|
-
title: (0, _jsxRuntime.jsx)("h3", {
|
|
167
|
-
sx: {
|
|
168
|
-
m: 0
|
|
169
|
-
},
|
|
170
|
-
children: "Choose Domain"
|
|
171
|
-
}),
|
|
172
|
-
subTitle: (0, _jsxRuntime.jsx)("span", {
|
|
173
|
-
children: "You can bring a domain name you already own, or buy a new one."
|
|
174
|
-
})
|
|
175
|
-
}, {
|
|
176
|
-
title: (0, _jsxRuntime.jsx)("h3", {
|
|
177
|
-
sx: {
|
|
178
|
-
m: 0
|
|
179
|
-
},
|
|
180
|
-
children: "Configure DNS"
|
|
181
|
-
})
|
|
182
|
-
}];
|
|
183
|
-
return (0, _jsxRuntime.jsx)(_react["default"].Fragment, {
|
|
184
|
-
children: (0, _jsxRuntime.jsx)(_.Wizard, {
|
|
185
|
-
activeStep: 0,
|
|
186
|
-
steps: steps,
|
|
187
|
-
className: "vip-wizard-xyz"
|
|
188
|
-
})
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
exports.CustomTitle = CustomTitle;
|
|
195
|
+
exports.WithTitleAutoFocus = WithTitleAutoFocus;
|
|
@@ -7,12 +7,14 @@ exports.WizardStep = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _bs = require("react-icons/bs");
|
|
11
11
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
|
|
14
14
|
var _ = require("..");
|
|
15
15
|
|
|
16
|
+
var _ScreenReaderText = require("../ScreenReaderText");
|
|
17
|
+
|
|
16
18
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
17
19
|
|
|
18
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -31,33 +33,45 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
31
33
|
var WizardStep = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwardRef) {
|
|
32
34
|
var title = _ref.title,
|
|
33
35
|
subTitle = _ref.subTitle,
|
|
36
|
+
_ref$skipped = _ref.skipped,
|
|
37
|
+
skipped = _ref$skipped === void 0 ? false : _ref$skipped,
|
|
34
38
|
_ref$complete = _ref.complete,
|
|
35
39
|
complete = _ref$complete === void 0 ? false : _ref$complete,
|
|
36
40
|
children = _ref.children,
|
|
37
41
|
active = _ref.active,
|
|
38
42
|
order = _ref.order,
|
|
43
|
+
totalSteps = _ref.totalSteps,
|
|
39
44
|
shouldFocusTitle = _ref.shouldFocusTitle,
|
|
40
45
|
_ref$titleVariant = _ref.titleVariant,
|
|
41
|
-
titleVariant = _ref$titleVariant === void 0 ? 'h3' : _ref$titleVariant
|
|
46
|
+
titleVariant = _ref$titleVariant === void 0 ? 'h3' : _ref$titleVariant,
|
|
47
|
+
summary = _ref.summary,
|
|
48
|
+
onChange = _ref.onChange;
|
|
42
49
|
|
|
43
50
|
var titleRef = _react["default"].useRef(null);
|
|
44
51
|
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
var status = 'inactive';
|
|
53
|
+
var statusText = 'Step not completed';
|
|
54
|
+
|
|
55
|
+
if (active) {
|
|
56
|
+
status = 'active';
|
|
57
|
+
statusText = ''; // not adding the status text for active step since it's announced by aria-current
|
|
58
|
+
} else if (complete) {
|
|
59
|
+
status = 'complete';
|
|
60
|
+
statusText = 'Step completed';
|
|
61
|
+
} else if (skipped) {
|
|
62
|
+
status = 'skipped';
|
|
63
|
+
statusText = 'Step skipped';
|
|
51
64
|
}
|
|
52
65
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (complete) {
|
|
56
|
-
color = 'success';
|
|
57
|
-
} else if (active) {
|
|
58
|
-
color = 'heading';
|
|
66
|
+
if (statusText !== '') {
|
|
67
|
+
statusText = "Status: " + statusText;
|
|
59
68
|
}
|
|
60
69
|
|
|
70
|
+
var stepText = "Step " + order + " of " + totalSteps;
|
|
71
|
+
var borderLeftColor = "wizard.step.border." + status;
|
|
72
|
+
var statusIconColor = "wizard.step.icon." + status;
|
|
73
|
+
var headingColor = "wizard.step.heading." + status;
|
|
74
|
+
var StatusIcon = complete ? _bs.BsFillCheckCircleFill : _bs.BsCircleFill;
|
|
61
75
|
(0, _react.useLayoutEffect)(function () {
|
|
62
76
|
if (active && titleRef != null && titleRef.current && shouldFocusTitle) {
|
|
63
77
|
titleRef.current.focus();
|
|
@@ -74,50 +88,115 @@ var WizardStep = /*#__PURE__*/_react["default"].forwardRef(function (_ref, forwa
|
|
|
74
88
|
borderBottom: active ? 'none' : '1px solid',
|
|
75
89
|
'&:first-of-type': {
|
|
76
90
|
borderTopWidth: '1px',
|
|
77
|
-
borderTopStyle: 'solid'
|
|
78
|
-
borderTopColor: 'borders.2'
|
|
91
|
+
borderTopStyle: 'solid'
|
|
79
92
|
},
|
|
80
|
-
borderColor:
|
|
93
|
+
borderColor: 'wizard.step.border.default',
|
|
81
94
|
borderLeftColor: borderLeftColor,
|
|
82
95
|
overflow: 'inherit'
|
|
83
96
|
},
|
|
84
97
|
"data-step": order,
|
|
85
98
|
"data-active": active || undefined,
|
|
86
|
-
ref: forwardRef
|
|
87
|
-
|
|
88
|
-
|
|
99
|
+
ref: forwardRef // aria-current={ active ? 'step' : undefined }
|
|
100
|
+
,
|
|
101
|
+
children: [(0, _jsxRuntime.jsxs)(_.Flex, {
|
|
89
102
|
sx: {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
alignItems: 'center',
|
|
93
|
-
color: color,
|
|
94
|
-
fontSize: 2,
|
|
95
|
-
fontWeight: active ? 'bold' : 'normal'
|
|
103
|
+
alignItems: 'flex-end',
|
|
104
|
+
mb: 2
|
|
96
105
|
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
children: [(0, _jsxRuntime.jsx)(_md.MdCheckCircle, {
|
|
100
|
-
"aria-hidden": "true",
|
|
106
|
+
children: [(0, _jsxRuntime.jsxs)(_.Heading, {
|
|
107
|
+
variant: titleVariant,
|
|
101
108
|
sx: {
|
|
102
|
-
|
|
103
|
-
color:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
mb: 1,
|
|
110
|
+
color: headingColor,
|
|
111
|
+
fontSize: 2,
|
|
112
|
+
fontWeight: '500',
|
|
113
|
+
flexGrow: 1
|
|
114
|
+
},
|
|
115
|
+
ref: titleRef,
|
|
116
|
+
tabIndex: shouldFocusTitle ? -1 : undefined,
|
|
117
|
+
"aria-current": active ? 'step' : undefined,
|
|
118
|
+
children: [(0, _jsxRuntime.jsx)(_.Text, {
|
|
119
|
+
sx: {
|
|
120
|
+
color: 'wizard.step.number.color'
|
|
121
|
+
},
|
|
122
|
+
"aria-hidden": "true",
|
|
123
|
+
children: stepText
|
|
124
|
+
}), (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
125
|
+
as: "span",
|
|
126
|
+
sx: {
|
|
127
|
+
mt: 3,
|
|
128
|
+
alignItems: 'center'
|
|
129
|
+
},
|
|
130
|
+
"aria-hidden": "true",
|
|
131
|
+
children: [(0, _jsxRuntime.jsx)(StatusIcon, {
|
|
132
|
+
sx: {
|
|
133
|
+
mr: 3,
|
|
134
|
+
mt: 0,
|
|
135
|
+
color: statusIconColor
|
|
136
|
+
}
|
|
137
|
+
}), title]
|
|
138
|
+
}), (0, _jsxRuntime.jsx)(_ScreenReaderText.ScreenReaderText, {
|
|
139
|
+
children:
|
|
140
|
+
/**
|
|
141
|
+
* we are adding the composed title here so that it's announced correctly by the voiceover
|
|
142
|
+
* Using tags inside the heading would make the voiceover read the heading in multiple parts
|
|
143
|
+
**/
|
|
144
|
+
stepText + ": " + title + ". " + statusText
|
|
145
|
+
})]
|
|
146
|
+
}), !active && (complete || skipped) && onChange && (0, _jsxRuntime.jsxs)(_.Button, {
|
|
147
|
+
variant: "text",
|
|
148
|
+
onClick: onChange,
|
|
113
149
|
sx: {
|
|
114
|
-
|
|
115
|
-
|
|
150
|
+
height: 'auto',
|
|
151
|
+
alignSelf: 'flex-end'
|
|
152
|
+
},
|
|
153
|
+
children: ["Change ", (0, _jsxRuntime.jsx)(_ScreenReaderText.ScreenReaderText, {
|
|
154
|
+
children: "the " + title + " step"
|
|
155
|
+
})]
|
|
156
|
+
})]
|
|
157
|
+
}), !active && (complete || skipped) && (summary == null ? void 0 : summary.length) > 0 && (0, _jsxRuntime.jsx)(_.Table, {
|
|
158
|
+
caption: "Summary of " + title,
|
|
159
|
+
sx: {
|
|
160
|
+
width: 'auto',
|
|
161
|
+
minWidth: 'auto',
|
|
162
|
+
'> tbody > tr': {
|
|
163
|
+
'> td, > th': {
|
|
164
|
+
fontWeight: '500',
|
|
165
|
+
border: 'none',
|
|
166
|
+
pl: 0,
|
|
167
|
+
'&:first-of-type': {
|
|
168
|
+
pl: 0
|
|
169
|
+
}
|
|
170
|
+
}
|
|
116
171
|
}
|
|
117
|
-
}
|
|
172
|
+
},
|
|
173
|
+
children: (0, _jsxRuntime.jsx)("tbody", {
|
|
174
|
+
children: summary.map(function (item, index) {
|
|
175
|
+
return (0, _jsxRuntime.jsxs)(_.TableRow, {
|
|
176
|
+
children: [(0, _jsxRuntime.jsxs)(_.TableCell, {
|
|
177
|
+
as: "th",
|
|
178
|
+
scope: "row",
|
|
179
|
+
sx: {
|
|
180
|
+
color: 'gray',
|
|
181
|
+
whiteSpace: 'nowrap',
|
|
182
|
+
pr: 1
|
|
183
|
+
},
|
|
184
|
+
children: [item.label, item.value ? ':' : '']
|
|
185
|
+
}), (0, _jsxRuntime.jsx)(_.TableCell, {
|
|
186
|
+
sx: {
|
|
187
|
+
color: 'text'
|
|
188
|
+
},
|
|
189
|
+
children: (0, _jsxRuntime.jsx)("strong", {
|
|
190
|
+
children: item.value
|
|
191
|
+
})
|
|
192
|
+
})]
|
|
193
|
+
}, "summary_tb_" + index);
|
|
194
|
+
})
|
|
195
|
+
})
|
|
118
196
|
}), subTitle && active && (0, _jsxRuntime.jsx)(_.Text, {
|
|
119
197
|
sx: {
|
|
120
|
-
mb: 3
|
|
198
|
+
mb: 3,
|
|
199
|
+
mt: 2
|
|
121
200
|
},
|
|
122
201
|
children: subTitle
|
|
123
202
|
}), active && children]
|
|
@@ -131,8 +210,15 @@ WizardStep.propTypes = {
|
|
|
131
210
|
children: _propTypes["default"].node,
|
|
132
211
|
complete: _propTypes["default"].bool,
|
|
133
212
|
order: _propTypes["default"].number.isRequired,
|
|
213
|
+
totalSteps: _propTypes["default"].number.isRequired,
|
|
134
214
|
subTitle: _propTypes["default"].node,
|
|
135
|
-
title: _propTypes["default"].
|
|
215
|
+
title: _propTypes["default"].string,
|
|
136
216
|
titleVariant: _propTypes["default"].string,
|
|
217
|
+
skipped: _propTypes["default"].bool,
|
|
218
|
+
onChange: _propTypes["default"].func,
|
|
219
|
+
summary: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
220
|
+
label: _propTypes["default"].node,
|
|
221
|
+
value: _propTypes["default"].node
|
|
222
|
+
})),
|
|
137
223
|
shouldFocusTitle: _propTypes["default"].bool
|
|
138
224
|
};
|