@veritone-ce/design-system 1.10.0 → 1.11.1
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 -0
- package/dist/components/Modal/Modal.stories.d.ts +15 -0
- package/dist/components/Modal/Modal.stories.js +100 -0
- package/dist/components/Modal/__tests__/Modal.test.d.ts +1 -0
- package/dist/components/Modal/__tests__/Modal.test.js +10 -0
- package/dist/components/Modal/index.d.ts +11 -0
- package/dist/components/Modal/index.js +18 -0
- package/dist/components/Modal/modal.theme.d.ts +3 -0
- package/dist/components/Modal/modal.theme.js +26 -0
- package/package.json +1 -1
package/dist/assets/theme.js
CHANGED
|
@@ -7,6 +7,7 @@ import statusChipTheme from '../components/StatusChip/statusChip.theme';
|
|
|
7
7
|
import selectTheme from '../components/Select/select.theme';
|
|
8
8
|
import tabsTheme from '../components/Tabs/tabs.theme';
|
|
9
9
|
import inputTheme from '../components/Input/input.theme';
|
|
10
|
+
import modalTheme from '../components/Modal/modal.theme';
|
|
10
11
|
import CheckCircleIcon from '@mui/icons-material/CheckCircle';
|
|
11
12
|
import InfoIcon from '@mui/icons-material/Info';
|
|
12
13
|
import WarningIcon from '@mui/icons-material/Error';
|
|
@@ -91,6 +92,7 @@ theme = createTheme(theme, {
|
|
|
91
92
|
MuiButton: buttonTheme(theme),
|
|
92
93
|
MuiSelect: selectTheme(theme),
|
|
93
94
|
MuiTextField: inputTheme(theme),
|
|
95
|
+
MuiDialog: modalTheme(theme),
|
|
94
96
|
MuiCheckbox: checkboxTheme(theme),
|
|
95
97
|
MuiRadio: radioButtonTheme(theme),
|
|
96
98
|
MuiTabs: tabsTheme(theme),
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ComponentStory, Story, ComponentMeta } from '@storybook/react';
|
|
3
|
+
import Modal from '.';
|
|
4
|
+
declare const _default: ComponentMeta<({ handleClose, isOpen, title, children, ...props }: {
|
|
5
|
+
'data-testid'?: string | undefined;
|
|
6
|
+
handleClose?: (() => void) | undefined;
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
title?: string | undefined;
|
|
9
|
+
height?: string | undefined;
|
|
10
|
+
children?: import("react").ReactNode;
|
|
11
|
+
}) => JSX.Element>;
|
|
12
|
+
export default _default;
|
|
13
|
+
export declare const Primary: ComponentStory<typeof Modal> | Story;
|
|
14
|
+
export declare const Destructive: ComponentStory<typeof Modal> | Story;
|
|
15
|
+
export declare const Disabled: ComponentStory<typeof Modal> | Story;
|
|
@@ -0,0 +1,100 @@
|
|
|
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 Modal from '.';
|
|
14
|
+
import Button from '../Button';
|
|
15
|
+
import Input from '../Input';
|
|
16
|
+
import { DialogActions, DialogContent, DialogContentText, useTheme } from '@mui/material';
|
|
17
|
+
export default {
|
|
18
|
+
title: 'Components/Modal',
|
|
19
|
+
component: Modal,
|
|
20
|
+
argTypes: {
|
|
21
|
+
isOpen: { control: 'boolean', defaultValue: true },
|
|
22
|
+
title: { control: 'text', defaultValue: 'Modal Title' }
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export const Primary = (_a) => {
|
|
26
|
+
var args = __rest(_a, []);
|
|
27
|
+
const { palette } = useTheme();
|
|
28
|
+
return (_jsxs(Modal, Object.assign({ isOpen: true, title: "Modal Title" }, args, { children: [_jsx(DialogContent, Object.assign({ sx: {
|
|
29
|
+
paddingBottom: '20px'
|
|
30
|
+
} }, { children: _jsx(DialogContentText, Object.assign({ id: "alert-dialog-description", sx: {
|
|
31
|
+
fontSize: '14px',
|
|
32
|
+
fontWeight: '400',
|
|
33
|
+
lineHeight: '20px',
|
|
34
|
+
color: palette.text.primary
|
|
35
|
+
} }, { children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse consequat id tortor et feugiat. Nulla facilisi. Quisque a dui sit amet tellus scelerisque laoreet." })) })), _jsxs(DialogActions, Object.assign({ sx: {
|
|
36
|
+
padding: '30px'
|
|
37
|
+
} }, { children: [_jsx(Button, Object.assign({ variant: "tertiary" }, { children: "Cancel" })), _jsx(Button, { children: "Action" })] }))] })));
|
|
38
|
+
};
|
|
39
|
+
export const Destructive = (_a) => {
|
|
40
|
+
var args = __rest(_a, []);
|
|
41
|
+
const { palette } = useTheme();
|
|
42
|
+
return (_jsxs(Modal, Object.assign({ isOpen: true, title: "Modal Title" }, args, { children: [_jsxs(DialogContent, Object.assign({ sx: {
|
|
43
|
+
paddingBottom: '5px'
|
|
44
|
+
} }, { children: [_jsx(DialogContentText, Object.assign({ id: "alert-dialog-description", sx: {
|
|
45
|
+
fontSize: '14px',
|
|
46
|
+
fontWeight: '400',
|
|
47
|
+
lineHeight: '20px',
|
|
48
|
+
color: palette.text.primary
|
|
49
|
+
} }, { children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse consequat id tortor et feugiat.." })), _jsxs(DialogContentText, Object.assign({ id: "alert-dialog-description", sx: {
|
|
50
|
+
fontSize: '14px',
|
|
51
|
+
fontWeight: '400',
|
|
52
|
+
lineHeight: '20px',
|
|
53
|
+
color: palette.text.primary,
|
|
54
|
+
marginTop: '15px'
|
|
55
|
+
} }, { children: ["To continue, type ", _jsx("b", { children: "DELETE" }), " in the box to confirm."] })), _jsx(Input, { value: "DELETE", sx: {
|
|
56
|
+
'& .MuiOutlinedInput-root': {
|
|
57
|
+
width: '157px',
|
|
58
|
+
marginTop: '10px'
|
|
59
|
+
},
|
|
60
|
+
'& .MuiInputBase-root input': {
|
|
61
|
+
fontSize: '14px',
|
|
62
|
+
fontWeight: 700,
|
|
63
|
+
lineHeight: '20px',
|
|
64
|
+
color: '#5C6269'
|
|
65
|
+
}
|
|
66
|
+
} })] })), _jsxs(DialogActions, Object.assign({ sx: {
|
|
67
|
+
padding: '14px 30px 20px'
|
|
68
|
+
} }, { children: [_jsx(Button, Object.assign({ variant: "tertiary" }, { children: "Cancel" })), _jsx(Button, Object.assign({ color: "error" }, { children: "Delete" }))] }))] })));
|
|
69
|
+
};
|
|
70
|
+
export const Disabled = (_a) => {
|
|
71
|
+
var args = __rest(_a, []);
|
|
72
|
+
const { palette } = useTheme();
|
|
73
|
+
return (_jsxs(Modal, Object.assign({ isOpen: true, title: "Modal Title" }, args, { children: [_jsxs(DialogContent, Object.assign({ sx: {
|
|
74
|
+
paddingBottom: '5px'
|
|
75
|
+
} }, { children: [_jsx(DialogContentText, Object.assign({ id: "alert-dialog-description", sx: {
|
|
76
|
+
fontSize: '14px',
|
|
77
|
+
fontWeight: '400',
|
|
78
|
+
lineHeight: '20px',
|
|
79
|
+
color: palette.text.primary
|
|
80
|
+
} }, { children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse consequat id tortor et feugiat.." })), _jsxs(DialogContentText, Object.assign({ id: "alert-dialog-description", sx: {
|
|
81
|
+
fontSize: '14px',
|
|
82
|
+
fontWeight: '400',
|
|
83
|
+
lineHeight: '20px',
|
|
84
|
+
color: palette.text.primary,
|
|
85
|
+
marginTop: '15px'
|
|
86
|
+
} }, { children: ["To continue, type ", _jsx("b", { children: "DELETE" }), " in the box to confirm."] })), _jsx(Input, { sx: {
|
|
87
|
+
'& .MuiOutlinedInput-root': {
|
|
88
|
+
width: '157px',
|
|
89
|
+
marginTop: '10px'
|
|
90
|
+
},
|
|
91
|
+
'& .MuiInputBase-root input': {
|
|
92
|
+
fontSize: '14px',
|
|
93
|
+
fontWeight: 700,
|
|
94
|
+
lineHeight: '20px',
|
|
95
|
+
color: palette.neutral.main
|
|
96
|
+
}
|
|
97
|
+
} })] })), _jsxs(DialogActions, Object.assign({ sx: {
|
|
98
|
+
padding: '14px 30px 20px'
|
|
99
|
+
} }, { children: [_jsx(Button, Object.assign({ variant: "tertiary" }, { children: "Cancel" })), _jsx(Button, Object.assign({ color: "error", disabled: true }, { children: "Delete" }))] }))] })));
|
|
100
|
+
};
|
|
@@ -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 Modal from '..';
|
|
5
|
+
describe('<Modal />', () => {
|
|
6
|
+
it('should render the Modal component', () => {
|
|
7
|
+
render(_jsx(Modal, { "data-testid": "modal", isOpen: true }));
|
|
8
|
+
expect(screen.getByTestId('modal')).toBeInTheDocument();
|
|
9
|
+
});
|
|
10
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ModalProps = {
|
|
3
|
+
'data-testid'?: string;
|
|
4
|
+
handleClose?: () => void;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
title?: string;
|
|
7
|
+
height?: string;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare const Modal: ({ handleClose, isOpen, title, children, ...props }: ModalProps) => JSX.Element;
|
|
11
|
+
export default Modal;
|
|
@@ -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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Dialog, DialogTitle } from '@mui/material';
|
|
14
|
+
const Modal = (_a) => {
|
|
15
|
+
var { handleClose, isOpen, title, children } = _a, props = __rest(_a, ["handleClose", "isOpen", "title", "children"]);
|
|
16
|
+
return (_jsxs(Dialog, Object.assign({}, props, { open: isOpen, onClose: handleClose, "aria-labelledby": "alert-dialog-title", "aria-describedby": "alert-dialog-description" }, { children: [_jsx(DialogTitle, Object.assign({ id: "alert-dialog-title" }, { children: title })), children] })));
|
|
17
|
+
};
|
|
18
|
+
export default Modal;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const modalTheme = (theme) => ({
|
|
2
|
+
defaultProps: {},
|
|
3
|
+
styleOverrides: {
|
|
4
|
+
root: () => ({
|
|
5
|
+
borderRadius: '4px',
|
|
6
|
+
'& .MuiBackdrop-root': {
|
|
7
|
+
backgroundColor: theme.palette.neutral.main
|
|
8
|
+
},
|
|
9
|
+
margin: 'auto',
|
|
10
|
+
'& .MuiPaper-root': {
|
|
11
|
+
margin: '0px',
|
|
12
|
+
boxShadow: `
|
|
13
|
+
0px 4px 34px
|
|
14
|
+
${theme.palette.text.primary}`,
|
|
15
|
+
width: '410px'
|
|
16
|
+
},
|
|
17
|
+
'& .MuiDialogTitle-root': {
|
|
18
|
+
fontSize: '18px',
|
|
19
|
+
fontWeight: '600',
|
|
20
|
+
lineHeight: '24px',
|
|
21
|
+
color: theme.palette.text.primary
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export default modalTheme;
|