@veritone-ce/design-system 1.5.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.
- package/dist/assets/theme.js +30 -27
- package/dist/components/Input/Input.stories.d.ts +11 -0
- package/dist/components/Input/Input.stories.js +53 -0
- package/dist/components/Input/Input.theme.d.ts +3 -0
- package/dist/components/Input/Input.theme.js +98 -0
- package/dist/components/Input/__tests__/Input.test.d.ts +1 -0
- package/dist/components/Input/__tests__/Input.test.js +10 -0
- package/dist/components/Input/index.d.ts +6 -0
- package/dist/components/Input/index.js +20 -0
- package/dist/components/ProgressIndicator/DefaultProgress.d.ts +3 -0
- package/dist/components/ProgressIndicator/DefaultProgress.js +9 -0
- package/dist/components/ProgressIndicator/MLProgress.d.ts +3 -0
- package/dist/components/ProgressIndicator/MLProgress.js +13 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.stories.d.ts +7 -0
- package/dist/components/ProgressIndicator/ProgressIndicator.stories.js +42 -0
- package/dist/components/ProgressIndicator/__tests__/ProgressIndicator.test.d.ts +1 -0
- package/dist/components/ProgressIndicator/__tests__/ProgressIndicator.test.js +10 -0
- package/dist/components/ProgressIndicator/index.d.ts +11 -0
- package/dist/components/ProgressIndicator/index.js +22 -0
- package/dist/components/Select/Select.stories.d.ts +5 -0
- package/dist/components/Select/Select.stories.js +37 -0
- package/dist/components/Select/__tests__/Select.test.d.ts +1 -0
- package/dist/components/Select/__tests__/Select.test.js +19 -0
- package/dist/components/Select/index.d.ts +15 -0
- package/dist/components/Select/index.js +63 -0
- package/dist/components/Select/select.theme.d.ts +53 -0
- package/dist/components/Select/select.theme.js +52 -0
- package/package.json +1 -1
package/dist/assets/theme.js
CHANGED
|
@@ -3,6 +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';
|
|
7
|
+
import inputTheme from '../components/Input/Input.theme';
|
|
6
8
|
import sx from '@mui/system/sx';
|
|
7
9
|
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
8
10
|
import InfoIcon from '@mui/icons-material/Info';
|
|
@@ -83,8 +85,11 @@ let theme = createTheme({
|
|
|
83
85
|
},
|
|
84
86
|
spacing: 10
|
|
85
87
|
});
|
|
86
|
-
theme = createTheme(
|
|
88
|
+
theme = createTheme(theme, {
|
|
89
|
+
components: {
|
|
87
90
|
MuiButton: buttonTheme(theme),
|
|
91
|
+
MuiSelect: selectTheme(theme),
|
|
92
|
+
MuiTextField: inputTheme(theme),
|
|
88
93
|
MuiCheckbox: checkboxTheme(theme),
|
|
89
94
|
MuiRadio: radioButtonTheme(theme),
|
|
90
95
|
MuiInputLabel: {
|
|
@@ -131,31 +136,6 @@ theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
|
|
|
131
136
|
})
|
|
132
137
|
}
|
|
133
138
|
},
|
|
134
|
-
MuiTextField: {
|
|
135
|
-
defaultProps: {
|
|
136
|
-
size: 'small'
|
|
137
|
-
},
|
|
138
|
-
styleOverrides: {
|
|
139
|
-
root: sx({
|
|
140
|
-
color: colors.text.primary,
|
|
141
|
-
'& .MuiOutlinedInput-root': {
|
|
142
|
-
// TODO: Where did this color come from?
|
|
143
|
-
// '& fieldset': {
|
|
144
|
-
// borderColor: colors.light.five
|
|
145
|
-
// },
|
|
146
|
-
'&:hover fieldset': {
|
|
147
|
-
borderColor: theme.palette.secondary.main
|
|
148
|
-
},
|
|
149
|
-
'&.Mui-focused fieldset': {
|
|
150
|
-
border: `1px solid ${theme.palette.text.secondary}`
|
|
151
|
-
},
|
|
152
|
-
'&.Mui-error fieldset': {
|
|
153
|
-
borderColor: theme.palette.error.main
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
})
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
139
|
MuiStepIcon: {
|
|
160
140
|
styleOverrides: {
|
|
161
141
|
root: {
|
|
@@ -288,6 +268,29 @@ theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
|
|
|
288
268
|
paddingTop: theme.spacing(1)
|
|
289
269
|
}
|
|
290
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
|
+
}
|
|
291
293
|
}
|
|
292
|
-
}
|
|
294
|
+
}
|
|
295
|
+
});
|
|
293
296
|
export default theme;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ComponentStory, Story, ComponentMeta } from '@storybook/react';
|
|
2
|
+
import Input from '.';
|
|
3
|
+
declare const _default: ComponentMeta<({ ...TextFieldProps }: {
|
|
4
|
+
'data-testid'?: string | undefined;
|
|
5
|
+
} & import("@mui/material").TextFieldProps) => JSX.Element>;
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare const Default: ComponentStory<typeof Input> | Story;
|
|
8
|
+
export declare const Disabled: ComponentStory<typeof Input> | Story;
|
|
9
|
+
export declare const Error: ComponentStory<typeof Input> | Story;
|
|
10
|
+
export declare const Search: ComponentStory<typeof Input> | Story;
|
|
11
|
+
export declare const MultiLine: ComponentStory<typeof Input> | Story;
|
|
@@ -0,0 +1,53 @@
|
|
|
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 SearchIcon from '@mui/icons-material/Search';
|
|
14
|
+
import Input from '.';
|
|
15
|
+
import { Box, InputAdornment } from '@mui/material';
|
|
16
|
+
export default {
|
|
17
|
+
title: 'Components/Input',
|
|
18
|
+
component: Input,
|
|
19
|
+
argTypes: {
|
|
20
|
+
label: { control: 'text' },
|
|
21
|
+
helperText: { control: 'text' },
|
|
22
|
+
disabled: { control: 'boolean' },
|
|
23
|
+
error: { control: 'boolean' },
|
|
24
|
+
InputProps: { control: false },
|
|
25
|
+
margin: { control: false },
|
|
26
|
+
focused: { control: false },
|
|
27
|
+
ref: { control: false },
|
|
28
|
+
hiddenLabel: { control: false },
|
|
29
|
+
'data-testid': { control: false }
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const Default = (_a) => {
|
|
33
|
+
var args = __rest(_a, []);
|
|
34
|
+
return (_jsx(Box, { children: _jsx(Input, Object.assign({ value: "Input Text .paragraph1", label: "label.semibold 14/17", helperText: "Helper Text .paragraph3 (Optional)" }, args)) }));
|
|
35
|
+
};
|
|
36
|
+
export const Disabled = (_a) => {
|
|
37
|
+
var args = __rest(_a, []);
|
|
38
|
+
return (_jsx(Box, { children: _jsx(Input, Object.assign({ value: "Input Text .paragraph1", label: "label.semibold 14/17", disabled: true }, args)) }));
|
|
39
|
+
};
|
|
40
|
+
export const Error = (_a) => {
|
|
41
|
+
var args = __rest(_a, []);
|
|
42
|
+
return (_jsx(Box, { children: _jsx(Input, Object.assign({ value: "Input Text .paragraph1", label: "label.semibold 14/17", helperText: "Error Message", error: true }, args)) }));
|
|
43
|
+
};
|
|
44
|
+
export const Search = (_a) => {
|
|
45
|
+
var args = __rest(_a, []);
|
|
46
|
+
return (_jsx(Box, { children: _jsx(Input, Object.assign({ placeholder: "Search", label: "label.semibold 14/17", InputLabelProps: { shrink: true }, InputProps: {
|
|
47
|
+
startAdornment: (_jsx(InputAdornment, Object.assign({ position: "start" }, { children: _jsx(SearchIcon, {}) })))
|
|
48
|
+
} }, args)) }));
|
|
49
|
+
};
|
|
50
|
+
export const MultiLine = (_a) => {
|
|
51
|
+
var args = __rest(_a, []);
|
|
52
|
+
return (_jsx(Box, { children: _jsx(Input, Object.assign({ label: "label.semibold 14/17", multiline: true, rows: 4 }, args)) }));
|
|
53
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const inputTheme = (theme) => ({
|
|
2
|
+
defaultProps: {},
|
|
3
|
+
styleOverrides: {
|
|
4
|
+
root: () => ({
|
|
5
|
+
maxWidth: '300px',
|
|
6
|
+
display: 'flex',
|
|
7
|
+
gap: '3px',
|
|
8
|
+
'& .MuiInputLabel-root': {
|
|
9
|
+
position: 'initial',
|
|
10
|
+
transform: 'initial',
|
|
11
|
+
fontWeight: 600,
|
|
12
|
+
fontSize: '14px',
|
|
13
|
+
lineHeight: '20px',
|
|
14
|
+
color: theme.palette.neutral.main,
|
|
15
|
+
'&.Mui-focused': {
|
|
16
|
+
color: theme.palette.neutral.main
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
'& .MuiInputLabel-root.Mui-disabled': {
|
|
20
|
+
color: theme.palette.neutral.main
|
|
21
|
+
},
|
|
22
|
+
'& .MuiInputLabel-root.Mui-error': {
|
|
23
|
+
color: theme.palette.neutral.main
|
|
24
|
+
},
|
|
25
|
+
'& .MuiInputBase-root': {
|
|
26
|
+
padding: '0px 0px 4px',
|
|
27
|
+
height: '36px',
|
|
28
|
+
'& input': {
|
|
29
|
+
boxSizing: 'border-box',
|
|
30
|
+
height: '100%',
|
|
31
|
+
width: '100%',
|
|
32
|
+
padding: '8px',
|
|
33
|
+
fontFamily: 'Nunito Sans',
|
|
34
|
+
fontSize: '14px',
|
|
35
|
+
fontWeight: '400',
|
|
36
|
+
lineHeight: '20px',
|
|
37
|
+
color: theme.palette.text.primary,
|
|
38
|
+
border: 'none',
|
|
39
|
+
'&:disabled': {
|
|
40
|
+
background: theme.palette.action.disabledBackground,
|
|
41
|
+
borderColor: '#E0E8F0 !important'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
'& fieldset': {
|
|
45
|
+
border: `1px solid ${theme.palette.neutral.main}`,
|
|
46
|
+
borderRadius: '4px',
|
|
47
|
+
'&:focus': {
|
|
48
|
+
border: `2px solid ${theme.palette.secondary.main}`
|
|
49
|
+
},
|
|
50
|
+
'&:disabled': {
|
|
51
|
+
background: theme.palette.action.disabledBackground,
|
|
52
|
+
borderColor: '#E0E8F0 !important'
|
|
53
|
+
},
|
|
54
|
+
'& legend': {
|
|
55
|
+
display: 'none'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
'& .MuiInputBase-root.MuiInputBase-multiline': {
|
|
60
|
+
height: '157px',
|
|
61
|
+
border: 'none',
|
|
62
|
+
fontWeight: 400,
|
|
63
|
+
fontSize: '14px',
|
|
64
|
+
lineHeight: '20px',
|
|
65
|
+
'& textarea': {
|
|
66
|
+
boxSizing: 'border-box',
|
|
67
|
+
height: '100% !important',
|
|
68
|
+
width: '100%',
|
|
69
|
+
padding: '8px'
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
'& .MuiFormHelperText-root': {
|
|
73
|
+
fontWeight: 400,
|
|
74
|
+
fontSize: '12px',
|
|
75
|
+
lineHeight: '18px',
|
|
76
|
+
margin: 0,
|
|
77
|
+
color: theme.palette.action.disabled
|
|
78
|
+
},
|
|
79
|
+
'& .MuiFormHelperText-root.Mui-error': {
|
|
80
|
+
color: theme.palette.error.main
|
|
81
|
+
},
|
|
82
|
+
'& .Mui-error': {
|
|
83
|
+
'& input': {
|
|
84
|
+
border: 'none',
|
|
85
|
+
'&:focus': {
|
|
86
|
+
border: 'none'
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
'& .MuiInputAdornment-root': {
|
|
91
|
+
padding: '9px 2px 9px 8px',
|
|
92
|
+
marginRight: '0px',
|
|
93
|
+
color: theme.palette.text.tertiary
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
export default inputTheme;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 Input from '..';
|
|
5
|
+
describe('<Input />', () => {
|
|
6
|
+
it('should render the Input component', () => {
|
|
7
|
+
render(_jsx(Input, {}));
|
|
8
|
+
expect(screen.getByTestId('input-component')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
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 TextField from '@mui/material/TextField';
|
|
14
|
+
const Input = (_a) => {
|
|
15
|
+
var TextFieldProps = __rest(_a, []);
|
|
16
|
+
return (_jsx(TextField, Object.assign({ InputLabelProps: {
|
|
17
|
+
shrink: false
|
|
18
|
+
}, "data-testid": "input-component" }, TextFieldProps)));
|
|
19
|
+
};
|
|
20
|
+
export default Input;
|
|
@@ -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,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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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;
|