@veritone-ce/design-system 1.6.0 → 1.7.1

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.
@@ -3,8 +3,8 @@ import { createTheme } from '@mui/material';
3
3
  import checkboxTheme from '../components/Checkbox/checkbox.theme';
4
4
  import radioButtonTheme from '../components/RadioButton/RadioButton.theme';
5
5
  import buttonTheme from '../components/Button/button.theme';
6
+ import selectTheme from '../components/Select/select.theme';
6
7
  import inputTheme from '../components/Input/Input.theme';
7
- import sx from '@mui/system/sx';
8
8
  import CheckCircleIcon from '@mui/icons-material/CheckCircle';
9
9
  import InfoIcon from '@mui/icons-material/Info';
10
10
  import WarningIcon from '@mui/icons-material/Error';
@@ -84,36 +84,38 @@ let theme = createTheme({
84
84
  },
85
85
  spacing: 10
86
86
  });
87
- theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
87
+ theme = createTheme(theme, {
88
+ components: {
88
89
  MuiButton: buttonTheme(theme),
90
+ MuiSelect: selectTheme(theme),
89
91
  MuiTextField: inputTheme(theme),
90
92
  MuiCheckbox: checkboxTheme(theme),
91
93
  MuiRadio: radioButtonTheme(theme),
92
94
  MuiInputLabel: {
93
95
  styleOverrides: {
94
- root: sx({
96
+ root: {
95
97
  color: theme.palette.text.secondary,
96
98
  fontSize: `14px`,
97
99
  lineHeight: `21px`,
98
100
  fontWeight: `600`
99
- })
101
+ }
100
102
  }
101
103
  },
102
104
  MuiFormControlLabel: {
103
105
  styleOverrides: {
104
- root: sx({
106
+ root: {
105
107
  '& .MuiFormControlLabel-label': {
106
108
  color: theme.palette.text.secondary
107
109
  },
108
110
  '& .MuiFormControlLabel-label.Mui-disabled': {
109
111
  color: theme.palette.text.disabled
110
112
  }
111
- })
113
+ }
112
114
  }
113
115
  },
114
116
  MuiFormHelperText: {
115
117
  styleOverrides: {
116
- root: sx({
118
+ root: {
117
119
  position: 'relative',
118
120
  marginLeft: 0,
119
121
  '&.Mui-error': {
@@ -130,7 +132,7 @@ theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
130
132
  borderRadius: `100%`
131
133
  }
132
134
  }
133
- })
135
+ }
134
136
  }
135
137
  },
136
138
  MuiStepIcon: {
@@ -265,6 +267,29 @@ theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
265
267
  paddingTop: theme.spacing(1)
266
268
  }
267
269
  }
270
+ },
271
+ MuiDataGrid: {
272
+ styleOverrides: {
273
+ root: {
274
+ '& .MuiDataGrid-columnHeader:focus': {
275
+ outline: 0
276
+ },
277
+ '& .MuiDataGrid-cell:focus': {
278
+ outline: 0
279
+ }
280
+ }
281
+ }
282
+ },
283
+ MuiPaper: {
284
+ styleOverrides: {
285
+ root: {
286
+ '&.MuiMenu-paper': {
287
+ border: '1px solid ' + theme.palette.text.disabled,
288
+ boxShadow: 'none'
289
+ }
290
+ }
291
+ }
268
292
  }
269
- } }));
293
+ }
294
+ });
270
295
  export default theme;
@@ -1,4 +1,3 @@
1
- import sx from '@mui/system/sx';
2
1
  const buttonTheme = (theme) => ({
3
2
  defaultProps: {
4
3
  variant: 'contained',
@@ -89,7 +88,7 @@ const buttonTheme = (theme) => ({
89
88
  props: {
90
89
  variant: 'secondary'
91
90
  },
92
- style: sx({
91
+ style: {
93
92
  backgroundColor: 'white',
94
93
  color: theme.palette.neutral.main,
95
94
  border: `1px solid ${theme.palette.neutral.main}`,
@@ -98,7 +97,7 @@ const buttonTheme = (theme) => ({
98
97
  color: theme.palette.primary.main,
99
98
  backgroundColor: 'white'
100
99
  }
101
- })
100
+ }
102
101
  }
103
102
  ]
104
103
  });
@@ -0,0 +1,3 @@
1
+ import { ProgressIndicatorProps } from '.';
2
+ declare const DefaultProgress: ({ itemLoading, size }: ProgressIndicatorProps) => JSX.Element;
3
+ export default DefaultProgress;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CircularProgress, Typography, Box } from '@mui/material';
3
+ const DefaultProgress = ({ itemLoading, size }) => {
4
+ return (_jsxs(Box, Object.assign({ sx: { display: 'flex' } }, { children: [itemLoading && (_jsx(Typography, Object.assign({ sx: {
5
+ fontSize: '14px',
6
+ mr: '10px'
7
+ } }, { children: ` Loading ${itemLoading}` }))), _jsx(CircularProgress, { size: size })] })));
8
+ };
9
+ export default DefaultProgress;
@@ -0,0 +1,3 @@
1
+ import { ProgressIndicatorProps } from '.';
2
+ declare const MLProgress: ({ itemLoading, size }: ProgressIndicatorProps) => JSX.Element;
3
+ export default MLProgress;
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CircularProgress, Typography, Box } from '@mui/material';
3
+ const MLProgress = ({ itemLoading, size }) => {
4
+ return (_jsxs(Box, Object.assign({ sx: {
5
+ display: 'flex',
6
+ flexDirection: 'column',
7
+ alignItems: 'center',
8
+ justifyContent: 'center'
9
+ } }, { children: [_jsx(CircularProgress, { size: size }), itemLoading && (_jsx(Typography, Object.assign({ sx: {
10
+ fontSize: '14px'
11
+ } }, { children: ` Loading ${itemLoading}` })))] })));
12
+ };
13
+ export default MLProgress;
@@ -0,0 +1,7 @@
1
+ import { ComponentStory, Story, ComponentMeta } from '@storybook/react';
2
+ import ProgressIndicator, { ProgressIndicatorProps } from '.';
3
+ declare const _default: ComponentMeta<({ ...props }: ProgressIndicatorProps) => JSX.Element>;
4
+ export default _default;
5
+ export declare const Default: ComponentStory<typeof ProgressIndicator> | Story;
6
+ export declare const Medium: Story<import("@storybook/react").Args> | ComponentStory<({ ...props }: ProgressIndicatorProps) => JSX.Element>;
7
+ export declare const Large: Story<import("@storybook/react").Args> | ComponentStory<({ ...props }: ProgressIndicatorProps) => JSX.Element>;
@@ -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 } from "react/jsx-runtime";
13
+ import { createElement as _createElement } from "react";
14
+ import { Box } from '@mui/material';
15
+ import ProgressIndicator from '.';
16
+ export default {
17
+ title: 'Components/ProgressIndicator',
18
+ component: ProgressIndicator
19
+ };
20
+ const previewProps = [
21
+ {
22
+ itemLoading: 'default',
23
+ type: 'default',
24
+ size: 18
25
+ }
26
+ ];
27
+ export const Default = (_a) => {
28
+ var args = __rest(_a, []);
29
+ return (_jsx(Box, { children: previewProps.map((props, index) => (_createElement(ProgressIndicator, Object.assign({}, props, args, { key: index })))) }));
30
+ };
31
+ export const Medium = Default.bind({});
32
+ Medium.args = {
33
+ itemLoading: 'medium',
34
+ size: 30,
35
+ type: 'medium'
36
+ };
37
+ export const Large = Default.bind({});
38
+ Large.args = {
39
+ itemLoading: 'large',
40
+ size: 50,
41
+ type: 'large'
42
+ };
@@ -0,0 +1,10 @@
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 ProgressIndicator from '..';
5
+ describe('<ProgressIndicator />', () => {
6
+ it('should render the ProgressIndicator component', () => {
7
+ render(_jsx(ProgressIndicator, {}));
8
+ expect(screen.getByText('ProgressIndicator')).toBeInTheDocument();
9
+ });
10
+ });
@@ -0,0 +1,11 @@
1
+ import { CircularProgressProps } from '@mui/material';
2
+ export declare type ProgressIndicatorProps = {
3
+ itemLoading?: string;
4
+ type?: string;
5
+ size?: number;
6
+ } & CircularProgressProps;
7
+ /**
8
+ - Use a progress indicator to show the user that an operation is in progress.
9
+ **/
10
+ declare const ProgressIndicator: ({ ...props }: ProgressIndicatorProps) => JSX.Element;
11
+ export default ProgressIndicator;
@@ -0,0 +1,22 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import DefaultProgress from './DefaultProgress';
14
+ import MLProgress from './MLProgress';
15
+ /**
16
+ - Use a progress indicator to show the user that an operation is in progress.
17
+ **/
18
+ const ProgressIndicator = (_a) => {
19
+ var props = __rest(_a, []);
20
+ return (_jsxs(_Fragment, { children: [props.type === 'default' && _jsx(DefaultProgress, Object.assign({}, props)), props.type === 'medium' && _jsx(MLProgress, Object.assign({}, props)), props.type === 'large' && _jsx(MLProgress, Object.assign({}, props))] }));
21
+ };
22
+ export default ProgressIndicator;
@@ -0,0 +1,5 @@
1
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
+ declare const _default: ComponentMeta<({ label, items, helperText, errorMessage, ...props }: import(".").SelectProps) => JSX.Element>;
3
+ export default _default;
4
+ export declare const Default: ComponentStory<({ label, items, helperText, errorMessage, ...props }: import(".").SelectProps) => JSX.Element>;
5
+ export declare const MultiLine: ComponentStory<({ label, items, helperText, errorMessage, ...props }: import(".").SelectProps) => JSX.Element>;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { Box } from '@mui/material';
4
+ import Select from '.';
5
+ export default {
6
+ title: 'Components/Select',
7
+ component: Select
8
+ };
9
+ const Template = (args) => (_jsx(Box, Object.assign({ sx: {
10
+ display: `grid`,
11
+ gridTemplateColumns: `repeat(2, 300px)`,
12
+ gap: 2
13
+ } }, { children: _jsxs(React.Fragment, { children: [_jsx(Select, Object.assign({}, args)), _jsx(Select, Object.assign({}, args, { helperText: "Helper Text" })), _jsx(Select, Object.assign({}, args, { disabled: true })), _jsx(Select, Object.assign({}, args, { disabled: true, helperText: "Helper Text" })), _jsx(Select, Object.assign({}, args, { error: true, errorMessage: "Error Message" })), _jsx(Select, Object.assign({}, args, { error: true, errorMessage: "Error Message", helperText: "Helper Text" }))] }) })));
14
+ export const Default = Template.bind({});
15
+ Default.args = {
16
+ label: 'Label',
17
+ value: '',
18
+ items: [
19
+ { name: 'One', value: 1 },
20
+ { name: 'Two', value: 2 },
21
+ { name: 'Three', value: 3 }
22
+ ],
23
+ fullWidth: true,
24
+ displayEmpty: true
25
+ };
26
+ export const MultiLine = Template.bind({});
27
+ MultiLine.args = {
28
+ label: 'Label',
29
+ value: '',
30
+ items: [
31
+ { name: 'UA-12234566', value: 4, title: 'Google Analytics' },
32
+ { name: 'UA-12234567', value: 4, title: 'Source' },
33
+ { name: 'UA-12234568', value: 4, title: 'Source' }
34
+ ],
35
+ fullWidth: true,
36
+ displayEmpty: true
37
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
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 Select from '..';
5
+ const items = [
6
+ { name: 'One', value: 1 },
7
+ { name: 'Two', value: 2 },
8
+ { name: 'Three', value: 3 }
9
+ ];
10
+ describe('<Select />', () => {
11
+ it('should render the Select component', () => {
12
+ render(_jsx(Select, { "data-testid": "select", label: 'Select', value: '', items: items }));
13
+ expect(screen.getByTestId('select')).toBeInTheDocument();
14
+ });
15
+ it('should render Select component with all properties', () => {
16
+ render(_jsx(Select, { "data-testid": "select", label: 'Select', value: '', helperText: "Helper Text", error: true, errorMessage: "Error Message", items: items }));
17
+ expect(screen.getByTestId('select')).toBeInTheDocument();
18
+ });
19
+ });
@@ -0,0 +1,15 @@
1
+ import { SelectProps as MuiSelectProps } from '@mui/material';
2
+ declare type ItemData = {
3
+ title?: string;
4
+ name: string;
5
+ value: string | number;
6
+ };
7
+ export declare type SelectProps = {
8
+ 'data-testid'?: string;
9
+ label: string;
10
+ items: ItemData[];
11
+ helperText?: string;
12
+ errorMessage?: string;
13
+ } & MuiSelectProps;
14
+ declare const Select: ({ label, items, helperText, errorMessage, ...props }: SelectProps) => JSX.Element;
15
+ export default Select;
@@ -0,0 +1,63 @@
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, FormHelperText, InputLabel, MenuItem, Select as MuiSelect } from '@mui/material';
14
+ import Circle from '@mui/icons-material/Lens';
15
+ const Select = (_a) => {
16
+ var { label, items, helperText, errorMessage } = _a, props = __rest(_a, ["label", "items", "helperText", "errorMessage"]);
17
+ return (_jsxs(Box, Object.assign({ sx: {
18
+ maxHeight: helperText ? '77px' : '56px'
19
+ } }, { children: [_jsx(InputLabel, Object.assign({ id: "label-select", sx: {
20
+ display: 'flex',
21
+ alignItems: 'flex-end',
22
+ lineHeight: '17px',
23
+ marginBottom: '3px'
24
+ } }, { children: label })), _jsx(Box, Object.assign({ sx: {
25
+ display: 'flex',
26
+ '& .MuiOutlinedInput-root': {
27
+ '& .MuiSelect-outlined': {
28
+ padding: helperText ? '7px 7.5px' : '5px 8px',
29
+ fontSize: helperText ? '14px' : '16px',
30
+ lineHeight: helperText ? '20px' : '24px'
31
+ },
32
+ '&.Mui-error': {
33
+ '& .MuiSelect-outlined': {
34
+ padding: helperText ? '7px 8px' : '5px 13px'
35
+ }
36
+ }
37
+ }
38
+ } }, { children: _jsxs(MuiSelect, Object.assign({}, props, { labelId: "label-select" }, { children: [_jsx(MenuItem, Object.assign({ value: "", sx: {
39
+ color: (theme) => theme.palette.text.primary,
40
+ padding: '10px 20px',
41
+ ':hover, :focus': {
42
+ backgroundColor: (theme) => theme.palette.misc.altBackground
43
+ }
44
+ } }, { children: "Select" })), items.map((item, index) => (_jsx(MenuItem, Object.assign({ value: item.value, sx: {
45
+ color: (theme) => theme.palette.text.primary,
46
+ padding: '10px 20px',
47
+ ':hover, :focus': {
48
+ backgroundColor: (theme) => theme.palette.misc.altBackground
49
+ }
50
+ } }, { children: _jsxs(Box, Object.assign({ sx: { lineHeight: '20px', fontSize: '14px', opacity: 0.9 } }, { children: [_jsx(Box, Object.assign({ sx: { fontWeight: 700 } }, { children: item.title })), _jsx(Box, { children: item.name })] })) }), index)))] })) })), helperText && (_jsx(FormHelperText, Object.assign({ sx: {
51
+ lineHeight: '18px',
52
+ color: (theme) => theme.palette.text.disabled
53
+ } }, { children: helperText }))), props.error && (_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: [_jsx(Circle, { sx: {
54
+ width: '14px',
55
+ height: '14px',
56
+ margin: '1px 3px 0 -2px',
57
+ color: (theme) => theme.palette.error.main
58
+ } }), _jsx(FormHelperText, Object.assign({ sx: {
59
+ color: (theme) => theme.palette.error.main,
60
+ lineHeight: '18px'
61
+ } }, { children: errorMessage }))] })))] })));
62
+ };
63
+ export default Select;
@@ -0,0 +1,53 @@
1
+ import { Theme } from '../../assets/theme';
2
+ declare const selectTheme: (theme: Theme) => {
3
+ defaultProps: {
4
+ fullWidth: boolean;
5
+ displayEmpty: boolean;
6
+ };
7
+ styleOverrides: {
8
+ root: () => {
9
+ '&.MuiOutlinedInput-root': {
10
+ '& .MuiSelect-outlined': {
11
+ border: string;
12
+ };
13
+ '&.Mui-focused': {
14
+ '& .MuiOutlinedInput-notchedOutline': {
15
+ borderColor: string;
16
+ };
17
+ };
18
+ '&.Mui-error': {
19
+ '& .MuiSelect-outlined': {
20
+ color: string;
21
+ border: string;
22
+ fontSize: string;
23
+ lineHeight: string;
24
+ };
25
+ '& .MuiOutlinedInput-notchedOutline': {
26
+ borderColor: string;
27
+ };
28
+ '& .MuiSelect-iconOutlined': {
29
+ color: string;
30
+ };
31
+ };
32
+ '&.Mui-disabled': {
33
+ '& .MuiSelect-iconOutlined': {
34
+ color: string;
35
+ };
36
+ '& .MuiSelect-outlined': {
37
+ background: string;
38
+ borderColor: string;
39
+ color: string;
40
+ '-webkit-text-fill-color': string;
41
+ };
42
+ '& .MuiOutlinedInput-notchedOutline': {
43
+ border: string;
44
+ };
45
+ };
46
+ '& .MuiSelect-iconOutlined': {
47
+ color: string;
48
+ };
49
+ };
50
+ };
51
+ };
52
+ };
53
+ export default selectTheme;
@@ -0,0 +1,52 @@
1
+ const selectTheme = (theme) => ({
2
+ defaultProps: {
3
+ fullWidth: true,
4
+ displayEmpty: true
5
+ },
6
+ styleOverrides: {
7
+ root: () => ({
8
+ '&.MuiOutlinedInput-root': {
9
+ '& .MuiSelect-outlined': {
10
+ border: '1px solid ' + theme.palette.text.secondary
11
+ },
12
+ '&.Mui-focused': {
13
+ '& .MuiOutlinedInput-notchedOutline': {
14
+ borderColor: theme.palette.secondary.main
15
+ }
16
+ },
17
+ '&.Mui-error': {
18
+ '& .MuiSelect-outlined': {
19
+ color: theme.palette.error.main,
20
+ border: '1px solid ' + theme.palette.error.main,
21
+ fontSize: '16px',
22
+ lineHeight: '24px'
23
+ },
24
+ '& .MuiOutlinedInput-notchedOutline': {
25
+ borderColor: theme.palette.error.main
26
+ },
27
+ '& .MuiSelect-iconOutlined': {
28
+ color: theme.palette.text.tertiary
29
+ }
30
+ },
31
+ '&.Mui-disabled': {
32
+ '& .MuiSelect-iconOutlined': {
33
+ color: theme.palette.text.disabled
34
+ },
35
+ '& .MuiSelect-outlined': {
36
+ background: theme.palette.misc.rowHoverGreyOne,
37
+ borderColor: theme.palette.misc.altBackground,
38
+ color: theme.palette.text.disabled,
39
+ '-webkit-text-fill-color': theme.palette.text.disabled
40
+ },
41
+ '& .MuiOutlinedInput-notchedOutline': {
42
+ border: 'none'
43
+ }
44
+ },
45
+ '& .MuiSelect-iconOutlined': {
46
+ color: theme.palette.secondary.main
47
+ }
48
+ }
49
+ })
50
+ }
51
+ });
52
+ export default selectTheme;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritone-ce/design-system",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "start": "yarn storybook",