@automattic/vip-design-system 2.10.0 → 2.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel.config.js +23 -19
- package/build/declaration.d.js +0 -1
- package/build/system/Accordion/Accordion.js +28 -33
- package/build/system/Accordion/Accordion.stories.js +34 -35
- package/build/system/Accordion/Accordion.test.js +35 -34
- package/build/system/Accordion/index.js +5 -8
- package/build/system/Avatar/Avatar.js +13 -17
- package/build/system/Avatar/Avatar.stories.js +10 -12
- package/build/system/Avatar/Avatar.test.js +15 -14
- package/build/system/Avatar/index.js +4 -6
- package/build/system/Badge/Badge.js +9 -14
- package/build/system/Badge/Badge.stories.js +23 -23
- package/build/system/Badge/Badge.test.js +15 -14
- package/build/system/Badge/index.js +4 -6
- package/build/system/Box/Box.js +9 -13
- package/build/system/Box/Box.stories.js +5 -8
- package/build/system/Breadcrumbs/Breadcrumbs.js +34 -38
- package/build/system/Breadcrumbs/Breadcrumbs.stories.js +18 -21
- package/build/system/Breadcrumbs/Breadcrumbs.test.js +28 -30
- package/build/system/Breadcrumbs/styles.js +5 -9
- package/build/system/Button/Button.js +11 -17
- package/build/system/Button/Button.stories.js +34 -33
- package/build/system/Button/Button.test.js +17 -16
- package/build/system/Button/ButtonSubmit.js +12 -16
- package/build/system/Button/ButtonSubmit.stories.js +12 -16
- package/build/system/Button/ButtonSubmit.test.js +15 -14
- package/build/system/Button/index.js +5 -8
- package/build/system/Card/Card.js +12 -14
- package/build/system/Card/Card.stories.js +21 -24
- package/build/system/Card/Card.test.js +19 -18
- package/build/system/Card/index.js +4 -6
- package/build/system/Code/Code.js +19 -23
- package/build/system/Code/Code.stories.js +16 -18
- package/build/system/Code/Code.test.js +20 -19
- package/build/system/Code/index.js +4 -6
- package/build/system/Drawer/Drawer.js +25 -30
- package/build/system/Drawer/Drawer.stories.js +38 -39
- package/build/system/Drawer/Drawer.test.js +19 -18
- package/build/system/Drawer/styles.js +9 -11
- package/build/system/Dropdown/Dropdown.js +23 -26
- package/build/system/Dropdown/Dropdown.test.js +16 -18
- package/build/system/Dropdown/DropdownContent.js +14 -20
- package/build/system/Dropdown/DropdownItem.js +19 -25
- package/build/system/Dropdown/DropdownLabel.js +10 -16
- package/build/system/Dropdown/DropdownSeparator.js +10 -16
- package/build/system/Dropdown/index.js +20 -23
- package/build/system/FilterDropdown/FilterDropdown.js +23 -29
- package/build/system/FilterDropdown/FilterDropdown.stories.js +9 -11
- package/build/system/FilterDropdown/FilterDropdown.test.js +7 -10
- package/build/system/Flex/Flex.js +7 -10
- package/build/system/Flex/Flex.stories.js +6 -10
- package/build/system/Flex/index.js +4 -6
- package/build/system/Footer/Footer.d.ts +33 -0
- package/build/system/Footer/Footer.js +82 -0
- package/build/system/Footer/Footer.stories.d.ts +41 -0
- package/build/system/Footer/Footer.stories.js +53 -0
- package/build/system/Footer/Footer.test.d.ts +1 -0
- package/build/system/Footer/Footer.test.js +36 -0
- package/build/system/Form/Checkbox/Checkbox.js +14 -18
- package/build/system/Form/Checkbox/Checkbox.stories.js +47 -48
- package/build/system/Form/Checkbox/Checkbox.test.js +23 -21
- package/build/system/Form/Checkbox/styles.js +7 -10
- package/build/system/Form/Input.js +19 -18
- package/build/system/Form/Input.stories.js +16 -18
- package/build/system/Form/Input.styles.js +5 -9
- package/build/system/Form/Label.js +14 -16
- package/build/system/Form/Label.stories.js +15 -15
- package/build/system/Form/Radio/Radio.js +13 -18
- package/build/system/Form/Radio/Radio.stories.js +43 -43
- package/build/system/Form/Radio/Radio.test.js +19 -18
- package/build/system/Form/Radio/RadioOption.js +22 -23
- package/build/system/Form/Radio/styles.js +7 -10
- package/build/system/Form/RadioGroupChip.js +26 -29
- package/build/system/Form/RadioGroupChip.stories.js +12 -15
- package/build/system/Form/RadioGroupChip.test.js +12 -11
- package/build/system/Form/RequiredLabel.js +3 -7
- package/build/system/Form/Toggle.js +11 -16
- package/build/system/Form/Toggle.stories.js +25 -27
- package/build/system/Form/Toggle.test.js +12 -11
- package/build/system/Form/Validation.js +10 -12
- package/build/system/Form/index.d.ts +2 -1
- package/build/system/Form/index.js +2 -0
- package/build/system/Grid/Grid.js +7 -10
- package/build/system/Grid/Grid.stories.js +6 -10
- package/build/system/Grid/index.js +4 -6
- package/build/system/Heading/Heading.js +9 -14
- package/build/system/Heading/Heading.stories.js +13 -16
- package/build/system/Hr/Hr.js +3 -7
- package/build/system/Hr/Hr.stories.js +10 -11
- package/build/system/Hr/Hr.test.js +14 -14
- package/build/system/Link/Link.js +11 -14
- package/build/system/Link/Link.stories.js +11 -14
- package/build/system/Link/index.js +4 -6
- package/build/system/LinkExternal/LinkExternal.d.ts +23 -3
- package/build/system/LinkExternal/LinkExternal.js +17 -23
- package/build/system/LinkExternal/LinkExternal.stories.d.ts +1 -8
- package/build/system/LinkExternal/LinkExternal.stories.js +4 -9
- package/build/system/LinkExternal/LinkExternal.test.js +14 -15
- package/build/system/MobileMenu/MobileMenu.js +24 -29
- package/build/system/MobileMenu/MobileMenu.stories.js +66 -67
- package/build/system/MobileMenu/MobileMenu.test.js +21 -22
- package/build/system/Nav/Nav.js +26 -32
- package/build/system/Nav/Nav.stories.js +97 -99
- package/build/system/Nav/Nav.test.js +32 -28
- package/build/system/Nav/NavItem.js +40 -45
- package/build/system/Nav/NavItemGroup.js +34 -39
- package/build/system/Nav/NavItemGroup.test.js +26 -23
- package/build/system/Nav/styles/variants/breadcrumbs.js +4 -7
- package/build/system/Nav/styles/variants/menu.js +8 -12
- package/build/system/Nav/styles/variants/menugroup.js +7 -11
- package/build/system/Nav/styles/variants/primary.js +4 -8
- package/build/system/Nav/styles/variants/tabs.js +3 -7
- package/build/system/Nav/styles/variants/toolbar.js +5 -8
- package/build/system/Nav/styles.js +26 -29
- package/build/system/NewDialog/DialogClose.js +14 -18
- package/build/system/NewDialog/DialogClose.test.js +11 -14
- package/build/system/NewDialog/DialogDescription.js +9 -15
- package/build/system/NewDialog/DialogOverlay.js +11 -13
- package/build/system/NewDialog/DialogTitle.js +7 -15
- package/build/system/NewDialog/NewDialog.js +24 -29
- package/build/system/NewDialog/index.js +7 -11
- package/build/system/NewDialog/styles.js +1 -5
- package/build/system/NewForm/Fieldset.js +13 -17
- package/build/system/NewForm/Form.js +8 -13
- package/build/system/NewForm/FormAutocomplete.js +2 -2
- package/build/system/NewForm/Legend.js +11 -15
- package/build/system/Notice/Notice.js +22 -25
- package/build/system/Notice/Notice.stories.js +41 -43
- package/build/system/Notice/index.js +5 -5
- package/build/system/Page/Page.js +4 -8
- package/build/system/Page/Page.test.js +14 -14
- package/build/system/Progress/Progress.js +21 -24
- package/build/system/Progress/Progress.stories.js +9 -15
- package/build/system/Progress/Progress.test.js +14 -13
- package/build/system/Progress/index.js +4 -6
- package/build/system/ScreenReaderText/ScreenReaderText.js +9 -9
- package/build/system/Spinner/Spinner.js +9 -14
- package/build/system/Spinner/Spinner.stories.js +6 -10
- package/build/system/Spinner/Spinner.test.js +14 -13
- package/build/system/Spinner/index.js +1 -6
- package/build/system/Table/Table.js +20 -22
- package/build/system/Table/Table.stories.js +29 -30
- package/build/system/Table/TableCell.js +9 -11
- package/build/system/Table/TableRow.js +10 -11
- package/build/system/Table/index.js +6 -10
- package/build/system/Text/Text.js +9 -14
- package/build/system/Text/Text.stories.js +24 -25
- package/build/system/Text/index.js +4 -6
- package/build/system/Toolbar/Logo.js +11 -15
- package/build/system/Toolbar/Toolbar.js +12 -17
- package/build/system/Toolbar/Toolbar.stories.js +47 -50
- package/build/system/Toolbar/Toolbar.test.js +26 -24
- package/build/system/Toolbar/ToolbarUtilNav.js +9 -16
- package/build/system/Toolbar/index.js +10 -15
- package/build/system/Tooltip/Tooltip.js +9 -14
- package/build/system/Tooltip/Tooltip.stories.js +29 -31
- package/build/system/Tooltip/index.js +5 -5
- package/build/system/Wizard/Wizard.js +11 -18
- package/build/system/Wizard/Wizard.stories.js +37 -38
- package/build/system/Wizard/WizardStep.js +26 -32
- package/build/system/Wizard/index.js +6 -7
- package/build/system/assets/a8cLogo.d.ts +2 -0
- package/build/system/assets/a8cLogo.js +39 -0
- package/build/system/index.d.ts +2 -1
- package/build/system/index.js +2 -0
- package/build/system/theme/breakpoints.js +1 -5
- package/build/system/utils/stories/CustomLink.js +7 -13
- package/package.json +1 -1
- package/src/system/Footer/Footer.stories.tsx +46 -0
- package/src/system/Footer/Footer.test.tsx +40 -0
- package/src/system/Footer/Footer.tsx +120 -0
- package/src/system/Form/index.js +2 -0
- package/src/system/LinkExternal/LinkExternal.tsx +27 -8
- package/src/system/NewForm/FormAutocomplete.js +2 -2
- package/src/system/assets/a8cLogo.tsx +30 -0
- package/src/system/index.js +2 -0
|
@@ -1,49 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
import { render, screen } from '@testing-library/react';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
var _react = require("@testing-library/react");
|
|
5
|
-
var _LinkExternal = _interopRequireDefault(require("./LinkExternal"));
|
|
6
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
-
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); } /**
|
|
5
|
+
/**
|
|
9
6
|
* Internal dependencies
|
|
10
7
|
*/
|
|
8
|
+
import LinkExternal from './LinkExternal';
|
|
9
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
11
10
|
var props = {
|
|
12
11
|
children: 'View on Github',
|
|
13
12
|
href: 'https://github.com/Automattic/vip-design-system'
|
|
14
13
|
};
|
|
15
14
|
describe('<LinkExternal />', function () {
|
|
16
15
|
it('should render correctly', function () {
|
|
17
|
-
|
|
16
|
+
render(_jsx(LinkExternal, _extends({}, props, {
|
|
18
17
|
children: "View on Github"
|
|
19
18
|
})));
|
|
20
|
-
var link =
|
|
19
|
+
var link = screen.getByRole('link');
|
|
21
20
|
expect(link).toHaveTextContent(/view on github/i);
|
|
22
21
|
expect(link).toHaveTextContent(/external link/i);
|
|
23
22
|
expect(link).toHaveAttribute('target', '_self');
|
|
24
23
|
expect(link).toHaveAttribute('rel', '');
|
|
25
24
|
});
|
|
26
25
|
it('should open in new tab when newTab is true', function () {
|
|
27
|
-
|
|
26
|
+
render(_jsx(LinkExternal, _extends({}, props, {
|
|
28
27
|
newTab: true
|
|
29
28
|
})));
|
|
30
|
-
var link =
|
|
29
|
+
var link = screen.getByRole('link');
|
|
31
30
|
expect(link).toHaveTextContent(/opens in a new tab/i);
|
|
32
31
|
expect(link).toHaveAttribute('target', '_blank');
|
|
33
32
|
expect(link).toHaveAttribute('rel', 'noopener noreferrer');
|
|
34
33
|
});
|
|
35
34
|
it('should contain additional screenreader text when added', function () {
|
|
36
|
-
|
|
35
|
+
render(_jsx(LinkExternal, _extends({}, props, {
|
|
37
36
|
screenReaderText: "VIP Design System"
|
|
38
37
|
})));
|
|
39
|
-
expect(
|
|
38
|
+
expect(screen.getByRole('link', {
|
|
40
39
|
name: /vip design system/i
|
|
41
40
|
})).toBeInTheDocument();
|
|
42
41
|
});
|
|
43
42
|
it('should hide icon when showExternalIcon is false', function () {
|
|
44
|
-
|
|
43
|
+
render(_jsx(LinkExternal, _extends({}, props, {
|
|
45
44
|
showExternalIcon: false
|
|
46
45
|
})));
|
|
47
|
-
expect(
|
|
46
|
+
expect(screen.queryByText('↗')).not.toBeInTheDocument();
|
|
48
47
|
});
|
|
49
48
|
});
|
|
@@ -1,37 +1,32 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.MobileMenuWrapper = exports.MobileMenuTrigger = exports.MobileMenu = void 0;
|
|
5
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
-
var _bi = require("react-icons/bi");
|
|
7
|
-
var Drawer = _interopRequireWildcard(require("../Drawer/Drawer"));
|
|
8
|
-
var _DialogClose = require("../NewDialog/DialogClose");
|
|
9
|
-
var _Logo = require("../Toolbar/Logo");
|
|
10
|
-
var _index = require("../index");
|
|
11
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
1
|
/** @jsxImportSource theme-ui */
|
|
15
2
|
|
|
16
|
-
|
|
3
|
+
import React, { forwardRef } from 'react';
|
|
4
|
+
import { BiMenu } from 'react-icons/bi';
|
|
5
|
+
import * as Drawer from '../Drawer/Drawer';
|
|
6
|
+
import { DialogCloseDefault } from '../NewDialog/DialogClose';
|
|
7
|
+
import { Logo } from '../Toolbar/Logo';
|
|
8
|
+
import { Button, Flex, Nav, Box } from '../index';
|
|
9
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
11
|
+
export var MobileMenu = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
17
12
|
var children = _ref.children,
|
|
18
13
|
toolbarItems = _ref.toolbarItems;
|
|
19
|
-
return (
|
|
14
|
+
return _jsx(Drawer.Content, {
|
|
20
15
|
variant: "left",
|
|
21
16
|
label: "Main Navigation Items",
|
|
22
17
|
ref: ref,
|
|
23
18
|
renderClose: function renderClose() {
|
|
24
|
-
return (
|
|
19
|
+
return _jsx(DialogCloseDefault, {
|
|
25
20
|
variant: "inverse"
|
|
26
21
|
});
|
|
27
22
|
},
|
|
28
|
-
children: (
|
|
23
|
+
children: _jsxs(Box, {
|
|
29
24
|
sx: {
|
|
30
25
|
backgroundColor: 'toolbar.background',
|
|
31
26
|
boxShadow: 'none',
|
|
32
27
|
gap: 4
|
|
33
28
|
},
|
|
34
|
-
children: [(
|
|
29
|
+
children: [_jsx(Flex, {
|
|
35
30
|
sx: {
|
|
36
31
|
flexWrap: 'wrap',
|
|
37
32
|
height: 64,
|
|
@@ -41,14 +36,14 @@ var MobileMenu = exports.MobileMenu = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
41
36
|
gap: 7,
|
|
42
37
|
alignItems: 'center'
|
|
43
38
|
},
|
|
44
|
-
children: (
|
|
45
|
-
}), (
|
|
39
|
+
children: _jsx(Logo, {})
|
|
40
|
+
}), _jsx("div", {
|
|
46
41
|
sx: {
|
|
47
42
|
height: '100vh',
|
|
48
43
|
display: 'flex',
|
|
49
44
|
flex: 1
|
|
50
45
|
},
|
|
51
|
-
children: (
|
|
46
|
+
children: _jsxs(Flex, {
|
|
52
47
|
sx: {
|
|
53
48
|
width: '100%',
|
|
54
49
|
flexDirection: 'column',
|
|
@@ -56,11 +51,11 @@ var MobileMenu = exports.MobileMenu = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
56
51
|
overflowX: 'hidden',
|
|
57
52
|
overflowY: 'auto'
|
|
58
53
|
},
|
|
59
|
-
children: [toolbarItems && (
|
|
54
|
+
children: [toolbarItems && _jsx(Nav.PrimaryInverse, {
|
|
60
55
|
label: "Main Links",
|
|
61
56
|
orientation: "vertical",
|
|
62
57
|
children: toolbarItems
|
|
63
|
-
}), (
|
|
58
|
+
}), _jsx(Box, {
|
|
64
59
|
sx: {
|
|
65
60
|
alignSelf: 'stretch',
|
|
66
61
|
backgroundColor: 'layer.1',
|
|
@@ -78,21 +73,21 @@ var MobileMenu = exports.MobileMenu = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
78
73
|
})
|
|
79
74
|
});
|
|
80
75
|
});
|
|
81
|
-
var MobileMenuWrapper =
|
|
76
|
+
export var MobileMenuWrapper = function MobileMenuWrapper(_ref2) {
|
|
82
77
|
var children = _ref2.children;
|
|
83
|
-
return (
|
|
78
|
+
return _jsx(Drawer.Root, {
|
|
84
79
|
children: children
|
|
85
80
|
});
|
|
86
81
|
};
|
|
87
|
-
var MobileMenuTrigger =
|
|
82
|
+
export var MobileMenuTrigger = function MobileMenuTrigger(_ref3) {
|
|
88
83
|
var _ref3$label = _ref3.label,
|
|
89
84
|
label = _ref3$label === void 0 ? 'Menu' : _ref3$label,
|
|
90
85
|
_ref3$variant = _ref3.variant,
|
|
91
86
|
variant = _ref3$variant === void 0 ? 'primary' : _ref3$variant,
|
|
92
87
|
_ref3$display = _ref3.display,
|
|
93
88
|
display = _ref3$display === void 0 ? ['none', 'flex', 'flex', 'none'] : _ref3$display;
|
|
94
|
-
return (
|
|
95
|
-
children: (
|
|
89
|
+
return _jsx(Drawer.Trigger, {
|
|
90
|
+
children: _jsx(Button, {
|
|
96
91
|
type: "button",
|
|
97
92
|
variant: "tertiary",
|
|
98
93
|
sx: {
|
|
@@ -105,7 +100,7 @@ var MobileMenuTrigger = exports.MobileMenuTrigger = function MobileMenuTrigger(_
|
|
|
105
100
|
p: 0
|
|
106
101
|
},
|
|
107
102
|
"aria-label": label,
|
|
108
|
-
children: (
|
|
103
|
+
children: _jsx(BiMenu, {
|
|
109
104
|
size: 16,
|
|
110
105
|
role: "presentation"
|
|
111
106
|
})
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports["default"] = exports.MobileMenuExample = exports.Default = void 0;
|
|
5
|
-
var _ai = require("react-icons/ai");
|
|
6
|
-
var _bi = require("react-icons/bi");
|
|
7
|
-
var _md = require("react-icons/md");
|
|
8
|
-
var _MobileMenu = require("./MobileMenu");
|
|
9
|
-
var _ = require("..");
|
|
10
|
-
var _CustomLink = require("../utils/stories/CustomLink");
|
|
11
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
12
1
|
/** @jsxImportSource theme-ui */
|
|
13
|
-
|
|
2
|
+
|
|
3
|
+
import { AiOutlineLock } from 'react-icons/ai';
|
|
4
|
+
import { BiBell, BiBulb, BiCodeAlt, BiData, BiGridAlt, BiHistory, BiTachometer, BiWindows } from 'react-icons/bi';
|
|
5
|
+
import { MdOutlinePhotoLibrary } from 'react-icons/md';
|
|
6
|
+
import { MobileMenu, MobileMenuTrigger, MobileMenuWrapper } from './MobileMenu';
|
|
7
|
+
import { Flex, Nav, NavItem } from '..';
|
|
8
|
+
import { CustomLink } from '../utils/stories/CustomLink';
|
|
9
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
10
|
+
import { Fragment as _Fragment } from "theme-ui/jsx-runtime";
|
|
11
|
+
import { jsxs as _jsxs } from "theme-ui/jsx-runtime";
|
|
12
|
+
export default {
|
|
14
13
|
title: 'Navigation/MobileMenu',
|
|
15
|
-
component:
|
|
14
|
+
component: MobileMenu,
|
|
16
15
|
parameters: {
|
|
17
16
|
docs: {
|
|
18
17
|
description: {
|
|
@@ -21,147 +20,147 @@ var _default = exports["default"] = {
|
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
};
|
|
24
|
-
var MobileMenuExample =
|
|
25
|
-
return (
|
|
26
|
-
children: [(
|
|
23
|
+
export var MobileMenuExample = function MobileMenuExample() {
|
|
24
|
+
return _jsxs(MobileMenuWrapper, {
|
|
25
|
+
children: [_jsx(MobileMenuTrigger, {
|
|
27
26
|
label: "Menu",
|
|
28
27
|
variant: "primary",
|
|
29
28
|
display: ['flex', 'flex', 'flex']
|
|
30
|
-
}), (
|
|
31
|
-
toolbarItems: (
|
|
32
|
-
children: [(
|
|
29
|
+
}), _jsx(MobileMenu, {
|
|
30
|
+
toolbarItems: _jsxs(_Fragment, {
|
|
31
|
+
children: [_jsx(NavItem.MenuInverse, {
|
|
33
32
|
href: "/apps",
|
|
34
33
|
active: true,
|
|
35
|
-
as:
|
|
34
|
+
as: CustomLink,
|
|
36
35
|
children: "My Applications"
|
|
37
|
-
}), (
|
|
36
|
+
}), _jsx(NavItem.MenuInverse, {
|
|
38
37
|
href: "/orgs",
|
|
39
|
-
as:
|
|
38
|
+
as: CustomLink,
|
|
40
39
|
children: "My Organizations"
|
|
41
40
|
})]
|
|
42
41
|
}),
|
|
43
|
-
children: (
|
|
42
|
+
children: _jsx(Flex, {
|
|
44
43
|
sx: {
|
|
45
44
|
gap: 3,
|
|
46
45
|
px: 5,
|
|
47
46
|
py: 0,
|
|
48
47
|
flexDirection: 'column'
|
|
49
48
|
},
|
|
50
|
-
children: (
|
|
49
|
+
children: _jsxs(Nav.Menu, {
|
|
51
50
|
sx: {
|
|
52
51
|
mb: 4
|
|
53
52
|
},
|
|
54
53
|
label: "Nav Menu",
|
|
55
|
-
children: [(
|
|
54
|
+
children: [_jsx(NavItem.Menu, {
|
|
56
55
|
href: "https://wordpress.com",
|
|
57
56
|
renderIcon: function renderIcon(size) {
|
|
58
|
-
return (
|
|
57
|
+
return _jsx(BiGridAlt, {
|
|
59
58
|
size: size
|
|
60
59
|
});
|
|
61
60
|
},
|
|
62
|
-
as:
|
|
61
|
+
as: CustomLink,
|
|
63
62
|
children: "Overview"
|
|
64
|
-
}), (
|
|
65
|
-
as:
|
|
63
|
+
}), _jsx(NavItem.Menu, {
|
|
64
|
+
as: CustomLink,
|
|
66
65
|
href: "https://random-website.com/",
|
|
67
66
|
renderIcon: function renderIcon(size) {
|
|
68
|
-
return (
|
|
67
|
+
return _jsx(BiWindows, {
|
|
69
68
|
size: size
|
|
70
69
|
});
|
|
71
70
|
},
|
|
72
71
|
children: "Network Sites"
|
|
73
|
-
}), (
|
|
74
|
-
as:
|
|
72
|
+
}), _jsx(NavItem.Menu, {
|
|
73
|
+
as: CustomLink,
|
|
75
74
|
href: "https://random-website.com/",
|
|
76
75
|
renderIcon: function renderIcon(size) {
|
|
77
|
-
return (
|
|
76
|
+
return _jsx(AiOutlineLock, {
|
|
78
77
|
size: size
|
|
79
78
|
});
|
|
80
79
|
},
|
|
81
80
|
children: "Domains & TLS"
|
|
82
|
-
}), (
|
|
81
|
+
}), _jsxs(NavItem.MenuGroup, {
|
|
83
82
|
active: true,
|
|
84
83
|
label: "Logs",
|
|
85
84
|
renderIcon: function renderIcon(size) {
|
|
86
|
-
return (
|
|
85
|
+
return _jsx(BiHistory, {
|
|
87
86
|
size: size
|
|
88
87
|
});
|
|
89
88
|
},
|
|
90
|
-
children: [(
|
|
91
|
-
as:
|
|
89
|
+
children: [_jsx(NavItem.Menu, {
|
|
90
|
+
as: CustomLink,
|
|
92
91
|
href: "https://google.com/",
|
|
93
92
|
children: "Audit"
|
|
94
|
-
}), (
|
|
93
|
+
}), _jsx(NavItem.Menu, {
|
|
95
94
|
active: true,
|
|
96
|
-
as:
|
|
95
|
+
as: CustomLink,
|
|
97
96
|
href: "https://wpvip.com/",
|
|
98
97
|
children: "Runtime"
|
|
99
|
-
}), (
|
|
100
|
-
as:
|
|
98
|
+
}), _jsx(NavItem.Menu, {
|
|
99
|
+
as: CustomLink,
|
|
101
100
|
href: "https://dashboard.wpvip.com/",
|
|
102
101
|
children: "Slow Query"
|
|
103
102
|
})]
|
|
104
|
-
}), (
|
|
103
|
+
}), _jsxs(NavItem.MenuGroup, {
|
|
105
104
|
label: "Performance",
|
|
106
105
|
renderIcon: function renderIcon(size) {
|
|
107
|
-
return (
|
|
106
|
+
return _jsx(BiTachometer, {
|
|
108
107
|
size: size
|
|
109
108
|
});
|
|
110
109
|
},
|
|
111
|
-
children: [(
|
|
112
|
-
as:
|
|
110
|
+
children: [_jsx(NavItem.Menu, {
|
|
111
|
+
as: CustomLink,
|
|
113
112
|
href: "https://random-website.com/",
|
|
114
113
|
children: "Metrics"
|
|
115
|
-
}), (
|
|
116
|
-
as:
|
|
114
|
+
}), _jsx(NavItem.Menu, {
|
|
115
|
+
as: CustomLink,
|
|
117
116
|
href: "https://random-website.com/",
|
|
118
117
|
children: "Monitor"
|
|
119
|
-
}), (
|
|
120
|
-
as:
|
|
118
|
+
}), _jsx(NavItem.Menu, {
|
|
119
|
+
as: CustomLink,
|
|
121
120
|
href: "https://random-website.com/",
|
|
122
121
|
children: "Cache"
|
|
123
122
|
})]
|
|
124
|
-
}), (
|
|
125
|
-
as:
|
|
123
|
+
}), _jsx(NavItem.Menu, {
|
|
124
|
+
as: CustomLink,
|
|
126
125
|
href: "https://random-website.com/",
|
|
127
126
|
renderIcon: function renderIcon(size) {
|
|
128
|
-
return (
|
|
127
|
+
return _jsx(BiCodeAlt, {
|
|
129
128
|
size: size
|
|
130
129
|
});
|
|
131
130
|
},
|
|
132
131
|
children: "Code [v]"
|
|
133
|
-
}), (
|
|
134
|
-
as:
|
|
132
|
+
}), _jsx(NavItem.Menu, {
|
|
133
|
+
as: CustomLink,
|
|
135
134
|
href: "https://random-website.com/",
|
|
136
135
|
renderIcon: function renderIcon(size) {
|
|
137
|
-
return (
|
|
136
|
+
return _jsx(BiData, {
|
|
138
137
|
size: size
|
|
139
138
|
});
|
|
140
139
|
},
|
|
141
140
|
children: "Database [v]"
|
|
142
|
-
}), (
|
|
143
|
-
as:
|
|
141
|
+
}), _jsx(NavItem.Menu, {
|
|
142
|
+
as: CustomLink,
|
|
144
143
|
href: "https://random-website.com/",
|
|
145
144
|
renderIcon: function renderIcon(size) {
|
|
146
|
-
return (
|
|
145
|
+
return _jsx(MdOutlinePhotoLibrary, {
|
|
147
146
|
size: size
|
|
148
147
|
});
|
|
149
148
|
},
|
|
150
149
|
children: "Media [v]"
|
|
151
|
-
}), (
|
|
152
|
-
as:
|
|
150
|
+
}), _jsx(NavItem.Menu, {
|
|
151
|
+
as: CustomLink,
|
|
153
152
|
href: "https://random-website.com/",
|
|
154
153
|
renderIcon: function renderIcon(size) {
|
|
155
|
-
return (
|
|
154
|
+
return _jsx(BiBell, {
|
|
156
155
|
size: size
|
|
157
156
|
});
|
|
158
157
|
},
|
|
159
158
|
children: "Notifications"
|
|
160
|
-
}), (
|
|
161
|
-
as:
|
|
159
|
+
}), _jsx(NavItem.Menu, {
|
|
160
|
+
as: CustomLink,
|
|
162
161
|
href: "https://random-website.com/",
|
|
163
162
|
renderIcon: function renderIcon(size) {
|
|
164
|
-
return (
|
|
163
|
+
return _jsx(BiBulb, {
|
|
165
164
|
size: size
|
|
166
165
|
});
|
|
167
166
|
},
|
|
@@ -172,10 +171,10 @@ var MobileMenuExample = exports.MobileMenuExample = function MobileMenuExample()
|
|
|
172
171
|
})]
|
|
173
172
|
});
|
|
174
173
|
};
|
|
175
|
-
var Default =
|
|
174
|
+
export var Default = {
|
|
176
175
|
render: function render() {
|
|
177
|
-
return (
|
|
178
|
-
children: (
|
|
176
|
+
return _jsx(_Fragment, {
|
|
177
|
+
children: _jsx(MobileMenuExample, {})
|
|
179
178
|
});
|
|
180
179
|
}
|
|
181
180
|
};
|
|
@@ -1,28 +1,27 @@
|
|
|
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 _MobileMenu = require("./MobileMenu.stories");
|
|
8
|
-
var _ = require("../");
|
|
9
|
-
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
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; }
|
|
12
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); } }
|
|
13
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
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
|
|
14
6
|
/** @jsxImportSource theme-ui */
|
|
7
|
+
import { render, screen } from '@testing-library/react';
|
|
8
|
+
import userEvent from '@testing-library/user-event';
|
|
9
|
+
import { axe } from 'jest-axe';
|
|
10
|
+
import { ThemeUIProvider } from 'theme-ui';
|
|
11
|
+
import { MobileMenuExample } from './MobileMenu.stories';
|
|
12
|
+
import { theme } from '../';
|
|
13
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
15
14
|
var renderWithTheme = function renderWithTheme(children) {
|
|
16
|
-
return
|
|
17
|
-
theme:
|
|
15
|
+
return render(_jsx(ThemeUIProvider, {
|
|
16
|
+
theme: theme,
|
|
18
17
|
children: children
|
|
19
18
|
}));
|
|
20
19
|
};
|
|
21
20
|
var renderComponent = function renderComponent() {
|
|
22
|
-
return renderWithTheme((
|
|
21
|
+
return renderWithTheme(_jsx(MobileMenuExample, {}));
|
|
23
22
|
};
|
|
24
23
|
function getMenuTrigger() {
|
|
25
|
-
return
|
|
24
|
+
return screen.getByRole('button', {
|
|
26
25
|
name: 'Menu'
|
|
27
26
|
});
|
|
28
27
|
}
|
|
@@ -39,7 +38,7 @@ describe('<MobileMenu />', function () {
|
|
|
39
38
|
// Check for accessibility issues
|
|
40
39
|
_context.t0 = expect;
|
|
41
40
|
_context.next = 6;
|
|
42
|
-
return
|
|
41
|
+
return axe(container);
|
|
43
42
|
case 6:
|
|
44
43
|
_context.t1 = _context.sent;
|
|
45
44
|
(0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
@@ -54,21 +53,21 @@ describe('<MobileMenu />', function () {
|
|
|
54
53
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
55
54
|
while (1) switch (_context2.prev = _context2.next) {
|
|
56
55
|
case 0:
|
|
57
|
-
user =
|
|
56
|
+
user = userEvent.setup();
|
|
58
57
|
_renderComponent2 = renderComponent(), container = _renderComponent2.container;
|
|
59
58
|
_context2.next = 4;
|
|
60
59
|
return user.click(getMenuTrigger());
|
|
61
60
|
case 4:
|
|
62
61
|
// Should find the open content
|
|
63
|
-
expect(
|
|
64
|
-
expect(
|
|
65
|
-
expect(
|
|
66
|
-
expect(
|
|
62
|
+
expect(screen.getByText('My Applications')).toBeVisible(); // First menu
|
|
63
|
+
expect(screen.getByText('My Organizations')).toBeVisible();
|
|
64
|
+
expect(screen.getByText('Performance')).toBeVisible();
|
|
65
|
+
expect(screen.getByText('Features')).toBeVisible(); // Last Menu
|
|
67
66
|
|
|
68
67
|
// Check for accessibility issues
|
|
69
68
|
_context2.t0 = expect;
|
|
70
69
|
_context2.next = 11;
|
|
71
|
-
return
|
|
70
|
+
return axe(container);
|
|
72
71
|
case 11:
|
|
73
72
|
_context2.t1 = _context2.sent;
|
|
74
73
|
(0, _context2.t0)(_context2.t1).toHaveNoViolations();
|
package/build/system/Nav/Nav.js
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
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); }
|
|
12
|
-
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; }
|
|
13
|
-
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); } /** @jsxImportSource theme-ui */
|
|
14
|
-
var VIP_NAV = exports.VIP_NAV = 'vip-nav-component';
|
|
15
|
-
var NavBase = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
/** @jsxImportSource theme-ui */
|
|
3
|
+
import * as NavigationMenu from '@radix-ui/react-navigation-menu';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { forwardRef } from 'react';
|
|
6
|
+
import { navMenuListStyles, navStyles } from './styles';
|
|
7
|
+
import { jsx as _jsx } from "theme-ui/jsx-runtime";
|
|
8
|
+
export var VIP_NAV = 'vip-nav-component';
|
|
9
|
+
var NavBase = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
16
10
|
var className = _ref.className,
|
|
17
11
|
children = _ref.children,
|
|
18
12
|
_ref$orientation = _ref.orientation,
|
|
@@ -20,51 +14,51 @@ var NavBase = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
20
14
|
_ref$variant = _ref.variant,
|
|
21
15
|
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
22
16
|
label = _ref.label;
|
|
23
|
-
return (
|
|
17
|
+
return _jsx(NavigationMenu.Root, {
|
|
24
18
|
"aria-label": label,
|
|
25
19
|
ref: ref,
|
|
26
|
-
className: (
|
|
27
|
-
sx:
|
|
20
|
+
className: classNames(VIP_NAV, className),
|
|
21
|
+
sx: navStyles(variant, orientation),
|
|
28
22
|
orientation: orientation,
|
|
29
|
-
children: (
|
|
30
|
-
className: (
|
|
31
|
-
sx:
|
|
23
|
+
children: _jsx(NavigationMenu.List, {
|
|
24
|
+
className: classNames(VIP_NAV + "-list"),
|
|
25
|
+
sx: navMenuListStyles(orientation),
|
|
32
26
|
children: children
|
|
33
27
|
})
|
|
34
28
|
});
|
|
35
29
|
});
|
|
36
|
-
var NavPrimary = /*#__PURE__*/
|
|
37
|
-
return (
|
|
30
|
+
var NavPrimary = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
31
|
+
return _jsx(NavBase, _extends({}, props, {
|
|
38
32
|
variant: "primary",
|
|
39
33
|
ref: ref
|
|
40
34
|
}));
|
|
41
35
|
});
|
|
42
|
-
var NavPrimaryInverse = /*#__PURE__*/
|
|
43
|
-
return (
|
|
36
|
+
var NavPrimaryInverse = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
37
|
+
return _jsx(NavBase, _extends({}, props, {
|
|
44
38
|
variant: "primary-inverse",
|
|
45
39
|
ref: ref
|
|
46
40
|
}));
|
|
47
41
|
});
|
|
48
|
-
var NavTab = /*#__PURE__*/
|
|
49
|
-
return (
|
|
42
|
+
var NavTab = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
43
|
+
return _jsx(NavBase, _extends({}, props, {
|
|
50
44
|
variant: "tabs",
|
|
51
45
|
ref: ref
|
|
52
46
|
}));
|
|
53
47
|
});
|
|
54
|
-
var NavToolbar = /*#__PURE__*/
|
|
55
|
-
return (
|
|
48
|
+
var NavToolbar = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
49
|
+
return _jsx(NavBase, _extends({}, props, {
|
|
56
50
|
variant: "toolbar",
|
|
57
51
|
ref: ref
|
|
58
52
|
}));
|
|
59
53
|
});
|
|
60
|
-
var NavMenu = /*#__PURE__*/
|
|
61
|
-
return (
|
|
54
|
+
var NavMenu = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
55
|
+
return _jsx(NavBase, _extends({}, props, {
|
|
62
56
|
variant: "menu",
|
|
63
57
|
orientation: "vertical",
|
|
64
58
|
ref: ref
|
|
65
59
|
}));
|
|
66
60
|
});
|
|
67
|
-
var Nav =
|
|
61
|
+
export var Nav = {
|
|
68
62
|
Primary: NavPrimary,
|
|
69
63
|
PrimaryInverse: NavPrimaryInverse,
|
|
70
64
|
Tab: NavTab,
|