@chellaa/react 0.2.0 → 0.2.1

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.mjs CHANGED
@@ -1,27 +1,536 @@
1
1
  import "./styles.css";
2
2
  import * as React from 'react';
3
+ import { keyframes, ThemeProvider as ThemeProvider$1, useTheme as useTheme$1 } from '@emotion/react';
3
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
+ import emotionStyled from '@emotion/styled';
4
6
 
5
- // src/theme/ThemeProvider.tsx
7
+ // src/theme/palette.ts
8
+ var lightPalette = {
9
+ mode: "light",
10
+ primary: {
11
+ light: "#818cf8",
12
+ // indigo-400
13
+ main: "#6366f1",
14
+ // indigo-500
15
+ dark: "#4f46e5",
16
+ // indigo-600
17
+ contrastText: "#ffffff"
18
+ },
19
+ secondary: {
20
+ light: "#a78bfa",
21
+ // violet-400
22
+ main: "#8b5cf6",
23
+ // violet-500
24
+ dark: "#7c3aed",
25
+ // violet-600
26
+ contrastText: "#ffffff"
27
+ },
28
+ error: {
29
+ light: "#f87171",
30
+ // red-400
31
+ main: "#ef4444",
32
+ // red-500
33
+ dark: "#dc2626",
34
+ // red-600
35
+ contrastText: "#ffffff"
36
+ },
37
+ warning: {
38
+ light: "#fbbf24",
39
+ // amber-400
40
+ main: "#f59e0b",
41
+ // amber-500
42
+ dark: "#d97706",
43
+ // amber-600
44
+ contrastText: "#18181b"
45
+ },
46
+ info: {
47
+ light: "#38bdf8",
48
+ // sky-400
49
+ main: "#0ea5e9",
50
+ // sky-500
51
+ dark: "#0284c7",
52
+ // sky-600
53
+ contrastText: "#ffffff"
54
+ },
55
+ success: {
56
+ light: "#34d399",
57
+ // emerald-400
58
+ main: "#10b981",
59
+ // emerald-500
60
+ dark: "#059669",
61
+ // emerald-600
62
+ contrastText: "#ffffff"
63
+ },
64
+ text: {
65
+ primary: "rgba(0, 0, 0, 0.87)",
66
+ secondary: "rgba(0, 0, 0, 0.6)",
67
+ disabled: "rgba(0, 0, 0, 0.38)"
68
+ },
69
+ background: {
70
+ default: "#f8fafc",
71
+ paper: "#ffffff",
72
+ surface: "#ffffff"
73
+ },
74
+ divider: "rgba(0, 0, 0, 0.12)",
75
+ action: {
76
+ active: "rgba(0, 0, 0, 0.54)",
77
+ hover: "rgba(0, 0, 0, 0.04)",
78
+ hoverOpacity: 0.04,
79
+ selected: "rgba(0, 0, 0, 0.08)",
80
+ selectedOpacity: 0.08,
81
+ disabled: "rgba(0, 0, 0, 0.26)",
82
+ disabledBackground: "rgba(0, 0, 0, 0.12)",
83
+ focus: "rgba(0, 0, 0, 0.12)",
84
+ focusOpacity: 0.12
85
+ }
86
+ };
87
+ var darkPalette = {
88
+ mode: "dark",
89
+ primary: {
90
+ light: "#a5b4fc",
91
+ // indigo-300
92
+ main: "#818cf8",
93
+ // indigo-400
94
+ dark: "#6366f1",
95
+ // indigo-500
96
+ contrastText: "#09090b"
97
+ },
98
+ secondary: {
99
+ light: "#c4b5fd",
100
+ // violet-300
101
+ main: "#a78bfa",
102
+ // violet-400
103
+ dark: "#8b5cf6",
104
+ // violet-500
105
+ contrastText: "#09090b"
106
+ },
107
+ error: {
108
+ light: "#fca5a5",
109
+ // red-300
110
+ main: "#f87171",
111
+ // red-400
112
+ dark: "#ef4444",
113
+ // red-500
114
+ contrastText: "#09090b"
115
+ },
116
+ warning: {
117
+ light: "#fde68a",
118
+ // amber-200
119
+ main: "#fbbf24",
120
+ // amber-400
121
+ dark: "#f59e0b",
122
+ // amber-500
123
+ contrastText: "#09090b"
124
+ },
125
+ info: {
126
+ light: "#7dd3fc",
127
+ // sky-300
128
+ main: "#38bdf8",
129
+ // sky-400
130
+ dark: "#0ea5e9",
131
+ // sky-500
132
+ contrastText: "#09090b"
133
+ },
134
+ success: {
135
+ light: "#6ee7b7",
136
+ // emerald-300
137
+ main: "#34d399",
138
+ // emerald-400
139
+ dark: "#10b981",
140
+ // emerald-500
141
+ contrastText: "#09090b"
142
+ },
143
+ text: {
144
+ primary: "rgba(255, 255, 255, 0.95)",
145
+ secondary: "rgba(255, 255, 255, 0.7)",
146
+ disabled: "rgba(255, 255, 255, 0.38)"
147
+ },
148
+ background: {
149
+ default: "#09090b",
150
+ paper: "#18181b",
151
+ surface: "#18181b"
152
+ },
153
+ divider: "rgba(255, 255, 255, 0.12)",
154
+ action: {
155
+ active: "rgba(255, 255, 255, 0.7)",
156
+ hover: "rgba(255, 255, 255, 0.08)",
157
+ hoverOpacity: 0.08,
158
+ selected: "rgba(255, 255, 255, 0.16)",
159
+ selectedOpacity: 0.16,
160
+ disabled: "rgba(255, 255, 255, 0.3)",
161
+ disabledBackground: "rgba(255, 255, 255, 0.12)",
162
+ focus: "rgba(255, 255, 255, 0.12)",
163
+ focusOpacity: 0.12
164
+ }
165
+ };
166
+ function createPalette(mode = "light") {
167
+ return mode === "dark" ? darkPalette : lightPalette;
168
+ }
169
+
170
+ // src/theme/typography.ts
171
+ var defaultFontFamily = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"';
172
+ var defaultTypography = {
173
+ fontFamily: defaultFontFamily,
174
+ fontSize: 14,
175
+ fontWeightLight: 300,
176
+ fontWeightRegular: 400,
177
+ fontWeightMedium: 500,
178
+ fontWeightBold: 700,
179
+ h1: {
180
+ fontFamily: defaultFontFamily,
181
+ fontWeight: 300,
182
+ fontSize: "6rem",
183
+ lineHeight: 1.167,
184
+ letterSpacing: "-0.01562em"
185
+ },
186
+ h2: {
187
+ fontFamily: defaultFontFamily,
188
+ fontWeight: 300,
189
+ fontSize: "3.75rem",
190
+ lineHeight: 1.2,
191
+ letterSpacing: "-0.00833em"
192
+ },
193
+ h3: {
194
+ fontFamily: defaultFontFamily,
195
+ fontWeight: 400,
196
+ fontSize: "3rem",
197
+ lineHeight: 1.167,
198
+ letterSpacing: "0em"
199
+ },
200
+ h4: {
201
+ fontFamily: defaultFontFamily,
202
+ fontWeight: 400,
203
+ fontSize: "2.125rem",
204
+ lineHeight: 1.235,
205
+ letterSpacing: "0.00735em"
206
+ },
207
+ h5: {
208
+ fontFamily: defaultFontFamily,
209
+ fontWeight: 500,
210
+ fontSize: "1.5rem",
211
+ lineHeight: 1.334,
212
+ letterSpacing: "0em"
213
+ },
214
+ h6: {
215
+ fontFamily: defaultFontFamily,
216
+ fontWeight: 500,
217
+ fontSize: "1.25rem",
218
+ lineHeight: 1.6,
219
+ letterSpacing: "0.0075em"
220
+ },
221
+ subtitle1: {
222
+ fontFamily: defaultFontFamily,
223
+ fontWeight: 400,
224
+ fontSize: "1rem",
225
+ lineHeight: 1.75,
226
+ letterSpacing: "0.00938em"
227
+ },
228
+ subtitle2: {
229
+ fontFamily: defaultFontFamily,
230
+ fontWeight: 500,
231
+ fontSize: "0.875rem",
232
+ lineHeight: 1.57,
233
+ letterSpacing: "0.00714em"
234
+ },
235
+ body1: {
236
+ fontFamily: defaultFontFamily,
237
+ fontWeight: 400,
238
+ fontSize: "1rem",
239
+ lineHeight: 1.5,
240
+ letterSpacing: "0.00938em"
241
+ },
242
+ body2: {
243
+ fontFamily: defaultFontFamily,
244
+ fontWeight: 400,
245
+ fontSize: "0.875rem",
246
+ lineHeight: 1.43,
247
+ letterSpacing: "0.01071em"
248
+ },
249
+ button: {
250
+ fontFamily: defaultFontFamily,
251
+ fontWeight: 500,
252
+ fontSize: "0.875rem",
253
+ lineHeight: 1.75,
254
+ letterSpacing: "0.02857em",
255
+ textTransform: "uppercase"
256
+ },
257
+ caption: {
258
+ fontFamily: defaultFontFamily,
259
+ fontWeight: 400,
260
+ fontSize: "0.75rem",
261
+ lineHeight: 1.66,
262
+ letterSpacing: "0.03333em"
263
+ },
264
+ overline: {
265
+ fontFamily: defaultFontFamily,
266
+ fontWeight: 400,
267
+ fontSize: "0.75rem",
268
+ lineHeight: 2.66,
269
+ letterSpacing: "0.08333em",
270
+ textTransform: "uppercase"
271
+ }
272
+ };
273
+
274
+ // src/theme/spacing.ts
275
+ function createSpacing(base = 8) {
276
+ return (...factors) => {
277
+ if (factors.length === 0) return `${base}px`;
278
+ return factors.map((factor) => {
279
+ if (typeof factor === "string") return factor;
280
+ return `${factor * base}px`;
281
+ }).join(" ");
282
+ };
283
+ }
284
+ var defaultSpacing = createSpacing(8);
285
+
286
+ // src/theme/breakpoints.ts
287
+ var defaultBreakpointValues = {
288
+ xs: 0,
289
+ sm: 600,
290
+ md: 900,
291
+ lg: 1200,
292
+ xl: 1536
293
+ };
294
+ var breakpointKeys = ["xs", "sm", "md", "lg", "xl"];
295
+ function createBreakpoints(customValues) {
296
+ const values = {
297
+ ...defaultBreakpointValues,
298
+ ...customValues
299
+ };
300
+ const step = 5 / 100;
301
+ const up = (key) => {
302
+ const value = typeof key === "number" ? key : values[key];
303
+ return `@media (min-width:${value}px)`;
304
+ };
305
+ const down = (key) => {
306
+ const value = typeof key === "number" ? key : values[key];
307
+ return `@media (max-width:${value - step}px)`;
308
+ };
309
+ const between = (start, end) => {
310
+ const min = typeof start === "number" ? start : values[start];
311
+ const max = typeof end === "number" ? end : values[end];
312
+ return `@media (min-width:${min}px) and (max-width:${max - step}px)`;
313
+ };
314
+ const only = (key) => {
315
+ const index = breakpointKeys.indexOf(key);
316
+ if (index === breakpointKeys.length - 1) {
317
+ return up(key);
318
+ }
319
+ const nextKey = breakpointKeys[index + 1];
320
+ return nextKey ? between(key, nextKey) : up(key);
321
+ };
322
+ return {
323
+ values,
324
+ up,
325
+ down,
326
+ between,
327
+ only
328
+ };
329
+ }
330
+ var defaultBreakpoints = createBreakpoints();
331
+
332
+ // src/theme/shadows.ts
333
+ var umbra = [
334
+ "0px 0px 0px 0px",
335
+ "0px 2px 1px -1px",
336
+ "0px 3px 1px -2px",
337
+ "0px 3px 3px -2px",
338
+ "0px 2px 4px -1px",
339
+ "0px 3px 5px -1px",
340
+ "0px 3px 5px -1px",
341
+ "0px 4px 5px -2px",
342
+ "0px 5px 5px -3px",
343
+ "0px 5px 6px -3px",
344
+ "0px 6px 6px -3px",
345
+ "0px 6px 7px -4px",
346
+ "0px 7px 8px -4px",
347
+ "0px 7px 8px -4px",
348
+ "0px 7px 9px -4px",
349
+ "0px 8px 9px -5px",
350
+ "0px 8px 10px -5px",
351
+ "0px 8px 11px -5px",
352
+ "0px 9px 11px -5px",
353
+ "0px 9px 12px -6px",
354
+ "0px 10px 13px -6px",
355
+ "0px 10px 13px -6px",
356
+ "0px 10px 14px -6px",
357
+ "0px 11px 14px -7px",
358
+ "0px 11px 15px -7px"
359
+ ];
360
+ var penumbra = [
361
+ "0px 0px 0px 0px",
362
+ "0px 1px 1px 0px",
363
+ "0px 2px 2px 0px",
364
+ "0px 3px 4px 0px",
365
+ "0px 4px 5px 0px",
366
+ "0px 5px 8px 0px",
367
+ "0px 6px 10px 0px",
368
+ "0px 7px 10px 1px",
369
+ "0px 8px 10px 1px",
370
+ "0px 9px 12px 1px",
371
+ "0px 10px 14px 1px",
372
+ "0px 11px 15px 1px",
373
+ "0px 12px 17px 2px",
374
+ "0px 13px 19px 2px",
375
+ "0px 14px 21px 2px",
376
+ "0px 15px 22px 2px",
377
+ "0px 16px 24px 2px",
378
+ "0px 17px 26px 2px",
379
+ "0px 18px 28px 2px",
380
+ "0px 19px 29px 2px",
381
+ "0px 20px 31px 3px",
382
+ "0px 21px 33px 3px",
383
+ "0px 22px 35px 3px",
384
+ "0px 23px 36px 3px",
385
+ "0px 24px 38px 3px"
386
+ ];
387
+ var ambient = [
388
+ "0px 0px 0px 0px",
389
+ "0px 1px 3px 0px",
390
+ "0px 1px 5px 0px",
391
+ "0px 1px 8px 0px",
392
+ "0px 1px 10px 0px",
393
+ "0px 1px 14px 0px",
394
+ "0px 1px 18px 0px",
395
+ "0px 2px 16px 1px",
396
+ "0px 3px 14px 2px",
397
+ "0px 3px 16px 2px",
398
+ "0px 4px 18px 3px",
399
+ "0px 4px 20px 3px",
400
+ "0px 5px 22px 4px",
401
+ "0px 5px 24px 4px",
402
+ "0px 5px 26px 4px",
403
+ "0px 6px 28px 5px",
404
+ "0px 6px 30px 5px",
405
+ "0px 6px 32px 5px",
406
+ "0px 7px 34px 6px",
407
+ "0px 7px 36px 6px",
408
+ "0px 8px 38px 7px",
409
+ "0px 8px 40px 7px",
410
+ "0px 8px 42px 7px",
411
+ "0px 9px 44px 8px",
412
+ "0px 9px 46px 8px"
413
+ ];
414
+ function createShadows() {
415
+ return umbra.map((u, i) => {
416
+ if (i === 0) return "none";
417
+ return `${u} rgba(0,0,0,0.2), ${penumbra[i]} rgba(0,0,0,0.14), ${ambient[i]} rgba(0,0,0,0.12)`;
418
+ });
419
+ }
420
+ var defaultShadows = createShadows();
421
+
422
+ // src/theme/transitions.ts
423
+ var defaultTransitions = {
424
+ easing: {
425
+ easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
426
+ easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
427
+ easeIn: "cubic-bezier(0.4, 0, 1, 1)",
428
+ sharp: "cubic-bezier(0.4, 0, 0.6, 1)"
429
+ },
430
+ duration: {
431
+ shortest: 150,
432
+ shorter: 200,
433
+ short: 250,
434
+ standard: 300,
435
+ complex: 375,
436
+ enteringScreen: 225,
437
+ leavingScreen: 195
438
+ },
439
+ create(props = ["all"], options = {}) {
440
+ const {
441
+ duration = defaultTransitions.duration.standard,
442
+ easing = defaultTransitions.easing.easeInOut,
443
+ delay = 0
444
+ } = options;
445
+ const formatDuration = (d) => typeof d === "string" ? d : `${d}ms`;
446
+ const formatDelay = (d) => typeof d === "string" ? d : `${d}ms`;
447
+ const properties = Array.isArray(props) ? props : [props];
448
+ return properties.map(
449
+ (prop) => `${prop} ${formatDuration(duration)} ${easing} ${formatDelay(delay)}`
450
+ ).join(", ");
451
+ }
452
+ };
453
+
454
+ // src/theme/zIndex.ts
455
+ var defaultZIndex = {
456
+ mobileStepper: 1e3,
457
+ fab: 1050,
458
+ speedDial: 1050,
459
+ appBar: 1100,
460
+ drawer: 1200,
461
+ modal: 1300,
462
+ snackbar: 1400,
463
+ tooltip: 1500
464
+ };
465
+
466
+ // src/theme/createTheme.ts
467
+ function isObject(item) {
468
+ return item && typeof item === "object" && !Array.isArray(item);
469
+ }
470
+ function deepMerge(target, source) {
471
+ const output = { ...target };
472
+ if (isObject(target) && isObject(source)) {
473
+ Object.keys(source).forEach((key) => {
474
+ if (isObject(source[key])) {
475
+ if (!(key in target)) {
476
+ Object.assign(output, { [key]: source[key] });
477
+ } else {
478
+ output[key] = deepMerge(target[key], source[key]);
479
+ }
480
+ } else {
481
+ Object.assign(output, { [key]: source[key] });
482
+ }
483
+ });
484
+ }
485
+ return output;
486
+ }
487
+ function createTheme(options = {}) {
488
+ const mode = options.palette?.mode ?? "light";
489
+ const basePalette = createPalette(mode);
490
+ const mergedPalette = options.palette ? deepMerge(basePalette, options.palette) : basePalette;
491
+ const mergedTypography = options.typography ? deepMerge(defaultTypography, options.typography) : defaultTypography;
492
+ const mergedBreakpoints = options.breakpoints?.values ? createBreakpoints(options.breakpoints.values) : defaultBreakpoints;
493
+ const spacing = typeof options.spacing === "function" ? options.spacing : defaultSpacing;
494
+ const shape = {
495
+ borderRadius: options.shape?.borderRadius ?? 4
496
+ };
497
+ const shadows = options.shadows ?? defaultShadows;
498
+ const transitions = options.transitions ? deepMerge(defaultTransitions, options.transitions) : defaultTransitions;
499
+ const zIndex = options.zIndex ? deepMerge(defaultZIndex, options.zIndex) : defaultZIndex;
500
+ return {
501
+ palette: mergedPalette,
502
+ typography: mergedTypography,
503
+ spacing,
504
+ shape,
505
+ breakpoints: mergedBreakpoints,
506
+ shadows,
507
+ transitions,
508
+ zIndex,
509
+ components: options.components ?? {}
510
+ };
511
+ }
512
+ var defaultTheme = createTheme({ palette: { mode: "light" } });
513
+ var defaultDarkTheme = createTheme({ palette: { mode: "dark" } });
6
514
  var ThemeContext = React.createContext(
7
515
  void 0
8
516
  );
9
517
  var COLOR_SCHEME_QUERY = "(prefers-color-scheme: dark)";
10
518
  function ThemeProvider({
11
519
  children,
12
- defaultTheme = "system",
520
+ theme: customThemeProp,
521
+ defaultTheme: defaultThemeMode = "system",
13
522
  storageKey = "chellaa-theme",
14
523
  enableSystem = true,
15
524
  tokens,
16
525
  attribute = "data-theme"
17
526
  }) {
18
527
  const parentContext = React.useContext(ThemeContext);
19
- const [theme, setThemeState] = React.useState(() => {
20
- if (typeof window === "undefined") return defaultTheme;
528
+ const [themeMode, setThemeModeState] = React.useState(() => {
529
+ if (typeof window === "undefined") return defaultThemeMode;
21
530
  try {
22
- return localStorage.getItem(storageKey) || defaultTheme;
531
+ return localStorage.getItem(storageKey) || defaultThemeMode;
23
532
  } catch {
24
- return defaultTheme;
533
+ return defaultThemeMode;
25
534
  }
26
535
  });
27
536
  const [systemTheme, setSystemTheme] = React.useState(() => {
@@ -31,11 +540,11 @@ function ThemeProvider({
31
540
  return window.matchMedia(COLOR_SCHEME_QUERY).matches ? "dark" : "light";
32
541
  });
33
542
  const resolvedTheme = React.useMemo(() => {
34
- if (theme === "system") {
543
+ if (themeMode === "system") {
35
544
  return systemTheme ?? "light";
36
545
  }
37
- return theme === "dark" ? "dark" : "light";
38
- }, [theme, systemTheme]);
546
+ return themeMode === "dark" ? "dark" : "light";
547
+ }, [themeMode, systemTheme]);
39
548
  React.useEffect(() => {
40
549
  if (!enableSystem || typeof window === "undefined" || typeof window.matchMedia !== "function") {
41
550
  return;
@@ -52,21 +561,33 @@ function ThemeProvider({
52
561
  return () => mediaQuery.removeListener(handleChange);
53
562
  }
54
563
  }, [enableSystem]);
564
+ const activeTheme = React.useMemo(() => {
565
+ if (customThemeProp) {
566
+ return createTheme({
567
+ ...customThemeProp,
568
+ palette: {
569
+ mode: resolvedTheme,
570
+ ...customThemeProp.palette || {}
571
+ }
572
+ });
573
+ }
574
+ return resolvedTheme === "dark" ? defaultDarkTheme : defaultTheme;
575
+ }, [customThemeProp, resolvedTheme]);
55
576
  React.useEffect(() => {
56
577
  if (typeof document === "undefined") return;
57
578
  if (!parentContext) {
58
579
  const root = document.documentElement;
59
580
  root.setAttribute(attribute, resolvedTheme);
60
581
  if (tokens) {
61
- for (const [key, value2] of Object.entries(tokens)) {
62
- root.style.setProperty(key, value2);
582
+ for (const [key, value] of Object.entries(tokens)) {
583
+ root.style.setProperty(key, value);
63
584
  }
64
585
  }
65
586
  }
66
587
  }, [resolvedTheme, parentContext, attribute, tokens]);
67
588
  const setTheme = React.useCallback(
68
589
  (newTheme) => {
69
- setThemeState(newTheme);
590
+ setThemeModeState(newTheme);
70
591
  try {
71
592
  localStorage.setItem(storageKey, newTheme);
72
593
  } catch {
@@ -74,18 +595,27 @@ function ThemeProvider({
74
595
  },
75
596
  [storageKey]
76
597
  );
77
- const value = React.useMemo(
598
+ const setColorMode = React.useCallback(
599
+ (mode) => {
600
+ setTheme(mode);
601
+ },
602
+ [setTheme]
603
+ );
604
+ const contextValue = React.useMemo(
78
605
  () => ({
79
- theme,
606
+ theme: themeMode,
80
607
  setTheme,
81
608
  resolvedTheme,
82
- systemTheme
609
+ systemTheme,
610
+ activeTheme,
611
+ colorMode: resolvedTheme,
612
+ setColorMode
83
613
  }),
84
- [theme, setTheme, resolvedTheme, systemTheme]
614
+ [themeMode, setTheme, resolvedTheme, systemTheme, activeTheme, setColorMode]
85
615
  );
86
616
  if (parentContext) {
87
617
  const styleObj = tokens ? tokens : void 0;
88
- return /* @__PURE__ */ jsx(ThemeContext.Provider, { value, children: /* @__PURE__ */ jsx(
618
+ return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(ThemeProvider$1, { theme: activeTheme, children: /* @__PURE__ */ jsx(
89
619
  "div",
90
620
  {
91
621
  ...{ [attribute]: resolvedTheme },
@@ -93,43 +623,56 @@ function ThemeProvider({
93
623
  className: "cl-theme-scope",
94
624
  children
95
625
  }
96
- ) });
626
+ ) }) });
97
627
  }
98
- return /* @__PURE__ */ jsx(ThemeContext.Provider, { value, children });
628
+ return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(ThemeProvider$1, { theme: activeTheme, children }) });
99
629
  }
100
630
  function useTheme() {
101
631
  const context = React.useContext(ThemeContext);
102
- if (!context) {
103
- throw new Error(
104
- "useTheme must be used within a <ThemeProvider>. Wrap your application root in <ThemeProvider>."
105
- );
632
+ const emotionTheme = useTheme$1();
633
+ if (context) {
634
+ return {
635
+ ...context,
636
+ themeObject: context.activeTheme
637
+ };
638
+ }
639
+ if (emotionTheme && emotionTheme.palette) {
640
+ return {
641
+ theme: emotionTheme.palette.mode,
642
+ setTheme: () => {
643
+ },
644
+ resolvedTheme: emotionTheme.palette.mode,
645
+ systemTheme: void 0,
646
+ activeTheme: emotionTheme,
647
+ colorMode: emotionTheme.palette.mode,
648
+ setColorMode: () => {
649
+ },
650
+ themeObject: emotionTheme
651
+ };
106
652
  }
107
- return context;
108
- }
109
-
110
- // src/theme/createTheme.ts
111
- function createTheme(config) {
112
- const { name, tokens } = config;
113
- const declarations = Object.entries(tokens).map(([property, value]) => ` ${property}: ${value};`).join("\n");
114
- const cssText = `[data-theme="${name}"] {
115
- ${declarations}
116
- }`;
117
653
  return {
118
- name,
119
- tokens,
120
- cssText
654
+ theme: "light",
655
+ setTheme: () => {
656
+ },
657
+ resolvedTheme: "light",
658
+ systemTheme: void 0,
659
+ activeTheme: defaultTheme,
660
+ colorMode: "light",
661
+ setColorMode: () => {
662
+ },
663
+ themeObject: defaultTheme
121
664
  };
122
665
  }
123
666
  function ThemeScript({
124
667
  storageKey = "chellaa-theme",
125
- defaultTheme = "system",
668
+ defaultTheme: defaultTheme2 = "system",
126
669
  attribute = "data-theme",
127
670
  nonce
128
671
  }) {
129
672
  const scriptContent = `(function() {
130
673
  try {
131
674
  var key = '${storageKey}';
132
- var def = '${defaultTheme}';
675
+ var def = '${defaultTheme2}';
133
676
  var attr = '${attribute}';
134
677
  var stored = localStorage.getItem(key);
135
678
  var theme = stored || def;
@@ -150,6 +693,303 @@ function ThemeScript({
150
693
  );
151
694
  }
152
695
 
696
+ // src/system/shouldForwardProp.ts
697
+ var defaultBlockedProps = /* @__PURE__ */ new Set([
698
+ "sx",
699
+ "theme",
700
+ "as",
701
+ "ownerState",
702
+ "slotProps"
703
+ ]);
704
+ function createShouldForwardProp(customBlocked) {
705
+ const blockedSet = new Set(defaultBlockedProps);
706
+ if (customBlocked) {
707
+ customBlocked.forEach((prop) => blockedSet.add(prop));
708
+ }
709
+ return (prop) => {
710
+ if (typeof prop === "string" && prop.startsWith("$")) {
711
+ return false;
712
+ }
713
+ return !blockedSet.has(prop);
714
+ };
715
+ }
716
+ var rootShouldForwardProp = createShouldForwardProp();
717
+
718
+ // src/system/sx.ts
719
+ var spacingProperties = {
720
+ m: ["margin"],
721
+ margin: ["margin"],
722
+ mt: ["marginTop"],
723
+ marginTop: ["marginTop"],
724
+ mr: ["marginRight"],
725
+ marginRight: ["marginRight"],
726
+ mb: ["marginBottom"],
727
+ marginBottom: ["marginBottom"],
728
+ ml: ["marginLeft"],
729
+ marginLeft: ["marginLeft"],
730
+ mx: ["marginInline"],
731
+ marginInline: ["marginInline"],
732
+ my: ["marginBlock"],
733
+ marginBlock: ["marginBlock"],
734
+ p: ["padding"],
735
+ padding: ["padding"],
736
+ pt: ["paddingTop"],
737
+ paddingTop: ["paddingTop"],
738
+ pr: ["paddingRight"],
739
+ paddingRight: ["paddingRight"],
740
+ pb: ["paddingBottom"],
741
+ paddingBottom: ["paddingBottom"],
742
+ pl: ["paddingLeft"],
743
+ paddingLeft: ["paddingLeft"],
744
+ px: ["paddingInline"],
745
+ paddingInline: ["paddingInline"],
746
+ py: ["paddingBlock"],
747
+ paddingBlock: ["paddingBlock"],
748
+ gap: ["gap"],
749
+ rowGap: ["rowGap"],
750
+ columnGap: ["columnGap"]
751
+ };
752
+ function resolvePalettePath(palette, path) {
753
+ if (!path || typeof path !== "string") return void 0;
754
+ const parts = path.split(".");
755
+ let current = palette;
756
+ for (const part of parts) {
757
+ if (current && typeof current === "object" && part in current) {
758
+ current = current[part];
759
+ } else {
760
+ return void 0;
761
+ }
762
+ }
763
+ return typeof current === "string" ? current : void 0;
764
+ }
765
+ function resolveColor(theme, value) {
766
+ if (typeof value !== "string") return value;
767
+ const resolved = resolvePalettePath(theme.palette, value);
768
+ return resolved ?? value;
769
+ }
770
+ function resolveZIndex(theme, value) {
771
+ if (typeof value === "string" && value in theme.zIndex) {
772
+ return theme.zIndex[value];
773
+ }
774
+ return value;
775
+ }
776
+ function resolveSingleProperty(theme, prop, value) {
777
+ if (value === void 0 || value === null) return {};
778
+ if (prop in spacingProperties) {
779
+ const cssProps = spacingProperties[prop];
780
+ const formatted = typeof value === "number" ? theme.spacing(value) : value;
781
+ const result = {};
782
+ for (const cssProp of cssProps) {
783
+ result[cssProp] = formatted;
784
+ }
785
+ return result;
786
+ }
787
+ if (prop === "bgcolor") {
788
+ return { backgroundColor: resolveColor(theme, value) };
789
+ }
790
+ if (prop === "color" || prop === "backgroundColor" || prop === "borderColor" || prop === "outlineColor") {
791
+ return { [prop]: resolveColor(theme, value) };
792
+ }
793
+ if (prop === "elevation") {
794
+ if (typeof value === "number" && theme.shadows[value]) {
795
+ return { boxShadow: theme.shadows[value] };
796
+ }
797
+ return {};
798
+ }
799
+ if (prop === "boxShadow") {
800
+ if (typeof value === "number" && theme.shadows[value]) {
801
+ return { boxShadow: theme.shadows[value] };
802
+ }
803
+ return { boxShadow: value };
804
+ }
805
+ if (prop === "borderRadius") {
806
+ if (typeof value === "number") {
807
+ const radius = theme.shape?.borderRadius ?? 4;
808
+ return { borderRadius: `${value * radius}px` };
809
+ }
810
+ return { borderRadius: value };
811
+ }
812
+ if (prop === "zIndex") {
813
+ return { zIndex: resolveZIndex(theme, value) };
814
+ }
815
+ return { [prop]: value };
816
+ }
817
+ function isObject2(val) {
818
+ return val !== null && typeof val === "object" && !Array.isArray(val);
819
+ }
820
+ function isResponsiveValue(val) {
821
+ if (Array.isArray(val)) return true;
822
+ if (isObject2(val)) {
823
+ return Object.keys(val).some((k) => breakpointKeys.includes(k));
824
+ }
825
+ return false;
826
+ }
827
+ function parseSxObject(theme, sxObject) {
828
+ const result = {};
829
+ for (const [key, value] of Object.entries(sxObject)) {
830
+ if (value === void 0 || value === null) continue;
831
+ if (key.startsWith("&") || key.startsWith("@") || key.startsWith(".")) {
832
+ if (typeof value === "function") {
833
+ result[key] = parseSxObject(theme, value(theme));
834
+ } else if (isObject2(value)) {
835
+ result[key] = parseSxObject(theme, value);
836
+ }
837
+ continue;
838
+ }
839
+ if (Array.isArray(value)) {
840
+ value.forEach((bpVal, index) => {
841
+ if (bpVal === void 0 || bpVal === null) return;
842
+ const bpKey = breakpointKeys[index];
843
+ if (!bpKey) return;
844
+ const resolved2 = resolveSingleProperty(theme, key, bpVal);
845
+ if (bpKey === "xs") {
846
+ Object.assign(result, resolved2);
847
+ } else {
848
+ const media = theme.breakpoints.up(bpKey);
849
+ result[media] = {
850
+ ...result[media] || {},
851
+ ...resolved2
852
+ };
853
+ }
854
+ });
855
+ continue;
856
+ }
857
+ if (isResponsiveValue(value)) {
858
+ const respObj = value;
859
+ for (const [bpKey, bpVal] of Object.entries(respObj)) {
860
+ if (bpVal === void 0 || bpVal === null) continue;
861
+ const resolved2 = resolveSingleProperty(theme, key, bpVal);
862
+ if (bpKey === "xs") {
863
+ Object.assign(result, resolved2);
864
+ } else if (breakpointKeys.includes(bpKey)) {
865
+ const media = theme.breakpoints.up(bpKey);
866
+ result[media] = {
867
+ ...result[media] || {},
868
+ ...resolved2
869
+ };
870
+ }
871
+ }
872
+ continue;
873
+ }
874
+ if (isObject2(value)) {
875
+ result[key] = parseSxObject(theme, value);
876
+ continue;
877
+ }
878
+ const resolved = resolveSingleProperty(theme, key, value);
879
+ Object.assign(result, resolved);
880
+ }
881
+ return result;
882
+ }
883
+ function parseSx(themeInput, sx) {
884
+ if (!sx) return {};
885
+ const theme = themeInput && typeof themeInput.spacing === "function" ? themeInput : defaultTheme;
886
+ if (typeof sx === "function") {
887
+ return parseSxObject(theme, sx(theme));
888
+ }
889
+ if (Array.isArray(sx)) {
890
+ return sx.reduce((acc, item) => {
891
+ if (!item) return acc;
892
+ const parsed = parseSx(theme, item);
893
+ return deepMergeStyles(acc, parsed);
894
+ }, {});
895
+ }
896
+ if (isObject2(sx)) {
897
+ return parseSxObject(theme, sx);
898
+ }
899
+ return {};
900
+ }
901
+ function deepMergeStyles(target, source) {
902
+ const result = { ...target };
903
+ for (const [key, value] of Object.entries(source)) {
904
+ if (isObject2(value) && isObject2(result[key]) && !Array.isArray(value) && !Array.isArray(result[key])) {
905
+ result[key] = deepMergeStyles(result[key], value);
906
+ } else {
907
+ result[key] = value;
908
+ }
909
+ }
910
+ return result;
911
+ }
912
+
913
+ // src/system/componentOverrides.ts
914
+ function resolveComponentOverrides(theme, options, props) {
915
+ const { name, slot = "root", overridesResolver } = options;
916
+ if (!name || !theme.components?.[name]) {
917
+ return void 0;
918
+ }
919
+ const componentConfig = theme.components[name];
920
+ const styleOverrides = componentConfig.styleOverrides;
921
+ if (!styleOverrides) {
922
+ return void 0;
923
+ }
924
+ if (overridesResolver) {
925
+ const resolved = overridesResolver(props, styleOverrides);
926
+ if (resolved) return resolved;
927
+ }
928
+ const slotLower = slot.toLowerCase();
929
+ const matchedKey = Object.keys(styleOverrides).find(
930
+ (k) => k.toLowerCase() === slotLower
931
+ );
932
+ if (matchedKey) {
933
+ const override = styleOverrides[matchedKey];
934
+ if (typeof override === "function") {
935
+ return override({ theme, ownerState: props.ownerState ?? props });
936
+ }
937
+ return override;
938
+ }
939
+ return void 0;
940
+ }
941
+ function styled(component, options = {}) {
942
+ const {
943
+ name,
944
+ slot = "Root",
945
+ label,
946
+ target,
947
+ shouldForwardProp: customShouldForwardProp,
948
+ skipSx = false
949
+ } = options;
950
+ const resolvedShouldForwardProp = customShouldForwardProp ? (prop) => rootShouldForwardProp(prop) && customShouldForwardProp(prop) : rootShouldForwardProp;
951
+ const resolvedLabel = label ?? (name ? `${name}-${slot}` : void 0);
952
+ const emotionOptions = {
953
+ shouldForwardProp: resolvedShouldForwardProp
954
+ };
955
+ if (resolvedLabel !== void 0) {
956
+ emotionOptions.label = resolvedLabel;
957
+ }
958
+ if (target !== void 0) {
959
+ emotionOptions.target = target;
960
+ }
961
+ const emotionCreator = emotionStyled(component, emotionOptions);
962
+ return (...interpolations) => {
963
+ const wrappedInterpolations = interpolations.map((interpolation) => {
964
+ if (typeof interpolation === "function") {
965
+ return (rawProps) => {
966
+ const activeTheme = rawProps.theme && typeof rawProps.theme.spacing === "function" ? rawProps.theme : defaultTheme;
967
+ return interpolation({
968
+ ...rawProps,
969
+ theme: activeTheme
970
+ });
971
+ };
972
+ }
973
+ return interpolation;
974
+ });
975
+ return emotionCreator(
976
+ ...wrappedInterpolations,
977
+ // 2. Global theme overrides from theme.components[name].styleOverrides[slot]
978
+ (props) => {
979
+ if (!name) return null;
980
+ const activeTheme = props.theme && typeof props.theme.spacing === "function" ? props.theme : defaultTheme;
981
+ return resolveComponentOverrides(activeTheme, options, props);
982
+ },
983
+ // 3. Local sx prop styles (highest precedence)
984
+ (props) => {
985
+ if (skipSx || !props.sx) return null;
986
+ const activeTheme = props.theme && typeof props.theme.spacing === "function" ? props.theme : defaultTheme;
987
+ return parseSx(activeTheme, props.sx);
988
+ }
989
+ );
990
+ };
991
+ }
992
+
153
993
  // src/utils/classNames.ts
154
994
  function classNames(...inputs) {
155
995
  const classes = [];
@@ -190,6 +1030,13 @@ function setRef(ref, value) {
190
1030
  ref.current = value;
191
1031
  }
192
1032
  }
1033
+ function useMergeRefs(...refs) {
1034
+ return React.useCallback((current) => {
1035
+ for (const ref of refs) {
1036
+ setRef(ref, current);
1037
+ }
1038
+ }, refs);
1039
+ }
193
1040
 
194
1041
  // src/primitives/Slot.tsx
195
1042
  var Slot = React.forwardRef(
@@ -259,6 +1106,252 @@ var ButtonGroupContext = React.createContext(void 0);
259
1106
  function useButtonGroupContext() {
260
1107
  return React.useContext(ButtonGroupContext);
261
1108
  }
1109
+ var enterKeyframe = keyframes`
1110
+ 0% {
1111
+ transform: scale(0);
1112
+ opacity: 0.1;
1113
+ }
1114
+ 100% {
1115
+ transform: scale(1);
1116
+ opacity: 0.3;
1117
+ }
1118
+ `;
1119
+ var exitKeyframe = keyframes`
1120
+ 0% {
1121
+ opacity: 0.3;
1122
+ }
1123
+ 100% {
1124
+ opacity: 0;
1125
+ }
1126
+ `;
1127
+ var pulsateKeyframe = keyframes`
1128
+ 0% {
1129
+ transform: scale(1);
1130
+ }
1131
+ 50% {
1132
+ transform: scale(0.92);
1133
+ }
1134
+ 100% {
1135
+ transform: scale(1);
1136
+ }
1137
+ `;
1138
+ var TouchRippleRoot = styled("span", {
1139
+ name: "ChellaaTouchRipple",
1140
+ slot: "Root"
1141
+ })({
1142
+ overflow: "hidden",
1143
+ pointerEvents: "none",
1144
+ position: "absolute",
1145
+ zIndex: 0,
1146
+ top: 0,
1147
+ right: 0,
1148
+ bottom: 0,
1149
+ left: 0,
1150
+ borderRadius: "inherit"
1151
+ });
1152
+ var StyledRippleSpan = styled("span", {
1153
+ shouldForwardProp: (prop) => prop !== "pulsating" && prop !== "leaving"
1154
+ })(({ pulsating, leaving }) => ({
1155
+ position: "absolute",
1156
+ borderRadius: "50%",
1157
+ backgroundColor: "currentColor",
1158
+ opacity: 0.3,
1159
+ animation: `${enterKeyframe} 550ms cubic-bezier(0.4, 0, 0.2, 1)`,
1160
+ ...pulsating && {
1161
+ animation: `${pulsateKeyframe} 2500ms ease-in-out infinite 200ms`
1162
+ },
1163
+ ...leaving && {
1164
+ opacity: 0,
1165
+ animation: `${exitKeyframe} 550ms cubic-bezier(0.4, 0, 0.2, 1) forwards`
1166
+ }
1167
+ }));
1168
+ var TouchRipple = React.forwardRef(
1169
+ function TouchRipple2(props, ref) {
1170
+ const { center: centerProp = false, className, ...rest } = props;
1171
+ const [ripples, setRipples] = React.useState([]);
1172
+ const nextKey = React.useRef(0);
1173
+ const containerRef = React.useRef(null);
1174
+ const start = React.useCallback(
1175
+ (event, options = {}) => {
1176
+ const { pulsate: pulsate2 = false, center = centerProp || pulsate2 } = options;
1177
+ const container = containerRef.current;
1178
+ if (!container) return;
1179
+ const rect = container.getBoundingClientRect();
1180
+ let rippleX;
1181
+ let rippleY;
1182
+ let rippleSize;
1183
+ if (center || !event || event.nativeEvent.clientX === void 0) {
1184
+ rippleX = Math.round(rect.width / 2);
1185
+ rippleY = Math.round(rect.height / 2);
1186
+ rippleSize = Math.max(rect.width, rect.height);
1187
+ } else {
1188
+ const clientX = event.nativeEvent.clientX ?? event.nativeEvent.touches?.[0]?.clientX;
1189
+ const clientY = event.nativeEvent.clientY ?? event.nativeEvent.touches?.[0]?.clientY;
1190
+ rippleX = Math.round(clientX - rect.left);
1191
+ rippleY = Math.round(clientY - rect.top);
1192
+ const sizeX = Math.max(Math.abs(container.clientWidth - rippleX), rippleX) * 2 + 2;
1193
+ const sizeY = Math.max(Math.abs(container.clientHeight - rippleY), rippleY) * 2 + 2;
1194
+ rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
1195
+ }
1196
+ const currentKey = nextKey.current;
1197
+ nextKey.current += 1;
1198
+ setRipples((prev) => [
1199
+ ...prev,
1200
+ {
1201
+ key: currentKey,
1202
+ rippleX,
1203
+ rippleY,
1204
+ rippleSize,
1205
+ pulsating: pulsate2,
1206
+ leaving: false
1207
+ }
1208
+ ]);
1209
+ },
1210
+ [centerProp]
1211
+ );
1212
+ const stop = React.useCallback(() => {
1213
+ setRipples((prev) => {
1214
+ if (prev.length === 0) return prev;
1215
+ return prev.map((ripple) => ({ ...ripple, leaving: true }));
1216
+ });
1217
+ setTimeout(() => {
1218
+ setRipples((prev) => prev.filter((r) => !r.leaving));
1219
+ }, 550);
1220
+ }, []);
1221
+ const pulsate = React.useCallback(() => {
1222
+ start(void 0, { pulsate: true });
1223
+ }, [start]);
1224
+ React.useImperativeHandle(
1225
+ ref,
1226
+ () => ({
1227
+ start,
1228
+ stop,
1229
+ pulsate
1230
+ }),
1231
+ [start, stop, pulsate]
1232
+ );
1233
+ return /* @__PURE__ */ jsx(
1234
+ TouchRippleRoot,
1235
+ {
1236
+ ref: containerRef,
1237
+ className,
1238
+ "aria-hidden": "true",
1239
+ ...rest,
1240
+ children: ripples.map((item) => {
1241
+ const style = {
1242
+ width: `${item.rippleSize}px`,
1243
+ height: `${item.rippleSize}px`,
1244
+ top: `${-(item.rippleSize / 2) + item.rippleY}px`,
1245
+ left: `${-(item.rippleSize / 2) + item.rippleX}px`
1246
+ };
1247
+ return /* @__PURE__ */ jsx(
1248
+ StyledRippleSpan,
1249
+ {
1250
+ pulsating: item.pulsating,
1251
+ leaving: item.leaving,
1252
+ style
1253
+ },
1254
+ item.key
1255
+ );
1256
+ })
1257
+ }
1258
+ );
1259
+ }
1260
+ );
1261
+ TouchRipple.displayName = "TouchRipple";
1262
+ function useRipple(options = {}) {
1263
+ const { disabled = false, disableRipple = false, center = false } = options;
1264
+ const rippleRef = React.useRef(null);
1265
+ const onMouseDown = React.useCallback(
1266
+ (event) => {
1267
+ if (disabled || disableRipple) return;
1268
+ rippleRef.current?.start(event);
1269
+ },
1270
+ [disabled, disableRipple]
1271
+ );
1272
+ const onMouseUp = React.useCallback(
1273
+ (event) => {
1274
+ if (disabled || disableRipple) return;
1275
+ rippleRef.current?.stop(event);
1276
+ },
1277
+ [disabled, disableRipple]
1278
+ );
1279
+ const onMouseLeave = React.useCallback(
1280
+ (event) => {
1281
+ if (disabled || disableRipple) return;
1282
+ rippleRef.current?.stop(event);
1283
+ },
1284
+ [disabled, disableRipple]
1285
+ );
1286
+ const onTouchStart = React.useCallback(
1287
+ (event) => {
1288
+ if (disabled || disableRipple) return;
1289
+ rippleRef.current?.start(event);
1290
+ },
1291
+ [disabled, disableRipple]
1292
+ );
1293
+ const onTouchEnd = React.useCallback(
1294
+ (event) => {
1295
+ if (disabled || disableRipple) return;
1296
+ rippleRef.current?.stop(event);
1297
+ },
1298
+ [disabled, disableRipple]
1299
+ );
1300
+ const onKeyDown = React.useCallback(
1301
+ (event) => {
1302
+ if (disabled || disableRipple) return;
1303
+ if (event.key === " " || event.key === "Enter") {
1304
+ rippleRef.current?.start(void 0, { pulsate: true });
1305
+ }
1306
+ },
1307
+ [disabled, disableRipple]
1308
+ );
1309
+ const onKeyUp = React.useCallback(
1310
+ (event) => {
1311
+ if (disabled || disableRipple) return;
1312
+ if (event.key === " " || event.key === "Enter") {
1313
+ rippleRef.current?.stop();
1314
+ }
1315
+ },
1316
+ [disabled, disableRipple]
1317
+ );
1318
+ const onBlur = React.useCallback(() => {
1319
+ rippleRef.current?.stop();
1320
+ }, []);
1321
+ const getRippleHandlers = React.useCallback(
1322
+ (props = {}) => {
1323
+ return {
1324
+ ...props,
1325
+ onMouseDown: composeEventHandlers(props.onMouseDown, onMouseDown),
1326
+ onMouseUp: composeEventHandlers(props.onMouseUp, onMouseUp),
1327
+ onMouseLeave: composeEventHandlers(props.onMouseLeave, onMouseLeave),
1328
+ onTouchStart: composeEventHandlers(props.onTouchStart, onTouchStart),
1329
+ onTouchEnd: composeEventHandlers(props.onTouchEnd, onTouchEnd),
1330
+ onKeyDown: composeEventHandlers(props.onKeyDown, onKeyDown),
1331
+ onKeyUp: composeEventHandlers(props.onKeyUp, onKeyUp),
1332
+ onBlur: composeEventHandlers(props.onBlur, onBlur)
1333
+ };
1334
+ },
1335
+ [
1336
+ onMouseDown,
1337
+ onMouseUp,
1338
+ onMouseLeave,
1339
+ onTouchStart,
1340
+ onTouchEnd,
1341
+ onKeyDown,
1342
+ onKeyUp,
1343
+ onBlur
1344
+ ]
1345
+ );
1346
+ return {
1347
+ rippleRef,
1348
+ rippleProps: {
1349
+ ref: rippleRef,
1350
+ center
1351
+ },
1352
+ getRippleHandlers
1353
+ };
1354
+ }
262
1355
  function ButtonSpinner() {
263
1356
  return /* @__PURE__ */ jsxs(
264
1357
  "svg",
@@ -293,6 +1386,11 @@ function ButtonSpinner() {
293
1386
  }
294
1387
  );
295
1388
  }
1389
+ var StyledButtonRoot = styled("button", {
1390
+ name: "ChellaaButton",
1391
+ slot: "Root",
1392
+ shouldForwardProp: (prop) => prop !== "variant" && prop !== "colorScheme" && prop !== "isFullWidth" && prop !== "isLoading" && prop !== "isDisabled" && prop !== "loadingText" && prop !== "loadingPosition" && prop !== "startIcon" && prop !== "endIcon" && prop !== "disableRipple" && prop !== "asChild"
1393
+ })({});
296
1394
  var Button = React.forwardRef(
297
1395
  function Button2(props, forwardedRef) {
298
1396
  const {
@@ -313,6 +1411,8 @@ var Button = React.forwardRef(
313
1411
  type = "button",
314
1412
  onClick,
315
1413
  onKeyDown,
1414
+ disableRipple = false,
1415
+ sx,
316
1416
  ...restProps
317
1417
  } = props;
318
1418
  const buttonGroup = useButtonGroupContext();
@@ -321,6 +1421,10 @@ var Button = React.forwardRef(
321
1421
  const colorScheme = colorSchemeProp ?? buttonGroup?.colorScheme ?? "primary";
322
1422
  const isDisabled = isDisabledProp ?? disabledProp ?? buttonGroup?.isDisabled ?? false;
323
1423
  const isEffectivelyDisabled = isDisabled || isLoading;
1424
+ const { rippleProps, getRippleHandlers } = useRipple({
1425
+ disabled: isEffectivelyDisabled,
1426
+ disableRipple
1427
+ });
324
1428
  const handleClick = (event) => {
325
1429
  if (isEffectivelyDisabled) {
326
1430
  event.preventDefault();
@@ -352,12 +1456,14 @@ var Button = React.forwardRef(
352
1456
  const spinner = /* @__PURE__ */ jsx(ButtonSpinner, {});
353
1457
  if (asChild) {
354
1458
  return /* @__PURE__ */ jsx(
355
- Slot,
1459
+ StyledButtonRoot,
356
1460
  {
1461
+ as: Slot,
357
1462
  ref: forwardedRef,
358
1463
  className: buttonClassName,
359
1464
  "aria-disabled": isEffectivelyDisabled ? true : void 0,
360
1465
  "aria-busy": isLoading ? true : void 0,
1466
+ sx,
361
1467
  onClick: handleClick,
362
1468
  onKeyDown: handleKeyDown,
363
1469
  ...restProps,
@@ -366,8 +1472,13 @@ var Button = React.forwardRef(
366
1472
  );
367
1473
  }
368
1474
  const isCenterLoading = isLoading && loadingPosition === "center";
369
- return /* @__PURE__ */ jsx(
370
- "button",
1475
+ const buttonHandlers = getRippleHandlers({
1476
+ onClick: handleClick,
1477
+ onKeyDown: handleKeyDown,
1478
+ ...restProps
1479
+ });
1480
+ return /* @__PURE__ */ jsxs(
1481
+ StyledButtonRoot,
371
1482
  {
372
1483
  ref: forwardedRef,
373
1484
  type,
@@ -375,13 +1486,33 @@ var Button = React.forwardRef(
375
1486
  "aria-disabled": isEffectivelyDisabled ? true : void 0,
376
1487
  "aria-busy": isLoading ? true : void 0,
377
1488
  className: buttonClassName,
378
- onClick: handleClick,
379
- onKeyDown: handleKeyDown,
380
- ...restProps,
381
- children: isCenterLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
382
- /* @__PURE__ */ jsx("span", { className: "cl-button__spinner-wrapper--center", children: spinner }),
383
- /* @__PURE__ */ jsxs("span", { className: "cl-button__content--hidden", children: [
384
- startIcon && /* @__PURE__ */ jsx(
1489
+ sx,
1490
+ ...buttonHandlers,
1491
+ children: [
1492
+ isCenterLoading ? /* @__PURE__ */ jsxs(Fragment, { children: [
1493
+ /* @__PURE__ */ jsx("span", { className: "cl-button__spinner-wrapper--center", children: spinner }),
1494
+ /* @__PURE__ */ jsxs("span", { className: "cl-button__content--hidden", children: [
1495
+ startIcon && /* @__PURE__ */ jsx(
1496
+ "span",
1497
+ {
1498
+ className: "cl-button__icon cl-button__icon--start",
1499
+ "aria-hidden": "true",
1500
+ children: startIcon
1501
+ }
1502
+ ),
1503
+ children !== void 0 && /* @__PURE__ */ jsx("span", { className: "cl-button__label", children }),
1504
+ endIcon && /* @__PURE__ */ jsx(
1505
+ "span",
1506
+ {
1507
+ className: "cl-button__icon cl-button__icon--end",
1508
+ "aria-hidden": "true",
1509
+ children: endIcon
1510
+ }
1511
+ )
1512
+ ] })
1513
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1514
+ isLoading && loadingPosition === "start" && spinner,
1515
+ !isLoading && startIcon && /* @__PURE__ */ jsx(
385
1516
  "span",
386
1517
  {
387
1518
  className: "cl-button__icon cl-button__icon--start",
@@ -389,8 +1520,9 @@ var Button = React.forwardRef(
389
1520
  children: startIcon
390
1521
  }
391
1522
  ),
392
- children !== void 0 && /* @__PURE__ */ jsx("span", { className: "cl-button__label", children }),
393
- endIcon && /* @__PURE__ */ jsx(
1523
+ isLoading && loadingText ? /* @__PURE__ */ jsx("span", { className: "cl-button__label", children: loadingText }) : children !== void 0 ? /* @__PURE__ */ jsx("span", { className: "cl-button__label", children }) : null,
1524
+ isLoading && loadingPosition === "end" && spinner,
1525
+ !isLoading && endIcon && /* @__PURE__ */ jsx(
394
1526
  "span",
395
1527
  {
396
1528
  className: "cl-button__icon cl-button__icon--end",
@@ -398,28 +1530,9 @@ var Button = React.forwardRef(
398
1530
  children: endIcon
399
1531
  }
400
1532
  )
401
- ] })
402
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
403
- isLoading && loadingPosition === "start" && spinner,
404
- !isLoading && startIcon && /* @__PURE__ */ jsx(
405
- "span",
406
- {
407
- className: "cl-button__icon cl-button__icon--start",
408
- "aria-hidden": "true",
409
- children: startIcon
410
- }
411
- ),
412
- isLoading && loadingText ? /* @__PURE__ */ jsx("span", { className: "cl-button__label", children: loadingText }) : children !== void 0 ? /* @__PURE__ */ jsx("span", { className: "cl-button__label", children }) : null,
413
- isLoading && loadingPosition === "end" && spinner,
414
- !isLoading && endIcon && /* @__PURE__ */ jsx(
415
- "span",
416
- {
417
- className: "cl-button__icon cl-button__icon--end",
418
- "aria-hidden": "true",
419
- children: endIcon
420
- }
421
- )
422
- ] })
1533
+ ] }),
1534
+ !disableRipple && !isEffectivelyDisabled && /* @__PURE__ */ jsx(TouchRipple, { ...rippleProps })
1535
+ ]
423
1536
  }
424
1537
  );
425
1538
  }
@@ -489,7 +1602,2862 @@ var ButtonGroup = React.forwardRef(
489
1602
  }
490
1603
  );
491
1604
  ButtonGroup.displayName = "ButtonGroup";
1605
+ var StyledBoxRoot = styled("div", {
1606
+ name: "ChellaaBox",
1607
+ slot: "Root",
1608
+ shouldForwardProp: (prop) => prop !== "asChild" && prop !== "component"
1609
+ })({});
1610
+ var Box = React.forwardRef(
1611
+ function Box2(props, ref) {
1612
+ const { asChild = false, component, as, className, style, sx, children, ...rest } = props;
1613
+ const targetTag = component || as;
1614
+ const boxClassName = classNames("cl-box", className);
1615
+ if (asChild) {
1616
+ return /* @__PURE__ */ jsx(
1617
+ StyledBoxRoot,
1618
+ {
1619
+ as: Slot,
1620
+ ref,
1621
+ className: boxClassName,
1622
+ style,
1623
+ sx,
1624
+ ...rest,
1625
+ children
1626
+ }
1627
+ );
1628
+ }
1629
+ if (targetTag) {
1630
+ return /* @__PURE__ */ jsx(
1631
+ StyledBoxRoot,
1632
+ {
1633
+ as: targetTag,
1634
+ ref,
1635
+ className: boxClassName,
1636
+ style,
1637
+ sx,
1638
+ ...rest,
1639
+ children
1640
+ }
1641
+ );
1642
+ }
1643
+ return /* @__PURE__ */ jsx(
1644
+ StyledBoxRoot,
1645
+ {
1646
+ ref,
1647
+ className: boxClassName,
1648
+ style,
1649
+ sx,
1650
+ ...rest,
1651
+ children
1652
+ }
1653
+ );
1654
+ }
1655
+ );
1656
+ Box.displayName = "Box";
1657
+ var StyledStackRoot = styled("div", {
1658
+ name: "ChellaaStack",
1659
+ slot: "Root",
1660
+ shouldForwardProp: (prop) => prop !== "direction" && prop !== "spacing" && prop !== "alignItems" && prop !== "justifyContent" && prop !== "flexWrap" && prop !== "useFlexGap" && prop !== "asChild" && prop !== "component"
1661
+ })(({ theme, ownerState }) => {
1662
+ const styles = {};
1663
+ if (typeof ownerState.direction === "object") {
1664
+ Object.assign(
1665
+ styles,
1666
+ parseSx(theme, { flexDirection: ownerState.direction })
1667
+ );
1668
+ }
1669
+ if (ownerState.spacing !== void 0 && ownerState.spacing !== 0) {
1670
+ Object.assign(
1671
+ styles,
1672
+ parseSx(theme, { gap: ownerState.spacing })
1673
+ );
1674
+ }
1675
+ if (ownerState.alignItems !== void 0) {
1676
+ Object.assign(
1677
+ styles,
1678
+ parseSx(theme, { alignItems: ownerState.alignItems })
1679
+ );
1680
+ }
1681
+ if (ownerState.justifyContent !== void 0) {
1682
+ Object.assign(
1683
+ styles,
1684
+ parseSx(theme, { justifyContent: ownerState.justifyContent })
1685
+ );
1686
+ }
1687
+ if (ownerState.flexWrap !== void 0) {
1688
+ Object.assign(
1689
+ styles,
1690
+ parseSx(theme, { flexWrap: ownerState.flexWrap })
1691
+ );
1692
+ }
1693
+ return styles;
1694
+ });
1695
+ var Stack = React.forwardRef(
1696
+ function Stack2(props, ref) {
1697
+ const {
1698
+ asChild = false,
1699
+ component,
1700
+ as,
1701
+ direction = "column",
1702
+ spacing = 0,
1703
+ alignItems,
1704
+ justifyContent,
1705
+ flexWrap,
1706
+ useFlexGap = true,
1707
+ divider,
1708
+ className,
1709
+ style,
1710
+ sx,
1711
+ children,
1712
+ ...rest
1713
+ } = props;
1714
+ const ownerState = {
1715
+ direction,
1716
+ spacing,
1717
+ alignItems,
1718
+ justifyContent,
1719
+ flexWrap,
1720
+ useFlexGap
1721
+ };
1722
+ const isSimpleDirection = typeof direction === "string";
1723
+ const stackClassName = classNames(
1724
+ "cl-stack",
1725
+ isSimpleDirection && `cl-stack--${direction}`,
1726
+ className
1727
+ );
1728
+ const targetTag = component || as;
1729
+ let renderedChildren = children;
1730
+ if (divider && !asChild) {
1731
+ const validChildren = React.Children.toArray(children).filter(
1732
+ React.isValidElement
1733
+ );
1734
+ renderedChildren = validChildren.reduce(
1735
+ (acc, child, index) => {
1736
+ acc.push(child);
1737
+ if (index < validChildren.length - 1) {
1738
+ acc.push(
1739
+ React.isValidElement(divider) ? React.cloneElement(divider, {
1740
+ key: `stack-divider-${index}`
1741
+ }) : /* @__PURE__ */ jsx("span", { children: divider }, `stack-divider-${index}`)
1742
+ );
1743
+ }
1744
+ return acc;
1745
+ },
1746
+ []
1747
+ );
1748
+ }
1749
+ if (asChild) {
1750
+ return /* @__PURE__ */ jsx(
1751
+ StyledStackRoot,
1752
+ {
1753
+ as: Slot,
1754
+ ref,
1755
+ className: stackClassName,
1756
+ style,
1757
+ ownerState,
1758
+ sx,
1759
+ ...rest,
1760
+ children: renderedChildren
1761
+ }
1762
+ );
1763
+ }
1764
+ if (targetTag) {
1765
+ return /* @__PURE__ */ jsx(
1766
+ StyledStackRoot,
1767
+ {
1768
+ as: targetTag,
1769
+ ref,
1770
+ className: stackClassName,
1771
+ style,
1772
+ ownerState,
1773
+ sx,
1774
+ ...rest,
1775
+ children: renderedChildren
1776
+ }
1777
+ );
1778
+ }
1779
+ return /* @__PURE__ */ jsx(
1780
+ StyledStackRoot,
1781
+ {
1782
+ ref,
1783
+ className: stackClassName,
1784
+ style,
1785
+ ownerState,
1786
+ sx,
1787
+ ...rest,
1788
+ children: renderedChildren
1789
+ }
1790
+ );
1791
+ }
1792
+ );
1793
+ Stack.displayName = "Stack";
1794
+ var StyledFlexRoot = styled("div", {
1795
+ name: "ChellaaFlex",
1796
+ slot: "Root",
1797
+ shouldForwardProp: (prop) => prop !== "direction" && prop !== "spacing" && prop !== "gap" && prop !== "alignItems" && prop !== "align" && prop !== "justifyContent" && prop !== "justify" && prop !== "flexWrap" && prop !== "wrap" && prop !== "inline" && prop !== "center" && prop !== "asChild" && prop !== "component"
1798
+ })(({ theme, ownerState }) => {
1799
+ const isCenter = ownerState.center ?? false;
1800
+ const styles = {};
1801
+ if (typeof ownerState.direction === "object") {
1802
+ Object.assign(
1803
+ styles,
1804
+ parseSx(theme, { flexDirection: ownerState.direction })
1805
+ );
1806
+ }
1807
+ const gapValue = ownerState.gap ?? ownerState.spacing;
1808
+ if (gapValue !== void 0) {
1809
+ Object.assign(styles, parseSx(theme, { gap: gapValue }));
1810
+ }
1811
+ if (!isCenter) {
1812
+ const alignVal = ownerState.align ?? ownerState.alignItems;
1813
+ if (alignVal !== void 0) {
1814
+ Object.assign(styles, parseSx(theme, { alignItems: alignVal }));
1815
+ }
1816
+ const justifyVal = ownerState.justify ?? ownerState.justifyContent;
1817
+ if (justifyVal !== void 0) {
1818
+ Object.assign(styles, parseSx(theme, { justifyContent: justifyVal }));
1819
+ }
1820
+ }
1821
+ const wrapVal = ownerState.wrap ?? ownerState.flexWrap;
1822
+ if (wrapVal !== void 0) {
1823
+ Object.assign(styles, parseSx(theme, { flexWrap: wrapVal }));
1824
+ }
1825
+ return styles;
1826
+ });
1827
+ var Flex = React.forwardRef(
1828
+ function Flex2(props, ref) {
1829
+ const {
1830
+ asChild = false,
1831
+ component,
1832
+ as,
1833
+ direction = "row",
1834
+ spacing,
1835
+ gap,
1836
+ alignItems,
1837
+ align,
1838
+ justifyContent,
1839
+ justify,
1840
+ flexWrap,
1841
+ wrap,
1842
+ inline = false,
1843
+ center = false,
1844
+ divider,
1845
+ className,
1846
+ style,
1847
+ sx,
1848
+ children,
1849
+ ...rest
1850
+ } = props;
1851
+ const ownerState = {
1852
+ direction,
1853
+ spacing,
1854
+ gap,
1855
+ alignItems,
1856
+ align,
1857
+ justifyContent,
1858
+ justify,
1859
+ flexWrap,
1860
+ wrap,
1861
+ inline,
1862
+ center
1863
+ };
1864
+ const isSimpleDirection = typeof direction === "string";
1865
+ const flexClassName = classNames(
1866
+ "cl-flex",
1867
+ inline && "cl-flex--inline",
1868
+ center && "cl-flex--center",
1869
+ isSimpleDirection && `cl-flex--${direction}`,
1870
+ className
1871
+ );
1872
+ const targetTag = component || as;
1873
+ let renderedChildren = children;
1874
+ if (divider && !asChild) {
1875
+ const validChildren = React.Children.toArray(children).filter(
1876
+ React.isValidElement
1877
+ );
1878
+ renderedChildren = validChildren.reduce(
1879
+ (acc, child, index) => {
1880
+ acc.push(child);
1881
+ if (index < validChildren.length - 1) {
1882
+ acc.push(
1883
+ React.isValidElement(divider) ? React.cloneElement(divider, {
1884
+ key: `flex-divider-${index}`
1885
+ }) : /* @__PURE__ */ jsx("span", { children: divider }, `flex-divider-${index}`)
1886
+ );
1887
+ }
1888
+ return acc;
1889
+ },
1890
+ []
1891
+ );
1892
+ }
1893
+ if (asChild) {
1894
+ return /* @__PURE__ */ jsx(
1895
+ StyledFlexRoot,
1896
+ {
1897
+ as: Slot,
1898
+ ref,
1899
+ className: flexClassName,
1900
+ style,
1901
+ ownerState,
1902
+ sx,
1903
+ ...rest,
1904
+ children: renderedChildren
1905
+ }
1906
+ );
1907
+ }
1908
+ if (targetTag) {
1909
+ return /* @__PURE__ */ jsx(
1910
+ StyledFlexRoot,
1911
+ {
1912
+ as: targetTag,
1913
+ ref,
1914
+ className: flexClassName,
1915
+ style,
1916
+ ownerState,
1917
+ sx,
1918
+ ...rest,
1919
+ children: renderedChildren
1920
+ }
1921
+ );
1922
+ }
1923
+ return /* @__PURE__ */ jsx(
1924
+ StyledFlexRoot,
1925
+ {
1926
+ ref,
1927
+ className: flexClassName,
1928
+ style,
1929
+ ownerState,
1930
+ sx,
1931
+ ...rest,
1932
+ children: renderedChildren
1933
+ }
1934
+ );
1935
+ }
1936
+ );
1937
+ Flex.displayName = "Flex";
1938
+ var StyledContainerRoot = styled("div", {
1939
+ name: "ChellaaContainer",
1940
+ slot: "Root",
1941
+ shouldForwardProp: (prop) => prop !== "maxWidth" && prop !== "fixed" && prop !== "disableGutters" && prop !== "asChild" && prop !== "component"
1942
+ })({});
1943
+ var Container = React.forwardRef(
1944
+ function Container2(props, ref) {
1945
+ const {
1946
+ asChild = false,
1947
+ component,
1948
+ as,
1949
+ maxWidth = "lg",
1950
+ fixed = false,
1951
+ disableGutters = false,
1952
+ className,
1953
+ style,
1954
+ sx,
1955
+ children,
1956
+ ...rest
1957
+ } = props;
1958
+ const containerClassName = classNames(
1959
+ "cl-container",
1960
+ disableGutters && "cl-container--disable-gutters",
1961
+ fixed && "cl-container--fixed",
1962
+ maxWidth !== false && `cl-container--${maxWidth}`,
1963
+ className
1964
+ );
1965
+ const targetTag = component || as;
1966
+ if (asChild) {
1967
+ return /* @__PURE__ */ jsx(
1968
+ StyledContainerRoot,
1969
+ {
1970
+ as: Slot,
1971
+ ref,
1972
+ className: containerClassName,
1973
+ style,
1974
+ sx,
1975
+ ...rest,
1976
+ children
1977
+ }
1978
+ );
1979
+ }
1980
+ if (targetTag) {
1981
+ return /* @__PURE__ */ jsx(
1982
+ StyledContainerRoot,
1983
+ {
1984
+ as: targetTag,
1985
+ ref,
1986
+ className: containerClassName,
1987
+ style,
1988
+ sx,
1989
+ ...rest,
1990
+ children
1991
+ }
1992
+ );
1993
+ }
1994
+ return /* @__PURE__ */ jsx(
1995
+ StyledContainerRoot,
1996
+ {
1997
+ ref,
1998
+ className: containerClassName,
1999
+ style,
2000
+ sx,
2001
+ ...rest,
2002
+ children
2003
+ }
2004
+ );
2005
+ }
2006
+ );
2007
+ Container.displayName = "Container";
2008
+ function generateGridSizeStyles(size, columns = 12) {
2009
+ if (size === true) {
2010
+ return {
2011
+ flexBasis: 0,
2012
+ flexGrow: 1,
2013
+ maxWidth: "100%"
2014
+ };
2015
+ }
2016
+ if (size === "auto") {
2017
+ return {
2018
+ flexBasis: "auto",
2019
+ flexGrow: 0,
2020
+ maxWidth: "none"
2021
+ };
2022
+ }
2023
+ if (typeof size === "number") {
2024
+ const widthPercentage = `${Math.round(size / columns * 1e8) / 1e6}%`;
2025
+ return {
2026
+ flexBasis: widthPercentage,
2027
+ flexGrow: 0,
2028
+ maxWidth: widthPercentage
2029
+ };
2030
+ }
2031
+ return {};
2032
+ }
2033
+ var StyledGridRoot = styled("div", {
2034
+ name: "ChellaaGrid",
2035
+ slot: "Root",
2036
+ shouldForwardProp: (prop) => prop !== "container" && prop !== "item" && prop !== "columns" && prop !== "spacing" && prop !== "rowSpacing" && prop !== "columnSpacing" && prop !== "direction" && prop !== "wrap" && prop !== "alignItems" && prop !== "justifyContent" && prop !== "xs" && prop !== "sm" && prop !== "md" && prop !== "lg" && prop !== "xl" && prop !== "asChild" && prop !== "component"
2037
+ })(({ theme, ownerState }) => {
2038
+ const styles = {};
2039
+ const columns = ownerState.columns ?? 12;
2040
+ if (ownerState.container) {
2041
+ if (typeof ownerState.direction === "object") {
2042
+ Object.assign(
2043
+ styles,
2044
+ parseSx(theme, { flexDirection: ownerState.direction })
2045
+ );
2046
+ }
2047
+ if (ownerState.spacing !== void 0) {
2048
+ Object.assign(styles, parseSx(theme, { gap: ownerState.spacing }));
2049
+ }
2050
+ if (ownerState.rowSpacing !== void 0) {
2051
+ Object.assign(styles, parseSx(theme, { rowGap: ownerState.rowSpacing }));
2052
+ }
2053
+ if (ownerState.columnSpacing !== void 0) {
2054
+ Object.assign(
2055
+ styles,
2056
+ parseSx(theme, { columnGap: ownerState.columnSpacing })
2057
+ );
2058
+ }
2059
+ if (ownerState.alignItems !== void 0) {
2060
+ Object.assign(
2061
+ styles,
2062
+ parseSx(theme, { alignItems: ownerState.alignItems })
2063
+ );
2064
+ }
2065
+ if (ownerState.justifyContent !== void 0) {
2066
+ Object.assign(
2067
+ styles,
2068
+ parseSx(theme, { justifyContent: ownerState.justifyContent })
2069
+ );
2070
+ }
2071
+ }
2072
+ const bpSizes = {
2073
+ xs: ownerState.xs,
2074
+ sm: ownerState.sm,
2075
+ md: ownerState.md,
2076
+ lg: ownerState.lg,
2077
+ xl: ownerState.xl
2078
+ };
2079
+ for (const bp of breakpointKeys) {
2080
+ const size = bpSizes[bp];
2081
+ if (size !== void 0) {
2082
+ const sizeStyles = generateGridSizeStyles(size, columns);
2083
+ if (bp === "xs") {
2084
+ Object.assign(styles, sizeStyles);
2085
+ } else {
2086
+ const media = theme.breakpoints.up(bp);
2087
+ styles[media] = {
2088
+ ...styles[media] || {},
2089
+ ...sizeStyles
2090
+ };
2091
+ }
2092
+ }
2093
+ }
2094
+ return styles;
2095
+ });
2096
+ var Grid = React.forwardRef(
2097
+ function Grid2(props, ref) {
2098
+ const {
2099
+ asChild = false,
2100
+ component,
2101
+ as,
2102
+ container = false,
2103
+ item = false,
2104
+ columns = 12,
2105
+ spacing,
2106
+ rowSpacing,
2107
+ columnSpacing,
2108
+ direction = "row",
2109
+ wrap = "wrap",
2110
+ alignItems,
2111
+ justifyContent,
2112
+ xs,
2113
+ sm,
2114
+ md,
2115
+ lg,
2116
+ xl,
2117
+ className,
2118
+ style,
2119
+ sx,
2120
+ children,
2121
+ ...rest
2122
+ } = props;
2123
+ const ownerState = {
2124
+ container,
2125
+ item,
2126
+ columns,
2127
+ spacing,
2128
+ rowSpacing,
2129
+ columnSpacing,
2130
+ direction,
2131
+ wrap,
2132
+ alignItems,
2133
+ justifyContent,
2134
+ xs,
2135
+ sm,
2136
+ md,
2137
+ lg,
2138
+ xl
2139
+ };
2140
+ const isSimpleDirection = typeof direction === "string";
2141
+ const gridClassName = classNames(
2142
+ "cl-grid",
2143
+ container && "cl-grid--container",
2144
+ item && "cl-grid--item",
2145
+ wrap && `cl-grid--${wrap}`,
2146
+ isSimpleDirection && `cl-grid--direction-${direction}`,
2147
+ className
2148
+ );
2149
+ const targetTag = component || as;
2150
+ if (asChild) {
2151
+ return /* @__PURE__ */ jsx(
2152
+ StyledGridRoot,
2153
+ {
2154
+ as: Slot,
2155
+ ref,
2156
+ className: gridClassName,
2157
+ style,
2158
+ ownerState,
2159
+ sx,
2160
+ ...rest,
2161
+ children
2162
+ }
2163
+ );
2164
+ }
2165
+ if (targetTag) {
2166
+ return /* @__PURE__ */ jsx(
2167
+ StyledGridRoot,
2168
+ {
2169
+ as: targetTag,
2170
+ ref,
2171
+ className: gridClassName,
2172
+ style,
2173
+ ownerState,
2174
+ sx,
2175
+ ...rest,
2176
+ children
2177
+ }
2178
+ );
2179
+ }
2180
+ return /* @__PURE__ */ jsx(
2181
+ StyledGridRoot,
2182
+ {
2183
+ ref,
2184
+ className: gridClassName,
2185
+ style,
2186
+ ownerState,
2187
+ sx,
2188
+ ...rest,
2189
+ children
2190
+ }
2191
+ );
2192
+ }
2193
+ );
2194
+ Grid.displayName = "Grid";
2195
+ var StyledDividerRoot = styled("hr", {
2196
+ name: "ChellaaDivider",
2197
+ slot: "Root",
2198
+ shouldForwardProp: (prop) => prop !== "orientation" && prop !== "variant" && prop !== "lineStyle" && prop !== "flexItem" && prop !== "light" && prop !== "textAlign" && prop !== "hasChildren" && prop !== "asChild" && prop !== "component"
2199
+ })({});
2200
+ var Divider = React.forwardRef(
2201
+ function Divider2(props, ref) {
2202
+ const {
2203
+ asChild = false,
2204
+ component,
2205
+ as,
2206
+ orientation = "horizontal",
2207
+ variant = "fullWidth",
2208
+ lineStyle = "solid",
2209
+ flexItem = false,
2210
+ light = false,
2211
+ textAlign = "center",
2212
+ className,
2213
+ style,
2214
+ sx,
2215
+ children,
2216
+ role: roleProp,
2217
+ ...rest
2218
+ } = props;
2219
+ const hasChildren = Boolean(children);
2220
+ const dividerClassName = classNames(
2221
+ "cl-divider",
2222
+ `cl-divider--${orientation}`,
2223
+ variant !== "fullWidth" && `cl-divider--${variant}`,
2224
+ lineStyle !== "solid" && `cl-divider--${lineStyle}`,
2225
+ flexItem && "cl-divider--flex-item",
2226
+ light && "cl-divider--light",
2227
+ hasChildren && "cl-divider--with-children",
2228
+ hasChildren && `cl-divider--align-${textAlign}`,
2229
+ className
2230
+ );
2231
+ let defaultTag = "hr";
2232
+ if (orientation === "vertical" || hasChildren) {
2233
+ defaultTag = "div";
2234
+ }
2235
+ const targetTag = component || as || defaultTag;
2236
+ const isNativeHr = targetTag === "hr";
2237
+ const role = roleProp || (isNativeHr ? void 0 : "separator");
2238
+ const ariaOrientation = isNativeHr ? void 0 : orientation === "vertical" ? "vertical" : void 0;
2239
+ if (asChild) {
2240
+ return /* @__PURE__ */ jsx(
2241
+ StyledDividerRoot,
2242
+ {
2243
+ as: Slot,
2244
+ ref,
2245
+ className: dividerClassName,
2246
+ style,
2247
+ sx,
2248
+ role,
2249
+ "aria-orientation": ariaOrientation,
2250
+ ...rest,
2251
+ children: hasChildren ? /* @__PURE__ */ jsx("span", { className: "cl-divider__wrapper ChellaaDivider-wrapper", children }) : children
2252
+ }
2253
+ );
2254
+ }
2255
+ return /* @__PURE__ */ jsx(
2256
+ StyledDividerRoot,
2257
+ {
2258
+ as: targetTag,
2259
+ ref,
2260
+ className: dividerClassName,
2261
+ style,
2262
+ sx,
2263
+ role,
2264
+ "aria-orientation": ariaOrientation,
2265
+ ...rest,
2266
+ children: hasChildren ? /* @__PURE__ */ jsx("span", { className: "cl-divider__wrapper ChellaaDivider-wrapper", children }) : null
2267
+ }
2268
+ );
2269
+ }
2270
+ );
2271
+ Divider.displayName = "Divider";
2272
+ var defaultVariantMapping = {
2273
+ h1: "h1",
2274
+ h2: "h2",
2275
+ h3: "h3",
2276
+ h4: "h4",
2277
+ h5: "h5",
2278
+ h6: "h6",
2279
+ subtitle1: "h6",
2280
+ subtitle2: "h6",
2281
+ body1: "p",
2282
+ body2: "p",
2283
+ button: "span",
2284
+ caption: "span",
2285
+ overline: "span"
2286
+ };
2287
+ function resolveTypographyColor(theme, color) {
2288
+ if (!color || color === "inherit" || color === "currentColor") {
2289
+ return color;
2290
+ }
2291
+ const paletteAny = theme.palette;
2292
+ if (paletteAny[color] && typeof paletteAny[color].main === "string") {
2293
+ return paletteAny[color].main;
2294
+ }
2295
+ if (color.includes(".")) {
2296
+ const parts = color.split(".");
2297
+ let current = theme.palette;
2298
+ for (const part of parts) {
2299
+ if (current && typeof current === "object" && part in current) {
2300
+ current = current[part];
2301
+ } else {
2302
+ current = void 0;
2303
+ break;
2304
+ }
2305
+ }
2306
+ if (typeof current === "string") {
2307
+ return current;
2308
+ }
2309
+ }
2310
+ return color;
2311
+ }
2312
+ var StyledTypographyRoot = styled("span", {
2313
+ name: "ChellaaTypography",
2314
+ slot: "Root",
2315
+ shouldForwardProp: (prop) => prop !== "variant" && prop !== "align" && prop !== "color" && prop !== "gutterBottom" && prop !== "noWrap" && prop !== "lineClamp" && prop !== "asChild" && prop !== "component"
2316
+ })(({ theme, color }) => {
2317
+ if (color) {
2318
+ return {
2319
+ color: resolveTypographyColor(theme, color)
2320
+ };
2321
+ }
2322
+ return {};
2323
+ });
2324
+ var Typography = React.forwardRef(
2325
+ function Typography2(props, ref) {
2326
+ const {
2327
+ asChild = false,
2328
+ component,
2329
+ as,
2330
+ variant = "body1",
2331
+ align = "inherit",
2332
+ color,
2333
+ gutterBottom = false,
2334
+ noWrap = false,
2335
+ lineClamp,
2336
+ className,
2337
+ style,
2338
+ sx,
2339
+ children,
2340
+ ...rest
2341
+ } = props;
2342
+ const typographyClassName = classNames(
2343
+ "cl-typography",
2344
+ `cl-typography--${variant}`,
2345
+ align && align !== "inherit" && `cl-typography--align-${align}`,
2346
+ gutterBottom && "cl-typography--gutter-bottom",
2347
+ noWrap && "cl-typography--no-wrap",
2348
+ lineClamp !== void 0 && lineClamp > 0 && "cl-typography--line-clamp",
2349
+ className
2350
+ );
2351
+ const inlineStyle = {
2352
+ ...lineClamp !== void 0 && lineClamp > 0 ? { WebkitLineClamp: lineClamp } : {},
2353
+ ...style
2354
+ };
2355
+ const targetTag = component || as || defaultVariantMapping[variant] || "span";
2356
+ if (asChild) {
2357
+ return /* @__PURE__ */ jsx(
2358
+ StyledTypographyRoot,
2359
+ {
2360
+ as: Slot,
2361
+ ref,
2362
+ className: typographyClassName,
2363
+ style: inlineStyle,
2364
+ color,
2365
+ sx,
2366
+ ...rest,
2367
+ children
2368
+ }
2369
+ );
2370
+ }
2371
+ return /* @__PURE__ */ jsx(
2372
+ StyledTypographyRoot,
2373
+ {
2374
+ as: targetTag,
2375
+ ref,
2376
+ className: typographyClassName,
2377
+ style: inlineStyle,
2378
+ color,
2379
+ sx,
2380
+ ...rest,
2381
+ children
2382
+ }
2383
+ );
2384
+ }
2385
+ );
2386
+ Typography.displayName = "Typography";
2387
+ var Heading = React.forwardRef(
2388
+ function Heading2(props, ref) {
2389
+ const { level = 2, variant, component, ...rest } = props;
2390
+ const levelTag = `h${level}`;
2391
+ const resolvedVariant = variant || levelTag;
2392
+ const resolvedComponent = component || levelTag;
2393
+ return /* @__PURE__ */ jsx(
2394
+ Typography,
2395
+ {
2396
+ ref,
2397
+ component: resolvedComponent,
2398
+ variant: resolvedVariant,
2399
+ ...rest
2400
+ }
2401
+ );
2402
+ }
2403
+ );
2404
+ Heading.displayName = "Heading";
2405
+ var sizeToVariant = {
2406
+ xs: "caption",
2407
+ sm: "body2",
2408
+ md: "body1",
2409
+ lg: "subtitle1",
2410
+ xl: "h6"
2411
+ };
2412
+ var Text = React.forwardRef(
2413
+ function Text2(props, ref) {
2414
+ const { size, variant, block = false, component, ...rest } = props;
2415
+ const resolvedVariant = variant || (size ? sizeToVariant[size] : "body1");
2416
+ const defaultTag = block ? "p" : "span";
2417
+ const resolvedComponent = component || defaultTag;
2418
+ return /* @__PURE__ */ jsx(
2419
+ Typography,
2420
+ {
2421
+ ref,
2422
+ component: resolvedComponent,
2423
+ variant: resolvedVariant,
2424
+ ...rest
2425
+ }
2426
+ );
2427
+ }
2428
+ );
2429
+ Text.displayName = "Text";
2430
+ var Paragraph = React.forwardRef(
2431
+ function Paragraph2(props, ref) {
2432
+ const { component = "p", variant = "body1", gutterBottom = true, ...rest } = props;
2433
+ return /* @__PURE__ */ jsx(
2434
+ Typography,
2435
+ {
2436
+ ref,
2437
+ component,
2438
+ variant,
2439
+ gutterBottom,
2440
+ ...rest
2441
+ }
2442
+ );
2443
+ }
2444
+ );
2445
+ Paragraph.displayName = "Paragraph";
2446
+ var StyledCodeRoot = styled("code", {
2447
+ name: "ChellaaCode",
2448
+ slot: "Root",
2449
+ shouldForwardProp: (prop) => prop !== "colorScheme" && prop !== "asChild" && prop !== "component"
2450
+ })({});
2451
+ var Code = React.forwardRef(
2452
+ function Code2(props, ref) {
2453
+ const {
2454
+ asChild = false,
2455
+ component = "code",
2456
+ as,
2457
+ colorScheme = "default",
2458
+ className,
2459
+ style,
2460
+ sx,
2461
+ children,
2462
+ ...rest
2463
+ } = props;
2464
+ const codeClassName = classNames(
2465
+ "cl-code",
2466
+ colorScheme !== "default" && `cl-code--${colorScheme}`,
2467
+ className
2468
+ );
2469
+ const targetTag = component || as || "code";
2470
+ if (asChild) {
2471
+ return /* @__PURE__ */ jsx(
2472
+ StyledCodeRoot,
2473
+ {
2474
+ as: Slot,
2475
+ ref,
2476
+ className: codeClassName,
2477
+ style,
2478
+ sx,
2479
+ ...rest,
2480
+ children
2481
+ }
2482
+ );
2483
+ }
2484
+ return /* @__PURE__ */ jsx(
2485
+ StyledCodeRoot,
2486
+ {
2487
+ as: targetTag,
2488
+ ref,
2489
+ className: codeClassName,
2490
+ style,
2491
+ sx,
2492
+ ...rest,
2493
+ children
2494
+ }
2495
+ );
2496
+ }
2497
+ );
2498
+ Code.displayName = "Code";
2499
+ var MODIFIER_SYMBOLS = {
2500
+ command: "\u2318",
2501
+ cmd: "\u2318",
2502
+ shift: "\u21E7",
2503
+ option: "\u2325",
2504
+ alt: "\u2325",
2505
+ control: "\u2303",
2506
+ ctrl: "\u2303",
2507
+ enter: "\u21B5",
2508
+ escape: "Esc",
2509
+ esc: "Esc",
2510
+ tab: "\u21E5",
2511
+ backspace: "\u232B",
2512
+ delete: "\u2326",
2513
+ del: "\u2326",
2514
+ up: "\u2191",
2515
+ down: "\u2193",
2516
+ left: "\u2190",
2517
+ right: "\u2192"
2518
+ };
2519
+ var StyledKbdRoot = styled("kbd", {
2520
+ name: "ChellaaKbd",
2521
+ slot: "Root",
2522
+ shouldForwardProp: (prop) => prop !== "size" && prop !== "variant" && prop !== "modifier" && prop !== "asChild" && prop !== "component"
2523
+ })({});
2524
+ var Kbd = React.forwardRef(
2525
+ function Kbd2(props, ref) {
2526
+ const {
2527
+ asChild = false,
2528
+ component = "kbd",
2529
+ as,
2530
+ size = "md",
2531
+ variant = "outline",
2532
+ modifier,
2533
+ className,
2534
+ style,
2535
+ sx,
2536
+ children,
2537
+ ...rest
2538
+ } = props;
2539
+ const kbdClassName = classNames(
2540
+ "cl-kbd",
2541
+ `cl-kbd--${size}`,
2542
+ `cl-kbd--${variant}`,
2543
+ className
2544
+ );
2545
+ const targetTag = component || as || "kbd";
2546
+ const content = children ?? (modifier ? MODIFIER_SYMBOLS[modifier] ?? modifier : null);
2547
+ if (asChild) {
2548
+ return /* @__PURE__ */ jsx(
2549
+ StyledKbdRoot,
2550
+ {
2551
+ as: Slot,
2552
+ ref,
2553
+ className: kbdClassName,
2554
+ style,
2555
+ sx,
2556
+ ...rest,
2557
+ children: content
2558
+ }
2559
+ );
2560
+ }
2561
+ return /* @__PURE__ */ jsx(
2562
+ StyledKbdRoot,
2563
+ {
2564
+ as: targetTag,
2565
+ ref,
2566
+ className: kbdClassName,
2567
+ style,
2568
+ sx,
2569
+ ...rest,
2570
+ children: content
2571
+ }
2572
+ );
2573
+ }
2574
+ );
2575
+ Kbd.displayName = "Kbd";
2576
+ var FormFieldContext = React.createContext(void 0);
2577
+ function useFormField() {
2578
+ return React.useContext(FormFieldContext);
2579
+ }
2580
+ var InputBase = React.forwardRef(function InputBase2({ className, ownerState: _ownerState, ...props }, ref) {
2581
+ return /* @__PURE__ */ jsx(
2582
+ "input",
2583
+ {
2584
+ ref,
2585
+ className: classNames("cl-input__input", className),
2586
+ ...props
2587
+ }
2588
+ );
2589
+ });
2590
+ InputBase.displayName = "InputBase";
2591
+ var StyledInputRoot = styled("div", {
2592
+ name: "ChellaaInput",
2593
+ slot: "Root",
2594
+ shouldForwardProp: (prop) => prop !== "variant" && prop !== "size" && prop !== "fullWidth" && prop !== "error" && prop !== "disabled" && prop !== "readOnly" && prop !== "hasStartAdornment" && prop !== "hasEndAdornment" && prop !== "focused" && prop !== "asChild" && prop !== "component" && prop !== "ownerState"
2595
+ })({});
2596
+ var Input = React.forwardRef(
2597
+ function Input2(props, ref) {
2598
+ const formField = useFormField();
2599
+ const {
2600
+ asChild = false,
2601
+ component,
2602
+ as,
2603
+ variant = "outlined",
2604
+ size = "md",
2605
+ fullWidth = false,
2606
+ error: errorProp,
2607
+ disabled: disabledProp,
2608
+ readOnly: readOnlyProp,
2609
+ required: requiredProp,
2610
+ startAdornment,
2611
+ endAdornment,
2612
+ clearable = false,
2613
+ onClear,
2614
+ inputRef: inputRefProp,
2615
+ value: valueProp,
2616
+ defaultValue,
2617
+ onChange,
2618
+ type = "text",
2619
+ id: idProp,
2620
+ className,
2621
+ style,
2622
+ sx,
2623
+ inputProps,
2624
+ "aria-describedby": ariaDescribedByProp,
2625
+ ...restInputProps
2626
+ } = props;
2627
+ const id = idProp ?? formField?.id;
2628
+ const error = errorProp ?? formField?.error ?? false;
2629
+ const disabled = disabledProp ?? formField?.disabled ?? false;
2630
+ const readOnly = readOnlyProp ?? formField?.readOnly ?? false;
2631
+ const required = requiredProp ?? formField?.required ?? false;
2632
+ const ariaDescribedBy = [
2633
+ ariaDescribedByProp,
2634
+ formField?.error && formField?.hasErrorMessage ? formField.errorMessageId : null,
2635
+ formField?.hasHelperText ? formField.helperTextId : null
2636
+ ].filter(Boolean).join(" ") || void 0;
2637
+ const [internalValue, setInternalValue] = React.useState(() => {
2638
+ if (valueProp !== void 0) return String(valueProp);
2639
+ if (defaultValue !== void 0) return String(defaultValue);
2640
+ return "";
2641
+ });
2642
+ const isControlled = valueProp !== void 0;
2643
+ const currentValue = isControlled ? String(valueProp ?? "") : internalValue;
2644
+ const innerInputRef = React.useRef(null);
2645
+ const handleInputRef = React.useCallback(
2646
+ (node) => {
2647
+ innerInputRef.current = node;
2648
+ if (typeof inputRefProp === "function") {
2649
+ inputRefProp(node);
2650
+ } else if (inputRefProp && "current" in inputRefProp) {
2651
+ inputRefProp.current = node;
2652
+ }
2653
+ },
2654
+ [inputRefProp]
2655
+ );
2656
+ const handleChange = (event) => {
2657
+ if (!isControlled) {
2658
+ setInternalValue(event.target.value);
2659
+ }
2660
+ onChange?.(event);
2661
+ };
2662
+ const handleClear = (e) => {
2663
+ e.stopPropagation();
2664
+ if (!isControlled) {
2665
+ setInternalValue("");
2666
+ }
2667
+ if (innerInputRef.current) {
2668
+ innerInputRef.current.value = "";
2669
+ const event = new Event("input", { bubbles: true });
2670
+ innerInputRef.current.dispatchEvent(event);
2671
+ innerInputRef.current.focus();
2672
+ }
2673
+ onClear?.();
2674
+ };
2675
+ const handleWrapperClick = () => {
2676
+ if (innerInputRef.current && document.activeElement !== innerInputRef.current) {
2677
+ innerInputRef.current.focus();
2678
+ }
2679
+ };
2680
+ const showClear = clearable && !disabled && !readOnly && currentValue.length > 0;
2681
+ const clearButton = showClear ? /* @__PURE__ */ jsx(
2682
+ "button",
2683
+ {
2684
+ type: "button",
2685
+ className: "cl-input__clear",
2686
+ "aria-label": "Clear input",
2687
+ onClick: handleClear,
2688
+ children: /* @__PURE__ */ jsxs(
2689
+ "svg",
2690
+ {
2691
+ width: "14",
2692
+ height: "14",
2693
+ viewBox: "0 0 24 24",
2694
+ fill: "none",
2695
+ stroke: "currentColor",
2696
+ strokeWidth: "2.5",
2697
+ strokeLinecap: "round",
2698
+ strokeLinejoin: "round",
2699
+ children: [
2700
+ /* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
2701
+ /* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
2702
+ ]
2703
+ }
2704
+ )
2705
+ }
2706
+ ) : null;
2707
+ const inputWrapperClassName = classNames(
2708
+ "cl-input",
2709
+ `cl-input--${variant}`,
2710
+ `cl-input--${size}`,
2711
+ fullWidth && "cl-input--full-width",
2712
+ error && "cl-input--error",
2713
+ disabled && "cl-input--disabled",
2714
+ className
2715
+ );
2716
+ const targetTag = component || as;
2717
+ if (asChild) {
2718
+ return /* @__PURE__ */ jsxs(
2719
+ StyledInputRoot,
2720
+ {
2721
+ as: Slot,
2722
+ ref,
2723
+ className: inputWrapperClassName,
2724
+ style,
2725
+ sx,
2726
+ onClick: handleWrapperClick,
2727
+ children: [
2728
+ startAdornment,
2729
+ /* @__PURE__ */ jsx(
2730
+ "input",
2731
+ {
2732
+ ref: handleInputRef,
2733
+ id,
2734
+ type,
2735
+ disabled,
2736
+ readOnly,
2737
+ required,
2738
+ "aria-describedby": ariaDescribedBy,
2739
+ value: valueProp,
2740
+ defaultValue,
2741
+ onChange: handleChange,
2742
+ "aria-invalid": error ? true : void 0,
2743
+ className: "cl-input__input",
2744
+ ...inputProps,
2745
+ ...restInputProps
2746
+ }
2747
+ ),
2748
+ clearButton,
2749
+ endAdornment
2750
+ ]
2751
+ }
2752
+ );
2753
+ }
2754
+ return /* @__PURE__ */ jsxs(
2755
+ StyledInputRoot,
2756
+ {
2757
+ as: targetTag,
2758
+ ref,
2759
+ className: inputWrapperClassName,
2760
+ style,
2761
+ sx,
2762
+ onClick: handleWrapperClick,
2763
+ children: [
2764
+ startAdornment,
2765
+ /* @__PURE__ */ jsx(
2766
+ "input",
2767
+ {
2768
+ ref: handleInputRef,
2769
+ id,
2770
+ type,
2771
+ disabled,
2772
+ readOnly,
2773
+ required,
2774
+ "aria-describedby": ariaDescribedBy,
2775
+ value: valueProp,
2776
+ defaultValue,
2777
+ onChange: handleChange,
2778
+ "aria-invalid": error ? true : void 0,
2779
+ className: "cl-input__input",
2780
+ ...inputProps,
2781
+ ...restInputProps
2782
+ }
2783
+ ),
2784
+ clearButton,
2785
+ endAdornment
2786
+ ]
2787
+ }
2788
+ );
2789
+ }
2790
+ );
2791
+ Input.displayName = "Input";
2792
+ var StyledTextFieldRoot = styled("div", {
2793
+ name: "ChellaaTextField",
2794
+ slot: "Root",
2795
+ shouldForwardProp: (prop) => prop !== "fullWidth"
2796
+ })(({ fullWidth }) => ({
2797
+ display: "inline-flex",
2798
+ flexDirection: "column",
2799
+ position: "relative",
2800
+ width: fullWidth ? "100%" : "auto",
2801
+ verticalAlign: "top"
2802
+ }));
2803
+ var StyledLabel = styled("label")(
2804
+ ({ theme, error }) => ({
2805
+ display: "block",
2806
+ fontSize: "0.875rem",
2807
+ fontWeight: 500,
2808
+ lineHeight: 1.4,
2809
+ marginBottom: theme.spacing(0.75),
2810
+ color: error ? theme.palette.error.main : theme.palette.text.primary,
2811
+ userSelect: "none",
2812
+ "& .ChellaaTextField-requiredAsterisk": {
2813
+ color: theme.palette.error.main,
2814
+ marginLeft: 4
2815
+ }
2816
+ })
2817
+ );
2818
+ var StyledHelperText = styled("p")(
2819
+ ({ theme, error }) => ({
2820
+ fontSize: "0.75rem",
2821
+ lineHeight: 1.4,
2822
+ margin: 0,
2823
+ marginTop: theme.spacing(0.5),
2824
+ color: error ? theme.palette.error.main : theme.palette.text.secondary
2825
+ })
2826
+ );
2827
+ var TextField = React.forwardRef(
2828
+ function TextField2(props, ref) {
2829
+ const {
2830
+ id: idProp,
2831
+ label,
2832
+ helperText,
2833
+ errorMessage,
2834
+ error = false,
2835
+ required = false,
2836
+ fullWidth = false,
2837
+ className,
2838
+ style,
2839
+ sx,
2840
+ ...inputProps
2841
+ } = props;
2842
+ const generatedId = React.useId();
2843
+ const inputId = idProp || generatedId;
2844
+ const helperId = `${inputId}-helper`;
2845
+ const activeHelperContent = error && errorMessage ? errorMessage : helperText;
2846
+ return /* @__PURE__ */ jsxs(
2847
+ StyledTextFieldRoot,
2848
+ {
2849
+ ref,
2850
+ fullWidth,
2851
+ className,
2852
+ style,
2853
+ sx,
2854
+ children: [
2855
+ label && /* @__PURE__ */ jsxs(StyledLabel, { htmlFor: inputId, error, required, children: [
2856
+ label,
2857
+ required && /* @__PURE__ */ jsx("span", { className: "ChellaaTextField-requiredAsterisk", children: "*" })
2858
+ ] }),
2859
+ /* @__PURE__ */ jsx(
2860
+ Input,
2861
+ {
2862
+ id: inputId,
2863
+ error,
2864
+ required,
2865
+ fullWidth,
2866
+ "aria-describedby": activeHelperContent ? helperId : void 0,
2867
+ ...inputProps
2868
+ }
2869
+ ),
2870
+ activeHelperContent && /* @__PURE__ */ jsx(StyledHelperText, { id: helperId, error, children: activeHelperContent })
2871
+ ]
2872
+ }
2873
+ );
2874
+ }
2875
+ );
2876
+ TextField.displayName = "TextField";
2877
+ var StyledAdornmentRoot = styled("div", {
2878
+ name: "ChellaaInputAdornment",
2879
+ slot: "Root",
2880
+ shouldForwardProp: (prop) => prop !== "position" && prop !== "disablePointerEvents"
2881
+ })(
2882
+ ({ theme, position, disablePointerEvents }) => ({
2883
+ display: "flex",
2884
+ height: "100%",
2885
+ maxHeight: "2em",
2886
+ alignItems: "center",
2887
+ justifyContent: "center",
2888
+ whiteSpace: "nowrap",
2889
+ color: theme.palette.text.secondary,
2890
+ marginLeft: position === "end" ? theme.spacing(1) : 0,
2891
+ marginRight: position === "start" ? theme.spacing(1) : 0,
2892
+ pointerEvents: disablePointerEvents ? "none" : "auto",
2893
+ userSelect: "none"
2894
+ })
2895
+ );
2896
+ var InputAdornment = React.forwardRef(function InputAdornment2(props, ref) {
2897
+ const { position, disablePointerEvents = false, children, ...rest } = props;
2898
+ return /* @__PURE__ */ jsx(
2899
+ StyledAdornmentRoot,
2900
+ {
2901
+ ref,
2902
+ position,
2903
+ disablePointerEvents,
2904
+ ...rest,
2905
+ children
2906
+ }
2907
+ );
2908
+ });
2909
+ InputAdornment.displayName = "InputAdornment";
2910
+ var StyledTextareaContainer = styled("div", {
2911
+ name: "ChellaaTextarea",
2912
+ slot: "Root",
2913
+ shouldForwardProp: (prop) => prop !== "variant" && prop !== "size" && prop !== "fullWidth" && prop !== "error" && prop !== "disabled" && prop !== "readOnly" && prop !== "autoResize" && prop !== "resize" && prop !== "hasCount" && prop !== "asChild" && prop !== "component" && prop !== "ownerState"
2914
+ })({});
2915
+ var Textarea = React.forwardRef(
2916
+ function Textarea2(props, ref) {
2917
+ const formField = useFormField();
2918
+ const {
2919
+ asChild = false,
2920
+ component,
2921
+ as,
2922
+ variant = "outlined",
2923
+ size = "md",
2924
+ fullWidth = false,
2925
+ error: errorProp,
2926
+ disabled: disabledProp,
2927
+ readOnly: readOnlyProp,
2928
+ required: requiredProp,
2929
+ minRows = 3,
2930
+ maxRows,
2931
+ autoResize = false,
2932
+ resize = "vertical",
2933
+ showCount = false,
2934
+ maxLength,
2935
+ textareaRef: textareaRefProp,
2936
+ textareaProps = {},
2937
+ value: valueProp,
2938
+ defaultValue,
2939
+ onChange,
2940
+ id: idProp,
2941
+ className,
2942
+ style,
2943
+ sx,
2944
+ placeholder,
2945
+ name,
2946
+ rows,
2947
+ cols,
2948
+ autoFocus,
2949
+ onFocus,
2950
+ onBlur,
2951
+ onKeyDown,
2952
+ onKeyUp,
2953
+ "aria-describedby": ariaDescribedByProp,
2954
+ ...restContainerProps
2955
+ } = props;
2956
+ const id = idProp ?? formField?.id;
2957
+ const error = errorProp ?? formField?.error ?? false;
2958
+ const disabled = disabledProp ?? formField?.disabled ?? false;
2959
+ const readOnly = readOnlyProp ?? formField?.readOnly ?? false;
2960
+ const required = requiredProp ?? formField?.required ?? false;
2961
+ const ariaDescribedBy = [
2962
+ ariaDescribedByProp,
2963
+ formField?.error && formField?.hasErrorMessage ? formField.errorMessageId : null,
2964
+ formField?.hasHelperText ? formField.helperTextId : null
2965
+ ].filter(Boolean).join(" ") || void 0;
2966
+ const [internalValue, setInternalValue] = React.useState(() => {
2967
+ if (valueProp !== void 0) return String(valueProp);
2968
+ if (defaultValue !== void 0) return String(defaultValue);
2969
+ return "";
2970
+ });
2971
+ const isControlled = valueProp !== void 0;
2972
+ const currentValue = isControlled ? String(valueProp ?? "") : internalValue;
2973
+ const innerTextareaRef = React.useRef(null);
2974
+ const handleTextareaRef = React.useCallback(
2975
+ (node) => {
2976
+ innerTextareaRef.current = node;
2977
+ if (typeof textareaRefProp === "function") {
2978
+ textareaRefProp(node);
2979
+ } else if (textareaRefProp && "current" in textareaRefProp) {
2980
+ textareaRefProp.current = node;
2981
+ }
2982
+ },
2983
+ [textareaRefProp]
2984
+ );
2985
+ React.useLayoutEffect(() => {
2986
+ if (!autoResize || !innerTextareaRef.current) return;
2987
+ const textarea = innerTextareaRef.current;
2988
+ textarea.style.height = "auto";
2989
+ const lineHeight = parseFloat(getComputedStyle(textarea).lineHeight) || 20;
2990
+ const minHeight = minRows * lineHeight;
2991
+ const maxHeight = maxRows ? maxRows * lineHeight : Infinity;
2992
+ const calculatedHeight = Math.min(
2993
+ Math.max(textarea.scrollHeight, minHeight),
2994
+ maxHeight
2995
+ );
2996
+ textarea.style.height = `${calculatedHeight}px`;
2997
+ textarea.style.overflowY = maxRows && textarea.scrollHeight > maxHeight ? "auto" : "hidden";
2998
+ }, [currentValue, autoResize, minRows, maxRows]);
2999
+ const handleChange = (event) => {
3000
+ if (!isControlled) {
3001
+ setInternalValue(event.target.value);
3002
+ }
3003
+ onChange?.(event);
3004
+ };
3005
+ const handleWrapperClick = () => {
3006
+ if (innerTextareaRef.current && document.activeElement !== innerTextareaRef.current) {
3007
+ innerTextareaRef.current.focus();
3008
+ }
3009
+ };
3010
+ const containerClassName = classNames(
3011
+ "cl-textarea",
3012
+ `cl-textarea--${variant}`,
3013
+ `cl-textarea--${size}`,
3014
+ fullWidth && "cl-textarea--full-width",
3015
+ error && "cl-textarea--error",
3016
+ disabled && "cl-textarea--disabled",
3017
+ className
3018
+ );
3019
+ const targetTag = component || as;
3020
+ const textareaStyle = {
3021
+ resize: autoResize ? "none" : resize
3022
+ };
3023
+ const countDisplay = showCount ? /* @__PURE__ */ jsxs("div", { className: "cl-textarea__counter", "aria-live": "polite", children: [
3024
+ currentValue.length,
3025
+ maxLength ? ` / ${maxLength}` : ""
3026
+ ] }) : null;
3027
+ if (asChild) {
3028
+ return /* @__PURE__ */ jsxs(
3029
+ StyledTextareaContainer,
3030
+ {
3031
+ as: Slot,
3032
+ ref,
3033
+ className: containerClassName,
3034
+ style,
3035
+ sx,
3036
+ onClick: handleWrapperClick,
3037
+ ...restContainerProps,
3038
+ children: [
3039
+ /* @__PURE__ */ jsx(
3040
+ "textarea",
3041
+ {
3042
+ ref: handleTextareaRef,
3043
+ id,
3044
+ name,
3045
+ placeholder,
3046
+ disabled,
3047
+ readOnly,
3048
+ required,
3049
+ "aria-describedby": ariaDescribedBy,
3050
+ "aria-invalid": error ? true : void 0,
3051
+ value: valueProp,
3052
+ defaultValue,
3053
+ onChange: handleChange,
3054
+ maxLength,
3055
+ rows: rows ?? minRows,
3056
+ cols,
3057
+ autoFocus,
3058
+ onFocus,
3059
+ onBlur,
3060
+ onKeyDown,
3061
+ onKeyUp,
3062
+ style: textareaStyle,
3063
+ className: "cl-textarea__input",
3064
+ ...textareaProps
3065
+ }
3066
+ ),
3067
+ countDisplay
3068
+ ]
3069
+ }
3070
+ );
3071
+ }
3072
+ return /* @__PURE__ */ jsxs(
3073
+ StyledTextareaContainer,
3074
+ {
3075
+ as: targetTag,
3076
+ ref,
3077
+ className: containerClassName,
3078
+ style,
3079
+ sx,
3080
+ onClick: handleWrapperClick,
3081
+ ...restContainerProps,
3082
+ children: [
3083
+ /* @__PURE__ */ jsx(
3084
+ "textarea",
3085
+ {
3086
+ ref: handleTextareaRef,
3087
+ id,
3088
+ name,
3089
+ placeholder,
3090
+ disabled,
3091
+ readOnly,
3092
+ required,
3093
+ "aria-describedby": ariaDescribedBy,
3094
+ "aria-invalid": error ? true : void 0,
3095
+ value: valueProp,
3096
+ defaultValue,
3097
+ onChange: handleChange,
3098
+ maxLength,
3099
+ rows: rows ?? minRows,
3100
+ cols,
3101
+ autoFocus,
3102
+ onFocus,
3103
+ onBlur,
3104
+ onKeyDown,
3105
+ onKeyUp,
3106
+ style: textareaStyle,
3107
+ className: "cl-textarea__input",
3108
+ ...textareaProps
3109
+ }
3110
+ ),
3111
+ countDisplay
3112
+ ]
3113
+ }
3114
+ );
3115
+ }
3116
+ );
3117
+ Textarea.displayName = "Textarea";
3118
+ var StyledFormFieldRoot = styled("div", {
3119
+ name: "ChellaaFormField",
3120
+ slot: "Root",
3121
+ shouldForwardProp: (prop) => prop !== "fullWidth" && prop !== "asChild" && prop !== "component" && prop !== "error" && prop !== "disabled" && prop !== "readOnly"
3122
+ })({});
3123
+ var FormField = React.forwardRef(
3124
+ function FormField2(props, ref) {
3125
+ const {
3126
+ id: idProp,
3127
+ name,
3128
+ required = false,
3129
+ disabled = false,
3130
+ readOnly = false,
3131
+ error = false,
3132
+ fullWidth = false,
3133
+ asChild = false,
3134
+ component,
3135
+ as,
3136
+ children,
3137
+ className,
3138
+ style,
3139
+ sx,
3140
+ ...rest
3141
+ } = props;
3142
+ const generatedId = React.useId();
3143
+ const id = idProp || generatedId;
3144
+ const labelId = `${id}-label`;
3145
+ const helperTextId = `${id}-helper`;
3146
+ const errorMessageId = `${id}-error`;
3147
+ const [hasHelperText, setHasHelperText] = React.useState(false);
3148
+ const [hasErrorMessage, setHasErrorMessage] = React.useState(false);
3149
+ const contextValue = React.useMemo(
3150
+ () => ({
3151
+ id,
3152
+ name,
3153
+ required,
3154
+ disabled,
3155
+ readOnly,
3156
+ error,
3157
+ labelId,
3158
+ helperTextId,
3159
+ errorMessageId,
3160
+ hasHelperText,
3161
+ hasErrorMessage,
3162
+ setHasHelperText,
3163
+ setHasErrorMessage
3164
+ }),
3165
+ [
3166
+ id,
3167
+ name,
3168
+ required,
3169
+ disabled,
3170
+ readOnly,
3171
+ error,
3172
+ labelId,
3173
+ helperTextId,
3174
+ errorMessageId,
3175
+ hasHelperText,
3176
+ hasErrorMessage
3177
+ ]
3178
+ );
3179
+ const fieldClassName = classNames(
3180
+ "cl-form-field",
3181
+ fullWidth && "cl-form-field--full-width",
3182
+ error && "cl-form-field--error",
3183
+ disabled && "cl-form-field--disabled",
3184
+ className
3185
+ );
3186
+ const targetTag = component || as;
3187
+ if (asChild) {
3188
+ return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
3189
+ StyledFormFieldRoot,
3190
+ {
3191
+ as: Slot,
3192
+ ref,
3193
+ className: fieldClassName,
3194
+ style,
3195
+ sx,
3196
+ ...rest,
3197
+ children
3198
+ }
3199
+ ) });
3200
+ }
3201
+ return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
3202
+ StyledFormFieldRoot,
3203
+ {
3204
+ as: targetTag,
3205
+ ref,
3206
+ className: fieldClassName,
3207
+ style,
3208
+ sx,
3209
+ ...rest,
3210
+ children
3211
+ }
3212
+ ) });
3213
+ }
3214
+ );
3215
+ FormField.displayName = "FormField";
3216
+ var StyledLabelRoot = styled("label", {
3217
+ name: "ChellaaFormLabel",
3218
+ slot: "Root",
3219
+ shouldForwardProp: (prop) => prop !== "required" && prop !== "error" && prop !== "disabled" && prop !== "asChild" && prop !== "component"
3220
+ })({});
3221
+ var FormLabel = React.forwardRef(
3222
+ function FormLabel2(props, ref) {
3223
+ const {
3224
+ htmlFor: htmlForProp,
3225
+ id: idProp,
3226
+ required: requiredProp,
3227
+ error: errorProp,
3228
+ disabled: disabledProp,
3229
+ asChild = false,
3230
+ component,
3231
+ as,
3232
+ children,
3233
+ className,
3234
+ style,
3235
+ sx,
3236
+ ...rest
3237
+ } = props;
3238
+ const formField = useFormField();
3239
+ const htmlFor = htmlForProp ?? formField?.id;
3240
+ const id = idProp ?? formField?.labelId;
3241
+ const required = requiredProp ?? formField?.required ?? false;
3242
+ const error = errorProp ?? formField?.error ?? false;
3243
+ const disabled = disabledProp ?? formField?.disabled ?? false;
3244
+ const labelClassName = classNames(
3245
+ "cl-form-label",
3246
+ error && "cl-form-label--error",
3247
+ disabled && "cl-form-label--disabled",
3248
+ className
3249
+ );
3250
+ const targetTag = component || as;
3251
+ if (asChild) {
3252
+ return /* @__PURE__ */ jsx(
3253
+ StyledLabelRoot,
3254
+ {
3255
+ as: Slot,
3256
+ ref,
3257
+ htmlFor,
3258
+ id,
3259
+ className: labelClassName,
3260
+ style,
3261
+ sx,
3262
+ ...rest,
3263
+ children
3264
+ }
3265
+ );
3266
+ }
3267
+ return /* @__PURE__ */ jsxs(
3268
+ StyledLabelRoot,
3269
+ {
3270
+ as: targetTag,
3271
+ ref,
3272
+ htmlFor,
3273
+ id,
3274
+ className: labelClassName,
3275
+ style,
3276
+ sx,
3277
+ ...rest,
3278
+ children: [
3279
+ children,
3280
+ required && /* @__PURE__ */ jsx("span", { className: "cl-form-label__asterisk", "aria-hidden": "true", children: "*" })
3281
+ ]
3282
+ }
3283
+ );
3284
+ }
3285
+ );
3286
+ FormLabel.displayName = "FormLabel";
3287
+ var StyledHelperTextRoot = styled("p", {
3288
+ name: "ChellaaFormHelperText",
3289
+ slot: "Root",
3290
+ shouldForwardProp: (prop) => prop !== "disabled" && prop !== "asChild" && prop !== "component"
3291
+ })({});
3292
+ var FormHelperText = React.forwardRef(function FormHelperText2(props, ref) {
3293
+ const {
3294
+ id: idProp,
3295
+ disabled: disabledProp,
3296
+ asChild = false,
3297
+ component = "p",
3298
+ as,
3299
+ children,
3300
+ className,
3301
+ style,
3302
+ sx,
3303
+ ...rest
3304
+ } = props;
3305
+ const formField = useFormField();
3306
+ const setHasHelperText = formField?.setHasHelperText;
3307
+ React.useEffect(() => {
3308
+ setHasHelperText?.(true);
3309
+ return () => setHasHelperText?.(false);
3310
+ }, [setHasHelperText]);
3311
+ const id = idProp ?? formField?.helperTextId;
3312
+ const disabled = disabledProp ?? formField?.disabled ?? false;
3313
+ const targetTag = component || as;
3314
+ const helperClassName = classNames(
3315
+ "cl-form-helper-text",
3316
+ disabled && "cl-form-helper-text--disabled",
3317
+ className
3318
+ );
3319
+ if (asChild) {
3320
+ return /* @__PURE__ */ jsx(
3321
+ StyledHelperTextRoot,
3322
+ {
3323
+ as: Slot,
3324
+ ref,
3325
+ id,
3326
+ className: helperClassName,
3327
+ style,
3328
+ sx,
3329
+ ...rest,
3330
+ children
3331
+ }
3332
+ );
3333
+ }
3334
+ return /* @__PURE__ */ jsx(
3335
+ StyledHelperTextRoot,
3336
+ {
3337
+ as: targetTag,
3338
+ ref,
3339
+ id,
3340
+ className: helperClassName,
3341
+ style,
3342
+ sx,
3343
+ ...rest,
3344
+ children
3345
+ }
3346
+ );
3347
+ });
3348
+ FormHelperText.displayName = "FormHelperText";
3349
+ var StyledErrorMessageRoot = styled("p", {
3350
+ name: "ChellaaFormErrorMessage",
3351
+ slot: "Root",
3352
+ shouldForwardProp: (prop) => prop !== "forceMount" && prop !== "asChild" && prop !== "component"
3353
+ })({});
3354
+ var FormErrorMessage = React.forwardRef(function FormErrorMessage2(props, ref) {
3355
+ const {
3356
+ id: idProp,
3357
+ forceMount = false,
3358
+ asChild = false,
3359
+ component = "p",
3360
+ as,
3361
+ children,
3362
+ className,
3363
+ style,
3364
+ sx,
3365
+ ...rest
3366
+ } = props;
3367
+ const formField = useFormField();
3368
+ const isError = formField?.error ?? false;
3369
+ const setHasErrorMessage = formField?.setHasErrorMessage;
3370
+ React.useEffect(() => {
3371
+ if (isError || forceMount) {
3372
+ setHasErrorMessage?.(true);
3373
+ return () => setHasErrorMessage?.(false);
3374
+ }
3375
+ }, [setHasErrorMessage, isError, forceMount]);
3376
+ if (!isError && !forceMount) {
3377
+ return null;
3378
+ }
3379
+ const id = idProp ?? formField?.errorMessageId;
3380
+ const targetTag = component || as;
3381
+ const errorClassName = classNames("cl-form-error-message", className);
3382
+ if (asChild) {
3383
+ return /* @__PURE__ */ jsx(
3384
+ StyledErrorMessageRoot,
3385
+ {
3386
+ as: Slot,
3387
+ ref,
3388
+ id,
3389
+ role: "alert",
3390
+ "aria-live": "polite",
3391
+ className: errorClassName,
3392
+ style,
3393
+ sx,
3394
+ ...rest,
3395
+ children
3396
+ }
3397
+ );
3398
+ }
3399
+ return /* @__PURE__ */ jsx(
3400
+ StyledErrorMessageRoot,
3401
+ {
3402
+ as: targetTag,
3403
+ ref,
3404
+ id,
3405
+ role: "alert",
3406
+ "aria-live": "polite",
3407
+ className: errorClassName,
3408
+ style,
3409
+ sx,
3410
+ ...rest,
3411
+ children
3412
+ }
3413
+ );
3414
+ });
3415
+ FormErrorMessage.displayName = "FormErrorMessage";
3416
+ var CheckboxContext = React.createContext(void 0);
3417
+ function useCheckboxGroup() {
3418
+ return React.useContext(CheckboxContext);
3419
+ }
3420
+ var StyledCheckboxRoot = styled("label", {
3421
+ name: "ChellaaCheckbox",
3422
+ slot: "Root",
3423
+ shouldForwardProp: (prop) => prop !== "size" && prop !== "colorScheme" && prop !== "disabled" && prop !== "readOnly" && prop !== "error" && prop !== "checked" && prop !== "indeterminate" && prop !== "asChild" && prop !== "component"
3424
+ })({});
3425
+ var Checkbox = React.forwardRef(
3426
+ function Checkbox2(props, ref) {
3427
+ const group = useCheckboxGroup();
3428
+ const formField = useFormField();
3429
+ const {
3430
+ checked: checkedProp,
3431
+ defaultChecked = false,
3432
+ indeterminate = false,
3433
+ onChange: onChangeProp,
3434
+ value: valueProp,
3435
+ name: nameProp,
3436
+ size: sizeProp,
3437
+ colorScheme: colorSchemeProp,
3438
+ disabled: disabledProp,
3439
+ readOnly: readOnlyProp,
3440
+ required: requiredProp,
3441
+ error: errorProp,
3442
+ inputRef: inputRefProp,
3443
+ inputProps = {},
3444
+ asChild = false,
3445
+ component,
3446
+ as,
3447
+ children,
3448
+ className,
3449
+ style,
3450
+ sx,
3451
+ id: idProp,
3452
+ ...rest
3453
+ } = props;
3454
+ const isGroupControlled = group !== void 0 && valueProp !== void 0;
3455
+ const isCheckedInGroup = isGroupControlled ? group.value.includes(valueProp) : void 0;
3456
+ const checked = checkedProp !== void 0 ? checkedProp : isCheckedInGroup;
3457
+ const size = sizeProp ?? group?.size ?? "md";
3458
+ const colorScheme = colorSchemeProp ?? group?.colorScheme ?? "primary";
3459
+ const disabled = disabledProp ?? group?.disabled ?? formField?.disabled ?? false;
3460
+ const readOnly = readOnlyProp ?? group?.readOnly ?? formField?.readOnly ?? false;
3461
+ const error = errorProp ?? group?.error ?? formField?.error ?? false;
3462
+ const required = requiredProp ?? formField?.required ?? false;
3463
+ const name = nameProp ?? group?.name ?? formField?.name;
3464
+ const id = idProp ?? (formField ? `${formField.id}-checkbox` : void 0);
3465
+ const [uncontrolledChecked, setUncontrolledChecked] = React.useState(
3466
+ defaultChecked
3467
+ );
3468
+ const isControlled = checked !== void 0;
3469
+ const effectiveChecked = isControlled ? checked : uncontrolledChecked;
3470
+ const nativeInputRef = React.useRef(null);
3471
+ const mergedInputRef = useMergeRefs(nativeInputRef, inputRefProp);
3472
+ React.useEffect(() => {
3473
+ if (nativeInputRef.current) {
3474
+ nativeInputRef.current.indeterminate = Boolean(indeterminate);
3475
+ }
3476
+ }, [indeterminate]);
3477
+ const handleChange = (event) => {
3478
+ if (disabled || readOnly) {
3479
+ event.preventDefault();
3480
+ return;
3481
+ }
3482
+ if (isGroupControlled) {
3483
+ group.toggleValue(valueProp);
3484
+ } else if (!isControlled) {
3485
+ setUncontrolledChecked(event.target.checked);
3486
+ }
3487
+ onChangeProp?.(event);
3488
+ };
3489
+ const checkboxClassName = classNames(
3490
+ "cl-checkbox",
3491
+ `cl-checkbox--${size}`,
3492
+ `cl-checkbox--${colorScheme}`,
3493
+ effectiveChecked && "cl-checkbox--checked",
3494
+ indeterminate && "cl-checkbox--indeterminate",
3495
+ disabled && "cl-checkbox--disabled",
3496
+ error && "cl-checkbox--error",
3497
+ className
3498
+ );
3499
+ const targetTag = component || as;
3500
+ const controlBox = /* @__PURE__ */ jsx("span", { className: "cl-checkbox__control ChellaaCheckbox-Control", "aria-hidden": "true", children: indeterminate ? /* @__PURE__ */ jsx(
3501
+ "svg",
3502
+ {
3503
+ className: "cl-checkbox__icon ChellaaCheckbox-Icon ChellaaCheckbox-Icon--indeterminate",
3504
+ viewBox: "0 0 24 24",
3505
+ fill: "none",
3506
+ stroke: "currentColor",
3507
+ strokeWidth: "3.5",
3508
+ strokeLinecap: "round",
3509
+ strokeLinejoin: "round",
3510
+ "aria-hidden": "true",
3511
+ width: size === "lg" ? 18 : size === "sm" ? 12 : 14,
3512
+ height: size === "lg" ? 18 : size === "sm" ? 12 : 14,
3513
+ children: /* @__PURE__ */ jsx("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
3514
+ }
3515
+ ) : effectiveChecked ? /* @__PURE__ */ jsx(
3516
+ "svg",
3517
+ {
3518
+ className: "cl-checkbox__icon ChellaaCheckbox-Icon ChellaaCheckbox-Icon--checked",
3519
+ viewBox: "0 0 24 24",
3520
+ fill: "none",
3521
+ stroke: "currentColor",
3522
+ strokeWidth: "3.5",
3523
+ strokeLinecap: "round",
3524
+ strokeLinejoin: "round",
3525
+ "aria-hidden": "true",
3526
+ width: size === "lg" ? 18 : size === "sm" ? 12 : 14,
3527
+ height: size === "lg" ? 18 : size === "sm" ? 12 : 14,
3528
+ children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" })
3529
+ }
3530
+ ) : null });
3531
+ const ariaDescribedBy = [
3532
+ inputProps["aria-describedby"],
3533
+ formField?.error && formField?.hasErrorMessage ? formField.errorMessageId : null,
3534
+ formField?.hasHelperText ? formField.helperTextId : null
3535
+ ].filter(Boolean).join(" ") || void 0;
3536
+ if (asChild) {
3537
+ return /* @__PURE__ */ jsx(
3538
+ StyledCheckboxRoot,
3539
+ {
3540
+ as: Slot,
3541
+ ref,
3542
+ className: checkboxClassName,
3543
+ style,
3544
+ sx,
3545
+ ...rest,
3546
+ children
3547
+ }
3548
+ );
3549
+ }
3550
+ return /* @__PURE__ */ jsxs(
3551
+ StyledCheckboxRoot,
3552
+ {
3553
+ as: targetTag,
3554
+ ref,
3555
+ className: checkboxClassName,
3556
+ style,
3557
+ sx,
3558
+ ...rest,
3559
+ children: [
3560
+ /* @__PURE__ */ jsx(
3561
+ "input",
3562
+ {
3563
+ type: "checkbox",
3564
+ id,
3565
+ name,
3566
+ value: valueProp,
3567
+ disabled,
3568
+ readOnly,
3569
+ required,
3570
+ checked: isControlled ? effectiveChecked : void 0,
3571
+ defaultChecked: !isControlled ? defaultChecked : void 0,
3572
+ onChange: handleChange,
3573
+ ref: mergedInputRef,
3574
+ "aria-checked": indeterminate ? "mixed" : effectiveChecked,
3575
+ "aria-invalid": error ? true : void 0,
3576
+ "aria-describedby": ariaDescribedBy,
3577
+ className: "cl-checkbox__input",
3578
+ ...inputProps
3579
+ }
3580
+ ),
3581
+ controlBox,
3582
+ children && /* @__PURE__ */ jsx("span", { className: "cl-checkbox__label ChellaaCheckbox-Label", children })
3583
+ ]
3584
+ }
3585
+ );
3586
+ }
3587
+ );
3588
+ Checkbox.displayName = "Checkbox";
3589
+ function useControllableState({
3590
+ value: valueProp,
3591
+ defaultValue,
3592
+ onChange
3593
+ }) {
3594
+ const isControlled = valueProp !== void 0;
3595
+ const [uncontrolledValue, setUncontrolledValue] = React.useState(() => {
3596
+ if (defaultValue !== void 0) {
3597
+ return typeof defaultValue === "function" ? defaultValue() : defaultValue;
3598
+ }
3599
+ return void 0;
3600
+ });
3601
+ const value = isControlled ? valueProp : uncontrolledValue;
3602
+ const onChangeRef = React.useRef(onChange);
3603
+ React.useEffect(() => {
3604
+ onChangeRef.current = onChange;
3605
+ });
3606
+ const setValue = React.useCallback(
3607
+ (next) => {
3608
+ const resolvedNext = typeof next === "function" ? next(value) : next;
3609
+ if (!Object.is(value, resolvedNext)) {
3610
+ if (!isControlled) {
3611
+ setUncontrolledValue(resolvedNext);
3612
+ }
3613
+ onChangeRef.current?.(resolvedNext);
3614
+ }
3615
+ },
3616
+ [isControlled, value]
3617
+ );
3618
+ return [value, setValue];
3619
+ }
3620
+ var StyledCheckboxGroupRoot = styled("div", {
3621
+ name: "ChellaaCheckboxGroup",
3622
+ slot: "Root",
3623
+ shouldForwardProp: (prop) => prop !== "orientation" && prop !== "spacing" && prop !== "colorScheme" && prop !== "error" && prop !== "disabled" && prop !== "readOnly" && prop !== "asChild" && prop !== "component"
3624
+ })(({ theme, spacing = 2 }) => {
3625
+ const gapValue = typeof spacing === "number" ? theme.spacing(spacing) : spacing;
3626
+ return {
3627
+ gap: gapValue
3628
+ };
3629
+ });
3630
+ var CheckboxGroup = React.forwardRef(function CheckboxGroup2(props, ref) {
3631
+ const formField = useFormField();
3632
+ const {
3633
+ value: valueProp,
3634
+ defaultValue = [],
3635
+ onChange: onChangeProp,
3636
+ name: nameProp,
3637
+ size = "md",
3638
+ colorScheme = "primary",
3639
+ orientation = "vertical",
3640
+ spacing = 2,
3641
+ disabled: disabledProp,
3642
+ readOnly: readOnlyProp,
3643
+ error: errorProp,
3644
+ asChild = false,
3645
+ component,
3646
+ as,
3647
+ children,
3648
+ className,
3649
+ style,
3650
+ sx,
3651
+ ...rest
3652
+ } = props;
3653
+ const name = nameProp ?? formField?.name;
3654
+ const disabled = disabledProp ?? formField?.disabled ?? false;
3655
+ const readOnly = readOnlyProp ?? formField?.readOnly ?? false;
3656
+ const error = errorProp ?? formField?.error ?? false;
3657
+ const [value, setValue] = useControllableState({
3658
+ value: valueProp,
3659
+ defaultValue,
3660
+ onChange: onChangeProp
3661
+ });
3662
+ const toggleValue = React.useCallback(
3663
+ (itemValue) => {
3664
+ if (readOnly || disabled) return;
3665
+ const current = value || [];
3666
+ const next = current.includes(itemValue) ? current.filter((v) => v !== itemValue) : [...current, itemValue];
3667
+ setValue(next);
3668
+ },
3669
+ [value, setValue, readOnly, disabled]
3670
+ );
3671
+ const contextValue = React.useMemo(
3672
+ () => ({
3673
+ value: value || [],
3674
+ name,
3675
+ size,
3676
+ colorScheme,
3677
+ disabled,
3678
+ readOnly,
3679
+ error,
3680
+ toggleValue
3681
+ }),
3682
+ [value, name, size, colorScheme, disabled, readOnly, error, toggleValue]
3683
+ );
3684
+ const groupClassName = classNames(
3685
+ "cl-checkbox-group",
3686
+ `cl-checkbox-group--${orientation}`,
3687
+ className
3688
+ );
3689
+ const targetTag = component || as;
3690
+ if (asChild) {
3691
+ return /* @__PURE__ */ jsx(CheckboxContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
3692
+ StyledCheckboxGroupRoot,
3693
+ {
3694
+ as: Slot,
3695
+ ref,
3696
+ role: "group",
3697
+ orientation,
3698
+ spacing,
3699
+ className: groupClassName,
3700
+ style,
3701
+ sx,
3702
+ ...rest,
3703
+ children
3704
+ }
3705
+ ) });
3706
+ }
3707
+ return /* @__PURE__ */ jsx(CheckboxContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
3708
+ StyledCheckboxGroupRoot,
3709
+ {
3710
+ as: targetTag,
3711
+ ref,
3712
+ role: "group",
3713
+ orientation,
3714
+ spacing,
3715
+ className: groupClassName,
3716
+ style,
3717
+ sx,
3718
+ ...rest,
3719
+ children
3720
+ }
3721
+ ) });
3722
+ });
3723
+ CheckboxGroup.displayName = "CheckboxGroup";
3724
+ var RadioContext = React.createContext(void 0);
3725
+ function useRadioGroup() {
3726
+ return React.useContext(RadioContext);
3727
+ }
3728
+ var StyledRadioRoot = styled("label", {
3729
+ name: "ChellaaRadio",
3730
+ slot: "Root",
3731
+ shouldForwardProp: (prop) => prop !== "size" && prop !== "colorScheme" && prop !== "disabled" && prop !== "readOnly" && prop !== "error" && prop !== "checked" && prop !== "asChild" && prop !== "component"
3732
+ })({});
3733
+ var Radio = React.forwardRef(
3734
+ function Radio2(props, ref) {
3735
+ const group = useRadioGroup();
3736
+ const formField = useFormField();
3737
+ const {
3738
+ checked: checkedProp,
3739
+ defaultChecked = false,
3740
+ onChange: onChangeProp,
3741
+ value: valueProp,
3742
+ name: nameProp,
3743
+ size: sizeProp,
3744
+ colorScheme: colorSchemeProp,
3745
+ disabled: disabledProp,
3746
+ readOnly: readOnlyProp,
3747
+ required: requiredProp,
3748
+ error: errorProp,
3749
+ inputRef: inputRefProp,
3750
+ inputProps = {},
3751
+ asChild = false,
3752
+ component,
3753
+ as,
3754
+ children,
3755
+ className,
3756
+ style,
3757
+ sx,
3758
+ id: idProp,
3759
+ ...rest
3760
+ } = props;
3761
+ const isGroupControlled = group !== void 0 && valueProp !== void 0;
3762
+ const isCheckedInGroup = isGroupControlled ? group.value !== void 0 && String(group.value) === String(valueProp) : void 0;
3763
+ const checked = checkedProp !== void 0 ? checkedProp : isCheckedInGroup;
3764
+ const size = sizeProp ?? group?.size ?? "md";
3765
+ const colorScheme = colorSchemeProp ?? group?.colorScheme ?? "primary";
3766
+ const disabled = disabledProp ?? group?.disabled ?? formField?.disabled ?? false;
3767
+ const readOnly = readOnlyProp ?? group?.readOnly ?? formField?.readOnly ?? false;
3768
+ const error = errorProp ?? group?.error ?? formField?.error ?? false;
3769
+ const required = requiredProp ?? formField?.required ?? false;
3770
+ const name = nameProp ?? group?.name ?? formField?.name;
3771
+ const id = idProp ?? (formField ? `${formField.id}-radio-${valueProp ?? ""}` : void 0);
3772
+ const [uncontrolledChecked, setUncontrolledChecked] = React.useState(
3773
+ defaultChecked
3774
+ );
3775
+ const isControlled = checked !== void 0;
3776
+ const effectiveChecked = isControlled ? checked : uncontrolledChecked;
3777
+ const nativeInputRef = React.useRef(null);
3778
+ const mergedInputRef = useMergeRefs(nativeInputRef, inputRefProp);
3779
+ const handleChange = (event) => {
3780
+ if (disabled || readOnly) {
3781
+ event.preventDefault();
3782
+ return;
3783
+ }
3784
+ if (isGroupControlled && valueProp !== void 0) {
3785
+ group.onChange(valueProp);
3786
+ } else if (!isControlled) {
3787
+ setUncontrolledChecked(event.target.checked);
3788
+ }
3789
+ onChangeProp?.(event);
3790
+ };
3791
+ const radioClassName = classNames(
3792
+ "cl-radio",
3793
+ `cl-radio--${size}`,
3794
+ `cl-radio--${colorScheme}`,
3795
+ effectiveChecked && "cl-radio--checked",
3796
+ disabled && "cl-radio--disabled",
3797
+ error && "cl-radio--error",
3798
+ className
3799
+ );
3800
+ const targetTag = component || as;
3801
+ const controlBox = /* @__PURE__ */ jsx("span", { className: "cl-radio__control ChellaaRadio-Control", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { className: "cl-radio__dot ChellaaRadio-Dot" }) });
3802
+ const ariaDescribedBy = [
3803
+ inputProps["aria-describedby"],
3804
+ formField?.error && formField?.hasErrorMessage ? formField.errorMessageId : null,
3805
+ formField?.hasHelperText ? formField.helperTextId : null
3806
+ ].filter(Boolean).join(" ") || void 0;
3807
+ if (asChild) {
3808
+ return /* @__PURE__ */ jsx(
3809
+ StyledRadioRoot,
3810
+ {
3811
+ as: Slot,
3812
+ ref,
3813
+ className: radioClassName,
3814
+ style,
3815
+ sx,
3816
+ ...rest,
3817
+ children
3818
+ }
3819
+ );
3820
+ }
3821
+ return /* @__PURE__ */ jsxs(
3822
+ StyledRadioRoot,
3823
+ {
3824
+ as: targetTag,
3825
+ ref,
3826
+ className: radioClassName,
3827
+ style,
3828
+ sx,
3829
+ ...rest,
3830
+ children: [
3831
+ /* @__PURE__ */ jsx(
3832
+ "input",
3833
+ {
3834
+ type: "radio",
3835
+ id,
3836
+ name,
3837
+ value: valueProp,
3838
+ disabled,
3839
+ readOnly,
3840
+ required,
3841
+ checked: isControlled ? effectiveChecked : void 0,
3842
+ defaultChecked: !isControlled ? defaultChecked : void 0,
3843
+ onChange: handleChange,
3844
+ ref: mergedInputRef,
3845
+ "aria-invalid": error ? true : void 0,
3846
+ "aria-describedby": ariaDescribedBy,
3847
+ className: "cl-radio__input",
3848
+ ...inputProps
3849
+ }
3850
+ ),
3851
+ controlBox,
3852
+ children && /* @__PURE__ */ jsx("span", { className: "cl-radio__label ChellaaRadio-Label", children })
3853
+ ]
3854
+ }
3855
+ );
3856
+ }
3857
+ );
3858
+ Radio.displayName = "Radio";
3859
+ var StyledRadioGroupRoot = styled("div", {
3860
+ name: "ChellaaRadioGroup",
3861
+ slot: "Root",
3862
+ shouldForwardProp: (prop) => prop !== "orientation" && prop !== "spacing" && prop !== "colorScheme" && prop !== "error" && prop !== "disabled" && prop !== "readOnly" && prop !== "asChild" && prop !== "component"
3863
+ })({});
3864
+ var RadioGroup = React.forwardRef(
3865
+ function RadioGroup2(props, ref) {
3866
+ const formField = useFormField();
3867
+ const {
3868
+ value: valueProp,
3869
+ defaultValue,
3870
+ onChange: onChangeProp,
3871
+ name: nameProp,
3872
+ size = "md",
3873
+ colorScheme = "primary",
3874
+ orientation = "vertical",
3875
+ spacing = 2,
3876
+ disabled: disabledProp,
3877
+ readOnly: readOnlyProp,
3878
+ error: errorProp,
3879
+ asChild = false,
3880
+ component,
3881
+ as,
3882
+ children,
3883
+ className,
3884
+ style,
3885
+ sx,
3886
+ ...rest
3887
+ } = props;
3888
+ const generatedName = React.useId();
3889
+ const name = nameProp || formField?.name || generatedName;
3890
+ const disabled = disabledProp ?? formField?.disabled ?? false;
3891
+ const readOnly = readOnlyProp ?? formField?.readOnly ?? false;
3892
+ const error = errorProp ?? formField?.error ?? false;
3893
+ const [value, setValue] = useControllableState({
3894
+ value: valueProp,
3895
+ defaultValue,
3896
+ onChange: (val) => {
3897
+ if (val !== void 0) {
3898
+ onChangeProp?.(val);
3899
+ }
3900
+ }
3901
+ });
3902
+ const handleChange = React.useCallback(
3903
+ (nextValue) => {
3904
+ if (readOnly || disabled) return;
3905
+ setValue(nextValue);
3906
+ },
3907
+ [readOnly, disabled, setValue]
3908
+ );
3909
+ const contextValue = React.useMemo(
3910
+ () => ({
3911
+ value,
3912
+ name,
3913
+ size,
3914
+ colorScheme,
3915
+ disabled,
3916
+ readOnly,
3917
+ error,
3918
+ onChange: handleChange
3919
+ }),
3920
+ [value, name, size, colorScheme, disabled, readOnly, error, handleChange]
3921
+ );
3922
+ const targetTag = component || as;
3923
+ const groupClassName = classNames(
3924
+ "cl-radio-group",
3925
+ orientation === "horizontal" ? "cl-radio-group--horizontal" : "cl-radio-group--vertical",
3926
+ className
3927
+ );
3928
+ const gapStyle = spacing !== void 0 ? {
3929
+ gap: typeof spacing === "number" ? `${spacing * 4}px` : spacing,
3930
+ ...style
3931
+ } : style;
3932
+ if (asChild) {
3933
+ return /* @__PURE__ */ jsx(RadioContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
3934
+ StyledRadioGroupRoot,
3935
+ {
3936
+ as: Slot,
3937
+ ref,
3938
+ role: "radiogroup",
3939
+ className: groupClassName,
3940
+ style: gapStyle,
3941
+ sx,
3942
+ ...rest,
3943
+ children
3944
+ }
3945
+ ) });
3946
+ }
3947
+ return /* @__PURE__ */ jsx(RadioContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
3948
+ StyledRadioGroupRoot,
3949
+ {
3950
+ as: targetTag,
3951
+ ref,
3952
+ role: "radiogroup",
3953
+ className: groupClassName,
3954
+ style: gapStyle,
3955
+ sx,
3956
+ ...rest,
3957
+ children
3958
+ }
3959
+ ) });
3960
+ }
3961
+ );
3962
+ RadioGroup.displayName = "RadioGroup";
3963
+ var StyledSwitchRoot = styled("label", {
3964
+ name: "ChellaaSwitch",
3965
+ slot: "Root",
3966
+ shouldForwardProp: (prop) => prop !== "size" && prop !== "labelPlacement" && prop !== "disabled" && prop !== "readOnly" && prop !== "error" && prop !== "loading" && prop !== "checked" && prop !== "colorScheme" && prop !== "asChild" && prop !== "component"
3967
+ })({});
3968
+ var Switch = React.forwardRef(
3969
+ function Switch2(props, ref) {
3970
+ const formField = useFormField();
3971
+ const {
3972
+ checked: checkedProp,
3973
+ defaultChecked = false,
3974
+ onChange: onChangeProp,
3975
+ value,
3976
+ name: nameProp,
3977
+ size = "md",
3978
+ colorScheme = "primary",
3979
+ disabled: disabledProp,
3980
+ readOnly: readOnlyProp,
3981
+ required: requiredProp,
3982
+ error: errorProp,
3983
+ loading = false,
3984
+ checkedIcon,
3985
+ uncheckedIcon,
3986
+ labelPlacement = "end",
3987
+ inputRef: inputRefProp,
3988
+ inputProps = {},
3989
+ asChild = false,
3990
+ component,
3991
+ as,
3992
+ children,
3993
+ className,
3994
+ style,
3995
+ sx,
3996
+ id: idProp,
3997
+ ...rest
3998
+ } = props;
3999
+ const disabled = disabledProp ?? formField?.disabled ?? loading ? true : false;
4000
+ const readOnly = readOnlyProp ?? formField?.readOnly ?? false;
4001
+ const error = errorProp ?? formField?.error ?? false;
4002
+ const required = requiredProp ?? formField?.required ?? false;
4003
+ const name = nameProp ?? formField?.name;
4004
+ const id = idProp ?? (formField ? `${formField.id}-switch` : void 0);
4005
+ const [uncontrolledChecked, setUncontrolledChecked] = React.useState(
4006
+ defaultChecked
4007
+ );
4008
+ const isControlled = checkedProp !== void 0;
4009
+ const effectiveChecked = isControlled ? checkedProp : uncontrolledChecked;
4010
+ const nativeInputRef = React.useRef(null);
4011
+ const mergedInputRef = useMergeRefs(nativeInputRef, inputRefProp);
4012
+ const handleChange = (event) => {
4013
+ if (disabled || readOnly || loading) {
4014
+ event.preventDefault();
4015
+ return;
4016
+ }
4017
+ if (!isControlled) {
4018
+ setUncontrolledChecked(event.target.checked);
4019
+ }
4020
+ onChangeProp?.(event);
4021
+ };
4022
+ const handleKeyDown = (event) => {
4023
+ if (event.key === "Enter") {
4024
+ event.preventDefault();
4025
+ nativeInputRef.current?.click();
4026
+ }
4027
+ inputProps.onKeyDown?.(event);
4028
+ };
4029
+ const switchClassName = classNames(
4030
+ "cl-switch",
4031
+ `cl-switch--${size}`,
4032
+ `cl-switch--${colorScheme}`,
4033
+ `cl-switch--placement-${labelPlacement}`,
4034
+ effectiveChecked && "cl-switch--checked",
4035
+ disabled && "cl-switch--disabled",
4036
+ error && "cl-switch--error",
4037
+ className
4038
+ );
4039
+ const targetTag = component || as;
4040
+ const thumbIcon = loading ? /* @__PURE__ */ jsx(
4041
+ "svg",
4042
+ {
4043
+ className: "cl-switch__spinner",
4044
+ viewBox: "0 0 24 24",
4045
+ fill: "none",
4046
+ "aria-hidden": "true",
4047
+ children: /* @__PURE__ */ jsx(
4048
+ "circle",
4049
+ {
4050
+ cx: "12",
4051
+ cy: "12",
4052
+ r: "9",
4053
+ stroke: "currentColor",
4054
+ strokeWidth: "3",
4055
+ strokeDasharray: "40 20",
4056
+ strokeLinecap: "round"
4057
+ }
4058
+ )
4059
+ }
4060
+ ) : effectiveChecked ? checkedIcon : uncheckedIcon;
4061
+ const trackControl = /* @__PURE__ */ jsx("span", { className: "cl-switch__track ChellaaSwitch-Track", "aria-hidden": "true", children: /* @__PURE__ */ jsx("span", { className: "cl-switch__thumb ChellaaSwitch-Thumb", children: thumbIcon }) });
4062
+ const ariaDescribedBy = [
4063
+ inputProps["aria-describedby"],
4064
+ formField?.error && formField?.hasErrorMessage ? formField.errorMessageId : null,
4065
+ formField?.hasHelperText ? formField.helperTextId : null
4066
+ ].filter(Boolean).join(" ") || void 0;
4067
+ if (asChild) {
4068
+ return /* @__PURE__ */ jsx(
4069
+ StyledSwitchRoot,
4070
+ {
4071
+ as: Slot,
4072
+ ref,
4073
+ className: switchClassName,
4074
+ style,
4075
+ sx,
4076
+ ...rest,
4077
+ children
4078
+ }
4079
+ );
4080
+ }
4081
+ return /* @__PURE__ */ jsxs(
4082
+ StyledSwitchRoot,
4083
+ {
4084
+ as: targetTag,
4085
+ ref,
4086
+ className: switchClassName,
4087
+ style,
4088
+ sx,
4089
+ ...rest,
4090
+ children: [
4091
+ /* @__PURE__ */ jsx(
4092
+ "input",
4093
+ {
4094
+ type: "checkbox",
4095
+ role: "switch",
4096
+ id,
4097
+ name,
4098
+ value,
4099
+ disabled,
4100
+ readOnly,
4101
+ required,
4102
+ checked: isControlled ? effectiveChecked : void 0,
4103
+ defaultChecked: !isControlled ? defaultChecked : void 0,
4104
+ onChange: handleChange,
4105
+ onKeyDown: handleKeyDown,
4106
+ ref: mergedInputRef,
4107
+ "aria-checked": effectiveChecked,
4108
+ "aria-invalid": error ? true : void 0,
4109
+ "aria-describedby": ariaDescribedBy,
4110
+ className: "cl-switch__input",
4111
+ ...inputProps
4112
+ }
4113
+ ),
4114
+ trackControl,
4115
+ children && /* @__PURE__ */ jsx("span", { className: "cl-switch__label ChellaaSwitch-Label", children })
4116
+ ]
4117
+ }
4118
+ );
4119
+ }
4120
+ );
4121
+ Switch.displayName = "Switch";
4122
+ var StyledPaperRoot = styled("div", {
4123
+ name: "ChellaaPaper",
4124
+ slot: "Root",
4125
+ shouldForwardProp: (prop) => prop !== "elevation" && prop !== "variant" && prop !== "square" && prop !== "asChild" && prop !== "component"
4126
+ })({});
4127
+ var Paper = React.forwardRef(
4128
+ function Paper2(props, ref) {
4129
+ const {
4130
+ asChild = false,
4131
+ component,
4132
+ as,
4133
+ elevation = 1,
4134
+ variant = "elevation",
4135
+ square = false,
4136
+ className,
4137
+ style,
4138
+ sx,
4139
+ children,
4140
+ ...rest
4141
+ } = props;
4142
+ const clampedElevation = Math.max(0, Math.min(24, elevation));
4143
+ const paperClassName = classNames(
4144
+ "cl-paper",
4145
+ square && "cl-paper--square",
4146
+ variant === "outlined" ? "cl-paper--outlined" : `cl-paper--elevation-${clampedElevation}`,
4147
+ className
4148
+ );
4149
+ const targetTag = component || as;
4150
+ if (asChild) {
4151
+ return /* @__PURE__ */ jsx(
4152
+ StyledPaperRoot,
4153
+ {
4154
+ as: Slot,
4155
+ ref,
4156
+ className: paperClassName,
4157
+ style,
4158
+ sx,
4159
+ ...rest,
4160
+ children
4161
+ }
4162
+ );
4163
+ }
4164
+ if (targetTag) {
4165
+ return /* @__PURE__ */ jsx(
4166
+ StyledPaperRoot,
4167
+ {
4168
+ as: targetTag,
4169
+ ref,
4170
+ className: paperClassName,
4171
+ style,
4172
+ sx,
4173
+ ...rest,
4174
+ children
4175
+ }
4176
+ );
4177
+ }
4178
+ return /* @__PURE__ */ jsx(
4179
+ StyledPaperRoot,
4180
+ {
4181
+ ref,
4182
+ className: paperClassName,
4183
+ style,
4184
+ sx,
4185
+ ...rest,
4186
+ children
4187
+ }
4188
+ );
4189
+ }
4190
+ );
4191
+ Paper.displayName = "Paper";
4192
+ var CardContext = React.createContext({
4193
+ size: "md"
4194
+ });
4195
+ var StyledCardRoot = styled("div", {
4196
+ name: "ChellaaCard",
4197
+ slot: "Root",
4198
+ shouldForwardProp: (prop) => prop !== "variant" && prop !== "elevation" && prop !== "hoverable" && prop !== "square" && prop !== "size" && prop !== "asChild" && prop !== "component"
4199
+ })({});
4200
+ var Card = React.forwardRef(
4201
+ function Card2(props, ref) {
4202
+ const {
4203
+ variant = "elevated",
4204
+ elevation = 1,
4205
+ size = "md",
4206
+ hoverable = false,
4207
+ square = false,
4208
+ asChild = false,
4209
+ component,
4210
+ as,
4211
+ className,
4212
+ style,
4213
+ sx,
4214
+ children,
4215
+ ...rest
4216
+ } = props;
4217
+ const cardClassName = classNames(
4218
+ "cl-card",
4219
+ `cl-card--${size}`,
4220
+ `cl-card--${variant}`,
4221
+ square && "cl-card--square",
4222
+ hoverable && "cl-card--hoverable",
4223
+ className
4224
+ );
4225
+ const targetTag = component || as;
4226
+ return /* @__PURE__ */ jsx(CardContext.Provider, { value: { size }, children: asChild ? /* @__PURE__ */ jsx(
4227
+ StyledCardRoot,
4228
+ {
4229
+ as: Slot,
4230
+ ref,
4231
+ className: cardClassName,
4232
+ style,
4233
+ sx,
4234
+ ...rest,
4235
+ children
4236
+ }
4237
+ ) : /* @__PURE__ */ jsx(
4238
+ StyledCardRoot,
4239
+ {
4240
+ as: targetTag,
4241
+ ref,
4242
+ className: cardClassName,
4243
+ style,
4244
+ sx,
4245
+ ...rest,
4246
+ children
4247
+ }
4248
+ ) });
4249
+ }
4250
+ );
4251
+ Card.displayName = "Card";
4252
+ var StyledCardHeaderRoot = styled("div", {
4253
+ name: "ChellaaCard",
4254
+ slot: "Header",
4255
+ shouldForwardProp: (prop) => prop !== "cardSize" && prop !== "asChild"
4256
+ })({});
4257
+ var CardHeader = React.forwardRef(
4258
+ function CardHeader2(props, ref) {
4259
+ const {
4260
+ avatar,
4261
+ action,
4262
+ title,
4263
+ subheader,
4264
+ titleTypographyProps,
4265
+ subheaderTypographyProps,
4266
+ asChild = false,
4267
+ className,
4268
+ style,
4269
+ sx,
4270
+ children,
4271
+ ...rest
4272
+ } = props;
4273
+ const headerClassName = classNames(
4274
+ "cl-card__header",
4275
+ "ChellaaCard-header",
4276
+ className
4277
+ );
4278
+ if (asChild) {
4279
+ return /* @__PURE__ */ jsx(
4280
+ StyledCardHeaderRoot,
4281
+ {
4282
+ as: Slot,
4283
+ ref,
4284
+ className: headerClassName,
4285
+ style,
4286
+ sx,
4287
+ ...rest,
4288
+ children
4289
+ }
4290
+ );
4291
+ }
4292
+ return /* @__PURE__ */ jsxs(
4293
+ StyledCardHeaderRoot,
4294
+ {
4295
+ ref,
4296
+ className: headerClassName,
4297
+ style,
4298
+ sx,
4299
+ ...rest,
4300
+ children: [
4301
+ avatar && /* @__PURE__ */ jsx("div", { className: "cl-card__header-avatar ChellaaCard-headerAvatar", children: avatar }),
4302
+ /* @__PURE__ */ jsxs("div", { className: "cl-card__header-content ChellaaCard-headerContent", children: [
4303
+ title != null && /* @__PURE__ */ jsx(
4304
+ "span",
4305
+ {
4306
+ className: classNames(
4307
+ "cl-card__header-title",
4308
+ "ChellaaCard-headerTitle",
4309
+ titleTypographyProps?.className
4310
+ ),
4311
+ ...titleTypographyProps,
4312
+ children: title
4313
+ }
4314
+ ),
4315
+ subheader != null && /* @__PURE__ */ jsx(
4316
+ "span",
4317
+ {
4318
+ className: classNames(
4319
+ "cl-card__header-subheader",
4320
+ "ChellaaCard-headerSubheader",
4321
+ subheaderTypographyProps?.className
4322
+ ),
4323
+ ...subheaderTypographyProps,
4324
+ children: subheader
4325
+ }
4326
+ ),
4327
+ children
4328
+ ] }),
4329
+ action && /* @__PURE__ */ jsx("div", { className: "cl-card__header-action ChellaaCard-headerAction", children: action })
4330
+ ]
4331
+ }
4332
+ );
4333
+ }
4334
+ );
4335
+ CardHeader.displayName = "CardHeader";
4336
+ var StyledCardMediaRoot = styled("div", {
4337
+ name: "ChellaaCard",
4338
+ slot: "Media",
4339
+ shouldForwardProp: (prop) => prop !== "image" && prop !== "aspectRatio"
4340
+ })({});
4341
+ var CardMedia = React.forwardRef(
4342
+ function CardMedia2(props, ref) {
4343
+ const {
4344
+ image,
4345
+ alt,
4346
+ aspectRatio = "16/9",
4347
+ component,
4348
+ className,
4349
+ style,
4350
+ sx,
4351
+ children,
4352
+ ...rest
4353
+ } = props;
4354
+ const mediaStyle = {
4355
+ ...aspectRatio ? { aspectRatio } : {},
4356
+ ...image ? { backgroundImage: `url(${image})` } : {},
4357
+ ...style
4358
+ };
4359
+ const mediaClassName = classNames(
4360
+ "cl-card__media",
4361
+ "ChellaaCard-media",
4362
+ className
4363
+ );
4364
+ return /* @__PURE__ */ jsx(
4365
+ StyledCardMediaRoot,
4366
+ {
4367
+ as: component,
4368
+ ref,
4369
+ className: mediaClassName,
4370
+ style: mediaStyle,
4371
+ sx,
4372
+ role: image && !children ? "img" : void 0,
4373
+ "aria-label": image && !children ? alt : void 0,
4374
+ ...rest,
4375
+ children
4376
+ }
4377
+ );
4378
+ }
4379
+ );
4380
+ CardMedia.displayName = "CardMedia";
4381
+ var StyledCardBodyRoot = styled("div", {
4382
+ name: "ChellaaCard",
4383
+ slot: "Body",
4384
+ shouldForwardProp: (prop) => prop !== "cardSize"
4385
+ })({});
4386
+ var CardBody = React.forwardRef(
4387
+ function CardBody2(props, ref) {
4388
+ const { children, className, style, sx, ...rest } = props;
4389
+ const bodyClassName = classNames("cl-card__body", "ChellaaCard-body", className);
4390
+ return /* @__PURE__ */ jsx(
4391
+ StyledCardBodyRoot,
4392
+ {
4393
+ ref,
4394
+ className: bodyClassName,
4395
+ style,
4396
+ sx,
4397
+ ...rest,
4398
+ children
4399
+ }
4400
+ );
4401
+ }
4402
+ );
4403
+ CardBody.displayName = "CardBody";
4404
+ var StyledCardFooterRoot = styled("div", {
4405
+ name: "ChellaaCard",
4406
+ slot: "Footer",
4407
+ shouldForwardProp: (prop) => prop !== "divider" && prop !== "cardSize"
4408
+ })({});
4409
+ var CardFooter = React.forwardRef(
4410
+ function CardFooter2(props, ref) {
4411
+ const { divider = false, children, className, style, sx, ...rest } = props;
4412
+ const footerClassName = classNames(
4413
+ "cl-card__footer",
4414
+ "ChellaaCard-footer",
4415
+ divider && "cl-card__footer--divider",
4416
+ className
4417
+ );
4418
+ return /* @__PURE__ */ jsx(
4419
+ StyledCardFooterRoot,
4420
+ {
4421
+ ref,
4422
+ className: footerClassName,
4423
+ style,
4424
+ sx,
4425
+ ...rest,
4426
+ children
4427
+ }
4428
+ );
4429
+ }
4430
+ );
4431
+ CardFooter.displayName = "CardFooter";
4432
+ var StyledCardActionsRoot = styled("div", {
4433
+ name: "ChellaaCard",
4434
+ slot: "Actions",
4435
+ shouldForwardProp: (prop) => prop !== "disableSpacing" && prop !== "cardSize"
4436
+ })({});
4437
+ var CardActions = React.forwardRef(
4438
+ function CardActions2(props, ref) {
4439
+ const { disableSpacing = false, children, className, style, sx, ...rest } = props;
4440
+ const actionsClassName = classNames(
4441
+ "cl-card__actions",
4442
+ "ChellaaCard-actions",
4443
+ disableSpacing && "cl-card__actions--disable-spacing",
4444
+ className
4445
+ );
4446
+ return /* @__PURE__ */ jsx(
4447
+ StyledCardActionsRoot,
4448
+ {
4449
+ ref,
4450
+ className: actionsClassName,
4451
+ style,
4452
+ sx,
4453
+ ...rest,
4454
+ children
4455
+ }
4456
+ );
4457
+ }
4458
+ );
4459
+ CardActions.displayName = "CardActions";
492
4460
 
493
- export { Button, ButtonGroup, ButtonGroupContext, ThemeProvider, ThemeScript, createTheme, useButtonGroupContext, useTheme };
4461
+ export { Box, Button, ButtonGroup, ButtonGroupContext, Card, CardActions, CardBody, CardFooter, CardHeader, CardMedia, Checkbox, CheckboxContext, CheckboxGroup, Code, Container, Divider, Flex, FormErrorMessage, FormField, FormFieldContext, FormHelperText, FormLabel, Grid, Heading, Input, InputAdornment, InputBase, Kbd, MODIFIER_SYMBOLS, Paper, Paragraph, Radio, RadioContext, RadioGroup, Stack, Switch, Text, TextField, Textarea, ThemeProvider, ThemeScript, TouchRipple, Typography, breakpointKeys, createBreakpoints, createPalette, createShadows, createShouldForwardProp, createSpacing, createTheme, darkPalette, defaultBreakpoints, defaultDarkTheme, defaultShadows, defaultSpacing, defaultTheme, defaultTransitions, defaultTypography, defaultZIndex, lightPalette, parseSx, resolveComponentOverrides, resolveTypographyColor, rootShouldForwardProp, styled, useButtonGroupContext, useCheckboxGroup, useFormField, useRadioGroup, useRipple, useTheme };
494
4462
  //# sourceMappingURL=index.mjs.map
495
4463
  //# sourceMappingURL=index.mjs.map