@veritone-ce/design-system 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ 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
8
  import sx from '@mui/system/sx';
8
9
  import CheckCircleIcon from '@mui/icons-material/CheckCircle';
@@ -84,8 +85,10 @@ let theme = createTheme({
84
85
  },
85
86
  spacing: 10
86
87
  });
87
- theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
88
+ theme = createTheme(theme, {
89
+ components: {
88
90
  MuiButton: buttonTheme(theme),
91
+ MuiSelect: selectTheme(theme),
89
92
  MuiTextField: inputTheme(theme),
90
93
  MuiCheckbox: checkboxTheme(theme),
91
94
  MuiRadio: radioButtonTheme(theme),
@@ -265,6 +268,29 @@ theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
265
268
  paddingTop: theme.spacing(1)
266
269
  }
267
270
  }
271
+ },
272
+ MuiDataGrid: {
273
+ styleOverrides: {
274
+ root: {
275
+ '& .MuiDataGrid-columnHeader:focus': {
276
+ outline: 0
277
+ },
278
+ '& .MuiDataGrid-cell:focus': {
279
+ outline: 0
280
+ }
281
+ }
282
+ }
283
+ },
284
+ MuiPaper: {
285
+ styleOverrides: {
286
+ root: {
287
+ '&.MuiMenu-paper': {
288
+ border: '1px solid ' + theme.palette.text.disabled,
289
+ boxShadow: 'none'
290
+ }
291
+ }
292
+ }
268
293
  }
269
- } }));
294
+ }
295
+ });
270
296
  export default theme;
@@ -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.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "start": "yarn storybook",