@zimyo/ui 1.1.8 → 1.1.10
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/Accordion/index.d.ts +34 -0
- package/dist/Accordion/index.esm.js +239 -0
- package/dist/Accordion/index.js +247 -0
- package/dist/Button/index.d.ts +15 -0
- package/dist/Button/index.esm.js +13 -0
- package/dist/Button/index.js +18 -0
- package/dist/Card/index.d.ts +41 -0
- package/dist/Card/index.esm.js +36 -0
- package/dist/Card/index.js +38 -0
- package/dist/Modal/index.d.ts +17 -0
- package/dist/Modal/index.esm.js +144 -0
- package/dist/Modal/index.js +149 -0
- package/dist/Popover/index.d.ts +19 -0
- package/dist/Popover/index.esm.js +22 -0
- package/dist/Popover/index.js +27 -0
- package/dist/RadioGroup/index.d.ts +31 -0
- package/dist/RadioGroup/index.esm.js +91 -0
- package/dist/RadioGroup/index.js +96 -0
- package/dist/Select/index.d.ts +22 -0
- package/dist/Select/index.esm.js +195 -0
- package/dist/Select/index.js +200 -0
- package/dist/Switch/index.d.ts +14 -0
- package/dist/Switch/index.esm.js +9 -0
- package/dist/Switch/index.js +14 -0
- package/dist/Tabs/index.d.ts +36 -0
- package/dist/Tabs/index.esm.js +202 -0
- package/dist/Tabs/index.js +207 -0
- package/dist/TextInput/index.d.ts +18 -0
- package/dist/TextInput/index.esm.js +33 -0
- package/dist/TextInput/index.js +38 -0
- package/dist/Typography/index.d.ts +30 -0
- package/dist/Typography/index.esm.js +57 -0
- package/dist/Typography/index.js +66 -0
- package/dist/index.d.ts +222 -0
- package/dist/index.esm.js +750 -0
- package/dist/index.js +772 -0
- package/dist/theme/index.d.ts +91 -0
- package/dist/theme/index.esm.js +234 -0
- package/dist/theme/index.js +239 -0
- package/package.json +1 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import React, { forwardRef, createElement } from 'react';
|
|
3
|
+
import { useTheme, FormControl, Select as Select$1, OutlinedInput, IconButton, MenuItem, ListItemText, FormHelperText, Box, Chip } from '@mui/material';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @license lucide-react v0.525.0 - ISC
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the ISC license.
|
|
9
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
13
|
+
const toCamelCase = (string) => string.replace(
|
|
14
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
15
|
+
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
16
|
+
);
|
|
17
|
+
const toPascalCase = (string) => {
|
|
18
|
+
const camelCase = toCamelCase(string);
|
|
19
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
20
|
+
};
|
|
21
|
+
const mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
22
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
23
|
+
}).join(" ").trim();
|
|
24
|
+
const hasA11yProp = (props) => {
|
|
25
|
+
for (const prop in props) {
|
|
26
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @license lucide-react v0.525.0 - ISC
|
|
34
|
+
*
|
|
35
|
+
* This source code is licensed under the ISC license.
|
|
36
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
var defaultAttributes = {
|
|
40
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
+
width: 24,
|
|
42
|
+
height: 24,
|
|
43
|
+
viewBox: "0 0 24 24",
|
|
44
|
+
fill: "none",
|
|
45
|
+
stroke: "currentColor",
|
|
46
|
+
strokeWidth: 2,
|
|
47
|
+
strokeLinecap: "round",
|
|
48
|
+
strokeLinejoin: "round"
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @license lucide-react v0.525.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
const Icon = forwardRef(
|
|
60
|
+
({
|
|
61
|
+
color = "currentColor",
|
|
62
|
+
size = 24,
|
|
63
|
+
strokeWidth = 2,
|
|
64
|
+
absoluteStrokeWidth,
|
|
65
|
+
className = "",
|
|
66
|
+
children,
|
|
67
|
+
iconNode,
|
|
68
|
+
...rest
|
|
69
|
+
}, ref) => createElement(
|
|
70
|
+
"svg",
|
|
71
|
+
{
|
|
72
|
+
ref,
|
|
73
|
+
...defaultAttributes,
|
|
74
|
+
width: size,
|
|
75
|
+
height: size,
|
|
76
|
+
stroke: color,
|
|
77
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
78
|
+
className: mergeClasses("lucide", className),
|
|
79
|
+
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
80
|
+
...rest
|
|
81
|
+
},
|
|
82
|
+
[
|
|
83
|
+
...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
|
|
84
|
+
...Array.isArray(children) ? children : [children]
|
|
85
|
+
]
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @license lucide-react v0.525.0 - ISC
|
|
91
|
+
*
|
|
92
|
+
* This source code is licensed under the ISC license.
|
|
93
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
const createLucideIcon = (iconName, iconNode) => {
|
|
98
|
+
const Component = forwardRef(
|
|
99
|
+
({ className, ...props }, ref) => createElement(Icon, {
|
|
100
|
+
ref,
|
|
101
|
+
iconNode,
|
|
102
|
+
className: mergeClasses(
|
|
103
|
+
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
104
|
+
`lucide-${iconName}`,
|
|
105
|
+
className
|
|
106
|
+
),
|
|
107
|
+
...props
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
Component.displayName = toPascalCase(iconName);
|
|
111
|
+
return Component;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @license lucide-react v0.525.0 - ISC
|
|
116
|
+
*
|
|
117
|
+
* This source code is licensed under the ISC license.
|
|
118
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
const __iconNode$1 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
123
|
+
const ChevronDown = createLucideIcon("chevron-down", __iconNode$1);
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @license lucide-react v0.525.0 - ISC
|
|
127
|
+
*
|
|
128
|
+
* This source code is licensed under the ISC license.
|
|
129
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
const __iconNode = [
|
|
134
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
135
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
136
|
+
];
|
|
137
|
+
const X = createLucideIcon("x", __iconNode);
|
|
138
|
+
|
|
139
|
+
const Select = React.forwardRef(({ label = '', options = [], value, onChange, error = false, helperText = '', required = false, placeholder = 'Select...', isMulti = false, disabled = false, ...rest }, ref) => {
|
|
140
|
+
useTheme();
|
|
141
|
+
const handleRemoveChip = (chipValue) => (e) => {
|
|
142
|
+
e.stopPropagation();
|
|
143
|
+
const newValue = value.filter((v) => v !== chipValue);
|
|
144
|
+
onChange?.({
|
|
145
|
+
target: {
|
|
146
|
+
name: rest.name,
|
|
147
|
+
value: newValue,
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
const renderValue = (selected) => {
|
|
152
|
+
if (isMulti && Array.isArray(selected)) {
|
|
153
|
+
return (jsx(Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 }, children: selected.map((val) => {
|
|
154
|
+
const label = options.find((o) => o.value === val)?.label || val;
|
|
155
|
+
return jsx(Box, { onMouseDown: (e) => e.stopPropagation(), children: jsx(Chip, { onDelete: handleRemoveChip(val), label: label, sx: { borderRadius: '12px' } }) }, val);
|
|
156
|
+
}) }));
|
|
157
|
+
}
|
|
158
|
+
return options.find((o) => o.value === selected)?.label || placeholder;
|
|
159
|
+
};
|
|
160
|
+
const handleClearSelection = (e) => {
|
|
161
|
+
e.stopPropagation();
|
|
162
|
+
const emptyValue = isMulti ? [] : '';
|
|
163
|
+
onChange?.({
|
|
164
|
+
target: {
|
|
165
|
+
name: rest.name,
|
|
166
|
+
value: emptyValue,
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
return (jsxs(FormControl, { fullWidth: true, error: error, disabled: disabled, sx: {
|
|
171
|
+
'& .MuiOutlinedInput-root': {
|
|
172
|
+
borderRadius: '8px',
|
|
173
|
+
minHeight: '44px',
|
|
174
|
+
// backgroundColor: theme.palette.background.paper,
|
|
175
|
+
fontSize: '14px'
|
|
176
|
+
},
|
|
177
|
+
'& .MuiSelect-select': {
|
|
178
|
+
fontSize: '14px',
|
|
179
|
+
padding: '10px 14px',
|
|
180
|
+
},
|
|
181
|
+
'& .MuiSelect-placeholder': {
|
|
182
|
+
fontSize: '14px',
|
|
183
|
+
},
|
|
184
|
+
'& .MuiMenuItem-root': {
|
|
185
|
+
fontSize: '14px',
|
|
186
|
+
},
|
|
187
|
+
'& .MuiChip-label': {
|
|
188
|
+
fontSize: '14px',
|
|
189
|
+
},
|
|
190
|
+
}, children: [jsx(Select$1, { displayEmpty: true,
|
|
191
|
+
// labelId={labelId}
|
|
192
|
+
multiple: isMulti, value: value || (isMulti ? [] : ''), onChange: onChange, input: jsx(OutlinedInput, { label: label }), renderValue: renderValue, ref: ref, IconComponent: ChevronDown, endAdornment: value && !isMulti && ((isMulti && value.length > 0) || (!isMulti && value !== '')) ? (jsx(IconButton, { sx: { marginRight: '1rem' }, size: "small", onClick: handleClearSelection, children: jsx(X, { fontSize: "small" }) })) : null, variant: "outlined", ...rest, children: options && options.map((option) => (jsx(MenuItem, { value: option.value, children: isMulti ? (jsx(Fragment, { children: jsx(ListItemText, { primary: option.label }) })) : (option.label || placeholder) }, option.value))) }), helperText && jsx(FormHelperText, { children: helperText })] }));
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
export { Select, Select as default };
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var material = require('@mui/material');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @license lucide-react v0.525.0 - ISC
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the ISC license.
|
|
13
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
17
|
+
const toCamelCase = (string) => string.replace(
|
|
18
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
19
|
+
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
20
|
+
);
|
|
21
|
+
const toPascalCase = (string) => {
|
|
22
|
+
const camelCase = toCamelCase(string);
|
|
23
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
24
|
+
};
|
|
25
|
+
const mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
26
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
27
|
+
}).join(" ").trim();
|
|
28
|
+
const hasA11yProp = (props) => {
|
|
29
|
+
for (const prop in props) {
|
|
30
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @license lucide-react v0.525.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
var defaultAttributes = {
|
|
44
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
45
|
+
width: 24,
|
|
46
|
+
height: 24,
|
|
47
|
+
viewBox: "0 0 24 24",
|
|
48
|
+
fill: "none",
|
|
49
|
+
stroke: "currentColor",
|
|
50
|
+
strokeWidth: 2,
|
|
51
|
+
strokeLinecap: "round",
|
|
52
|
+
strokeLinejoin: "round"
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @license lucide-react v0.525.0 - ISC
|
|
57
|
+
*
|
|
58
|
+
* This source code is licensed under the ISC license.
|
|
59
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
const Icon = React.forwardRef(
|
|
64
|
+
({
|
|
65
|
+
color = "currentColor",
|
|
66
|
+
size = 24,
|
|
67
|
+
strokeWidth = 2,
|
|
68
|
+
absoluteStrokeWidth,
|
|
69
|
+
className = "",
|
|
70
|
+
children,
|
|
71
|
+
iconNode,
|
|
72
|
+
...rest
|
|
73
|
+
}, ref) => React.createElement(
|
|
74
|
+
"svg",
|
|
75
|
+
{
|
|
76
|
+
ref,
|
|
77
|
+
...defaultAttributes,
|
|
78
|
+
width: size,
|
|
79
|
+
height: size,
|
|
80
|
+
stroke: color,
|
|
81
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
82
|
+
className: mergeClasses("lucide", className),
|
|
83
|
+
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
84
|
+
...rest
|
|
85
|
+
},
|
|
86
|
+
[
|
|
87
|
+
...iconNode.map(([tag, attrs]) => React.createElement(tag, attrs)),
|
|
88
|
+
...Array.isArray(children) ? children : [children]
|
|
89
|
+
]
|
|
90
|
+
)
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @license lucide-react v0.525.0 - ISC
|
|
95
|
+
*
|
|
96
|
+
* This source code is licensed under the ISC license.
|
|
97
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
const createLucideIcon = (iconName, iconNode) => {
|
|
102
|
+
const Component = React.forwardRef(
|
|
103
|
+
({ className, ...props }, ref) => React.createElement(Icon, {
|
|
104
|
+
ref,
|
|
105
|
+
iconNode,
|
|
106
|
+
className: mergeClasses(
|
|
107
|
+
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
108
|
+
`lucide-${iconName}`,
|
|
109
|
+
className
|
|
110
|
+
),
|
|
111
|
+
...props
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
Component.displayName = toPascalCase(iconName);
|
|
115
|
+
return Component;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @license lucide-react v0.525.0 - ISC
|
|
120
|
+
*
|
|
121
|
+
* This source code is licensed under the ISC license.
|
|
122
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
const __iconNode$1 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
127
|
+
const ChevronDown = createLucideIcon("chevron-down", __iconNode$1);
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @license lucide-react v0.525.0 - ISC
|
|
131
|
+
*
|
|
132
|
+
* This source code is licensed under the ISC license.
|
|
133
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
const __iconNode = [
|
|
138
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
139
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
140
|
+
];
|
|
141
|
+
const X = createLucideIcon("x", __iconNode);
|
|
142
|
+
|
|
143
|
+
const Select = React.forwardRef(({ label = '', options = [], value, onChange, error = false, helperText = '', required = false, placeholder = 'Select...', isMulti = false, disabled = false, ...rest }, ref) => {
|
|
144
|
+
material.useTheme();
|
|
145
|
+
const handleRemoveChip = (chipValue) => (e) => {
|
|
146
|
+
e.stopPropagation();
|
|
147
|
+
const newValue = value.filter((v) => v !== chipValue);
|
|
148
|
+
onChange?.({
|
|
149
|
+
target: {
|
|
150
|
+
name: rest.name,
|
|
151
|
+
value: newValue,
|
|
152
|
+
},
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
const renderValue = (selected) => {
|
|
156
|
+
if (isMulti && Array.isArray(selected)) {
|
|
157
|
+
return (jsxRuntime.jsx(material.Box, { sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 }, children: selected.map((val) => {
|
|
158
|
+
const label = options.find((o) => o.value === val)?.label || val;
|
|
159
|
+
return jsxRuntime.jsx(material.Box, { onMouseDown: (e) => e.stopPropagation(), children: jsxRuntime.jsx(material.Chip, { onDelete: handleRemoveChip(val), label: label, sx: { borderRadius: '12px' } }) }, val);
|
|
160
|
+
}) }));
|
|
161
|
+
}
|
|
162
|
+
return options.find((o) => o.value === selected)?.label || placeholder;
|
|
163
|
+
};
|
|
164
|
+
const handleClearSelection = (e) => {
|
|
165
|
+
e.stopPropagation();
|
|
166
|
+
const emptyValue = isMulti ? [] : '';
|
|
167
|
+
onChange?.({
|
|
168
|
+
target: {
|
|
169
|
+
name: rest.name,
|
|
170
|
+
value: emptyValue,
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
return (jsxRuntime.jsxs(material.FormControl, { fullWidth: true, error: error, disabled: disabled, sx: {
|
|
175
|
+
'& .MuiOutlinedInput-root': {
|
|
176
|
+
borderRadius: '8px',
|
|
177
|
+
minHeight: '44px',
|
|
178
|
+
// backgroundColor: theme.palette.background.paper,
|
|
179
|
+
fontSize: '14px'
|
|
180
|
+
},
|
|
181
|
+
'& .MuiSelect-select': {
|
|
182
|
+
fontSize: '14px',
|
|
183
|
+
padding: '10px 14px',
|
|
184
|
+
},
|
|
185
|
+
'& .MuiSelect-placeholder': {
|
|
186
|
+
fontSize: '14px',
|
|
187
|
+
},
|
|
188
|
+
'& .MuiMenuItem-root': {
|
|
189
|
+
fontSize: '14px',
|
|
190
|
+
},
|
|
191
|
+
'& .MuiChip-label': {
|
|
192
|
+
fontSize: '14px',
|
|
193
|
+
},
|
|
194
|
+
}, children: [jsxRuntime.jsx(material.Select, { displayEmpty: true,
|
|
195
|
+
// labelId={labelId}
|
|
196
|
+
multiple: isMulti, value: value || (isMulti ? [] : ''), onChange: onChange, input: jsxRuntime.jsx(material.OutlinedInput, { label: label }), renderValue: renderValue, ref: ref, IconComponent: ChevronDown, endAdornment: value && !isMulti && ((isMulti && value.length > 0) || (!isMulti && value !== '')) ? (jsxRuntime.jsx(material.IconButton, { sx: { marginRight: '1rem' }, size: "small", onClick: handleClearSelection, children: jsxRuntime.jsx(X, { fontSize: "small" }) })) : null, variant: "outlined", ...rest, children: options && options.map((option) => (jsxRuntime.jsx(material.MenuItem, { value: option.value, children: isMulti ? (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(material.ListItemText, { primary: option.label }) })) : (option.label || placeholder) }, option.value))) }), helperText && jsxRuntime.jsx(material.FormHelperText, { children: helperText })] }));
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
exports.Select = Select;
|
|
200
|
+
exports.default = Select;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SwitchProps as SwitchProps$1 } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
interface SwitchProps extends Omit<SwitchProps$1, 'onChange'> {
|
|
5
|
+
label?: string;
|
|
6
|
+
helperText?: string;
|
|
7
|
+
error?: boolean;
|
|
8
|
+
required?: boolean | number;
|
|
9
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
12
|
+
|
|
13
|
+
export { Switch, Switch as default };
|
|
14
|
+
export type { SwitchProps };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FormControl, FormControlLabel, Switch as Switch$1, FormHelperText } from '@mui/material';
|
|
4
|
+
|
|
5
|
+
const Switch = React.forwardRef(({ label = '', helperText = '', error = false, onChange, checked, required = false, disabled = false, ...rest }, ref) => {
|
|
6
|
+
return (jsxs(FormControl, { error: error, disabled: disabled, component: "fieldset", children: [jsx(FormControlLabel, { control: jsx(Switch$1, { inputRef: ref, checked: checked, onChange: (e, checked) => onChange?.(e, checked), disabled: disabled, required: required == 1 || required === true ? true : false, ...rest }), label: label }), helperText && jsx(FormHelperText, { children: helperText })] }));
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export { Switch, Switch as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var material = require('@mui/material');
|
|
8
|
+
|
|
9
|
+
const Switch = React.forwardRef(({ label = '', helperText = '', error = false, onChange, checked, required = false, disabled = false, ...rest }, ref) => {
|
|
10
|
+
return (jsxRuntime.jsxs(material.FormControl, { error: error, disabled: disabled, component: "fieldset", children: [jsxRuntime.jsx(material.FormControlLabel, { control: jsxRuntime.jsx(material.Switch, { inputRef: ref, checked: checked, onChange: (e, checked) => onChange?.(e, checked), disabled: disabled, required: required == 1 || required === true ? true : false, ...rest }), label: label }), helperText && jsxRuntime.jsx(material.FormHelperText, { children: helperText })] }));
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
exports.Switch = Switch;
|
|
14
|
+
exports.default = Switch;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TabProps, TabsProps as TabsProps$1 } from '@mui/material';
|
|
3
|
+
import { SxProps, Theme } from '@mui/system';
|
|
4
|
+
|
|
5
|
+
interface TabItem {
|
|
6
|
+
label: string;
|
|
7
|
+
value: string | number;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
badge?: string | number;
|
|
11
|
+
}
|
|
12
|
+
interface CustomTabProps extends Omit<TabProps, 'sx'> {
|
|
13
|
+
sx?: SxProps<Theme>;
|
|
14
|
+
badge?: string | number;
|
|
15
|
+
}
|
|
16
|
+
interface TabsProps extends Omit<TabsProps$1, 'children' | 'sx' | 'indicatorColor' | 'textColor'> {
|
|
17
|
+
items: TabItem[];
|
|
18
|
+
value: string | number;
|
|
19
|
+
onChange: (event: React.SyntheticEvent, newValue: string | number) => void;
|
|
20
|
+
variant?: 'standard' | 'scrollable' | 'fullWidth';
|
|
21
|
+
orientation?: 'horizontal' | 'vertical';
|
|
22
|
+
styleVariant?: 'default' | 'filled' | 'outlined' | 'pills' | 'underlined';
|
|
23
|
+
size?: 'small' | 'medium' | 'large';
|
|
24
|
+
centered?: boolean;
|
|
25
|
+
allowScrollButtonsMobile?: boolean;
|
|
26
|
+
scrollButtons?: boolean | 'auto';
|
|
27
|
+
sx?: SxProps<Theme>;
|
|
28
|
+
tabSx?: SxProps<Theme>;
|
|
29
|
+
iconPosition?: 'start' | 'end' | 'top' | 'bottom';
|
|
30
|
+
indicatorColor?: TabsProps$1['indicatorColor'];
|
|
31
|
+
textColor?: TabsProps$1['textColor'];
|
|
32
|
+
}
|
|
33
|
+
declare const Tabs: React.ForwardRefExoticComponent<Omit<TabsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
34
|
+
|
|
35
|
+
export { Tabs, Tabs as default };
|
|
36
|
+
export type { CustomTabProps, TabItem, TabsProps };
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useTheme, Box, Tab, Tabs as Tabs$1, alpha } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
// Custom Tab Component
|
|
5
|
+
const CustomTab = React.forwardRef(({ badge, sx, label, ...props }, ref) => {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
const tabLabel = badge ? React.createElement(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1 } }, label, React.createElement(Box, {
|
|
8
|
+
component: 'span',
|
|
9
|
+
sx: {
|
|
10
|
+
backgroundColor: theme.palette.error.main,
|
|
11
|
+
color: theme.palette.error.contrastText,
|
|
12
|
+
borderRadius: '10px',
|
|
13
|
+
padding: '2px 6px',
|
|
14
|
+
fontSize: '0.75rem',
|
|
15
|
+
fontWeight: 600,
|
|
16
|
+
minWidth: '18px',
|
|
17
|
+
height: '18px',
|
|
18
|
+
display: 'flex',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
lineHeight: 1,
|
|
22
|
+
}
|
|
23
|
+
}, badge)) : label;
|
|
24
|
+
return React.createElement(Tab, {
|
|
25
|
+
ref,
|
|
26
|
+
sx: {
|
|
27
|
+
position: 'relative',
|
|
28
|
+
...sx,
|
|
29
|
+
},
|
|
30
|
+
label: tabLabel,
|
|
31
|
+
...props
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
CustomTab.displayName = 'CustomTab';
|
|
35
|
+
// Main Tabs Component
|
|
36
|
+
const Tabs = React.forwardRef(({ items, value, onChange, variant = 'standard', orientation = 'horizontal', styleVariant = 'default', size = 'medium', centered = false, allowScrollButtonsMobile = false, scrollButtons = 'auto', sx = {}, tabSx = {}, iconPosition = 'start', indicatorColor = 'primary', textColor = 'primary', ...props }, ref) => {
|
|
37
|
+
const theme = useTheme();
|
|
38
|
+
// Get size-based styling
|
|
39
|
+
const getSizeStyles = () => {
|
|
40
|
+
switch (size) {
|
|
41
|
+
case 'small':
|
|
42
|
+
return {
|
|
43
|
+
minHeight: 36,
|
|
44
|
+
fontSize: '0.875rem',
|
|
45
|
+
padding: '6px 12px',
|
|
46
|
+
};
|
|
47
|
+
case 'large':
|
|
48
|
+
return {
|
|
49
|
+
minHeight: 56,
|
|
50
|
+
fontSize: '1rem',
|
|
51
|
+
padding: '12px 24px',
|
|
52
|
+
};
|
|
53
|
+
default:
|
|
54
|
+
return {
|
|
55
|
+
minHeight: 48,
|
|
56
|
+
fontSize: '0.9375rem',
|
|
57
|
+
padding: '8px 16px',
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
// Get style variant specific styling
|
|
62
|
+
const getStyleVariantStyles = () => {
|
|
63
|
+
const baseStyles = getSizeStyles();
|
|
64
|
+
switch (styleVariant) {
|
|
65
|
+
case 'filled':
|
|
66
|
+
return {
|
|
67
|
+
'& .MuiTab-root': {
|
|
68
|
+
...baseStyles,
|
|
69
|
+
backgroundColor: alpha(theme.palette.action.hover, 0.08),
|
|
70
|
+
borderRadius: theme.shape.borderRadius,
|
|
71
|
+
margin: '0 4px',
|
|
72
|
+
border: 'none',
|
|
73
|
+
'&.Mui-selected': {
|
|
74
|
+
backgroundColor: theme.palette.primary.main,
|
|
75
|
+
color: theme.palette.primary.contrastText,
|
|
76
|
+
},
|
|
77
|
+
'&:hover': {
|
|
78
|
+
backgroundColor: alpha(theme.palette.action.hover, 0.12),
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
'& .MuiTabs-indicator': {
|
|
82
|
+
display: 'none',
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
case 'outlined':
|
|
86
|
+
return {
|
|
87
|
+
'& .MuiTab-root': {
|
|
88
|
+
...baseStyles,
|
|
89
|
+
border: `1px solid ${alpha(theme.palette.divider, 0.5)}`,
|
|
90
|
+
borderRadius: theme.shape.borderRadius,
|
|
91
|
+
margin: '0 2px',
|
|
92
|
+
'&.Mui-selected': {
|
|
93
|
+
borderColor: theme.palette.primary.main,
|
|
94
|
+
backgroundColor: alpha(theme.palette.primary.main, 0.08),
|
|
95
|
+
color: theme.palette.primary.main,
|
|
96
|
+
},
|
|
97
|
+
'&:hover': {
|
|
98
|
+
borderColor: alpha(theme.palette.primary.main, 0.5),
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
'& .MuiTabs-indicator': {
|
|
102
|
+
display: 'none',
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
case 'pills':
|
|
106
|
+
return {
|
|
107
|
+
'& .MuiTab-root': {
|
|
108
|
+
...baseStyles,
|
|
109
|
+
borderRadius: 25,
|
|
110
|
+
margin: '0 4px',
|
|
111
|
+
backgroundColor: 'transparent',
|
|
112
|
+
border: `1px solid transparent`,
|
|
113
|
+
'&.Mui-selected': {
|
|
114
|
+
backgroundColor: theme.palette.primary.main,
|
|
115
|
+
color: theme.palette.primary.contrastText,
|
|
116
|
+
},
|
|
117
|
+
'&:hover': {
|
|
118
|
+
backgroundColor: alpha(theme.palette.action.hover, 0.08),
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
'& .MuiTabs-indicator': {
|
|
122
|
+
display: 'none',
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
case 'underlined':
|
|
126
|
+
return {
|
|
127
|
+
'& .MuiTab-root': {
|
|
128
|
+
...baseStyles,
|
|
129
|
+
borderBottom: `2px solid transparent`,
|
|
130
|
+
'&.Mui-selected': {
|
|
131
|
+
borderBottomColor: theme.palette.primary.main,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
'& .MuiTabs-indicator': {
|
|
135
|
+
display: 'none',
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
default:
|
|
139
|
+
return {
|
|
140
|
+
'& .MuiTab-root': {
|
|
141
|
+
...baseStyles,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
return React.createElement(Box, { ref }, React.createElement(Tabs$1, {
|
|
147
|
+
value,
|
|
148
|
+
onChange,
|
|
149
|
+
variant,
|
|
150
|
+
orientation,
|
|
151
|
+
centered,
|
|
152
|
+
allowScrollButtonsMobile,
|
|
153
|
+
scrollButtons,
|
|
154
|
+
indicatorColor,
|
|
155
|
+
textColor,
|
|
156
|
+
sx: {
|
|
157
|
+
...getStyleVariantStyles(),
|
|
158
|
+
'& .MuiTab-root': {
|
|
159
|
+
textTransform: 'none',
|
|
160
|
+
fontWeight: 500,
|
|
161
|
+
letterSpacing: '0.5px',
|
|
162
|
+
transition: 'all 0.2s ease-in-out',
|
|
163
|
+
...getStyleVariantStyles()['& .MuiTab-root'],
|
|
164
|
+
...tabSx,
|
|
165
|
+
},
|
|
166
|
+
...sx,
|
|
167
|
+
},
|
|
168
|
+
...props,
|
|
169
|
+
}, ...items.map((item) => {
|
|
170
|
+
// Create the label content based on icon position
|
|
171
|
+
let labelContent;
|
|
172
|
+
if (item.icon) {
|
|
173
|
+
switch (iconPosition) {
|
|
174
|
+
case 'end':
|
|
175
|
+
labelContent = React.createElement(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1, flexDirection: 'row-reverse' } }, item.icon, item.label);
|
|
176
|
+
break;
|
|
177
|
+
case 'top':
|
|
178
|
+
labelContent = React.createElement(Box, { sx: { display: 'flex', alignItems: 'center', gap: 0.5, flexDirection: 'column' } }, item.icon, item.label);
|
|
179
|
+
break;
|
|
180
|
+
case 'bottom':
|
|
181
|
+
labelContent = React.createElement(Box, { sx: { display: 'flex', alignItems: 'center', gap: 0.5, flexDirection: 'column-reverse' } }, item.icon, item.label);
|
|
182
|
+
break;
|
|
183
|
+
default: // 'start'
|
|
184
|
+
labelContent = React.createElement(Box, { sx: { display: 'flex', alignItems: 'center', gap: 1 } }, item.icon, item.label);
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
labelContent = item.label;
|
|
190
|
+
}
|
|
191
|
+
return React.createElement(CustomTab, {
|
|
192
|
+
key: item.value,
|
|
193
|
+
value: item.value,
|
|
194
|
+
disabled: item.disabled,
|
|
195
|
+
badge: item.badge,
|
|
196
|
+
label: labelContent,
|
|
197
|
+
});
|
|
198
|
+
})));
|
|
199
|
+
});
|
|
200
|
+
Tabs.displayName = 'Tabs';
|
|
201
|
+
|
|
202
|
+
export { Tabs, Tabs as default };
|