@ndlib/component-library 1.0.41 → 1.0.43
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/dist/components/composites/NavMenu2/NavMenuV2.stories.d.ts +6 -0
- package/dist/components/composites/NavMenu2/NavMenuV2.stories.js +14 -0
- package/dist/components/composites/NavMenu2/demoV2.d.ts +1 -0
- package/dist/components/composites/NavMenu2/demoV2.js +189 -0
- package/dist/components/composites/NavMenu2/index.d.ts +5 -0
- package/dist/components/composites/NavMenu2/index.js +56 -0
- package/dist/components/composites/NavMenuV2/NavMenuV2.module.css +24 -0
- package/dist/components/elements/AlertsV2/AlertV2.stories.d.ts +10 -0
- package/dist/components/elements/AlertsV2/AlertV2.stories.js +51 -0
- package/dist/components/elements/AlertsV2/AlertsV2.module.css +49 -0
- package/dist/components/elements/AlertsV2/AlertsV2.stories.d.ts +7 -0
- package/dist/components/elements/AlertsV2/AlertsV2.stories.js +17 -0
- package/dist/components/elements/AlertsV2/index.d.ts +15 -0
- package/dist/components/elements/AlertsV2/index.js +50 -0
- package/dist/components/elements/ArrowLinkV2/ArrowLinkV2.module.css +47 -0
- package/dist/components/elements/ArrowLinkV2/ArrowLinkV2.stories.d.ts +6 -0
- package/dist/components/elements/ArrowLinkV2/ArrowLinkV2.stories.js +14 -0
- package/dist/components/elements/ArrowLinkV2/index.d.ts +7 -0
- package/dist/components/elements/ArrowLinkV2/index.js +21 -0
- package/dist/components/elements/BlockQuoteV2/BlockQuoteV2.module.css +6 -0
- package/dist/components/elements/BlockQuoteV2/index.d.ts +4 -0
- package/dist/components/elements/BlockQuoteV2/index.js +21 -0
- package/dist/components/elements/BrandingBarV2/BrandingBarV2.module.css +68 -0
- package/dist/components/elements/BrandingBarV2/BrandingBarV2.stories.d.ts +6 -0
- package/dist/components/elements/BrandingBarV2/BrandingBarV2.stories.js +13 -0
- package/dist/components/elements/BrandingBarV2/index.d.ts +2 -0
- package/dist/components/elements/BrandingBarV2/index.js +10 -0
- package/dist/components/elements/CaptionV2/index.d.ts +2 -0
- package/dist/components/elements/CaptionV2/index.js +22 -0
- package/dist/components/elements/DatePickerV2/DatePickerV2.stories.d.ts +8 -0
- package/dist/components/elements/DatePickerV2/DatePickerV2.stories.js +53 -0
- package/dist/components/elements/DatePickerV2/index.d.ts +23 -0
- package/dist/components/elements/DatePickerV2/index.js +57 -0
- package/dist/components/elements/DropdownV2/DropdownV2.stories.d.ts +8 -0
- package/dist/components/elements/DropdownV2/DropdownV2.stories.js +26 -0
- package/dist/components/elements/DropdownV2/index.d.ts +26 -0
- package/dist/components/elements/DropdownV2/index.js +81 -0
- package/dist/components/elements/InlineV2/InlineV2.stories.d.ts +6 -0
- package/dist/components/elements/InlineV2/InlineV2.stories.js +14 -0
- package/dist/components/elements/InlineV2/index.d.ts +6 -0
- package/dist/components/elements/InlineV2/index.js +23 -0
- package/dist/components/elements/ListV2/ListV2.stories.d.ts +10 -0
- package/dist/components/elements/ListV2/ListV2.stories.js +39 -0
- package/dist/components/elements/ListV2/index.d.ts +27 -0
- package/dist/components/elements/ListV2/index.js +102 -0
- package/dist/components/elements/MarkdownV2/MarkdownV2.module.css +39 -0
- package/dist/components/elements/MarkdownV2/MarkdownV2.stories.d.ts +10 -0
- package/dist/components/elements/MarkdownV2/MarkdownV2.stories.js +130 -0
- package/dist/components/elements/MarkdownV2/index.d.ts +11 -0
- package/dist/components/elements/MarkdownV2/index.js +123 -0
- package/dist/components/elements/MonthPickerV2/MonthPickerV2.stories.d.ts +7 -0
- package/dist/components/elements/MonthPickerV2/MonthPickerV2.stories.js +33 -0
- package/dist/components/elements/MonthPickerV2/index.d.ts +14 -0
- package/dist/components/elements/MonthPickerV2/index.js +26 -0
- package/dist/components/elements/PillV2/PillV2.module.css +29 -0
- package/dist/components/elements/PillV2/PillV2.stories.d.ts +8 -0
- package/dist/components/elements/PillV2/PillV2.stories.js +42 -0
- package/dist/components/elements/PillV2/index.d.ts +21 -0
- package/dist/components/elements/PillV2/index.js +79 -0
- package/dist/components/elements/RadioGroupV2/RadioGroupV2.stories.d.ts +7 -0
- package/dist/components/elements/RadioGroupV2/RadioGroupV2.stories.js +28 -0
- package/dist/components/elements/RadioGroupV2/index.d.ts +16 -0
- package/dist/components/elements/RadioGroupV2/index.js +27 -0
- package/dist/components/elements/RadioV2/RadioV2.module.css +17 -0
- package/dist/components/elements/RadioV2/RadioV2.stories.d.ts +6 -0
- package/dist/components/elements/RadioV2/RadioV2.stories.js +19 -0
- package/dist/components/elements/RadioV2/index.d.ts +8 -0
- package/dist/components/elements/RadioV2/index.js +23 -0
- package/dist/components/elements/TabListV2/TabListV2.module.css +21 -0
- package/dist/components/elements/TabListV2/TabListV2.stories.d.ts +6 -0
- package/dist/components/elements/TabListV2/TabListV2.stories.js +14 -0
- package/dist/components/elements/TabListV2/example.d.ts +7 -0
- package/dist/components/elements/TabListV2/example.js +36 -0
- package/dist/components/elements/TabListV2/index.d.ts +10 -0
- package/dist/components/elements/TabListV2/index.js +31 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
3
|
+
import { NavMenuV2 } from '.';
|
|
4
|
+
import { DemoMenuImplementationV2 } from './demoV2';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Composites/NavMenuV2',
|
|
7
|
+
component: NavMenuV2,
|
|
8
|
+
decorators: [UIVersion2],
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Default = {
|
|
12
|
+
render: () => _jsx(DemoMenuImplementationV2, {}),
|
|
13
|
+
args: {},
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DemoMenuImplementationV2: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { createElement as _createElement } from "react";
|
|
14
|
+
import { NavMenuV2 } from '.';
|
|
15
|
+
import { ButtonV2 } from '../../elements/ButtonV2';
|
|
16
|
+
import { RowV2 } from '../../elements/RowV2';
|
|
17
|
+
import { MENU_ACTION_TYPE, MENU_ORIENTATION, MenuProvider, } from '../../providers/menu';
|
|
18
|
+
const demoMenuV2 = {
|
|
19
|
+
orientation: MENU_ORIENTATION.HORIZONTAL,
|
|
20
|
+
items: [
|
|
21
|
+
{
|
|
22
|
+
id: 'home',
|
|
23
|
+
label: 'home',
|
|
24
|
+
action: {
|
|
25
|
+
type: MENU_ACTION_TYPE.LINK,
|
|
26
|
+
to: '/',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'research',
|
|
31
|
+
label: 'research',
|
|
32
|
+
action: {
|
|
33
|
+
type: MENU_ACTION_TYPE.SUBMENU,
|
|
34
|
+
submenu: {
|
|
35
|
+
orientation: MENU_ORIENTATION.HORIZONTAL,
|
|
36
|
+
items: [
|
|
37
|
+
{
|
|
38
|
+
label: 'test submenu 1',
|
|
39
|
+
id: 'test-submenu-1',
|
|
40
|
+
action: {
|
|
41
|
+
type: MENU_ACTION_TYPE.SUBMENU,
|
|
42
|
+
submenu: {
|
|
43
|
+
orientation: MENU_ORIENTATION.VERTICAL,
|
|
44
|
+
items: [
|
|
45
|
+
{
|
|
46
|
+
label: 'test leaf 1',
|
|
47
|
+
id: 'test-leaf-1',
|
|
48
|
+
action: {
|
|
49
|
+
type: MENU_ACTION_TYPE.LINK,
|
|
50
|
+
to: '/',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: 'test leaf 2',
|
|
55
|
+
id: 'test-leaf-2',
|
|
56
|
+
action: {
|
|
57
|
+
type: MENU_ACTION_TYPE.LINK,
|
|
58
|
+
to: '/',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
action: {
|
|
67
|
+
type: MENU_ACTION_TYPE.SUBMENU,
|
|
68
|
+
submenu: {
|
|
69
|
+
orientation: MENU_ORIENTATION.VERTICAL,
|
|
70
|
+
items: [
|
|
71
|
+
{
|
|
72
|
+
label: 'test leaf 3',
|
|
73
|
+
id: 'test-leaf-3',
|
|
74
|
+
action: {
|
|
75
|
+
type: MENU_ACTION_TYPE.LINK,
|
|
76
|
+
to: '/',
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: 'test leaf 4',
|
|
81
|
+
id: 'test-leaf-4',
|
|
82
|
+
action: {
|
|
83
|
+
type: MENU_ACTION_TYPE.LINK,
|
|
84
|
+
to: '/',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
label: 'test submenu 2',
|
|
91
|
+
id: 'test-submenu-2',
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 'services',
|
|
99
|
+
label: 'services',
|
|
100
|
+
action: {
|
|
101
|
+
type: MENU_ACTION_TYPE.SUBMENU,
|
|
102
|
+
submenu: {
|
|
103
|
+
orientation: MENU_ORIENTATION.HORIZONTAL,
|
|
104
|
+
items: [
|
|
105
|
+
{
|
|
106
|
+
label: 'test submenu 5',
|
|
107
|
+
id: 'test-submenu-5',
|
|
108
|
+
action: {
|
|
109
|
+
type: MENU_ACTION_TYPE.SUBMENU,
|
|
110
|
+
submenu: {
|
|
111
|
+
orientation: MENU_ORIENTATION.VERTICAL,
|
|
112
|
+
items: [
|
|
113
|
+
{
|
|
114
|
+
label: 'test leaf 1',
|
|
115
|
+
id: 'test-leaf-1',
|
|
116
|
+
action: {
|
|
117
|
+
type: MENU_ACTION_TYPE.LINK,
|
|
118
|
+
to: '/',
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
label: 'test leaf 2',
|
|
123
|
+
id: 'test-leaf-2',
|
|
124
|
+
action: {
|
|
125
|
+
type: MENU_ACTION_TYPE.LINK,
|
|
126
|
+
to: '/',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
action: {
|
|
135
|
+
type: MENU_ACTION_TYPE.SUBMENU,
|
|
136
|
+
submenu: {
|
|
137
|
+
orientation: MENU_ORIENTATION.VERTICAL,
|
|
138
|
+
items: [
|
|
139
|
+
{
|
|
140
|
+
label: 'test leaf 3',
|
|
141
|
+
id: 'test-leaf-3',
|
|
142
|
+
action: {
|
|
143
|
+
type: MENU_ACTION_TYPE.LINK,
|
|
144
|
+
to: '/',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
label: 'test leaf 4',
|
|
149
|
+
id: 'test-leaf-4',
|
|
150
|
+
action: {
|
|
151
|
+
type: MENU_ACTION_TYPE.LINK,
|
|
152
|
+
to: '/',
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
label: 'test leaf 5',
|
|
157
|
+
id: 'test-leaf-5',
|
|
158
|
+
action: {
|
|
159
|
+
type: MENU_ACTION_TYPE.LINK,
|
|
160
|
+
to: '/',
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
label: 'test leaf 6',
|
|
165
|
+
id: 'test-leaf-6',
|
|
166
|
+
action: {
|
|
167
|
+
type: MENU_ACTION_TYPE.LINK,
|
|
168
|
+
to: '/',
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
label: 'test submenu 6',
|
|
175
|
+
id: 'test-submenu-6',
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
};
|
|
183
|
+
export const DemoMenuImplementationV2 = () => (_jsx(MenuProvider, Object.assign({ menu: demoMenuV2 }, { children: ({ menu, getMenuProps, getMenuItemProps }) => {
|
|
184
|
+
const getPropsWithoutStyle = (props) => {
|
|
185
|
+
const { style: _style } = props, propsWithoutStyle = __rest(props, ["style"]);
|
|
186
|
+
return propsWithoutStyle;
|
|
187
|
+
};
|
|
188
|
+
return (_jsxs(_Fragment, { children: [_jsx(RowV2, Object.assign({}, getMenuProps(), { children: menu.items.map((menuItem) => (_createElement(ButtonV2, Object.assign({}, getPropsWithoutStyle(getMenuItemProps([menuItem.id])), { sx: { margin: '4px' }, key: menuItem.id }), menuItem.label))) })), _jsx(NavMenuV2, {})] }));
|
|
189
|
+
} })));
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import _ChevronRightIcon from '@mui/icons-material/ChevronRight';
|
|
14
|
+
import { ArrowLinkV2 } from '../../elements/ArrowLinkV2';
|
|
15
|
+
import { ListV2, ListItemV2 } from '../../elements/ListV2';
|
|
16
|
+
import { MENU_ACTION_TYPE, useMenu } from '../../providers/menu';
|
|
17
|
+
import { RowV2 } from '../../elements/RowV2';
|
|
18
|
+
import { ColumnV2 } from '../../elements/ColumnV2';
|
|
19
|
+
import { HEADINGV2_SIZE, HeadingV2 } from '../../elements/HeadingV2';
|
|
20
|
+
import { FONT_SIZE } from '../../../theme/typography';
|
|
21
|
+
import { importedDefaultComponentShim } from '../../../utils/misc';
|
|
22
|
+
import * as styles from './NavMenuV2.module.css';
|
|
23
|
+
const typeSafeStyles = styles;
|
|
24
|
+
const ChevronRightIcon = importedDefaultComponentShim(_ChevronRightIcon);
|
|
25
|
+
export const NavMenuV2 = (props) => {
|
|
26
|
+
const { sx } = props, rest = __rest(props, ["sx"]);
|
|
27
|
+
const { isOpen, activePath, getMenuItem, getMenuItemProps, getMenuProps } = useMenu();
|
|
28
|
+
if (!isOpen) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const topLevelMenuId = activePath[0];
|
|
32
|
+
const activeTopLevelMenu = getMenuItem([topLevelMenuId]);
|
|
33
|
+
if (!activeTopLevelMenu ||
|
|
34
|
+
!(activeTopLevelMenu.action.type === MENU_ACTION_TYPE.SUBMENU)) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const submenu = activeTopLevelMenu.action.submenu;
|
|
38
|
+
const getPropsWithoutStyle = (propsFn) => {
|
|
39
|
+
const _a = propsFn(), { style: _style } = _a, propsWithoutStyle = __rest(_a, ["style"]);
|
|
40
|
+
return propsWithoutStyle;
|
|
41
|
+
};
|
|
42
|
+
return (_jsxs(RowV2, Object.assign({ className: typeSafeStyles.navWrapper, sx: sx }, rest, { children: [_jsx(ColumnV2, { sx: { flexGrow: 1 } }), submenu.items.map((submenuItem, i) => {
|
|
43
|
+
if (!(submenuItem.action.type === MENU_ACTION_TYPE.SUBMENU)) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
const leafMenuItems = submenuItem.action.submenu.items;
|
|
47
|
+
const submenuPath = [topLevelMenuId, submenuItem.id];
|
|
48
|
+
const link = '//' + document.location.host + topLevelMenuId;
|
|
49
|
+
const category = topLevelMenuId.charAt(1).toUpperCase() + topLevelMenuId.slice(2);
|
|
50
|
+
return (_jsxs(ColumnV2, Object.assign({ className: typeSafeStyles.submenuCol }, { children: [_jsx("div", Object.assign({}, getPropsWithoutStyle(() => getMenuItemProps(submenuPath)), { children: _jsx(HeadingV2, Object.assign({ standalone: true, size: HEADINGV2_SIZE.SM, underline: true }, { children: submenuItem.label })) })), _jsx(ListV2, Object.assign({}, getPropsWithoutStyle(() => getMenuProps(submenuPath)), { icon: ChevronRightIcon, iconSize: FONT_SIZE.MS }, { children: leafMenuItems.map((leafMenuItem, i) => {
|
|
51
|
+
var _a;
|
|
52
|
+
const leafMenuPath = submenuPath.concat(leafMenuItem.id);
|
|
53
|
+
return (_jsx(ListItemV2, Object.assign({ index: i, sx: { mt: 2 } }, getPropsWithoutStyle(() => getMenuItemProps(leafMenuPath)), { children: _jsx("a", Object.assign({ href: (_a = leafMenuItem === null || leafMenuItem === void 0 ? void 0 : leafMenuItem.action) === null || _a === void 0 ? void 0 : _a.to, className: typeSafeStyles.leafMenuLink, tabIndex: -1 }, { children: leafMenuItem.label })) }), leafMenuItem.id));
|
|
54
|
+
}) })), i < 1 && (link.includes('esearch') || link.includes('ervices')) ? (_jsxs(ArrowLinkV2, Object.assign({ to: link, sx: { m: '20px 10px 10px 10px' } }, { children: ["View More ", category] }))) : null] }), submenuItem.id));
|
|
55
|
+
}), _jsx(ColumnV2, { sx: { flexGrow: 1 } })] })));
|
|
56
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.navWrapper {
|
|
2
|
+
justify-content: center;
|
|
3
|
+
padding: 0.75rem;
|
|
4
|
+
border: 1px solid var(--extraLightGray);
|
|
5
|
+
background: var(--white);
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
margin: 0px 10px 0px 10px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.submenuCol {
|
|
11
|
+
flex-basis: 300px;
|
|
12
|
+
padding: 0.5rem 1rem;
|
|
13
|
+
flex-shrink: 0;
|
|
14
|
+
flex-grow: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.leafMenuLink {
|
|
18
|
+
font-weight: 700;
|
|
19
|
+
font-size: 1rem;
|
|
20
|
+
line-height: 1.4;
|
|
21
|
+
font-family: 'Libre Franklin', 'Helvetica Neue', Helvetica, Arial, Verdana,
|
|
22
|
+
sans-serif;
|
|
23
|
+
text-decoration: none;
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AlertV2 } from '.';
|
|
3
|
+
declare const meta: Meta<typeof AlertV2>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AlertV2>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const InformationalAlert: Story;
|
|
8
|
+
export declare const YellowAlert: Story;
|
|
9
|
+
export declare const WarningAlert: Story;
|
|
10
|
+
export declare const SuccessAlert: Story;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AlertV2 } from '.';
|
|
3
|
+
import { ALERT_TYPE } from '../../providers/alerts';
|
|
4
|
+
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Elements/AlertV2',
|
|
7
|
+
component: AlertV2,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
decorators: [UIVersion2],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
render: (args) => _jsx(AlertV2, Object.assign({}, args)),
|
|
14
|
+
args: {
|
|
15
|
+
title: 'Informational Alert',
|
|
16
|
+
type: ALERT_TYPE.INFORMATIONAL,
|
|
17
|
+
description: 'This is an informational alert',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export const InformationalAlert = {
|
|
21
|
+
render: (args) => _jsx(AlertV2, Object.assign({}, args)),
|
|
22
|
+
args: {
|
|
23
|
+
title: 'Informational Alert',
|
|
24
|
+
type: ALERT_TYPE.INFORMATIONAL,
|
|
25
|
+
description: 'This is an informational alert',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const YellowAlert = {
|
|
29
|
+
render: (args) => _jsx(AlertV2, Object.assign({}, args)),
|
|
30
|
+
args: {
|
|
31
|
+
title: 'Informational - Yellow Alert',
|
|
32
|
+
type: ALERT_TYPE.INFORMATIONAL_YELLOW,
|
|
33
|
+
description: 'This is an informational yellow alert',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export const WarningAlert = {
|
|
37
|
+
render: (args) => _jsx(AlertV2, Object.assign({}, args)),
|
|
38
|
+
args: {
|
|
39
|
+
title: 'Warning Alert',
|
|
40
|
+
type: ALERT_TYPE.WARNING,
|
|
41
|
+
description: 'This is a warning alert',
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
export const SuccessAlert = {
|
|
45
|
+
render: (args) => _jsx(AlertV2, Object.assign({}, args)),
|
|
46
|
+
args: {
|
|
47
|
+
title: 'Success Alert',
|
|
48
|
+
type: ALERT_TYPE.SUCCESS,
|
|
49
|
+
description: 'This is a success alert',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
.alertWrapper {
|
|
2
|
+
border-width: 2px;
|
|
3
|
+
border-style: solid;
|
|
4
|
+
margin: 0;
|
|
5
|
+
padding: 1rem;
|
|
6
|
+
box-shadow: 0 0 8px #dfdfdf;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.alertWrapper[data-alert-type='Informational'] {
|
|
10
|
+
background-color: var(--alertInformationalBg);
|
|
11
|
+
border-color: var(--alertInformationalBorder);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.alertWrapper[data-alert-type='Informational_Yellow'] {
|
|
15
|
+
background-color: var(--alertInformationalYellowBg);
|
|
16
|
+
border-color: var(--alertInformationalYellowBorder);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.alertWrapper[data-alert-type='Warning'] {
|
|
20
|
+
background-color: var(--alertWarningBg);
|
|
21
|
+
border-color: var(--alertWarningBorder);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.alertWrapper[data-alert-type='Success'] {
|
|
25
|
+
background-color: var(--alertSuccessBg);
|
|
26
|
+
border-color: var(--alertSuccessBorder);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.alertInnerWrapper {
|
|
30
|
+
box-sizing: border-box;
|
|
31
|
+
margin: 0 auto;
|
|
32
|
+
padding-left: 0.5rem;
|
|
33
|
+
padding-right: 0.5rem;
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.icon {
|
|
38
|
+
margin-right: 1rem;
|
|
39
|
+
font-size: 1.75rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.markdownWrapper {
|
|
43
|
+
flex-grow: 1;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.button {
|
|
48
|
+
margin-left: 1rem;
|
|
49
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AlertsV2 } from '.';
|
|
3
|
+
declare const meta: Meta<typeof AlertsV2>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof AlertsV2>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const CustomizeAlertStyles: Story;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AlertsV2 } from '.';
|
|
3
|
+
import { AlertsProvider } from '../../providers/alerts';
|
|
4
|
+
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Elements/AlertsV2',
|
|
7
|
+
component: AlertsV2,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
decorators: [UIVersion2],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
render: () => (_jsx(AlertsProvider, Object.assign({ startTime: new Date('2022-01-01').toISOString(), endTime: new Date('2022-01-01').toISOString(), endpoint: "http://localhost:1337/graphql" }, { children: _jsx(AlertsV2, {}) }))),
|
|
14
|
+
};
|
|
15
|
+
export const CustomizeAlertStyles = {
|
|
16
|
+
render: () => (_jsx(AlertsProvider, Object.assign({ startTime: new Date('2022-01-01').toISOString(), endTime: new Date('2022-01-01').toISOString(), endpoint: "http://localhost:1337/graphql" }, { children: _jsx(AlertsV2, { alertStyles: { borderRadius: '0px' } }) }))),
|
|
17
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ALERT_TYPE } from '../../providers/alerts';
|
|
3
|
+
import { StyledElementPropsV2, StylesPropV2 } from '../../../theme';
|
|
4
|
+
type AlertsV2Props = StyledElementPropsV2<HTMLDivElement, {
|
|
5
|
+
pageAlerts?: string[];
|
|
6
|
+
alertStyles?: StylesPropV2;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const AlertsV2: React.FC<AlertsV2Props>;
|
|
9
|
+
type AlertV2Props = StyledElementPropsV2<HTMLDivElement, {
|
|
10
|
+
type: ALERT_TYPE;
|
|
11
|
+
description: string;
|
|
12
|
+
dismiss: () => void;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const AlertV2: React.FC<AlertV2Props>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import _WarningIcon from '@mui/icons-material/Warning';
|
|
14
|
+
import _InfoIcon from '@mui/icons-material/Info';
|
|
15
|
+
import _SuccessIcon from '@mui/icons-material/CheckCircle';
|
|
16
|
+
import { MarkdownV2 } from '../MarkdownV2';
|
|
17
|
+
import { RowV2 } from '../RowV2';
|
|
18
|
+
import { IconV2 } from '../IconV2';
|
|
19
|
+
import { useAlerts, ALERT_TYPE } from '../../providers/alerts';
|
|
20
|
+
import { BUTTONV2_TYPE, ButtonV2 } from '../ButtonV2';
|
|
21
|
+
import { importedDefaultComponentShim } from '../../../utils/misc';
|
|
22
|
+
import { BoxV2 } from '../BoxV2';
|
|
23
|
+
import { processSx } from '../../../utils/processSx';
|
|
24
|
+
import * as styles from './AlertsV2.module.css';
|
|
25
|
+
import clsx from 'clsx';
|
|
26
|
+
const typeSafeStyles = styles;
|
|
27
|
+
const WarningIcon = importedDefaultComponentShim(_WarningIcon);
|
|
28
|
+
const InfoIcon = importedDefaultComponentShim(_InfoIcon);
|
|
29
|
+
const SuccessIcon = importedDefaultComponentShim(_SuccessIcon);
|
|
30
|
+
export const AlertsV2 = (_a) => {
|
|
31
|
+
var { pageAlerts, alertStyles } = _a, rest = __rest(_a, ["pageAlerts", "alertStyles"]);
|
|
32
|
+
const { alerts, dismiss } = useAlerts(pageAlerts);
|
|
33
|
+
return (_jsx(BoxV2, Object.assign({}, rest, { children: alerts.map((alert, i) => {
|
|
34
|
+
const { type, description } = alert;
|
|
35
|
+
return (_jsx(AlertV2, { type: type, description: description, "data-nosnippet": true, sx: Object.assign({ mt: i ? '4px' : 0 }, alertStyles), dismiss: () => {
|
|
36
|
+
dismiss(alert.id);
|
|
37
|
+
} }, i));
|
|
38
|
+
}) })));
|
|
39
|
+
};
|
|
40
|
+
export const AlertV2 = (_a) => {
|
|
41
|
+
var { type = ALERT_TYPE.INFORMATIONAL, description, dismiss, sx } = _a, rest = __rest(_a, ["type", "description", "dismiss", "sx"]);
|
|
42
|
+
const processedStyles = processSx(sx);
|
|
43
|
+
const icon = {
|
|
44
|
+
[ALERT_TYPE.WARNING]: WarningIcon,
|
|
45
|
+
[ALERT_TYPE.INFORMATIONAL_YELLOW]: InfoIcon,
|
|
46
|
+
[ALERT_TYPE.INFORMATIONAL]: InfoIcon,
|
|
47
|
+
[ALERT_TYPE.SUCCESS]: SuccessIcon,
|
|
48
|
+
}[type];
|
|
49
|
+
return (_jsx(RowV2, Object.assign({ className: clsx(processedStyles, typeSafeStyles.alertWrapper), "data-alert-type": type }, rest, { children: _jsxs(RowV2, Object.assign({ className: typeSafeStyles.alertInnerWrapper }, { children: [icon && _jsx(IconV2, { icon: icon, className: typeSafeStyles.icon }), _jsx(RowV2, Object.assign({ className: typeSafeStyles.markdownWrapper }, { children: _jsx(MarkdownV2, { content: description }) })), _jsx(ButtonV2, Object.assign({ type: BUTTONV2_TYPE.TEXT, onClick: dismiss }, { children: "Dismiss" }))] })) })));
|
|
50
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.arrowLinkWrapper {
|
|
2
|
+
text-decoration: none;
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
white-space: nowrap;
|
|
5
|
+
padding: 0;
|
|
6
|
+
flex-grow: 0;
|
|
7
|
+
position: relative;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
background: var(--white);
|
|
10
|
+
color: var(--primary);
|
|
11
|
+
font-weight: 700;
|
|
12
|
+
font-size: 1rem;
|
|
13
|
+
line-height: 1.4;
|
|
14
|
+
font-family: 'Libre Franklin', 'Helvetica Neue', Helvetica, Arial, Verdana,
|
|
15
|
+
sans-serif;
|
|
16
|
+
|
|
17
|
+
&:hover {
|
|
18
|
+
transform: scale(1.02);
|
|
19
|
+
background: var(--extraExtraLightGray);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&:hover > svg {
|
|
23
|
+
fill: var(--extraExtraLightGray);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
& > svg {
|
|
27
|
+
fill: var(--white);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.arrowLinkInnerWrapper {
|
|
32
|
+
position: relative;
|
|
33
|
+
border: 1px solid #a7a7a7;
|
|
34
|
+
border-width: 1px 0 2px 1px;
|
|
35
|
+
box-sizing: border-box;
|
|
36
|
+
padding: 0.125rem 1.5rem 0.125rem 0.5rem;
|
|
37
|
+
height: 100%;
|
|
38
|
+
flex: 1 1 auto;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.arrow {
|
|
42
|
+
width: 16px;
|
|
43
|
+
right: -16px;
|
|
44
|
+
position: absolute;
|
|
45
|
+
top: 0;
|
|
46
|
+
height: 100%;
|
|
47
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowLinkV2 } from '.';
|
|
3
|
+
import { ColumnV2 } from '../ColumnV2';
|
|
4
|
+
import { BoxV2 } from '../BoxV2';
|
|
5
|
+
import { UIVersion2 } from '../../../utils/decorators/UIVersion2';
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Elements/ArrowLinkV2',
|
|
8
|
+
component: ArrowLinkV2,
|
|
9
|
+
decorators: [UIVersion2],
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
export const Default = {
|
|
13
|
+
render: () => (_jsx(ColumnV2, { children: _jsx(BoxV2, { children: _jsx(ArrowLinkV2, Object.assign({ to: "/" }, { children: "Click Me" })) }) })),
|
|
14
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { processSx } from '../../../utils/processSx';
|
|
14
|
+
import { BoxV2 } from '../BoxV2';
|
|
15
|
+
import * as styles from './ArrowLinkV2.module.css';
|
|
16
|
+
const typeSafeStyles = styles;
|
|
17
|
+
export const ArrowLinkV2 = (_a) => {
|
|
18
|
+
var { to, children, sx } = _a, rest = __rest(_a, ["to", "children", "sx"]);
|
|
19
|
+
const processedSx = processSx(sx);
|
|
20
|
+
return (_jsxs("a", Object.assign({ href: to, className: typeSafeStyles.arrowLinkWrapper, style: processedSx }, rest, { children: [_jsx(BoxV2, Object.assign({ className: typeSafeStyles.arrowLinkInnerWrapper }, { children: children })), _jsxs("svg", Object.assign({ viewBox: "0 0 16 1", preserveAspectRatio: "none", className: typeSafeStyles.arrow }, { children: [_jsx("path", { d: "M0,0 0,0 16,0.5 0,1 0,1z" }), _jsx("line", { x1: "0", x2: "16", y1: "0", y2: "0.5", stroke: "#a7a7a7", strokeWidth: "0.05", strokeLinecap: "butt" }), _jsx("line", { x1: "0", x2: "16", y1: "1", y2: "0.5", stroke: "#a7a7a7", strokeWidth: "0.1", strokeLinecap: "butt" })] }))] })));
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { TYPOGRAPHY_TYPE, getTypographyStyles } from '../../../theme/typography';
|
|
14
|
+
import * as styles from './BlockQuoteV2.module.css';
|
|
15
|
+
import { processSx } from '../../../utils/processSx';
|
|
16
|
+
const typeSafeStyles = styles;
|
|
17
|
+
export const BlockQuoteV2 = (_a) => {
|
|
18
|
+
var { sx } = _a, props = __rest(_a, ["sx"]);
|
|
19
|
+
const processedStyles = processSx(Object.assign(Object.assign({}, sx), getTypographyStyles(TYPOGRAPHY_TYPE.PARAGRAPH_LARGE)));
|
|
20
|
+
return (_jsx("blockquote", Object.assign({}, props, { className: typeSafeStyles.blockQuote, style: Object.assign({}, processedStyles) })));
|
|
21
|
+
};
|