@zimyo/ui 1.1.4 → 1.1.6

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.
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { AccordionProps as AccordionProps$1, AccordionSummaryProps, AccordionDetailsProps } from '@mui/material';
3
+ import { SxProps } from '@mui/system';
4
+
5
+ interface AccordionProps extends Omit<AccordionProps$1, 'sx' | 'onChange' | 'expanded'> {
6
+ type?: 'single' | 'multiple';
7
+ collapsible?: boolean;
8
+ value?: string | string[];
9
+ defaultValue?: string | string[];
10
+ onValueChange?: (value: string | string[]) => void;
11
+ children: React.ReactNode;
12
+ sx?: SxProps;
13
+ }
14
+ interface AccordionItemProps extends Omit<AccordionProps$1, 'sx'> {
15
+ value: string;
16
+ children: React.ReactNode;
17
+ sx?: SxProps;
18
+ }
19
+ interface AccordionTriggerProps extends Omit<AccordionSummaryProps, 'sx'> {
20
+ children: React.ReactNode;
21
+ sx?: SxProps;
22
+ expandIcon?: React.ReactNode;
23
+ }
24
+ interface AccordionContentProps extends Omit<AccordionDetailsProps, 'sx'> {
25
+ children: React.ReactNode;
26
+ sx?: SxProps;
27
+ }
28
+ declare const Accordion: React.ForwardRefExoticComponent<Omit<AccordionProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
29
+ declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
30
+ declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionTriggerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
31
+ declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
32
+
33
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Accordion as default };
34
+ export type { AccordionContentProps, AccordionItemProps, AccordionProps, AccordionTriggerProps };
@@ -0,0 +1,239 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import React, { forwardRef, createElement } from 'react';
3
+ import { useTheme, Accordion as Accordion$1, AccordionSummary, AccordionDetails } 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 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
123
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode);
124
+
125
+ const AccordionContext = React.createContext({});
126
+ // Main Accordion Container Component
127
+ const Accordion = React.forwardRef(({ type = 'single', collapsible = false, value: controlledValue, defaultValue, onValueChange, children, sx = {}, ...props }, ref) => {
128
+ const theme = useTheme();
129
+ // Internal state management
130
+ const [internalValue, setInternalValue] = React.useState(() => {
131
+ if (controlledValue !== undefined)
132
+ return controlledValue;
133
+ if (defaultValue !== undefined)
134
+ return defaultValue;
135
+ return type === 'multiple' ? [] : '';
136
+ });
137
+ const value = controlledValue !== undefined ? controlledValue : internalValue;
138
+ const handleValueChange = React.useCallback((newValue) => {
139
+ if (controlledValue === undefined) {
140
+ setInternalValue(newValue);
141
+ }
142
+ onValueChange?.(newValue);
143
+ }, [controlledValue, onValueChange]);
144
+ const contextValue = React.useMemo(() => ({
145
+ type,
146
+ collapsible,
147
+ value,
148
+ defaultValue,
149
+ onValueChange: handleValueChange,
150
+ }), [type, collapsible, value, defaultValue, handleValueChange]);
151
+ return (jsx(AccordionContext.Provider, { value: contextValue, children: jsx("div", { ref: ref, style: {
152
+ display: 'flex',
153
+ flexDirection: 'column',
154
+ gap: theme.spacing(1),
155
+ }, ...props, children: children }) }));
156
+ });
157
+ // AccordionItem Component
158
+ const AccordionItem = React.forwardRef(({ value: itemValue, children, sx = {}, ...props }, ref) => {
159
+ const theme = useTheme();
160
+ const context = React.useContext(AccordionContext);
161
+ const isExpanded = React.useMemo(() => {
162
+ if (context.type === 'multiple') {
163
+ return Array.isArray(context.value) && context.value.includes(itemValue);
164
+ }
165
+ return context.value === itemValue;
166
+ }, [context.value, context.type, itemValue]);
167
+ const handleChange = React.useCallback(() => {
168
+ if (!context.onValueChange)
169
+ return;
170
+ if (context.type === 'multiple') {
171
+ const currentValue = Array.isArray(context.value) ? context.value : [];
172
+ const newValue = isExpanded
173
+ ? currentValue.filter(v => v !== itemValue)
174
+ : [...currentValue, itemValue];
175
+ context.onValueChange(newValue);
176
+ }
177
+ else {
178
+ const newValue = isExpanded && context.collapsible ? '' : itemValue;
179
+ context.onValueChange(newValue);
180
+ }
181
+ }, [context, itemValue, isExpanded]);
182
+ return (jsx(Accordion$1, { ref: ref, expanded: isExpanded, onChange: handleChange, variant: "outlined", sx: {
183
+ borderRadius: theme.radius?.sm || theme.shape.borderRadius,
184
+ '&:before': {
185
+ display: 'none',
186
+ },
187
+ '&.Mui-expanded': {
188
+ margin: 0,
189
+ },
190
+ border: `1px solid ${theme.palette.divider}`,
191
+ ...sx,
192
+ }, ...props, children: children }));
193
+ });
194
+ // AccordionTrigger Component
195
+ const AccordionTrigger = React.forwardRef(({ children, sx = {}, expandIcon, ...props }, ref) => {
196
+ const theme = useTheme();
197
+ const defaultExpandIcon = expandIcon !== undefined ? expandIcon : jsx(ChevronDown, {});
198
+ return (jsx(AccordionSummary, { ref: ref, expandIcon: defaultExpandIcon, sx: {
199
+ borderRadius: theme.radius?.sm || theme.shape.borderRadius,
200
+ minHeight: 56,
201
+ fontWeight: 500,
202
+ '&.Mui-expanded': {
203
+ minHeight: 56,
204
+ borderBottomLeftRadius: 0,
205
+ borderBottomRightRadius: 0,
206
+ borderBottom: `1px solid ${theme.palette.divider}`,
207
+ },
208
+ '& .MuiAccordionSummary-content': {
209
+ margin: '12px 0',
210
+ '&.Mui-expanded': {
211
+ margin: '12px 0',
212
+ },
213
+ },
214
+ '& .MuiAccordionSummary-expandIconWrapper': {
215
+ transition: theme.transitions.create('transform', {
216
+ duration: theme.transitions.duration.shortest,
217
+ }),
218
+ '&.Mui-expanded': {
219
+ transform: 'rotate(180deg)',
220
+ },
221
+ },
222
+ '&:hover': {
223
+ backgroundColor: theme.palette.action.hover,
224
+ },
225
+ ...sx,
226
+ }, ...props, children: children }));
227
+ });
228
+ // AccordionContent Component
229
+ const AccordionContent = React.forwardRef(({ children, sx = {}, ...props }, ref) => {
230
+ const theme = useTheme();
231
+ return (jsx(AccordionDetails, { ref: ref, sx: {
232
+ padding: theme.spacing(2),
233
+ borderBottomLeftRadius: theme.radius?.sm || theme.shape.borderRadius,
234
+ borderBottomRightRadius: theme.radius?.sm || theme.shape.borderRadius,
235
+ ...sx,
236
+ }, ...props, children: children }));
237
+ });
238
+
239
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Accordion as default };
@@ -0,0 +1,247 @@
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 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
127
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode);
128
+
129
+ const AccordionContext = React.createContext({});
130
+ // Main Accordion Container Component
131
+ const Accordion = React.forwardRef(({ type = 'single', collapsible = false, value: controlledValue, defaultValue, onValueChange, children, sx = {}, ...props }, ref) => {
132
+ const theme = material.useTheme();
133
+ // Internal state management
134
+ const [internalValue, setInternalValue] = React.useState(() => {
135
+ if (controlledValue !== undefined)
136
+ return controlledValue;
137
+ if (defaultValue !== undefined)
138
+ return defaultValue;
139
+ return type === 'multiple' ? [] : '';
140
+ });
141
+ const value = controlledValue !== undefined ? controlledValue : internalValue;
142
+ const handleValueChange = React.useCallback((newValue) => {
143
+ if (controlledValue === undefined) {
144
+ setInternalValue(newValue);
145
+ }
146
+ onValueChange?.(newValue);
147
+ }, [controlledValue, onValueChange]);
148
+ const contextValue = React.useMemo(() => ({
149
+ type,
150
+ collapsible,
151
+ value,
152
+ defaultValue,
153
+ onValueChange: handleValueChange,
154
+ }), [type, collapsible, value, defaultValue, handleValueChange]);
155
+ return (jsxRuntime.jsx(AccordionContext.Provider, { value: contextValue, children: jsxRuntime.jsx("div", { ref: ref, style: {
156
+ display: 'flex',
157
+ flexDirection: 'column',
158
+ gap: theme.spacing(1),
159
+ }, ...props, children: children }) }));
160
+ });
161
+ // AccordionItem Component
162
+ const AccordionItem = React.forwardRef(({ value: itemValue, children, sx = {}, ...props }, ref) => {
163
+ const theme = material.useTheme();
164
+ const context = React.useContext(AccordionContext);
165
+ const isExpanded = React.useMemo(() => {
166
+ if (context.type === 'multiple') {
167
+ return Array.isArray(context.value) && context.value.includes(itemValue);
168
+ }
169
+ return context.value === itemValue;
170
+ }, [context.value, context.type, itemValue]);
171
+ const handleChange = React.useCallback(() => {
172
+ if (!context.onValueChange)
173
+ return;
174
+ if (context.type === 'multiple') {
175
+ const currentValue = Array.isArray(context.value) ? context.value : [];
176
+ const newValue = isExpanded
177
+ ? currentValue.filter(v => v !== itemValue)
178
+ : [...currentValue, itemValue];
179
+ context.onValueChange(newValue);
180
+ }
181
+ else {
182
+ const newValue = isExpanded && context.collapsible ? '' : itemValue;
183
+ context.onValueChange(newValue);
184
+ }
185
+ }, [context, itemValue, isExpanded]);
186
+ return (jsxRuntime.jsx(material.Accordion, { ref: ref, expanded: isExpanded, onChange: handleChange, variant: "outlined", sx: {
187
+ borderRadius: theme.radius?.sm || theme.shape.borderRadius,
188
+ '&:before': {
189
+ display: 'none',
190
+ },
191
+ '&.Mui-expanded': {
192
+ margin: 0,
193
+ },
194
+ border: `1px solid ${theme.palette.divider}`,
195
+ ...sx,
196
+ }, ...props, children: children }));
197
+ });
198
+ // AccordionTrigger Component
199
+ const AccordionTrigger = React.forwardRef(({ children, sx = {}, expandIcon, ...props }, ref) => {
200
+ const theme = material.useTheme();
201
+ const defaultExpandIcon = expandIcon !== undefined ? expandIcon : jsxRuntime.jsx(ChevronDown, {});
202
+ return (jsxRuntime.jsx(material.AccordionSummary, { ref: ref, expandIcon: defaultExpandIcon, sx: {
203
+ borderRadius: theme.radius?.sm || theme.shape.borderRadius,
204
+ minHeight: 56,
205
+ fontWeight: 500,
206
+ '&.Mui-expanded': {
207
+ minHeight: 56,
208
+ borderBottomLeftRadius: 0,
209
+ borderBottomRightRadius: 0,
210
+ borderBottom: `1px solid ${theme.palette.divider}`,
211
+ },
212
+ '& .MuiAccordionSummary-content': {
213
+ margin: '12px 0',
214
+ '&.Mui-expanded': {
215
+ margin: '12px 0',
216
+ },
217
+ },
218
+ '& .MuiAccordionSummary-expandIconWrapper': {
219
+ transition: theme.transitions.create('transform', {
220
+ duration: theme.transitions.duration.shortest,
221
+ }),
222
+ '&.Mui-expanded': {
223
+ transform: 'rotate(180deg)',
224
+ },
225
+ },
226
+ '&:hover': {
227
+ backgroundColor: theme.palette.action.hover,
228
+ },
229
+ ...sx,
230
+ }, ...props, children: children }));
231
+ });
232
+ // AccordionContent Component
233
+ const AccordionContent = React.forwardRef(({ children, sx = {}, ...props }, ref) => {
234
+ const theme = material.useTheme();
235
+ return (jsxRuntime.jsx(material.AccordionDetails, { ref: ref, sx: {
236
+ padding: theme.spacing(2),
237
+ borderBottomLeftRadius: theme.radius?.sm || theme.shape.borderRadius,
238
+ borderBottomRightRadius: theme.radius?.sm || theme.shape.borderRadius,
239
+ ...sx,
240
+ }, ...props, children: children }));
241
+ });
242
+
243
+ exports.Accordion = Accordion;
244
+ exports.AccordionContent = AccordionContent;
245
+ exports.AccordionItem = AccordionItem;
246
+ exports.AccordionTrigger = AccordionTrigger;
247
+ exports.default = Accordion;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { ButtonProps as ButtonProps$1 } from '@mui/material';
3
+ import { SxProps } from '@mui/system';
4
+
5
+ interface ButtonProps extends Omit<ButtonProps$1, 'sx'> {
6
+ loading?: boolean;
7
+ loadingText?: string;
8
+ sx?: SxProps;
9
+ loaderSize?: number;
10
+ loaderPosition?: 'start' | 'end' | 'center';
11
+ }
12
+ declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
13
+
14
+ export { Button, Button as default };
15
+ export type { ButtonProps };
@@ -0,0 +1,23 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import React from 'react';
3
+ import { useTheme, Button as Button$1, CircularProgress } from '@mui/material';
4
+
5
+ const Button = React.forwardRef(({ children, loading = false, loadingText, loaderSize = 18, loaderPosition = 'start', variant = 'contained', color = 'primary', size = 'medium', sx = {}, disabled, startIcon, endIcon, ...props }, ref) => {
6
+ useTheme();
7
+ const showStartSpinner = loading && loaderPosition === 'start';
8
+ const showEndSpinner = loading && loaderPosition === 'end';
9
+ const showCenterSpinner = loading && loaderPosition === 'center';
10
+ return (jsx(Button$1, { ref: ref, variant: variant, color: color, size: size, disabled: disabled || loading, startIcon: showStartSpinner ? (jsx(CircularProgress, { size: loaderSize, color: "inherit" })) : (startIcon), endIcon: showEndSpinner ? (jsx(CircularProgress, { size: loaderSize, color: "inherit" })) : (endIcon), sx: {
11
+ // borderRadius: theme.radius.sm,
12
+ fontWeight: 500,
13
+ textTransform: 'none',
14
+ letterSpacing: '0.5px',
15
+ px: size === 'small' ? 1.5 : size === 'large' ? 3 : 2,
16
+ py: size === 'small' ? 0.5 : size === 'large' ? 1.5 : 1,
17
+ position: 'relative',
18
+ ...sx,
19
+ }, ...props, children: showCenterSpinner ? (jsx(CircularProgress, { size: loaderSize, color: "inherit" })) : loading && loadingText ? (loadingText) : (children) }));
20
+ });
21
+ Button.displayName = 'Button';
22
+
23
+ export { Button, Button as default };
@@ -0,0 +1,28 @@
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 Button = React.forwardRef(({ children, loading = false, loadingText, loaderSize = 18, loaderPosition = 'start', variant = 'contained', color = 'primary', size = 'medium', sx = {}, disabled, startIcon, endIcon, ...props }, ref) => {
10
+ material.useTheme();
11
+ const showStartSpinner = loading && loaderPosition === 'start';
12
+ const showEndSpinner = loading && loaderPosition === 'end';
13
+ const showCenterSpinner = loading && loaderPosition === 'center';
14
+ return (jsxRuntime.jsx(material.Button, { ref: ref, variant: variant, color: color, size: size, disabled: disabled || loading, startIcon: showStartSpinner ? (jsxRuntime.jsx(material.CircularProgress, { size: loaderSize, color: "inherit" })) : (startIcon), endIcon: showEndSpinner ? (jsxRuntime.jsx(material.CircularProgress, { size: loaderSize, color: "inherit" })) : (endIcon), sx: {
15
+ // borderRadius: theme.radius.sm,
16
+ fontWeight: 500,
17
+ textTransform: 'none',
18
+ letterSpacing: '0.5px',
19
+ px: size === 'small' ? 1.5 : size === 'large' ? 3 : 2,
20
+ py: size === 'small' ? 0.5 : size === 'large' ? 1.5 : 1,
21
+ position: 'relative',
22
+ ...sx,
23
+ }, ...props, children: showCenterSpinner ? (jsxRuntime.jsx(material.CircularProgress, { size: loaderSize, color: "inherit" })) : loading && loadingText ? (loadingText) : (children) }));
24
+ });
25
+ Button.displayName = 'Button';
26
+
27
+ exports.Button = Button;
28
+ exports.default = Button;
@@ -0,0 +1,41 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React$1 from 'react';
3
+ import React__default from 'react';
4
+ import { CardProps } from '@mui/material';
5
+ import { SxProps } from '@mui/system';
6
+
7
+ interface CardRootProps extends CardProps {
8
+ sx?: SxProps;
9
+ variant?: 'elevated' | 'outlined' | 'bordered';
10
+ children: React__default.ReactNode;
11
+ }
12
+
13
+ declare const Card: React$1.FC<CardRootProps> & {
14
+ Header: ({ title, subtitle, action, }: {
15
+ title?: string | React.ReactNode;
16
+ subtitle?: string | React.ReactNode;
17
+ action?: React.ReactNode;
18
+ }) => react_jsx_runtime.JSX.Element;
19
+ Content: ({ children, sx }: {
20
+ children: React.ReactNode;
21
+ sx?: any;
22
+ }) => react_jsx_runtime.JSX.Element;
23
+ Body: ({ children, sx }: {
24
+ children: React.ReactNode;
25
+ sx?: any;
26
+ }) => react_jsx_runtime.JSX.Element;
27
+ Actions: ({ children, sx }: {
28
+ children: React.ReactNode;
29
+ sx?: any;
30
+ }) => react_jsx_runtime.JSX.Element;
31
+ Image: ({ src, height, alt }: {
32
+ src: string;
33
+ height?: number | string;
34
+ alt?: string;
35
+ }) => react_jsx_runtime.JSX.Element;
36
+ Skeleton: ({ lines }: {
37
+ lines?: number;
38
+ }) => react_jsx_runtime.JSX.Element;
39
+ };
40
+
41
+ export { Card as default };
@@ -0,0 +1,36 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { useTheme, Card as Card$1, CardHeader as CardHeader$1, Typography, CardActions as CardActions$1, Box, Skeleton } from '@mui/material';
3
+ import MuiCardContent from '@mui/material/CardContent';
4
+ import CardMedia from '@mui/material/CardMedia';
5
+
6
+ const CardRoot = ({ children, sx = {}, elevation = 1, variant = 'elevated', ...props }) => {
7
+ const theme = useTheme();
8
+ return (jsx(Card$1, { elevation: variant === 'elevated' ? elevation : 0, variant: variant === 'outlined' ? 'outlined' : 'elevation', sx: {
9
+ borderRadius: theme.radius?.sm || 8,
10
+ border: variant === 'bordered' ? `1px solid ${theme.palette.divider}` : 'none',
11
+ overflow: 'hidden',
12
+ backgroundColor: theme.palette.background.paper,
13
+ ...sx,
14
+ }, ...props, children: children }));
15
+ };
16
+
17
+ const CardHeader = ({ title, subtitle, action, }) => (jsx(CardHeader$1, { title: typeof title === 'string' ? (jsx(Typography, { variant: "h6", fontWeight: 600, children: title })) : (title), subheader: typeof subtitle === 'string' ? (jsx(Typography, { variant: "body2", color: "text.secondary", children: subtitle })) : (subtitle), action: action }));
18
+
19
+ const CardContent = ({ children, sx }) => (jsx(MuiCardContent, { sx: sx, children: children }));
20
+
21
+ const CardActions = ({ children, sx }) => (jsx(CardActions$1, { sx: sx, children: children }));
22
+
23
+ const CardImage = ({ src, height = 160, alt = 'card image' }) => (jsx(CardMedia, { component: "img", height: height, image: src, alt: alt }));
24
+
25
+ const CardSkeleton = ({ lines = 3 }) => (jsxs(Box, { p: 2, children: [jsx(Skeleton, { variant: "rectangular", height: 140 }), [...Array(lines)].map((_, i) => (jsx(Skeleton, { variant: "text", height: 20, sx: { mt: 1 } }, i)))] }));
26
+
27
+ const Card = Object.assign(CardRoot, {
28
+ Header: CardHeader,
29
+ Content: CardContent,
30
+ Body: CardContent, // alias
31
+ Actions: CardActions,
32
+ Image: CardImage,
33
+ Skeleton: CardSkeleton,
34
+ });
35
+
36
+ export { Card as default };