@veritone-ce/design-system 1.12.7 → 1.12.9
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/assets/theme.js +21 -22
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +11 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.js +31 -0
- package/dist/components/Breadcrumbs/__tests__/Breadcrumbs.test.d.ts +1 -0
- package/dist/components/Breadcrumbs/__tests__/Breadcrumbs.test.js +15 -0
- package/dist/components/Breadcrumbs/breadcrumbs.theme.d.ts +11 -0
- package/dist/components/Breadcrumbs/breadcrumbs.theme.js +10 -0
- package/dist/components/Breadcrumbs/index.d.ts +15 -0
- package/dist/components/Breadcrumbs/index.js +34 -0
- package/dist/components/FileUploader/index.d.ts +2 -1
- package/dist/components/FileUploader/index.js +62 -56
- package/dist/components/LinearProgress/LinearProgress.stories.d.ts +14 -0
- package/dist/components/LinearProgress/LinearProgress.stories.js +29 -0
- package/dist/components/LinearProgress/__tests__/LinearProgress.test.d.ts +1 -0
- package/dist/components/LinearProgress/__tests__/LinearProgress.test.js +18 -0
- package/dist/components/LinearProgress/index.d.ts +27 -0
- package/dist/components/LinearProgress/index.js +26 -0
- package/dist/components/LinearProgress/linearProgress.theme.d.ts +14 -0
- package/dist/components/LinearProgress/linearProgress.theme.js +13 -0
- package/dist/components/MenuFlyout/MenuFlyout.stories.d.ts +31 -0
- package/dist/components/MenuFlyout/MenuFlyout.stories.js +38 -0
- package/dist/components/MenuFlyout/__tests__/MenuFlyout.test.d.ts +1 -0
- package/dist/components/MenuFlyout/__tests__/MenuFlyout.test.js +24 -0
- package/dist/components/MenuFlyout/constants.d.ts +3 -0
- package/dist/components/MenuFlyout/constants.js +3 -0
- package/dist/components/MenuFlyout/index.d.ts +15 -0
- package/dist/components/MenuFlyout/index.js +27 -0
- package/dist/components/MenuFlyout/menuFlyout.theme.d.ts +41 -0
- package/dist/components/MenuFlyout/menuFlyout.theme.js +40 -0
- package/dist/components/StatusChip/StatusChip.stories.d.ts +2 -2
- package/dist/components/Stepper/Stepper.stories.d.ts +1 -1
- package/dist/components/Toast/Toast.stories.d.ts +14 -0
- package/dist/components/Toast/Toast.stories.js +42 -0
- package/dist/components/Toast/__tests__/Toast.test.d.ts +1 -0
- package/dist/components/Toast/__tests__/Toast.test.js +30 -0
- package/dist/components/Toast/index.d.ts +23 -0
- package/dist/components/Toast/index.js +43 -0
- package/dist/components/Typography/Typography.stories.d.ts +1 -1
- package/dist/components/UtilityRail/__tests__/UtilityRail.test.js +2 -18
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/assets/theme.js
CHANGED
|
@@ -8,10 +8,12 @@ import statusChipTheme from '../components/StatusChip/statusChip.theme';
|
|
|
8
8
|
import selectTheme from '../components/Select/select.theme';
|
|
9
9
|
import tabsTheme from '../components/Tabs/tabs.theme';
|
|
10
10
|
import inputTheme from '../components/Input/input.theme';
|
|
11
|
+
import { menuFlyoutTheme, menuItemTheme } from '../components/MenuFlyout/menuFlyout.theme';
|
|
11
12
|
import modalTheme from '../components/Modal/modal.theme';
|
|
13
|
+
import linearProgress from '../components/LinearProgress/linearProgress.theme';
|
|
12
14
|
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
13
|
-
import
|
|
14
|
-
import WarningIcon from '
|
|
15
|
+
import InformationIcon from 'resources/icons/information.svg';
|
|
16
|
+
import WarningIcon from 'resources/icons/warning.svg';
|
|
15
17
|
import ErrorIcon from '@mui/icons-material/Cancel';
|
|
16
18
|
export const colors = {
|
|
17
19
|
brand: {
|
|
@@ -49,6 +51,9 @@ let theme = createTheme({
|
|
|
49
51
|
fontSize: '1.429rem',
|
|
50
52
|
lineHeight: '2.143rem',
|
|
51
53
|
fontWeight: '700'
|
|
54
|
+
},
|
|
55
|
+
body1: {
|
|
56
|
+
color: colors.text.primary
|
|
52
57
|
}
|
|
53
58
|
},
|
|
54
59
|
palette: {
|
|
@@ -89,7 +94,7 @@ let theme = createTheme({
|
|
|
89
94
|
spacing: 10
|
|
90
95
|
});
|
|
91
96
|
theme = createTheme(theme, {
|
|
92
|
-
components: Object.assign(Object.assign({ MuiButton: buttonTheme(theme) }, stepperTheme(theme)), { MuiSelect: selectTheme(theme), MuiTextField: inputTheme(theme), MuiDialog: modalTheme(theme), MuiCheckbox: checkboxTheme(theme), MuiRadio: radioButtonTheme(theme), MuiTabs: tabsTheme(theme), MuiChip: statusChipTheme(theme), MuiInputLabel: {
|
|
97
|
+
components: Object.assign(Object.assign({ MuiButton: buttonTheme(theme) }, stepperTheme(theme)), { MuiSelect: selectTheme(theme), MuiTextField: inputTheme(theme), MuiDialog: modalTheme(theme), MuiCheckbox: checkboxTheme(theme), MuiRadio: radioButtonTheme(theme), MuiTabs: tabsTheme(theme), MuiChip: statusChipTheme(theme), MuiMenu: menuFlyoutTheme(theme), MuiMenuItem: menuItemTheme(theme), MuiLinearProgress: linearProgress(theme), MuiInputLabel: {
|
|
93
98
|
styleOverrides: {
|
|
94
99
|
root: {
|
|
95
100
|
color: theme.palette.text.secondary,
|
|
@@ -159,11 +164,11 @@ theme = createTheme(theme, {
|
|
|
159
164
|
}, MuiLink: {
|
|
160
165
|
defaultProps: {
|
|
161
166
|
underline: `none`,
|
|
162
|
-
color:
|
|
167
|
+
color: colors.button.primary
|
|
163
168
|
}
|
|
164
169
|
}, MuiSnackbar: {
|
|
165
170
|
defaultProps: {
|
|
166
|
-
autoHideDuration:
|
|
171
|
+
autoHideDuration: 3000,
|
|
167
172
|
anchorOrigin: {
|
|
168
173
|
vertical: `top`,
|
|
169
174
|
horizontal: `right`
|
|
@@ -181,17 +186,18 @@ theme = createTheme(theme, {
|
|
|
181
186
|
variant: `outlined`,
|
|
182
187
|
iconMapping: {
|
|
183
188
|
success: _jsx(CheckCircleIcon, {}),
|
|
184
|
-
info: _jsx(
|
|
185
|
-
warning: _jsx(
|
|
189
|
+
info: _jsx("img", { alt: 'information icon', src: InformationIcon }),
|
|
190
|
+
warning: _jsx("img", { alt: 'warning icon', src: WarningIcon }),
|
|
186
191
|
error: _jsx(ErrorIcon, {})
|
|
187
192
|
}
|
|
188
193
|
},
|
|
189
194
|
styleOverrides: {
|
|
190
195
|
root: {
|
|
191
|
-
width: `
|
|
196
|
+
width: `415px`,
|
|
192
197
|
backgroundColor: `white`,
|
|
193
198
|
position: `relative`,
|
|
194
199
|
overflow: `hidden`,
|
|
200
|
+
border: `1px solid #7C848D`,
|
|
195
201
|
'&:after': {
|
|
196
202
|
content: '""',
|
|
197
203
|
position: `absolute`,
|
|
@@ -204,7 +210,7 @@ theme = createTheme(theme, {
|
|
|
204
210
|
backgroundColor: theme.palette.success.main
|
|
205
211
|
},
|
|
206
212
|
'&.MuiAlert-outlinedInfo:after': {
|
|
207
|
-
backgroundColor: theme.palette.
|
|
213
|
+
backgroundColor: theme.palette.secondary.main
|
|
208
214
|
},
|
|
209
215
|
'&.MuiAlert-outlinedWarning:after': {
|
|
210
216
|
backgroundColor: theme.palette.warning.main
|
|
@@ -219,7 +225,10 @@ theme = createTheme(theme, {
|
|
|
219
225
|
'& .MuiAlert-message': {
|
|
220
226
|
fontSize: `12px`,
|
|
221
227
|
lineHeight: `22px`,
|
|
222
|
-
color:
|
|
228
|
+
color: colors.text.primary
|
|
229
|
+
},
|
|
230
|
+
'& .MuiIconButton-root': {
|
|
231
|
+
color: colors.text.tertiary
|
|
223
232
|
}
|
|
224
233
|
}
|
|
225
234
|
}
|
|
@@ -251,18 +260,8 @@ theme = createTheme(theme, {
|
|
|
251
260
|
styleOverrides: {
|
|
252
261
|
root: {
|
|
253
262
|
'&.MuiMenu-paper': {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}, MuiMenuItem: {
|
|
260
|
-
styleOverrides: {
|
|
261
|
-
root: {
|
|
262
|
-
color: theme.palette.text.primary,
|
|
263
|
-
padding: '10px 20px',
|
|
264
|
-
':hover, :focus': {
|
|
265
|
-
backgroundColor: theme.palette.misc.altBackground
|
|
263
|
+
// border: '1px solid ' + theme.palette.text.disabled,
|
|
264
|
+
// boxShadow: 'none'
|
|
266
265
|
}
|
|
267
266
|
}
|
|
268
267
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentStory, Story, ComponentMeta } from '@storybook/react';
|
|
2
|
+
import BreadcrumbsComponent from '.';
|
|
3
|
+
declare const _default: ComponentMeta<({ links }: {
|
|
4
|
+
'data-testid'?: string | undefined;
|
|
5
|
+
links: {
|
|
6
|
+
href: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}[];
|
|
9
|
+
}) => JSX.Element>;
|
|
10
|
+
export default _default;
|
|
11
|
+
export declare const Default: ComponentStory<typeof BreadcrumbsComponent> | Story;
|
|
@@ -0,0 +1,31 @@
|
|
|
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 BreadcrumbsComponent from '.';
|
|
14
|
+
const links = [
|
|
15
|
+
{ label: 'Home', href: '/' },
|
|
16
|
+
{ label: 'About', href: '/about' },
|
|
17
|
+
{ label: 'Contact', href: '/contact' }
|
|
18
|
+
];
|
|
19
|
+
export default {
|
|
20
|
+
title: 'Components/BreadcrumbsComponent',
|
|
21
|
+
component: BreadcrumbsComponent,
|
|
22
|
+
argTypes: {
|
|
23
|
+
links: {
|
|
24
|
+
defaultValue: ['.pdf', '.format']
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export const Default = (_a) => {
|
|
29
|
+
var args = __rest(_a, []);
|
|
30
|
+
return _jsx(BreadcrumbsComponent, Object.assign({}, args, { links: links }));
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '../../../utils/tests/helpers';
|
|
3
|
+
import { screen } from '@testing-library/react';
|
|
4
|
+
import Breadcrumbs from '..';
|
|
5
|
+
const links = [
|
|
6
|
+
{ label: 'Home', href: '/' },
|
|
7
|
+
{ label: 'About', href: '/about' },
|
|
8
|
+
{ label: 'Contact', href: '/contact' }
|
|
9
|
+
];
|
|
10
|
+
describe('<Breadcrumbs />', () => {
|
|
11
|
+
it('should render the Breadcrumbs component', () => {
|
|
12
|
+
render(_jsx(Breadcrumbs, { links: links, "data-testid": "breadcrumbs" }));
|
|
13
|
+
expect(screen.getByTestId('breadcrumbs')).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type BreadcrumbsProps = {
|
|
2
|
+
'data-testid'?: string;
|
|
3
|
+
links: {
|
|
4
|
+
href: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* - This is the breadcrumbs component that is used in the header
|
|
10
|
+
* - It takes in an array of links and renders them as breadcrumbs
|
|
11
|
+
* - The last link is not clickable
|
|
12
|
+
* - The last link is styled differently
|
|
13
|
+
**/
|
|
14
|
+
declare const BreadcrumbsComponent: ({ links }: BreadcrumbsProps) => JSX.Element;
|
|
15
|
+
export default BreadcrumbsComponent;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Breadcrumbs, Link, Typography } from '@mui/material';
|
|
3
|
+
import theme from '../../assets/theme';
|
|
4
|
+
/**
|
|
5
|
+
* - This is the breadcrumbs component that is used in the header
|
|
6
|
+
* - It takes in an array of links and renders them as breadcrumbs
|
|
7
|
+
* - The last link is not clickable
|
|
8
|
+
* - The last link is styled differently
|
|
9
|
+
**/
|
|
10
|
+
const BreadcrumbsComponent = ({ links = [] }) => {
|
|
11
|
+
return (_jsx(Breadcrumbs, Object.assign({ "aria-label": "breadcrumbs", "data-testid": "breadcrumbs" }, { children: links === null || links === void 0 ? void 0 : links.map((link, index) => {
|
|
12
|
+
if (index === links.length - 1) {
|
|
13
|
+
return (_jsx(Typography, Object.assign({ sx: {
|
|
14
|
+
color: theme.palette.text.disabled,
|
|
15
|
+
fontFamily: 'Dosis',
|
|
16
|
+
fontStyle: 'normal',
|
|
17
|
+
fontWeight: 600,
|
|
18
|
+
fontSize: '18px',
|
|
19
|
+
textTransform: 'uppercase'
|
|
20
|
+
} }, { children: link.label }), index));
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return (_jsx(Link, Object.assign({ href: link.href }, { children: _jsx(Typography, Object.assign({ sx: {
|
|
24
|
+
color: theme.palette.button.main,
|
|
25
|
+
fontFamily: 'Dosis',
|
|
26
|
+
fontStyle: 'normal',
|
|
27
|
+
fontWeight: 600,
|
|
28
|
+
fontSize: '18px',
|
|
29
|
+
textTransform: 'uppercase'
|
|
30
|
+
} }, { children: link.label }), index) }), link.href));
|
|
31
|
+
}
|
|
32
|
+
}) })));
|
|
33
|
+
};
|
|
34
|
+
export default BreadcrumbsComponent;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Accept } from 'react-dropzone';
|
|
2
2
|
export interface FileData {
|
|
3
|
-
file: File;
|
|
3
|
+
file: File | any;
|
|
4
4
|
uploadProgress: number;
|
|
5
5
|
isUploaded: boolean;
|
|
6
6
|
withError: boolean;
|
|
7
|
+
feedbackText: string;
|
|
7
8
|
}
|
|
8
9
|
type FileUploaderProps = {
|
|
9
10
|
'data-testid'?: string;
|
|
@@ -9,20 +9,74 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
13
14
|
import { useCallback, useEffect, useState } from 'react';
|
|
14
15
|
import { Box } from '@mui/system';
|
|
15
16
|
import { IconButton, Typography } from '@mui/material';
|
|
16
17
|
import { useTheme } from '@mui/material/styles';
|
|
17
18
|
import CloudUploadOutlinedIcon from '@mui/icons-material/CloudUploadOutlined';
|
|
18
|
-
import InsertDriveFileIcon from '@mui/icons-material/InsertDriveFile';
|
|
19
19
|
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
|
|
20
20
|
import { useDropzone } from 'react-dropzone';
|
|
21
21
|
import { useUploadFile } from './useUploadFile';
|
|
22
|
+
import LinearProgress from '../LinearProgress';
|
|
22
23
|
const FileUploader = (_a) => {
|
|
23
24
|
var { uploadUrl, files, accept, multiple, onSuccess, onError, extensions = ['[format]', '[format]', '[format]'] } = _a, props = __rest(_a, ["uploadUrl", "files", "accept", "multiple", "onSuccess", "onError", "extensions"]);
|
|
24
25
|
const { palette } = useTheme();
|
|
25
|
-
const
|
|
26
|
+
const fileData = [
|
|
27
|
+
{
|
|
28
|
+
feedbackText: `Feedback text`,
|
|
29
|
+
uploadProgress: 60,
|
|
30
|
+
isUploaded: false,
|
|
31
|
+
withError: false,
|
|
32
|
+
file: {
|
|
33
|
+
lastModified: 1527053530715,
|
|
34
|
+
name: 'test-consent.pdf',
|
|
35
|
+
size: 0,
|
|
36
|
+
type: 'image/jpg',
|
|
37
|
+
webkitRelativePath: '',
|
|
38
|
+
slice: ``,
|
|
39
|
+
// arrayBuffer: // need to mock this
|
|
40
|
+
stream: ``,
|
|
41
|
+
text: ``
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
feedbackText: ``,
|
|
46
|
+
uploadProgress: 100,
|
|
47
|
+
isUploaded: true,
|
|
48
|
+
withError: false,
|
|
49
|
+
file: {
|
|
50
|
+
lastModified: 1527053530715,
|
|
51
|
+
name: 'test-consent.pdf',
|
|
52
|
+
size: 0,
|
|
53
|
+
type: 'image/jpg',
|
|
54
|
+
webkitRelativePath: '',
|
|
55
|
+
slice: ``,
|
|
56
|
+
// arrayBuffer: // need to mock this
|
|
57
|
+
stream: ``,
|
|
58
|
+
text: ``
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
feedbackText: `File upload error. Please try again.`,
|
|
63
|
+
uploadProgress: 70,
|
|
64
|
+
isUploaded: false,
|
|
65
|
+
withError: true,
|
|
66
|
+
file: {
|
|
67
|
+
lastModified: 1527053530715,
|
|
68
|
+
name: 'test-consent.pdf',
|
|
69
|
+
size: 0,
|
|
70
|
+
type: 'image/jpg',
|
|
71
|
+
webkitRelativePath: '',
|
|
72
|
+
slice: ``,
|
|
73
|
+
// arrayBuffer: // need to mock this
|
|
74
|
+
stream: ``,
|
|
75
|
+
text: ``
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
];
|
|
79
|
+
const [fileList, setfileList] = useState(fileData);
|
|
26
80
|
const { onDrop } = useUploadFile(setfileList, uploadUrl, onSuccess, onError);
|
|
27
81
|
const { getRootProps, getInputProps, acceptedFiles } = useDropzone({
|
|
28
82
|
multiple,
|
|
@@ -48,6 +102,7 @@ const FileUploader = (_a) => {
|
|
|
48
102
|
paddingRight: '38px',
|
|
49
103
|
paddingBottom: '19px',
|
|
50
104
|
paddingLeft: '20px',
|
|
105
|
+
marginBottom: '5px',
|
|
51
106
|
width: '100%',
|
|
52
107
|
boxSizing: 'border-box',
|
|
53
108
|
borderRadius: '4px',
|
|
@@ -87,64 +142,15 @@ const FileUploader = (_a) => {
|
|
|
87
142
|
maxWidth: '500px',
|
|
88
143
|
display: 'flex',
|
|
89
144
|
alignItems: 'center',
|
|
90
|
-
gap: '
|
|
91
|
-
padding: '
|
|
145
|
+
gap: '10px',
|
|
146
|
+
padding: '10px',
|
|
92
147
|
boxSizing: 'border-box',
|
|
93
148
|
borderBottom: `1px solid rgba(42, 50, 60, 0.5)`
|
|
94
|
-
} }, { children: [_jsx(
|
|
95
|
-
display: 'flex',
|
|
96
|
-
alignItems: 'center',
|
|
97
|
-
justifyContent: 'center',
|
|
98
|
-
width: '40px',
|
|
99
|
-
height: '40px',
|
|
100
|
-
boxSizing: 'border-box',
|
|
101
|
-
border: `3px solid ${palette.misc.altBackground}`,
|
|
102
|
-
borderRadius: '50%'
|
|
103
|
-
} }, { children: _jsx(InsertDriveFileIcon, { sx: {
|
|
149
|
+
} }, { children: [_jsx(LinearProgress, { value: file.uploadProgress, itemLoading: file.file.name, isError: file.withError, feedbackText: file.feedbackText, isUploaded: file.isUploaded }), _jsx(IconButton, Object.assign({ "data-testid": "file-item-delete-button", "aria-label": "delete", sx: { padding: 0 }, onClick: () => handleDeleteFile(index) }, { children: _jsx(DeleteOutlineIcon, { sx: {
|
|
104
150
|
width: '18px',
|
|
105
151
|
height: '18px',
|
|
106
152
|
fill: palette.text.tertiary
|
|
107
|
-
} }) }))
|
|
108
|
-
fontWeight: 600,
|
|
109
|
-
fontSize: '14px',
|
|
110
|
-
lineHeight: '19px',
|
|
111
|
-
color: palette.text.primary
|
|
112
|
-
} }, { children: file.file.name })), file.isUploaded ? (_jsx(_Fragment, { children: _jsx(Typography, Object.assign({ "data-testid": "file-item-size", sx: {
|
|
113
|
-
marginTop: '1px',
|
|
114
|
-
fontWeight: 400,
|
|
115
|
-
fontSize: '12px',
|
|
116
|
-
lineHeight: '16px',
|
|
117
|
-
color: palette.neutral.main
|
|
118
|
-
} }, { children: (file.file.size / (1024 * 1024)).toFixed(1) + ' MB' })) })) : file.withError ? (_jsxs(_Fragment, { children: [_jsx(Box, Object.assign({ sx: {
|
|
119
|
-
width: '100%',
|
|
120
|
-
height: '4px',
|
|
121
|
-
marginTop: '5px',
|
|
122
|
-
marginBottom: '4px',
|
|
123
|
-
borderRadius: '20px',
|
|
124
|
-
background: palette.misc.altBackground
|
|
125
|
-
} }, { children: _jsx(Box, { sx: {
|
|
126
|
-
width: '100%',
|
|
127
|
-
height: '100%',
|
|
128
|
-
borderRadius: '20px',
|
|
129
|
-
background: palette.error.main
|
|
130
|
-
} }) })), _jsx(Typography, Object.assign({ sx: {
|
|
131
|
-
fontWeight: 600,
|
|
132
|
-
fontSize: '10px',
|
|
133
|
-
lineHeight: '14px',
|
|
134
|
-
color: palette.text.primary
|
|
135
|
-
} }, { children: "File upload error. Please try again." }))] })) : (_jsx(Box, Object.assign({ sx: {
|
|
136
|
-
width: '100%',
|
|
137
|
-
height: '4px',
|
|
138
|
-
marginTop: '5px',
|
|
139
|
-
marginBottom: '4px',
|
|
140
|
-
borderRadius: '20px',
|
|
141
|
-
background: palette.misc.altBackground
|
|
142
|
-
} }, { children: _jsx(Box, { "data-testid": "file-progress-bar", sx: {
|
|
143
|
-
width: `${file.uploadProgress}%`,
|
|
144
|
-
height: '100%',
|
|
145
|
-
borderRadius: '20px',
|
|
146
|
-
background: palette.success.main
|
|
147
|
-
} }) })))] })), _jsx(IconButton, Object.assign({ "data-testid": "file-item-delete-button", "aria-label": "delete", sx: { padding: 0 }, onClick: () => handleDeleteFile(index) }, { children: _jsx(DeleteOutlineIcon, { sx: { width: '18px', height: '18px' } }) }))] }), index));
|
|
153
|
+
} }) }))] }), index));
|
|
148
154
|
})] })));
|
|
149
155
|
};
|
|
150
156
|
export default FileUploader;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentStory, Story, ComponentMeta } from '@storybook/react';
|
|
2
|
+
import LinearProgress from '.';
|
|
3
|
+
declare const _default: ComponentMeta<({ value, itemLoading, isError, feedbackText, isUploaded, ...props }: {
|
|
4
|
+
'data-testid'?: string | undefined;
|
|
5
|
+
value: number;
|
|
6
|
+
itemLoading: string;
|
|
7
|
+
isError?: boolean | undefined;
|
|
8
|
+
feedbackText?: string | undefined;
|
|
9
|
+
isUploaded: boolean;
|
|
10
|
+
} & import("@mui/material").LinearProgressProps) => JSX.Element>;
|
|
11
|
+
export default _default;
|
|
12
|
+
export declare const Default: ComponentStory<typeof LinearProgress> | Story;
|
|
13
|
+
export declare const FullProgress: ComponentStory<typeof LinearProgress> | Story;
|
|
14
|
+
export declare const ProgressError: ComponentStory<typeof LinearProgress> | Story;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 LinearProgress from '.';
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Components/LinearProgress',
|
|
16
|
+
component: LinearProgress
|
|
17
|
+
};
|
|
18
|
+
export const Default = (_a) => {
|
|
19
|
+
var args = __rest(_a, []);
|
|
20
|
+
return (_jsx(LinearProgress, Object.assign({ value: 60, itemLoading: 'image-file-name.png', isUploaded: false }, args)));
|
|
21
|
+
};
|
|
22
|
+
export const FullProgress = (_a) => {
|
|
23
|
+
var args = __rest(_a, []);
|
|
24
|
+
return (_jsx(LinearProgress, Object.assign({ value: 100, itemLoading: 'image-file-name.png', isUploaded: true }, args)));
|
|
25
|
+
};
|
|
26
|
+
export const ProgressError = (_a) => {
|
|
27
|
+
var args = __rest(_a, []);
|
|
28
|
+
return (_jsx(LinearProgress, Object.assign({ value: 70, itemLoading: 'image-file-name.png', isError: true, feedbackText: 'Error messaging', isUploaded: false }, args)));
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '../../../utils/tests/helpers';
|
|
3
|
+
import { screen } from '@testing-library/react';
|
|
4
|
+
import LinearProgress from '..';
|
|
5
|
+
describe('<LinearProgress />', () => {
|
|
6
|
+
it('should render the LinearProgress component', () => {
|
|
7
|
+
render(_jsx(LinearProgress, { "data-testid": "linear-progress", value: 15, itemLoading: '', isUploaded: false }));
|
|
8
|
+
expect(screen.getByTestId('linear-progress')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
it('should render the Linear Progress component with feedback text', () => {
|
|
11
|
+
render(_jsx(LinearProgress, { "data-testid": "linear-progress", value: 15, itemLoading: '', isError: true, feedbackText: 'Error message', isUploaded: false }));
|
|
12
|
+
expect(screen.getByText('Error message')).toBeInTheDocument();
|
|
13
|
+
});
|
|
14
|
+
it('should render the Linear Progress component with uploadProgress when there is no feedback text', () => {
|
|
15
|
+
render(_jsx(LinearProgress, { "data-testid": "linear-progress", value: 15, itemLoading: '', isError: true, feedbackText: '', isUploaded: false }));
|
|
16
|
+
expect(screen.getByText('15%')).toBeInTheDocument();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { LinearProgressProps as MuiLinearProgressProps } from '@mui/material';
|
|
2
|
+
type LinearProgressProps = {
|
|
3
|
+
'data-testid'?: string;
|
|
4
|
+
value: number;
|
|
5
|
+
/**
|
|
6
|
+
- The value of the progress indicator for the determinate and buffer variants. Value between 0 and 100.
|
|
7
|
+
**/
|
|
8
|
+
itemLoading: string;
|
|
9
|
+
/**
|
|
10
|
+
- The name of the item or file loading
|
|
11
|
+
**/
|
|
12
|
+
isError?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
- Optional prop that can be passed to show error state in bar
|
|
15
|
+
**/
|
|
16
|
+
feedbackText?: string;
|
|
17
|
+
/**
|
|
18
|
+
- Optional prop that can be passed to show error message
|
|
19
|
+
**/
|
|
20
|
+
isUploaded: boolean;
|
|
21
|
+
} & MuiLinearProgressProps;
|
|
22
|
+
/**
|
|
23
|
+
- Use a Linear Progress Bar to show the user that an operation is in progress.
|
|
24
|
+
This is currently being used in conjuction with the uploader tool
|
|
25
|
+
**/
|
|
26
|
+
declare const LinearProgress: ({ value, itemLoading, isError, feedbackText, isUploaded, ...props }: LinearProgressProps) => JSX.Element;
|
|
27
|
+
export default LinearProgress;
|
|
@@ -0,0 +1,26 @@
|
|
|
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 { LinearProgress as MuiLinearProgress, Typography, Box } from '@mui/material';
|
|
14
|
+
/**
|
|
15
|
+
- Use a Linear Progress Bar to show the user that an operation is in progress.
|
|
16
|
+
This is currently being used in conjuction with the uploader tool
|
|
17
|
+
**/
|
|
18
|
+
const LinearProgress = (_a) => {
|
|
19
|
+
var { value, itemLoading, isError = false, feedbackText, isUploaded } = _a, props = __rest(_a, ["value", "itemLoading", "isError", "feedbackText", "isUploaded"]);
|
|
20
|
+
return (_jsxs(Box, Object.assign({ sx: { width: `100%`, margin: `5px 0` } }, { children: [_jsx(Box, Object.assign({ sx: {
|
|
21
|
+
display: `flex`,
|
|
22
|
+
justifyContent: `space-between`,
|
|
23
|
+
marginBottom: `5px`
|
|
24
|
+
} }, { children: _jsx(Typography, Object.assign({ sx: { fontSize: `14px`, fontWeight: `600` } }, { children: itemLoading })) })), isError ? (_jsx(MuiLinearProgress, Object.assign({ "aria-label": 'linear progress bar', variant: "determinate", value: value, sx: { '& .MuiLinearProgress-bar': { backgroundColor: `#EB0000` } } }, props))) : isUploaded ? (_jsx(MuiLinearProgress, Object.assign({ "aria-label": 'linear progress bar', variant: "determinate", value: value }, props, { sx: { '& .MuiLinearProgress-bar': { backgroundColor: `#28BA3F` } } }))) : (_jsx(MuiLinearProgress, Object.assign({ "aria-label": 'linear progress bar', variant: "determinate", value: value }, props))), _jsx(Typography, Object.assign({ sx: { fontSize: `11px`, marginTop: `10px`, color: `#5C6269` } }, { children: feedbackText ? feedbackText : `${value}%` }))] })));
|
|
25
|
+
};
|
|
26
|
+
export default LinearProgress;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Theme } from '../../assets/theme';
|
|
2
|
+
declare const linearProgress: (theme: Theme) => {
|
|
3
|
+
styleOverrides: {
|
|
4
|
+
root: () => {
|
|
5
|
+
borderRadius: string;
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
'& .MuiLinearProgress-bar': {
|
|
8
|
+
backgroundColor: string;
|
|
9
|
+
borderRadius: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default linearProgress;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const linearProgress = (theme) => ({
|
|
2
|
+
styleOverrides: {
|
|
3
|
+
root: () => ({
|
|
4
|
+
borderRadius: `20px`,
|
|
5
|
+
backgroundColor: `#E0E8F0`,
|
|
6
|
+
'& .MuiLinearProgress-bar': {
|
|
7
|
+
backgroundColor: '#335B89',
|
|
8
|
+
borderRadius: `20px`
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
export default linearProgress;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
3
|
+
declare const _default: ComponentMeta<({ menuOptions, open, ...props }: {
|
|
4
|
+
'data-testid'?: string | undefined;
|
|
5
|
+
menuOptions: {
|
|
6
|
+
label: string;
|
|
7
|
+
icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
8
|
+
}[];
|
|
9
|
+
} & import("@mui/material").MenuProps) => JSX.Element>;
|
|
10
|
+
export default _default;
|
|
11
|
+
export declare const Default: ComponentStory<({ menuOptions, open, ...props }: {
|
|
12
|
+
'data-testid'?: string | undefined;
|
|
13
|
+
menuOptions: {
|
|
14
|
+
label: string;
|
|
15
|
+
icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
16
|
+
}[];
|
|
17
|
+
} & import("@mui/material").MenuProps) => JSX.Element>;
|
|
18
|
+
export declare const WithIcons: ComponentStory<({ menuOptions, open, ...props }: {
|
|
19
|
+
'data-testid'?: string | undefined;
|
|
20
|
+
menuOptions: {
|
|
21
|
+
label: string;
|
|
22
|
+
icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
23
|
+
}[];
|
|
24
|
+
} & import("@mui/material").MenuProps) => JSX.Element>;
|
|
25
|
+
export declare const WithoutIcons: ComponentStory<({ menuOptions, open, ...props }: {
|
|
26
|
+
'data-testid'?: string | undefined;
|
|
27
|
+
menuOptions: {
|
|
28
|
+
label: string;
|
|
29
|
+
icon?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
30
|
+
}[];
|
|
31
|
+
} & import("@mui/material").MenuProps) => JSX.Element>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import EditOutlinedIcon from '@mui/icons-material/EditOutlined';
|
|
3
|
+
import PersonAddAltOutlinedIcon from '@mui/icons-material/PersonAddAltOutlined';
|
|
4
|
+
import DeleteOutlinedIcon from '@mui/icons-material/DeleteOutlined';
|
|
5
|
+
import { editLabel, shareWithLabel, deleteLabel } from './constants';
|
|
6
|
+
import MenuFlyout from '.';
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/MenuFlyout',
|
|
9
|
+
component: MenuFlyout
|
|
10
|
+
};
|
|
11
|
+
const Template = (args) => (_jsx(MenuFlyout, Object.assign({}, args)));
|
|
12
|
+
export const Default = Template.bind({});
|
|
13
|
+
Default.args = {
|
|
14
|
+
menuOptions: [
|
|
15
|
+
{
|
|
16
|
+
label: 'This is an example of a 2 line item',
|
|
17
|
+
icon: _jsx(EditOutlinedIcon, {})
|
|
18
|
+
},
|
|
19
|
+
{ label: '1 Line Item', icon: _jsx(EditOutlinedIcon, {}) },
|
|
20
|
+
{ label: '2 Line Item', icon: _jsx(EditOutlinedIcon, {}) }
|
|
21
|
+
]
|
|
22
|
+
};
|
|
23
|
+
export const WithIcons = Template.bind({});
|
|
24
|
+
WithIcons.args = {
|
|
25
|
+
menuOptions: [
|
|
26
|
+
{ label: editLabel, icon: _jsx(EditOutlinedIcon, {}) },
|
|
27
|
+
{ label: shareWithLabel, icon: _jsx(PersonAddAltOutlinedIcon, {}) },
|
|
28
|
+
{ label: deleteLabel, icon: _jsx(DeleteOutlinedIcon, {}) }
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
export const WithoutIcons = Template.bind({});
|
|
32
|
+
WithoutIcons.args = {
|
|
33
|
+
menuOptions: [
|
|
34
|
+
{ label: editLabel },
|
|
35
|
+
{ label: shareWithLabel },
|
|
36
|
+
{ label: deleteLabel }
|
|
37
|
+
]
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '../../../utils/tests/helpers';
|
|
3
|
+
import { screen } from '@testing-library/react';
|
|
4
|
+
import { editLabel, shareWithLabel } from '../constants';
|
|
5
|
+
import EditOutlinedIcon from '@mui/icons-material/EditOutlined';
|
|
6
|
+
import MenuFlyout from '..';
|
|
7
|
+
describe('<MenuFlyout />', () => {
|
|
8
|
+
const mockMenuOptions = [{ label: editLabel }, { label: shareWithLabel }];
|
|
9
|
+
const mockMenuIconOptions = [{ label: editLabel, icon: _jsx(EditOutlinedIcon, {}) }];
|
|
10
|
+
it('should render the MenuFlyout component, multi item list without icons', () => {
|
|
11
|
+
render(_jsx(MenuFlyout, { "data-testid": "menu-flyout", open: true, menuOptions: mockMenuOptions }));
|
|
12
|
+
expect(screen.getByTestId('menu-flyout')).toBeInTheDocument();
|
|
13
|
+
expect(screen.getByText(editLabel)).toBeInTheDocument();
|
|
14
|
+
expect(screen.getByText(shareWithLabel)).toBeInTheDocument();
|
|
15
|
+
expect(screen.getByRole('menu').children).toHaveLength(2);
|
|
16
|
+
});
|
|
17
|
+
it('should render MenuFlyout component, single item list with icon', () => {
|
|
18
|
+
render(_jsx(MenuFlyout, { "data-testid": "menu-flyout", open: true, menuOptions: mockMenuIconOptions }));
|
|
19
|
+
expect(screen.getByTestId('menu-flyout')).toBeInTheDocument();
|
|
20
|
+
expect(screen.getByText(editLabel)).toBeInTheDocument();
|
|
21
|
+
expect(screen.getByTestId('EditOutlinedIcon')).toBeVisible();
|
|
22
|
+
expect(screen.getByRole('menu').children).toHaveLength(1);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MenuProps } from '@mui/material';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
type MenuOption = {
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: React.ReactElement;
|
|
6
|
+
};
|
|
7
|
+
type MenuFlyoutProps = {
|
|
8
|
+
'data-testid'?: string;
|
|
9
|
+
/**
|
|
10
|
+
An array of objects of type `MenuOption[]`. Each object in this array **requires** a label property of type `string` and an **optional** icon property of type `React.ReactElement`. Each object represents a list item on the menu flyout component.
|
|
11
|
+
**/
|
|
12
|
+
menuOptions: MenuOption[];
|
|
13
|
+
} & MenuProps;
|
|
14
|
+
declare const MenuFlyout: ({ menuOptions, open, ...props }: MenuFlyoutProps) => JSX.Element;
|
|
15
|
+
export default MenuFlyout;
|
|
@@ -0,0 +1,27 @@
|
|
|
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 { Menu, MenuItem, ListItemIcon, Box, Typography } from '@mui/material';
|
|
14
|
+
const MenuFlyout = (_a) => {
|
|
15
|
+
var { menuOptions, open } = _a, props = __rest(_a, ["menuOptions", "open"]);
|
|
16
|
+
return (_jsx(Menu, Object.assign({ "data-testid": true, open: true }, props, { children: menuOptions.map((menuItem, index) => {
|
|
17
|
+
return (_jsx(MenuItem, { children: _jsxs(Box, Object.assign({ sx: {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
alignItems: 'center'
|
|
20
|
+
} }, { children: [_jsx(Box, Object.assign({ sx: {
|
|
21
|
+
mr: '10px'
|
|
22
|
+
} }, { children: menuItem.icon && _jsx(ListItemIcon, { children: menuItem.icon }) })), _jsx(Box, { children: _jsx(Typography, Object.assign({ sx: {
|
|
23
|
+
fontSize: '14px'
|
|
24
|
+
} }, { children: menuItem.label })) })] })) }, index));
|
|
25
|
+
}) })));
|
|
26
|
+
};
|
|
27
|
+
export default MenuFlyout;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Theme } from '../../assets/theme';
|
|
2
|
+
export declare const menuFlyoutTheme: (theme: Theme) => {
|
|
3
|
+
styleOverrides: {
|
|
4
|
+
root: () => {
|
|
5
|
+
height: string;
|
|
6
|
+
fontSize: string;
|
|
7
|
+
borderRadius: string;
|
|
8
|
+
fontFamily: string;
|
|
9
|
+
fontStyle: string;
|
|
10
|
+
fontWeight: number;
|
|
11
|
+
textTransform: string;
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
':hover, :focus': {
|
|
14
|
+
backgroundColor: string;
|
|
15
|
+
};
|
|
16
|
+
'& .MuiList-root, &.MuiMenu-list': {
|
|
17
|
+
minWidth: number;
|
|
18
|
+
maxWidth: number;
|
|
19
|
+
padding: number;
|
|
20
|
+
};
|
|
21
|
+
'& .MuiPaper-root': {
|
|
22
|
+
background: string;
|
|
23
|
+
border: string;
|
|
24
|
+
borderRadius: string;
|
|
25
|
+
padding: string;
|
|
26
|
+
gap: string;
|
|
27
|
+
boxShadow: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare const menuItemTheme: (theme: Theme) => {
|
|
33
|
+
styleOverrides: {
|
|
34
|
+
root: () => {
|
|
35
|
+
whiteSpace: string;
|
|
36
|
+
minWidth: number;
|
|
37
|
+
maxWidth: number;
|
|
38
|
+
padding: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const menuFlyoutTheme = (theme) => ({
|
|
2
|
+
styleOverrides: {
|
|
3
|
+
root: () => ({
|
|
4
|
+
height: 'auto',
|
|
5
|
+
fontSize: '14px',
|
|
6
|
+
borderRadius: '2px',
|
|
7
|
+
fontFamily: 'Nunito',
|
|
8
|
+
fontStyle: 'normal',
|
|
9
|
+
fontWeight: 400,
|
|
10
|
+
textTransform: 'capitalize',
|
|
11
|
+
backgroundColor: theme.palette.common.white,
|
|
12
|
+
':hover, :focus': {
|
|
13
|
+
backgroundColor: theme.palette.misc.altBackground
|
|
14
|
+
},
|
|
15
|
+
'& .MuiList-root, &.MuiMenu-list': {
|
|
16
|
+
minWidth: 168,
|
|
17
|
+
maxWidth: 200,
|
|
18
|
+
padding: 0
|
|
19
|
+
},
|
|
20
|
+
'& .MuiPaper-root': {
|
|
21
|
+
background: '#FFFFFF',
|
|
22
|
+
border: '1px solid #7C848D',
|
|
23
|
+
borderRadius: '0px 0px 4px 4px',
|
|
24
|
+
padding: '10px',
|
|
25
|
+
gap: '20px',
|
|
26
|
+
boxShadow: '3px 3px 5px rgba(0, 0, 0, 0.2)'
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export const menuItemTheme = (theme) => ({
|
|
32
|
+
styleOverrides: {
|
|
33
|
+
root: () => ({
|
|
34
|
+
whiteSpace: 'normal',
|
|
35
|
+
minWidth: 168,
|
|
36
|
+
maxWidth: 200,
|
|
37
|
+
padding: '5px'
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
});
|
|
@@ -21,7 +21,7 @@ declare const _default: ComponentMeta<({ label, ...props }: {
|
|
|
21
21
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
22
22
|
tabIndex?: number | undefined;
|
|
23
23
|
variant?: "outlined" | "filled" | undefined;
|
|
24
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<
|
|
24
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
25
25
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
26
26
|
}, "color" | "icon" | keyof import("@mui/material/OverridableComponent").CommonProps | "label" | "tabIndex" | "children" | "disabled" | "sx" | "size" | "variant" | "clickable" | "avatar" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled">) => JSX.Element>;
|
|
27
27
|
export default _default;
|
|
@@ -46,6 +46,6 @@ export declare const Options: ComponentStory<({ label, ...props }: {
|
|
|
46
46
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
47
47
|
tabIndex?: number | undefined;
|
|
48
48
|
variant?: "outlined" | "filled" | undefined;
|
|
49
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<
|
|
49
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
50
50
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
51
51
|
}, "color" | "icon" | keyof import("@mui/material/OverridableComponent").CommonProps | "label" | "tabIndex" | "children" | "disabled" | "sx" | "size" | "variant" | "clickable" | "avatar" | "deleteIcon" | "onDelete" | "skipFocusWhenDisabled">) => JSX.Element>;
|
|
@@ -14,7 +14,7 @@ declare const _default: ComponentMeta<(props: {
|
|
|
14
14
|
nonLinear?: boolean | undefined;
|
|
15
15
|
orientation?: import("@mui/material").Orientation | undefined;
|
|
16
16
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
17
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<
|
|
17
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
18
18
|
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
19
19
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "square" | "elevation" | "orientation" | "component" | "activeStep" | "alternativeLabel" | "connector" | "nonLinear">) => JSX.Element>;
|
|
20
20
|
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ComponentStory, Story, ComponentMeta } from '@storybook/react';
|
|
2
|
+
import Toast from '.';
|
|
3
|
+
declare const _default: ComponentMeta<({ severity, messageLabel, messageText, linkText, handleClose, open, ...props }: {
|
|
4
|
+
'data-testid'?: string | undefined;
|
|
5
|
+
messageLabel?: string | undefined;
|
|
6
|
+
messageText?: string | undefined;
|
|
7
|
+
linkText?: string | undefined;
|
|
8
|
+
handleClose?: (() => void) | undefined;
|
|
9
|
+
open?: boolean | undefined;
|
|
10
|
+
} & import("@mui/material").SnackbarProps & import("@mui/material").AlertProps) => JSX.Element>;
|
|
11
|
+
export default _default;
|
|
12
|
+
export declare const DefaultAutoHide: ComponentStory<typeof Toast> | Story;
|
|
13
|
+
export declare const onClose: ComponentStory<typeof Toast> | Story;
|
|
14
|
+
export declare const onCloseWithLink: ComponentStory<typeof Toast> | Story;
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { Stack } from '@mui/material';
|
|
14
|
+
import Toast from '.';
|
|
15
|
+
export default {
|
|
16
|
+
title: 'Components/Toast',
|
|
17
|
+
component: Toast,
|
|
18
|
+
argTypes: {
|
|
19
|
+
severity: {
|
|
20
|
+
options: ['success', 'info', 'warning', 'error'],
|
|
21
|
+
control: { type: 'radio' }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const handleClose = () => {
|
|
26
|
+
/**
|
|
27
|
+
* - This is a dummy function to demonstrate passing in a handleClose prop
|
|
28
|
+
* - It adds a close button
|
|
29
|
+
**/
|
|
30
|
+
};
|
|
31
|
+
export const DefaultAutoHide = (_a) => {
|
|
32
|
+
var args = __rest(_a, []);
|
|
33
|
+
return (_jsxs(Stack, Object.assign({ spacing: 2 }, { children: [_jsx(Toast, Object.assign({ severity: "success" }, args)), _jsx(Toast, Object.assign({ severity: "info" }, args)), _jsx(Toast, Object.assign({ severity: "warning" }, args)), _jsx(Toast, Object.assign({ severity: "error" }, args))] })));
|
|
34
|
+
};
|
|
35
|
+
export const onClose = (_a) => {
|
|
36
|
+
var args = __rest(_a, []);
|
|
37
|
+
return (_jsxs(Stack, Object.assign({ spacing: 2 }, { children: [_jsx(Toast, Object.assign({ severity: "success", autoHideDuration: 15000, handleClose: handleClose }, args)), _jsx(Toast, Object.assign({ severity: "info", autoHideDuration: 15000, handleClose: handleClose }, args)), _jsx(Toast, Object.assign({ severity: "warning", autoHideDuration: 15000, handleClose: handleClose }, args)), _jsx(Toast, Object.assign({ severity: "error", autoHideDuration: 15000, handleClose: handleClose }, args))] })));
|
|
38
|
+
};
|
|
39
|
+
export const onCloseWithLink = (_a) => {
|
|
40
|
+
var args = __rest(_a, []);
|
|
41
|
+
return (_jsxs(Stack, Object.assign({ spacing: 2 }, { children: [_jsx(Toast, Object.assign({ severity: "success", linkText: "See Action Result", autoHideDuration: 15000, handleClose: handleClose }, args)), _jsx(Toast, Object.assign({ severity: "info", linkText: "Link", autoHideDuration: 15000, handleClose: handleClose }, args)), _jsx(Toast, Object.assign({ severity: "warning", linkText: "Action Link", autoHideDuration: 15000, handleClose: handleClose }, args)), _jsx(Toast, Object.assign({ severity: "error", linkText: "Correction Link", autoHideDuration: 15000, handleClose: handleClose }, args))] })));
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '../../../utils/tests/helpers';
|
|
3
|
+
import { screen } from '@testing-library/react';
|
|
4
|
+
import Toast from '..';
|
|
5
|
+
describe('<Toast />', () => {
|
|
6
|
+
it('should render the Success Toast component', () => {
|
|
7
|
+
render(_jsx(Toast, { "data-testid": "success", severity: "success" }));
|
|
8
|
+
expect(screen.getByText('Success:')).toBeInTheDocument();
|
|
9
|
+
expect(screen.getByText('Your action was completed.')).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
it('should render the Info Toast component', () => {
|
|
12
|
+
render(_jsx(Toast, { "data-testid": "info", severity: "info" }));
|
|
13
|
+
expect(screen.getByText('Info:')).toBeInTheDocument();
|
|
14
|
+
expect(screen.getByText('General information.')).toBeInTheDocument();
|
|
15
|
+
});
|
|
16
|
+
it('should render the Warning Toast component', () => {
|
|
17
|
+
render(_jsx(Toast, { "data-testid": "warning", severity: "warning" }));
|
|
18
|
+
expect(screen.getByText('Alert:')).toBeInTheDocument();
|
|
19
|
+
expect(screen.getByText('Your action is required.')).toBeInTheDocument();
|
|
20
|
+
});
|
|
21
|
+
it('should render the Error Toast component', () => {
|
|
22
|
+
render(_jsx(Toast, { "data-testid": "error", severity: "error" }));
|
|
23
|
+
expect(screen.getByText('Error:')).toBeInTheDocument();
|
|
24
|
+
expect(screen.getByText('An error has occured.')).toBeInTheDocument();
|
|
25
|
+
});
|
|
26
|
+
it('should render linkText in Toast component when provided', () => {
|
|
27
|
+
render(_jsx(Toast, { "data-testid": "link", linkText: "Click link for more information" }));
|
|
28
|
+
expect(screen.getByText('Click link for more information')).toBeInTheDocument();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SnackbarProps, AlertProps } from '@mui/material';
|
|
2
|
+
type ToastProps = {
|
|
3
|
+
'data-testid'?: string;
|
|
4
|
+
messageLabel?: string;
|
|
5
|
+
messageText?: string;
|
|
6
|
+
/**
|
|
7
|
+
* - Use can pass messageLabel or messageText
|
|
8
|
+
* - If these props are not passed in, the default label and text will be set based on severity
|
|
9
|
+
**/
|
|
10
|
+
linkText?: string;
|
|
11
|
+
/**
|
|
12
|
+
* - User can add linkText if they want to provide users a link with information related to the toast
|
|
13
|
+
**/
|
|
14
|
+
handleClose?: () => void;
|
|
15
|
+
/**
|
|
16
|
+
* - handleClose is an optional function a user can pass
|
|
17
|
+
* - if user does not pass this function, the autoHideDuration will control when the toast disappears
|
|
18
|
+
* -
|
|
19
|
+
**/
|
|
20
|
+
open?: boolean;
|
|
21
|
+
} & SnackbarProps & AlertProps;
|
|
22
|
+
declare const Toast: ({ severity, messageLabel, messageText, linkText, handleClose, open, ...props }: ToastProps) => JSX.Element;
|
|
23
|
+
export default Toast;
|
|
@@ -0,0 +1,43 @@
|
|
|
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 { Box, Snackbar, Alert, Link, Typography } from '@mui/material';
|
|
14
|
+
const defaultMessageLabel = {
|
|
15
|
+
success: `Success`,
|
|
16
|
+
info: `Info`,
|
|
17
|
+
warning: `Alert`,
|
|
18
|
+
error: `Error`
|
|
19
|
+
};
|
|
20
|
+
const defaultMessageText = {
|
|
21
|
+
success: `Your action was completed. `,
|
|
22
|
+
info: `General information. `,
|
|
23
|
+
warning: `Your action is required. `,
|
|
24
|
+
error: `An error has occured. `
|
|
25
|
+
};
|
|
26
|
+
const Toast = (_a) => {
|
|
27
|
+
var { severity = `success`, messageLabel, messageText, linkText = ``, handleClose, open } = _a, props = __rest(_a, ["severity", "messageLabel", "messageText", "linkText", "handleClose", "open"]);
|
|
28
|
+
return (_jsxs(Box, { children: [_jsx(Snackbar, Object.assign({}, props, { open: open })), _jsx(Alert, Object.assign({ onClose: handleClose, severity: severity }, { children: _jsxs(Box, Object.assign({ sx: {
|
|
29
|
+
display: `flex`,
|
|
30
|
+
alignItems: `center`
|
|
31
|
+
} }, { children: [_jsx(Typography, Object.assign({ sx: {
|
|
32
|
+
fontSize: `12px`,
|
|
33
|
+
fontWeight: `bold`,
|
|
34
|
+
marginRight: `2px`
|
|
35
|
+
} }, { children: messageLabel
|
|
36
|
+
? `${messageLabel + ` `}: `
|
|
37
|
+
: `${defaultMessageLabel[severity]}: ` })), _jsx(Typography, Object.assign({ sx: {
|
|
38
|
+
fontSize: `12px`
|
|
39
|
+
} }, { children: messageText
|
|
40
|
+
? `${messageText + ` `} `
|
|
41
|
+
: defaultMessageText[severity] })), linkText && _jsx(Link, Object.assign({ href: "#" }, { children: linkText }))] })) }))] }));
|
|
42
|
+
};
|
|
43
|
+
export default Toast;
|
|
@@ -13,7 +13,7 @@ declare const _default: ComponentMeta<({ ...props }: {
|
|
|
13
13
|
sx?: import("@mui/system").SxProps<import("@mui/material").Theme> | undefined;
|
|
14
14
|
variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "overline" | "subtitle1" | "subtitle2" | "body1" | "body2" | undefined;
|
|
15
15
|
variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "overline" | "subtitle1" | "subtitle2" | "body1" | "body2", string>> | undefined;
|
|
16
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<
|
|
16
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
17
17
|
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
18
18
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | ("color" | "p" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxShadow" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "zIndex" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">) => JSX.Element>;
|
|
19
19
|
export default _default;
|
|
@@ -5,23 +5,7 @@ import UtilityRail from '..';
|
|
|
5
5
|
import { mock } from '../mock';
|
|
6
6
|
describe('<UtilityRail />', () => {
|
|
7
7
|
it('should render the UtilityRail component', () => {
|
|
8
|
-
render(_jsx(UtilityRail, { items: mock }));
|
|
9
|
-
expect(screen.
|
|
10
|
-
});
|
|
11
|
-
it('should render a specific amount of items', () => {
|
|
12
|
-
render(_jsx(UtilityRail, { "data-testid": "utility-rail", items: [
|
|
13
|
-
{
|
|
14
|
-
title: 'Title item 1',
|
|
15
|
-
subtitle: 'Subtitle item 1',
|
|
16
|
-
description: 'Description item 1'
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
title: 'Title item 2',
|
|
20
|
-
subtitle: 'Subtitle item 2',
|
|
21
|
-
description: 'Description item 2'
|
|
22
|
-
}
|
|
23
|
-
] }));
|
|
24
|
-
const utilityRail = screen.getByTestId('utility-rail');
|
|
25
|
-
expect(utilityRail.childElementCount).toHaveLength(2);
|
|
8
|
+
render(_jsx(UtilityRail, { items: mock, "data-testid": "UtilityRail" }));
|
|
9
|
+
expect(screen.getByTestId('UtilityRail')).toBeInTheDocument();
|
|
26
10
|
});
|
|
27
11
|
});
|
package/dist/index.d.ts
CHANGED
|
@@ -25,5 +25,6 @@ export { default as RadioGroup } from './components/RadioGroup';
|
|
|
25
25
|
export { default as Step } from './components/Step';
|
|
26
26
|
export { default as StepLabel } from './components/StepLabel';
|
|
27
27
|
export { default as ModelGridView } from './components/ModelGridView';
|
|
28
|
+
export { default as Breadcrumbs } from './components/Breadcrumbs';
|
|
28
29
|
export { default as theme } from './assets/theme';
|
|
29
30
|
export { useTheme } from '@mui/material';
|
package/dist/index.js
CHANGED
|
@@ -25,5 +25,6 @@ export { default as RadioGroup } from './components/RadioGroup';
|
|
|
25
25
|
export { default as Step } from './components/Step';
|
|
26
26
|
export { default as StepLabel } from './components/StepLabel';
|
|
27
27
|
export { default as ModelGridView } from './components/ModelGridView';
|
|
28
|
+
export { default as Breadcrumbs } from './components/Breadcrumbs';
|
|
28
29
|
export { default as theme } from './assets/theme';
|
|
29
30
|
export { useTheme } from '@mui/material';
|