@veritone-ce/design-system 1.12.6 → 1.12.8

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.
Files changed (32) hide show
  1. package/dist/assets/theme.js +18 -10
  2. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +11 -0
  3. package/dist/components/Breadcrumbs/Breadcrumbs.stories.js +31 -0
  4. package/dist/components/Breadcrumbs/__tests__/Breadcrumbs.test.d.ts +1 -0
  5. package/dist/components/Breadcrumbs/__tests__/Breadcrumbs.test.js +15 -0
  6. package/dist/components/Breadcrumbs/breadcrumbs.theme.d.ts +11 -0
  7. package/dist/components/Breadcrumbs/breadcrumbs.theme.js +10 -0
  8. package/dist/components/Breadcrumbs/index.d.ts +15 -0
  9. package/dist/components/Breadcrumbs/index.js +34 -0
  10. package/dist/components/FileUploader/index.d.ts +2 -1
  11. package/dist/components/FileUploader/index.js +62 -56
  12. package/dist/components/LinearProgress/LinearProgress.stories.d.ts +14 -0
  13. package/dist/components/LinearProgress/LinearProgress.stories.js +29 -0
  14. package/dist/components/LinearProgress/__tests__/LinearProgress.test.d.ts +1 -0
  15. package/dist/components/LinearProgress/__tests__/LinearProgress.test.js +18 -0
  16. package/dist/components/LinearProgress/index.d.ts +27 -0
  17. package/dist/components/LinearProgress/index.js +26 -0
  18. package/dist/components/LinearProgress/linearProgress.theme.d.ts +14 -0
  19. package/dist/components/LinearProgress/linearProgress.theme.js +13 -0
  20. package/dist/components/StatusChip/StatusChip.stories.d.ts +2 -2
  21. package/dist/components/Stepper/Stepper.stories.d.ts +1 -1
  22. package/dist/components/Toast/Toast.stories.d.ts +14 -0
  23. package/dist/components/Toast/Toast.stories.js +42 -0
  24. package/dist/components/Toast/__tests__/Toast.test.d.ts +1 -0
  25. package/dist/components/Toast/__tests__/Toast.test.js +30 -0
  26. package/dist/components/Toast/index.d.ts +23 -0
  27. package/dist/components/Toast/index.js +43 -0
  28. package/dist/components/Typography/Typography.stories.d.ts +1 -1
  29. package/dist/components/UtilityRail/__tests__/UtilityRail.test.js +2 -18
  30. package/dist/index.d.ts +1 -0
  31. package/dist/index.js +1 -0
  32. package/package.json +1 -1
@@ -9,9 +9,10 @@ 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
11
  import modalTheme from '../components/Modal/modal.theme';
12
+ import linearProgress from '../components/LinearProgress/linearProgress.theme';
12
13
  import CheckCircleIcon from '@mui/icons-material/CheckCircle';
13
- import InfoIcon from '@mui/icons-material/Info';
14
- import WarningIcon from '@mui/icons-material/Error';
14
+ import InformationIcon from 'resources/icons/information.svg';
15
+ import WarningIcon from 'resources/icons/warning.svg';
15
16
  import ErrorIcon from '@mui/icons-material/Cancel';
16
17
  export const colors = {
17
18
  brand: {
@@ -49,6 +50,9 @@ let theme = createTheme({
49
50
  fontSize: '1.429rem',
50
51
  lineHeight: '2.143rem',
51
52
  fontWeight: '700'
53
+ },
54
+ body1: {
55
+ color: colors.text.primary
52
56
  }
53
57
  },
54
58
  palette: {
@@ -89,7 +93,7 @@ let theme = createTheme({
89
93
  spacing: 10
90
94
  });
91
95
  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: {
96
+ 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), MuiLinearProgress: linearProgress(theme), MuiInputLabel: {
93
97
  styleOverrides: {
94
98
  root: {
95
99
  color: theme.palette.text.secondary,
@@ -159,11 +163,11 @@ theme = createTheme(theme, {
159
163
  }, MuiLink: {
160
164
  defaultProps: {
161
165
  underline: `none`,
162
- color: theme.palette.primary.main
166
+ color: colors.button.primary
163
167
  }
164
168
  }, MuiSnackbar: {
165
169
  defaultProps: {
166
- autoHideDuration: 6000,
170
+ autoHideDuration: 3000,
167
171
  anchorOrigin: {
168
172
  vertical: `top`,
169
173
  horizontal: `right`
@@ -181,17 +185,18 @@ theme = createTheme(theme, {
181
185
  variant: `outlined`,
182
186
  iconMapping: {
183
187
  success: _jsx(CheckCircleIcon, {}),
184
- info: _jsx(InfoIcon, {}),
185
- warning: _jsx(WarningIcon, {}),
188
+ info: _jsx("img", { alt: 'information icon', src: InformationIcon }),
189
+ warning: _jsx("img", { alt: 'warning icon', src: WarningIcon }),
186
190
  error: _jsx(ErrorIcon, {})
187
191
  }
188
192
  },
189
193
  styleOverrides: {
190
194
  root: {
191
- width: `100%`,
195
+ width: `415px`,
192
196
  backgroundColor: `white`,
193
197
  position: `relative`,
194
198
  overflow: `hidden`,
199
+ border: `1px solid #7C848D`,
195
200
  '&:after': {
196
201
  content: '""',
197
202
  position: `absolute`,
@@ -204,7 +209,7 @@ theme = createTheme(theme, {
204
209
  backgroundColor: theme.palette.success.main
205
210
  },
206
211
  '&.MuiAlert-outlinedInfo:after': {
207
- backgroundColor: theme.palette.info.main
212
+ backgroundColor: theme.palette.secondary.main
208
213
  },
209
214
  '&.MuiAlert-outlinedWarning:after': {
210
215
  backgroundColor: theme.palette.warning.main
@@ -219,7 +224,10 @@ theme = createTheme(theme, {
219
224
  '& .MuiAlert-message': {
220
225
  fontSize: `12px`,
221
226
  lineHeight: `22px`,
222
- color: `black`
227
+ color: colors.text.primary
228
+ },
229
+ '& .MuiIconButton-root': {
230
+ color: colors.text.tertiary
223
231
  }
224
232
  }
225
233
  }
@@ -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,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,11 @@
1
+ import { Theme } from '../../assets/theme';
2
+ declare const breadcrumbs: (theme: Theme) => {
3
+ styleOverrides: {
4
+ root: () => {
5
+ '& .MuiBreadcrumbs-separator': {
6
+ color: string;
7
+ };
8
+ };
9
+ };
10
+ };
11
+ export default breadcrumbs;
@@ -0,0 +1,10 @@
1
+ const breadcrumbs = (theme) => ({
2
+ styleOverrides: {
3
+ root: () => ({
4
+ '& .MuiBreadcrumbs-separator': {
5
+ color: theme.palette.text.disabled
6
+ }
7
+ })
8
+ }
9
+ });
10
+ export default breadcrumbs;
@@ -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, Fragment as _Fragment } from "react/jsx-runtime";
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 [fileList, setfileList] = useState([]);
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: '20px',
91
- padding: '15px',
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(Box, Object.assign({ sx: {
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
- } }) })), _jsxs(Box, Object.assign({ sx: { flex: 1 } }, { children: [_jsx(Typography, Object.assign({ sx: {
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,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;
@@ -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<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
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<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
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<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
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<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof import("react").HTMLAttributes<HTMLSpanElement>> & {
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.getByText('UtilityRail')).toBeInTheDocument();
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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritone-ce/design-system",
3
- "version": "1.12.6",
3
+ "version": "1.12.8",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "start": "yarn storybook",