@automattic/vip-design-system 2.10.1 → 2.10.3
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.d.ts +2 -0
- package/build/system/Accordion/Accordion.js +28 -33
- package/build/system/Accordion/Accordion.stories.js +34 -35
- package/build/system/Accordion/Accordion.test.js +91 -36
- 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.d.ts +9 -3
- package/build/system/Code/Code.js +19 -23
- package/build/system/Code/Code.stories.d.ts +7 -1
- 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/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/NewDialog.stories.jsx +2 -1
- package/build/system/NewDialog/index.js +7 -11
- package/build/system/NewDialog/styles.js +2 -5
- package/build/system/NewForm/Fieldset.js +13 -17
- package/build/system/NewForm/Form.d.ts +6 -3
- 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/NewForm/index.d.ts +4 -1
- package/build/system/Notice/Notice.d.ts +11 -3
- package/build/system/Notice/Notice.js +22 -25
- package/build/system/Notice/Notice.stories.d.ts +9 -1
- 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/theme/breakpoints.js +1 -5
- package/build/system/utils/stories/CustomLink.js +7 -13
- package/package.json +1 -1
- package/src/system/Accordion/Accordion.test.tsx +55 -3
- package/src/system/Accordion/Accordion.tsx +2 -0
- package/src/system/Code/Code.tsx +2 -2
- 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/LinkExternal/LinkExternal.tsx +27 -8
- package/src/system/NewDialog/NewDialog.stories.jsx +2 -1
- package/src/system/NewDialog/styles.ts +1 -0
- package/src/system/NewForm/Form.tsx +2 -2
- package/src/system/NewForm/FormAutocomplete.js +2 -2
- package/src/system/Notice/Notice.tsx +2 -2
- package/src/system/assets/a8cLogo.tsx +30 -0
package/babel.config.js
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
[
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
module.exports = function ( api ) {
|
|
2
|
+
const isTest = api.env( 'test' );
|
|
3
|
+
return {
|
|
4
|
+
ignore: [],
|
|
5
|
+
plugins: [],
|
|
6
|
+
presets: [
|
|
7
|
+
[
|
|
8
|
+
'@babel/preset-env',
|
|
9
|
+
{
|
|
10
|
+
loose: true,
|
|
11
|
+
modules: isTest ? 'auto' : false,
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
[
|
|
15
|
+
'@babel/preset-react',
|
|
16
|
+
{
|
|
17
|
+
importSource: 'theme-ui',
|
|
18
|
+
runtime: 'automatic',
|
|
19
|
+
throwIfNamespace: false,
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
'@babel/preset-typescript',
|
|
10
23
|
],
|
|
11
|
-
|
|
12
|
-
'@babel/preset-react',
|
|
13
|
-
{
|
|
14
|
-
importSource: 'theme-ui',
|
|
15
|
-
runtime: 'automatic',
|
|
16
|
-
throwIfNamespace: false,
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
'@babel/preset-typescript',
|
|
20
|
-
],
|
|
24
|
+
};
|
|
21
25
|
};
|
package/build/declaration.d.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -26,6 +26,8 @@ interface RootProps {
|
|
|
26
26
|
className?: Argument;
|
|
27
27
|
sx?: ThemeUIStyleObject;
|
|
28
28
|
defaultValue?: string;
|
|
29
|
+
value?: string;
|
|
30
|
+
onValueChange?: (value: string) => void;
|
|
29
31
|
}
|
|
30
32
|
export declare const Item: {
|
|
31
33
|
({ children, ...props }: AccordionItemProps): React.JSX.Element;
|
|
@@ -1,32 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.TriggerWithIcon = exports.Trigger = exports.Root = exports.Item = exports.Content = void 0;
|
|
5
|
-
var _react = require("@emotion/react");
|
|
6
|
-
var AccordionPrimitive = _interopRequireWildcard(require("@radix-ui/react-accordion"));
|
|
7
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
-
var _react2 = _interopRequireDefault(require("react"));
|
|
9
|
-
var _md = require("react-icons/md");
|
|
10
|
-
var _Heading = require("../Heading");
|
|
11
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
12
1
|
var _excluded = ["children"],
|
|
13
2
|
_excluded2 = ["children", "headingVariant", "sx"],
|
|
14
3
|
_excluded3 = ["children", "icon"],
|
|
15
4
|
_excluded4 = ["children", "sx"],
|
|
16
5
|
_excluded5 = ["sx", "children", "className"];
|
|
6
|
+
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); }
|
|
7
|
+
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; }
|
|
17
8
|
/** @jsxImportSource theme-ui */
|
|
9
|
+
|
|
18
10
|
/**
|
|
19
11
|
* External dependencies
|
|
20
12
|
*/
|
|
13
|
+
import { keyframes } from '@emotion/react';
|
|
14
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
15
|
+
import classNames from 'classnames';
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { MdChevronRight } from 'react-icons/md';
|
|
21
18
|
/**
|
|
22
19
|
* Internal dependencies
|
|
23
20
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
var slideDown = (0, _react.keyframes)({
|
|
21
|
+
import { Heading } from '../Heading';
|
|
22
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
23
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
24
|
+
var slideDown = keyframes({
|
|
30
25
|
from: {
|
|
31
26
|
height: 0
|
|
32
27
|
},
|
|
@@ -34,7 +29,7 @@ var slideDown = (0, _react.keyframes)({
|
|
|
34
29
|
height: 'var(--radix-accordion-content-height)'
|
|
35
30
|
}
|
|
36
31
|
});
|
|
37
|
-
var slideUp =
|
|
32
|
+
var slideUp = keyframes({
|
|
38
33
|
from: {
|
|
39
34
|
height: 'var(--radix-accordion-content-height)'
|
|
40
35
|
},
|
|
@@ -45,10 +40,10 @@ var slideUp = (0, _react.keyframes)({
|
|
|
45
40
|
|
|
46
41
|
// temporary solution while we converte the theme to TS
|
|
47
42
|
|
|
48
|
-
var Item =
|
|
43
|
+
export var Item = function Item(_ref) {
|
|
49
44
|
var children = _ref.children,
|
|
50
45
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
51
|
-
return (
|
|
46
|
+
return _jsx(AccordionPrimitive.Item, _extends({}, props, {
|
|
52
47
|
sx: {
|
|
53
48
|
overflow: 'hidden',
|
|
54
49
|
borderWidth: '0 1px 1px 1px',
|
|
@@ -71,20 +66,20 @@ var Item = exports.Item = function Item(_ref) {
|
|
|
71
66
|
}));
|
|
72
67
|
};
|
|
73
68
|
Item.displayName = 'Accordion.Item';
|
|
74
|
-
var Trigger =
|
|
69
|
+
export var Trigger = /*#__PURE__*/React.forwardRef(function (_ref2, forwardedRef) {
|
|
75
70
|
var children = _ref2.children,
|
|
76
71
|
_ref2$headingVariant = _ref2.headingVariant,
|
|
77
72
|
headingVariant = _ref2$headingVariant === void 0 ? 'h3' : _ref2$headingVariant,
|
|
78
73
|
_ref2$sx = _ref2.sx,
|
|
79
74
|
sx = _ref2$sx === void 0 ? {} : _ref2$sx,
|
|
80
75
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
81
|
-
return (
|
|
76
|
+
return _jsx(Heading, {
|
|
82
77
|
sx: {
|
|
83
78
|
all: 'unset',
|
|
84
79
|
display: 'flex'
|
|
85
80
|
},
|
|
86
81
|
variant: headingVariant,
|
|
87
|
-
children: (
|
|
82
|
+
children: _jsxs(AccordionPrimitive.Trigger, _extends({
|
|
88
83
|
sx: _extends({
|
|
89
84
|
color: 'heading',
|
|
90
85
|
cursor: 'pointer',
|
|
@@ -115,7 +110,7 @@ var Trigger = exports.Trigger = /*#__PURE__*/_react2["default"].forwardRef(funct
|
|
|
115
110
|
}, sx)
|
|
116
111
|
}, props, {
|
|
117
112
|
ref: forwardedRef,
|
|
118
|
-
children: [children, (
|
|
113
|
+
children: [children, _jsx(MdChevronRight, {
|
|
119
114
|
className: "vip-accordion-trigger-indicator",
|
|
120
115
|
sx: {
|
|
121
116
|
fontSize: 3,
|
|
@@ -131,19 +126,19 @@ var Trigger = exports.Trigger = /*#__PURE__*/_react2["default"].forwardRef(funct
|
|
|
131
126
|
});
|
|
132
127
|
});
|
|
133
128
|
Trigger.displayName = 'Accordion.Trigger';
|
|
134
|
-
var TriggerWithIcon =
|
|
129
|
+
export var TriggerWithIcon = /*#__PURE__*/React.forwardRef(function (_ref3, forwardedRef) {
|
|
135
130
|
var children = _ref3.children,
|
|
136
131
|
icon = _ref3.icon,
|
|
137
132
|
props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
138
|
-
return (
|
|
133
|
+
return _jsxs(Trigger, _extends({}, props, {
|
|
139
134
|
ref: forwardedRef,
|
|
140
|
-
children: [(
|
|
135
|
+
children: [_jsx("span", {
|
|
141
136
|
sx: {
|
|
142
137
|
color: 'icon.primary',
|
|
143
138
|
fontSize: 3
|
|
144
139
|
},
|
|
145
140
|
children: icon
|
|
146
|
-
}), (
|
|
141
|
+
}), _jsx("div", {
|
|
147
142
|
sx: {
|
|
148
143
|
color: 'accordion.trigger.text',
|
|
149
144
|
flexGrow: 1,
|
|
@@ -155,12 +150,12 @@ var TriggerWithIcon = exports.TriggerWithIcon = /*#__PURE__*/_react2["default"].
|
|
|
155
150
|
}));
|
|
156
151
|
});
|
|
157
152
|
TriggerWithIcon.displayName = 'Accordion.TriggerWithIcon';
|
|
158
|
-
var Content =
|
|
153
|
+
export var Content = /*#__PURE__*/React.forwardRef(function (_ref4, forwardedRef) {
|
|
159
154
|
var children = _ref4.children,
|
|
160
155
|
_ref4$sx = _ref4.sx,
|
|
161
156
|
sx = _ref4$sx === void 0 ? {} : _ref4$sx,
|
|
162
157
|
props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
|
|
163
|
-
return (
|
|
158
|
+
return _jsx(AccordionPrimitive.Content, _extends({
|
|
164
159
|
sx: _extends({
|
|
165
160
|
backgroundColor: 'accordion.content.background',
|
|
166
161
|
color: 'accordion.content.text',
|
|
@@ -181,14 +176,14 @@ var Content = exports.Content = /*#__PURE__*/_react2["default"].forwardRef(funct
|
|
|
181
176
|
}));
|
|
182
177
|
});
|
|
183
178
|
Content.displayName = 'Accordion.Content';
|
|
184
|
-
var Root =
|
|
179
|
+
export var Root = /*#__PURE__*/React.forwardRef(function (_ref5, forwardRef) {
|
|
185
180
|
var _ref5$sx = _ref5.sx,
|
|
186
181
|
sx = _ref5$sx === void 0 ? {} : _ref5$sx,
|
|
187
182
|
children = _ref5.children,
|
|
188
183
|
className = _ref5.className,
|
|
189
184
|
props = _objectWithoutPropertiesLoose(_ref5, _excluded5);
|
|
190
|
-
return (
|
|
191
|
-
className: (
|
|
185
|
+
return _jsx(AccordionPrimitive.Root, _extends({
|
|
186
|
+
className: classNames('vip-accordion-component', className),
|
|
192
187
|
collapsible: true,
|
|
193
188
|
type: "single",
|
|
194
189
|
ref: forwardRef,
|
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.WithLargeText = exports.Default = void 0;
|
|
5
|
-
var _bi = require("react-icons/bi");
|
|
6
|
-
var _ri = require("react-icons/ri");
|
|
7
|
-
var _ = require("..");
|
|
8
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
1
|
/** @jsxImportSource theme-ui */
|
|
2
|
+
|
|
10
3
|
/**
|
|
11
4
|
* External dependencies
|
|
12
5
|
*/
|
|
6
|
+
import { BiBookContent } from 'react-icons/bi';
|
|
7
|
+
import { RiUserAddLine, RiCodeSSlashFill } from 'react-icons/ri';
|
|
8
|
+
|
|
13
9
|
/**
|
|
14
10
|
* Internal dependencies
|
|
15
11
|
*/
|
|
16
|
-
|
|
12
|
+
import { Box, Accordion } from '..';
|
|
13
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
15
|
+
export default {
|
|
17
16
|
title: 'Accordion',
|
|
18
|
-
component:
|
|
17
|
+
component: Accordion
|
|
19
18
|
};
|
|
20
19
|
var ExampleContent = function ExampleContent() {
|
|
21
|
-
return (
|
|
22
|
-
children: [(
|
|
20
|
+
return _jsxs(Box, {
|
|
21
|
+
children: [_jsx("p", {
|
|
23
22
|
sx: {
|
|
24
23
|
mt: 0
|
|
25
24
|
},
|
|
26
25
|
children: "Add your key team members to the VIP Dashboard."
|
|
27
|
-
}), (
|
|
26
|
+
}), _jsx("p", {
|
|
28
27
|
children: "Add developers to GitHub."
|
|
29
|
-
}), (
|
|
28
|
+
}), _jsx("p", {
|
|
30
29
|
sx: {
|
|
31
30
|
mb: 0
|
|
32
31
|
},
|
|
@@ -35,48 +34,48 @@ var ExampleContent = function ExampleContent() {
|
|
|
35
34
|
});
|
|
36
35
|
};
|
|
37
36
|
var ExampleAccordion = function ExampleAccordion() {
|
|
38
|
-
return (
|
|
37
|
+
return _jsxs(Accordion.Root, {
|
|
39
38
|
defaultValue: "teamPermissions",
|
|
40
39
|
sx: {
|
|
41
40
|
width: '250px'
|
|
42
41
|
},
|
|
43
|
-
children: [(
|
|
42
|
+
children: [_jsxs(Accordion.Item, {
|
|
44
43
|
value: "teamPermissions",
|
|
45
|
-
children: [(
|
|
46
|
-
icon: (
|
|
44
|
+
children: [_jsx(Accordion.TriggerWithIcon, {
|
|
45
|
+
icon: _jsx(RiUserAddLine, {}),
|
|
47
46
|
children: "Team & Permissions"
|
|
48
|
-
}), (
|
|
49
|
-
children: (
|
|
47
|
+
}), _jsx(Accordion.Content, {
|
|
48
|
+
children: _jsx(ExampleContent, {})
|
|
50
49
|
})]
|
|
51
|
-
}), (
|
|
50
|
+
}), _jsxs(Accordion.Item, {
|
|
52
51
|
value: "addContentMedia",
|
|
53
|
-
children: [(
|
|
54
|
-
icon: (
|
|
52
|
+
children: [_jsx(Accordion.TriggerWithIcon, {
|
|
53
|
+
icon: _jsx(BiBookContent, {}),
|
|
55
54
|
children: "Add Content & Media"
|
|
56
|
-
}), (
|
|
57
|
-
children: (
|
|
55
|
+
}), _jsx(Accordion.Content, {
|
|
56
|
+
children: _jsx(ExampleContent, {})
|
|
58
57
|
})]
|
|
59
|
-
}), (
|
|
58
|
+
}), _jsxs(Accordion.Item, {
|
|
60
59
|
value: "addCode",
|
|
61
|
-
children: [(
|
|
62
|
-
icon: (
|
|
60
|
+
children: [_jsx(Accordion.TriggerWithIcon, {
|
|
61
|
+
icon: _jsx(RiCodeSSlashFill, {}),
|
|
63
62
|
children: "Add Code"
|
|
64
|
-
}), (
|
|
65
|
-
children: (
|
|
63
|
+
}), _jsx(Accordion.Content, {
|
|
64
|
+
children: _jsx(ExampleContent, {})
|
|
66
65
|
})]
|
|
67
66
|
})]
|
|
68
67
|
});
|
|
69
68
|
};
|
|
70
|
-
var Default =
|
|
71
|
-
return (
|
|
69
|
+
export var Default = function Default() {
|
|
70
|
+
return _jsx(ExampleAccordion, {});
|
|
72
71
|
};
|
|
73
|
-
var WithLargeText =
|
|
74
|
-
return (
|
|
72
|
+
export var WithLargeText = function WithLargeText() {
|
|
73
|
+
return _jsx(Box, {
|
|
75
74
|
sx: {
|
|
76
75
|
'.vip-heading-component > button': {
|
|
77
76
|
fontSize: 4
|
|
78
77
|
}
|
|
79
78
|
},
|
|
80
|
-
children: (
|
|
79
|
+
children: _jsx(ExampleAccordion, {})
|
|
81
80
|
});
|
|
82
81
|
};
|
|
@@ -1,68 +1,123 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _react = require("@testing-library/react");
|
|
4
|
-
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
5
|
-
var _jestAxe = require("jest-axe");
|
|
6
|
-
var _themeUi = require("theme-ui");
|
|
7
|
-
var Accordion = _interopRequireWildcard(require("./Accordion"));
|
|
8
|
-
var _ = require("../");
|
|
9
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
10
|
-
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); }
|
|
11
|
-
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; }
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
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; }
|
|
14
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); } }
|
|
15
|
-
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); }); }; }
|
|
16
|
-
|
|
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
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
5
|
+
// @ts-nocheck
|
|
6
|
+
/** @jsxImportSource theme-ui */
|
|
7
|
+
/**
|
|
17
8
|
* External dependencies
|
|
18
|
-
*/
|
|
9
|
+
*/
|
|
10
|
+
import { render, screen } from '@testing-library/react';
|
|
11
|
+
import userEvent from '@testing-library/user-event';
|
|
12
|
+
import { axe } from 'jest-axe';
|
|
13
|
+
import { useState } from 'react';
|
|
14
|
+
import { ThemeUIProvider } from 'theme-ui';
|
|
15
|
+
|
|
16
|
+
/**
|
|
19
17
|
* Internal dependencies
|
|
20
18
|
*/
|
|
19
|
+
import * as Accordion from './Accordion';
|
|
20
|
+
import { Button, theme } from '../';
|
|
21
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
22
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
21
23
|
var renderWithTheme = function renderWithTheme(children) {
|
|
22
|
-
return
|
|
23
|
-
theme:
|
|
24
|
+
return render(_jsx(ThemeUIProvider, {
|
|
25
|
+
theme: theme,
|
|
24
26
|
children: children
|
|
25
27
|
}));
|
|
26
28
|
};
|
|
27
|
-
var
|
|
28
|
-
return renderWithTheme((
|
|
29
|
+
var renderUncontrolledComponent = function renderUncontrolledComponent() {
|
|
30
|
+
return renderWithTheme(_jsxs(Accordion.Root, {
|
|
29
31
|
defaultValue: "one",
|
|
30
32
|
sx: {
|
|
31
33
|
width: '400px'
|
|
32
34
|
},
|
|
33
|
-
children: [(
|
|
35
|
+
children: [_jsxs(Accordion.Item, {
|
|
34
36
|
value: "one",
|
|
35
|
-
children: [(
|
|
37
|
+
children: [_jsx(Accordion.Trigger, {
|
|
36
38
|
children: "trigger one"
|
|
37
|
-
}), (
|
|
39
|
+
}), _jsx(Accordion.Content, {
|
|
38
40
|
children: "content one"
|
|
39
41
|
})]
|
|
40
|
-
}), (
|
|
42
|
+
}), _jsxs(Accordion.Item, {
|
|
41
43
|
value: "two",
|
|
42
|
-
children: [(
|
|
44
|
+
children: [_jsx(Accordion.Trigger, {
|
|
43
45
|
children: "trigger two"
|
|
44
|
-
}), (
|
|
46
|
+
}), _jsx(Accordion.Content, {
|
|
45
47
|
children: "content two"
|
|
46
48
|
})]
|
|
47
49
|
})]
|
|
48
50
|
}));
|
|
49
51
|
};
|
|
50
|
-
|
|
52
|
+
var renderControlledComponent = function renderControlledComponent() {
|
|
53
|
+
var ControlledComponent = function ControlledComponent() {
|
|
54
|
+
var _useState = useState('one'),
|
|
55
|
+
value = _useState[0],
|
|
56
|
+
setValue = _useState[1];
|
|
57
|
+
return _jsxs(Accordion.Root, {
|
|
58
|
+
value: value,
|
|
59
|
+
onValueChange: setValue,
|
|
60
|
+
children: [_jsxs(Accordion.Item, {
|
|
61
|
+
value: "one",
|
|
62
|
+
children: [_jsx(Button, {
|
|
63
|
+
"aria-controls": "manage-content-one",
|
|
64
|
+
"aria-expanded": value === 'one' ? 'true' : 'false',
|
|
65
|
+
"data-state": value === 'one' ? 'open' : 'closed',
|
|
66
|
+
onClick: function onClick() {
|
|
67
|
+
if (value === 'one') {
|
|
68
|
+
setValue('');
|
|
69
|
+
} else {
|
|
70
|
+
setValue('one');
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
children: "trigger one"
|
|
74
|
+
}), _jsx(Accordion.Content, {
|
|
75
|
+
id: "manage-content-one",
|
|
76
|
+
children: "content one"
|
|
77
|
+
})]
|
|
78
|
+
}), _jsxs(Accordion.Item, {
|
|
79
|
+
value: "two",
|
|
80
|
+
children: [_jsx(Button, {
|
|
81
|
+
"aria-controls": "manage-content-two",
|
|
82
|
+
"aria-expanded": value === 'two' ? 'true' : 'false',
|
|
83
|
+
"data-state": value === 'two' ? 'open' : 'closed',
|
|
84
|
+
onClick: function onClick() {
|
|
85
|
+
if (value === 'two') {
|
|
86
|
+
setValue('');
|
|
87
|
+
} else {
|
|
88
|
+
setValue('two');
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
children: "trigger two"
|
|
92
|
+
}), _jsx(Accordion.Content, {
|
|
93
|
+
id: "manage-content-two",
|
|
94
|
+
children: "content two"
|
|
95
|
+
})]
|
|
96
|
+
})]
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
return renderWithTheme(_jsx(ControlledComponent, {}));
|
|
100
|
+
};
|
|
101
|
+
describe.each([['Uncontrolled', renderUncontrolledComponent], ['Controlled', renderControlledComponent]])('<Accordion />, %s', function () {
|
|
102
|
+
for (var _len = arguments.length, modeAndComponent = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
103
|
+
modeAndComponent[_key] = arguments[_key];
|
|
104
|
+
}
|
|
105
|
+
var renderComponent = modeAndComponent[1];
|
|
51
106
|
it('renders the Accordion component with default value visible', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
52
107
|
var _renderComponent, container;
|
|
53
108
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
54
109
|
while (1) switch (_context.prev = _context.next) {
|
|
55
110
|
case 0:
|
|
56
111
|
_renderComponent = renderComponent(), container = _renderComponent.container; // Should find the open content
|
|
57
|
-
expect(
|
|
112
|
+
expect(screen.getByText('content one')).toBeInTheDocument();
|
|
58
113
|
|
|
59
114
|
// Should not find the closed content
|
|
60
|
-
expect(
|
|
115
|
+
expect(screen.queryByText('content two')).toBeNull();
|
|
61
116
|
|
|
62
117
|
// Check for accessibility issues
|
|
63
118
|
_context.t0 = expect;
|
|
64
119
|
_context.next = 6;
|
|
65
|
-
return
|
|
120
|
+
return axe(container);
|
|
66
121
|
case 6:
|
|
67
122
|
_context.t1 = _context.sent;
|
|
68
123
|
(0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
@@ -77,31 +132,31 @@ describe('<Accordion />', function () {
|
|
|
77
132
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
78
133
|
while (1) switch (_context2.prev = _context2.next) {
|
|
79
134
|
case 0:
|
|
80
|
-
user =
|
|
135
|
+
user = userEvent.setup();
|
|
81
136
|
_renderComponent2 = renderComponent(), container = _renderComponent2.container;
|
|
82
137
|
_context2.next = 4;
|
|
83
|
-
return user.click(
|
|
138
|
+
return user.click(screen.getByRole('button', {
|
|
84
139
|
name: 'trigger two',
|
|
85
140
|
expanded: false
|
|
86
141
|
}));
|
|
87
142
|
case 4:
|
|
88
|
-
expect(
|
|
143
|
+
expect(screen.getByRole('button', {
|
|
89
144
|
name: 'trigger one',
|
|
90
145
|
expanded: false
|
|
91
146
|
})).toHaveAttribute('data-state', 'closed');
|
|
92
|
-
expect(
|
|
147
|
+
expect(screen.queryByText('content one')).not.toBeInTheDocument();
|
|
93
148
|
|
|
94
149
|
// Should find the open content
|
|
95
|
-
expect(
|
|
150
|
+
expect(screen.getByRole('button', {
|
|
96
151
|
name: 'trigger two',
|
|
97
152
|
expanded: true
|
|
98
153
|
})).toHaveAttribute('data-state', 'open');
|
|
99
|
-
expect(
|
|
154
|
+
expect(screen.getByText('content two')).toBeVisible();
|
|
100
155
|
|
|
101
156
|
// Check for accessibility issues
|
|
102
157
|
_context2.t0 = expect;
|
|
103
158
|
_context2.next = 11;
|
|
104
|
-
return
|
|
159
|
+
return axe(container);
|
|
105
160
|
case 11:
|
|
106
161
|
_context2.t1 = _context2.sent;
|
|
107
162
|
(0, _context2.t0)(_context2.t1).toHaveNoViolations();
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.Accordion = Accordion;
|
|
7
|
-
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); }
|
|
8
|
-
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; }
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import * as Accordion from './Accordion';
|
|
5
|
+
export { Accordion };
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.Avatar = void 0;
|
|
5
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
6
|
-
var _react = require("react");
|
|
7
|
-
var _themeUi = require("theme-ui");
|
|
8
|
-
var _ = require("..");
|
|
9
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
10
1
|
var _excluded = ["name", "size", "src", "className", "sx"];
|
|
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
|
/**
|
|
12
5
|
* External dependencies
|
|
13
6
|
*/
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import { forwardRef } from 'react';
|
|
9
|
+
import { Image } from 'theme-ui';
|
|
10
|
+
|
|
14
11
|
/**
|
|
15
12
|
* Internal dependencies
|
|
16
13
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
14
|
+
import { Box, Text } from '..';
|
|
15
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
16
|
+
export var Avatar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
21
17
|
var name = _ref.name,
|
|
22
18
|
_ref$size = _ref.size,
|
|
23
19
|
size = _ref$size === void 0 ? 32 : _ref$size,
|
|
@@ -26,7 +22,7 @@ var Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
26
22
|
_ref$sx = _ref.sx,
|
|
27
23
|
sx = _ref$sx === void 0 ? {} : _ref$sx,
|
|
28
24
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
29
|
-
return (
|
|
25
|
+
return _jsx(Box, _extends({
|
|
30
26
|
sx: _extends({
|
|
31
27
|
borderRadius: '100%',
|
|
32
28
|
height: size,
|
|
@@ -40,11 +36,11 @@ var Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
40
36
|
color: 'inverse',
|
|
41
37
|
textAlign: 'center'
|
|
42
38
|
}, sx),
|
|
43
|
-
className: (
|
|
39
|
+
className: classNames('vip-avatar-component', className),
|
|
44
40
|
"aria-hidden": "true",
|
|
45
41
|
ref: ref
|
|
46
42
|
}, props, {
|
|
47
|
-
children: src ? (
|
|
43
|
+
children: src ? _jsx(Image, {
|
|
48
44
|
src: src,
|
|
49
45
|
alt: "Avatar image from " + name,
|
|
50
46
|
sx: {
|
|
@@ -52,7 +48,7 @@ var Avatar = exports.Avatar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref
|
|
|
52
48
|
width: '100%',
|
|
53
49
|
display: 'block'
|
|
54
50
|
}
|
|
55
|
-
}) : (
|
|
51
|
+
}) : _jsx(Text, {
|
|
56
52
|
as: "span",
|
|
57
53
|
sx: {
|
|
58
54
|
color: 'icon.inverse',
|