@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.
Files changed (40) hide show
  1. package/dist/Accordion/index.d.ts +34 -0
  2. package/dist/Accordion/index.esm.js +239 -0
  3. package/dist/Accordion/index.js +247 -0
  4. package/dist/Button/index.d.ts +15 -0
  5. package/dist/Button/index.esm.js +13 -0
  6. package/dist/Button/index.js +18 -0
  7. package/dist/Card/index.d.ts +41 -0
  8. package/dist/Card/index.esm.js +36 -0
  9. package/dist/Card/index.js +38 -0
  10. package/dist/Modal/index.d.ts +17 -0
  11. package/dist/Modal/index.esm.js +144 -0
  12. package/dist/Modal/index.js +149 -0
  13. package/dist/Popover/index.d.ts +19 -0
  14. package/dist/Popover/index.esm.js +22 -0
  15. package/dist/Popover/index.js +27 -0
  16. package/dist/RadioGroup/index.d.ts +31 -0
  17. package/dist/RadioGroup/index.esm.js +91 -0
  18. package/dist/RadioGroup/index.js +96 -0
  19. package/dist/Select/index.d.ts +22 -0
  20. package/dist/Select/index.esm.js +195 -0
  21. package/dist/Select/index.js +200 -0
  22. package/dist/Switch/index.d.ts +14 -0
  23. package/dist/Switch/index.esm.js +9 -0
  24. package/dist/Switch/index.js +14 -0
  25. package/dist/Tabs/index.d.ts +36 -0
  26. package/dist/Tabs/index.esm.js +202 -0
  27. package/dist/Tabs/index.js +207 -0
  28. package/dist/TextInput/index.d.ts +18 -0
  29. package/dist/TextInput/index.esm.js +33 -0
  30. package/dist/TextInput/index.js +38 -0
  31. package/dist/Typography/index.d.ts +30 -0
  32. package/dist/Typography/index.esm.js +57 -0
  33. package/dist/Typography/index.js +66 -0
  34. package/dist/index.d.ts +222 -0
  35. package/dist/index.esm.js +750 -0
  36. package/dist/index.js +772 -0
  37. package/dist/theme/index.d.ts +91 -0
  38. package/dist/theme/index.esm.js +234 -0
  39. package/dist/theme/index.js +239 -0
  40. package/package.json +1 -1
@@ -0,0 +1,38 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var material = require('@mui/material');
5
+ var MuiCardContent = require('@mui/material/CardContent');
6
+ var CardMedia = require('@mui/material/CardMedia');
7
+
8
+ const CardRoot = ({ children, sx = {}, elevation = 1, variant = 'elevated', ...props }) => {
9
+ const theme = material.useTheme();
10
+ return (jsxRuntime.jsx(material.Card, { elevation: variant === 'elevated' ? elevation : 0, variant: variant === 'outlined' ? 'outlined' : 'elevation', sx: {
11
+ borderRadius: theme.radius?.sm || 8,
12
+ border: variant === 'bordered' ? `1px solid ${theme.palette.divider}` : 'none',
13
+ overflow: 'hidden',
14
+ backgroundColor: theme.palette.background.paper,
15
+ ...sx,
16
+ }, ...props, children: children }));
17
+ };
18
+
19
+ const CardHeader = ({ title, subtitle, action, }) => (jsxRuntime.jsx(material.CardHeader, { title: typeof title === 'string' ? (jsxRuntime.jsx(material.Typography, { variant: "h6", fontWeight: 600, children: title })) : (title), subheader: typeof subtitle === 'string' ? (jsxRuntime.jsx(material.Typography, { variant: "body2", color: "text.secondary", children: subtitle })) : (subtitle), action: action }));
20
+
21
+ const CardContent = ({ children, sx }) => (jsxRuntime.jsx(MuiCardContent, { sx: sx, children: children }));
22
+
23
+ const CardActions = ({ children, sx }) => (jsxRuntime.jsx(material.CardActions, { sx: sx, children: children }));
24
+
25
+ const CardImage = ({ src, height = 160, alt = 'card image' }) => (jsxRuntime.jsx(CardMedia, { component: "img", height: height, image: src, alt: alt }));
26
+
27
+ const CardSkeleton = ({ lines = 3 }) => (jsxRuntime.jsxs(material.Box, { p: 2, children: [jsxRuntime.jsx(material.Skeleton, { variant: "rectangular", height: 140 }), [...Array(lines)].map((_, i) => (jsxRuntime.jsx(material.Skeleton, { variant: "text", height: 20, sx: { mt: 1 } }, i)))] }));
28
+
29
+ const Card = Object.assign(CardRoot, {
30
+ Header: CardHeader,
31
+ Content: CardContent,
32
+ Body: CardContent, // alias
33
+ Actions: CardActions,
34
+ Image: CardImage,
35
+ Skeleton: CardSkeleton,
36
+ });
37
+
38
+ module.exports = Card;
@@ -0,0 +1,17 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { DialogProps } from '@mui/material';
3
+ import { ReactNode } from 'react';
4
+
5
+ interface ModalProps extends Omit<DialogProps, 'title'> {
6
+ open: boolean;
7
+ onClose: () => void;
8
+ title?: ReactNode;
9
+ content?: ReactNode;
10
+ actions?: ReactNode;
11
+ maxWidth?: DialogProps['maxWidth'];
12
+ fullWidth?: boolean;
13
+ }
14
+ declare const Modal: ({ open, onClose, title, content, actions, fullWidth, maxWidth, ...rest }: ModalProps) => react_jsx_runtime.JSX.Element;
15
+
16
+ export { Modal, Modal as default };
17
+ export type { ModalProps };
@@ -0,0 +1,144 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Typography, useTheme, Dialog, DialogTitle, IconButton, DialogContent, DialogActions } from '@mui/material';
3
+ import { forwardRef, createElement } from 'react';
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 = [
123
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
124
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
125
+ ];
126
+ const X = createLucideIcon("x", __iconNode);
127
+
128
+ const Heading = ({ level = 1, ...props }) => {
129
+ const variant = `h${level}`;
130
+ return (jsx(Typography, { variant: variant, component: props.component || `h${level}`, fontWeight: 600, gutterBottom: true, ...props }));
131
+ };
132
+
133
+ const Modal = ({ open, onClose, title, content, actions, fullWidth = true, maxWidth = 'sm', ...rest }) => {
134
+ const theme = useTheme();
135
+ return (jsxs(Dialog, { open: open, onClose: onClose, fullWidth: fullWidth, maxWidth: maxWidth, scroll: "body", PaperProps: {
136
+ sx: {
137
+ borderRadius: 1.5,
138
+ p: 1,
139
+ backgroundColor: theme.palette.background.paper,
140
+ },
141
+ }, ...rest, children: [!!title && (jsxs(DialogTitle, { sx: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' }, children: [jsx(Heading, { level: 6, children: title }), jsx(IconButton, { edge: "end", onClick: onClose, children: jsx(X, { size: 18, strokeWidth: 2 }) })] })), !!content && jsx(DialogContent, { dividers: true, children: content }), !!actions && jsx(DialogActions, { children: actions })] }));
142
+ };
143
+
144
+ export { Modal, Modal as default };
@@ -0,0 +1,149 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var material = require('@mui/material');
7
+ var react = require('react');
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 = [
127
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
128
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
129
+ ];
130
+ const X = createLucideIcon("x", __iconNode);
131
+
132
+ const Heading = ({ level = 1, ...props }) => {
133
+ const variant = `h${level}`;
134
+ return (jsxRuntime.jsx(material.Typography, { variant: variant, component: props.component || `h${level}`, fontWeight: 600, gutterBottom: true, ...props }));
135
+ };
136
+
137
+ const Modal = ({ open, onClose, title, content, actions, fullWidth = true, maxWidth = 'sm', ...rest }) => {
138
+ const theme = material.useTheme();
139
+ return (jsxRuntime.jsxs(material.Dialog, { open: open, onClose: onClose, fullWidth: fullWidth, maxWidth: maxWidth, scroll: "body", PaperProps: {
140
+ sx: {
141
+ borderRadius: 1.5,
142
+ p: 1,
143
+ backgroundColor: theme.palette.background.paper,
144
+ },
145
+ }, ...rest, children: [!!title && (jsxRuntime.jsxs(material.DialogTitle, { sx: { display: 'flex', justifyContent: 'space-between', alignItems: 'center' }, children: [jsxRuntime.jsx(Heading, { level: 6, children: title }), jsxRuntime.jsx(material.IconButton, { edge: "end", onClick: onClose, children: jsxRuntime.jsx(X, { size: 18, strokeWidth: 2 }) })] })), !!content && jsxRuntime.jsx(material.DialogContent, { dividers: true, children: content }), !!actions && jsxRuntime.jsx(material.DialogActions, { children: actions })] }));
146
+ };
147
+
148
+ exports.Modal = Modal;
149
+ exports.default = Modal;
@@ -0,0 +1,19 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+ import { PopoverProps as PopoverProps$1 } from '@mui/material';
4
+
5
+ interface PopoverProps extends Partial<PopoverProps$1> {
6
+ open: boolean;
7
+ onClose: () => void;
8
+ anchorEl: HTMLElement | null;
9
+ children: React.ReactNode;
10
+ width?: number | string;
11
+ maxWidth?: number | string;
12
+ minWidth?: number | string;
13
+ padding?: number;
14
+ border?: boolean;
15
+ }
16
+ declare const Popover: ({ open, onClose, anchorEl, children, width, maxWidth, minWidth, padding, border, anchorOrigin, transformOrigin, ...rest }: PopoverProps) => react_jsx_runtime.JSX.Element;
17
+
18
+ export { Popover, Popover as default };
19
+ export type { PopoverProps };
@@ -0,0 +1,22 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useTheme, Popover as Popover$1, Fade } from '@mui/material';
3
+
4
+ const Popover = ({ open, onClose, anchorEl, children, width = 240, maxWidth = '100%', minWidth = 200, padding = 2, border = true, anchorOrigin = { vertical: 'bottom', horizontal: 'left' }, transformOrigin = { vertical: 'top', horizontal: 'left' }, ...rest }) => {
5
+ const theme = useTheme();
6
+ return (jsx(Popover$1, { open: open, anchorEl: anchorEl, onClose: onClose, disableScrollLock: true, TransitionComponent: Fade, transitionDuration: 150, anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, PaperProps: {
7
+ elevation: 0,
8
+ sx: {
9
+ boxShadow: 'none',
10
+ bgcolor: theme.palette.background.paper,
11
+ border: border ? `1px solid ${theme.palette.divider}` : 'none',
12
+ borderRadius: theme.radius.md,
13
+ px: theme.spacing(padding),
14
+ py: theme.spacing(padding),
15
+ width,
16
+ maxWidth,
17
+ minWidth,
18
+ },
19
+ }, ...rest, children: children }));
20
+ };
21
+
22
+ export { Popover, Popover as default };
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var material = require('@mui/material');
7
+
8
+ const Popover = ({ open, onClose, anchorEl, children, width = 240, maxWidth = '100%', minWidth = 200, padding = 2, border = true, anchorOrigin = { vertical: 'bottom', horizontal: 'left' }, transformOrigin = { vertical: 'top', horizontal: 'left' }, ...rest }) => {
9
+ const theme = material.useTheme();
10
+ return (jsxRuntime.jsx(material.Popover, { open: open, anchorEl: anchorEl, onClose: onClose, disableScrollLock: true, TransitionComponent: material.Fade, transitionDuration: 150, anchorOrigin: anchorOrigin, transformOrigin: transformOrigin, PaperProps: {
11
+ elevation: 0,
12
+ sx: {
13
+ boxShadow: 'none',
14
+ bgcolor: theme.palette.background.paper,
15
+ border: border ? `1px solid ${theme.palette.divider}` : 'none',
16
+ borderRadius: theme.radius.md,
17
+ px: theme.spacing(padding),
18
+ py: theme.spacing(padding),
19
+ width,
20
+ maxWidth,
21
+ minWidth,
22
+ },
23
+ }, ...rest, children: children }));
24
+ };
25
+
26
+ exports.Popover = Popover;
27
+ exports.default = Popover;
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { SxProps } from '@mui/system';
3
+
4
+ interface RadioOption {
5
+ value: string;
6
+ label: string;
7
+ disabled?: boolean;
8
+ description?: string;
9
+ }
10
+ interface RadioGroupProps {
11
+ label?: string;
12
+ options: RadioOption[];
13
+ value?: string;
14
+ defaultValue?: string;
15
+ onChange?: (value: string) => void;
16
+ name?: string;
17
+ disabled?: boolean;
18
+ required?: boolean;
19
+ error?: boolean;
20
+ helperText?: string;
21
+ row?: boolean;
22
+ size?: 'small' | 'medium';
23
+ color?: 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
24
+ sx?: SxProps;
25
+ radioSx?: SxProps;
26
+ labelSx?: SxProps;
27
+ }
28
+ declare const RadioGroup: React.ForwardRefExoticComponent<RadioGroupProps & React.RefAttributes<HTMLDivElement>>;
29
+
30
+ export { RadioGroup, RadioGroup as default };
31
+ export type { RadioGroupProps, RadioOption };
@@ -0,0 +1,91 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import React from 'react';
3
+ import { useTheme, FormControl, FormLabel, Typography, RadioGroup as RadioGroup$1, Box, FormControlLabel, Radio, FormHelperText } from '@mui/material';
4
+
5
+ const RadioGroup = React.forwardRef(({ label, options = [], value, defaultValue, onChange, name, disabled = false, required = false, error = false, helperText, row = false, size = 'medium', color = 'primary', sx = {}, radioSx = {}, labelSx = {}, ...props }, ref) => {
6
+ const theme = useTheme();
7
+ const [internalValue, setInternalValue] = React.useState(value || defaultValue || '');
8
+ // Sync with external value prop
9
+ React.useEffect(() => {
10
+ if (value !== undefined) {
11
+ setInternalValue(value);
12
+ }
13
+ }, [value]);
14
+ const handleChange = (event) => {
15
+ const newValue = event.target.value;
16
+ if (value === undefined) {
17
+ setInternalValue(newValue);
18
+ }
19
+ onChange?.(newValue);
20
+ };
21
+ const currentValue = value !== undefined ? value : internalValue;
22
+ return (jsxs(FormControl, { ref: ref, component: "fieldset", variant: "standard", disabled: disabled, required: required, error: error, sx: {
23
+ borderRadius: '8px',
24
+ ...sx,
25
+ }, ...props, children: [label && (jsxs(FormLabel, { component: "legend", sx: {
26
+ fontWeight: 500,
27
+ fontSize: size === 'small' ? '0.875rem' : '1rem',
28
+ color: disabled
29
+ ? theme.palette.text.disabled
30
+ : error
31
+ ? theme.palette.error.main
32
+ : theme.palette.text.primary,
33
+ '&.Mui-focused': {
34
+ color: error
35
+ ? theme.palette.error.main
36
+ : `${theme.palette[color].main}`,
37
+ },
38
+ mb: 1,
39
+ ...labelSx,
40
+ }, children: [label, required && (jsx(Typography, { component: "span", sx: {
41
+ color: theme.palette.error.main,
42
+ ml: 0.5,
43
+ fontSize: 'inherit',
44
+ }, children: "*" }))] })), jsx(RadioGroup$1, { name: name, value: currentValue, onChange: handleChange, row: row, sx: {
45
+ gap: size === 'small' ? 1 : 1.5,
46
+ '& .MuiFormControlLabel-root': {
47
+ marginLeft: 0,
48
+ marginRight: row ? 2 : 0,
49
+ },
50
+ }, children: options.map((option) => (jsx(Box, { children: jsx(FormControlLabel, { value: option.value, disabled: disabled || option.disabled, control: jsx(Radio, { size: size, color: color, sx: {
51
+ '&.Mui-checked': {
52
+ color: error
53
+ ? theme.palette.error.main
54
+ : `${theme.palette[color].main}`,
55
+ },
56
+ alignSelf: option.description ? 'flex-start' : 'center',
57
+ mt: option.description ? 0.25 : 0,
58
+ ...radioSx,
59
+ } }), label: jsxs(Box, { sx: { display: 'flex', flexDirection: 'column' }, children: [jsx(Typography, { variant: size === 'small' ? 'body2' : 'body1', sx: {
60
+ fontWeight: 400,
61
+ color: disabled || option.disabled
62
+ ? theme.palette.text.disabled
63
+ : theme.palette.text.primary,
64
+ lineHeight: 1.5,
65
+ }, children: option.label }), option.description && (jsx(Typography, { variant: "caption", sx: {
66
+ color: disabled || option.disabled
67
+ ? theme.palette.text.disabled
68
+ : theme.palette.text.secondary,
69
+ mt: 0.25,
70
+ lineHeight: 1.4,
71
+ }, children: option.description }))] }), sx: {
72
+ alignItems: option.description ? 'flex-start' : 'center',
73
+ margin: 0,
74
+ display: 'flex',
75
+ '& .MuiFormControlLabel-label': {
76
+ ml: 1,
77
+ flex: 1,
78
+ },
79
+ '& .MuiButtonBase-root': {
80
+ p: size === 'small' ? 0.5 : 1,
81
+ },
82
+ } }) }, option.value))) }), helperText && (jsx(FormHelperText, { sx: {
83
+ mt: 1,
84
+ fontSize: size === 'small' ? '0.75rem' : '0.875rem',
85
+ color: error
86
+ ? theme.palette.error.main
87
+ : theme.palette.text.secondary,
88
+ }, children: helperText }))] }));
89
+ });
90
+
91
+ export { RadioGroup, RadioGroup as default };
@@ -0,0 +1,96 @@
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 RadioGroup = React.forwardRef(({ label, options = [], value, defaultValue, onChange, name, disabled = false, required = false, error = false, helperText, row = false, size = 'medium', color = 'primary', sx = {}, radioSx = {}, labelSx = {}, ...props }, ref) => {
10
+ const theme = material.useTheme();
11
+ const [internalValue, setInternalValue] = React.useState(value || defaultValue || '');
12
+ // Sync with external value prop
13
+ React.useEffect(() => {
14
+ if (value !== undefined) {
15
+ setInternalValue(value);
16
+ }
17
+ }, [value]);
18
+ const handleChange = (event) => {
19
+ const newValue = event.target.value;
20
+ if (value === undefined) {
21
+ setInternalValue(newValue);
22
+ }
23
+ onChange?.(newValue);
24
+ };
25
+ const currentValue = value !== undefined ? value : internalValue;
26
+ return (jsxRuntime.jsxs(material.FormControl, { ref: ref, component: "fieldset", variant: "standard", disabled: disabled, required: required, error: error, sx: {
27
+ borderRadius: '8px',
28
+ ...sx,
29
+ }, ...props, children: [label && (jsxRuntime.jsxs(material.FormLabel, { component: "legend", sx: {
30
+ fontWeight: 500,
31
+ fontSize: size === 'small' ? '0.875rem' : '1rem',
32
+ color: disabled
33
+ ? theme.palette.text.disabled
34
+ : error
35
+ ? theme.palette.error.main
36
+ : theme.palette.text.primary,
37
+ '&.Mui-focused': {
38
+ color: error
39
+ ? theme.palette.error.main
40
+ : `${theme.palette[color].main}`,
41
+ },
42
+ mb: 1,
43
+ ...labelSx,
44
+ }, children: [label, required && (jsxRuntime.jsx(material.Typography, { component: "span", sx: {
45
+ color: theme.palette.error.main,
46
+ ml: 0.5,
47
+ fontSize: 'inherit',
48
+ }, children: "*" }))] })), jsxRuntime.jsx(material.RadioGroup, { name: name, value: currentValue, onChange: handleChange, row: row, sx: {
49
+ gap: size === 'small' ? 1 : 1.5,
50
+ '& .MuiFormControlLabel-root': {
51
+ marginLeft: 0,
52
+ marginRight: row ? 2 : 0,
53
+ },
54
+ }, children: options.map((option) => (jsxRuntime.jsx(material.Box, { children: jsxRuntime.jsx(material.FormControlLabel, { value: option.value, disabled: disabled || option.disabled, control: jsxRuntime.jsx(material.Radio, { size: size, color: color, sx: {
55
+ '&.Mui-checked': {
56
+ color: error
57
+ ? theme.palette.error.main
58
+ : `${theme.palette[color].main}`,
59
+ },
60
+ alignSelf: option.description ? 'flex-start' : 'center',
61
+ mt: option.description ? 0.25 : 0,
62
+ ...radioSx,
63
+ } }), label: jsxRuntime.jsxs(material.Box, { sx: { display: 'flex', flexDirection: 'column' }, children: [jsxRuntime.jsx(material.Typography, { variant: size === 'small' ? 'body2' : 'body1', sx: {
64
+ fontWeight: 400,
65
+ color: disabled || option.disabled
66
+ ? theme.palette.text.disabled
67
+ : theme.palette.text.primary,
68
+ lineHeight: 1.5,
69
+ }, children: option.label }), option.description && (jsxRuntime.jsx(material.Typography, { variant: "caption", sx: {
70
+ color: disabled || option.disabled
71
+ ? theme.palette.text.disabled
72
+ : theme.palette.text.secondary,
73
+ mt: 0.25,
74
+ lineHeight: 1.4,
75
+ }, children: option.description }))] }), sx: {
76
+ alignItems: option.description ? 'flex-start' : 'center',
77
+ margin: 0,
78
+ display: 'flex',
79
+ '& .MuiFormControlLabel-label': {
80
+ ml: 1,
81
+ flex: 1,
82
+ },
83
+ '& .MuiButtonBase-root': {
84
+ p: size === 'small' ? 0.5 : 1,
85
+ },
86
+ } }) }, option.value))) }), helperText && (jsxRuntime.jsx(material.FormHelperText, { sx: {
87
+ mt: 1,
88
+ fontSize: size === 'small' ? '0.75rem' : '0.875rem',
89
+ color: error
90
+ ? theme.palette.error.main
91
+ : theme.palette.text.secondary,
92
+ }, children: helperText }))] }));
93
+ });
94
+
95
+ exports.RadioGroup = RadioGroup;
96
+ exports.default = RadioGroup;
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { SelectProps as SelectProps$1, SelectChangeEvent } from '@mui/material';
3
+
4
+ interface OptionType {
5
+ label: string;
6
+ value: string | number;
7
+ }
8
+ interface SelectProps extends Omit<SelectProps$1, 'value' | 'onChange'> {
9
+ label?: string;
10
+ options: OptionType[];
11
+ error?: boolean;
12
+ helperText?: string;
13
+ required?: boolean;
14
+ placeholder?: string;
15
+ value?: any;
16
+ onChange?: (event: SelectChangeEvent<any>) => void;
17
+ isMulti?: boolean;
18
+ }
19
+ declare const Select: React.ForwardRefExoticComponent<Omit<SelectProps, "ref"> & React.RefAttributes<any>>;
20
+
21
+ export { Select, Select as default };
22
+ export type { SelectProps };