@zimyo/ui 1.1.2 → 1.1.4

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/index.esm.js DELETED
@@ -1,253 +0,0 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import React from 'react';
3
- import { useTheme, Button as Button$1, CircularProgress, Card as Card$1, CardHeader as CardHeader$1, Typography, CardActions as CardActions$1, Box, Skeleton, CssBaseline } from '@mui/material';
4
- import MuiCardContent from '@mui/material/CardContent';
5
- import CardMedia from '@mui/material/CardMedia';
6
- import { createTheme, ThemeProvider } from '@mui/material/styles';
7
-
8
- const Button = React.forwardRef(({ children, loading = false, loadingText, loaderSize = 18, loaderPosition = 'start', variant = 'contained', color = 'primary', size = 'medium', sx = {}, disabled, startIcon, endIcon, ...props }, ref) => {
9
- const theme = useTheme();
10
- const showStartSpinner = loading && loaderPosition === 'start';
11
- const showEndSpinner = loading && loaderPosition === 'end';
12
- const showCenterSpinner = loading && loaderPosition === 'center';
13
- 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: {
14
- borderRadius: theme.radius.sm,
15
- fontWeight: 500,
16
- textTransform: 'none',
17
- letterSpacing: '0.5px',
18
- px: size === 'small' ? 1.5 : size === 'large' ? 3 : 2,
19
- py: size === 'small' ? 0.5 : size === 'large' ? 1.5 : 1,
20
- position: 'relative',
21
- ...sx,
22
- }, ...props, children: showCenterSpinner ? (jsx(CircularProgress, { size: loaderSize, color: "inherit" })) : loading && loadingText ? (loadingText) : (children) }));
23
- });
24
- Button.displayName = 'Button';
25
-
26
- const CardRoot = ({ children, sx = {}, elevation = 1, variant = 'elevated', ...props }) => {
27
- const theme = useTheme();
28
- return (jsx(Card$1, { elevation: variant === 'elevated' ? elevation : 0, variant: variant === 'outlined' ? 'outlined' : 'elevation', sx: {
29
- borderRadius: theme.radius?.sm || 8,
30
- border: variant === 'bordered' ? `1px solid ${theme.palette.divider}` : 'none',
31
- overflow: 'hidden',
32
- backgroundColor: theme.palette.background.paper,
33
- ...sx,
34
- }, ...props, children: children }));
35
- };
36
-
37
- 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 }));
38
-
39
- const CardContent = ({ children, sx }) => (jsx(MuiCardContent, { sx: sx, children: children }));
40
-
41
- const CardActions = ({ children, sx }) => (jsx(CardActions$1, { sx: sx, children: children }));
42
-
43
- const CardImage = ({ src, height = 160, alt = 'card image' }) => (jsx(CardMedia, { component: "img", height: height, image: src, alt: alt }));
44
-
45
- 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)))] }));
46
-
47
- const Card = Object.assign(CardRoot, {
48
- Header: CardHeader,
49
- Content: CardContent,
50
- Body: CardContent, // alias
51
- Actions: CardActions,
52
- Image: CardImage,
53
- Skeleton: CardSkeleton,
54
- });
55
-
56
- const Heading = ({ level = 1, ...props }) => {
57
- const variant = `h${level}`;
58
- return (jsx(Typography, { variant: variant, component: props.component || `h${level}`, fontWeight: 600, gutterBottom: true, ...props }));
59
- };
60
-
61
- const Text = ({ size = 'md', ...props }) => {
62
- const variantMap = {
63
- sm: 'body2',
64
- md: 'body1',
65
- lg: 'subtitle1',
66
- };
67
- return (jsx(Typography, { variant: variantMap[size], component: props.component || 'p', ...props }));
68
- };
69
-
70
- const Lead = (props) => {
71
- return (jsx(Typography, { variant: "subtitle1", component: props.component || 'p', fontWeight: 400, color: "text.secondary", ...props }));
72
- };
73
-
74
- const Muted = (props) => {
75
- return (jsx(Typography, { variant: "body2", component: props.component || 'span', color: "text.disabled", ...props }));
76
- };
77
-
78
- const Strong = (props) => {
79
- return (jsx(Typography, { component: props.component || 'strong', fontWeight: 700, display: "inline", ...props }));
80
- };
81
-
82
- const Caption = (props) => {
83
- return (jsx(Typography, { variant: "caption", color: "text.secondary", component: props.component || 'span', ...props }));
84
- };
85
-
86
- const Blockquote = (props) => {
87
- return (jsx(Typography, { component: "blockquote", sx: {
88
- borderLeft: '4px solid',
89
- borderColor: 'divider',
90
- pl: 2,
91
- color: 'text.secondary',
92
- fontStyle: 'italic',
93
- }, ...props }));
94
- };
95
-
96
- const Code = ({ children, sx }) => {
97
- return (jsx(Box, { component: "code", sx: {
98
- fontFamily: 'monospace',
99
- backgroundColor: 'grey.100',
100
- color: 'primary.main',
101
- px: 0.5,
102
- py: 0.25,
103
- borderRadius: 1,
104
- fontSize: '0.875rem',
105
- ...sx,
106
- }, children: children }));
107
- };
108
-
109
- var index = /*#__PURE__*/Object.freeze({
110
- __proto__: null,
111
- Blockquote: Blockquote,
112
- Caption: Caption,
113
- Code: Code,
114
- Heading: Heading,
115
- Lead: Lead,
116
- Muted: Muted,
117
- Strong: Strong,
118
- Text: Text
119
- });
120
-
121
- const designTokens = {
122
- colors: {
123
- primary: {
124
- 50: '#e3f2fd',
125
- 100: '#bbdefb',
126
- 500: '#2196f3',
127
- 900: '#0d47a1',
128
- },
129
- secondary: {
130
- 50: '#fce4ec',
131
- 100: '#f8bbd9',
132
- 500: '#e91e63',
133
- 900: '#880e4f',
134
- },
135
- neutral: {
136
- 50: '#fafafa',
137
- 100: '#f5f5f5',
138
- 200: '#eeeeee',
139
- 500: '#9e9e9e',
140
- 900: '#212121',
141
- },
142
- },
143
- spacing: {
144
- xs: '4px',
145
- sm: '8px',
146
- md: '16px',
147
- lg: '24px',
148
- xl: '32px',
149
- },
150
- radius: {
151
- xs: "2px",
152
- sm: '4px',
153
- md: '8px',
154
- lg: '12px',
155
- xl: '16px',
156
- full: '9999px',
157
- },
158
- typography: {
159
- fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
160
- fontSize: {
161
- xs: '0.75rem',
162
- sm: '0.875rem',
163
- md: '1rem',
164
- lg: '1.25rem',
165
- xl: '1.5rem',
166
- },
167
- },
168
- };
169
-
170
- const createCustomTheme = (config = {}) => {
171
- const { primaryColor = designTokens.colors.primary[500], secondaryColor = designTokens.colors.secondary[500], } = config;
172
- return createTheme({
173
- palette: {
174
- primary: {
175
- main: primaryColor,
176
- },
177
- secondary: {
178
- main: secondaryColor,
179
- },
180
- },
181
- typography: {
182
- fontFamily: designTokens.typography.fontFamily,
183
- h1: { fontWeight: 600 },
184
- h2: { fontWeight: 600 },
185
- h3: { fontWeight: 600 },
186
- h4: { fontWeight: 600 },
187
- h5: { fontWeight: 600 },
188
- h6: { fontWeight: 600 },
189
- },
190
- spacing: 8,
191
- shape: {
192
- borderRadius: 8,
193
- },
194
- radius: designTokens.radius,
195
- components: {
196
- MuiButton: {
197
- styleOverrides: {
198
- root: {
199
- textTransform: 'none',
200
- borderRadius: '4px',
201
- // fontWeight: 600,
202
- letterSpacing: '0.5px',
203
- padding: '8px 16px',
204
- },
205
- sizeSmall: {
206
- padding: '4px 12px',
207
- fontSize: '0.875rem',
208
- },
209
- sizeLarge: {
210
- padding: '12px 24px',
211
- fontSize: '1rem',
212
- },
213
- },
214
- defaultProps: {
215
- disableElevation: true
216
- }
217
- },
218
- MuiCard: {
219
- styleOverrides: {
220
- root: {
221
- borderRadius: '12px',
222
- boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
223
- },
224
- },
225
- },
226
- MuiTextField: {
227
- styleOverrides: {
228
- root: {
229
- '& .MuiOutlinedInput-root': {
230
- borderRadius: '8px',
231
- },
232
- },
233
- },
234
- },
235
- },
236
- });
237
- };
238
- // Default theme
239
- const theme = createCustomTheme();
240
-
241
- const UILibraryThemeProvider = ({ children, primaryColor, secondaryColor, enableCssBaseline = true, }) => {
242
- const themeConfig = {};
243
- if (primaryColor) {
244
- themeConfig.primaryColor = primaryColor;
245
- }
246
- if (secondaryColor) {
247
- themeConfig.secondaryColor = secondaryColor;
248
- }
249
- const theme = createCustomTheme(themeConfig);
250
- return (jsxs(ThemeProvider, { theme: theme, children: [enableCssBaseline && jsx(CssBaseline, {}), children] }));
251
- };
252
-
253
- export { Button, Card, index as Typography, UILibraryThemeProvider, createCustomTheme, designTokens, theme };
package/dist/index.js DELETED
@@ -1,261 +0,0 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var React = require('react');
5
- var material = require('@mui/material');
6
- var MuiCardContent = require('@mui/material/CardContent');
7
- var CardMedia = require('@mui/material/CardMedia');
8
- var styles = require('@mui/material/styles');
9
-
10
- const Button = React.forwardRef(({ children, loading = false, loadingText, loaderSize = 18, loaderPosition = 'start', variant = 'contained', color = 'primary', size = 'medium', sx = {}, disabled, startIcon, endIcon, ...props }, ref) => {
11
- const theme = material.useTheme();
12
- const showStartSpinner = loading && loaderPosition === 'start';
13
- const showEndSpinner = loading && loaderPosition === 'end';
14
- const showCenterSpinner = loading && loaderPosition === 'center';
15
- 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: {
16
- borderRadius: theme.radius.sm,
17
- fontWeight: 500,
18
- textTransform: 'none',
19
- letterSpacing: '0.5px',
20
- px: size === 'small' ? 1.5 : size === 'large' ? 3 : 2,
21
- py: size === 'small' ? 0.5 : size === 'large' ? 1.5 : 1,
22
- position: 'relative',
23
- ...sx,
24
- }, ...props, children: showCenterSpinner ? (jsxRuntime.jsx(material.CircularProgress, { size: loaderSize, color: "inherit" })) : loading && loadingText ? (loadingText) : (children) }));
25
- });
26
- Button.displayName = 'Button';
27
-
28
- const CardRoot = ({ children, sx = {}, elevation = 1, variant = 'elevated', ...props }) => {
29
- const theme = material.useTheme();
30
- return (jsxRuntime.jsx(material.Card, { elevation: variant === 'elevated' ? elevation : 0, variant: variant === 'outlined' ? 'outlined' : 'elevation', sx: {
31
- borderRadius: theme.radius?.sm || 8,
32
- border: variant === 'bordered' ? `1px solid ${theme.palette.divider}` : 'none',
33
- overflow: 'hidden',
34
- backgroundColor: theme.palette.background.paper,
35
- ...sx,
36
- }, ...props, children: children }));
37
- };
38
-
39
- 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 }));
40
-
41
- const CardContent = ({ children, sx }) => (jsxRuntime.jsx(MuiCardContent, { sx: sx, children: children }));
42
-
43
- const CardActions = ({ children, sx }) => (jsxRuntime.jsx(material.CardActions, { sx: sx, children: children }));
44
-
45
- const CardImage = ({ src, height = 160, alt = 'card image' }) => (jsxRuntime.jsx(CardMedia, { component: "img", height: height, image: src, alt: alt }));
46
-
47
- 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)))] }));
48
-
49
- const Card = Object.assign(CardRoot, {
50
- Header: CardHeader,
51
- Content: CardContent,
52
- Body: CardContent, // alias
53
- Actions: CardActions,
54
- Image: CardImage,
55
- Skeleton: CardSkeleton,
56
- });
57
-
58
- const Heading = ({ level = 1, ...props }) => {
59
- const variant = `h${level}`;
60
- return (jsxRuntime.jsx(material.Typography, { variant: variant, component: props.component || `h${level}`, fontWeight: 600, gutterBottom: true, ...props }));
61
- };
62
-
63
- const Text = ({ size = 'md', ...props }) => {
64
- const variantMap = {
65
- sm: 'body2',
66
- md: 'body1',
67
- lg: 'subtitle1',
68
- };
69
- return (jsxRuntime.jsx(material.Typography, { variant: variantMap[size], component: props.component || 'p', ...props }));
70
- };
71
-
72
- const Lead = (props) => {
73
- return (jsxRuntime.jsx(material.Typography, { variant: "subtitle1", component: props.component || 'p', fontWeight: 400, color: "text.secondary", ...props }));
74
- };
75
-
76
- const Muted = (props) => {
77
- return (jsxRuntime.jsx(material.Typography, { variant: "body2", component: props.component || 'span', color: "text.disabled", ...props }));
78
- };
79
-
80
- const Strong = (props) => {
81
- return (jsxRuntime.jsx(material.Typography, { component: props.component || 'strong', fontWeight: 700, display: "inline", ...props }));
82
- };
83
-
84
- const Caption = (props) => {
85
- return (jsxRuntime.jsx(material.Typography, { variant: "caption", color: "text.secondary", component: props.component || 'span', ...props }));
86
- };
87
-
88
- const Blockquote = (props) => {
89
- return (jsxRuntime.jsx(material.Typography, { component: "blockquote", sx: {
90
- borderLeft: '4px solid',
91
- borderColor: 'divider',
92
- pl: 2,
93
- color: 'text.secondary',
94
- fontStyle: 'italic',
95
- }, ...props }));
96
- };
97
-
98
- const Code = ({ children, sx }) => {
99
- return (jsxRuntime.jsx(material.Box, { component: "code", sx: {
100
- fontFamily: 'monospace',
101
- backgroundColor: 'grey.100',
102
- color: 'primary.main',
103
- px: 0.5,
104
- py: 0.25,
105
- borderRadius: 1,
106
- fontSize: '0.875rem',
107
- ...sx,
108
- }, children: children }));
109
- };
110
-
111
- var index = /*#__PURE__*/Object.freeze({
112
- __proto__: null,
113
- Blockquote: Blockquote,
114
- Caption: Caption,
115
- Code: Code,
116
- Heading: Heading,
117
- Lead: Lead,
118
- Muted: Muted,
119
- Strong: Strong,
120
- Text: Text
121
- });
122
-
123
- const designTokens = {
124
- colors: {
125
- primary: {
126
- 50: '#e3f2fd',
127
- 100: '#bbdefb',
128
- 500: '#2196f3',
129
- 900: '#0d47a1',
130
- },
131
- secondary: {
132
- 50: '#fce4ec',
133
- 100: '#f8bbd9',
134
- 500: '#e91e63',
135
- 900: '#880e4f',
136
- },
137
- neutral: {
138
- 50: '#fafafa',
139
- 100: '#f5f5f5',
140
- 200: '#eeeeee',
141
- 500: '#9e9e9e',
142
- 900: '#212121',
143
- },
144
- },
145
- spacing: {
146
- xs: '4px',
147
- sm: '8px',
148
- md: '16px',
149
- lg: '24px',
150
- xl: '32px',
151
- },
152
- radius: {
153
- xs: "2px",
154
- sm: '4px',
155
- md: '8px',
156
- lg: '12px',
157
- xl: '16px',
158
- full: '9999px',
159
- },
160
- typography: {
161
- fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
162
- fontSize: {
163
- xs: '0.75rem',
164
- sm: '0.875rem',
165
- md: '1rem',
166
- lg: '1.25rem',
167
- xl: '1.5rem',
168
- },
169
- },
170
- };
171
-
172
- const createCustomTheme = (config = {}) => {
173
- const { primaryColor = designTokens.colors.primary[500], secondaryColor = designTokens.colors.secondary[500], } = config;
174
- return styles.createTheme({
175
- palette: {
176
- primary: {
177
- main: primaryColor,
178
- },
179
- secondary: {
180
- main: secondaryColor,
181
- },
182
- },
183
- typography: {
184
- fontFamily: designTokens.typography.fontFamily,
185
- h1: { fontWeight: 600 },
186
- h2: { fontWeight: 600 },
187
- h3: { fontWeight: 600 },
188
- h4: { fontWeight: 600 },
189
- h5: { fontWeight: 600 },
190
- h6: { fontWeight: 600 },
191
- },
192
- spacing: 8,
193
- shape: {
194
- borderRadius: 8,
195
- },
196
- radius: designTokens.radius,
197
- components: {
198
- MuiButton: {
199
- styleOverrides: {
200
- root: {
201
- textTransform: 'none',
202
- borderRadius: '4px',
203
- // fontWeight: 600,
204
- letterSpacing: '0.5px',
205
- padding: '8px 16px',
206
- },
207
- sizeSmall: {
208
- padding: '4px 12px',
209
- fontSize: '0.875rem',
210
- },
211
- sizeLarge: {
212
- padding: '12px 24px',
213
- fontSize: '1rem',
214
- },
215
- },
216
- defaultProps: {
217
- disableElevation: true
218
- }
219
- },
220
- MuiCard: {
221
- styleOverrides: {
222
- root: {
223
- borderRadius: '12px',
224
- boxShadow: '0 2px 8px rgba(0, 0, 0, 0.1)',
225
- },
226
- },
227
- },
228
- MuiTextField: {
229
- styleOverrides: {
230
- root: {
231
- '& .MuiOutlinedInput-root': {
232
- borderRadius: '8px',
233
- },
234
- },
235
- },
236
- },
237
- },
238
- });
239
- };
240
- // Default theme
241
- const theme = createCustomTheme();
242
-
243
- const UILibraryThemeProvider = ({ children, primaryColor, secondaryColor, enableCssBaseline = true, }) => {
244
- const themeConfig = {};
245
- if (primaryColor) {
246
- themeConfig.primaryColor = primaryColor;
247
- }
248
- if (secondaryColor) {
249
- themeConfig.secondaryColor = secondaryColor;
250
- }
251
- const theme = createCustomTheme(themeConfig);
252
- return (jsxRuntime.jsxs(styles.ThemeProvider, { theme: theme, children: [enableCssBaseline && jsxRuntime.jsx(material.CssBaseline, {}), children] }));
253
- };
254
-
255
- exports.Button = Button;
256
- exports.Card = Card;
257
- exports.Typography = index;
258
- exports.UILibraryThemeProvider = UILibraryThemeProvider;
259
- exports.createCustomTheme = createCustomTheme;
260
- exports.designTokens = designTokens;
261
- exports.theme = theme;
@@ -1,91 +0,0 @@
1
- import React from 'react';
2
- import { Theme } from '@mui/material/styles';
3
-
4
- interface UILibraryThemeProviderProps {
5
- children: React.ReactNode;
6
- primaryColor?: string;
7
- secondaryColor?: string;
8
- enableCssBaseline?: boolean;
9
- }
10
- declare const UILibraryThemeProvider: React.FC<UILibraryThemeProviderProps>;
11
-
12
- declare module '@mui/material/styles' {
13
- interface Theme {
14
- radius: {
15
- xs: string;
16
- sm: string;
17
- md: string;
18
- lg: string;
19
- xl: string;
20
- full: string;
21
- };
22
- }
23
- interface ThemeOptions {
24
- radius?: {
25
- xs?: string;
26
- sm?: string;
27
- md?: string;
28
- lg?: string;
29
- xl?: string;
30
- full?: string;
31
- };
32
- }
33
- }
34
- interface ThemeConfig {
35
- primaryColor?: string;
36
- secondaryColor?: string;
37
- }
38
- declare const createCustomTheme: (config?: ThemeConfig) => Theme;
39
- declare const theme: Theme;
40
-
41
- declare const designTokens: {
42
- colors: {
43
- primary: {
44
- 50: string;
45
- 100: string;
46
- 500: string;
47
- 900: string;
48
- };
49
- secondary: {
50
- 50: string;
51
- 100: string;
52
- 500: string;
53
- 900: string;
54
- };
55
- neutral: {
56
- 50: string;
57
- 100: string;
58
- 200: string;
59
- 500: string;
60
- 900: string;
61
- };
62
- };
63
- spacing: {
64
- xs: string;
65
- sm: string;
66
- md: string;
67
- lg: string;
68
- xl: string;
69
- };
70
- radius: {
71
- xs: string;
72
- sm: string;
73
- md: string;
74
- lg: string;
75
- xl: string;
76
- full: string;
77
- };
78
- typography: {
79
- fontFamily: string;
80
- fontSize: {
81
- xs: string;
82
- sm: string;
83
- md: string;
84
- lg: string;
85
- xl: string;
86
- };
87
- };
88
- };
89
-
90
- export { UILibraryThemeProvider, createCustomTheme, designTokens, theme };
91
- export type { ThemeConfig, UILibraryThemeProviderProps };