@automattic/vip-design-system 1.3.2 → 1.4.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/.storybook/preview.tsx +3 -0
- package/README.md +17 -4
- package/build/system/Form/Radio.js +0 -2
- package/build/system/Link/Link.stories.d.ts +1 -1
- package/build/system/Link/Link.stories.js +2 -2
- package/build/system/Nav/Nav.d.ts +13 -0
- package/build/system/Nav/Nav.js +62 -0
- package/build/system/Nav/Nav.stories.d.ts +27 -0
- package/build/system/Nav/Nav.stories.js +85 -0
- package/build/system/Nav/Nav.test.d.ts +1 -0
- package/build/system/Nav/Nav.test.js +72 -0
- package/build/system/Nav/NavItem.d.ts +19 -0
- package/build/system/Nav/NavItem.js +148 -0
- package/build/system/Nav/index.d.ts +10 -0
- package/build/system/Nav/index.js +19 -0
- package/build/system/Notice/Notice.js +24 -10
- package/build/system/Notice/Notice.stories.d.ts +1 -0
- package/build/system/Notice/Notice.stories.js +34 -2
- package/build/system/Tabs/Tabs.stories.jsx +1 -1
- package/build/system/Wizard/Wizard.stories.js +1 -1
- package/build/system/index.d.ts +3 -1
- package/build/system/index.js +5 -2
- package/docs/ARCHITECTURE.md +88 -0
- package/docs/CONTRIBUTING.md +54 -0
- package/docs/RELEASING.md +70 -0
- package/docs/SETUP.md +68 -0
- package/docs/TESTING.md +63 -0
- package/package.json +2 -1
- package/src/system/Form/Radio.js +0 -2
- package/src/system/Link/Link.stories.tsx +1 -1
- package/src/system/Nav/Nav.stories.tsx +117 -0
- package/src/system/Nav/Nav.test.tsx +51 -0
- package/src/system/Nav/Nav.tsx +62 -0
- package/src/system/Nav/NavItem.tsx +152 -0
- package/src/system/Nav/index.tsx +18 -0
- package/src/system/Notice/Notice.stories.tsx +21 -3
- package/src/system/Notice/Notice.tsx +20 -13
- package/src/system/Tabs/Tabs.stories.jsx +1 -1
- package/src/system/Wizard/Wizard.stories.tsx +1 -1
- package/src/system/index.js +5 -2
- package/CONTRIBUTING.md +0 -138
package/.storybook/preview.tsx
CHANGED
package/README.md
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
# VIP Design System
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This is the main repository to store Design system tokens and components used throughout VIP projects.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Further documentation
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- [SETUP.md](https://github.com/Automattic/vip-design-system/blob/trunk/docs/SETUP.md) for installation and setup instructions, basic usage and environmental variables.
|
|
10
|
+
- [ARCHITECTURE.md](https://github.com/Automattic/vip-design-system/blob/trunk/docs/ARCHITECTURE.md) for information on architecture, code structure, data storage and security.
|
|
11
|
+
- [CONTRIBUTING.md](https://github.com/Automattic/vip-design-system/blob/trunk/docs/CONTRIBUTING.md) for information on how to contribute patches and features, also issue and pull request labels.
|
|
12
|
+
- [TESTING.md](https://github.com/Automattic/vip-design-system/blob/trunk/docs/TESTING.md) for details on testing the software and individual tasks.
|
|
13
|
+
- [RELEASING.md](https://github.com/Automattic/vip-design-system/blob/trunk/docs/RELEASING.md) for details on deploying a new release.
|
|
14
|
+
|
|
15
|
+
## Health, logs and monitoring
|
|
16
|
+
|
|
17
|
+
- [React Components Website](https://vip-design-system-components.netlify.app/)
|
|
18
|
+
- [Figma Productive Components](https://www.figma.com/file/jcGe2KIAlh2PxaAZ5liYWi/Productive-Components?type=design&node-id=7378-4230&mode=design&t=QUgpLoxTpJvAfTiN-0)
|
|
19
|
+
|
|
20
|
+
## Links to historical documents
|
|
21
|
+
|
|
22
|
+
For VIP folks: Please see internal documentation on vip-design-system regarding historical documents (search for vip-design-system).
|
|
@@ -31,7 +31,6 @@ const inputStyle = {
|
|
|
31
31
|
content: '""',
|
|
32
32
|
border: '1px solid',
|
|
33
33
|
borderColor: baseControlBorderStyle.borderColor,
|
|
34
|
-
zIndex: 3,
|
|
35
34
|
left: `${ -1 * radioPosition }px`,
|
|
36
35
|
} ),
|
|
37
36
|
'&:checked ~ label::after': {
|
|
@@ -54,7 +53,6 @@ const labelStyle = {
|
|
|
54
53
|
top: 1,
|
|
55
54
|
left: `${ -1 * radioPosition }px`,
|
|
56
55
|
transition: 'all .3s ease-out',
|
|
57
|
-
zIndex: 2,
|
|
58
56
|
width: '16px',
|
|
59
57
|
height: '16px',
|
|
60
58
|
},
|
|
@@ -8,8 +8,8 @@ import type { StoryObj } from '@storybook/react';
|
|
|
8
8
|
*/
|
|
9
9
|
import { Link } from '..';
|
|
10
10
|
declare const _default: {
|
|
11
|
-
component: import("react").ForwardRefExoticComponent<Omit<import("./Link").LinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
12
11
|
title: string;
|
|
12
|
+
component: import("react").ForwardRefExoticComponent<Omit<import("./Link").LinkProps, "ref"> & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
13
13
|
};
|
|
14
14
|
export default _default;
|
|
15
15
|
type Story = StoryObj<typeof Link>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import * as NavigationMenu from '@radix-ui/react-navigation-menu';
|
|
4
|
+
import { ThemeUIStyleObject } from 'theme-ui';
|
|
5
|
+
export type NavVariant = 'primary' | 'tabs';
|
|
6
|
+
export interface NavProps extends NavigationMenu.NavigationMenuProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
variant?: NavVariant;
|
|
9
|
+
sx?: ThemeUIStyleObject;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const NavPrimary: React.ForwardRefExoticComponent<NavProps & React.RefAttributes<HTMLElement>>;
|
|
13
|
+
export declare const NavTab: React.ForwardRefExoticComponent<NavProps & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.NavTab = exports.NavPrimary = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var NavigationMenu = _interopRequireWildcard(require("@radix-ui/react-navigation-menu"));
|
|
7
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
+
var _ = require(".");
|
|
9
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
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 Nav = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
15
|
+
var className = _ref.className,
|
|
16
|
+
children = _ref.children,
|
|
17
|
+
orientation = _ref.orientation,
|
|
18
|
+
_ref$variant = _ref.variant,
|
|
19
|
+
variant = _ref$variant === void 0 ? 'primary' : _ref$variant,
|
|
20
|
+
_ref$sx = _ref.sx,
|
|
21
|
+
sx = _ref$sx === void 0 ? {} : _ref$sx,
|
|
22
|
+
label = _ref.label;
|
|
23
|
+
return (0, _jsxRuntime.jsx)(NavigationMenu.Root, {
|
|
24
|
+
"aria-label": label,
|
|
25
|
+
ref: ref,
|
|
26
|
+
className: (0, _classnames["default"])(_.VIP_NAV, className),
|
|
27
|
+
sx: _extends({
|
|
28
|
+
position: 'relative',
|
|
29
|
+
display: 'flex',
|
|
30
|
+
width: variant === 'tabs' ? '100%' : 'max-content',
|
|
31
|
+
zIndex: 1,
|
|
32
|
+
pb: 0,
|
|
33
|
+
borderBottom: '1px solid',
|
|
34
|
+
borderColor: variant === 'tabs' ? 'borders.2' : 'transparent'
|
|
35
|
+
}, sx),
|
|
36
|
+
orientation: orientation,
|
|
37
|
+
children: (0, _jsxRuntime.jsx)(NavigationMenu.List, {
|
|
38
|
+
className: (0, _classnames["default"])(_.VIP_NAV + "-list"),
|
|
39
|
+
sx: {
|
|
40
|
+
display: 'flex',
|
|
41
|
+
listStyle: 'none',
|
|
42
|
+
justifyContent: 'flex-start',
|
|
43
|
+
m: 0,
|
|
44
|
+
px: 0,
|
|
45
|
+
flexDirection: 'row'
|
|
46
|
+
},
|
|
47
|
+
children: children
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
var NavPrimary = exports.NavPrimary = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
52
|
+
return (0, _jsxRuntime.jsx)(Nav, _extends({}, props, {
|
|
53
|
+
variant: "primary",
|
|
54
|
+
ref: ref
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
57
|
+
var NavTab = exports.NavTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
58
|
+
return (0, _jsxRuntime.jsx)(Nav, _extends({}, props, {
|
|
59
|
+
variant: "tabs",
|
|
60
|
+
ref: ref
|
|
61
|
+
}));
|
|
62
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import type { StoryObj } from '@storybook/react';
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { Nav } from '../../system';
|
|
10
|
+
declare const _default: {
|
|
11
|
+
title: string;
|
|
12
|
+
component: {
|
|
13
|
+
Primary: import("react").ForwardRefExoticComponent<import("./Nav").NavProps & import("react").RefAttributes<HTMLElement>>;
|
|
14
|
+
Tab: import("react").ForwardRefExoticComponent<import("./Nav").NavProps & import("react").RefAttributes<HTMLElement>>;
|
|
15
|
+
};
|
|
16
|
+
parameters: {
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
25
|
+
type Story = StoryObj<typeof Nav>;
|
|
26
|
+
export declare const Default: Story;
|
|
27
|
+
export declare const Tab: Story;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports["default"] = exports.Tab = exports.Default = void 0;
|
|
5
|
+
var _system = require("../../system");
|
|
6
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
7
|
+
/**
|
|
8
|
+
* External dependencies
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
var _default = exports["default"] = {
|
|
14
|
+
title: 'Navigation/Nav',
|
|
15
|
+
component: _system.Nav,
|
|
16
|
+
parameters: {
|
|
17
|
+
docs: {
|
|
18
|
+
description: {
|
|
19
|
+
component: "\nA navigation menu is a list of links used to navigate a website. It is usually placed in a prominent position at the top of a site, or anywhere that needs a linked-navigation.\n\n## Guidance\n\n### When to use the Nav component\n\n- To link internal or external links in a menu format.\n- To link to pages that are not part of the main navigation.\n\n### When to consider something else\n\n- If you have content inside the same page that will not affect the page Route/URL, use [Tabs](/docs/tabs--docs) component instead.\n- If you are planning to have buttons in your navigation, use another navigation solution, for example: [Dropdown](/docs/dropdown--docs) component instead.\n\n## Accessibility Considerations guidance\n\nThis component is based on the Radix Navigation Menu primitive, so it contains all the accessibility features from the primitive.\n\n- Adheres to the [navigation role requirements.](https://www.w3.org/TR/wai-aria-1.2/#navigation)\n- Keyboard Interactions: https://www.radix-ui.com/primitives/docs/components/navigation-menu#keyboard-interactions\n\n### Usability guidance\n\nPick one of the available variants: Primary or Tabs. You can use the components directly from the `Nav` component:\n\n~~~jsx filename=\"index.jsx\"\nimport { Nav, NavItem } from '@automattic/components';\n\n<Nav.Primary> or <Nav.Tab>\n<NavItem.Primary> or <NavItem.Tab>\n~~~\n\n### Usage with Next.js framwork\n\n~~~jsx filename=\"index.jsx\"\nimport Link from 'next/link';\n\n<Nav.Primary label=\"Etc\">\n\t<NavItem.Primary\n\t\tactive\n\t\thref=\"https://google.com\"\n\t\tasChild // This is important to pass the link styles to the child\n\t>\n\t\t<Link href={ `/orgs/${ id }/sso/configurations/${ idP }/edit/${ tab.path }` }>\n\t\t\tYour page name\n\t\t</Link>\n\t</NavItem.Primary>\n</Nav.Primary>\n~~~\n\n-------\n\n## Component Properties\n"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var Default = exports.Default = {
|
|
25
|
+
render: function render() {
|
|
26
|
+
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
27
|
+
children: [(0, _jsxRuntime.jsx)("p", {
|
|
28
|
+
children: (0, _jsxRuntime.jsx)("strong", {
|
|
29
|
+
children: "Variant: Primary"
|
|
30
|
+
})
|
|
31
|
+
}), (0, _jsxRuntime.jsxs)(_system.Nav.Primary, {
|
|
32
|
+
sx: {
|
|
33
|
+
mb: 4
|
|
34
|
+
},
|
|
35
|
+
label: "Nav Primary",
|
|
36
|
+
children: [(0, _jsxRuntime.jsx)(_system.NavItem.Primary, {
|
|
37
|
+
active: true,
|
|
38
|
+
href: "#",
|
|
39
|
+
children: "PHP"
|
|
40
|
+
}), (0, _jsxRuntime.jsx)(_system.NavItem.Primary, {
|
|
41
|
+
href: "https://wordpress.com",
|
|
42
|
+
children: "WordPress"
|
|
43
|
+
}), (0, _jsxRuntime.jsx)(_system.NavItem.Primary, {
|
|
44
|
+
href: "htpps://newrelic.com/",
|
|
45
|
+
children: "New Relic"
|
|
46
|
+
}), (0, _jsxRuntime.jsx)(_system.NavItem.Primary, {
|
|
47
|
+
disabled: true,
|
|
48
|
+
href: "https://google.com/",
|
|
49
|
+
children: "Not accessible"
|
|
50
|
+
})]
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
var Tab = exports.Tab = {
|
|
56
|
+
render: function render() {
|
|
57
|
+
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
58
|
+
children: [(0, _jsxRuntime.jsx)("p", {
|
|
59
|
+
children: (0, _jsxRuntime.jsx)("strong", {
|
|
60
|
+
children: "Variant: Tab"
|
|
61
|
+
})
|
|
62
|
+
}), (0, _jsxRuntime.jsxs)(_system.Nav.Tab, {
|
|
63
|
+
sx: {
|
|
64
|
+
mb: 4
|
|
65
|
+
},
|
|
66
|
+
label: "Nav Tab",
|
|
67
|
+
children: [(0, _jsxRuntime.jsx)(_system.NavItem.Tab, {
|
|
68
|
+
active: true,
|
|
69
|
+
href: "#",
|
|
70
|
+
children: "PHP"
|
|
71
|
+
}), (0, _jsxRuntime.jsx)(_system.NavItem.Tab, {
|
|
72
|
+
href: "https://wordpress.com",
|
|
73
|
+
children: "WordPress"
|
|
74
|
+
}), (0, _jsxRuntime.jsx)(_system.NavItem.Tab, {
|
|
75
|
+
href: "htpps://newrelic.com/",
|
|
76
|
+
children: "New Relic"
|
|
77
|
+
}), (0, _jsxRuntime.jsx)(_system.NavItem.Tab, {
|
|
78
|
+
disabled: true,
|
|
79
|
+
href: "https://google.com/",
|
|
80
|
+
children: "Not accessible"
|
|
81
|
+
})]
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _react = require("@testing-library/react");
|
|
4
|
+
var _jestAxe = require("jest-axe");
|
|
5
|
+
var _themeUi = require("theme-ui");
|
|
6
|
+
var _ = require("./");
|
|
7
|
+
var _2 = require("../");
|
|
8
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
9
|
+
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; }
|
|
10
|
+
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); } }
|
|
11
|
+
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); }); }; } /** @jsxImportSource theme-ui */ /* eslint-disable @typescript-eslint/ban-ts-comment */ // @ts-nocheck
|
|
12
|
+
/**
|
|
13
|
+
* External dependencies
|
|
14
|
+
*/ /**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
var renderWithTheme = function renderWithTheme(children) {
|
|
18
|
+
return (0, _react.render)((0, _jsxRuntime.jsx)(_themeUi.ThemeUIProvider, {
|
|
19
|
+
theme: _2.theme,
|
|
20
|
+
children: children
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
var renderComponent = function renderComponent() {
|
|
24
|
+
return renderWithTheme((0, _jsxRuntime.jsxs)(_.Nav.Primary, {
|
|
25
|
+
variant: "primary",
|
|
26
|
+
label: "Main",
|
|
27
|
+
children: [(0, _jsxRuntime.jsx)(_.NavItem.Primary, {
|
|
28
|
+
href: "#",
|
|
29
|
+
children: "PHP"
|
|
30
|
+
}), (0, _jsxRuntime.jsx)(_.NavItem.Primary, {
|
|
31
|
+
href: "https://wordpress.com",
|
|
32
|
+
children: "WordPress"
|
|
33
|
+
}), (0, _jsxRuntime.jsx)(_.NavItem.Primary, {
|
|
34
|
+
active: true,
|
|
35
|
+
href: "htpps://newrelic.com/",
|
|
36
|
+
children: "New Relic"
|
|
37
|
+
}), (0, _jsxRuntime.jsx)(_.NavItem.Primary, {
|
|
38
|
+
disabled: true,
|
|
39
|
+
href: "https://google.com/",
|
|
40
|
+
children: "Not accessible"
|
|
41
|
+
})]
|
|
42
|
+
}));
|
|
43
|
+
};
|
|
44
|
+
describe('<Nav />', function () {
|
|
45
|
+
it('renders the Nav component with default value visible', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
46
|
+
var _renderComponent, container;
|
|
47
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
48
|
+
while (1) switch (_context.prev = _context.next) {
|
|
49
|
+
case 0:
|
|
50
|
+
_renderComponent = renderComponent(), container = _renderComponent.container; // Should find the nav label
|
|
51
|
+
expect(_react.screen.getByLabelText('Main')).toBeInTheDocument();
|
|
52
|
+
|
|
53
|
+
// Should find all links
|
|
54
|
+
expect(_react.screen.queryByText('PHP')).toBeInTheDocument();
|
|
55
|
+
expect(_react.screen.queryByText('WordPress')).toBeInTheDocument();
|
|
56
|
+
expect(_react.screen.queryByText('New Relic')).toBeInTheDocument();
|
|
57
|
+
expect(_react.screen.queryByText('Not accessible')).toHaveAttribute('aria-disabled', 'true');
|
|
58
|
+
|
|
59
|
+
// Check for accessibility issues
|
|
60
|
+
_context.t0 = expect;
|
|
61
|
+
_context.next = 9;
|
|
62
|
+
return (0, _jestAxe.axe)(container);
|
|
63
|
+
case 9:
|
|
64
|
+
_context.t1 = _context.sent;
|
|
65
|
+
(0, _context.t0)(_context.t1).toHaveNoViolations();
|
|
66
|
+
case 11:
|
|
67
|
+
case "end":
|
|
68
|
+
return _context.stop();
|
|
69
|
+
}
|
|
70
|
+
}, _callee);
|
|
71
|
+
})));
|
|
72
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @jsxImportSource theme-ui */
|
|
2
|
+
/**
|
|
3
|
+
* External dependencies
|
|
4
|
+
*/
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import * as NavigationMenu from '@radix-ui/react-navigation-menu';
|
|
7
|
+
import { ThemeUIStyleObject } from 'theme-ui';
|
|
8
|
+
import { NavVariant } from './Nav';
|
|
9
|
+
export interface NavItemBaseProps extends NavigationMenu.NavigationMenuItemProps {
|
|
10
|
+
className?: string;
|
|
11
|
+
sx?: ThemeUIStyleObject;
|
|
12
|
+
}
|
|
13
|
+
export interface NavItemProps extends NavigationMenu.NavigationMenuLinkProps {
|
|
14
|
+
className?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
variant?: NavVariant;
|
|
17
|
+
}
|
|
18
|
+
export declare const ItemPrimary: React.ForwardRefExoticComponent<NavItemProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
19
|
+
export declare const ItemTab: React.ForwardRefExoticComponent<NavItemProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.ItemTab = exports.ItemPrimary = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var NavigationMenu = _interopRequireWildcard(require("@radix-ui/react-navigation-menu"));
|
|
7
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
+
var _ = require(".");
|
|
9
|
+
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
10
|
+
var _excluded = ["children", "sx", "className"],
|
|
11
|
+
_excluded2 = ["children", "href", "active", "disabled", "variant"],
|
|
12
|
+
_excluded3 = ["className", "children", "href", "active", "disabled", "variant"];
|
|
13
|
+
/** @jsxImportSource theme-ui */
|
|
14
|
+
/**
|
|
15
|
+
* External dependencies
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
21
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
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); }
|
|
24
|
+
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; }
|
|
25
|
+
var NavItemBase = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
26
|
+
var children = _ref.children,
|
|
27
|
+
_ref$sx = _ref.sx,
|
|
28
|
+
sx = _ref$sx === void 0 ? {} : _ref$sx,
|
|
29
|
+
className = _ref.className,
|
|
30
|
+
rest = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
31
|
+
return (0, _jsxRuntime.jsx)(NavigationMenu.Item, _extends({
|
|
32
|
+
className: (0, _classnames["default"])(_.VIP_NAV + "-item", className)
|
|
33
|
+
}, rest, {
|
|
34
|
+
sx: _extends({
|
|
35
|
+
mr: 2,
|
|
36
|
+
'&:last-of-type': {
|
|
37
|
+
mr: 0
|
|
38
|
+
}
|
|
39
|
+
}, sx),
|
|
40
|
+
ref: ref,
|
|
41
|
+
children: children
|
|
42
|
+
}));
|
|
43
|
+
});
|
|
44
|
+
var NavLink = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
45
|
+
var children = _ref2.children,
|
|
46
|
+
href = _ref2.href,
|
|
47
|
+
active = _ref2.active,
|
|
48
|
+
disabled = _ref2.disabled,
|
|
49
|
+
variant = _ref2.variant,
|
|
50
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
51
|
+
return (0, _jsxRuntime.jsx)(NavigationMenu.Link, _extends({
|
|
52
|
+
className: (0, _classnames["default"])(_.VIP_NAV + "-item-link"),
|
|
53
|
+
href: href,
|
|
54
|
+
ref: ref,
|
|
55
|
+
sx: styles(variant),
|
|
56
|
+
active: active,
|
|
57
|
+
"aria-disabled": disabled
|
|
58
|
+
}, props, {
|
|
59
|
+
children: children
|
|
60
|
+
}));
|
|
61
|
+
});
|
|
62
|
+
var styles = function styles(variant) {
|
|
63
|
+
var defaultVariantStyles = variant === 'tabs' ? {
|
|
64
|
+
px: 0,
|
|
65
|
+
mr: 2,
|
|
66
|
+
color: 'heading',
|
|
67
|
+
'&[data-active]': {
|
|
68
|
+
color: 'link',
|
|
69
|
+
fontWeight: 'normal',
|
|
70
|
+
boxShadow: 'inset 0 -1px 0 0, 0 1px 0 0'
|
|
71
|
+
},
|
|
72
|
+
'&[aria-disabled="true"]': {
|
|
73
|
+
color: 'muted'
|
|
74
|
+
},
|
|
75
|
+
':hover': {
|
|
76
|
+
fontWeight: 'regular',
|
|
77
|
+
color: 'heading'
|
|
78
|
+
}
|
|
79
|
+
} : {
|
|
80
|
+
variant: "buttons." + (variant === 'link' ? 'text' : 'tertiary'),
|
|
81
|
+
borderRadius: 1,
|
|
82
|
+
'&[data-active]': {
|
|
83
|
+
variant: "buttons." + (variant === 'link' ? 'display' : variant)
|
|
84
|
+
},
|
|
85
|
+
'&[aria-disabled="true"]': {
|
|
86
|
+
opacity: 0.7,
|
|
87
|
+
color: 'texts.secondary',
|
|
88
|
+
cursor: 'not-allowed'
|
|
89
|
+
},
|
|
90
|
+
':hover': {
|
|
91
|
+
backgroundColor: "button." + variant + ".background.hover",
|
|
92
|
+
textDecoration: 'none'
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return _extends({
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
display: 'inline-flex',
|
|
98
|
+
fontSize: 2,
|
|
99
|
+
justifyContent: 'center',
|
|
100
|
+
lineHeight: 'inherit',
|
|
101
|
+
minHeight: '36px',
|
|
102
|
+
px: 3,
|
|
103
|
+
py: 0,
|
|
104
|
+
textDecoration: 'none',
|
|
105
|
+
verticalAlign: 'middle'
|
|
106
|
+
}, defaultVariantStyles, {
|
|
107
|
+
'&:focus': function focus(theme) {
|
|
108
|
+
return theme.outline;
|
|
109
|
+
},
|
|
110
|
+
'&:focus-visible': function focusVisible(theme) {
|
|
111
|
+
return theme.outline;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
var NavItem = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
116
|
+
var className = _ref3.className,
|
|
117
|
+
children = _ref3.children,
|
|
118
|
+
href = _ref3.href,
|
|
119
|
+
active = _ref3.active,
|
|
120
|
+
disabled = _ref3.disabled,
|
|
121
|
+
_ref3$variant = _ref3.variant,
|
|
122
|
+
variant = _ref3$variant === void 0 ? 'primary' : _ref3$variant,
|
|
123
|
+
props = _objectWithoutPropertiesLoose(_ref3, _excluded3);
|
|
124
|
+
return (0, _jsxRuntime.jsx)(NavItemBase, {
|
|
125
|
+
className: className,
|
|
126
|
+
children: (0, _jsxRuntime.jsx)(NavLink, _extends({
|
|
127
|
+
variant: variant,
|
|
128
|
+
href: href,
|
|
129
|
+
ref: ref,
|
|
130
|
+
active: active,
|
|
131
|
+
disabled: disabled
|
|
132
|
+
}, props, {
|
|
133
|
+
children: children
|
|
134
|
+
}))
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
var ItemPrimary = exports.ItemPrimary = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
138
|
+
return (0, _jsxRuntime.jsx)(NavItem, _extends({
|
|
139
|
+
variant: "primary",
|
|
140
|
+
ref: ref
|
|
141
|
+
}, props));
|
|
142
|
+
});
|
|
143
|
+
var ItemTab = exports.ItemTab = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
144
|
+
return (0, _jsxRuntime.jsx)(NavItem, _extends({
|
|
145
|
+
variant: "tabs",
|
|
146
|
+
ref: ref
|
|
147
|
+
}, props));
|
|
148
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const VIP_NAV = "vip-nav-component";
|
|
3
|
+
export declare const Nav: {
|
|
4
|
+
Primary: import("react").ForwardRefExoticComponent<import("./Nav").NavProps & import("react").RefAttributes<HTMLElement>>;
|
|
5
|
+
Tab: import("react").ForwardRefExoticComponent<import("./Nav").NavProps & import("react").RefAttributes<HTMLElement>>;
|
|
6
|
+
};
|
|
7
|
+
export declare const NavItem: {
|
|
8
|
+
Primary: import("react").ForwardRefExoticComponent<import("./NavItem").NavItemProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
9
|
+
Tab: import("react").ForwardRefExoticComponent<import("./NavItem").NavItemProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.VIP_NAV = exports.NavItem = exports.Nav = void 0;
|
|
5
|
+
var _Nav = require("./Nav");
|
|
6
|
+
var _NavItem = require("./NavItem");
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var VIP_NAV = exports.VIP_NAV = 'vip-nav-component';
|
|
12
|
+
var Nav = exports.Nav = {
|
|
13
|
+
Primary: _Nav.NavPrimary,
|
|
14
|
+
Tab: _Nav.NavTab
|
|
15
|
+
};
|
|
16
|
+
var NavItem = exports.NavItem = {
|
|
17
|
+
Primary: _NavItem.ItemPrimary,
|
|
18
|
+
Tab: _NavItem.ItemTab
|
|
19
|
+
};
|
|
@@ -23,8 +23,7 @@ var NoticeIcon = function NoticeIcon(_ref) {
|
|
|
23
23
|
variant = _ref.variant;
|
|
24
24
|
var sx = {
|
|
25
25
|
color: color,
|
|
26
|
-
flex: '0 0 auto'
|
|
27
|
-
mt: 0
|
|
26
|
+
flex: '0 0 auto'
|
|
28
27
|
};
|
|
29
28
|
var size = 20;
|
|
30
29
|
switch (variant) {
|
|
@@ -97,18 +96,33 @@ var Notice = exports.Notice = /*#__PURE__*/_react["default"].forwardRef(function
|
|
|
97
96
|
}, props, {
|
|
98
97
|
children: (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
99
98
|
sx: {
|
|
100
|
-
|
|
99
|
+
height: '100%' // required for the dynamic height of the icon box to work
|
|
101
100
|
},
|
|
102
|
-
children: [(0, _jsxRuntime.jsx)(_.
|
|
101
|
+
children: [(0, _jsxRuntime.jsx)(_.Box, {
|
|
103
102
|
sx: {
|
|
103
|
+
minWidth: '32px',
|
|
104
104
|
mr: 3,
|
|
105
|
-
mt: 0
|
|
106
|
-
flexShrink: 0,
|
|
107
|
-
alignSelf: 'center'
|
|
105
|
+
mt: 0
|
|
108
106
|
},
|
|
109
|
-
children: (0, _jsxRuntime.
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
children: (0, _jsxRuntime.jsxs)(_.Flex, {
|
|
108
|
+
sx: {
|
|
109
|
+
flexDirection: 'column',
|
|
110
|
+
// the trick here is to have a flex column with the icon at the bottom and an empty div that fills the space
|
|
111
|
+
minHeight: '20px',
|
|
112
|
+
maxHeight: '32px',
|
|
113
|
+
// we're forcing the max height so that the icon is, at max, aligned between the first and the second line of text
|
|
114
|
+
alignItems: 'flex-end',
|
|
115
|
+
// we want the icon to be aligned to the bottom
|
|
116
|
+
height: '100%' // specifying the height will allow the box to match the height of the content.
|
|
117
|
+
},
|
|
118
|
+
children: [(0, _jsxRuntime.jsx)(_.Box, {
|
|
119
|
+
sx: {
|
|
120
|
+
flex: '1 100%' // we need this empty div to make the icon align to the bottom
|
|
121
|
+
}
|
|
122
|
+
}), (0, _jsxRuntime.jsx)(NoticeIcon, {
|
|
123
|
+
color: "notice.icon." + variant,
|
|
124
|
+
variant: variant
|
|
125
|
+
})]
|
|
112
126
|
})
|
|
113
127
|
}), (0, _jsxRuntime.jsxs)(_.Box, {
|
|
114
128
|
children: [title && (0, _jsxRuntime.jsx)(_.Heading, {
|