@moderneinc/neo-styled-components 0.0.0-development → 1.6.1-next.1d7c75
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/Badge.d.ts +23 -0
- package/dist/Button.d.ts +59 -0
- package/dist/IconButton.d.ts +31 -0
- package/dist/InputField.d.ts +90 -0
- package/dist/Tabs.d.ts +51 -0
- package/dist/Tag.d.ts +48 -0
- package/dist/Toast.d.ts +68 -0
- package/dist/index.d.ts +447 -4
- package/dist/index.esm.js +1085 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1093 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +18 -0
- package/package.json +15 -6
package/dist/index.js
CHANGED
|
@@ -1,13 +1,1105 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var neoDesign = require('@moderneinc/neo-design');
|
|
5
|
+
var Chip = require('@mui/material/Chip');
|
|
6
|
+
var styles = require('@mui/material/styles');
|
|
7
|
+
var ButtonBase = require('@mui/material/ButtonBase');
|
|
8
|
+
var CircularProgress = require('@mui/material/CircularProgress');
|
|
9
|
+
var IconButton = require('@mui/material/IconButton');
|
|
10
|
+
var FormControl = require('@mui/material/FormControl');
|
|
11
|
+
var FormHelperText = require('@mui/material/FormHelperText');
|
|
12
|
+
var InputAdornment = require('@mui/material/InputAdornment');
|
|
13
|
+
var InputBase = require('@mui/material/InputBase');
|
|
14
|
+
var InputLabel = require('@mui/material/InputLabel');
|
|
15
|
+
var react = require('react');
|
|
16
|
+
var MuiTab = require('@mui/material/Tab');
|
|
17
|
+
var MuiTabs = require('@mui/material/Tabs');
|
|
18
|
+
var Alert = require('@mui/material/Alert');
|
|
19
|
+
var Button = require('@mui/material/Button');
|
|
20
|
+
var LinearProgress = require('@mui/material/LinearProgress');
|
|
21
|
+
var Stack = require('@mui/material/Stack');
|
|
22
|
+
|
|
23
|
+
const StyledChip$1 = styles.styled(Chip)(({ theme }) => ({
|
|
24
|
+
height: 24,
|
|
25
|
+
padding: `${neoDesign.spacing.spacing_1_4}px ${neoDesign.spacing.spacing_1}px`,
|
|
26
|
+
borderRadius: neoDesign.borderRadius.full,
|
|
27
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.xs),
|
|
28
|
+
lineHeight: 1,
|
|
29
|
+
gap: neoDesign.spacing.spacing_1_2,
|
|
30
|
+
overflow: 'visible',
|
|
31
|
+
[`& .${Chip.chipClasses.label}`]: {
|
|
32
|
+
padding: 0,
|
|
33
|
+
overflow: 'visible',
|
|
34
|
+
},
|
|
35
|
+
[`& .${Chip.chipClasses.icon}`]: {
|
|
36
|
+
margin: 0,
|
|
37
|
+
width: 12,
|
|
38
|
+
height: 12,
|
|
39
|
+
},
|
|
40
|
+
[`& .${Chip.chipClasses.deleteIcon}`]: {
|
|
41
|
+
margin: 0,
|
|
42
|
+
width: 12,
|
|
43
|
+
height: 12,
|
|
44
|
+
},
|
|
45
|
+
// Default (Neutral) state
|
|
46
|
+
[`&.${Chip.chipClasses.colorDefault}`]: {
|
|
47
|
+
backgroundColor: neoDesign.semanticColors.status.neutral.light,
|
|
48
|
+
color: neoDesign.semanticColors.status.neutral.dark,
|
|
49
|
+
border: `1px solid ${neoDesign.semanticColors.status.neutral.medium}80`,
|
|
50
|
+
[`& .${Chip.chipClasses.icon}, & .${Chip.chipClasses.deleteIcon}`]: {
|
|
51
|
+
color: neoDesign.semanticColors.status.neutral.dark,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
// Error state
|
|
55
|
+
[`&.${Chip.chipClasses.colorError}`]: {
|
|
56
|
+
backgroundColor: neoDesign.semanticColors.status.error.light,
|
|
57
|
+
color: neoDesign.semanticColors.status.error.dark,
|
|
58
|
+
border: `1px solid ${neoDesign.semanticColors.status.error.medium}80`,
|
|
59
|
+
[`& .${Chip.chipClasses.icon}, & .${Chip.chipClasses.deleteIcon}`]: {
|
|
60
|
+
color: neoDesign.semanticColors.status.error.dark,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
// Warning state
|
|
64
|
+
[`&.${Chip.chipClasses.colorWarning}`]: {
|
|
65
|
+
backgroundColor: neoDesign.semanticColors.status.warning.light,
|
|
66
|
+
color: neoDesign.semanticColors.status.warning.dark,
|
|
67
|
+
border: `1px solid ${neoDesign.semanticColors.status.warning.medium}80`,
|
|
68
|
+
[`& .${Chip.chipClasses.icon}, & .${Chip.chipClasses.deleteIcon}`]: {
|
|
69
|
+
color: neoDesign.semanticColors.status.warning.dark,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
// Success state
|
|
73
|
+
[`&.${Chip.chipClasses.colorSuccess}`]: {
|
|
74
|
+
backgroundColor: neoDesign.semanticColors.status.success.light,
|
|
75
|
+
color: neoDesign.semanticColors.status.success.dark,
|
|
76
|
+
border: `1px solid ${neoDesign.semanticColors.status.success.medium}80`,
|
|
77
|
+
[`& .${Chip.chipClasses.icon}, & .${Chip.chipClasses.deleteIcon}`]: {
|
|
78
|
+
color: neoDesign.semanticColors.status.success.dark,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
// Info state
|
|
82
|
+
[`&.${Chip.chipClasses.colorInfo}`]: {
|
|
83
|
+
backgroundColor: neoDesign.semanticColors.status.info.light,
|
|
84
|
+
color: neoDesign.semanticColors.status.info.dark,
|
|
85
|
+
border: `1px solid ${neoDesign.semanticColors.status.info.medium}80`,
|
|
86
|
+
[`& .${Chip.chipClasses.icon}, & .${Chip.chipClasses.deleteIcon}`]: {
|
|
87
|
+
color: neoDesign.semanticColors.status.info.dark,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
}));
|
|
91
|
+
/**
|
|
92
|
+
* NeoBadge - Status badge component based on MUI Chip
|
|
93
|
+
*
|
|
94
|
+
* @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC/Neo---Moderne-Design-system-w--correct-set-of-tokens?node-id=4091-17230
|
|
95
|
+
*
|
|
96
|
+
* Figma Props Mapping:
|
|
97
|
+
* - state (Neutral|Error|Warning|Success|Info) → color (default|error|warning|success|info)
|
|
98
|
+
* - iconLeading → icon prop (pass React element)
|
|
99
|
+
* - iconTrailing → deleteIcon prop (pass React element)
|
|
100
|
+
* - Label → label prop
|
|
101
|
+
*/
|
|
102
|
+
const NeoBadge = (props) => {
|
|
103
|
+
return jsxRuntime.jsx(StyledChip$1, { ...props });
|
|
104
|
+
};
|
|
105
|
+
NeoBadge.displayName = 'NeoBadge';
|
|
106
|
+
|
|
107
|
+
const StyledButtonBase = styles.styled(ButtonBase, {
|
|
108
|
+
shouldForwardProp: prop => prop !== 'variant' && prop !== 'size' && prop !== 'loading',
|
|
109
|
+
})(({ theme, variant = 'primary', size = 'medium', loading = false }) => {
|
|
110
|
+
// Size configurations using theme.spacing()
|
|
111
|
+
const sizeConfig = {
|
|
112
|
+
small: {
|
|
113
|
+
height: 32,
|
|
114
|
+
padding: `0 ${theme.spacing(2)}`,
|
|
115
|
+
fontSize: theme.typography.pxToRem(14),
|
|
116
|
+
},
|
|
117
|
+
medium: {
|
|
118
|
+
height: 40,
|
|
119
|
+
padding: `0 ${theme.spacing(3)}`,
|
|
120
|
+
fontSize: theme.typography.pxToRem(16),
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
const sizeStyles = sizeConfig[size];
|
|
124
|
+
// Base styles shared by all variants
|
|
125
|
+
const baseStyles = {
|
|
126
|
+
height: sizeStyles.height,
|
|
127
|
+
padding: sizeStyles.padding,
|
|
128
|
+
fontSize: sizeStyles.fontSize,
|
|
129
|
+
fontWeight: 500,
|
|
130
|
+
lineHeight: 1.5,
|
|
131
|
+
borderRadius: neoDesign.borderRadius.button,
|
|
132
|
+
textTransform: 'none',
|
|
133
|
+
transition: theme.transitions.create(['background-color', 'border-color', 'color'], {
|
|
134
|
+
duration: theme.transitions.duration.short,
|
|
135
|
+
}),
|
|
136
|
+
position: 'relative',
|
|
137
|
+
minWidth: 'fit-content',
|
|
138
|
+
gap: theme.spacing(1),
|
|
139
|
+
// Disabled state (always show cursor)
|
|
140
|
+
[`&.${ButtonBase.buttonBaseClasses.disabled}`]: {
|
|
141
|
+
cursor: 'not-allowed',
|
|
142
|
+
pointerEvents: 'auto',
|
|
143
|
+
},
|
|
144
|
+
// Focus visible for keyboard navigation
|
|
145
|
+
[`&.${ButtonBase.buttonBaseClasses.focusVisible}`]: {
|
|
146
|
+
outline: `2px solid ${neoDesign.semanticColors.buttons.primary.focus}`,
|
|
147
|
+
outlineOffset: 2,
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
// Variant-specific styles
|
|
151
|
+
const variantStyles = {
|
|
152
|
+
primary: {
|
|
153
|
+
backgroundColor: neoDesign.semanticColors.buttons.primary.default,
|
|
154
|
+
color: theme.palette.common.white,
|
|
155
|
+
border: 'none',
|
|
156
|
+
'&:hover': {
|
|
157
|
+
backgroundColor: neoDesign.semanticColors.buttons.primary.hover,
|
|
158
|
+
},
|
|
159
|
+
'&:active': {
|
|
160
|
+
backgroundColor: neoDesign.semanticColors.buttons.primary.pressed,
|
|
161
|
+
},
|
|
162
|
+
...(loading
|
|
163
|
+
? {}
|
|
164
|
+
: {
|
|
165
|
+
[`&.${ButtonBase.buttonBaseClasses.disabled}`]: {
|
|
166
|
+
backgroundColor: neoDesign.semanticColors.buttons.primary.disabled,
|
|
167
|
+
color: neoDesign.semanticColors.typography.button.disabled,
|
|
168
|
+
},
|
|
169
|
+
}),
|
|
170
|
+
},
|
|
171
|
+
secondary: {
|
|
172
|
+
backgroundColor: neoDesign.semanticColors.buttons.secondary.defaultBackground,
|
|
173
|
+
color: neoDesign.semanticColors.buttons.primary.default,
|
|
174
|
+
border: `1px solid ${neoDesign.semanticColors.buttons.secondary.defaultBorder}`,
|
|
175
|
+
'&:hover': {
|
|
176
|
+
backgroundColor: neoDesign.semanticColors.buttons.secondary.hoverBackground,
|
|
177
|
+
},
|
|
178
|
+
'&:active': {
|
|
179
|
+
backgroundColor: neoDesign.semanticColors.buttons.secondary.pressedBackground,
|
|
180
|
+
},
|
|
181
|
+
...(loading
|
|
182
|
+
? {}
|
|
183
|
+
: {
|
|
184
|
+
[`&.${ButtonBase.buttonBaseClasses.disabled}`]: {
|
|
185
|
+
backgroundColor: neoDesign.semanticColors.buttons.secondary.disabledBackground,
|
|
186
|
+
borderColor: neoDesign.semanticColors.buttons.secondary.disabledBorder,
|
|
187
|
+
color: neoDesign.semanticColors.typography.button.disabled,
|
|
188
|
+
},
|
|
189
|
+
}),
|
|
190
|
+
},
|
|
191
|
+
destructive: {
|
|
192
|
+
backgroundColor: neoDesign.semanticColors.buttons.destructive,
|
|
193
|
+
color: theme.palette.common.white,
|
|
194
|
+
border: 'none',
|
|
195
|
+
'&:hover': {
|
|
196
|
+
backgroundColor: neoDesign.semanticColors.status.error.dark,
|
|
197
|
+
},
|
|
198
|
+
'&:active': {
|
|
199
|
+
backgroundColor: neoDesign.semanticColors.status.error.dark,
|
|
200
|
+
filter: 'brightness(0.9)',
|
|
201
|
+
},
|
|
202
|
+
...(loading
|
|
203
|
+
? {}
|
|
204
|
+
: {
|
|
205
|
+
[`&.${ButtonBase.buttonBaseClasses.disabled}`]: {
|
|
206
|
+
backgroundColor: neoDesign.semanticColors.buttons.primary.disabled,
|
|
207
|
+
color: neoDesign.semanticColors.typography.button.disabled,
|
|
208
|
+
},
|
|
209
|
+
}),
|
|
210
|
+
},
|
|
211
|
+
link: {
|
|
212
|
+
backgroundColor: 'transparent',
|
|
213
|
+
color: neoDesign.semanticColors.buttons.tertiary.default,
|
|
214
|
+
border: 'none',
|
|
215
|
+
padding: `0 ${theme.spacing(1)}`,
|
|
216
|
+
'&:hover': {
|
|
217
|
+
backgroundColor: 'transparent',
|
|
218
|
+
color: neoDesign.semanticColors.buttons.tertiary.hover,
|
|
219
|
+
},
|
|
220
|
+
'&:active': {
|
|
221
|
+
color: neoDesign.semanticColors.buttons.tertiary.pressed,
|
|
222
|
+
},
|
|
223
|
+
...(loading
|
|
224
|
+
? {}
|
|
225
|
+
: {
|
|
226
|
+
[`&.${ButtonBase.buttonBaseClasses.disabled}`]: {
|
|
227
|
+
backgroundColor: 'transparent',
|
|
228
|
+
color: neoDesign.semanticColors.buttons.tertiary.disabled,
|
|
229
|
+
},
|
|
230
|
+
}),
|
|
231
|
+
},
|
|
232
|
+
linkColor: {
|
|
233
|
+
backgroundColor: 'transparent',
|
|
234
|
+
color: neoDesign.semanticColors.buttons.primary.default,
|
|
235
|
+
border: 'none',
|
|
236
|
+
padding: `0 ${theme.spacing(1)}`,
|
|
237
|
+
'&:hover': {
|
|
238
|
+
backgroundColor: 'transparent',
|
|
239
|
+
color: neoDesign.semanticColors.buttons.primary.hover,
|
|
240
|
+
},
|
|
241
|
+
'&:active': {
|
|
242
|
+
color: neoDesign.semanticColors.buttons.primary.pressed,
|
|
243
|
+
},
|
|
244
|
+
...(loading
|
|
245
|
+
? {}
|
|
246
|
+
: {
|
|
247
|
+
[`&.${ButtonBase.buttonBaseClasses.disabled}`]: {
|
|
248
|
+
backgroundColor: 'transparent',
|
|
249
|
+
color: neoDesign.semanticColors.buttons.tertiary.disabled,
|
|
250
|
+
},
|
|
251
|
+
}),
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
return {
|
|
255
|
+
...baseStyles,
|
|
256
|
+
...variantStyles[variant],
|
|
257
|
+
};
|
|
258
|
+
});
|
|
259
|
+
const LoadingSpinner = styles.styled(CircularProgress)(({ theme, $variant }) => {
|
|
260
|
+
// Use appropriate spinner color for each variant to ensure visibility
|
|
261
|
+
const spinnerColors = {
|
|
262
|
+
primary: theme.palette.common.white,
|
|
263
|
+
secondary: neoDesign.semanticColors.buttons.primary.default,
|
|
264
|
+
destructive: theme.palette.common.white,
|
|
265
|
+
link: neoDesign.semanticColors.buttons.primary.default,
|
|
266
|
+
linkColor: neoDesign.semanticColors.buttons.primary.default,
|
|
267
|
+
};
|
|
268
|
+
return {
|
|
269
|
+
color: spinnerColors[$variant],
|
|
270
|
+
};
|
|
271
|
+
});
|
|
272
|
+
/**
|
|
273
|
+
* NeoButton - Text button component based on MUI ButtonBase
|
|
274
|
+
*
|
|
275
|
+
* @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC/Neo---Moderne-Design-system---2025?node-id=4086-7590
|
|
276
|
+
*
|
|
277
|
+
* Figma Props Mapping:
|
|
278
|
+
* - Hierarchy (Primary|Secondary|Destructive|Link|Link Color) → variant prop
|
|
279
|
+
* - Size (Small|Medium) → size prop
|
|
280
|
+
* - State=Disabled → disabled prop
|
|
281
|
+
* - State=Loading → loading prop
|
|
282
|
+
* - State=Hover → CSS :hover
|
|
283
|
+
* - State=Pressed → CSS :active
|
|
284
|
+
* - State=Focused → CSS :focus-visible
|
|
285
|
+
*/
|
|
286
|
+
const NeoButton = ({ variant = 'primary', size = 'medium', loading = false, children, disabled, ...props }) => {
|
|
287
|
+
return (jsxRuntime.jsx(StyledButtonBase, { variant: variant, size: size, loading: loading, disabled: disabled || loading, ...props, children: loading ? jsxRuntime.jsx(LoadingSpinner, { "$variant": variant, size: size === 'small' ? 16 : 20 }) : children }));
|
|
288
|
+
};
|
|
289
|
+
NeoButton.displayName = 'NeoButton';
|
|
290
|
+
|
|
291
|
+
const StyledIconButton = styles.styled(IconButton, {
|
|
292
|
+
shouldForwardProp: prop => prop !== 'size',
|
|
293
|
+
})(({ theme, size = 'medium' }) => {
|
|
294
|
+
// Size configurations using theme.spacing()
|
|
295
|
+
const sizeConfig = {
|
|
296
|
+
small: {
|
|
297
|
+
width: 32,
|
|
298
|
+
height: 32,
|
|
299
|
+
padding: theme.spacing(0.5),
|
|
300
|
+
},
|
|
301
|
+
medium: {
|
|
302
|
+
width: 44,
|
|
303
|
+
height: 44,
|
|
304
|
+
padding: theme.spacing(1.25),
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
const sizeStyles = sizeConfig[size];
|
|
308
|
+
// Base styles shared by all variants
|
|
309
|
+
const baseStyles = {
|
|
310
|
+
width: sizeStyles.width,
|
|
311
|
+
height: sizeStyles.height,
|
|
312
|
+
padding: sizeStyles.padding,
|
|
313
|
+
borderRadius: neoDesign.borderRadius.button, // Fully rounded/circular
|
|
314
|
+
transition: theme.transitions.create(['background-color', 'border-color', 'color'], {
|
|
315
|
+
duration: theme.transitions.duration.short,
|
|
316
|
+
}),
|
|
317
|
+
// Disabled state
|
|
318
|
+
[`&.${IconButton.iconButtonClasses.disabled}`]: {
|
|
319
|
+
cursor: 'not-allowed',
|
|
320
|
+
pointerEvents: 'auto',
|
|
321
|
+
},
|
|
322
|
+
// Focus visible for keyboard navigation
|
|
323
|
+
'&:focus-visible': {
|
|
324
|
+
outline: `2px solid ${neoDesign.semanticColors.buttons.primary.focus}`,
|
|
325
|
+
outlineOffset: 2,
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
// Icon button styling - single neutral style
|
|
329
|
+
const iconButtonStyles = {
|
|
330
|
+
backgroundColor: 'transparent',
|
|
331
|
+
color: neoDesign.semanticColors.icons.default,
|
|
332
|
+
border: 'none',
|
|
333
|
+
'&:hover': {
|
|
334
|
+
backgroundColor: neoDesign.semanticColors.icons.hoverBackground,
|
|
335
|
+
color: neoDesign.semanticColors.icons.hover,
|
|
336
|
+
},
|
|
337
|
+
'&:active': {
|
|
338
|
+
color: neoDesign.semanticColors.icons.pressed,
|
|
339
|
+
},
|
|
340
|
+
[`&.${IconButton.iconButtonClasses.disabled}`]: {
|
|
341
|
+
backgroundColor: 'transparent',
|
|
342
|
+
color: neoDesign.semanticColors.icons.disabled,
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
return {
|
|
346
|
+
...baseStyles,
|
|
347
|
+
...iconButtonStyles,
|
|
348
|
+
};
|
|
349
|
+
});
|
|
350
|
+
/**
|
|
351
|
+
* NeoIconButton - Icon-only button component based on MUI IconButton
|
|
352
|
+
*
|
|
353
|
+
* Simple, neutral icon button with transparent background and icon color states.
|
|
354
|
+
*
|
|
355
|
+
* @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC/Neo---Moderne-Design-system---2025?node-id=4086-7590
|
|
356
|
+
*
|
|
357
|
+
* Figma Props Mapping:
|
|
358
|
+
* - Hierarchy=Icon → Single default style (no variant prop)
|
|
359
|
+
* - Size (Small|Medium) → size prop
|
|
360
|
+
* - State=Disabled → disabled prop
|
|
361
|
+
* - State=Hover → CSS :hover
|
|
362
|
+
* - State=Pressed → CSS :active
|
|
363
|
+
* - State=Focused → CSS :focus-visible
|
|
364
|
+
*/
|
|
365
|
+
const NeoIconButton = ({ size = 'medium', ...props }) => {
|
|
366
|
+
return jsxRuntime.jsx(StyledIconButton, { size: size, ...props });
|
|
367
|
+
};
|
|
368
|
+
NeoIconButton.displayName = 'NeoIconButton';
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* @license lucide-react v0.552.0 - ISC
|
|
372
|
+
*
|
|
373
|
+
* This source code is licensed under the ISC license.
|
|
374
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
378
|
+
const toCamelCase = (string) => string.replace(
|
|
379
|
+
/^([A-Z])|[\s-_]+(\w)/g,
|
|
380
|
+
(match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
|
|
381
|
+
);
|
|
382
|
+
const toPascalCase = (string) => {
|
|
383
|
+
const camelCase = toCamelCase(string);
|
|
384
|
+
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
385
|
+
};
|
|
386
|
+
const mergeClasses = (...classes) => classes.filter((className, index, array) => {
|
|
387
|
+
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
388
|
+
}).join(" ").trim();
|
|
389
|
+
const hasA11yProp = (props) => {
|
|
390
|
+
for (const prop in props) {
|
|
391
|
+
if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* @license lucide-react v0.552.0 - ISC
|
|
399
|
+
*
|
|
400
|
+
* This source code is licensed under the ISC license.
|
|
401
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
402
|
+
*/
|
|
403
|
+
|
|
404
|
+
var defaultAttributes = {
|
|
405
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
406
|
+
width: 24,
|
|
407
|
+
height: 24,
|
|
408
|
+
viewBox: "0 0 24 24",
|
|
409
|
+
fill: "none",
|
|
410
|
+
stroke: "currentColor",
|
|
411
|
+
strokeWidth: 2,
|
|
412
|
+
strokeLinecap: "round",
|
|
413
|
+
strokeLinejoin: "round"
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* @license lucide-react v0.552.0 - ISC
|
|
418
|
+
*
|
|
419
|
+
* This source code is licensed under the ISC license.
|
|
420
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
421
|
+
*/
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
const Icon = react.forwardRef(
|
|
425
|
+
({
|
|
426
|
+
color = "currentColor",
|
|
427
|
+
size = 24,
|
|
428
|
+
strokeWidth = 2,
|
|
429
|
+
absoluteStrokeWidth,
|
|
430
|
+
className = "",
|
|
431
|
+
children,
|
|
432
|
+
iconNode,
|
|
433
|
+
...rest
|
|
434
|
+
}, ref) => react.createElement(
|
|
435
|
+
"svg",
|
|
436
|
+
{
|
|
437
|
+
ref,
|
|
438
|
+
...defaultAttributes,
|
|
439
|
+
width: size,
|
|
440
|
+
height: size,
|
|
441
|
+
stroke: color,
|
|
442
|
+
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
443
|
+
className: mergeClasses("lucide", className),
|
|
444
|
+
...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
|
|
445
|
+
...rest
|
|
446
|
+
},
|
|
447
|
+
[
|
|
448
|
+
...iconNode.map(([tag, attrs]) => react.createElement(tag, attrs)),
|
|
449
|
+
...Array.isArray(children) ? children : [children]
|
|
450
|
+
]
|
|
451
|
+
)
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* @license lucide-react v0.552.0 - ISC
|
|
456
|
+
*
|
|
457
|
+
* This source code is licensed under the ISC license.
|
|
458
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
459
|
+
*/
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
const createLucideIcon = (iconName, iconNode) => {
|
|
463
|
+
const Component = react.forwardRef(
|
|
464
|
+
({ className, ...props }, ref) => react.createElement(Icon, {
|
|
465
|
+
ref,
|
|
466
|
+
iconNode,
|
|
467
|
+
className: mergeClasses(
|
|
468
|
+
`lucide-${toKebabCase(toPascalCase(iconName))}`,
|
|
469
|
+
`lucide-${iconName}`,
|
|
470
|
+
className
|
|
471
|
+
),
|
|
472
|
+
...props
|
|
473
|
+
})
|
|
474
|
+
);
|
|
475
|
+
Component.displayName = toPascalCase(iconName);
|
|
476
|
+
return Component;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* @license lucide-react v0.552.0 - ISC
|
|
481
|
+
*
|
|
482
|
+
* This source code is licensed under the ISC license.
|
|
483
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
484
|
+
*/
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
const __iconNode$1 = [
|
|
488
|
+
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
489
|
+
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
490
|
+
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
491
|
+
];
|
|
492
|
+
const CircleAlert = createLucideIcon("circle-alert", __iconNode$1);
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* @license lucide-react v0.552.0 - ISC
|
|
496
|
+
*
|
|
497
|
+
* This source code is licensed under the ISC license.
|
|
498
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
499
|
+
*/
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
const __iconNode = [
|
|
503
|
+
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
504
|
+
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
505
|
+
];
|
|
506
|
+
const X = createLucideIcon("x", __iconNode);
|
|
507
|
+
|
|
508
|
+
const StyledFormControl = styles.styled(FormControl, {
|
|
509
|
+
shouldForwardProp: prop => prop !== 'size',
|
|
510
|
+
})(({ size = 'medium' }) => {
|
|
511
|
+
const sizeConfig = {
|
|
512
|
+
small: {
|
|
513
|
+
gap: neoDesign.spacing.spacing_1,
|
|
514
|
+
},
|
|
515
|
+
medium: {
|
|
516
|
+
gap: neoDesign.spacing.spacing_2,
|
|
517
|
+
},
|
|
518
|
+
};
|
|
519
|
+
return {
|
|
520
|
+
display: 'flex',
|
|
521
|
+
flexDirection: 'column',
|
|
522
|
+
gap: sizeConfig[size].gap,
|
|
523
|
+
width: '100%',
|
|
524
|
+
};
|
|
525
|
+
});
|
|
526
|
+
const StyledInputLabel = styles.styled(InputLabel, {
|
|
527
|
+
shouldForwardProp: prop => prop !== 'size' && prop !== 'infoIcon',
|
|
528
|
+
})(({ theme, size = 'medium' }) => {
|
|
529
|
+
const sizeConfig = {
|
|
530
|
+
small: {
|
|
531
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.xs),
|
|
532
|
+
},
|
|
533
|
+
medium: {
|
|
534
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.sm),
|
|
535
|
+
},
|
|
536
|
+
};
|
|
537
|
+
return {
|
|
538
|
+
position: 'static',
|
|
539
|
+
transform: 'none',
|
|
540
|
+
fontSize: sizeConfig[size].fontSize,
|
|
541
|
+
fontWeight: 500,
|
|
542
|
+
color: neoDesign.semanticColors.typography.input.label,
|
|
543
|
+
display: 'flex',
|
|
544
|
+
alignItems: 'center',
|
|
545
|
+
gap: neoDesign.spacing.spacing_1,
|
|
546
|
+
[`&.${InputLabel.inputLabelClasses.disabled}`]: {
|
|
547
|
+
color: neoDesign.semanticColors.icons.disabled,
|
|
548
|
+
},
|
|
549
|
+
[`&.${InputLabel.inputLabelClasses.error}`]: {
|
|
550
|
+
color: neoDesign.semanticColors.typography.input.label,
|
|
551
|
+
},
|
|
552
|
+
// Required asterisk styling
|
|
553
|
+
[`& .${InputLabel.inputLabelClasses.asterisk}`]: {
|
|
554
|
+
color: neoDesign.semanticColors.status.error.medium,
|
|
555
|
+
},
|
|
556
|
+
};
|
|
557
|
+
});
|
|
558
|
+
const InfoIconWrapper = styles.styled('span')({
|
|
559
|
+
display: 'inline-flex',
|
|
560
|
+
alignItems: 'center',
|
|
561
|
+
color: neoDesign.semanticColors.icons.placeholder,
|
|
562
|
+
});
|
|
563
|
+
const StyledInputBase = styles.styled(InputBase, {
|
|
564
|
+
shouldForwardProp: prop => prop !== 'size' && prop !== 'destructive',
|
|
565
|
+
})(({ theme, size = 'medium', destructive }) => {
|
|
566
|
+
const sizeConfig = {
|
|
567
|
+
small: {
|
|
568
|
+
height: 40,
|
|
569
|
+
padding: `${neoDesign.spacing.spacing_1}px ${neoDesign.spacing.spacing_2}px`,
|
|
570
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.sm),
|
|
571
|
+
borderRadius: neoDesign.borderRadius.input,
|
|
572
|
+
},
|
|
573
|
+
medium: {
|
|
574
|
+
height: 44,
|
|
575
|
+
padding: `${neoDesign.spacing.spacing_2}px ${neoDesign.spacing.spacing_3}px`,
|
|
576
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.default),
|
|
577
|
+
borderRadius: neoDesign.borderRadius.full,
|
|
578
|
+
},
|
|
579
|
+
};
|
|
580
|
+
const sizeStyles = sizeConfig[size];
|
|
581
|
+
return {
|
|
582
|
+
height: sizeStyles.height,
|
|
583
|
+
fontSize: sizeStyles.fontSize,
|
|
584
|
+
borderRadius: sizeStyles.borderRadius,
|
|
585
|
+
backgroundColor: neoDesign.semanticColors.input.background,
|
|
586
|
+
border: `1px solid ${destructive ? neoDesign.semanticColors.status.error.medium : neoDesign.semanticColors.border.input}`,
|
|
587
|
+
transition: theme.transitions.create(['border-color', 'background-color'], {
|
|
588
|
+
duration: theme.transitions.duration.short,
|
|
589
|
+
}),
|
|
590
|
+
[`& .${InputBase.inputBaseClasses.input}`]: {
|
|
591
|
+
padding: sizeStyles.padding,
|
|
592
|
+
color: neoDesign.semanticColors.typography.input.default,
|
|
593
|
+
'&::placeholder': {
|
|
594
|
+
color: neoDesign.semanticColors.typography.input.placeholder,
|
|
595
|
+
},
|
|
596
|
+
},
|
|
597
|
+
// Hover state
|
|
598
|
+
'&:hover': {
|
|
599
|
+
backgroundColor: neoDesign.semanticColors.input.hoverBackground,
|
|
600
|
+
borderColor: destructive ? neoDesign.semanticColors.status.error.medium : neoDesign.semanticColors.border.input,
|
|
601
|
+
},
|
|
602
|
+
// Focused state
|
|
603
|
+
[`&.${InputBase.inputBaseClasses.focused}`]: {
|
|
604
|
+
backgroundColor: neoDesign.semanticColors.input.background,
|
|
605
|
+
borderColor: destructive
|
|
606
|
+
? neoDesign.semanticColors.status.error.medium
|
|
607
|
+
: neoDesign.semanticColors.buttons.primary.default,
|
|
608
|
+
},
|
|
609
|
+
// Disabled state
|
|
610
|
+
[`&.${InputBase.inputBaseClasses.disabled}`]: {
|
|
611
|
+
backgroundColor: neoDesign.semanticColors.input.disabledBackground,
|
|
612
|
+
borderColor: neoDesign.semanticColors.border.input,
|
|
613
|
+
color: neoDesign.semanticColors.icons.disabled,
|
|
614
|
+
[`& .${InputBase.inputBaseClasses.input}`]: {
|
|
615
|
+
WebkitTextFillColor: neoDesign.semanticColors.icons.disabled,
|
|
616
|
+
},
|
|
617
|
+
},
|
|
618
|
+
// Error state
|
|
619
|
+
[`&.${InputBase.inputBaseClasses.error}`]: {
|
|
620
|
+
borderColor: neoDesign.semanticColors.status.error.medium,
|
|
621
|
+
},
|
|
622
|
+
// Adornment styling
|
|
623
|
+
'& .MuiInputAdornment-root': {
|
|
624
|
+
color: destructive ? neoDesign.semanticColors.status.error.medium : neoDesign.semanticColors.icons.placeholder,
|
|
625
|
+
},
|
|
626
|
+
};
|
|
627
|
+
});
|
|
628
|
+
const StyledFormHelperText = styles.styled(FormHelperText, {
|
|
629
|
+
shouldForwardProp: prop => prop !== 'size',
|
|
630
|
+
})(({ theme }) => {
|
|
631
|
+
return {
|
|
632
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.xs),
|
|
633
|
+
color: neoDesign.semanticColors.typography.input.helper,
|
|
634
|
+
[`&.${FormHelperText.formHelperTextClasses.error}`]: {
|
|
635
|
+
color: neoDesign.semanticColors.status.error.medium,
|
|
636
|
+
},
|
|
637
|
+
[`&.${FormHelperText.formHelperTextClasses.disabled}`]: {
|
|
638
|
+
color: neoDesign.semanticColors.icons.disabled,
|
|
639
|
+
},
|
|
640
|
+
};
|
|
641
|
+
});
|
|
642
|
+
/**
|
|
643
|
+
* NeoInputField - Form input field component using MUI FormControl composition
|
|
644
|
+
*
|
|
645
|
+
* @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC/Neo---Moderne-Design-system---2025?node-id=4091-23373
|
|
646
|
+
*
|
|
647
|
+
* Figma Props Mapping:
|
|
648
|
+
* - Size (small|medium) → size prop
|
|
649
|
+
* - Destructive (false|true) → destructive prop
|
|
650
|
+
* - State=Placeholder → empty value with placeholder text
|
|
651
|
+
* - State=Hover → CSS :hover
|
|
652
|
+
* - State=Filled → value prop with text
|
|
653
|
+
* - State=Focused → CSS :focus
|
|
654
|
+
* - State=Disabled → disabled prop
|
|
655
|
+
* - Label → label prop
|
|
656
|
+
* - Required indicator (*) → required prop
|
|
657
|
+
* - Info icon → infoIcon prop
|
|
658
|
+
* - Helper text → helperText prop
|
|
659
|
+
* - Error message → errorMessage prop (shown when destructive=true)
|
|
660
|
+
* - Left icon → startIcon prop
|
|
661
|
+
* - Right icon → endIcon prop (auto error icon when destructive=true)
|
|
662
|
+
*/
|
|
663
|
+
const NeoInputField = ({ size = 'medium', destructive = false, label, required = false, infoIcon, helperText, errorMessage, startIcon, endIcon, disabled, id, ...props }) => {
|
|
664
|
+
const inputId = id || `neo-input-${Math.random().toString(36).substring(7)}`;
|
|
665
|
+
const helperTextId = helperText || errorMessage ? `${inputId}-helper-text` : undefined;
|
|
666
|
+
return (jsxRuntime.jsxs(StyledFormControl, { size: size, error: destructive, disabled: disabled, required: required, children: [label && (jsxRuntime.jsxs(StyledInputLabel, { htmlFor: inputId, size: size, infoIcon: !!infoIcon, required: required, disabled: disabled, error: destructive, children: [label, infoIcon && jsxRuntime.jsx(InfoIconWrapper, { children: infoIcon })] })), jsxRuntime.jsx(StyledInputBase, { id: inputId, size: size, destructive: destructive, disabled: disabled, error: destructive, "aria-describedby": helperTextId, startAdornment: startIcon ? jsxRuntime.jsx(InputAdornment, { position: "start", children: startIcon }) : undefined, endAdornment: destructive ? (jsxRuntime.jsx(InputAdornment, { position: "end", children: jsxRuntime.jsx(CircleAlert, { size: size === 'small' ? 16 : 20 }) })) : endIcon ? (jsxRuntime.jsx(InputAdornment, { position: "end", children: endIcon })) : undefined, ...props }), (helperText || errorMessage) && (jsxRuntime.jsx(StyledFormHelperText, { id: helperTextId, error: destructive, disabled: disabled, children: destructive ? errorMessage : helperText }))] }));
|
|
667
|
+
};
|
|
668
|
+
NeoInputField.displayName = 'NeoInputField';
|
|
669
|
+
|
|
670
|
+
const StyledChip = styles.styled(Chip)(({ theme, size, variant, color }) => ({
|
|
671
|
+
padding: 0,
|
|
672
|
+
borderRadius: neoDesign.borderRadius.full,
|
|
673
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.xs),
|
|
674
|
+
fontWeight: neoDesign.typography.fontWeight.medium,
|
|
675
|
+
// Size variants
|
|
676
|
+
...(size === 'small' && {
|
|
677
|
+
height: 16,
|
|
678
|
+
paddingLeft: neoDesign.spacing.spacing_1_2, // 4px
|
|
679
|
+
paddingRight: neoDesign.spacing.spacing_1_2, // 4px
|
|
680
|
+
}),
|
|
681
|
+
...(size === 'medium' && {
|
|
682
|
+
height: 18,
|
|
683
|
+
paddingLeft: neoDesign.spacing.spacing_3_4, // 6px
|
|
684
|
+
paddingRight: neoDesign.spacing.spacing_3_4, // 6px
|
|
685
|
+
}),
|
|
686
|
+
...(size === 'large' && {
|
|
687
|
+
height: 20,
|
|
688
|
+
paddingLeft: neoDesign.spacing.spacing_3_4, // 6px
|
|
689
|
+
paddingRight: neoDesign.spacing.spacing_3_4, // 6px
|
|
690
|
+
}),
|
|
691
|
+
[`& .${Chip.chipClasses.label}`]: {
|
|
692
|
+
padding: 0,
|
|
693
|
+
},
|
|
694
|
+
// Outlined variant (light type in Figma) - Neutral/Default
|
|
695
|
+
...(variant === 'outlined' &&
|
|
696
|
+
color === 'default' && {
|
|
697
|
+
backgroundColor: neoDesign.semanticColors.status.neutral.light,
|
|
698
|
+
color: neoDesign.semanticColors.status.neutral.dark,
|
|
699
|
+
borderColor: neoDesign.colors.grey[200], // base/grey/200
|
|
700
|
+
}),
|
|
701
|
+
// Outlined variant - Error
|
|
702
|
+
...(variant === 'outlined' &&
|
|
703
|
+
color === 'error' && {
|
|
704
|
+
backgroundColor: neoDesign.semanticColors.status.error.light,
|
|
705
|
+
color: neoDesign.semanticColors.status.error.dark,
|
|
706
|
+
borderColor: neoDesign.colors.red[100], // base/red/100
|
|
707
|
+
}),
|
|
708
|
+
// Outlined variant - Warning
|
|
709
|
+
...(variant === 'outlined' &&
|
|
710
|
+
color === 'warning' && {
|
|
711
|
+
backgroundColor: neoDesign.semanticColors.status.warning.light,
|
|
712
|
+
color: neoDesign.semanticColors.status.warning.dark,
|
|
713
|
+
borderColor: neoDesign.colors.orange[100], // base/orange/100
|
|
714
|
+
}),
|
|
715
|
+
// Outlined variant - Success
|
|
716
|
+
...(variant === 'outlined' &&
|
|
717
|
+
color === 'success' && {
|
|
718
|
+
backgroundColor: neoDesign.semanticColors.status.success.light,
|
|
719
|
+
color: neoDesign.semanticColors.status.success.dark,
|
|
720
|
+
borderColor: 'rgba(94, 196, 111, 0.24)', // rgba from Figma
|
|
721
|
+
}),
|
|
722
|
+
// Outlined variant - Info
|
|
723
|
+
...(variant === 'outlined' &&
|
|
724
|
+
color === 'info' && {
|
|
725
|
+
backgroundColor: neoDesign.semanticColors.status.info.light,
|
|
726
|
+
color: neoDesign.semanticColors.status.info.dark,
|
|
727
|
+
borderColor: neoDesign.colors.digitalBlue[100], // base/digital-blue/100
|
|
728
|
+
}),
|
|
729
|
+
// Outlined variant - Violet
|
|
730
|
+
...(variant === 'outlined' &&
|
|
731
|
+
color === 'violet' && {
|
|
732
|
+
backgroundColor: `${neoDesign.colors.violet[100]}66`, // rgba(235,213,241,0.4)
|
|
733
|
+
color: neoDesign.colors.violet[600],
|
|
734
|
+
borderColor: neoDesign.colors.violet[100], // base/violet/100
|
|
735
|
+
}),
|
|
736
|
+
// Filled variant (dark type in Figma) - Neutral/Default
|
|
737
|
+
...(variant === 'filled' &&
|
|
738
|
+
color === 'default' && {
|
|
739
|
+
backgroundColor: neoDesign.semanticColors.status.neutral.medium,
|
|
740
|
+
color: '#ffffff',
|
|
741
|
+
border: 'none',
|
|
742
|
+
}),
|
|
743
|
+
// Filled variant - Error
|
|
744
|
+
...(variant === 'filled' &&
|
|
745
|
+
color === 'error' && {
|
|
746
|
+
backgroundColor: neoDesign.semanticColors.status.error.medium,
|
|
747
|
+
color: '#ffffff',
|
|
748
|
+
border: 'none',
|
|
749
|
+
}),
|
|
750
|
+
// Filled variant - Warning
|
|
751
|
+
...(variant === 'filled' &&
|
|
752
|
+
color === 'warning' && {
|
|
753
|
+
backgroundColor: neoDesign.semanticColors.status.warning.medium,
|
|
754
|
+
color: '#ffffff',
|
|
755
|
+
border: 'none',
|
|
756
|
+
}),
|
|
757
|
+
// Filled variant - Success
|
|
758
|
+
...(variant === 'filled' &&
|
|
759
|
+
color === 'success' && {
|
|
760
|
+
backgroundColor: neoDesign.semanticColors.status.success.medium,
|
|
761
|
+
color: '#ffffff',
|
|
762
|
+
border: 'none',
|
|
763
|
+
}),
|
|
764
|
+
// Filled variant - Info
|
|
765
|
+
...(variant === 'filled' &&
|
|
766
|
+
color === 'info' && {
|
|
767
|
+
backgroundColor: neoDesign.semanticColors.status.info.medium,
|
|
768
|
+
color: '#ffffff',
|
|
769
|
+
border: 'none',
|
|
770
|
+
}),
|
|
771
|
+
// Filled variant - Violet
|
|
772
|
+
...(variant === 'filled' &&
|
|
773
|
+
color === 'violet' && {
|
|
774
|
+
backgroundColor: neoDesign.colors.violet[500],
|
|
775
|
+
color: '#ffffff',
|
|
776
|
+
border: 'none',
|
|
777
|
+
}),
|
|
778
|
+
}));
|
|
779
|
+
/**
|
|
780
|
+
* NeoTag - Small pill-shaped label component based on MUI Chip
|
|
781
|
+
*
|
|
782
|
+
* @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC/Neo---Moderne-Design-system---2025?node-id=4120-34533
|
|
783
|
+
*
|
|
784
|
+
* Figma Props Mapping:
|
|
785
|
+
* - m (sm|md|lg) → size (small|medium|large)
|
|
786
|
+
* - type (light|dark) → variant (outlined|filled)
|
|
787
|
+
* - state (Neutral|Error|Warning|Success|Info|Violet) → color (default|error|warning|success|info|violet)
|
|
788
|
+
* - Label text → label prop
|
|
789
|
+
*/
|
|
790
|
+
const NeoTag = ({ size = 'small', variant = 'outlined', ...props }) => {
|
|
791
|
+
return jsxRuntime.jsx(StyledChip, { size: size, variant: variant, ...props });
|
|
792
|
+
};
|
|
793
|
+
NeoTag.displayName = 'NeoTag';
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* NeoTabs - Tabs container component based on MUI Tabs
|
|
797
|
+
*
|
|
798
|
+
* @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC/Neo---Moderne-Design-system---2025?node-id=3368-26152
|
|
799
|
+
*
|
|
800
|
+
* Figma Props Mapping:
|
|
801
|
+
* - Horizontal tab bar → default layout
|
|
802
|
+
* - Tab selection → value prop + onChange
|
|
803
|
+
* - Active indicator → styled via indicator slot
|
|
804
|
+
*/
|
|
805
|
+
const NeoTabs = styles.styled(MuiTabs)(() => ({
|
|
806
|
+
minHeight: 40,
|
|
807
|
+
[`& .${MuiTabs.tabsClasses.indicator}`]: {
|
|
808
|
+
backgroundColor: neoDesign.semanticColors.border.tabActive,
|
|
809
|
+
height: 2,
|
|
810
|
+
},
|
|
811
|
+
[`& .${MuiTabs.tabsClasses.flexContainer}`]: {
|
|
812
|
+
gap: 0,
|
|
813
|
+
},
|
|
814
|
+
}));
|
|
815
|
+
NeoTabs.displayName = 'NeoTabs';
|
|
816
|
+
const StyledTab = styles.styled(MuiTab)(({ theme }) => ({
|
|
817
|
+
minHeight: 40,
|
|
818
|
+
padding: `${theme.spacing(1)} ${theme.spacing(2)}`,
|
|
819
|
+
textTransform: 'none',
|
|
820
|
+
fontWeight: 500,
|
|
821
|
+
fontSize: theme.typography.pxToRem(14),
|
|
822
|
+
lineHeight: 1.5,
|
|
823
|
+
color: neoDesign.semanticColors.typography.tab.inactive,
|
|
824
|
+
transition: theme.transitions.create(['color', 'background-color'], {
|
|
825
|
+
duration: theme.transitions.duration.short,
|
|
826
|
+
}),
|
|
827
|
+
[`&.${MuiTab.tabClasses.selected}`]: {
|
|
828
|
+
color: neoDesign.semanticColors.typography.tab.active,
|
|
829
|
+
fontWeight: 600,
|
|
830
|
+
},
|
|
831
|
+
[`&.${ButtonBase.buttonBaseClasses.focusVisible}`]: {
|
|
832
|
+
outline: `2px solid ${neoDesign.semanticColors.buttons.primary.focus}`,
|
|
833
|
+
outlineOffset: -2,
|
|
834
|
+
},
|
|
835
|
+
[`&.${MuiTab.tabClasses.disabled}`]: {
|
|
836
|
+
color: neoDesign.semanticColors.typography.button.disabled,
|
|
837
|
+
cursor: 'not-allowed',
|
|
838
|
+
pointerEvents: 'auto',
|
|
839
|
+
},
|
|
840
|
+
}));
|
|
841
|
+
const TabLabelContainer = styles.styled('span')(({ theme }) => ({
|
|
842
|
+
display: 'inline-flex',
|
|
843
|
+
alignItems: 'center',
|
|
844
|
+
gap: theme.spacing(1),
|
|
845
|
+
}));
|
|
846
|
+
/**
|
|
847
|
+
* NeoTab - Individual tab button component based on MUI Tab
|
|
848
|
+
*
|
|
849
|
+
* @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC/Neo---Moderne-Design-system---2025?node-id=3368-26152
|
|
850
|
+
*
|
|
851
|
+
* Figma Props Mapping:
|
|
852
|
+
* - Current=True/False → Controlled by parent NeoTabs value
|
|
853
|
+
* - State=Default → default styling
|
|
854
|
+
* - State=Hover → CSS :hover
|
|
855
|
+
* - State=Focus → CSS :focus-visible
|
|
856
|
+
* - Tag count → count prop (renders NeoTag)
|
|
857
|
+
* - Text label → label prop
|
|
858
|
+
*/
|
|
859
|
+
const NeoTab = ({ label, count, ...props }) => {
|
|
860
|
+
const tabLabel = count !== undefined ? (jsxRuntime.jsxs(TabLabelContainer, { children: [label, jsxRuntime.jsx(NeoTag, { label: String(count), size: "large", variant: "outlined", color: "default" })] })) : (label);
|
|
861
|
+
return jsxRuntime.jsx(StyledTab, { label: tabLabel, ...props });
|
|
862
|
+
};
|
|
863
|
+
NeoTab.displayName = 'NeoTab';
|
|
864
|
+
|
|
865
|
+
const StyledAlert = styles.styled(Alert, {
|
|
866
|
+
shouldForwardProp: prop => prop !== 'variant' && prop !== 'showProgress',
|
|
867
|
+
})(({ theme, variant = 'default' }) => {
|
|
868
|
+
// Base styles
|
|
869
|
+
const baseStyles = {
|
|
870
|
+
padding: neoDesign.spacing.spacing_2,
|
|
871
|
+
borderRadius: neoDesign.borderRadius.s,
|
|
872
|
+
gap: neoDesign.spacing.spacing_4,
|
|
873
|
+
alignItems: 'flex-start',
|
|
874
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.sm),
|
|
875
|
+
lineHeight: 1.4,
|
|
876
|
+
[`& .${Alert.alertClasses.icon}`]: {
|
|
877
|
+
display: 'none',
|
|
878
|
+
},
|
|
879
|
+
[`& .${Alert.alertClasses.message}`]: {
|
|
880
|
+
padding: 0,
|
|
881
|
+
width: '100%',
|
|
882
|
+
display: 'flex',
|
|
883
|
+
flexDirection: 'column',
|
|
884
|
+
gap: neoDesign.spacing.spacing_3,
|
|
885
|
+
},
|
|
886
|
+
[`& .${Alert.alertClasses.action}`]: {
|
|
887
|
+
padding: 0,
|
|
888
|
+
marginRight: 0,
|
|
889
|
+
},
|
|
890
|
+
};
|
|
891
|
+
// Variant-specific styles
|
|
892
|
+
const variantStyles = {
|
|
893
|
+
default: {
|
|
894
|
+
backgroundColor: neoDesign.semanticColors.surfaces.snackbarDarkMode,
|
|
895
|
+
color: neoDesign.colors.grey['800'],
|
|
896
|
+
border: `1px solid ${neoDesign.semanticColors.border.primary}`,
|
|
897
|
+
},
|
|
898
|
+
dark: {
|
|
899
|
+
backgroundColor: neoDesign.semanticColors.surfaces.snackbarLightMode,
|
|
900
|
+
color: neoDesign.semanticColors.surfaces.white,
|
|
901
|
+
border: `1px solid ${neoDesign.semanticColors.surfaces.snackbarLightMode}`,
|
|
902
|
+
},
|
|
903
|
+
brand: {
|
|
904
|
+
backgroundColor: neoDesign.semanticColors.surfaces.snackbarBrand,
|
|
905
|
+
color: neoDesign.semanticColors.surfaces.white,
|
|
906
|
+
border: `1px solid ${neoDesign.semanticColors.surfaces.snackbarBrand}`,
|
|
907
|
+
},
|
|
908
|
+
error: {
|
|
909
|
+
backgroundColor: neoDesign.semanticColors.status.error.light,
|
|
910
|
+
color: neoDesign.semanticColors.status.error.dark,
|
|
911
|
+
border: `1px solid ${neoDesign.semanticColors.status.error.medium}`,
|
|
912
|
+
},
|
|
913
|
+
success: {
|
|
914
|
+
backgroundColor: neoDesign.semanticColors.status.success.light,
|
|
915
|
+
color: neoDesign.semanticColors.status.success.dark,
|
|
916
|
+
border: `1px solid ${neoDesign.semanticColors.status.success.medium}`,
|
|
917
|
+
},
|
|
918
|
+
info: {
|
|
919
|
+
backgroundColor: neoDesign.semanticColors.status.info.light,
|
|
920
|
+
color: neoDesign.semanticColors.status.info.dark,
|
|
921
|
+
border: `1px solid ${neoDesign.semanticColors.status.info.medium}`,
|
|
922
|
+
},
|
|
923
|
+
download: {
|
|
924
|
+
backgroundColor: neoDesign.semanticColors.surfaces.snackbarDarkMode,
|
|
925
|
+
color: neoDesign.colors.grey['800'],
|
|
926
|
+
border: `1px solid ${neoDesign.semanticColors.border.primary}`,
|
|
927
|
+
},
|
|
928
|
+
};
|
|
929
|
+
return {
|
|
930
|
+
...baseStyles,
|
|
931
|
+
...variantStyles[variant],
|
|
932
|
+
};
|
|
933
|
+
});
|
|
934
|
+
const ToastTitle = styles.styled('p')(({ theme, variant = 'default' }) => {
|
|
935
|
+
const colorMap = {
|
|
936
|
+
default: neoDesign.colors.grey['700'],
|
|
937
|
+
dark: neoDesign.semanticColors.surfaces.white,
|
|
938
|
+
brand: neoDesign.semanticColors.surfaces.white,
|
|
939
|
+
error: neoDesign.semanticColors.status.error.dark,
|
|
940
|
+
success: neoDesign.semanticColors.status.success.dark,
|
|
941
|
+
info: neoDesign.semanticColors.status.info.dark,
|
|
942
|
+
download: neoDesign.colors.grey['700'],
|
|
943
|
+
};
|
|
944
|
+
return {
|
|
945
|
+
margin: 0,
|
|
946
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.sm),
|
|
947
|
+
fontWeight: 600,
|
|
948
|
+
lineHeight: 1.4,
|
|
949
|
+
color: colorMap[variant],
|
|
950
|
+
};
|
|
951
|
+
});
|
|
952
|
+
const ToastMessage = styles.styled('p')(({ theme, variant = 'default' }) => {
|
|
953
|
+
const colorMap = {
|
|
954
|
+
default: neoDesign.semanticColors.typography.bodySecondary,
|
|
955
|
+
dark: neoDesign.colors.grey['200'],
|
|
956
|
+
brand: neoDesign.colors.grey['200'],
|
|
957
|
+
error: neoDesign.semanticColors.status.error.dark,
|
|
958
|
+
success: neoDesign.semanticColors.status.success.dark,
|
|
959
|
+
info: neoDesign.semanticColors.status.info.dark,
|
|
960
|
+
download: neoDesign.colors.grey['800'],
|
|
961
|
+
};
|
|
962
|
+
return {
|
|
963
|
+
margin: 0,
|
|
964
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.sm),
|
|
965
|
+
fontWeight: 400,
|
|
966
|
+
lineHeight: 1.4,
|
|
967
|
+
color: colorMap[variant],
|
|
968
|
+
};
|
|
969
|
+
});
|
|
970
|
+
const ToastActions = styles.styled(Stack)({
|
|
971
|
+
gap: neoDesign.spacing.spacing_3,
|
|
972
|
+
alignItems: 'flex-start',
|
|
973
|
+
justifyContent: 'flex-start',
|
|
974
|
+
});
|
|
975
|
+
const ToastButton = styles.styled(Button, {
|
|
976
|
+
shouldForwardProp: prop => prop !== 'toastVariant' && prop !== 'primary',
|
|
977
|
+
})(({ toastVariant = 'default', primary }) => {
|
|
978
|
+
const getColor = () => {
|
|
979
|
+
if (primary) {
|
|
980
|
+
if (toastVariant === 'dark' || toastVariant === 'brand') {
|
|
981
|
+
return neoDesign.colors.digitalBlue['200'];
|
|
982
|
+
}
|
|
983
|
+
return neoDesign.semanticColors.typography.link.primary;
|
|
984
|
+
}
|
|
985
|
+
// Non-primary button colors
|
|
986
|
+
if (toastVariant === 'dark' || toastVariant === 'brand') {
|
|
987
|
+
return neoDesign.semanticColors.surfaces.white;
|
|
988
|
+
}
|
|
989
|
+
if (toastVariant === 'error') {
|
|
990
|
+
return neoDesign.semanticColors.status.error.dark;
|
|
991
|
+
}
|
|
992
|
+
if (toastVariant === 'success') {
|
|
993
|
+
return neoDesign.semanticColors.status.success.dark;
|
|
994
|
+
}
|
|
995
|
+
if (toastVariant === 'info') {
|
|
996
|
+
return neoDesign.semanticColors.status.info.dark;
|
|
997
|
+
}
|
|
998
|
+
// default and download variants use icon placeholder color
|
|
999
|
+
return neoDesign.semanticColors.icons.placeholder;
|
|
1000
|
+
};
|
|
1001
|
+
return {
|
|
1002
|
+
padding: 0,
|
|
1003
|
+
minWidth: 'auto',
|
|
1004
|
+
fontSize: neoDesign.typography.fontSize.sm,
|
|
1005
|
+
fontWeight: 500,
|
|
1006
|
+
lineHeight: 'normal',
|
|
1007
|
+
textTransform: 'none',
|
|
1008
|
+
color: getColor(),
|
|
1009
|
+
'&:hover': {
|
|
1010
|
+
backgroundColor: 'transparent',
|
|
1011
|
+
textDecoration: 'underline',
|
|
1012
|
+
},
|
|
1013
|
+
};
|
|
1014
|
+
});
|
|
1015
|
+
const ProgressSection = styles.styled(Stack)({
|
|
1016
|
+
gap: neoDesign.spacing.spacing_1,
|
|
1017
|
+
width: '100%',
|
|
1018
|
+
});
|
|
1019
|
+
const FileName = styles.styled('p')(({ theme }) => ({
|
|
1020
|
+
margin: 0,
|
|
1021
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.xs),
|
|
1022
|
+
fontWeight: 500,
|
|
1023
|
+
lineHeight: 1.5,
|
|
1024
|
+
color: neoDesign.colors.grey['800'],
|
|
1025
|
+
}));
|
|
1026
|
+
const ProgressLabel = styles.styled('p')(({ theme }) => ({
|
|
1027
|
+
margin: 0,
|
|
1028
|
+
fontSize: theme.typography.pxToRem(neoDesign.typography.fontSize.xs),
|
|
1029
|
+
fontWeight: 500,
|
|
1030
|
+
lineHeight: 1.5,
|
|
1031
|
+
color: neoDesign.colors.grey['800'],
|
|
1032
|
+
}));
|
|
1033
|
+
const StyledLinearProgress = styles.styled(LinearProgress)({
|
|
1034
|
+
width: '100%',
|
|
1035
|
+
height: neoDesign.spacing.spacing_2,
|
|
1036
|
+
borderRadius: neoDesign.borderRadius.s,
|
|
1037
|
+
backgroundColor: neoDesign.colors.grey['200'],
|
|
1038
|
+
[`& .${LinearProgress.linearProgressClasses.bar}`]: {
|
|
1039
|
+
backgroundColor: neoDesign.semanticColors.buttons.primary.default,
|
|
1040
|
+
borderRadius: `${neoDesign.borderRadius.xS}px 0 0 ${neoDesign.borderRadius.xS}px`,
|
|
1041
|
+
},
|
|
1042
|
+
});
|
|
1043
|
+
const DownloadActions = styles.styled(Stack)({
|
|
1044
|
+
gap: `${neoDesign.spacing.spacing_4}px`,
|
|
1045
|
+
alignItems: 'center',
|
|
1046
|
+
});
|
|
1047
|
+
const DownloadIconButton = styles.styled(IconButton)({
|
|
1048
|
+
padding: 0,
|
|
1049
|
+
width: 16,
|
|
1050
|
+
height: 16,
|
|
1051
|
+
color: neoDesign.colors.grey['800'],
|
|
1052
|
+
'&:hover': {
|
|
1053
|
+
backgroundColor: 'transparent',
|
|
1054
|
+
},
|
|
1055
|
+
});
|
|
1056
|
+
/**
|
|
1057
|
+
* NeoToast - Notification/Toast component based on MUI Alert
|
|
1058
|
+
*
|
|
1059
|
+
* @figma https://www.figma.com/design/fQTkGSFbYyE7LiHuQJsENC/Neo---Moderne-Design-system---2025?node-id=4122-37223
|
|
1060
|
+
*
|
|
1061
|
+
* Figma Props Mapping:
|
|
1062
|
+
* - type (Light mode|Dark mode|Brand color|Error|Success|Info|Download) → variant (default|dark|brand|error|success|info|download)
|
|
1063
|
+
* - header → title (string)
|
|
1064
|
+
* - supportingText → message (string)
|
|
1065
|
+
* - xCloseButton → showClose (boolean)
|
|
1066
|
+
* - actions → actions (ReactNode)
|
|
1067
|
+
* - Progress bar → progress (number 0-100)
|
|
1068
|
+
*/
|
|
1069
|
+
const NeoToast = ({ variant = 'default', title, message, showClose = true, actions, progress, fileName, onClose, ...props }) => {
|
|
1070
|
+
const isDownloadVariant = variant === 'download';
|
|
1071
|
+
return (jsxRuntime.jsx(StyledAlert, { ...props, variant: variant, showProgress: isDownloadVariant, action: showClose && !isDownloadVariant ? (jsxRuntime.jsx(IconButton, { size: "small", onClick: onClose, sx: { color: neoDesign.semanticColors.icons.placeholder }, children: jsxRuntime.jsx(X, { size: 16 }) })) : undefined, children: isDownloadVariant ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Stack, { direction: "row", sx: {
|
|
1072
|
+
alignItems: 'flex-start',
|
|
1073
|
+
justifyContent: 'space-between',
|
|
1074
|
+
width: '100%',
|
|
1075
|
+
gap: `${neoDesign.spacing.spacing_4}px`,
|
|
1076
|
+
}, children: [title && jsxRuntime.jsx(ToastTitle, { variant: variant, children: title }), showClose && (jsxRuntime.jsxs(DownloadActions, { direction: "row", children: [jsxRuntime.jsx(DownloadIconButton, { size: "small", children: jsxRuntime.jsx(Stack, { sx: { width: 16, height: 16 } }) }), jsxRuntime.jsx(DownloadIconButton, { size: "small", onClick: onClose, children: jsxRuntime.jsx(X, { size: 16 }) })] }))] }), jsxRuntime.jsxs(ProgressSection, { children: [jsxRuntime.jsxs(Stack, { direction: "row", sx: { alignItems: 'flex-end', justifyContent: 'space-between', width: '100%' }, children: [fileName && jsxRuntime.jsx(FileName, { children: fileName }), progress !== undefined && jsxRuntime.jsxs(ProgressLabel, { children: [progress, "%"] })] }), jsxRuntime.jsx(StyledLinearProgress, { variant: "determinate", value: progress ?? 0 })] })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Stack, { sx: { gap: `${neoDesign.spacing.spacing_1}px`, width: '100%' }, children: [title && jsxRuntime.jsx(ToastTitle, { variant: variant, children: title }), message && jsxRuntime.jsx(ToastMessage, { variant: variant, children: message })] }), actions && jsxRuntime.jsx(ToastActions, { direction: "row", children: actions })] })) }));
|
|
1077
|
+
};
|
|
1078
|
+
/**
|
|
1079
|
+
* Helper component for creating toast action buttons with proper styling
|
|
1080
|
+
*/
|
|
1081
|
+
const NeoToastButton = ({ primary, variant = 'default', children, ...props }) => {
|
|
1082
|
+
return (jsxRuntime.jsx(ToastButton, { variant: "text", toastVariant: variant, primary: primary, ...props, children: children }));
|
|
1083
|
+
};
|
|
1084
|
+
NeoToast.displayName = 'NeoToast';
|
|
1085
|
+
NeoToastButton.displayName = 'NeoToastButton';
|
|
1086
|
+
|
|
3
1087
|
/**
|
|
4
1088
|
* @moderneinc/neo-styled-components
|
|
5
1089
|
*
|
|
6
1090
|
* Styled MUI components using Moderne design tokens
|
|
7
1091
|
*/
|
|
8
1092
|
|
|
9
|
-
// Placeholder - components will be added here
|
|
10
1093
|
const version = '0.0.0-development';
|
|
11
1094
|
|
|
1095
|
+
exports.NeoBadge = NeoBadge;
|
|
1096
|
+
exports.NeoButton = NeoButton;
|
|
1097
|
+
exports.NeoIconButton = NeoIconButton;
|
|
1098
|
+
exports.NeoInputField = NeoInputField;
|
|
1099
|
+
exports.NeoTab = NeoTab;
|
|
1100
|
+
exports.NeoTabs = NeoTabs;
|
|
1101
|
+
exports.NeoTag = NeoTag;
|
|
1102
|
+
exports.NeoToast = NeoToast;
|
|
1103
|
+
exports.NeoToastButton = NeoToastButton;
|
|
12
1104
|
exports.version = version;
|
|
13
1105
|
//# sourceMappingURL=index.js.map
|