@automattic/vip-design-system 2.10.0 → 2.10.2
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/babel.config.js +23 -19
- package/build/declaration.d.js +0 -1
- package/build/system/Accordion/Accordion.js +28 -33
- package/build/system/Accordion/Accordion.stories.js +34 -35
- package/build/system/Accordion/Accordion.test.js +35 -34
- package/build/system/Accordion/index.js +5 -8
- package/build/system/Avatar/Avatar.js +13 -17
- package/build/system/Avatar/Avatar.stories.js +10 -12
- package/build/system/Avatar/Avatar.test.js +15 -14
- package/build/system/Avatar/index.js +4 -6
- package/build/system/Badge/Badge.js +9 -14
- package/build/system/Badge/Badge.stories.js +23 -23
- package/build/system/Badge/Badge.test.js +15 -14
- package/build/system/Badge/index.js +4 -6
- package/build/system/Box/Box.js +9 -13
- package/build/system/Box/Box.stories.js +5 -8
- package/build/system/Breadcrumbs/Breadcrumbs.js +34 -38
- package/build/system/Breadcrumbs/Breadcrumbs.stories.js +18 -21
- package/build/system/Breadcrumbs/Breadcrumbs.test.js +28 -30
- package/build/system/Breadcrumbs/styles.js +5 -9
- package/build/system/Button/Button.js +11 -17
- package/build/system/Button/Button.stories.js +34 -33
- package/build/system/Button/Button.test.js +17 -16
- package/build/system/Button/ButtonSubmit.js +12 -16
- package/build/system/Button/ButtonSubmit.stories.js +12 -16
- package/build/system/Button/ButtonSubmit.test.js +15 -14
- package/build/system/Button/index.js +5 -8
- package/build/system/Card/Card.js +12 -14
- package/build/system/Card/Card.stories.js +21 -24
- package/build/system/Card/Card.test.js +19 -18
- package/build/system/Card/index.js +4 -6
- package/build/system/Code/Code.js +19 -23
- package/build/system/Code/Code.stories.js +16 -18
- package/build/system/Code/Code.test.js +20 -19
- package/build/system/Code/index.js +4 -6
- package/build/system/Drawer/Drawer.js +25 -30
- package/build/system/Drawer/Drawer.stories.js +38 -39
- package/build/system/Drawer/Drawer.test.js +19 -18
- package/build/system/Drawer/styles.js +9 -11
- package/build/system/Dropdown/Dropdown.js +23 -26
- package/build/system/Dropdown/Dropdown.test.js +16 -18
- package/build/system/Dropdown/DropdownContent.js +14 -20
- package/build/system/Dropdown/DropdownItem.js +19 -25
- package/build/system/Dropdown/DropdownLabel.js +10 -16
- package/build/system/Dropdown/DropdownSeparator.js +10 -16
- package/build/system/Dropdown/index.js +20 -23
- package/build/system/FilterDropdown/FilterDropdown.js +23 -29
- package/build/system/FilterDropdown/FilterDropdown.stories.js +9 -11
- package/build/system/FilterDropdown/FilterDropdown.test.js +7 -10
- package/build/system/Flex/Flex.js +7 -10
- package/build/system/Flex/Flex.stories.js +6 -10
- package/build/system/Flex/index.js +4 -6
- package/build/system/Footer/Footer.d.ts +33 -0
- package/build/system/Footer/Footer.js +82 -0
- package/build/system/Footer/Footer.stories.d.ts +41 -0
- package/build/system/Footer/Footer.stories.js +53 -0
- package/build/system/Footer/Footer.test.d.ts +1 -0
- package/build/system/Footer/Footer.test.js +36 -0
- package/build/system/Form/Checkbox/Checkbox.js +14 -18
- package/build/system/Form/Checkbox/Checkbox.stories.js +47 -48
- package/build/system/Form/Checkbox/Checkbox.test.js +23 -21
- package/build/system/Form/Checkbox/styles.js +7 -10
- package/build/system/Form/Input.js +19 -18
- package/build/system/Form/Input.stories.js +16 -18
- package/build/system/Form/Input.styles.js +5 -9
- package/build/system/Form/Label.js +14 -16
- package/build/system/Form/Label.stories.js +15 -15
- package/build/system/Form/Radio/Radio.js +13 -18
- package/build/system/Form/Radio/Radio.stories.js +43 -43
- package/build/system/Form/Radio/Radio.test.js +19 -18
- package/build/system/Form/Radio/RadioOption.js +22 -23
- package/build/system/Form/Radio/styles.js +7 -10
- package/build/system/Form/RadioGroupChip.js +26 -29
- package/build/system/Form/RadioGroupChip.stories.js +12 -15
- package/build/system/Form/RadioGroupChip.test.js +12 -11
- package/build/system/Form/RequiredLabel.js +3 -7
- package/build/system/Form/Toggle.js +11 -16
- package/build/system/Form/Toggle.stories.js +25 -27
- package/build/system/Form/Toggle.test.js +12 -11
- package/build/system/Form/Validation.js +10 -12
- package/build/system/Form/index.d.ts +2 -1
- package/build/system/Form/index.js +2 -0
- package/build/system/Grid/Grid.js +7 -10
- package/build/system/Grid/Grid.stories.js +6 -10
- package/build/system/Grid/index.js +4 -6
- package/build/system/Heading/Heading.js +9 -14
- package/build/system/Heading/Heading.stories.js +13 -16
- package/build/system/Hr/Hr.js +3 -7
- package/build/system/Hr/Hr.stories.js +10 -11
- package/build/system/Hr/Hr.test.js +14 -14
- package/build/system/Link/Link.js +11 -14
- package/build/system/Link/Link.stories.js +11 -14
- package/build/system/Link/index.js +4 -6
- package/build/system/LinkExternal/LinkExternal.d.ts +23 -3
- package/build/system/LinkExternal/LinkExternal.js +17 -23
- package/build/system/LinkExternal/LinkExternal.stories.d.ts +1 -8
- package/build/system/LinkExternal/LinkExternal.stories.js +4 -9
- package/build/system/LinkExternal/LinkExternal.test.js +14 -15
- package/build/system/MobileMenu/MobileMenu.js +24 -29
- package/build/system/MobileMenu/MobileMenu.stories.js +66 -67
- package/build/system/MobileMenu/MobileMenu.test.js +21 -22
- package/build/system/Nav/Nav.js +26 -32
- package/build/system/Nav/Nav.stories.js +97 -99
- package/build/system/Nav/Nav.test.js +32 -28
- package/build/system/Nav/NavItem.js +40 -45
- package/build/system/Nav/NavItemGroup.js +34 -39
- package/build/system/Nav/NavItemGroup.test.js +26 -23
- package/build/system/Nav/styles/variants/breadcrumbs.js +4 -7
- package/build/system/Nav/styles/variants/menu.js +8 -12
- package/build/system/Nav/styles/variants/menugroup.js +7 -11
- package/build/system/Nav/styles/variants/primary.js +4 -8
- package/build/system/Nav/styles/variants/tabs.js +3 -7
- package/build/system/Nav/styles/variants/toolbar.js +5 -8
- package/build/system/Nav/styles.js +26 -29
- package/build/system/NewDialog/DialogClose.js +14 -18
- package/build/system/NewDialog/DialogClose.test.js +11 -14
- package/build/system/NewDialog/DialogDescription.js +9 -15
- package/build/system/NewDialog/DialogOverlay.js +11 -13
- package/build/system/NewDialog/DialogTitle.js +7 -15
- package/build/system/NewDialog/NewDialog.js +24 -29
- package/build/system/NewDialog/index.js +7 -11
- package/build/system/NewDialog/styles.js +1 -5
- package/build/system/NewForm/Fieldset.js +13 -17
- package/build/system/NewForm/Form.js +8 -13
- package/build/system/NewForm/FormAutocomplete.js +2 -2
- package/build/system/NewForm/Legend.js +11 -15
- package/build/system/Notice/Notice.js +22 -25
- package/build/system/Notice/Notice.stories.js +41 -43
- package/build/system/Notice/index.js +5 -5
- package/build/system/Page/Page.js +4 -8
- package/build/system/Page/Page.test.js +14 -14
- package/build/system/Progress/Progress.js +21 -24
- package/build/system/Progress/Progress.stories.js +9 -15
- package/build/system/Progress/Progress.test.js +14 -13
- package/build/system/Progress/index.js +4 -6
- package/build/system/ScreenReaderText/ScreenReaderText.js +9 -9
- package/build/system/Spinner/Spinner.js +9 -14
- package/build/system/Spinner/Spinner.stories.js +6 -10
- package/build/system/Spinner/Spinner.test.js +14 -13
- package/build/system/Spinner/index.js +1 -6
- package/build/system/Table/Table.js +20 -22
- package/build/system/Table/Table.stories.js +29 -30
- package/build/system/Table/TableCell.js +9 -11
- package/build/system/Table/TableRow.js +10 -11
- package/build/system/Table/index.js +6 -10
- package/build/system/Text/Text.js +9 -14
- package/build/system/Text/Text.stories.js +24 -25
- package/build/system/Text/index.js +4 -6
- package/build/system/Toolbar/Logo.js +11 -15
- package/build/system/Toolbar/Toolbar.js +12 -17
- package/build/system/Toolbar/Toolbar.stories.js +47 -50
- package/build/system/Toolbar/Toolbar.test.js +26 -24
- package/build/system/Toolbar/ToolbarUtilNav.js +9 -16
- package/build/system/Toolbar/index.js +10 -15
- package/build/system/Tooltip/Tooltip.js +9 -14
- package/build/system/Tooltip/Tooltip.stories.js +29 -31
- package/build/system/Tooltip/index.js +5 -5
- package/build/system/Wizard/Wizard.js +11 -18
- package/build/system/Wizard/Wizard.stories.js +37 -38
- package/build/system/Wizard/WizardStep.js +26 -32
- package/build/system/Wizard/index.js +6 -7
- package/build/system/assets/a8cLogo.d.ts +2 -0
- package/build/system/assets/a8cLogo.js +39 -0
- package/build/system/index.d.ts +2 -1
- package/build/system/index.js +2 -0
- package/build/system/theme/breakpoints.js +1 -5
- package/build/system/utils/stories/CustomLink.js +7 -13
- package/package.json +1 -1
- package/src/system/Footer/Footer.stories.tsx +46 -0
- package/src/system/Footer/Footer.test.tsx +40 -0
- package/src/system/Footer/Footer.tsx +120 -0
- package/src/system/Form/index.js +2 -0
- package/src/system/LinkExternal/LinkExternal.tsx +27 -8
- package/src/system/NewForm/FormAutocomplete.js +2 -2
- package/src/system/assets/a8cLogo.tsx +30 -0
- package/src/system/index.js +2 -0
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.Notice = void 0;
|
|
5
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
6
|
-
var _react = _interopRequireDefault(require("react"));
|
|
7
|
-
var _md = require("react-icons/md");
|
|
8
|
-
var _ = require("../");
|
|
9
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
10
1
|
var _excluded = ["children", "className", "headingVariant", "inline", "sx", "title", "variant"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
4
|
/** @jsxImportSource theme-ui */
|
|
5
|
+
|
|
12
6
|
/**
|
|
13
7
|
* External dependencies
|
|
14
8
|
*/
|
|
9
|
+
import classNames from 'classnames';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { MdError, MdWarning, MdCheckCircle, MdInfo } from 'react-icons/md';
|
|
15
12
|
/**
|
|
16
13
|
* Internal dependencies
|
|
17
14
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
import { Box, Flex, Heading, Card } from '../';
|
|
16
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
17
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
21
18
|
var NoticeIcon = function NoticeIcon(_ref) {
|
|
22
19
|
var color = _ref.color,
|
|
23
20
|
variant = _ref.variant;
|
|
@@ -28,19 +25,19 @@ var NoticeIcon = function NoticeIcon(_ref) {
|
|
|
28
25
|
var size = 24;
|
|
29
26
|
switch (variant) {
|
|
30
27
|
case 'info':
|
|
31
|
-
return (
|
|
28
|
+
return _jsx(MdInfo, {
|
|
32
29
|
sx: sx,
|
|
33
30
|
size: size,
|
|
34
31
|
"aria-hidden": "true"
|
|
35
32
|
});
|
|
36
33
|
case 'error':
|
|
37
|
-
return (
|
|
34
|
+
return _jsx(MdError, {
|
|
38
35
|
sx: sx,
|
|
39
36
|
size: size,
|
|
40
37
|
"aria-hidden": "true"
|
|
41
38
|
});
|
|
42
39
|
case 'success':
|
|
43
|
-
return (
|
|
40
|
+
return _jsx(MdCheckCircle, {
|
|
44
41
|
sx: sx,
|
|
45
42
|
size: size,
|
|
46
43
|
"aria-hidden": "true"
|
|
@@ -48,13 +45,13 @@ var NoticeIcon = function NoticeIcon(_ref) {
|
|
|
48
45
|
}
|
|
49
46
|
|
|
50
47
|
// alert and warning will get the Warning icon
|
|
51
|
-
return (
|
|
48
|
+
return _jsx(MdWarning, {
|
|
52
49
|
sx: sx,
|
|
53
50
|
size: size,
|
|
54
51
|
"aria-hidden": "true"
|
|
55
52
|
});
|
|
56
53
|
};
|
|
57
|
-
var Notice =
|
|
54
|
+
export var Notice = /*#__PURE__*/React.forwardRef(function (_ref2, forwardRef) {
|
|
58
55
|
var children = _ref2.children,
|
|
59
56
|
_ref2$className = _ref2.className,
|
|
60
57
|
className = _ref2$className === void 0 ? null : _ref2$className,
|
|
@@ -68,7 +65,7 @@ var Notice = exports.Notice = /*#__PURE__*/_react["default"].forwardRef(function
|
|
|
68
65
|
_ref2$variant = _ref2.variant,
|
|
69
66
|
variant = _ref2$variant === void 0 ? 'warning' : _ref2$variant,
|
|
70
67
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
71
|
-
return (
|
|
68
|
+
return _jsxs(Card, _extends({
|
|
72
69
|
variant: "notice",
|
|
73
70
|
sx: _extends({
|
|
74
71
|
boxShadow: 'none',
|
|
@@ -96,14 +93,14 @@ var Notice = exports.Notice = /*#__PURE__*/_react["default"].forwardRef(function
|
|
|
96
93
|
pl: 5
|
|
97
94
|
}
|
|
98
95
|
}, sx),
|
|
99
|
-
className: (
|
|
96
|
+
className: classNames('vip-notice-component', className),
|
|
100
97
|
ref: forwardRef
|
|
101
98
|
}, props, {
|
|
102
|
-
children: [(
|
|
99
|
+
children: [_jsx(Box, {
|
|
103
100
|
sx: {
|
|
104
101
|
minWidth: '24px'
|
|
105
102
|
},
|
|
106
|
-
children: (
|
|
103
|
+
children: _jsxs(Flex, {
|
|
107
104
|
sx: {
|
|
108
105
|
flexDirection: 'column',
|
|
109
106
|
// the trick here is to have a flex column with the icon at the bottom and an empty div that fills the space
|
|
@@ -114,17 +111,17 @@ var Notice = exports.Notice = /*#__PURE__*/_react["default"].forwardRef(function
|
|
|
114
111
|
// we want the icon to be aligned to the bottom
|
|
115
112
|
height: '100%' // specifying the height will allow the box to match the height of the content.
|
|
116
113
|
},
|
|
117
|
-
children: [(
|
|
114
|
+
children: [_jsx(Box, {
|
|
118
115
|
sx: {
|
|
119
116
|
flex: '1 100%' // we need this empty div to make the icon align to the bottom
|
|
120
117
|
}
|
|
121
|
-
}), (
|
|
118
|
+
}), _jsx(NoticeIcon, {
|
|
122
119
|
color: "notice.icon." + variant,
|
|
123
120
|
variant: variant
|
|
124
121
|
})]
|
|
125
122
|
})
|
|
126
|
-
}), (
|
|
127
|
-
children: [title && (
|
|
123
|
+
}), _jsxs(Box, {
|
|
124
|
+
children: [title && _jsx(Heading, {
|
|
128
125
|
as: headingVariant,
|
|
129
126
|
sx: {
|
|
130
127
|
color: "notice.text." + variant,
|
|
@@ -1,152 +1,150 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Default = void 0;
|
|
5
|
-
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
var _ = require("..");
|
|
7
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
1
|
/** @jsxImportSource theme-ui */
|
|
10
2
|
/**
|
|
11
3
|
* External dependencies
|
|
12
4
|
*/
|
|
5
|
+
|
|
13
6
|
/**
|
|
14
7
|
* Internal dependencies
|
|
15
8
|
*/
|
|
16
|
-
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { Notice, Link, Heading } from '..';
|
|
11
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
13
|
+
import { Fragment as _Fragment } from "theme-ui/jsx-runtime";
|
|
14
|
+
export default {
|
|
17
15
|
title: 'Notice',
|
|
18
|
-
component:
|
|
16
|
+
component: Notice
|
|
19
17
|
};
|
|
20
|
-
var Default =
|
|
21
|
-
return (
|
|
22
|
-
children: [(
|
|
18
|
+
export var Default = function Default() {
|
|
19
|
+
return _jsxs(React.Fragment, {
|
|
20
|
+
children: [_jsxs(Notice, {
|
|
23
21
|
variant: "alert",
|
|
24
22
|
headingVariant: "h2",
|
|
25
23
|
sx: {
|
|
26
24
|
mb: 4
|
|
27
25
|
},
|
|
28
26
|
title: "Your site is ready to launch!",
|
|
29
|
-
children: ["It looks like you\u2018re ready to share your", ' ', (
|
|
27
|
+
children: ["It looks like you\u2018re ready to share your", ' ', _jsx(Link, {
|
|
30
28
|
href: "https://google.com/",
|
|
31
29
|
children: "application with the world."
|
|
32
30
|
})]
|
|
33
|
-
}), (
|
|
31
|
+
}), _jsxs(Notice, {
|
|
34
32
|
variant: "success",
|
|
35
33
|
sx: {
|
|
36
34
|
mb: 4
|
|
37
35
|
},
|
|
38
|
-
children: ["It looks like you\u2018re ready to share your", ' ', (
|
|
36
|
+
children: ["It looks like you\u2018re ready to share your", ' ', _jsx(Link, {
|
|
39
37
|
href: "https://google.com/",
|
|
40
38
|
children: "application with the world."
|
|
41
39
|
})]
|
|
42
|
-
}), (
|
|
40
|
+
}), _jsxs(Notice, {
|
|
43
41
|
sx: {
|
|
44
42
|
mb: 4
|
|
45
43
|
},
|
|
46
44
|
title: "This notice has only the title prop passed",
|
|
47
|
-
children: ["It looks like you\u2018re ready to share your", ' ', (
|
|
45
|
+
children: ["It looks like you\u2018re ready to share your", ' ', _jsx(Link, {
|
|
48
46
|
href: "https://google.com/",
|
|
49
47
|
children: "application with the world."
|
|
50
48
|
})]
|
|
51
|
-
}), (
|
|
49
|
+
}), _jsxs(Notice, {
|
|
52
50
|
variant: "success",
|
|
53
51
|
sx: {
|
|
54
52
|
mb: 4
|
|
55
53
|
},
|
|
56
54
|
title: "You made it!",
|
|
57
|
-
children: ["It looks like you\u2018re ready to share your", ' ', (
|
|
55
|
+
children: ["It looks like you\u2018re ready to share your", ' ', _jsx(Link, {
|
|
58
56
|
href: "https://google.com/",
|
|
59
57
|
children: "application with the world."
|
|
60
58
|
})]
|
|
61
|
-
}), (
|
|
59
|
+
}), _jsxs(Notice, {
|
|
62
60
|
variant: "info",
|
|
63
61
|
sx: {
|
|
64
62
|
mb: 4
|
|
65
63
|
},
|
|
66
64
|
title: "Please read this first",
|
|
67
|
-
children: ["This notice has a title and children and", ' ', (
|
|
65
|
+
children: ["This notice has a title and children and", ' ', _jsx(Link, {
|
|
68
66
|
href: "/?path=/story/avatar--default",
|
|
69
67
|
children: "A link to Avatar"
|
|
70
68
|
})]
|
|
71
|
-
}), (
|
|
69
|
+
}), _jsxs(Notice, {
|
|
72
70
|
variant: "alert",
|
|
73
71
|
sx: {
|
|
74
72
|
mb: 4
|
|
75
73
|
},
|
|
76
74
|
title: "Please read this first",
|
|
77
|
-
children: ["This notice has a title and children and", ' ', (
|
|
75
|
+
children: ["This notice has a title and children and", ' ', _jsx(Link, {
|
|
78
76
|
href: "/?path=/story/avatar--default",
|
|
79
77
|
children: "A link to Avatar"
|
|
80
78
|
})]
|
|
81
|
-
}), (
|
|
79
|
+
}), _jsx(Notice, {
|
|
82
80
|
variant: "alert",
|
|
83
81
|
sx: {
|
|
84
82
|
mb: 2
|
|
85
83
|
},
|
|
86
84
|
title: "There are errors in your form",
|
|
87
85
|
headingVariant: "h2",
|
|
88
|
-
children: (
|
|
86
|
+
children: _jsxs("ul", {
|
|
89
87
|
sx: {
|
|
90
88
|
m: 0,
|
|
91
89
|
pl: 3
|
|
92
90
|
},
|
|
93
|
-
children: [(
|
|
94
|
-
children: (
|
|
91
|
+
children: [_jsx("li", {
|
|
92
|
+
children: _jsx(Link, {
|
|
95
93
|
href: "#name",
|
|
96
94
|
children: "Please enter your name."
|
|
97
95
|
})
|
|
98
|
-
}), (
|
|
99
|
-
children: (
|
|
96
|
+
}), _jsx("li", {
|
|
97
|
+
children: _jsx(Link, {
|
|
100
98
|
href: "#email",
|
|
101
99
|
children: "Please enter your email address."
|
|
102
100
|
})
|
|
103
|
-
}), (
|
|
104
|
-
children: (
|
|
101
|
+
}), _jsx("li", {
|
|
102
|
+
children: _jsx(Link, {
|
|
105
103
|
href: "#terms",
|
|
106
104
|
children: "Please agree to the terms."
|
|
107
105
|
})
|
|
108
106
|
})]
|
|
109
107
|
})
|
|
110
|
-
}), (
|
|
108
|
+
}), _jsx(Notice, {
|
|
111
109
|
variant: "alert",
|
|
112
110
|
sx: {
|
|
113
111
|
mb: 2
|
|
114
112
|
},
|
|
115
|
-
children: (
|
|
116
|
-
children: [(
|
|
113
|
+
children: _jsxs(_Fragment, {
|
|
114
|
+
children: [_jsx(Heading, {
|
|
117
115
|
variant: 'h4',
|
|
118
116
|
sx: {
|
|
119
117
|
fontSize: 2
|
|
120
118
|
},
|
|
121
119
|
children: "Alternative way of printing errors"
|
|
122
|
-
}), (
|
|
120
|
+
}), _jsxs("ul", {
|
|
123
121
|
sx: {
|
|
124
122
|
m: 0,
|
|
125
123
|
pl: 3
|
|
126
124
|
},
|
|
127
|
-
children: [(
|
|
128
|
-
children: (
|
|
125
|
+
children: [_jsx("li", {
|
|
126
|
+
children: _jsx(Link, {
|
|
129
127
|
href: "#name",
|
|
130
128
|
children: "Please enter your name."
|
|
131
129
|
})
|
|
132
|
-
}), (
|
|
133
|
-
children: (
|
|
130
|
+
}), _jsx("li", {
|
|
131
|
+
children: _jsx(Link, {
|
|
134
132
|
href: "#email",
|
|
135
133
|
children: "Please enter your email address."
|
|
136
134
|
})
|
|
137
135
|
})]
|
|
138
136
|
})]
|
|
139
137
|
})
|
|
140
|
-
}), (
|
|
138
|
+
}), _jsxs(Notice, {
|
|
141
139
|
variant: "alert",
|
|
142
140
|
sx: {
|
|
143
141
|
mb: 4
|
|
144
142
|
},
|
|
145
|
-
children: ["Bucket names in Amazon S3 are globally unique, external link \u2197. To ensure that shipped data is delivered to the correct location, the Bucket Name and Bucket Region entered below must match the details used to set up your S3 bucket, external link \u2197.", (
|
|
143
|
+
children: ["Bucket names in Amazon S3 are globally unique, external link \u2197. To ensure that shipped data is delivered to the correct location, the Bucket Name and Bucket Region entered below must match the details used to set up your S3 bucket, external link \u2197.", _jsx(Link, {
|
|
146
144
|
href: "/?path=/story/avatar--default",
|
|
147
145
|
children: "A link to Avatar"
|
|
148
146
|
})]
|
|
149
|
-
}), (
|
|
147
|
+
}), _jsx(Notice, {
|
|
150
148
|
variant: "info",
|
|
151
149
|
sx: {
|
|
152
150
|
mb: 4
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Notice } from './Notice';
|
|
5
|
+
export { Notice };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.Page = void 0;
|
|
5
|
-
var _Box = require("../Box");
|
|
6
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
7
1
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { Box } from '../Box';
|
|
3
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
4
|
+
export var Page = function Page(props) {
|
|
5
|
+
return _jsx(Box, _extends({}, props));
|
|
10
6
|
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = require("@testing-library/react");
|
|
4
|
-
var _jestAxe = require("jest-axe");
|
|
5
|
-
var _themeUi = require("theme-ui");
|
|
6
|
-
var _Page = require("./Page");
|
|
7
|
-
var _theme = _interopRequireDefault(require("../theme"));
|
|
8
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
1
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
11
2
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
12
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
|
+
/** @jsxImportSource theme-ui */
|
|
5
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
import { render } from '@testing-library/react';
|
|
8
|
+
import { axe } from 'jest-axe';
|
|
9
|
+
import { ThemeUIProvider } from 'theme-ui';
|
|
10
|
+
import { Page } from './Page';
|
|
11
|
+
import theme from '../theme';
|
|
12
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
13
13
|
var renderWithTheme = function renderWithTheme(children) {
|
|
14
|
-
return
|
|
15
|
-
theme:
|
|
14
|
+
return render(_jsx(ThemeUIProvider, {
|
|
15
|
+
theme: theme,
|
|
16
16
|
children: children
|
|
17
17
|
}));
|
|
18
18
|
};
|
|
19
19
|
var renderComponent = function renderComponent() {
|
|
20
|
-
return renderWithTheme((
|
|
20
|
+
return renderWithTheme(_jsx(Page, {}));
|
|
21
21
|
};
|
|
22
22
|
describe('<Page />', function () {
|
|
23
23
|
it('renders the Page component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -28,7 +28,7 @@ describe('<Page />', function () {
|
|
|
28
28
|
_renderComponent = renderComponent(), container = _renderComponent.container;
|
|
29
29
|
_context.t0 = expect;
|
|
30
30
|
_context.next = 4;
|
|
31
|
-
return
|
|
31
|
+
return axe(container);
|
|
32
32
|
case 4:
|
|
33
33
|
_context.t1 = _context.sent;
|
|
34
34
|
(0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.Progress = void 0;
|
|
5
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
6
|
-
var _react = require("react");
|
|
7
|
-
var _md = require("react-icons/md");
|
|
8
|
-
var _themeUi = require("theme-ui");
|
|
9
|
-
var _ = require("..");
|
|
10
|
-
var _Spinner = require("../Spinner");
|
|
11
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
12
1
|
var _excluded = ["steps", "activeStep", "sx", "forLabel", "className"];
|
|
2
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
13
4
|
/**
|
|
14
5
|
* External dependencies
|
|
15
6
|
*/
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import { forwardRef } from 'react';
|
|
9
|
+
import { MdCheck } from 'react-icons/md';
|
|
10
|
+
import { Progress as ThemeProgress } from 'theme-ui';
|
|
11
|
+
|
|
16
12
|
/**
|
|
17
13
|
* Internal dependencies
|
|
18
14
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
import { Box, Text, Flex } from '..';
|
|
16
|
+
import { Spinner } from '../Spinner';
|
|
17
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
22
19
|
var prefix = 'vip-progress-component';
|
|
23
20
|
var uniqueID = function uniqueID() {
|
|
24
21
|
return Math.random().toString(36).substring(7);
|
|
25
22
|
};
|
|
26
|
-
var Progress =
|
|
23
|
+
export var Progress = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
27
24
|
var steps = _ref.steps,
|
|
28
25
|
activeStep = _ref.activeStep,
|
|
29
26
|
sx = _ref.sx,
|
|
@@ -36,9 +33,9 @@ var Progress = exports.Progress = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
36
33
|
var instance = uniqueID();
|
|
37
34
|
var htmlFor = prefix + "-" + instance;
|
|
38
35
|
var currentValue = activeStep + 1;
|
|
39
|
-
return (
|
|
40
|
-
className: (
|
|
41
|
-
children: [(
|
|
36
|
+
return _jsxs(Box, {
|
|
37
|
+
className: classNames(prefix, className),
|
|
38
|
+
children: [_jsx(ThemeProgress, _extends({
|
|
42
39
|
sx: _extends({
|
|
43
40
|
color: 'primary',
|
|
44
41
|
backgroundColor: 'background'
|
|
@@ -48,7 +45,7 @@ var Progress = exports.Progress = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
48
45
|
id: htmlFor,
|
|
49
46
|
"aria-label": forLabel,
|
|
50
47
|
ref: ref
|
|
51
|
-
}, props)), steps && (
|
|
48
|
+
}, props)), steps && _jsxs(Flex, {
|
|
52
49
|
sx: {
|
|
53
50
|
alignItems: 'center',
|
|
54
51
|
mt: 2
|
|
@@ -56,20 +53,20 @@ var Progress = exports.Progress = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
|
56
53
|
"aria-live": "polite",
|
|
57
54
|
"aria-atomic": "true",
|
|
58
55
|
"aria-describedby": htmlFor,
|
|
59
|
-
children: [!isDone && (
|
|
56
|
+
children: [!isDone && _jsx(Spinner, {
|
|
60
57
|
size: 24,
|
|
61
58
|
"aria-hidden": "true"
|
|
62
|
-
}), isDone && (
|
|
59
|
+
}), isDone && _jsx(MdCheck, {
|
|
63
60
|
size: 24,
|
|
64
61
|
"aria-hidden": "true"
|
|
65
|
-
}), (
|
|
62
|
+
}), _jsxs(Text, {
|
|
66
63
|
sx: {
|
|
67
64
|
ml: 2,
|
|
68
65
|
mb: 0
|
|
69
66
|
},
|
|
70
|
-
children: [(
|
|
67
|
+
children: [_jsxs("strong", {
|
|
71
68
|
children: [currentValue + " of " + stepsTotal, ": "]
|
|
72
|
-
}), (
|
|
69
|
+
}), _jsx(Text, {
|
|
73
70
|
as: "span",
|
|
74
71
|
sx: {
|
|
75
72
|
color: 'muted'
|
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Default = void 0;
|
|
5
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
-
var _ = require("..");
|
|
7
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
8
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
9
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
10
1
|
/**
|
|
11
2
|
* Internal dependencies
|
|
12
3
|
*/
|
|
13
|
-
|
|
4
|
+
import React, { useEffect } from 'react';
|
|
5
|
+
import { Progress } from '..';
|
|
6
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
7
|
+
export default {
|
|
14
8
|
title: 'Progress',
|
|
15
|
-
component:
|
|
9
|
+
component: Progress
|
|
16
10
|
};
|
|
17
|
-
var Default =
|
|
18
|
-
var _React$useState =
|
|
11
|
+
export var Default = function Default() {
|
|
12
|
+
var _React$useState = React.useState(0),
|
|
19
13
|
counter = _React$useState[0],
|
|
20
14
|
setCounter = _React$useState[1];
|
|
21
15
|
var steps = ['Downloading Data', 'Importing Data...', 'Finalizing', 'Done'];
|
|
22
|
-
|
|
16
|
+
useEffect(function () {
|
|
23
17
|
setTimeout(function () {
|
|
24
18
|
if (counter < steps.length - 1) {
|
|
25
19
|
setCounter(counter + 1);
|
|
26
20
|
}
|
|
27
21
|
}, 2000);
|
|
28
22
|
}, [counter, setCounter]);
|
|
29
|
-
return (
|
|
23
|
+
return _jsx(Progress, {
|
|
30
24
|
forLabel: "Update site progress",
|
|
31
25
|
steps: steps,
|
|
32
26
|
activeStep: counter
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = require("@testing-library/react");
|
|
4
|
-
var _jestAxe = require("jest-axe");
|
|
5
|
-
var _Progress = require("./Progress");
|
|
6
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
7
1
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(typeof e + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
8
2
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
|
+
/**
|
|
10
5
|
* External dependencies
|
|
11
|
-
*/
|
|
6
|
+
*/
|
|
7
|
+
import { render, screen } from '@testing-library/react';
|
|
8
|
+
import { axe } from 'jest-axe';
|
|
9
|
+
|
|
10
|
+
/**
|
|
12
11
|
* Internal dependencies
|
|
13
12
|
*/
|
|
13
|
+
import { Progress } from './Progress';
|
|
14
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
14
15
|
var steps = ['Downloading Data', 'Importing Data...', 'Finalizing', 'Done'];
|
|
15
16
|
describe('<Progress />', function () {
|
|
16
17
|
it('renders the progress component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -18,7 +19,7 @@ describe('<Progress />', function () {
|
|
|
18
19
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
19
20
|
while (1) switch (_context.prev = _context.next) {
|
|
20
21
|
case 0:
|
|
21
|
-
_render =
|
|
22
|
+
_render = render(_jsx(Progress, {
|
|
22
23
|
steps: steps,
|
|
23
24
|
activeStep: 1
|
|
24
25
|
})), container = _render.container;
|
|
@@ -27,7 +28,7 @@ describe('<Progress />', function () {
|
|
|
27
28
|
// Check for accessibility issues
|
|
28
29
|
_context.t0 = expect;
|
|
29
30
|
_context.next = 5;
|
|
30
|
-
return
|
|
31
|
+
return axe(container);
|
|
31
32
|
case 5:
|
|
32
33
|
_context.t1 = _context.sent;
|
|
33
34
|
(0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
@@ -42,17 +43,17 @@ describe('<Progress />', function () {
|
|
|
42
43
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
43
44
|
while (1) switch (_context2.prev = _context2.next) {
|
|
44
45
|
case 0:
|
|
45
|
-
_render2 =
|
|
46
|
+
_render2 = render(_jsx(Progress, {
|
|
46
47
|
forLabel: "My progress bar",
|
|
47
48
|
steps: steps,
|
|
48
49
|
activeStep: 1
|
|
49
50
|
})), container = _render2.container;
|
|
50
|
-
expect(
|
|
51
|
+
expect(screen.getByLabelText('My progress bar')).toBeInTheDocument();
|
|
51
52
|
|
|
52
53
|
// Check for accessibility issues
|
|
53
54
|
_context2.t0 = expect;
|
|
54
55
|
_context2.next = 5;
|
|
55
|
-
return
|
|
56
|
+
return axe(container);
|
|
56
57
|
case 5:
|
|
57
58
|
_context2.t1 = _context2.sent;
|
|
58
59
|
(0, _context2.t0)(_context2.t1).toHaveNoViolations();
|