@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
|
@@ -0,0 +1,78 @@
|
|
|
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 _Card = require("./Card");
|
|
10
|
+
|
|
11
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
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); } }
|
|
16
|
+
|
|
17
|
+
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); }); }; }
|
|
18
|
+
|
|
19
|
+
var defaultProps = {};
|
|
20
|
+
describe('<Card />', function () {
|
|
21
|
+
it('renders the Card component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
22
|
+
var _render, container;
|
|
23
|
+
|
|
24
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
25
|
+
while (1) {
|
|
26
|
+
switch (_context.prev = _context.next) {
|
|
27
|
+
case 0:
|
|
28
|
+
_render = (0, _react.render)((0, _jsxRuntime.jsx)(_Card.Card, _extends({}, defaultProps, {
|
|
29
|
+
children: "This is a Card"
|
|
30
|
+
}))), container = _render.container;
|
|
31
|
+
expect(_react.screen.getByText('This is a Card')).toBeInTheDocument(); // Check for accessibility issues
|
|
32
|
+
|
|
33
|
+
_context.t0 = expect;
|
|
34
|
+
_context.next = 5;
|
|
35
|
+
return (0, _jestAxe.axe)(container);
|
|
36
|
+
|
|
37
|
+
case 5:
|
|
38
|
+
_context.t1 = _context.sent;
|
|
39
|
+
_context.next = 8;
|
|
40
|
+
return (0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
41
|
+
|
|
42
|
+
case 8:
|
|
43
|
+
case "end":
|
|
44
|
+
return _context.stop();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}, _callee);
|
|
48
|
+
})));
|
|
49
|
+
it('renders the Card component with a different variant', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
50
|
+
var _render2, container;
|
|
51
|
+
|
|
52
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
53
|
+
while (1) {
|
|
54
|
+
switch (_context2.prev = _context2.next) {
|
|
55
|
+
case 0:
|
|
56
|
+
_render2 = (0, _react.render)((0, _jsxRuntime.jsx)(_Card.Card, {
|
|
57
|
+
variant: "primary",
|
|
58
|
+
children: "Card text"
|
|
59
|
+
})), container = _render2.container;
|
|
60
|
+
expect(_react.screen.getByText('Card text')).toBeInTheDocument(); // Check for accessibility issues
|
|
61
|
+
|
|
62
|
+
_context2.t0 = expect;
|
|
63
|
+
_context2.next = 5;
|
|
64
|
+
return (0, _jestAxe.axe)(container);
|
|
65
|
+
|
|
66
|
+
case 5:
|
|
67
|
+
_context2.t1 = _context2.sent;
|
|
68
|
+
_context2.next = 8;
|
|
69
|
+
return (0, _context2.t0)(_context2.t1).toHaveNoViolations();
|
|
70
|
+
|
|
71
|
+
case 8:
|
|
72
|
+
case "end":
|
|
73
|
+
return _context2.stop();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}, _callee2);
|
|
77
|
+
})));
|
|
78
|
+
});
|
|
@@ -61,18 +61,21 @@ var Code = function Code(_ref) {
|
|
|
61
61
|
sx: {
|
|
62
62
|
position: 'relative'
|
|
63
63
|
},
|
|
64
|
-
children: [codeDom, (0, _jsxRuntime.jsx)("
|
|
64
|
+
children: [codeDom, (0, _jsxRuntime.jsx)("button", {
|
|
65
|
+
"aria-label": "Copy",
|
|
65
66
|
sx: {
|
|
66
|
-
position: 'absolute',
|
|
67
|
-
top: 0,
|
|
68
67
|
bg: 'grey.10',
|
|
69
|
-
right: 0,
|
|
70
|
-
paddingRight: 2,
|
|
71
|
-
paddingLeft: 2,
|
|
72
|
-
paddingTop: 1,
|
|
73
|
-
paddingBottom: 1,
|
|
74
68
|
borderTopRightRadius: 1,
|
|
69
|
+
borderWidth: 0,
|
|
70
|
+
color: 'muted',
|
|
75
71
|
opacity: 0.8,
|
|
72
|
+
paddingBottom: 1,
|
|
73
|
+
paddingLeft: 2,
|
|
74
|
+
paddingRight: 2,
|
|
75
|
+
paddingTop: 1,
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
right: 0,
|
|
78
|
+
top: '-1px',
|
|
76
79
|
'&:hover': {
|
|
77
80
|
opacity: 1,
|
|
78
81
|
cursor: 'pointer'
|
|
@@ -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 { Code } from '..';
|
|
10
|
-
export default {
|
|
21
|
+
var _default = {
|
|
11
22
|
title: 'Code',
|
|
12
|
-
component: Code
|
|
23
|
+
component: _.Code
|
|
13
24
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
exports["default"] = _default;
|
|
26
|
+
|
|
27
|
+
var Default = function Default() {
|
|
28
|
+
return (0, _jsxRuntime.jsx)(_.Code, {
|
|
29
|
+
children: "Code"
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,167 @@
|
|
|
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 _Code = require("./Code");
|
|
10
|
+
|
|
11
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
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); } }
|
|
16
|
+
|
|
17
|
+
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); }); }; }
|
|
18
|
+
|
|
19
|
+
var defaultProps = {
|
|
20
|
+
showCopy: false
|
|
21
|
+
}; // Mock navigator.clipboard because jsdom doesn't support it
|
|
22
|
+
|
|
23
|
+
Object.defineProperty(window.navigator, 'clipboard', {
|
|
24
|
+
value: {
|
|
25
|
+
writeText: function writeText() {}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
describe('<Code />', function () {
|
|
29
|
+
it('renders the Code component', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
30
|
+
var _render, container;
|
|
31
|
+
|
|
32
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
33
|
+
while (1) {
|
|
34
|
+
switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
_render = (0, _react.render)((0, _jsxRuntime.jsx)(_Code.Code, _extends({}, defaultProps, {
|
|
37
|
+
children: "This is a code"
|
|
38
|
+
}))), container = _render.container;
|
|
39
|
+
expect(_react.screen.getByText('This is a code')).toBeInTheDocument(); // Check for accessibility issues
|
|
40
|
+
|
|
41
|
+
_context.t0 = expect;
|
|
42
|
+
_context.next = 5;
|
|
43
|
+
return (0, _jestAxe.axe)(container);
|
|
44
|
+
|
|
45
|
+
case 5:
|
|
46
|
+
_context.t1 = _context.sent;
|
|
47
|
+
_context.next = 8;
|
|
48
|
+
return (0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
49
|
+
|
|
50
|
+
case 8:
|
|
51
|
+
case "end":
|
|
52
|
+
return _context.stop();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}, _callee);
|
|
56
|
+
}))); // jsdom currently doesn't support pseudo-elements with getComputedStyle
|
|
57
|
+
|
|
58
|
+
it.skip('renders "$" in front of the code when in prompt mode', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
59
|
+
var props, _render2, container, codeElement;
|
|
60
|
+
|
|
61
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
62
|
+
while (1) {
|
|
63
|
+
switch (_context2.prev = _context2.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
props = _extends({}, defaultProps, {
|
|
66
|
+
prompt: true
|
|
67
|
+
});
|
|
68
|
+
_render2 = (0, _react.render)((0, _jsxRuntime.jsx)(_Code.Code, _extends({}, props, {
|
|
69
|
+
children: "This is a code"
|
|
70
|
+
}))), container = _render2.container;
|
|
71
|
+
codeElement = _react.screen.getByText('This is a code');
|
|
72
|
+
expect(window.getComputedStyle(codeElement, ':before').content).toEqual('$'); // Check for accessibility issues
|
|
73
|
+
|
|
74
|
+
_context2.t0 = expect;
|
|
75
|
+
_context2.next = 7;
|
|
76
|
+
return (0, _jestAxe.axe)(container);
|
|
77
|
+
|
|
78
|
+
case 7:
|
|
79
|
+
_context2.t1 = _context2.sent;
|
|
80
|
+
_context2.next = 10;
|
|
81
|
+
return (0, _context2.t0)(_context2.t1).toHaveNoViolations();
|
|
82
|
+
|
|
83
|
+
case 10:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context2.stop();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}, _callee2);
|
|
89
|
+
})));
|
|
90
|
+
it('renders the Code component with a copy button', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
91
|
+
var props, _render3, container;
|
|
92
|
+
|
|
93
|
+
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
94
|
+
while (1) {
|
|
95
|
+
switch (_context3.prev = _context3.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
props = _extends({}, defaultProps, {
|
|
98
|
+
showCopy: true
|
|
99
|
+
});
|
|
100
|
+
_render3 = (0, _react.render)((0, _jsxRuntime.jsx)(_Code.Code, _extends({}, props, {
|
|
101
|
+
children: "This is a code"
|
|
102
|
+
}))), container = _render3.container;
|
|
103
|
+
expect(_react.screen.getByRole('button', {
|
|
104
|
+
name: 'Copy'
|
|
105
|
+
})).toBeInTheDocument(); // Check for accessibility issues
|
|
106
|
+
|
|
107
|
+
_context3.t0 = expect;
|
|
108
|
+
_context3.next = 6;
|
|
109
|
+
return (0, _jestAxe.axe)(container);
|
|
110
|
+
|
|
111
|
+
case 6:
|
|
112
|
+
_context3.t1 = _context3.sent;
|
|
113
|
+
_context3.next = 9;
|
|
114
|
+
return (0, _context3.t0)(_context3.t1).toHaveNoViolations();
|
|
115
|
+
|
|
116
|
+
case 9:
|
|
117
|
+
case "end":
|
|
118
|
+
return _context3.stop();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}, _callee3);
|
|
122
|
+
})));
|
|
123
|
+
it('updates the the UI after clicking on "Copy"', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
124
|
+
var props, _render4, container;
|
|
125
|
+
|
|
126
|
+
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
127
|
+
while (1) {
|
|
128
|
+
switch (_context4.prev = _context4.next) {
|
|
129
|
+
case 0:
|
|
130
|
+
props = _extends({}, defaultProps, {
|
|
131
|
+
showCopy: true
|
|
132
|
+
});
|
|
133
|
+
_render4 = (0, _react.render)((0, _jsxRuntime.jsx)(_Code.Code, _extends({}, props, {
|
|
134
|
+
children: "This is a code"
|
|
135
|
+
}))), container = _render4.container;
|
|
136
|
+
|
|
137
|
+
_react.fireEvent.click(_react.screen.getByRole('button', {
|
|
138
|
+
name: 'Copy'
|
|
139
|
+
}));
|
|
140
|
+
|
|
141
|
+
_context4.next = 5;
|
|
142
|
+
return (0, _react.waitFor)(function () {
|
|
143
|
+
return new Promise(function (res) {
|
|
144
|
+
return setTimeout(res, 0);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
case 5:
|
|
149
|
+
expect(_react.screen.getByText('Copied!')).toBeInTheDocument(); // Check for accessibility issues
|
|
150
|
+
|
|
151
|
+
_context4.t0 = expect;
|
|
152
|
+
_context4.next = 9;
|
|
153
|
+
return (0, _jestAxe.axe)(container);
|
|
154
|
+
|
|
155
|
+
case 9:
|
|
156
|
+
_context4.t1 = _context4.sent;
|
|
157
|
+
_context4.next = 12;
|
|
158
|
+
return (0, _context4.t0)(_context4.t1).toHaveNoViolations();
|
|
159
|
+
|
|
160
|
+
case 12:
|
|
161
|
+
case "end":
|
|
162
|
+
return _context4.stop();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}, _callee4);
|
|
166
|
+
})));
|
|
167
|
+
});
|
|
@@ -1,32 +1,55 @@
|
|
|
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, ConfirmationDialog, Button, Heading, Text, Flex } from '..';
|
|
10
|
-
export default {
|
|
21
|
+
var _default = {
|
|
11
22
|
title: 'ConfirmationDialog',
|
|
12
|
-
component: ConfirmationDialog
|
|
23
|
+
component: _.ConfirmationDialog
|
|
13
24
|
};
|
|
14
|
-
|
|
25
|
+
exports["default"] = _default;
|
|
26
|
+
var ConfirmationTrigger = (0, _jsxRuntime.jsx)(_.Button, {
|
|
15
27
|
sx: {
|
|
16
28
|
mr: 3
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
},
|
|
30
|
+
children: "Dangerous Action"
|
|
31
|
+
});
|
|
32
|
+
var ConfirmationContent = (0, _jsxRuntime.jsxs)(_.Box, {
|
|
33
|
+
p: 5,
|
|
34
|
+
children: [(0, _jsxRuntime.jsx)(_.Heading, {
|
|
35
|
+
children: "This is a Modal"
|
|
36
|
+
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
37
|
+
sx: {
|
|
38
|
+
fontSize: 3
|
|
39
|
+
},
|
|
40
|
+
children: "A modal is used to perform more detailed actions that don\u2018t necessarily need the context behind."
|
|
41
|
+
})]
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
var Default = function Default() {
|
|
45
|
+
return (0, _jsxRuntime.jsx)(_.Flex, {
|
|
46
|
+
children: (0, _jsxRuntime.jsx)(_.Box, {
|
|
47
|
+
children: (0, _jsxRuntime.jsx)(_.ConfirmationDialog, {
|
|
48
|
+
trigger: ConfirmationTrigger,
|
|
49
|
+
content: ConfirmationContent
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
exports.Default = Default;
|
|
@@ -1,43 +1,83 @@
|
|
|
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, Dialog, DialogMenu, DialogMenuItem, DialogDivider, Button, Heading, Text, Flex } from '..';
|
|
10
|
-
export default {
|
|
21
|
+
var _default = {
|
|
11
22
|
title: 'Dialog',
|
|
12
|
-
component: Dialog
|
|
23
|
+
component: _.Dialog
|
|
13
24
|
};
|
|
14
|
-
|
|
15
|
-
var
|
|
25
|
+
exports["default"] = _default;
|
|
26
|
+
var DropdownTrigger = (0, _jsxRuntime.jsx)(_.Button, {
|
|
27
|
+
children: "Trigger Dropdown"
|
|
28
|
+
});
|
|
29
|
+
var ModalTrigger = (0, _jsxRuntime.jsx)(_.Button, {
|
|
16
30
|
sx: {
|
|
17
31
|
mr: 3
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
},
|
|
33
|
+
children: "Trigger Modal"
|
|
34
|
+
});
|
|
35
|
+
var DropdownContent = (0, _jsxRuntime.jsxs)("div", {
|
|
36
|
+
children: [(0, _jsxRuntime.jsxs)(_.DialogMenu, {
|
|
37
|
+
children: [(0, _jsxRuntime.jsx)(_.DialogMenuItem, {
|
|
38
|
+
children: "Profile"
|
|
39
|
+
}), (0, _jsxRuntime.jsx)(_.DialogMenuItem, {
|
|
40
|
+
children: "Account"
|
|
41
|
+
}), (0, _jsxRuntime.jsx)(_.DialogMenuItem, {
|
|
42
|
+
children: "Dark Mode"
|
|
43
|
+
})]
|
|
44
|
+
}), (0, _jsxRuntime.jsx)(_.DialogDivider, {}), (0, _jsxRuntime.jsx)(_.DialogMenu, {
|
|
45
|
+
children: (0, _jsxRuntime.jsx)(_.DialogMenuItem, {
|
|
46
|
+
children: "Logout"
|
|
47
|
+
})
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
var ModalContent = (0, _jsxRuntime.jsxs)(_.Box, {
|
|
51
|
+
p: 5,
|
|
52
|
+
children: [(0, _jsxRuntime.jsx)(_.Heading, {
|
|
53
|
+
children: "This is a Modal"
|
|
54
|
+
}), (0, _jsxRuntime.jsx)(_.Text, {
|
|
32
55
|
sx: {
|
|
33
|
-
|
|
56
|
+
fontSize: 3
|
|
34
57
|
},
|
|
35
|
-
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
58
|
+
children: "A modal is used to perform more detailed actions that don\u2018t necessarily need the context behind."
|
|
59
|
+
})]
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
var Default = function Default() {
|
|
63
|
+
return (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
64
|
+
children: [(0, _jsxRuntime.jsx)(_.Box, {
|
|
65
|
+
children: (0, _jsxRuntime.jsx)(_.Dialog, {
|
|
66
|
+
trigger: ModalTrigger,
|
|
67
|
+
content: ModalContent,
|
|
68
|
+
sx: {
|
|
69
|
+
width: 480
|
|
70
|
+
},
|
|
71
|
+
variant: "modal"
|
|
72
|
+
})
|
|
73
|
+
}), (0, _jsxRuntime.jsx)(_.Dialog, {
|
|
74
|
+
trigger: DropdownTrigger,
|
|
75
|
+
content: DropdownContent,
|
|
76
|
+
sx: {
|
|
77
|
+
width: 200
|
|
78
|
+
}
|
|
79
|
+
})]
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.Default = Default;
|
|
@@ -147,7 +147,9 @@ var DialogMotion = function DialogMotion(_ref2) {
|
|
|
147
147
|
right: position === 'left' ? 'auto' : 0,
|
|
148
148
|
padding: 0,
|
|
149
149
|
display: 'inline-block',
|
|
150
|
-
variant: "dialog." + variant
|
|
150
|
+
variant: "dialog." + variant,
|
|
151
|
+
overflow: 'auto',
|
|
152
|
+
maxHeight: variant === 'modal' ? '90%' : ''
|
|
151
153
|
}
|
|
152
154
|
}));
|
|
153
155
|
};
|
|
@@ -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 { Flex } from '..';
|
|
10
|
-
export default {
|
|
21
|
+
var _default = {
|
|
11
22
|
title: 'Flex',
|
|
12
|
-
component: Flex
|
|
23
|
+
component: _.Flex
|
|
13
24
|
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
exports["default"] = _default;
|
|
26
|
+
|
|
27
|
+
var Default = function Default() {
|
|
28
|
+
return (0, _jsxRuntime.jsx)(_.Flex, {
|
|
29
|
+
children: "Hello"
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.AsyncSearchSelect = void 0;
|
|
5
|
+
|
|
6
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
|
|
8
|
+
var _reactSelectAsyncPaginate = require("react-select-async-paginate");
|
|
9
|
+
|
|
10
|
+
var _SearchSelect = require("./SearchSelect");
|
|
11
|
+
|
|
12
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
13
|
+
|
|
14
|
+
var _excluded = ["options"];
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
// Asynchronous search select to load paginated results asynchronously
|
|
23
|
+
var CustomAsyncPaginate = (0, _reactSelectAsyncPaginate.withAsyncPaginate)(_SearchSelect.SearchSelect);
|
|
24
|
+
|
|
25
|
+
var AsyncSearchSelect = function AsyncSearchSelect(_ref) {
|
|
26
|
+
var options = _ref.options,
|
|
27
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
28
|
+
|
|
29
|
+
return (0, _jsxRuntime.jsx)(CustomAsyncPaginate, _extends({
|
|
30
|
+
SelectComponent: _SearchSelect.SearchSelect,
|
|
31
|
+
loadOptions: options
|
|
32
|
+
}, props));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.AsyncSearchSelect = AsyncSearchSelect;
|
|
36
|
+
AsyncSearchSelect.propTypes = {
|
|
37
|
+
options: _propTypes["default"].array
|
|
38
|
+
};
|
|
@@ -38,7 +38,7 @@ var Input = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
38
38
|
required: required,
|
|
39
39
|
sx: {
|
|
40
40
|
border: '1px solid',
|
|
41
|
-
borderColor: '
|
|
41
|
+
borderColor: 'border',
|
|
42
42
|
backgroundColor: 'card',
|
|
43
43
|
borderRadius: 1,
|
|
44
44
|
lineHeight: 'inherit',
|
|
@@ -57,7 +57,7 @@ var Input = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
57
57
|
bg: 'backgroundSecondary'
|
|
58
58
|
},
|
|
59
59
|
'&::placeholder': {
|
|
60
|
-
color: '
|
|
60
|
+
color: 'placeholder'
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
})), hasError && errorMessage && (0, _jsxRuntime.jsx)(_.Validation, {
|
|
@@ -1,18 +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 { Input } from '..';
|
|
10
|
-
export default {
|
|
21
|
+
var _default = {
|
|
11
22
|
title: 'Input',
|
|
12
|
-
component: Input
|
|
23
|
+
component: _.Input
|
|
13
24
|
};
|
|
14
|
-
|
|
15
|
-
|
|
25
|
+
exports["default"] = _default;
|
|
26
|
+
|
|
27
|
+
var Default = function Default() {
|
|
28
|
+
return (0, _jsxRuntime.jsx)(_.Input, {
|
|
16
29
|
placeholder: "Your input here..."
|
|
17
30
|
});
|
|
18
|
-
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.Default = Default;
|