@veritone-ce/design-system 1.3.1 → 1.5.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 -0
- 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/RadioButton/RadioButton.stories.d.ts +10 -0
- package/dist/components/RadioButton/RadioButton.stories.js +29 -0
- package/dist/components/RadioButton/RadioButton.theme.d.ts +4 -0
- package/dist/components/RadioButton/RadioButton.theme.js +53 -0
- package/dist/components/RadioButton/__tests__/RadioButton.test.d.ts +1 -0
- package/dist/components/RadioButton/__tests__/RadioButton.test.js +10 -0
- package/dist/components/RadioButton/index.d.ts +7 -0
- package/dist/components/RadioButton/index.js +30 -0
- package/package.json +1 -1
package/dist/assets/theme.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
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';
|
|
4
|
+
import radioButtonTheme from '../components/RadioButton/RadioButton.theme';
|
|
3
5
|
import buttonTheme from '../components/Button/button.theme';
|
|
4
6
|
import sx from '@mui/system/sx';
|
|
5
7
|
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
@@ -83,6 +85,8 @@ let theme = createTheme({
|
|
|
83
85
|
});
|
|
84
86
|
theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
|
|
85
87
|
MuiButton: buttonTheme(theme),
|
|
88
|
+
MuiCheckbox: checkboxTheme(theme),
|
|
89
|
+
MuiRadio: radioButtonTheme(theme),
|
|
86
90
|
MuiInputLabel: {
|
|
87
91
|
styleOverrides: {
|
|
88
92
|
root: sx({
|
|
@@ -93,6 +97,18 @@ theme = createTheme(Object.assign(Object.assign({}, theme), { components: {
|
|
|
93
97
|
})
|
|
94
98
|
}
|
|
95
99
|
},
|
|
100
|
+
MuiFormControlLabel: {
|
|
101
|
+
styleOverrides: {
|
|
102
|
+
root: sx({
|
|
103
|
+
'& .MuiFormControlLabel-label': {
|
|
104
|
+
color: theme.palette.text.secondary
|
|
105
|
+
},
|
|
106
|
+
'& .MuiFormControlLabel-label.Mui-disabled': {
|
|
107
|
+
color: theme.palette.text.disabled
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
}
|
|
111
|
+
},
|
|
96
112
|
MuiFormHelperText: {
|
|
97
113
|
styleOverrides: {
|
|
98
114
|
root: sx({
|
|
@@ -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,10 @@
|
|
|
1
|
+
import { ComponentStory, Story, ComponentMeta } from '@storybook/react';
|
|
2
|
+
import RadioButton from '.';
|
|
3
|
+
declare const _default: ComponentMeta<({ label, ...props }: {
|
|
4
|
+
'data-testid'?: string | undefined;
|
|
5
|
+
label?: string | undefined;
|
|
6
|
+
} & import("@mui/material").RadioProps) => JSX.Element>;
|
|
7
|
+
export default _default;
|
|
8
|
+
export declare const Default: ComponentStory<typeof RadioButton> | Story;
|
|
9
|
+
export declare const Checked: ComponentStory<typeof RadioButton> | Story;
|
|
10
|
+
export declare const Disabled: ComponentStory<typeof RadioButton> | Story;
|
|
@@ -0,0 +1,29 @@
|
|
|
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 RadioButton from '.';
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Components/RadioButton',
|
|
16
|
+
component: RadioButton
|
|
17
|
+
};
|
|
18
|
+
export const Default = (_a) => {
|
|
19
|
+
var args = __rest(_a, []);
|
|
20
|
+
return _jsx(RadioButton, Object.assign({ label: "Label" }, args));
|
|
21
|
+
};
|
|
22
|
+
export const Checked = (_a) => {
|
|
23
|
+
var args = __rest(_a, []);
|
|
24
|
+
return _jsx(RadioButton, Object.assign({ label: "Label", checked: true }, args));
|
|
25
|
+
};
|
|
26
|
+
export const Disabled = (_a) => {
|
|
27
|
+
var args = __rest(_a, []);
|
|
28
|
+
return _jsx(RadioButton, Object.assign({ label: "Label", disabled: true }, args));
|
|
29
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const radioButtonTheme = (theme) => ({
|
|
2
|
+
defaultProps: {
|
|
3
|
+
disableFocusRipple: true,
|
|
4
|
+
disableTouchRipple: true,
|
|
5
|
+
disableRipple: true
|
|
6
|
+
},
|
|
7
|
+
styleOverrides: {
|
|
8
|
+
root: () => ({
|
|
9
|
+
display: 'flex',
|
|
10
|
+
width: 'fit-content',
|
|
11
|
+
height: 'fit-content',
|
|
12
|
+
padding: '8px',
|
|
13
|
+
'&:hover': {
|
|
14
|
+
backgroundColor: 'transparent'
|
|
15
|
+
},
|
|
16
|
+
'& .MuiSvgIcon-root': {
|
|
17
|
+
boxSizing: 'border-box',
|
|
18
|
+
borderRadius: '50%'
|
|
19
|
+
},
|
|
20
|
+
'&.Mui-checked': {
|
|
21
|
+
'& .MuiSvgIcon-root:nth-of-type(1)': {
|
|
22
|
+
border: `1px solid ${theme.palette.button.main}`
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
'& .MuiSvgIcon-root:nth-of-type(1)': {
|
|
26
|
+
boxSizing: 'border-box',
|
|
27
|
+
fontSize: 18,
|
|
28
|
+
color: 'transparent',
|
|
29
|
+
border: `1px solid ${theme.palette.text.secondary}`,
|
|
30
|
+
transition: 'border-color 0.2s'
|
|
31
|
+
},
|
|
32
|
+
'& .MuiSvgIcon-root:nth-of-type(2)': {
|
|
33
|
+
boxSizing: 'border-box',
|
|
34
|
+
width: 'auto',
|
|
35
|
+
height: 'auto',
|
|
36
|
+
color: 'transparent',
|
|
37
|
+
background: theme.palette.button.main,
|
|
38
|
+
margin: '3.37px 3.38px',
|
|
39
|
+
transition: 'background 0.2s'
|
|
40
|
+
},
|
|
41
|
+
'&.Mui-disabled': {
|
|
42
|
+
'& .MuiSvgIcon-root:nth-of-type(1)': {
|
|
43
|
+
border: `1px solid ${theme.palette.text.disabled}`
|
|
44
|
+
},
|
|
45
|
+
'& .MuiSvgIcon-root:nth-of-type(2)': {
|
|
46
|
+
transform: 'scale(1)',
|
|
47
|
+
background: theme.palette.text.disabled
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export default radioButtonTheme;
|
|
@@ -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 RadioButton from '..';
|
|
5
|
+
describe('<RadioButton />', () => {
|
|
6
|
+
it('should render the RadioButton component', () => {
|
|
7
|
+
render(_jsx(RadioButton, {}));
|
|
8
|
+
expect(screen.getByTestId('radio-button')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
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, Radio } from '@mui/material';
|
|
14
|
+
const RadioButton = (_a) => {
|
|
15
|
+
var { label } = _a, props = __rest(_a, ["label"]);
|
|
16
|
+
return (_jsx(FormControlLabel, { label: label, sx: {
|
|
17
|
+
margin: 0,
|
|
18
|
+
height: '36px',
|
|
19
|
+
color: (theme) => theme.palette.text.secondary,
|
|
20
|
+
'& .MuiTypography-root': {
|
|
21
|
+
lineHeight: '24px'
|
|
22
|
+
},
|
|
23
|
+
'&.Mui-disabled': {
|
|
24
|
+
'& .MuiTypography-root': {
|
|
25
|
+
color: (theme) => theme.palette.text.disabled
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}, control: _jsx(Radio, Object.assign({ "data-testid": "radio-button" }, props)) }));
|
|
29
|
+
};
|
|
30
|
+
export default RadioButton;
|