@zesty-io/material 0.12.0 → 0.12.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/es/theme/index.js +4 -1
- package/package.json +1 -1
- package/cjs/ConfirmDialog/ConfirmDialog.stories.d.ts +0 -6
- package/cjs/ConfirmDialog/ConfirmDialog.stories.js +0 -27
- package/cjs/ConfirmDialog/index.d.ts +0 -18
- package/cjs/ConfirmDialog/index.js +0 -13
- package/cjs/CopyButton/CopyButton.stories.d.ts +0 -5
- package/cjs/CopyButton/CopyButton.stories.js +0 -17
- package/cjs/CopyButton/index.d.ts +0 -10
- package/cjs/CopyButton/index.js +0 -28
- package/cjs/FieldTypeColor/FieldTypeColor.stories.d.ts +0 -5
- package/cjs/FieldTypeColor/FieldTypeColor.stories.js +0 -24
- package/cjs/FieldTypeColor/index.d.ts +0 -6
- package/cjs/FieldTypeColor/index.js +0 -18
- package/cjs/FieldTypeDate/FieldTypeDate.stories.d.ts +0 -5
- package/cjs/FieldTypeDate/FieldTypeDate.stories.js +0 -20
- package/cjs/FieldTypeDate/index.d.ts +0 -9
- package/cjs/FieldTypeDate/index.js +0 -12
- package/cjs/FieldTypeDateTime/FieldTypeDateTime.stories.d.ts +0 -5
- package/cjs/FieldTypeDateTime/FieldTypeDateTime.stories.js +0 -20
- package/cjs/FieldTypeDateTime/index.d.ts +0 -9
- package/cjs/FieldTypeDateTime/index.js +0 -12
- package/cjs/FieldTypeNumber/FieldTypeNumber.stories.d.ts +0 -5
- package/cjs/FieldTypeNumber/FieldTypeNumber.stories.js +0 -24
- package/cjs/FieldTypeNumber/index.d.ts +0 -6
- package/cjs/FieldTypeNumber/index.js +0 -9
- package/cjs/FieldTypeOneToMany/FieldTypeOneToMany.stories.d.ts +0 -5
- package/cjs/FieldTypeOneToMany/FieldTypeOneToMany.stories.js +0 -31
- package/cjs/FieldTypeOneToMany/index.d.ts +0 -32
- package/cjs/FieldTypeOneToMany/index.js +0 -31
- package/cjs/FieldTypeOneToOne/FieldTypeOneToOne.stories.d.ts +0 -5
- package/cjs/FieldTypeOneToOne/FieldTypeOneToOne.stories.js +0 -31
- package/cjs/FieldTypeOneToOne/index.d.ts +0 -34
- package/cjs/FieldTypeOneToOne/index.js +0 -35
- package/cjs/FieldTypeSort/FieldTypeSort.stories.d.ts +0 -5
- package/cjs/FieldTypeSort/FieldTypeSort.stories.js +0 -25
- package/cjs/FieldTypeSort/index.d.ts +0 -7
- package/cjs/FieldTypeSort/index.js +0 -36
- package/cjs/FieldTypeText/FieldTypeText.stories.d.ts +0 -6
- package/cjs/FieldTypeText/FieldTypeText.stories.js +0 -32
- package/cjs/FieldTypeText/index.d.ts +0 -12
- package/cjs/FieldTypeText/index.js +0 -9
- package/cjs/FieldTypeUrl/FieldTypeUrl.stories.d.ts +0 -5
- package/cjs/FieldTypeUrl/FieldTypeUrl.stories.js +0 -24
- package/cjs/FieldTypeUrl/index.d.ts +0 -12
- package/cjs/FieldTypeUrl/index.js +0 -16
- package/cjs/LegacyTheme/index.d.ts +0 -3
- package/cjs/LegacyTheme/index.js +0 -83
- package/cjs/LegacyTheme/palette.d.ts +0 -3
- package/cjs/LegacyTheme/palette.js +0 -25
- package/cjs/LegacyTheme/typography.d.ts +0 -3
- package/cjs/LegacyTheme/typography.js +0 -6
- package/cjs/VitualizedAutocomplete/VirtualizedAutocomplete.stories.d.ts +0 -5
- package/cjs/VitualizedAutocomplete/VirtualizedAutocomplete.stories.js +0 -30
- package/cjs/VitualizedAutocomplete/index.d.ts +0 -28
- package/cjs/VitualizedAutocomplete/index.js +0 -23
- package/cjs/index.d.ts +0 -14
- package/cjs/index.js +0 -31
- package/cjs/theme/Theme.stories.d.ts +0 -4
- package/cjs/theme/Theme.stories.js +0 -13
- package/cjs/theme/index.d.ts +0 -3
- package/cjs/theme/index.js +0 -52
- package/cjs/theme/palette.d.ts +0 -15
- package/cjs/theme/palette.js +0 -138
- package/cjs/theme/typography.d.ts +0 -9
- package/cjs/theme/typography.js +0 -59
- package/cjs/utils/virtualization.d.ts +0 -2
- package/cjs/utils/virtualization.js +0 -66
- package/es/ConfirmModal/ConfirmModal.stories.d.ts +0 -6
- package/es/ConfirmModal/ConfirmModal.stories.js +0 -24
- package/es/ConfirmModal/index.d.ts +0 -18
- package/es/ConfirmModal/index.js +0 -11
- package/es/FieldTypeDropdown/FieldTypeDropwdon.stories.d.ts +0 -5
- package/es/FieldTypeDropdown/FieldTypeDropwdon.stories.js +0 -35
- package/es/FieldTypeDropdown/index.d.ts +0 -11
- package/es/FieldTypeDropdown/index.js +0 -10
- package/es/stories/Theme.stories.d.ts +0 -4
- package/es/stories/Theme.stories.js +0 -10
package/cjs/theme/palette.js
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const palette = {
|
|
4
|
-
primary: {
|
|
5
|
-
main: "#FF5D03",
|
|
6
|
-
dark: "#EC4A0A",
|
|
7
|
-
light: "#FD853A",
|
|
8
|
-
},
|
|
9
|
-
success: {
|
|
10
|
-
main: "#12B76A",
|
|
11
|
-
dark: "#027A48",
|
|
12
|
-
light: "#D1FADF",
|
|
13
|
-
},
|
|
14
|
-
warning: {
|
|
15
|
-
main: "#F79009",
|
|
16
|
-
dark: "B54708",
|
|
17
|
-
light: "#FEF0C7",
|
|
18
|
-
},
|
|
19
|
-
error: {
|
|
20
|
-
main: "#F04438",
|
|
21
|
-
dark: "#B42318",
|
|
22
|
-
light: "#FECDCA",
|
|
23
|
-
},
|
|
24
|
-
info: {
|
|
25
|
-
main: "#0BA5EC",
|
|
26
|
-
dark: "#026AA2",
|
|
27
|
-
light: "#7CD4FD",
|
|
28
|
-
},
|
|
29
|
-
text: {
|
|
30
|
-
primary: "#101828",
|
|
31
|
-
secondary: "#475467",
|
|
32
|
-
},
|
|
33
|
-
grey: {
|
|
34
|
-
50: "#F9FAFB",
|
|
35
|
-
100: "#F2F4F7",
|
|
36
|
-
200: "#E4E7EC",
|
|
37
|
-
300: "#D0D5DD",
|
|
38
|
-
400: "#98A2B3",
|
|
39
|
-
500: "#667085",
|
|
40
|
-
600: "#475467",
|
|
41
|
-
700: "#344054",
|
|
42
|
-
800: "#1D2939",
|
|
43
|
-
900: "#101828",
|
|
44
|
-
},
|
|
45
|
-
deepPurple: {
|
|
46
|
-
50: '#F8F9FC',
|
|
47
|
-
100: '#EAECF5',
|
|
48
|
-
200: '#C8CCE5',
|
|
49
|
-
300: '#9EA5D1',
|
|
50
|
-
400: "#4E5BA6",
|
|
51
|
-
500: '#4E5BA6',
|
|
52
|
-
600: '#3E4784',
|
|
53
|
-
700: '#363F72',
|
|
54
|
-
800: '#293056',
|
|
55
|
-
900: '#101323'
|
|
56
|
-
},
|
|
57
|
-
deepOrange: {
|
|
58
|
-
50: "#FFF6ED",
|
|
59
|
-
100: "#FFEAD5",
|
|
60
|
-
200: "#FDDCAB",
|
|
61
|
-
300: "#FEB273",
|
|
62
|
-
400: "#FD853A",
|
|
63
|
-
500: "#FF5C08",
|
|
64
|
-
600: "#EC4A0A",
|
|
65
|
-
700: "#C4320A",
|
|
66
|
-
800: "#9C2A10",
|
|
67
|
-
900: "#7E2410",
|
|
68
|
-
},
|
|
69
|
-
red: {
|
|
70
|
-
50: '#FEF3F2',
|
|
71
|
-
100: '#FEE4E2',
|
|
72
|
-
200: '#FECDCA',
|
|
73
|
-
300: '#FDA29B',
|
|
74
|
-
400: '#F97066',
|
|
75
|
-
500: '#F04438',
|
|
76
|
-
600: '#D92D20',
|
|
77
|
-
700: '#B42318',
|
|
78
|
-
800: '#912018',
|
|
79
|
-
900: '#7A271A',
|
|
80
|
-
},
|
|
81
|
-
pink: {
|
|
82
|
-
50: '#FDF2FA',
|
|
83
|
-
100: '#FCE7F6',
|
|
84
|
-
200: '#FCCEEE',
|
|
85
|
-
300: '#FAA7E0',
|
|
86
|
-
400: "#F670C7",
|
|
87
|
-
500: '#EE46BC',
|
|
88
|
-
600: '#DD2590',
|
|
89
|
-
700: '#C11574',
|
|
90
|
-
800: '#9E165F',
|
|
91
|
-
900: '#851651',
|
|
92
|
-
},
|
|
93
|
-
blue: {
|
|
94
|
-
50: '#F0F9FF',
|
|
95
|
-
100: "#E0F2FE",
|
|
96
|
-
200: '#B9E6FE',
|
|
97
|
-
300: '#7CD4FD',
|
|
98
|
-
400: "#36BFFA",
|
|
99
|
-
500: '#0BA5EC',
|
|
100
|
-
600: '#0086C9',
|
|
101
|
-
700: '#026AA2',
|
|
102
|
-
800: '#065986',
|
|
103
|
-
900: '#0B4A6F',
|
|
104
|
-
},
|
|
105
|
-
green: {
|
|
106
|
-
50: '#ECFDF3',
|
|
107
|
-
100: "#D1FADF",
|
|
108
|
-
200: '#A6F4C5',
|
|
109
|
-
300: '#6CE9A6',
|
|
110
|
-
400: "#32D583",
|
|
111
|
-
500: '#12B76A',
|
|
112
|
-
600: '#039855',
|
|
113
|
-
700: '#027A48',
|
|
114
|
-
800: '#05603A',
|
|
115
|
-
900: '#054F31',
|
|
116
|
-
},
|
|
117
|
-
purple: {
|
|
118
|
-
50: '#F3E5F5',
|
|
119
|
-
100: '#E1BEE7',
|
|
120
|
-
200: '#CE93D8',
|
|
121
|
-
300: '#BA68C8',
|
|
122
|
-
400: '#AB47BC',
|
|
123
|
-
500: '#9C27B0',
|
|
124
|
-
600: '#8E24AA',
|
|
125
|
-
700: '#7B1FA2',
|
|
126
|
-
800: '#6A1B9A',
|
|
127
|
-
900: '#4A148C',
|
|
128
|
-
},
|
|
129
|
-
action: {
|
|
130
|
-
active: "rgba(16, 24, 40, 0.40)",
|
|
131
|
-
hover: "rgba(16, 24, 40, 0.04)",
|
|
132
|
-
selected: "rgba(16, 24, 40, 0.08)",
|
|
133
|
-
disabled: "rgba(16, 24, 40, 0.26)",
|
|
134
|
-
disabledBackground: "rgba(16, 24, 40, 0.12)",
|
|
135
|
-
focus: "rgba(16, 24, 40, 0.12)",
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
exports.default = palette;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TypographyVariantsOptions } from '@mui/material/styles';
|
|
2
|
-
import { TypographyStyleOptions } from '@mui/material/styles/createTypography';
|
|
3
|
-
declare module '@mui/material/styles' {
|
|
4
|
-
interface TypographyVariantsOptions {
|
|
5
|
-
body3?: TypographyStyleOptions;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
declare const typography: TypographyVariantsOptions;
|
|
9
|
-
export default typography;
|
package/cjs/theme/typography.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const typography = {
|
|
4
|
-
fontFamily: "'Mulish'",
|
|
5
|
-
h1: {
|
|
6
|
-
fontSize: "36px",
|
|
7
|
-
lineHeight: "44px",
|
|
8
|
-
},
|
|
9
|
-
h2: {
|
|
10
|
-
fontSize: "32px",
|
|
11
|
-
lineHeight: "40px",
|
|
12
|
-
},
|
|
13
|
-
h3: {
|
|
14
|
-
fontSize: "28px",
|
|
15
|
-
lineHeight: "36px",
|
|
16
|
-
},
|
|
17
|
-
h4: {
|
|
18
|
-
fontSize: "24px",
|
|
19
|
-
lineHeight: "32px",
|
|
20
|
-
},
|
|
21
|
-
h5: {
|
|
22
|
-
fontSize: "20px",
|
|
23
|
-
lineHeight: "28px",
|
|
24
|
-
},
|
|
25
|
-
h6: {
|
|
26
|
-
fontSize: "16px",
|
|
27
|
-
lineHeight: "22px",
|
|
28
|
-
},
|
|
29
|
-
body1: {
|
|
30
|
-
fontSize: '16px',
|
|
31
|
-
lineHeight: '24px',
|
|
32
|
-
},
|
|
33
|
-
body2: {
|
|
34
|
-
fontSize: '14px',
|
|
35
|
-
lineHeight: '20px',
|
|
36
|
-
},
|
|
37
|
-
body3: {
|
|
38
|
-
fontSize: '12px',
|
|
39
|
-
lineHeight: '18px',
|
|
40
|
-
letterSpacing: '0.15px',
|
|
41
|
-
},
|
|
42
|
-
subtitle1: {
|
|
43
|
-
fontSize: '16px',
|
|
44
|
-
lineHeight: "28px",
|
|
45
|
-
},
|
|
46
|
-
subtitle2: {
|
|
47
|
-
fontSize: '14px',
|
|
48
|
-
lineHeight: "22px",
|
|
49
|
-
},
|
|
50
|
-
caption: {
|
|
51
|
-
fontSize: '12px',
|
|
52
|
-
lineHeight: "20px",
|
|
53
|
-
},
|
|
54
|
-
overline: {
|
|
55
|
-
fontSize: "12px",
|
|
56
|
-
letterSpacing: "1px",
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
exports.default = typography;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ListboxComponent = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const React = require("react");
|
|
6
|
-
const useMediaQuery_1 = require("@mui/material/useMediaQuery");
|
|
7
|
-
const ListSubheader_1 = require("@mui/material/ListSubheader");
|
|
8
|
-
const styles_1 = require("@mui/material/styles");
|
|
9
|
-
const react_window_1 = require("react-window");
|
|
10
|
-
const Typography_1 = require("@mui/material/Typography");
|
|
11
|
-
const LISTBOX_PADDING = 8; // px
|
|
12
|
-
function renderRow(props) {
|
|
13
|
-
const { data, index, style } = props;
|
|
14
|
-
const dataSet = data[index];
|
|
15
|
-
const inlineStyle = {
|
|
16
|
-
...style,
|
|
17
|
-
top: style.top + LISTBOX_PADDING,
|
|
18
|
-
};
|
|
19
|
-
if (dataSet.hasOwnProperty('group')) {
|
|
20
|
-
return ((0, jsx_runtime_1.jsx)(ListSubheader_1.default, { component: "div", style: inlineStyle, children: dataSet.group }, dataSet.key));
|
|
21
|
-
}
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)(Typography_1.default, { component: "li", ...dataSet[0], noWrap: true, style: inlineStyle, children: dataSet[1] }));
|
|
23
|
-
}
|
|
24
|
-
const OuterElementContext = React.createContext({});
|
|
25
|
-
const OuterElementType = React.forwardRef((props, ref) => {
|
|
26
|
-
const outerProps = React.useContext(OuterElementContext);
|
|
27
|
-
return (0, jsx_runtime_1.jsx)("div", { ref: ref, ...props, ...outerProps });
|
|
28
|
-
});
|
|
29
|
-
function useResetCache(data) {
|
|
30
|
-
const ref = React.useRef(null);
|
|
31
|
-
React.useEffect(() => {
|
|
32
|
-
if (ref.current != null) {
|
|
33
|
-
ref.current.resetAfterIndex(0, true);
|
|
34
|
-
}
|
|
35
|
-
}, [data]);
|
|
36
|
-
return ref;
|
|
37
|
-
}
|
|
38
|
-
// Adapter for react-window
|
|
39
|
-
exports.ListboxComponent = React.forwardRef(function ListboxComponent(props, ref) {
|
|
40
|
-
const { children, ...other } = props;
|
|
41
|
-
const itemData = [];
|
|
42
|
-
children.forEach((item) => {
|
|
43
|
-
itemData.push(item);
|
|
44
|
-
itemData.push(...(item.children || []));
|
|
45
|
-
});
|
|
46
|
-
const theme = (0, styles_1.useTheme)();
|
|
47
|
-
const smUp = (0, useMediaQuery_1.default)(theme.breakpoints.up('sm'), {
|
|
48
|
-
noSsr: true,
|
|
49
|
-
});
|
|
50
|
-
const itemCount = itemData.length;
|
|
51
|
-
const itemSize = smUp ? 36 : 48;
|
|
52
|
-
const getChildSize = (child) => {
|
|
53
|
-
if (child.hasOwnProperty('group')) {
|
|
54
|
-
return 48;
|
|
55
|
-
}
|
|
56
|
-
return itemSize;
|
|
57
|
-
};
|
|
58
|
-
const getHeight = () => {
|
|
59
|
-
if (itemCount > 8) {
|
|
60
|
-
return 8 * itemSize;
|
|
61
|
-
}
|
|
62
|
-
return itemData.map(getChildSize).reduce((a, b) => a + b, 0);
|
|
63
|
-
};
|
|
64
|
-
const gridRef = useResetCache(itemCount);
|
|
65
|
-
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, children: (0, jsx_runtime_1.jsx)(OuterElementContext.Provider, { value: other, children: (0, jsx_runtime_1.jsx)(react_window_1.VariableSizeList, { itemData: itemData, height: getHeight() + 2 * LISTBOX_PADDING, width: "100%", ref: gridRef, outerElementType: OuterElementType, innerElementType: "ul", itemSize: (index) => getChildSize(itemData[index]), overscanCount: 5, itemCount: itemCount, children: renderRow }) }) }));
|
|
66
|
-
});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Story, Meta } from '@storybook/react/types-6-0';
|
|
2
|
-
import { ConfirmDialogProps } from '.';
|
|
3
|
-
declare const _default: Meta<import("@storybook/react/types-6-0").Args>;
|
|
4
|
-
export default _default;
|
|
5
|
-
export declare const Default: Story<ConfirmDialogProps>;
|
|
6
|
-
export declare const CustomChildren: Story<ConfirmDialogProps>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { Button } from '@mui/material';
|
|
4
|
-
import ConfirmDialog from '.';
|
|
5
|
-
export default {
|
|
6
|
-
title: 'ConfirmDialog',
|
|
7
|
-
component: ConfirmDialog,
|
|
8
|
-
argType: {},
|
|
9
|
-
};
|
|
10
|
-
const Template = (args) => {
|
|
11
|
-
const [open, setOpen] = useState(false);
|
|
12
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "contained", onClick: () => setOpen(true), children: "Click me to open" }), _jsx(ConfirmDialog, { ...args, open: open, callback: (confirmed) => setOpen(false) })] }));
|
|
13
|
-
};
|
|
14
|
-
export const Default = Template.bind({});
|
|
15
|
-
Default.args = {
|
|
16
|
-
title: 'Confirm modal title',
|
|
17
|
-
content: 'Confirm modal content',
|
|
18
|
-
};
|
|
19
|
-
export const CustomChildren = Template.bind({});
|
|
20
|
-
CustomChildren.args = {
|
|
21
|
-
title: 'Confirm modal title',
|
|
22
|
-
content: 'Confirm modal content',
|
|
23
|
-
children: _jsxs(_Fragment, { children: [_jsx(Button, { color: "error", variant: "contained", children: "Custom 1" }), _jsx(Button, { color: "success", variant: "contained", children: "Custom 2" })] })
|
|
24
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { DialogProps } from '@mui/material/Dialog';
|
|
3
|
-
export interface ConfirmDialogProps extends Omit<DialogProps, 'title'> {
|
|
4
|
-
/**
|
|
5
|
-
* Title of confirm dialog
|
|
6
|
-
*/
|
|
7
|
-
title: string | ReactNode;
|
|
8
|
-
/**
|
|
9
|
-
* Content of confirm dialog
|
|
10
|
-
*/
|
|
11
|
-
content: string | ReactNode;
|
|
12
|
-
/**
|
|
13
|
-
* Callback of confirm dialog
|
|
14
|
-
*/
|
|
15
|
-
callback: (confirmed: boolean) => void;
|
|
16
|
-
}
|
|
17
|
-
declare const ConfirmDialog: ({ title, content, onClose, children, callback, ...props }: ConfirmDialogProps) => JSX.Element;
|
|
18
|
-
export default ConfirmDialog;
|
package/es/ConfirmModal/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Dialog from '@mui/material/Dialog';
|
|
3
|
-
import DialogActions from '@mui/material/DialogActions';
|
|
4
|
-
import DialogContent from '@mui/material/DialogContent';
|
|
5
|
-
import DialogContentText from '@mui/material/DialogContentText';
|
|
6
|
-
import DialogTitle from '@mui/material/DialogTitle';
|
|
7
|
-
import { Button } from '@mui/material';
|
|
8
|
-
const ConfirmDialog = ({ title, content, onClose, children, callback, ...props }) => {
|
|
9
|
-
return (_jsxs(Dialog, { ...props, children: [_jsx(DialogTitle, { children: title }), _jsx(DialogContent, { children: _jsx(DialogContentText, { children: content }) }), children ? _jsx(DialogActions, { children: children }) : (_jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", onClick: () => callback(false), children: "No" }), _jsx(Button, { variant: "contained", onClick: () => callback(true), autoFocus: true, children: "Yes" })] }))] }));
|
|
10
|
-
};
|
|
11
|
-
export default ConfirmDialog;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import FieldTypeDropdown from './';
|
|
4
|
-
export default {
|
|
5
|
-
title: 'FieldTypeDropdown',
|
|
6
|
-
component: FieldTypeDropdown,
|
|
7
|
-
argType: {},
|
|
8
|
-
};
|
|
9
|
-
const options = [
|
|
10
|
-
{
|
|
11
|
-
value: 'option1',
|
|
12
|
-
label: 'Option 1',
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
value: 'option2',
|
|
16
|
-
label: 'Option 2',
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
value: 'option3',
|
|
20
|
-
label: 'Option 3',
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
const Template = (args) => {
|
|
24
|
-
const [value, setValue] = useState('');
|
|
25
|
-
const handleOnChange = (e) => {
|
|
26
|
-
setValue(e.target.value);
|
|
27
|
-
};
|
|
28
|
-
return (_jsx(FieldTypeDropdown, { ...args, value: value, onChange: handleOnChange, options: options }));
|
|
29
|
-
};
|
|
30
|
-
export const Default = Template.bind({});
|
|
31
|
-
Default.args = {
|
|
32
|
-
placeholder: 'Placeholder Text...',
|
|
33
|
-
label: 'Dropdown label',
|
|
34
|
-
helperText: 'Dropdown helper text',
|
|
35
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { OutlinedTextFieldProps } from '@mui/material/TextField';
|
|
3
|
-
interface Option {
|
|
4
|
-
label: string;
|
|
5
|
-
value: any;
|
|
6
|
-
}
|
|
7
|
-
export interface FieldTypeDropdownProps extends Omit<OutlinedTextFieldProps, 'variant'> {
|
|
8
|
-
options: Option[];
|
|
9
|
-
}
|
|
10
|
-
declare const FieldTypeDropdown: ({ label, options, required, ...props }: FieldTypeDropdownProps) => JSX.Element;
|
|
11
|
-
export default FieldTypeDropdown;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { MenuItem } from '@mui/material';
|
|
3
|
-
import MuiTextField from '@mui/material/TextField';
|
|
4
|
-
import { FormControl, FormLabel } from '@mui/material';
|
|
5
|
-
const FieldTypeDropdown = ({ label, options, required, ...props }) => {
|
|
6
|
-
return (_jsxs(FormControl, { fullWidth: true, required: required, children: [_jsx(FormLabel, { children: label }), _jsxs(MuiTextField, { size: "small", variant: 'outlined', select: true, SelectProps: {
|
|
7
|
-
displayEmpty: true,
|
|
8
|
-
}, ...props, children: [_jsx(MenuItem, { value: '', children: "- None -" }, ''), options.map((option) => (_jsx(MenuItem, { value: option.value, children: option.label }, option.value)))] })] }));
|
|
9
|
-
};
|
|
10
|
-
export default FieldTypeDropdown;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import ReactJson from 'react-json-view';
|
|
3
|
-
import theme from '../theme';
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Theme',
|
|
6
|
-
};
|
|
7
|
-
const Template = (args) => {
|
|
8
|
-
return (_jsx(ReactJson, { src: theme }));
|
|
9
|
-
};
|
|
10
|
-
export const Default = Template.bind({});
|