@veritone-ce/design-system 1.4.0 → 1.6.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 +16 -25
- package/dist/components/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/components/Checkbox/Checkbox.stories.js +19 -0
- package/dist/components/Checkbox/__tests__/Checkbox.test.d.ts +1 -0
- package/dist/components/Checkbox/__tests__/Checkbox.test.js +10 -0
- package/dist/components/Checkbox/checkbox.theme.d.ts +18 -0
- package/dist/components/Checkbox/checkbox.theme.js +17 -0
- package/dist/components/Checkbox/index.d.ts +7 -0
- package/dist/components/Checkbox/index.js +18 -0
- 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/package.json +1 -1
package/dist/assets/theme.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createTheme } from '@mui/material';
|
|
3
|
+
import checkboxTheme from '../components/Checkbox/checkbox.theme';
|
|
3
4
|
import radioButtonTheme from '../components/RadioButton/RadioButton.theme';
|
|
4
5
|
import buttonTheme from '../components/Button/button.theme';
|
|
6
|
+
import inputTheme from '../components/Input/Input.theme';
|
|
5
7
|
import sx from '@mui/system/sx';
|
|
6
8
|
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
7
9
|
import InfoIcon from '@mui/icons-material/Info';
|
|
@@ -84,6 +86,8 @@ let theme = createTheme({
|
|
|
84
86
|
});
|
|
85
87
|
theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
|
|
86
88
|
MuiButton: buttonTheme(theme),
|
|
89
|
+
MuiTextField: inputTheme(theme),
|
|
90
|
+
MuiCheckbox: checkboxTheme(theme),
|
|
87
91
|
MuiRadio: radioButtonTheme(theme),
|
|
88
92
|
MuiInputLabel: {
|
|
89
93
|
styleOverrides: {
|
|
@@ -95,6 +99,18 @@ theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
|
|
|
95
99
|
})
|
|
96
100
|
}
|
|
97
101
|
},
|
|
102
|
+
MuiFormControlLabel: {
|
|
103
|
+
styleOverrides: {
|
|
104
|
+
root: sx({
|
|
105
|
+
'& .MuiFormControlLabel-label': {
|
|
106
|
+
color: theme.palette.text.secondary
|
|
107
|
+
},
|
|
108
|
+
'& .MuiFormControlLabel-label.Mui-disabled': {
|
|
109
|
+
color: theme.palette.text.disabled
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
},
|
|
98
114
|
MuiFormHelperText: {
|
|
99
115
|
styleOverrides: {
|
|
100
116
|
root: sx({
|
|
@@ -117,31 +133,6 @@ theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
|
|
|
117
133
|
})
|
|
118
134
|
}
|
|
119
135
|
},
|
|
120
|
-
MuiTextField: {
|
|
121
|
-
defaultProps: {
|
|
122
|
-
size: 'small'
|
|
123
|
-
},
|
|
124
|
-
styleOverrides: {
|
|
125
|
-
root: sx({
|
|
126
|
-
color: colors.text.primary,
|
|
127
|
-
'& .MuiOutlinedInput-root': {
|
|
128
|
-
// TODO: Where did this color come from?
|
|
129
|
-
// '& fieldset': {
|
|
130
|
-
// borderColor: colors.light.five
|
|
131
|
-
// },
|
|
132
|
-
'&:hover fieldset': {
|
|
133
|
-
borderColor: theme.palette.secondary.main
|
|
134
|
-
},
|
|
135
|
-
'&.Mui-focused fieldset': {
|
|
136
|
-
border: `1px solid ${theme.palette.text.secondary}`
|
|
137
|
-
},
|
|
138
|
-
'&.Mui-error fieldset': {
|
|
139
|
-
borderColor: theme.palette.error.main
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
})
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
136
|
MuiStepIcon: {
|
|
146
137
|
styleOverrides: {
|
|
147
138
|
root: {
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
|
+
declare const _default: ComponentMeta<({ label, ...props }: import(".").CheckboxProps) => JSX.Element>;
|
|
3
|
+
export default _default;
|
|
4
|
+
export declare const Default: ComponentStory<({ label, ...props }: import(".").CheckboxProps) => JSX.Element>;
|
|
5
|
+
export declare const WithoutLabel: ComponentStory<({ label, ...props }: import(".").CheckboxProps) => JSX.Element>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import Checkbox from '.';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Components/Checkbox',
|
|
7
|
+
component: Checkbox
|
|
8
|
+
};
|
|
9
|
+
const Template = (args) => (_jsx(Box, Object.assign({ sx: {
|
|
10
|
+
display: `grid`,
|
|
11
|
+
gridTemplateRows: `repeat(5, min-content)`,
|
|
12
|
+
gap: 2
|
|
13
|
+
} }, { children: _jsxs(React.Fragment, { children: [_jsx(Checkbox, Object.assign({}, args)), _jsx(Checkbox, Object.assign({}, args, { checked: true })), _jsx(Checkbox, Object.assign({}, args, { indeterminate: true })), _jsx(Checkbox, Object.assign({}, args, { disabled: true })), _jsx(Checkbox, Object.assign({}, args, { disabled: true, checked: true }))] }) })));
|
|
14
|
+
export const Default = Template.bind({});
|
|
15
|
+
Default.args = {
|
|
16
|
+
label: 'Label'
|
|
17
|
+
};
|
|
18
|
+
export const WithoutLabel = Template.bind({});
|
|
19
|
+
WithoutLabel.args = {};
|
|
@@ -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 Checkbox from '..';
|
|
5
|
+
describe('<Checkbox />', () => {
|
|
6
|
+
it('should render the Checkbox component', () => {
|
|
7
|
+
render(_jsx(Checkbox, { "data-testid": "checkbox" }));
|
|
8
|
+
expect(screen.getByTestId('checkbox')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Theme } from '../../assets/theme';
|
|
2
|
+
declare const checkboxTheme: (theme: Theme) => {
|
|
3
|
+
styleOverrides: {
|
|
4
|
+
root: () => {
|
|
5
|
+
marginRight: string;
|
|
6
|
+
'&.MuiCheckbox-root': {
|
|
7
|
+
color: string;
|
|
8
|
+
};
|
|
9
|
+
'&.Mui-checked, &.MuiCheckbox-indeterminate': {
|
|
10
|
+
color: string;
|
|
11
|
+
};
|
|
12
|
+
'&.Mui-disabled': {
|
|
13
|
+
color: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export default checkboxTheme;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const checkboxTheme = (theme) => ({
|
|
2
|
+
styleOverrides: {
|
|
3
|
+
root: () => ({
|
|
4
|
+
marginRight: '8px',
|
|
5
|
+
'&.MuiCheckbox-root': {
|
|
6
|
+
color: theme.palette.text.secondary
|
|
7
|
+
},
|
|
8
|
+
'&.Mui-checked, &.MuiCheckbox-indeterminate': {
|
|
9
|
+
color: theme.palette.button.main
|
|
10
|
+
},
|
|
11
|
+
'&.Mui-disabled': {
|
|
12
|
+
color: theme.palette.text.disabled
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export default checkboxTheme;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CheckboxProps as MuiCheckboxProps } from '@mui/material';
|
|
2
|
+
export declare type CheckboxProps = {
|
|
3
|
+
'data-testid'?: string;
|
|
4
|
+
label?: string | undefined;
|
|
5
|
+
} & MuiCheckboxProps;
|
|
6
|
+
declare const Checkbox: ({ label, ...props }: CheckboxProps) => JSX.Element;
|
|
7
|
+
export default Checkbox;
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { FormControlLabel, Checkbox as MuiCheckbox } from '@mui/material';
|
|
14
|
+
const Checkbox = (_a) => {
|
|
15
|
+
var { label } = _a, props = __rest(_a, ["label"]);
|
|
16
|
+
return _jsx(FormControlLabel, { label: label, control: _jsx(MuiCheckbox, Object.assign({}, props)) });
|
|
17
|
+
};
|
|
18
|
+
export default Checkbox;
|
|
@@ -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;
|