@veritone-ce/design-system 1.5.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 +2 -25
- 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
|
@@ -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 inputTheme from '../components/Input/Input.theme';
|
|
6
7
|
import sx from '@mui/system/sx';
|
|
7
8
|
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
8
9
|
import InfoIcon from '@mui/icons-material/Info';
|
|
@@ -85,6 +86,7 @@ let theme = createTheme({
|
|
|
85
86
|
});
|
|
86
87
|
theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
|
|
87
88
|
MuiButton: buttonTheme(theme),
|
|
89
|
+
MuiTextField: inputTheme(theme),
|
|
88
90
|
MuiCheckbox: checkboxTheme(theme),
|
|
89
91
|
MuiRadio: radioButtonTheme(theme),
|
|
90
92
|
MuiInputLabel: {
|
|
@@ -131,31 +133,6 @@ theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
|
|
|
131
133
|
})
|
|
132
134
|
}
|
|
133
135
|
},
|
|
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
136
|
MuiStepIcon: {
|
|
160
137
|
styleOverrides: {
|
|
161
138
|
root: {
|
|
@@ -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;
|