@zesty-io/material 0.2.3 → 0.2.5
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 → cjs}/ConfirmDialog/ConfirmDialog.stories.d.ts +0 -0
- package/cjs/ConfirmDialog/ConfirmDialog.stories.js +27 -0
- package/{es → cjs}/ConfirmDialog/index.d.ts +0 -0
- package/cjs/ConfirmDialog/index.js +13 -0
- package/{es → cjs}/CopyButton/CopyButton.stories.d.ts +0 -0
- package/cjs/CopyButton/CopyButton.stories.js +17 -0
- package/{es → cjs}/CopyButton/index.d.ts +0 -0
- package/cjs/CopyButton/index.js +28 -0
- package/{es → cjs}/FieldTypeColor/FieldTypeColor.stories.d.ts +0 -0
- package/cjs/FieldTypeColor/FieldTypeColor.stories.js +24 -0
- package/{es → cjs}/FieldTypeColor/index.d.ts +0 -0
- package/cjs/FieldTypeColor/index.js +18 -0
- package/{es → cjs}/FieldTypeDate/FieldTypeDate.stories.d.ts +0 -0
- package/cjs/FieldTypeDate/FieldTypeDate.stories.js +20 -0
- package/{es → cjs}/FieldTypeDate/index.d.ts +0 -0
- package/cjs/FieldTypeDate/index.js +12 -0
- package/{es → cjs}/FieldTypeDateTime/FieldTypeDateTime.stories.d.ts +0 -0
- package/cjs/FieldTypeDateTime/FieldTypeDateTime.stories.js +20 -0
- package/{es → cjs}/FieldTypeDateTime/index.d.ts +0 -0
- package/cjs/FieldTypeDateTime/index.js +12 -0
- package/{es → cjs}/FieldTypeNumber/FieldTypeNumber.stories.d.ts +0 -0
- package/cjs/FieldTypeNumber/FieldTypeNumber.stories.js +24 -0
- package/{es → cjs}/FieldTypeNumber/index.d.ts +0 -0
- package/cjs/FieldTypeNumber/index.js +9 -0
- package/{es → cjs}/FieldTypeOneToMany/FieldTypeOneToMany.stories.d.ts +0 -0
- package/cjs/FieldTypeOneToMany/FieldTypeOneToMany.stories.js +31 -0
- package/{es → cjs}/FieldTypeOneToMany/index.d.ts +0 -0
- package/cjs/FieldTypeOneToMany/index.js +31 -0
- package/{es → cjs}/FieldTypeOneToOne/FieldTypeOneToOne.stories.d.ts +0 -0
- package/cjs/FieldTypeOneToOne/FieldTypeOneToOne.stories.js +31 -0
- package/{es → cjs}/FieldTypeOneToOne/index.d.ts +0 -0
- package/cjs/FieldTypeOneToOne/index.js +35 -0
- package/{es → cjs}/FieldTypeSort/FieldTypeSort.stories.d.ts +0 -0
- package/cjs/FieldTypeSort/FieldTypeSort.stories.js +25 -0
- package/{es → cjs}/FieldTypeSort/index.d.ts +0 -0
- package/{es → cjs}/FieldTypeSort/index.js +13 -11
- package/{es → cjs}/FieldTypeText/FieldTypeText.stories.d.ts +0 -0
- package/cjs/FieldTypeText/FieldTypeText.stories.js +32 -0
- package/{es → cjs}/FieldTypeText/index.d.ts +0 -0
- package/cjs/FieldTypeText/index.js +9 -0
- package/{es → cjs}/FieldTypeUrl/FieldTypeUrl.stories.d.ts +0 -0
- package/cjs/FieldTypeUrl/FieldTypeUrl.stories.js +24 -0
- package/{es → cjs}/FieldTypeUrl/index.d.ts +0 -0
- package/cjs/FieldTypeUrl/index.js +16 -0
- package/{es → cjs}/LegacyTheme/index.d.ts +0 -0
- package/{es → cjs}/LegacyTheme/index.js +10 -8
- package/{es → cjs}/LegacyTheme/palette.d.ts +0 -0
- package/{es → cjs}/LegacyTheme/palette.js +3 -1
- package/{es → cjs}/LegacyTheme/typography.d.ts +0 -0
- package/cjs/LegacyTheme/typography.js +6 -0
- package/{es → cjs}/VitualizedAutocomplete/VirtualizedAutocomplete.stories.d.ts +0 -0
- package/cjs/VitualizedAutocomplete/VirtualizedAutocomplete.stories.js +30 -0
- package/{es → cjs}/VitualizedAutocomplete/index.d.ts +0 -0
- package/cjs/VitualizedAutocomplete/index.js +23 -0
- package/{es → cjs}/index.d.ts +0 -0
- package/cjs/index.js +31 -0
- package/{es/stories → cjs/theme}/Theme.stories.d.ts +0 -0
- package/cjs/theme/Theme.stories.js +13 -0
- package/{es → cjs}/theme/index.d.ts +0 -0
- package/{es → cjs}/theme/index.js +10 -8
- package/{es → cjs}/theme/palette.d.ts +0 -0
- package/{es → cjs}/theme/palette.js +3 -1
- package/{es → cjs}/theme/typography.d.ts +0 -0
- package/{es → cjs}/theme/typography.js +4 -2
- package/{es → cjs}/utils/virtualization.d.ts +0 -0
- package/cjs/utils/virtualization.js +66 -0
- package/package.json +5 -3
- package/src/theme/typography.ts +1 -1
- package/es/ConfirmDialog/ConfirmDialog.stories.js +0 -24
- package/es/ConfirmDialog/index.js +0 -11
- 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/CopyButton/CopyButton.stories.js +0 -14
- package/es/CopyButton/index.js +0 -26
- package/es/FieldTypeColor/FieldTypeColor.stories.js +0 -21
- package/es/FieldTypeColor/index.js +0 -16
- package/es/FieldTypeDate/FieldTypeDate.stories.js +0 -17
- package/es/FieldTypeDate/index.js +0 -10
- package/es/FieldTypeDateTime/FieldTypeDateTime.stories.js +0 -17
- package/es/FieldTypeDateTime/index.js +0 -10
- 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/FieldTypeNumber/FieldTypeNumber.stories.js +0 -21
- package/es/FieldTypeNumber/index.js +0 -7
- package/es/FieldTypeOneToMany/FieldTypeOneToMany.stories.js +0 -28
- package/es/FieldTypeOneToMany/index.js +0 -29
- package/es/FieldTypeOneToOne/FieldTypeOneToOne.stories.js +0 -28
- package/es/FieldTypeOneToOne/index.js +0 -33
- package/es/FieldTypeSort/FieldTypeSort.stories.js +0 -22
- package/es/FieldTypeText/FieldTypeText.stories.js +0 -29
- package/es/FieldTypeText/index.js +0 -7
- package/es/FieldTypeUrl/FieldTypeUrl.stories.js +0 -21
- package/es/FieldTypeUrl/index.js +0 -14
- package/es/LegacyTheme/typography.js +0 -4
- package/es/VitualizedAutocomplete/VirtualizedAutocomplete.stories.js +0 -27
- package/es/VitualizedAutocomplete/index.js +0 -21
- package/es/index.js +0 -14
- package/es/stories/Theme.stories.js +0 -10
- package/es/theme/Theme.stories.d.ts +0 -4
- package/es/theme/Theme.stories.js +0 -10
- package/es/utils/virtualization.js +0 -63
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomChildren = exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const _1 = require(".");
|
|
8
|
+
exports.default = {
|
|
9
|
+
title: 'ConfirmDialog',
|
|
10
|
+
component: _1.default,
|
|
11
|
+
argType: {},
|
|
12
|
+
};
|
|
13
|
+
const Template = (args) => {
|
|
14
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
15
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => setOpen(true), children: "Click me to open" }), (0, jsx_runtime_1.jsx)(_1.default, { ...args, open: open, callback: (confirmed) => setOpen(false) })] }));
|
|
16
|
+
};
|
|
17
|
+
exports.Default = Template.bind({});
|
|
18
|
+
exports.Default.args = {
|
|
19
|
+
title: 'Confirm modal title',
|
|
20
|
+
content: 'Confirm modal content',
|
|
21
|
+
};
|
|
22
|
+
exports.CustomChildren = Template.bind({});
|
|
23
|
+
exports.CustomChildren.args = {
|
|
24
|
+
title: 'Confirm modal title',
|
|
25
|
+
content: 'Confirm modal content',
|
|
26
|
+
children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { color: "error", variant: "contained", children: "Custom 1" }), (0, jsx_runtime_1.jsx)(material_1.Button, { color: "success", variant: "contained", children: "Custom 2" })] })
|
|
27
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const Dialog_1 = require("@mui/material/Dialog");
|
|
5
|
+
const DialogActions_1 = require("@mui/material/DialogActions");
|
|
6
|
+
const DialogContent_1 = require("@mui/material/DialogContent");
|
|
7
|
+
const DialogContentText_1 = require("@mui/material/DialogContentText");
|
|
8
|
+
const DialogTitle_1 = require("@mui/material/DialogTitle");
|
|
9
|
+
const material_1 = require("@mui/material");
|
|
10
|
+
const ConfirmDialog = ({ title, content, onClose, children, callback, ...props }) => {
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)(Dialog_1.default, { ...props, children: [(0, jsx_runtime_1.jsx)(DialogTitle_1.default, { children: title }), (0, jsx_runtime_1.jsx)(DialogContent_1.default, { children: (0, jsx_runtime_1.jsx)(DialogContentText_1.default, { children: content }) }), children ? (0, jsx_runtime_1.jsx)(DialogActions_1.default, { children: children }) : ((0, jsx_runtime_1.jsxs)(DialogActions_1.default, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => callback(false), children: "No" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => callback(true), autoFocus: true, children: "Yes" })] }))] }));
|
|
12
|
+
};
|
|
13
|
+
exports.default = ConfirmDialog;
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const _1 = require(".");
|
|
6
|
+
exports.default = {
|
|
7
|
+
title: 'CopyButton',
|
|
8
|
+
component: _1.default,
|
|
9
|
+
argType: {},
|
|
10
|
+
};
|
|
11
|
+
const Template = (args) => {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args }));
|
|
13
|
+
};
|
|
14
|
+
exports.Default = Template.bind({});
|
|
15
|
+
exports.Default.args = {
|
|
16
|
+
value: 'Copy Me!'
|
|
17
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const Button_1 = require("@mui/material/Button");
|
|
6
|
+
const ContentCopy_1 = require("@mui/icons-material/ContentCopy");
|
|
7
|
+
const Check_1 = require("@mui/icons-material/Check");
|
|
8
|
+
const CopyButton = ({ value, sx, ...props }) => {
|
|
9
|
+
const [copied, setCopied] = (0, react_1.useState)(false);
|
|
10
|
+
const copyValue = (0, react_1.useCallback)(() => {
|
|
11
|
+
navigator?.clipboard.writeText(value);
|
|
12
|
+
setCopied(true);
|
|
13
|
+
}, [value]);
|
|
14
|
+
(0, react_1.useEffect)(() => {
|
|
15
|
+
const iconTimer = setTimeout(() => {
|
|
16
|
+
setCopied(false);
|
|
17
|
+
}, 500);
|
|
18
|
+
return () => {
|
|
19
|
+
clearTimeout(iconTimer);
|
|
20
|
+
};
|
|
21
|
+
}, [copied]);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(Button_1.default, { variant: 'outlined', onClick: copyValue, size: "small", title: props.children ? `Copy ${props.children}` : `Copy ${value}`, sx: {
|
|
23
|
+
textTransform: 'unset',
|
|
24
|
+
// Spread sx prop at the end to allow sx prop overrides
|
|
25
|
+
...sx,
|
|
26
|
+
}, startIcon: copied ? ((0, jsx_runtime_1.jsx)(Check_1.default, { color: 'success', fontSize: 'small' })) : ((0, jsx_runtime_1.jsx)(ContentCopy_1.default, { fontSize: 'small' })), ...props, children: props.children ? props.children : value }));
|
|
27
|
+
};
|
|
28
|
+
exports.default = CopyButton;
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const _1 = require("./");
|
|
7
|
+
exports.default = {
|
|
8
|
+
title: 'FieldTypeColor',
|
|
9
|
+
component: _1.default,
|
|
10
|
+
argType: {},
|
|
11
|
+
};
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const [value, setValue] = (0, react_1.useState)('');
|
|
14
|
+
const handleOnChange = (e) => {
|
|
15
|
+
setValue(e.target.value);
|
|
16
|
+
};
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: handleOnChange }));
|
|
18
|
+
};
|
|
19
|
+
exports.Default = Template.bind({});
|
|
20
|
+
exports.Default.args = {
|
|
21
|
+
placeholder: 'Placeholder Text...',
|
|
22
|
+
label: 'Color label',
|
|
23
|
+
helperText: 'Color helper text',
|
|
24
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const TextField_1 = require("@mui/material/TextField");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const Brush_1 = require("@mui/icons-material/Brush");
|
|
7
|
+
const FieldTypeColor = ({ InputProps, label, required, ...props }) => {
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: label }), (0, jsx_runtime_1.jsx)(TextField_1.default, { size: "small", variant: 'outlined', type: 'color', InputProps: {
|
|
9
|
+
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", children: (0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "contained", onClick: (e) => {
|
|
10
|
+
// References color input via event in order to open color picker
|
|
11
|
+
const input = e.currentTarget?.parentElement?.parentElement?.firstElementChild;
|
|
12
|
+
input?.click();
|
|
13
|
+
}, children: (0, jsx_runtime_1.jsx)(Brush_1.default, { fontSize: 'small' }) }) })),
|
|
14
|
+
// Spread props at the end to allow Input prop overrides
|
|
15
|
+
...InputProps,
|
|
16
|
+
}, ...props })] }));
|
|
17
|
+
};
|
|
18
|
+
exports.default = FieldTypeColor;
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
exports.default = {
|
|
8
|
+
title: 'FieldTypeDate',
|
|
9
|
+
component: _1.default,
|
|
10
|
+
argType: {},
|
|
11
|
+
};
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: (value) => setValue(value) }));
|
|
15
|
+
};
|
|
16
|
+
exports.Default = Template.bind({});
|
|
17
|
+
exports.Default.args = {
|
|
18
|
+
label: 'Date label',
|
|
19
|
+
helperText: 'Date helper text',
|
|
20
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const AdapterDateFns_1 = require("@mui/x-date-pickers/AdapterDateFns");
|
|
5
|
+
const LocalizationProvider_1 = require("@mui/x-date-pickers/LocalizationProvider");
|
|
6
|
+
const x_date_pickers_1 = require("@mui/x-date-pickers");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
;
|
|
9
|
+
const FieldTypeDate = ({ label, helperText, error, required, ...props }) => {
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: label }), (0, jsx_runtime_1.jsx)(LocalizationProvider_1.LocalizationProvider, { dateAdapter: AdapterDateFns_1.AdapterDateFns, children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DesktopDatePicker, { "data-testid": "zds-date-picker", renderInput: (params) => (0, jsx_runtime_1.jsx)(material_1.TextField, { ...params, helperText: helperText, error: error, size: "small" }), ...props }) })] }));
|
|
11
|
+
};
|
|
12
|
+
exports.default = FieldTypeDate;
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
exports.default = {
|
|
8
|
+
title: 'FieldTypeDateTime',
|
|
9
|
+
component: _1.default,
|
|
10
|
+
argType: {},
|
|
11
|
+
};
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const [value, setValue] = (0, react_1.useState)(null);
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: (value) => setValue(value) }));
|
|
15
|
+
};
|
|
16
|
+
exports.Default = Template.bind({});
|
|
17
|
+
exports.Default.args = {
|
|
18
|
+
label: 'Date label',
|
|
19
|
+
helperText: 'Date helper text',
|
|
20
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const AdapterDateFns_1 = require("@mui/x-date-pickers/AdapterDateFns");
|
|
5
|
+
const LocalizationProvider_1 = require("@mui/x-date-pickers/LocalizationProvider");
|
|
6
|
+
const x_date_pickers_1 = require("@mui/x-date-pickers");
|
|
7
|
+
const material_1 = require("@mui/material");
|
|
8
|
+
;
|
|
9
|
+
const FieldTypeDateTime = ({ label, helperText, error, required, ...props }) => {
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: label }), (0, jsx_runtime_1.jsx)(LocalizationProvider_1.LocalizationProvider, { dateAdapter: AdapterDateFns_1.AdapterDateFns, children: (0, jsx_runtime_1.jsx)(x_date_pickers_1.DesktopDateTimePicker, { "data-testid": "zds-date-time-picker", renderInput: (params) => (0, jsx_runtime_1.jsx)(material_1.TextField, { ...params, helperText: helperText, error: error, size: "small" }), ...props }) })] }));
|
|
11
|
+
};
|
|
12
|
+
exports.default = FieldTypeDateTime;
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const _1 = require("./");
|
|
7
|
+
exports.default = {
|
|
8
|
+
title: 'FieldTypeNumber',
|
|
9
|
+
component: _1.default,
|
|
10
|
+
argType: {},
|
|
11
|
+
};
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const [value, setValue] = (0, react_1.useState)('0');
|
|
14
|
+
const handleOnChange = (e) => {
|
|
15
|
+
setValue(e.target.value);
|
|
16
|
+
};
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: handleOnChange }));
|
|
18
|
+
};
|
|
19
|
+
exports.Default = Template.bind({});
|
|
20
|
+
exports.Default.args = {
|
|
21
|
+
placeholder: 'Placeholder Text...',
|
|
22
|
+
label: 'Number label',
|
|
23
|
+
helperText: 'Number helper text',
|
|
24
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const TextField_1 = require("@mui/material/TextField");
|
|
6
|
+
const FieldTypeText = ({ label, required, ...props }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: label }), (0, jsx_runtime_1.jsx)(TextField_1.default, { size: "small", variant: 'outlined', type: 'number', ...props })] }));
|
|
8
|
+
};
|
|
9
|
+
exports.default = FieldTypeText;
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const _1 = require(".");
|
|
7
|
+
exports.default = {
|
|
8
|
+
title: 'FieldTypeOneToMany',
|
|
9
|
+
component: _1.default,
|
|
10
|
+
argType: {},
|
|
11
|
+
};
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const [value, setValue] = (0, react_1.useState)([]);
|
|
14
|
+
const [options, setOptions] = (0, react_1.useState)([]);
|
|
15
|
+
const handleOnOpen = async () => {
|
|
16
|
+
const largeArr = new Array(1000).fill(null);
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
18
|
+
const data = largeArr.map((_, idx) => ({ component: (0, jsx_runtime_1.jsx)("div", { children: `Test ${idx}` }), value: String(Math.random()), inputLabel: `Test ${idx}` }));
|
|
19
|
+
setOptions(data);
|
|
20
|
+
};
|
|
21
|
+
const handleOnChange = (e, values) => {
|
|
22
|
+
setValue(values);
|
|
23
|
+
};
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: handleOnChange, options: options, onOpen: handleOnOpen }));
|
|
25
|
+
};
|
|
26
|
+
exports.Default = Template.bind({});
|
|
27
|
+
exports.Default.args = {
|
|
28
|
+
placeholder: 'Placeholder Text...',
|
|
29
|
+
label: 'OneToMany label',
|
|
30
|
+
helperText: 'OneToMany helperText',
|
|
31
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const Autocomplete_1 = require("@mui/material/Autocomplete");
|
|
7
|
+
const virtualization_1 = require("../utils/virtualization");
|
|
8
|
+
const FieldTypeOneToMany = ({ label, helperText, placeholder, error, onOpen, options, required, ...props }) => {
|
|
9
|
+
const [loaded, setLoaded] = (0, react_1.useState)(false);
|
|
10
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
11
|
+
const handleOpen = () => {
|
|
12
|
+
if (!loaded && onOpen) {
|
|
13
|
+
onOpen().then(() => {
|
|
14
|
+
setLoading(false);
|
|
15
|
+
});
|
|
16
|
+
setLoading(true);
|
|
17
|
+
setLoaded(true);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: label }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { onOpen: handleOpen, loading: loading, fullWidth: true, multiple: true, disableListWrap: true, disableClearable: true, disablePortal: true, size: 'small', PopperComponent: StyledPopper, ListboxComponent: virtualization_1.ListboxComponent, renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, { ...params, helperText: helperText, error: error, placeholder: placeholder })), options: loading ? [] : options, getOptionLabel: (option) => option.inputLabel, renderOption: (props, option) => [props, option.component], ...props })] }));
|
|
21
|
+
};
|
|
22
|
+
exports.default = FieldTypeOneToMany;
|
|
23
|
+
const StyledPopper = (0, material_1.styled)(material_1.Popper)({
|
|
24
|
+
[`& .${Autocomplete_1.autocompleteClasses.listbox}`]: {
|
|
25
|
+
boxSizing: 'border-box',
|
|
26
|
+
'& ul': {
|
|
27
|
+
padding: 0,
|
|
28
|
+
margin: 0,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const _1 = require("./");
|
|
7
|
+
exports.default = {
|
|
8
|
+
title: 'FieldTypeOneToOne',
|
|
9
|
+
component: _1.default,
|
|
10
|
+
argType: {},
|
|
11
|
+
};
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const [value, setValue] = (0, react_1.useState)({ component: '- None -', value: '0', inputLabel: '- None -' });
|
|
14
|
+
const [options, setOptions] = (0, react_1.useState)([]);
|
|
15
|
+
const handleOnOpen = async () => {
|
|
16
|
+
const largeArr = new Array(1000).fill(null);
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
18
|
+
const data = largeArr.map((_, idx) => ({ component: (0, jsx_runtime_1.jsx)("div", { children: `Test ${idx}` }), value: String(Math.random()), inputLabel: `Test ${idx}` }));
|
|
19
|
+
setOptions(data);
|
|
20
|
+
};
|
|
21
|
+
const handleOnChange = (e, option) => {
|
|
22
|
+
setValue(option);
|
|
23
|
+
};
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: handleOnChange, options: options, onOpen: handleOnOpen }));
|
|
25
|
+
};
|
|
26
|
+
exports.Default = Template.bind({});
|
|
27
|
+
exports.Default.args = {
|
|
28
|
+
label: 'OneToOne label',
|
|
29
|
+
helperText: 'OneToOne helperText',
|
|
30
|
+
placeholder: 'OneToOne placeholder'
|
|
31
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const Autocomplete_1 = require("@mui/material/Autocomplete");
|
|
7
|
+
const virtualization_1 = require("../utils/virtualization");
|
|
8
|
+
const FieldTypeOneToOne = ({ label, helperText, placeholder, error, onOpen, options, required, startAdornment, endAdornment, ...props }) => {
|
|
9
|
+
const [loaded, setLoaded] = (0, react_1.useState)(false);
|
|
10
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
11
|
+
const handleOpen = () => {
|
|
12
|
+
if (!loaded && onOpen) {
|
|
13
|
+
onOpen().then(() => {
|
|
14
|
+
setLoading(false);
|
|
15
|
+
});
|
|
16
|
+
setLoading(true);
|
|
17
|
+
setLoaded(true);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: label }), (0, jsx_runtime_1.jsx)(Autocomplete_1.default, { onOpen: handleOpen, loading: loading, fullWidth: true, disableListWrap: true, disableClearable: true, disablePortal: true, size: 'small', PopperComponent: StyledPopper, ListboxComponent: virtualization_1.ListboxComponent, renderInput: (params) => ((0, jsx_runtime_1.jsx)(material_1.TextField, { ...params, helperText: helperText, error: error, placeholder: placeholder, InputProps: {
|
|
21
|
+
...params.InputProps,
|
|
22
|
+
startAdornment: (0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: 'end', children: startAdornment }),
|
|
23
|
+
endAdornment: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [params.InputProps.endAdornment, (0, jsx_runtime_1.jsx)(material_1.InputAdornment, { sx: { position: 'relative', right: '40px' }, position: 'end', children: endAdornment })] })
|
|
24
|
+
} })), options: loading ? [] : options, getOptionLabel: (option) => option.inputLabel, renderOption: (props, option) => [props, option.component], ...props })] }));
|
|
25
|
+
};
|
|
26
|
+
exports.default = FieldTypeOneToOne;
|
|
27
|
+
const StyledPopper = (0, material_1.styled)(material_1.Popper)({
|
|
28
|
+
[`& .${Autocomplete_1.autocompleteClasses.listbox}`]: {
|
|
29
|
+
boxSizing: 'border-box',
|
|
30
|
+
'& ul': {
|
|
31
|
+
padding: 0,
|
|
32
|
+
margin: 0,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const _1 = require("./");
|
|
7
|
+
exports.default = {
|
|
8
|
+
title: 'FieldTypeSort',
|
|
9
|
+
component: _1.default,
|
|
10
|
+
argType: {},
|
|
11
|
+
};
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const [value, setValue] = (0, react_1.useState)('3');
|
|
14
|
+
const handleOnChange = (e) => {
|
|
15
|
+
setValue(e.target.value);
|
|
16
|
+
};
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: handleOnChange }));
|
|
18
|
+
};
|
|
19
|
+
exports.Default = Template.bind({});
|
|
20
|
+
exports.Default.args = {
|
|
21
|
+
placeholder: 'Placeholder Text...',
|
|
22
|
+
label: 'Sort label',
|
|
23
|
+
helperText: 'Sort helper text',
|
|
24
|
+
error: false,
|
|
25
|
+
};
|
|
File without changes
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const TextField_1 = require("@mui/material/TextField");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const Add_1 = require("@mui/icons-material/Add");
|
|
7
|
+
const Remove_1 = require("@mui/icons-material/Remove");
|
|
6
8
|
const FieldTypeSort = ({ label, value, InputProps, required, onChange, ...props }) => {
|
|
7
|
-
return (
|
|
8
|
-
startAdornment: (
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, required: required, children: [(0, jsx_runtime_1.jsx)(material_1.FormLabel, { children: label }), (0, jsx_runtime_1.jsx)(TextField_1.default, { size: "small", variant: 'outlined', type: 'number', value: value, onChange: onChange, InputProps: {
|
|
10
|
+
startAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "start", children: (0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "contained", onClick: (e) => {
|
|
9
11
|
e.stopPropagation();
|
|
10
12
|
// References input via click event in order to obtain its value
|
|
11
13
|
const input = e.currentTarget?.parentElement?.parentElement?.childNodes?.[1];
|
|
@@ -15,8 +17,8 @@ const FieldTypeSort = ({ label, value, InputProps, required, onChange, ...props
|
|
|
15
17
|
// Mocks an event change
|
|
16
18
|
const event = { target: { value: newValue } };
|
|
17
19
|
onChange && onChange(event);
|
|
18
|
-
}, children:
|
|
19
|
-
endAdornment: (
|
|
20
|
+
}, children: (0, jsx_runtime_1.jsx)(Remove_1.default, { fontSize: 'small' }) }) })),
|
|
21
|
+
endAdornment: ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, { position: "end", children: (0, jsx_runtime_1.jsx)(material_1.Button, { size: "small", variant: "contained", onClick: (e) => {
|
|
20
22
|
e.stopPropagation();
|
|
21
23
|
// References input via click event in order to obtain its value
|
|
22
24
|
const input = e.currentTarget?.parentElement?.parentElement?.childNodes?.[1];
|
|
@@ -26,9 +28,9 @@ const FieldTypeSort = ({ label, value, InputProps, required, onChange, ...props
|
|
|
26
28
|
// Mocks an event change
|
|
27
29
|
const event = { target: { value: newValue } };
|
|
28
30
|
onChange && onChange(event);
|
|
29
|
-
}, children:
|
|
31
|
+
}, children: (0, jsx_runtime_1.jsx)(Add_1.default, { fontSize: 'small' }) }) })),
|
|
30
32
|
// Spread props at the end to allow Input prop overrides
|
|
31
33
|
...InputProps,
|
|
32
34
|
}, ...props })] }));
|
|
33
35
|
};
|
|
34
|
-
|
|
36
|
+
exports.default = FieldTypeSort;
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextArea = exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const _1 = require("./");
|
|
7
|
+
exports.default = {
|
|
8
|
+
title: 'FieldTypeText',
|
|
9
|
+
component: _1.default,
|
|
10
|
+
argType: {},
|
|
11
|
+
};
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const [value, setValue] = (0, react_1.useState)('');
|
|
14
|
+
const handleOnChange = (e) => {
|
|
15
|
+
setValue(e.target.value);
|
|
16
|
+
};
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: handleOnChange }) }));
|
|
18
|
+
};
|
|
19
|
+
exports.Default = Template.bind({});
|
|
20
|
+
exports.Default.args = {
|
|
21
|
+
placeholder: 'Placeholder Text...',
|
|
22
|
+
label: 'Text label',
|
|
23
|
+
helperText: 'Text helper text',
|
|
24
|
+
};
|
|
25
|
+
exports.TextArea = Template.bind({});
|
|
26
|
+
exports.TextArea.args = {
|
|
27
|
+
multiline: true,
|
|
28
|
+
rows: 4,
|
|
29
|
+
placeholder: 'Placeholder Text...',
|
|
30
|
+
label: 'Text Label',
|
|
31
|
+
helperText: 'Text helper text',
|
|
32
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const TextField_1 = require("@mui/material/TextField");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const FieldTypeText = ({ label, maxLength = 150, value, helperText, required, ...props }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, required: required, children: [(0, jsx_runtime_1.jsxs)(material_1.FormLabel, { sx: { display: 'flex', justifyContent: 'space-between', '& .MuiFormLabel-asterisk': { order: 2 } }, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { order: 1 }, children: label }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { order: 3, flex: 1, textAlign: 'right' }, children: [value?.length, "/", maxLength] })] }), (0, jsx_runtime_1.jsx)(TextField_1.default, { size: "small", variant: 'outlined', value: value, error: value?.length > maxLength, helperText: value?.length > maxLength ? 'Your input is over the specified limit' : helperText, ...props })] }));
|
|
8
|
+
};
|
|
9
|
+
exports.default = FieldTypeText;
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Default = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const _1 = require("./");
|
|
7
|
+
exports.default = {
|
|
8
|
+
title: 'FieldTypeUrl',
|
|
9
|
+
component: _1.default,
|
|
10
|
+
argType: {},
|
|
11
|
+
};
|
|
12
|
+
const Template = (args) => {
|
|
13
|
+
const [value, setValue] = (0, react_1.useState)('');
|
|
14
|
+
const handleOnChange = (e) => {
|
|
15
|
+
setValue(e.target.value);
|
|
16
|
+
};
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(_1.default, { ...args, value: value, onChange: handleOnChange }));
|
|
18
|
+
};
|
|
19
|
+
exports.Default = Template.bind({});
|
|
20
|
+
exports.Default.args = {
|
|
21
|
+
placeholder: 'Placeholder Text...',
|
|
22
|
+
label: 'Some label',
|
|
23
|
+
fullWidth: true,
|
|
24
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const TextField_1 = require("@mui/material/TextField");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const FieldTypeUrl = ({ label, maxLength = 2000, value, helperText, required, inputProps, ...props }) => {
|
|
8
|
+
// Use state to hold input reference to re-render once ref changes in case error needs to be shown on mount
|
|
9
|
+
const [inputRef, setInputRef] = (0, react_1.useState)();
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.FormControl, { fullWidth: true, required: required, children: [(0, jsx_runtime_1.jsxs)(material_1.FormLabel, { sx: { display: 'flex', justifyContent: 'space-between', '& .MuiFormLabel-asterisk': { order: 2 } }, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { order: 1 }, children: label }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: { order: 3, flex: 1, textAlign: 'right' }, children: [value?.length, "/", maxLength] })] }), (0, jsx_runtime_1.jsx)(TextField_1.default, { size: "small", type: 'url', variant: 'outlined', value: value, inputProps: {
|
|
11
|
+
ref: (inputRef) => setInputRef(inputRef),
|
|
12
|
+
// Spread props at the end to allow inputProps prop overrides
|
|
13
|
+
...inputProps,
|
|
14
|
+
}, error: (value && !inputRef?.validity.valid) || value?.length > maxLength, helperText: value?.length > maxLength ? 'Your input is over the specified limit' : (value && !inputRef?.validity.valid) ? 'Your input is not a valid url' : helperText, ...props })] }));
|
|
15
|
+
};
|
|
16
|
+
exports.default = FieldTypeUrl;
|
|
File without changes
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const palette_1 = require("./palette");
|
|
4
|
+
const typography_1 = require("./typography");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
let theme = (0, styles_1.createTheme)({
|
|
7
|
+
palette: palette_1.default,
|
|
8
|
+
typography: typography_1.default,
|
|
7
9
|
});
|
|
8
|
-
theme = createTheme(theme, {
|
|
10
|
+
theme = (0, styles_1.createTheme)(theme, {
|
|
9
11
|
components: {
|
|
10
12
|
MuiAccordionSummary: {
|
|
11
13
|
styleOverrides: {
|
|
@@ -78,4 +80,4 @@ theme = createTheme(theme, {
|
|
|
78
80
|
},
|
|
79
81
|
},
|
|
80
82
|
});
|
|
81
|
-
|
|
83
|
+
exports.default = theme;
|
|
File without changes
|