@automattic/vip-design-system 0.9.2 → 0.9.5
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/Avatar/Avatar.stories.js +23 -8
- package/build/system/Avatar/Avatar.test.js +41 -22
- package/build/system/Badge/Badge.stories.js +25 -8
- package/build/system/Badge/Badge.test.js +73 -0
- package/build/system/BlankState/BlankState.js +12 -9
- package/build/system/BlankState/BlankState.stories.js +27 -11
- package/build/system/BlankState/BlankState.test.js +124 -0
- package/build/system/Box/Box.stories.js +25 -8
- package/build/system/Button/Button.stories.js +36 -23
- package/build/system/Button/Button.test.js +44 -0
- package/build/system/Card/Card.stories.js +25 -8
- package/build/system/Card/Card.test.js +78 -0
- package/build/system/Code/Code.js +11 -8
- package/build/system/Code/Code.stories.js +25 -8
- package/build/system/Code/Code.test.js +167 -0
- package/build/system/ConfirmationDialog/ConfirmationDialog.stories.js +45 -22
- package/build/system/Dialog/Dialog.stories.js +71 -31
- package/build/system/Dialog/DialogContent.js +3 -1
- package/build/system/Flex/Flex.stories.js +25 -8
- package/build/system/Form/AsyncSearchSelect.js +38 -0
- package/build/system/Form/Input.js +2 -2
- package/build/system/Form/Input.stories.js +23 -8
- package/build/system/Form/SearchSelect.js +47 -11
- package/build/system/Form/Select.js +48 -12
- package/build/system/Form/Select.stories.js +108 -78
- package/build/system/Form/Select.test.js +52 -0
- package/build/system/Grid/Grid.stories.js +25 -8
- package/build/system/Heading/Heading.stories.js +43 -20
- package/build/system/Link/Link.stories.js +26 -10
- package/build/system/Notice/Notice.stories.js +47 -81
- package/build/system/Notification/Notification.stories.js +23 -8
- package/build/system/OptionRow/OptionRow.stories.js +36 -20
- package/build/system/Progress/Progress.stories.js +23 -8
- package/build/system/Spinner/Spinner.stories.js +23 -8
- package/build/system/Table/Table.stories.js +64 -42
- package/build/system/Tabs/Tabs.stories.js +32 -10
- package/build/system/Text/Text.stories.js +25 -8
- package/build/system/Timeline/Timeline.js +69 -0
- package/build/system/Timeline/Timeline.stories.js +44 -21
- package/build/system/Timeline/index.js +2 -66
- package/build/system/Tooltip/Tooltip.stories.js +41 -19
- package/build/system/Wizard/Wizard.stories.js +65 -37
- package/package.json +17 -5
- package/src/system/Avatar/Avatar.test.js +9 -10
- package/src/system/Badge/Badge.test.js +30 -0
- package/src/system/BlankState/BlankState.js +13 -5
- package/src/system/BlankState/BlankState.test.js +58 -0
- package/src/system/Button/Button.test.js +21 -0
- package/src/system/Card/Card.test.js +33 -0
- package/src/system/Code/Code.js +12 -9
- package/src/system/Code/Code.stories.js +2 -0
- package/src/system/Code/Code.test.js +69 -0
- package/src/system/Dialog/DialogContent.js +2 -0
- package/src/system/Form/AsyncSearchSelect.js +29 -0
- package/src/system/Form/Input.js +2 -2
- package/src/system/Form/SearchSelect.js +43 -3
- package/src/system/Form/Select.js +29 -6
- package/src/system/Form/Select.stories.js +82 -24
- package/src/system/Form/Select.test.js +37 -0
- package/src/system/Timeline/Timeline.js +46 -0
- package/src/system/Timeline/Timeline.stories.js +34 -0
- package/src/system/Timeline/index.js +2 -41
- package/build/system/UsageChart/UsageChart.stories.js +0 -20
|
@@ -1,16 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Default = exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
|
|
8
|
+
var _ = require("..");
|
|
9
|
+
|
|
10
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
1
14
|
/**
|
|
2
15
|
* External dependencies
|
|
3
16
|
*/
|
|
4
|
-
|
|
17
|
+
|
|
5
18
|
/**
|
|
6
19
|
* Internal dependencies
|
|
7
20
|
*/
|
|
8
|
-
|
|
9
|
-
import { Avatar } from '..';
|
|
10
|
-
export default {
|
|
21
|
+
var _default = {
|
|
11
22
|
title: 'Avatar',
|
|
12
|
-
component: Avatar
|
|
23
|
+
component: _.Avatar
|
|
13
24
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
exports["default"] = _default;
|
|
26
|
+
|
|
27
|
+
var Default = function Default() {
|
|
28
|
+
return (0, _jsxRuntime.jsx)(_.Avatar, {});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.Default = Default;
|
|
@@ -13,42 +13,61 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
13
13
|
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); }); }; }
|
|
14
14
|
|
|
15
15
|
describe('<Avatar />', function () {
|
|
16
|
-
it('renders the Avatar without an image', function () {
|
|
17
|
-
|
|
18
|
-
name: "John Doe"
|
|
19
|
-
}));
|
|
20
|
-
expect(_react.screen.getByText('J')).toBeInTheDocument();
|
|
21
|
-
});
|
|
22
|
-
it('renders the Avatar with image', function () {
|
|
23
|
-
(0, _react.render)((0, _jsxRuntime.jsx)(_Avatar.Avatar, {
|
|
24
|
-
name: "John Doe",
|
|
25
|
-
src: "path/to/image"
|
|
26
|
-
}));
|
|
27
|
-
expect(_react.screen.getByAltText('Avatar image from John Doe')).toBeInTheDocument();
|
|
28
|
-
});
|
|
29
|
-
it('should not have basic accessibility issues', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
30
|
-
var _render, container, results;
|
|
16
|
+
it('renders the Avatar without an image', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
17
|
+
var _render, container;
|
|
31
18
|
|
|
32
19
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
33
20
|
while (1) {
|
|
34
21
|
switch (_context.prev = _context.next) {
|
|
35
22
|
case 0:
|
|
36
23
|
_render = (0, _react.render)((0, _jsxRuntime.jsx)(_Avatar.Avatar, {
|
|
37
|
-
name: "John Doe"
|
|
38
|
-
src: "path/to/image"
|
|
24
|
+
name: "John Doe"
|
|
39
25
|
})), container = _render.container;
|
|
40
|
-
|
|
41
|
-
return (0, _jestAxe.axe)(container);
|
|
26
|
+
expect(_react.screen.getByText('J')).toBeInTheDocument(); // Check for accessibility issues
|
|
42
27
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
28
|
+
_context.t0 = expect;
|
|
29
|
+
_context.next = 5;
|
|
30
|
+
return (0, _jestAxe.axe)(container);
|
|
46
31
|
|
|
47
32
|
case 5:
|
|
33
|
+
_context.t1 = _context.sent;
|
|
34
|
+
_context.next = 8;
|
|
35
|
+
return (0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
36
|
+
|
|
37
|
+
case 8:
|
|
48
38
|
case "end":
|
|
49
39
|
return _context.stop();
|
|
50
40
|
}
|
|
51
41
|
}
|
|
52
42
|
}, _callee);
|
|
53
43
|
})));
|
|
44
|
+
it('renders the Avatar with image', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
45
|
+
var _render2, container;
|
|
46
|
+
|
|
47
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
48
|
+
while (1) {
|
|
49
|
+
switch (_context2.prev = _context2.next) {
|
|
50
|
+
case 0:
|
|
51
|
+
_render2 = (0, _react.render)((0, _jsxRuntime.jsx)(_Avatar.Avatar, {
|
|
52
|
+
name: "John Doe",
|
|
53
|
+
src: "path/to/image"
|
|
54
|
+
})), container = _render2.container;
|
|
55
|
+
expect(_react.screen.getByAltText('Avatar image from John Doe')).toBeInTheDocument(); // Check for accessibility issues
|
|
56
|
+
|
|
57
|
+
_context2.t0 = expect;
|
|
58
|
+
_context2.next = 5;
|
|
59
|
+
return (0, _jestAxe.axe)(container);
|
|
60
|
+
|
|
61
|
+
case 5:
|
|
62
|
+
_context2.t1 = _context2.sent;
|
|
63
|
+
_context2.next = 8;
|
|
64
|
+
return (0, _context2.t0)(_context2.t1).toHaveNoViolations();
|
|
65
|
+
|
|
66
|
+
case 8:
|
|
67
|
+
case "end":
|
|
68
|
+
return _context2.stop();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}, _callee2);
|
|
72
|
+
})));
|
|
54
73
|
});
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Default = exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
|
|
8
|
+
var _ = require("..");
|
|
9
|
+
|
|
10
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
1
14
|
/**
|
|
2
15
|
* External dependencies
|
|
3
16
|
*/
|
|
4
|
-
|
|
17
|
+
|
|
5
18
|
/**
|
|
6
19
|
* Internal dependencies
|
|
7
20
|
*/
|
|
8
|
-
|
|
9
|
-
import { Badge } from '..';
|
|
10
|
-
export default {
|
|
21
|
+
var _default = {
|
|
11
22
|
title: 'Badge',
|
|
12
|
-
component: Badge
|
|
23
|
+
component: _.Badge
|
|
13
24
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
exports["default"] = _default;
|
|
26
|
+
|
|
27
|
+
var Default = function Default() {
|
|
28
|
+
return (0, _jsxRuntime.jsx)(_.Badge, {
|
|
29
|
+
children: "Badge"
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
|
+
|
|
5
|
+
var _jestAxe = require("jest-axe");
|
|
6
|
+
|
|
7
|
+
var _Badge = require("./Badge");
|
|
8
|
+
|
|
9
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
10
|
+
|
|
11
|
+
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
|
+
|
|
13
|
+
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); }); }; }
|
|
14
|
+
|
|
15
|
+
describe('<Badge />', function () {
|
|
16
|
+
it('renders the Badge component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
17
|
+
var _render, container;
|
|
18
|
+
|
|
19
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
20
|
+
while (1) {
|
|
21
|
+
switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
_render = (0, _react.render)((0, _jsxRuntime.jsx)(_Badge.Badge, {
|
|
24
|
+
children: "Badge text"
|
|
25
|
+
})), container = _render.container;
|
|
26
|
+
expect(_react.screen.getByText('Badge text')).toBeInTheDocument(); // Check for accessibility issues
|
|
27
|
+
|
|
28
|
+
_context.t0 = expect;
|
|
29
|
+
_context.next = 5;
|
|
30
|
+
return (0, _jestAxe.axe)(container);
|
|
31
|
+
|
|
32
|
+
case 5:
|
|
33
|
+
_context.t1 = _context.sent;
|
|
34
|
+
_context.next = 8;
|
|
35
|
+
return (0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
36
|
+
|
|
37
|
+
case 8:
|
|
38
|
+
case "end":
|
|
39
|
+
return _context.stop();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, _callee);
|
|
43
|
+
})));
|
|
44
|
+
it('renders the Badge component with a different variant', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
45
|
+
var _render2, container;
|
|
46
|
+
|
|
47
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
48
|
+
while (1) {
|
|
49
|
+
switch (_context2.prev = _context2.next) {
|
|
50
|
+
case 0:
|
|
51
|
+
_render2 = (0, _react.render)((0, _jsxRuntime.jsx)(_Badge.Badge, {
|
|
52
|
+
variant: "primary",
|
|
53
|
+
children: "Badge text"
|
|
54
|
+
})), container = _render2.container;
|
|
55
|
+
expect(_react.screen.getByText('Badge text')).toBeInTheDocument(); // Check for accessibility issues
|
|
56
|
+
|
|
57
|
+
_context2.t0 = expect;
|
|
58
|
+
_context2.next = 5;
|
|
59
|
+
return (0, _jestAxe.axe)(container);
|
|
60
|
+
|
|
61
|
+
case 5:
|
|
62
|
+
_context2.t1 = _context2.sent;
|
|
63
|
+
_context2.next = 8;
|
|
64
|
+
return (0, _context2.t0)(_context2.t1).toHaveNoViolations();
|
|
65
|
+
|
|
66
|
+
case 8:
|
|
67
|
+
case "end":
|
|
68
|
+
return _context2.stop();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}, _callee2);
|
|
72
|
+
})));
|
|
73
|
+
});
|
|
@@ -21,11 +21,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
21
21
|
* Internal dependencies
|
|
22
22
|
*/
|
|
23
23
|
var BlankState = function BlankState(_ref) {
|
|
24
|
-
var
|
|
24
|
+
var body = _ref.body,
|
|
25
|
+
cta = _ref.cta,
|
|
25
26
|
icon = _ref.icon,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
image = _ref.image,
|
|
28
|
+
_ref$imageAlt = _ref.imageAlt,
|
|
29
|
+
imageAlt = _ref$imageAlt === void 0 ? 'Image representing the blank state' : _ref$imageAlt,
|
|
30
|
+
title = _ref.title;
|
|
29
31
|
return (0, _jsxRuntime.jsxs)(_.Box, {
|
|
30
32
|
sx: {
|
|
31
33
|
textAlign: 'center',
|
|
@@ -36,7 +38,7 @@ var BlankState = function BlankState(_ref) {
|
|
|
36
38
|
sx: {
|
|
37
39
|
mb: 3
|
|
38
40
|
},
|
|
39
|
-
alt:
|
|
41
|
+
alt: imageAlt
|
|
40
42
|
}), (0, _jsxRuntime.jsx)(_.Heading, {
|
|
41
43
|
variant: "h4",
|
|
42
44
|
children: title
|
|
@@ -53,9 +55,10 @@ var BlankState = function BlankState(_ref) {
|
|
|
53
55
|
|
|
54
56
|
exports.BlankState = BlankState;
|
|
55
57
|
BlankState.propTypes = {
|
|
56
|
-
image: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].string]),
|
|
57
|
-
icon: _propTypes["default"].node,
|
|
58
|
-
title: _propTypes["default"].node,
|
|
59
58
|
body: _propTypes["default"].node,
|
|
60
|
-
cta: _propTypes["default"].node
|
|
59
|
+
cta: _propTypes["default"].node,
|
|
60
|
+
icon: _propTypes["default"].node,
|
|
61
|
+
image: _propTypes["default"].oneOfType([_propTypes["default"].object, _propTypes["default"].string]),
|
|
62
|
+
imageAlt: _propTypes["default"].string,
|
|
63
|
+
title: _propTypes["default"].node
|
|
61
64
|
};
|
|
@@ -1,25 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Default = exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
|
|
8
|
+
var _ = require("..");
|
|
9
|
+
|
|
10
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
1
14
|
/**
|
|
2
15
|
* External dependencies
|
|
3
16
|
*/
|
|
4
|
-
|
|
17
|
+
|
|
5
18
|
/**
|
|
6
19
|
* Internal dependencies
|
|
7
20
|
*/
|
|
8
|
-
|
|
9
|
-
import { Link, BlankState } from '..';
|
|
10
|
-
export default {
|
|
21
|
+
var _default = {
|
|
11
22
|
title: 'BlankState',
|
|
12
|
-
component: BlankState
|
|
23
|
+
component: _.BlankState
|
|
13
24
|
}; // eslint-disable-next-line max-len
|
|
14
25
|
|
|
26
|
+
exports["default"] = _default;
|
|
15
27
|
var image2 = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='79' height='79' viewBox='0 0 79 79' fill='none'%3E%3Cpath d='M66.3001 15.9C66.3001 15.9 66.3 15.8 66.2 15.8C66.1 15.7 66 15.5 65.9001 15.4C65.9001 15.4 65.9001 15.4 65.9001 15.3L44.4001 0.2C44.3001 0.0999998 44.2 0.0999994 44.1 0.0999994C44 0.0999994 44.0001 0 43.9001 0H43.3C43.2 0 43.1 0.0999994 43.1 0.0999994C43 0.0999994 42.9 0.2 42.8 0.2L28.2001 10.3C28.1 10.4 28.0001 10.5 27.9001 10.6C27.9001 10.6 27.9001 10.6 27.9001 10.7C27.8001 10.8 27.7001 11 27.7001 11.2C27.7001 11.2 27.7001 11.2 27.7001 11.3V31.1L13.9 40.8L13.7001 41C13.6001 41.1 13.6 41.1 13.6 41.2L13.5 41.3C13.5 41.4 13.4 41.5 13.4 41.5V41.6C13.4 41.7 13.3 41.8 13.3 42V62.2C13.3 62.4 13.3 62.6 13.4 62.7V62.8C13.5 62.9 13.6001 63.1 13.7001 63.2C13.7001 63.2 13.7 63.2 13.8 63.3L13.9 63.4L35.3 78.6H35.4001C35.4001 78.6 35.5 78.6 35.5 78.7H35.6C35.8 78.8 36 78.8 36.2001 78.8C36.3001 78.8 36.5 78.8 36.6 78.7H36.7001C36.8001 78.7 36.8001 78.7 36.9001 78.6C36.9001 78.6 37 78.6 37 78.5H37.1L66 58.3C66.1 58.2 66.2001 58.1 66.3001 58V15.9ZM34.6 74.5L16.1 61.3V44.7L34.6 57.8V74.5ZM36 55.3L17.2001 41.9L29 33.5L47.9001 46.9L36 55.3ZM49 44.1L30.5 31V14.4L49 27.5V44.1ZM50.5 24.9L31.6 11.5L43.5 3.2L62.4001 16.6L50.5 24.9Z' fill='%23BD9D70'/%3E%3C/svg%3E";
|
|
16
|
-
|
|
17
|
-
|
|
28
|
+
|
|
29
|
+
var Default = function Default() {
|
|
30
|
+
return (0, _jsxRuntime.jsx)(_.BlankState, {
|
|
18
31
|
image: image2,
|
|
19
32
|
title: "Power up your application",
|
|
20
33
|
body: "Add-ons give you the ability to bolt on extra capabilities to\nyour application, including logging, analytics and performance\nmonitoring.",
|
|
21
|
-
cta:
|
|
22
|
-
as: "a"
|
|
23
|
-
|
|
34
|
+
cta: (0, _jsxRuntime.jsx)(_.Link, {
|
|
35
|
+
as: "a",
|
|
36
|
+
children: "Explore add-ons \u2192"
|
|
37
|
+
})
|
|
24
38
|
});
|
|
25
|
-
};
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
|
+
|
|
5
|
+
var _jestAxe = require("jest-axe");
|
|
6
|
+
|
|
7
|
+
var _md = require("react-icons/md");
|
|
8
|
+
|
|
9
|
+
var _BlankState = require("./BlankState");
|
|
10
|
+
|
|
11
|
+
var _Link = require("../Link");
|
|
12
|
+
|
|
13
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
14
|
+
|
|
15
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
16
|
+
|
|
17
|
+
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); } }
|
|
18
|
+
|
|
19
|
+
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); }); }; }
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line max-len
|
|
22
|
+
var image = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='79' height='79' viewBox='0 0 79 79' fill='none'%3E%3Cpath d='M66.3001 15.9C66.3001 15.9 66.3 15.8 66.2 15.8C66.1 15.7 66 15.5 65.9001 15.4C65.9001 15.4 65.9001 15.4 65.9001 15.3L44.4001 0.2C44.3001 0.0999998 44.2 0.0999994 44.1 0.0999994C44 0.0999994 44.0001 0 43.9001 0H43.3C43.2 0 43.1 0.0999994 43.1 0.0999994C43 0.0999994 42.9 0.2 42.8 0.2L28.2001 10.3C28.1 10.4 28.0001 10.5 27.9001 10.6C27.9001 10.6 27.9001 10.6 27.9001 10.7C27.8001 10.8 27.7001 11 27.7001 11.2C27.7001 11.2 27.7001 11.2 27.7001 11.3V31.1L13.9 40.8L13.7001 41C13.6001 41.1 13.6 41.1 13.6 41.2L13.5 41.3C13.5 41.4 13.4 41.5 13.4 41.5V41.6C13.4 41.7 13.3 41.8 13.3 42V62.2C13.3 62.4 13.3 62.6 13.4 62.7V62.8C13.5 62.9 13.6001 63.1 13.7001 63.2C13.7001 63.2 13.7 63.2 13.8 63.3L13.9 63.4L35.3 78.6H35.4001C35.4001 78.6 35.5 78.6 35.5 78.7H35.6C35.8 78.8 36 78.8 36.2001 78.8C36.3001 78.8 36.5 78.8 36.6 78.7H36.7001C36.8001 78.7 36.8001 78.7 36.9001 78.6C36.9001 78.6 37 78.6 37 78.5H37.1L66 58.3C66.1 58.2 66.2001 58.1 66.3001 58V15.9ZM34.6 74.5L16.1 61.3V44.7L34.6 57.8V74.5ZM36 55.3L17.2001 41.9L29 33.5L47.9001 46.9L36 55.3ZM49 44.1L30.5 31V14.4L49 27.5V44.1ZM50.5 24.9L31.6 11.5L43.5 3.2L62.4001 16.6L50.5 24.9Z' fill='%23BD9D70'/%3E%3C/svg%3E";
|
|
23
|
+
var defaultProps = {
|
|
24
|
+
body: 'Sorry, there\'s nothing here yet.',
|
|
25
|
+
cta: (0, _jsxRuntime.jsx)(_Link.Link, {
|
|
26
|
+
as: "a",
|
|
27
|
+
children: "Explore add-ons \u2192"
|
|
28
|
+
}),
|
|
29
|
+
image: image,
|
|
30
|
+
imageAlt: 'This is the image alt',
|
|
31
|
+
title: 'Power up your application'
|
|
32
|
+
};
|
|
33
|
+
describe('<BlankState />', function () {
|
|
34
|
+
it('renders the BlankState component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
35
|
+
var _render, container;
|
|
36
|
+
|
|
37
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
38
|
+
while (1) {
|
|
39
|
+
switch (_context.prev = _context.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
_render = (0, _react.render)((0, _jsxRuntime.jsx)(_BlankState.BlankState, _extends({}, defaultProps))), container = _render.container;
|
|
42
|
+
expect(_react.screen.getByText(defaultProps.body)).toBeInTheDocument();
|
|
43
|
+
expect(_react.screen.getByText(defaultProps.title)).toBeInTheDocument();
|
|
44
|
+
expect(_react.screen.getByText('Explore add-ons →')).toBeInTheDocument();
|
|
45
|
+
expect(_react.screen.getByAltText(defaultProps.imageAlt)).toBeInTheDocument(); // Check for accessibility issues
|
|
46
|
+
|
|
47
|
+
_context.t0 = expect;
|
|
48
|
+
_context.next = 8;
|
|
49
|
+
return (0, _jestAxe.axe)(container);
|
|
50
|
+
|
|
51
|
+
case 8:
|
|
52
|
+
_context.t1 = _context.sent;
|
|
53
|
+
_context.next = 11;
|
|
54
|
+
return (0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
55
|
+
|
|
56
|
+
case 11:
|
|
57
|
+
case "end":
|
|
58
|
+
return _context.stop();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, _callee);
|
|
62
|
+
})));
|
|
63
|
+
it('renders the BlankState component with default alt text for the given image', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
64
|
+
var props, _render2, container;
|
|
65
|
+
|
|
66
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
67
|
+
while (1) {
|
|
68
|
+
switch (_context2.prev = _context2.next) {
|
|
69
|
+
case 0:
|
|
70
|
+
props = _extends({}, defaultProps, {
|
|
71
|
+
imageAlt: undefined
|
|
72
|
+
});
|
|
73
|
+
_render2 = (0, _react.render)((0, _jsxRuntime.jsx)(_BlankState.BlankState, _extends({}, props))), container = _render2.container;
|
|
74
|
+
expect(_react.screen.getByAltText('Image representing the blank state')).toBeInTheDocument(); // Check for accessibility issues
|
|
75
|
+
|
|
76
|
+
_context2.t0 = expect;
|
|
77
|
+
_context2.next = 6;
|
|
78
|
+
return (0, _jestAxe.axe)(container);
|
|
79
|
+
|
|
80
|
+
case 6:
|
|
81
|
+
_context2.t1 = _context2.sent;
|
|
82
|
+
_context2.next = 9;
|
|
83
|
+
return (0, _context2.t0)(_context2.t1).toHaveNoViolations();
|
|
84
|
+
|
|
85
|
+
case 9:
|
|
86
|
+
case "end":
|
|
87
|
+
return _context2.stop();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}, _callee2);
|
|
91
|
+
})));
|
|
92
|
+
it('renders the BlankState component with an icon', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
93
|
+
var icon, props, _render3, container;
|
|
94
|
+
|
|
95
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
96
|
+
while (1) {
|
|
97
|
+
switch (_context3.prev = _context3.next) {
|
|
98
|
+
case 0:
|
|
99
|
+
icon = (0, _jsxRuntime.jsx)(_md.MdContentCopy, {
|
|
100
|
+
title: "this is an icon"
|
|
101
|
+
});
|
|
102
|
+
props = _extends({}, defaultProps, {
|
|
103
|
+
icon: icon
|
|
104
|
+
});
|
|
105
|
+
_render3 = (0, _react.render)((0, _jsxRuntime.jsx)(_BlankState.BlankState, _extends({}, props))), container = _render3.container;
|
|
106
|
+
expect(_react.screen.getByTitle('this is an icon')).toBeInTheDocument(); // Check for accessibility issues
|
|
107
|
+
|
|
108
|
+
_context3.t0 = expect;
|
|
109
|
+
_context3.next = 7;
|
|
110
|
+
return (0, _jestAxe.axe)(container);
|
|
111
|
+
|
|
112
|
+
case 7:
|
|
113
|
+
_context3.t1 = _context3.sent;
|
|
114
|
+
_context3.next = 10;
|
|
115
|
+
return (0, _context3.t0)(_context3.t1).toHaveNoViolations();
|
|
116
|
+
|
|
117
|
+
case 10:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context3.stop();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}, _callee3);
|
|
123
|
+
})));
|
|
124
|
+
});
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Default = exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
|
|
8
|
+
var _ = require("..");
|
|
9
|
+
|
|
10
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
1
14
|
/**
|
|
2
15
|
* External dependencies
|
|
3
16
|
*/
|
|
4
|
-
|
|
17
|
+
|
|
5
18
|
/**
|
|
6
19
|
* Internal dependencies
|
|
7
20
|
*/
|
|
8
|
-
|
|
9
|
-
import { Box } from '..';
|
|
10
|
-
export default {
|
|
21
|
+
var _default = {
|
|
11
22
|
title: 'Box',
|
|
12
|
-
component: Box
|
|
23
|
+
component: _.Box
|
|
13
24
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
exports["default"] = _default;
|
|
26
|
+
|
|
27
|
+
var Default = function Default() {
|
|
28
|
+
return (0, _jsxRuntime.jsx)(_.Box, {
|
|
29
|
+
children: "Hello"
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.Default = Default;
|
|
@@ -1,31 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Default = exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
|
|
8
|
+
var _ = require("..");
|
|
9
|
+
|
|
10
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
1
14
|
/**
|
|
2
15
|
* External dependencies
|
|
3
16
|
*/
|
|
4
|
-
|
|
17
|
+
|
|
5
18
|
/**
|
|
6
19
|
* Internal dependencies
|
|
7
20
|
*/
|
|
8
|
-
|
|
9
|
-
import { Button } from '..';
|
|
10
|
-
export default {
|
|
21
|
+
var _default = {
|
|
11
22
|
title: 'Button',
|
|
12
|
-
component: Button
|
|
23
|
+
component: _.Button
|
|
13
24
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
25
|
+
exports["default"] = _default;
|
|
26
|
+
|
|
27
|
+
var Default = function Default() {
|
|
28
|
+
return (0, _jsxRuntime.jsxs)(_react["default"].Fragment, {
|
|
29
|
+
children: [(0, _jsxRuntime.jsx)(_.Button, {
|
|
30
|
+
sx: {
|
|
31
|
+
mr: 2
|
|
32
|
+
},
|
|
33
|
+
children: "Primary"
|
|
34
|
+
}), (0, _jsxRuntime.jsx)(_.Button, {
|
|
35
|
+
variant: "secondary",
|
|
36
|
+
sx: {
|
|
37
|
+
ml: 2
|
|
38
|
+
},
|
|
39
|
+
children: "Secondary"
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
|
+
|
|
5
|
+
var _jestAxe = require("jest-axe");
|
|
6
|
+
|
|
7
|
+
var _Button = require("./Button");
|
|
8
|
+
|
|
9
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
10
|
+
|
|
11
|
+
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
|
+
|
|
13
|
+
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); }); }; }
|
|
14
|
+
|
|
15
|
+
describe('<Button />', function () {
|
|
16
|
+
it('renders the Button component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
17
|
+
var _render, container;
|
|
18
|
+
|
|
19
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
20
|
+
while (1) {
|
|
21
|
+
switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
_render = (0, _react.render)((0, _jsxRuntime.jsx)(_Button.Button, {
|
|
24
|
+
children: "Button text"
|
|
25
|
+
})), container = _render.container;
|
|
26
|
+
expect(_react.screen.getByText('Button text')).toBeInTheDocument(); // Check for accessibility issues
|
|
27
|
+
|
|
28
|
+
_context.t0 = expect;
|
|
29
|
+
_context.next = 5;
|
|
30
|
+
return (0, _jestAxe.axe)(container);
|
|
31
|
+
|
|
32
|
+
case 5:
|
|
33
|
+
_context.t1 = _context.sent;
|
|
34
|
+
_context.next = 8;
|
|
35
|
+
return (0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
36
|
+
|
|
37
|
+
case 8:
|
|
38
|
+
case "end":
|
|
39
|
+
return _context.stop();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, _callee);
|
|
43
|
+
})));
|
|
44
|
+
});
|
|
@@ -1,16 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.Default = exports["default"] = void 0;
|
|
5
|
+
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
|
|
8
|
+
var _ = require("..");
|
|
9
|
+
|
|
10
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
1
14
|
/**
|
|
2
15
|
* External dependencies
|
|
3
16
|
*/
|
|
4
|
-
|
|
17
|
+
|
|
5
18
|
/**
|
|
6
19
|
* Internal dependencies
|
|
7
20
|
*/
|
|
8
|
-
|
|
9
|
-
import { Card } from '..';
|
|
10
|
-
export default {
|
|
21
|
+
var _default = {
|
|
11
22
|
title: 'Card',
|
|
12
|
-
component: Card
|
|
23
|
+
component: _.Card
|
|
13
24
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
exports["default"] = _default;
|
|
26
|
+
|
|
27
|
+
var Default = function Default() {
|
|
28
|
+
return (0, _jsxRuntime.jsx)(_.Card, {
|
|
29
|
+
children: "Hello"
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.Default = Default;
|