@automattic/vip-design-system 0.10.3 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslines.json +8 -8
- package/.eslintrc.json +9 -4
- package/.github/PULL_REQUEST_TEMPLATE.md +1 -1
- package/.github/workflows/nodejs.yaml +14 -14
- package/.prettierrc +1 -2
- package/.storybook/main.js +1 -1
- package/.storybook/preview.js +4 -8
- package/README.md +1 -0
- package/babel.config.js +1 -1
- package/build/system/Avatar/Avatar.js +2 -1
- package/build/system/BlankState/BlankState.stories.js +3 -3
- package/build/system/BlankState/BlankState.test.js +2 -2
- package/build/system/Card/Card.test.js +0 -2
- package/build/system/Code/Code.js +7 -2
- package/build/system/Code/Code.test.js +22 -57
- package/build/system/Form/MultiSelect.js +45 -25
- package/build/system/Form/Select.stories.js +3 -4
- package/build/system/Form/Select.test.js +2 -2
- package/build/system/Notification/Notification.js +24 -15
- package/build/system/Notification/Notification.stories.js +14 -4
- package/build/system/OptionRow/OptionRow.js +23 -17
- package/build/system/OptionRow/OptionRow.stories.js +5 -5
- package/build/system/OptionRow/OptionRow.test.js +4 -4
- package/build/system/ResourceList/ResourceList.js +34 -25
- package/build/system/ResourceList/ResourceList.stories.js +2 -0
- package/build/system/ScreenReaderText/ScreenReader.test.js +37 -0
- package/build/system/ScreenReaderText/ScreenReaderText.js +49 -0
- package/build/system/ScreenReaderText/index.js +7 -0
- package/build/system/Time/index.js +1 -1
- package/build/system/UsageChart/UsageChart.js +47 -45
- package/build/system/UsageChart/UsageChart.stories.js +8 -8
- package/build/system/UsageChart/index.js +3 -3
- package/build/system/Wizard/Wizard.stories.js +1 -1
- package/package.json +8 -4
- package/src/system/Avatar/Avatar.js +1 -0
- package/src/system/Avatar/index.js +0 -1
- package/src/system/Badge/index.js +0 -1
- package/src/system/BlankState/BlankState.js +8 -5
- package/src/system/BlankState/BlankState.stories.jsx +5 -4
- package/src/system/BlankState/BlankState.test.js +21 -21
- package/src/system/BlankState/index.js +0 -1
- package/src/system/Box/Box.js +7 -1
- package/src/system/Box/index.js +0 -1
- package/src/system/Button/Button.js +3 -3
- package/src/system/Button/Button.stories.jsx +2 -2
- package/src/system/Button/index.js +0 -1
- package/src/system/Card/Card.js +4 -4
- package/src/system/Card/Card.test.js +1 -2
- package/src/system/Card/index.js +0 -1
- package/src/system/Code/Code.js +6 -2
- package/src/system/Code/Code.stories.jsx +10 -5
- package/src/system/Code/Code.test.js +3 -16
- package/src/system/ConfirmationDialog/ConfirmationDialog.js +8 -1
- package/src/system/Dialog/Dialog.js +17 -8
- package/src/system/Dialog/Dialog.stories.jsx +9 -13
- package/src/system/Dialog/DialogButton.js +18 -14
- package/src/system/Dialog/DialogDivider.js +1 -1
- package/src/system/Dialog/DialogMenu.js +1 -5
- package/src/system/Dialog/DialogMenuItem.js +4 -8
- package/src/system/Dialog/DialogTrigger.js +1 -1
- package/src/system/Dialog/index.js +0 -1
- package/src/system/Flex/Flex.js +1 -1
- package/src/system/Flex/index.js +0 -1
- package/src/system/Form/AsyncSearchSelect.js +3 -7
- package/src/system/Form/Checkbox.js +32 -28
- package/src/system/Form/InlineSelect.js +21 -17
- package/src/system/Form/Input.js +43 -45
- package/src/system/Form/Label.js +2 -2
- package/src/system/Form/RadioBoxGroup.js +34 -32
- package/src/system/Form/RadioBoxGroup.stories.jsx +8 -1
- package/src/system/Form/SearchSelect.js +7 -7
- package/src/system/Form/Select.js +21 -2
- package/src/system/Form/Select.stories.jsx +31 -34
- package/src/system/Form/Select.test.js +3 -8
- package/src/system/Form/Textarea.js +38 -40
- package/src/system/Form/Toggle.js +9 -11
- package/src/system/Form/ToggleGroup.js +29 -31
- package/src/system/Form/ToggleGroup.stories.jsx +8 -1
- package/src/system/Form/ToggleRow.js +6 -1
- package/src/system/Form/Validation.js +6 -1
- package/src/system/Form/index.js +13 -1
- package/src/system/Grid/Grid.js +1 -1
- package/src/system/Grid/index.js +0 -1
- package/src/system/Heading/Heading.js +4 -4
- package/src/system/Heading/index.js +0 -1
- package/src/system/Link/index.js +0 -1
- package/src/system/Notice/Notice.js +27 -13
- package/src/system/Notice/Notice.stories.jsx +6 -8
- package/src/system/Notice/index.js +0 -1
- package/src/system/Notification/Notification.js +25 -20
- package/src/system/Notification/Notification.stories.jsx +4 -4
- package/src/system/Notification/index.js +0 -1
- package/src/system/OptionRow/OptionRow.js +46 -44
- package/src/system/OptionRow/OptionRow.stories.jsx +10 -8
- package/src/system/OptionRow/OptionRow.test.js +12 -11
- package/src/system/OptionRow/index.js +0 -1
- package/src/system/Progress/Progress.js +3 -1
- package/src/system/Progress/Progress.stories.jsx +4 -4
- package/src/system/Progress/index.js +0 -1
- package/src/system/ResourceList/ResourceItem.js +15 -15
- package/src/system/ResourceList/ResourceList.js +28 -16
- package/src/system/ResourceList/ResourceList.stories.jsx +77 -71
- package/src/system/ScreenReaderText/ScreenReader.test.js +22 -0
- package/src/system/ScreenReaderText/ScreenReaderText.js +40 -0
- package/src/system/ScreenReaderText/index.js +7 -0
- package/src/system/Spinner/Spinner.js +4 -4
- package/src/system/Spinner/index.js +0 -1
- package/src/system/Table/Table.js +5 -5
- package/src/system/Table/Table.stories.jsx +10 -8
- package/src/system/Table/index.js +0 -1
- package/src/system/Tabs/Tabs.js +3 -3
- package/src/system/Tabs/index.js +0 -1
- package/src/system/Text/Text.js +3 -3
- package/src/system/Text/Text.stories.jsx +4 -6
- package/src/system/Text/index.js +0 -1
- package/src/system/Time/Time.stories.jsx +2 -6
- package/src/system/Time/index.js +5 -5
- package/src/system/Timeline/Timeline.js +6 -12
- package/src/system/Timeline/Timeline.stories.jsx +3 -12
- package/src/system/Timeline/index.js +0 -1
- package/src/system/Tooltip/Tooltip.js +4 -8
- package/src/system/Wizard/Wizard.js +23 -21
- package/src/system/Wizard/Wizard.stories.jsx +7 -12
- package/src/system/Wizard/WizardStep.js +8 -8
- package/src/system/Wizard/WizardStepHorizontal.js +4 -4
- package/src/system/Wizard/index.js +0 -1
- package/src/system/theme/index.js +3 -4
- package/tokens/valet-color.json +1919 -0
package/.eslines.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
"branches": {
|
|
3
|
+
"default": [ "downgrade-unmodified-lines" ]
|
|
4
|
+
},
|
|
5
|
+
"processors": {
|
|
6
|
+
"downgrade-unmodified-lines": {
|
|
7
|
+
"remote": "origin/master"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
10
|
}
|
package/.eslintrc.json
CHANGED
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
"parser": "@babel/eslint-parser",
|
|
3
3
|
"parserOptions": {
|
|
4
4
|
"babelOptions": {
|
|
5
|
-
"presets": ["@babel/preset-react"]
|
|
5
|
+
"presets": [ "@babel/preset-react" ]
|
|
6
6
|
}
|
|
7
7
|
},
|
|
8
|
-
"extends": ["plugin:storybook/recommended", "wpvip"],
|
|
9
|
-
"plugins": ["react", "jsx-a11y"],
|
|
8
|
+
"extends": [ "plugin:storybook/recommended", "prettier", "wpvip" ],
|
|
9
|
+
"plugins": [ "react", "jsx-a11y", "prettier" ],
|
|
10
10
|
"rules": {
|
|
11
11
|
"id-length": 0,
|
|
12
12
|
"react/jsx-uses-react": "off",
|
|
13
|
-
"react/react-in-jsx-scope": "off"
|
|
13
|
+
"react/react-in-jsx-scope": "off",
|
|
14
|
+
"no-use-before-define": "off",
|
|
15
|
+
"prettier/prettier": "error",
|
|
16
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
17
|
+
"@typescript-eslint/no-var-requires": "off",
|
|
18
|
+
"@typescript-eslint/no-explicit-any": "off"
|
|
14
19
|
},
|
|
15
20
|
"settings": {
|
|
16
21
|
"react": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Description
|
|
2
2
|
|
|
3
|
-
A few sentences describing the overall goals of the pull request. Any special considerations and decisions.
|
|
3
|
+
A few sentences describing the overall goals of the pull request. Any special considerations and decisions.
|
|
4
4
|
|
|
5
5
|
Also include any references to relevant discussions and documentation.
|
|
6
6
|
|
|
@@ -4,7 +4,6 @@ on: [push]
|
|
|
4
4
|
|
|
5
5
|
jobs:
|
|
6
6
|
build:
|
|
7
|
-
|
|
8
7
|
runs-on: ubuntu-latest
|
|
9
8
|
|
|
10
9
|
timeout-minutes: 5
|
|
@@ -14,16 +13,17 @@ jobs:
|
|
|
14
13
|
node-version: [14.x]
|
|
15
14
|
|
|
16
15
|
steps:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
- uses: actions/checkout@v2
|
|
17
|
+
with:
|
|
18
|
+
persist-credentials: false
|
|
19
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
20
|
+
uses: actions/setup-node@v1
|
|
21
|
+
with:
|
|
22
|
+
node-version: ${{ matrix.node-version }}
|
|
23
|
+
- run: npm install -g npm@7.24.2
|
|
24
|
+
- run: npm install
|
|
25
|
+
- run: npm run format:check
|
|
26
|
+
- run: npm run test
|
|
27
|
+
- run: npm run build
|
|
28
|
+
env:
|
|
29
|
+
CI: true
|
package/.prettierrc
CHANGED
package/.storybook/main.js
CHANGED
package/.storybook/preview.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
|
-
import axe from '@axe-core/react'
|
|
3
|
+
import axe from '@axe-core/react';
|
|
4
4
|
import withBoundingBox from './decorators/withBoundingBox';
|
|
5
5
|
import withColorMode, { backgrounds } from './decorators/withColorMode';
|
|
6
6
|
import withThemeProvider from './decorators/withThemeProvider';
|
|
7
7
|
|
|
8
8
|
axe( React, ReactDOM, 1000 );
|
|
9
9
|
|
|
10
|
-
export const decorators = [
|
|
11
|
-
withBoundingBox,
|
|
12
|
-
withColorMode,
|
|
13
|
-
withThemeProvider,
|
|
14
|
-
];
|
|
10
|
+
export const decorators = [ withBoundingBox, withColorMode, withThemeProvider ];
|
|
15
11
|
|
|
16
12
|
export const parameters = {
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
actions: { argTypesRegex: '^on[A-Z].*' },
|
|
14
|
+
backgrounds,
|
|
19
15
|
};
|
package/README.md
CHANGED
package/babel.config.js
CHANGED
|
@@ -51,7 +51,8 @@ var Avatar = function Avatar(_ref) {
|
|
|
51
51
|
padding: '1px',
|
|
52
52
|
textAlign: 'center'
|
|
53
53
|
},
|
|
54
|
-
className: (0, _classnames["default"])('vip-avatar-component', className)
|
|
54
|
+
className: (0, _classnames["default"])('vip-avatar-component', className),
|
|
55
|
+
"aria-hidden": "true"
|
|
55
56
|
}, props, {
|
|
56
57
|
children: src ? (0, _jsxRuntime.jsx)(_themeUi.Image, {
|
|
57
58
|
src: src,
|
|
@@ -13,10 +13,10 @@ var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
|
13
13
|
var _default = {
|
|
14
14
|
title: 'BlankState',
|
|
15
15
|
component: _.BlankState
|
|
16
|
-
};
|
|
17
|
-
|
|
16
|
+
};
|
|
18
17
|
exports["default"] = _default;
|
|
19
|
-
var image2 =
|
|
18
|
+
var image2 = // eslint-disable-next-line max-len
|
|
19
|
+
"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";
|
|
20
20
|
|
|
21
21
|
var Default = function Default() {
|
|
22
22
|
return (0, _jsxRuntime.jsx)(_.BlankState, {
|
|
@@ -27,8 +27,8 @@ var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
|
27
27
|
/**
|
|
28
28
|
* Internal dependencies
|
|
29
29
|
*/
|
|
30
|
-
// eslint-disable-next-line max-len
|
|
31
|
-
|
|
30
|
+
var image = // eslint-disable-next-line max-len
|
|
31
|
+
"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";
|
|
32
32
|
var defaultProps = {
|
|
33
33
|
body: "Sorry, there's nothing here yet.",
|
|
34
34
|
cta: (0, _jsxRuntime.jsx)(_Link.Link, {
|
|
@@ -65,7 +65,7 @@ var Code = function Code(_ref) {
|
|
|
65
65
|
position: 'relative'
|
|
66
66
|
},
|
|
67
67
|
children: [codeDom, (0, _jsxRuntime.jsx)("button", {
|
|
68
|
-
"aria-label": "Copy",
|
|
68
|
+
"aria-label": "Copy code",
|
|
69
69
|
sx: {
|
|
70
70
|
bg: 'grey.10',
|
|
71
71
|
borderTopRightRadius: 1,
|
|
@@ -94,7 +94,12 @@ var Code = function Code(_ref) {
|
|
|
94
94
|
onCopy();
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
|
-
children: copied ?
|
|
97
|
+
children: copied ? (0, _jsxRuntime.jsx)("span", {
|
|
98
|
+
role: "alert",
|
|
99
|
+
children: "Code copied to clipboard"
|
|
100
|
+
}) : (0, _jsxRuntime.jsx)(_md.MdContentCopy, {
|
|
101
|
+
"aria-hidden": "true"
|
|
102
|
+
})
|
|
98
103
|
})]
|
|
99
104
|
});
|
|
100
105
|
};
|
|
@@ -12,8 +12,6 @@ var _react = require("@testing-library/react");
|
|
|
12
12
|
|
|
13
13
|
var _jestAxe = require("jest-axe");
|
|
14
14
|
|
|
15
|
-
var _md = require("react-icons/md");
|
|
16
|
-
|
|
17
15
|
var _Code = require("./Code");
|
|
18
16
|
|
|
19
17
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
@@ -62,41 +60,41 @@ describe('<Code />', function () {
|
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
}, _callee);
|
|
65
|
-
})));
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var props, _render2, container, codeElement;
|
|
63
|
+
})));
|
|
64
|
+
it('renders the Code component with a copy button', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
65
|
+
var props, _render2, container;
|
|
69
66
|
|
|
70
67
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
71
68
|
while (1) {
|
|
72
69
|
switch (_context2.prev = _context2.next) {
|
|
73
70
|
case 0:
|
|
74
71
|
props = (0, _extends2["default"])({}, defaultProps, {
|
|
75
|
-
|
|
72
|
+
showCopy: true
|
|
76
73
|
});
|
|
77
74
|
_render2 = (0, _react.render)((0, _jsxRuntime.jsx)(_Code.Code, (0, _extends2["default"])({}, props, {
|
|
78
75
|
children: "This is a code"
|
|
79
76
|
}))), container = _render2.container;
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
expect(_react.screen.getByRole('button', {
|
|
78
|
+
name: 'Copy code'
|
|
79
|
+
})).toBeInTheDocument(); // Check for accessibility issues
|
|
82
80
|
|
|
83
81
|
_context2.t0 = expect;
|
|
84
|
-
_context2.next =
|
|
82
|
+
_context2.next = 6;
|
|
85
83
|
return (0, _jestAxe.axe)(container);
|
|
86
84
|
|
|
87
|
-
case
|
|
85
|
+
case 6:
|
|
88
86
|
_context2.t1 = _context2.sent;
|
|
89
|
-
_context2.next =
|
|
87
|
+
_context2.next = 9;
|
|
90
88
|
return (0, _context2.t0)(_context2.t1).toHaveNoViolations();
|
|
91
89
|
|
|
92
|
-
case
|
|
90
|
+
case 9:
|
|
93
91
|
case "end":
|
|
94
92
|
return _context2.stop();
|
|
95
93
|
}
|
|
96
94
|
}
|
|
97
95
|
}, _callee2);
|
|
98
96
|
})));
|
|
99
|
-
it('
|
|
97
|
+
it('updates the the UI after clicking on "Copy"', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
100
98
|
var props, _render3, container;
|
|
101
99
|
|
|
102
100
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
@@ -109,45 +107,12 @@ describe('<Code />', function () {
|
|
|
109
107
|
_render3 = (0, _react.render)((0, _jsxRuntime.jsx)(_Code.Code, (0, _extends2["default"])({}, props, {
|
|
110
108
|
children: "This is a code"
|
|
111
109
|
}))), container = _render3.container;
|
|
112
|
-
expect(_react.screen.getByRole('button', {
|
|
113
|
-
name: 'Copy'
|
|
114
|
-
})).toBeInTheDocument(); // Check for accessibility issues
|
|
115
|
-
|
|
116
|
-
_context3.t0 = expect;
|
|
117
|
-
_context3.next = 6;
|
|
118
|
-
return (0, _jestAxe.axe)(container);
|
|
119
|
-
|
|
120
|
-
case 6:
|
|
121
|
-
_context3.t1 = _context3.sent;
|
|
122
|
-
_context3.next = 9;
|
|
123
|
-
return (0, _context3.t0)(_context3.t1).toHaveNoViolations();
|
|
124
|
-
|
|
125
|
-
case 9:
|
|
126
|
-
case "end":
|
|
127
|
-
return _context3.stop();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}, _callee3);
|
|
131
|
-
})));
|
|
132
|
-
it('updates the the UI after clicking on "Copy"', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
133
|
-
var props, _render4, container;
|
|
134
|
-
|
|
135
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
136
|
-
while (1) {
|
|
137
|
-
switch (_context4.prev = _context4.next) {
|
|
138
|
-
case 0:
|
|
139
|
-
props = (0, _extends2["default"])({}, defaultProps, {
|
|
140
|
-
showCopy: true
|
|
141
|
-
});
|
|
142
|
-
_render4 = (0, _react.render)((0, _jsxRuntime.jsx)(_Code.Code, (0, _extends2["default"])({}, props, {
|
|
143
|
-
children: "This is a code"
|
|
144
|
-
}))), container = _render4.container;
|
|
145
110
|
|
|
146
111
|
_react.fireEvent.click(_react.screen.getByRole('button', {
|
|
147
|
-
name: 'Copy'
|
|
112
|
+
name: 'Copy code'
|
|
148
113
|
}));
|
|
149
114
|
|
|
150
|
-
|
|
115
|
+
_context3.next = 5;
|
|
151
116
|
return (0, _react.waitFor)(function () {
|
|
152
117
|
return new Promise(function (res) {
|
|
153
118
|
return setTimeout(res, 0);
|
|
@@ -155,22 +120,22 @@ describe('<Code />', function () {
|
|
|
155
120
|
});
|
|
156
121
|
|
|
157
122
|
case 5:
|
|
158
|
-
expect(_react.screen.getByText('
|
|
123
|
+
expect(_react.screen.getByText('Code copied to clipboard')).toBeInTheDocument(); // Check for accessibility issues
|
|
159
124
|
|
|
160
|
-
|
|
161
|
-
|
|
125
|
+
_context3.t0 = expect;
|
|
126
|
+
_context3.next = 9;
|
|
162
127
|
return (0, _jestAxe.axe)(container);
|
|
163
128
|
|
|
164
129
|
case 9:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return (0,
|
|
130
|
+
_context3.t1 = _context3.sent;
|
|
131
|
+
_context3.next = 12;
|
|
132
|
+
return (0, _context3.t0)(_context3.t1).toHaveNoViolations();
|
|
168
133
|
|
|
169
134
|
case 12:
|
|
170
135
|
case "end":
|
|
171
|
-
return
|
|
136
|
+
return _context3.stop();
|
|
172
137
|
}
|
|
173
138
|
}
|
|
174
|
-
},
|
|
139
|
+
}, _callee3);
|
|
175
140
|
})));
|
|
176
141
|
});
|
|
@@ -1,38 +1,58 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.MultiSelect = void 0;
|
|
5
5
|
|
|
6
|
-
var _reactSelect = _interopRequireDefault(require(
|
|
7
|
-
|
|
8
|
-
var _jsxRuntime = require(
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
var _reactSelect = _interopRequireDefault( require( 'react-select' ) );
|
|
7
|
+
|
|
8
|
+
var _jsxRuntime = require( 'theme-ui/jsx-runtime' );
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault( obj ) {
|
|
11
|
+
return obj && obj.__esModule ? obj : { default: obj };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function _extends() {
|
|
15
|
+
_extends =
|
|
16
|
+
Object.assign ||
|
|
17
|
+
function ( target ) {
|
|
18
|
+
for ( var i = 1; i < arguments.length; i++ ) {
|
|
19
|
+
var source = arguments[ i ];
|
|
20
|
+
for ( var key in source ) {
|
|
21
|
+
if ( Object.prototype.hasOwnProperty.call( source, key ) ) {
|
|
22
|
+
target[ key ] = source[ key ];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return target;
|
|
27
|
+
};
|
|
28
|
+
return _extends.apply( this, arguments );
|
|
29
|
+
}
|
|
13
30
|
|
|
14
31
|
var vipGold = '#c29c69'; // hardcoding for now
|
|
15
32
|
|
|
16
33
|
var vipGrey2 = '#d7dee2';
|
|
17
34
|
var customStyles = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
control: function control( styles ) {
|
|
36
|
+
return _extends( {}, styles, {
|
|
37
|
+
border: '1px solid ' + vipGrey2,
|
|
38
|
+
boxShadow: 'none',
|
|
39
|
+
'&:hover': {
|
|
40
|
+
border: '1px solid ' + vipGold,
|
|
41
|
+
},
|
|
42
|
+
'&:focus': {
|
|
43
|
+
border: '1px solid ' + vipGold,
|
|
44
|
+
},
|
|
45
|
+
} );
|
|
46
|
+
},
|
|
30
47
|
};
|
|
31
48
|
|
|
32
|
-
var MultiSelect = function MultiSelect(props) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
49
|
+
var MultiSelect = function MultiSelect( props ) {
|
|
50
|
+
return ( 0, _jsxRuntime.jsx )(
|
|
51
|
+
_reactSelect[ 'default' ],
|
|
52
|
+
_extends( {}, props, {
|
|
53
|
+
styles: customStyles,
|
|
54
|
+
} )
|
|
55
|
+
);
|
|
36
56
|
};
|
|
37
57
|
|
|
38
|
-
exports.MultiSelect = MultiSelect;
|
|
58
|
+
exports.MultiSelect = MultiSelect;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = exports.UsePortal = exports.Single = exports.Multi = exports.Inline = exports.DropdownMenu = exports.Async = void 0;
|
|
7
7
|
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
|
|
@@ -82,7 +82,7 @@ var Multi = function Multi() {
|
|
|
82
82
|
|
|
83
83
|
exports.Multi = Multi;
|
|
84
84
|
|
|
85
|
-
var
|
|
85
|
+
var UsePortal = function UsePortal() {
|
|
86
86
|
var _useState2 = (0, _react.useState)([]),
|
|
87
87
|
value = _useState2[0],
|
|
88
88
|
setValue = _useState2[1];
|
|
@@ -106,7 +106,7 @@ var usePortal = function usePortal() {
|
|
|
106
106
|
});
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
exports.
|
|
109
|
+
exports.UsePortal = UsePortal;
|
|
110
110
|
|
|
111
111
|
var Single = function Single() {
|
|
112
112
|
var _useState3 = (0, _react.useState)([]),
|
|
@@ -203,7 +203,6 @@ var Async = function Async() {
|
|
|
203
203
|
label: "Async Select",
|
|
204
204
|
value: value,
|
|
205
205
|
isAsync: true,
|
|
206
|
-
usePortal: true,
|
|
207
206
|
loadOptions: loadOptions,
|
|
208
207
|
noneLabel: "Everyone",
|
|
209
208
|
placeholder: "Load async...",
|
|
@@ -19,8 +19,8 @@ var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
24
|
describe('<Select />', function () {
|
|
25
25
|
it('renders the Select component with the specified placeholder', function () {
|
|
26
26
|
(0, _react.render)((0, _jsxRuntime.jsx)(_Select.Select, {
|
|
@@ -11,6 +11,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
var _ = require("../");
|
|
13
13
|
|
|
14
|
+
var _ScreenReaderText = _interopRequireDefault(require("../ScreenReaderText/ScreenReaderText"));
|
|
15
|
+
|
|
14
16
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
15
17
|
|
|
16
18
|
/** @jsxImportSource theme-ui */
|
|
@@ -29,6 +31,7 @@ var Notification = function Notification(_ref) {
|
|
|
29
31
|
status = _ref$status === void 0 ? 'success' : _ref$status,
|
|
30
32
|
onClose = _ref.onClose;
|
|
31
33
|
return (0, _jsxRuntime.jsxs)(_.Card, {
|
|
34
|
+
role: "alert",
|
|
32
35
|
className: "vip-notification-component",
|
|
33
36
|
sx: {
|
|
34
37
|
boxShadow: 'medium',
|
|
@@ -36,16 +39,8 @@ var Notification = function Notification(_ref) {
|
|
|
36
39
|
position: 'relative',
|
|
37
40
|
variant: "notification." + status
|
|
38
41
|
},
|
|
39
|
-
children: [(0, _jsxRuntime.jsx)(
|
|
40
|
-
|
|
41
|
-
variant: "icon",
|
|
42
|
-
sx: {
|
|
43
|
-
color: 'muted',
|
|
44
|
-
position: 'absolute',
|
|
45
|
-
top: 2,
|
|
46
|
-
right: 2
|
|
47
|
-
},
|
|
48
|
-
children: (0, _jsxRuntime.jsx)(_md.MdClose, {})
|
|
42
|
+
children: [(0, _jsxRuntime.jsx)(_ScreenReaderText["default"], {
|
|
43
|
+
children: "Alert,"
|
|
49
44
|
}), (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
50
45
|
sx: {
|
|
51
46
|
alignItems: 'center'
|
|
@@ -54,21 +49,24 @@ var Notification = function Notification(_ref) {
|
|
|
54
49
|
sx: {
|
|
55
50
|
color: 'error',
|
|
56
51
|
flex: '0 0 auto'
|
|
57
|
-
}
|
|
52
|
+
},
|
|
53
|
+
"aria-hidden": "true"
|
|
58
54
|
}) : (0, _jsxRuntime.jsx)(_md.MdCheckCircle, {
|
|
59
55
|
sx: {
|
|
60
56
|
color: 'success',
|
|
61
57
|
flex: '0 0 auto'
|
|
62
|
-
}
|
|
58
|
+
},
|
|
59
|
+
"aria-hidden": "true"
|
|
63
60
|
}), (0, _jsxRuntime.jsxs)(_.Box, {
|
|
64
61
|
sx: {
|
|
65
62
|
flex: '1 1 auto',
|
|
66
63
|
ml: 3
|
|
67
64
|
},
|
|
68
|
-
children: [(0, _jsxRuntime.jsx)(
|
|
69
|
-
variant: "h4",
|
|
65
|
+
children: [(0, _jsxRuntime.jsx)("p", {
|
|
70
66
|
sx: {
|
|
71
|
-
|
|
67
|
+
my: 0,
|
|
68
|
+
color: 'heading',
|
|
69
|
+
fontWeight: 'bold'
|
|
72
70
|
},
|
|
73
71
|
children: title
|
|
74
72
|
}), body && (0, _jsxRuntime.jsx)(_.Text, {
|
|
@@ -79,6 +77,17 @@ var Notification = function Notification(_ref) {
|
|
|
79
77
|
children: body
|
|
80
78
|
})]
|
|
81
79
|
})]
|
|
80
|
+
}), onClose && (0, _jsxRuntime.jsx)(_.Button, {
|
|
81
|
+
onClick: onClose,
|
|
82
|
+
variant: "icon",
|
|
83
|
+
sx: {
|
|
84
|
+
color: 'muted',
|
|
85
|
+
position: 'absolute',
|
|
86
|
+
top: 2,
|
|
87
|
+
right: 2
|
|
88
|
+
},
|
|
89
|
+
"aria-hidden": "true",
|
|
90
|
+
children: (0, _jsxRuntime.jsx)(_md.MdClose, {})
|
|
82
91
|
})]
|
|
83
92
|
});
|
|
84
93
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.Default = void 0;
|
|
4
|
+
exports["default"] = exports.Error = exports.Default = void 0;
|
|
5
5
|
|
|
6
6
|
var _ = require("..");
|
|
7
7
|
|
|
@@ -18,9 +18,19 @@ exports["default"] = _default;
|
|
|
18
18
|
|
|
19
19
|
var Default = function Default() {
|
|
20
20
|
return (0, _jsxRuntime.jsx)(_.Notification, {
|
|
21
|
-
title: "
|
|
22
|
-
|
|
21
|
+
title: "Awesome!",
|
|
22
|
+
body: "Your message has been sent successfully."
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
exports.Default = Default;
|
|
26
|
+
exports.Default = Default;
|
|
27
|
+
|
|
28
|
+
var Error = function Error() {
|
|
29
|
+
return (0, _jsxRuntime.jsx)(_.Notification, {
|
|
30
|
+
status: "error",
|
|
31
|
+
title: "Snag!",
|
|
32
|
+
body: "Your message could not be sent."
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.Error = Error;
|