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