@yomologic/react-ui 0.2.2 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +361 -9
- package/dist/index.d.ts +361 -9
- package/dist/index.js +883 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +871 -60
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +680 -14
- package/dist/styles.css.map +1 -1
- package/package.json +2 -5
package/dist/index.mjs
CHANGED
|
@@ -32,9 +32,11 @@ var Button = React.forwardRef(
|
|
|
32
32
|
danger: "[background-color:var(--color-error)] text-white hover:bg-red-700 focus:[--tw-ring-color:var(--color-error)]"
|
|
33
33
|
};
|
|
34
34
|
const sizes = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
xs: "[font-size:var(--button-font-size-xs)] [padding-left:var(--button-padding-xs-x)] [padding-right:var(--button-padding-xs-x)] [padding-top:var(--button-padding-xs-y)] [padding-bottom:var(--button-padding-xs-y)] gap-1",
|
|
36
|
+
sm: "[font-size:var(--button-font-size-sm)] [padding-left:var(--button-padding-sm-x)] [padding-right:var(--button-padding-sm-x)] [padding-top:var(--button-padding-sm-y)] [padding-bottom:var(--button-padding-sm-y)] gap-1.5",
|
|
37
|
+
md: "[font-size:var(--button-font-size-md)] [padding-left:var(--button-padding-md-x)] [padding-right:var(--button-padding-md-x)] [padding-top:var(--button-padding-md-y)] [padding-bottom:var(--button-padding-md-y)] gap-2",
|
|
38
|
+
lg: "[font-size:var(--button-font-size-lg)] [padding-left:var(--button-padding-lg-x)] [padding-right:var(--button-padding-lg-x)] [padding-top:var(--button-padding-lg-y)] [padding-bottom:var(--button-padding-lg-y)] gap-2.5",
|
|
39
|
+
xl: "[font-size:var(--button-font-size-xl)] [padding-left:var(--button-padding-xl-x)] [padding-right:var(--button-padding-xl-x)] [padding-top:var(--button-padding-xl-y)] [padding-bottom:var(--button-padding-xl-y)] gap-3"
|
|
38
40
|
};
|
|
39
41
|
const radiusStyle = "[border-radius:var(--button-radius)]";
|
|
40
42
|
const fontWeightStyle = "[font-weight:var(--button-font-weight)]";
|
|
@@ -94,7 +96,7 @@ var Button = React.forwardRef(
|
|
|
94
96
|
Button.displayName = "Button";
|
|
95
97
|
|
|
96
98
|
// src/ui/input.tsx
|
|
97
|
-
import React2 from "react";
|
|
99
|
+
import React2, { useId } from "react";
|
|
98
100
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
99
101
|
var Input = React2.forwardRef(
|
|
100
102
|
({
|
|
@@ -109,7 +111,8 @@ var Input = React2.forwardRef(
|
|
|
109
111
|
id,
|
|
110
112
|
...props
|
|
111
113
|
}, ref) => {
|
|
112
|
-
const
|
|
114
|
+
const autoId = useId();
|
|
115
|
+
const inputId = id || `input-${autoId}`;
|
|
113
116
|
return /* @__PURE__ */ jsxs2("div", { className: cn("flex flex-col", fullWidth && "w-full"), children: [
|
|
114
117
|
label && /* @__PURE__ */ jsxs2(
|
|
115
118
|
"label",
|
|
@@ -249,9 +252,11 @@ var Badge = React4.forwardRef(
|
|
|
249
252
|
info: "bg-cyan-100 text-cyan-800"
|
|
250
253
|
};
|
|
251
254
|
const sizes = {
|
|
255
|
+
xs: "text-[0.625rem] px-1.5 py-0.5",
|
|
252
256
|
sm: "text-xs px-2 py-0.5",
|
|
253
257
|
md: "text-sm px-2.5 py-1",
|
|
254
|
-
lg: "text-base px-3 py-1.5"
|
|
258
|
+
lg: "text-base px-3 py-1.5",
|
|
259
|
+
xl: "text-lg px-3.5 py-2"
|
|
255
260
|
};
|
|
256
261
|
const dotVariants = {
|
|
257
262
|
default: "bg-gray-600",
|
|
@@ -283,6 +288,7 @@ var Badge = React4.forwardRef(
|
|
|
283
288
|
Badge.displayName = "Badge";
|
|
284
289
|
|
|
285
290
|
// src/ui/checkbox.tsx
|
|
291
|
+
import { useId as useId2 } from "react";
|
|
286
292
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
287
293
|
function Checkbox({
|
|
288
294
|
label,
|
|
@@ -290,14 +296,37 @@ function Checkbox({
|
|
|
290
296
|
onChange,
|
|
291
297
|
disabled = false,
|
|
292
298
|
className,
|
|
293
|
-
id
|
|
299
|
+
id,
|
|
300
|
+
size = "md"
|
|
294
301
|
}) {
|
|
295
|
-
const
|
|
302
|
+
const autoId = useId2();
|
|
303
|
+
const checkboxId = id || `checkbox-${autoId}`;
|
|
296
304
|
const handleChange = (e) => {
|
|
297
305
|
if (onChange) {
|
|
298
306
|
onChange(e.target.checked);
|
|
299
307
|
}
|
|
300
308
|
};
|
|
309
|
+
const sizeStyles = {
|
|
310
|
+
xs: `[width:var(--checkbox-size-xs)] [height:var(--checkbox-size-xs)]`,
|
|
311
|
+
sm: `[width:var(--checkbox-size-sm)] [height:var(--checkbox-size-sm)]`,
|
|
312
|
+
md: `[width:var(--checkbox-size-md)] [height:var(--checkbox-size-md)]`,
|
|
313
|
+
lg: `[width:var(--checkbox-size-lg)] [height:var(--checkbox-size-lg)]`,
|
|
314
|
+
xl: `[width:var(--checkbox-size-xl)] [height:var(--checkbox-size-xl)]`
|
|
315
|
+
};
|
|
316
|
+
const labelSizeStyles = {
|
|
317
|
+
xs: `[font-size:var(--checkbox-label-font-size-xs)]`,
|
|
318
|
+
sm: `[font-size:var(--checkbox-label-font-size-sm)]`,
|
|
319
|
+
md: `[font-size:var(--checkbox-label-font-size-md)]`,
|
|
320
|
+
lg: `[font-size:var(--checkbox-label-font-size-lg)]`,
|
|
321
|
+
xl: `[font-size:var(--checkbox-label-font-size-xl)]`
|
|
322
|
+
};
|
|
323
|
+
const labelSpacingStyles = {
|
|
324
|
+
xs: `[margin-left:var(--checkbox-label-spacing-xs)]`,
|
|
325
|
+
sm: `[margin-left:var(--checkbox-label-spacing-sm)]`,
|
|
326
|
+
md: `[margin-left:var(--checkbox-label-spacing-md)]`,
|
|
327
|
+
lg: `[margin-left:var(--checkbox-label-spacing-lg)]`,
|
|
328
|
+
xl: `[margin-left:var(--checkbox-label-spacing-xl)]`
|
|
329
|
+
};
|
|
301
330
|
return /* @__PURE__ */ jsxs4("div", { className: cn("flex items-center", className), children: [
|
|
302
331
|
/* @__PURE__ */ jsx5(
|
|
303
332
|
"input",
|
|
@@ -308,7 +337,8 @@ function Checkbox({
|
|
|
308
337
|
onChange: handleChange,
|
|
309
338
|
disabled,
|
|
310
339
|
className: cn(
|
|
311
|
-
|
|
340
|
+
sizeStyles[size],
|
|
341
|
+
"rounded-(--checkbox-radius) border-gray-400 text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
312
342
|
disabled && "cursor-not-allowed opacity-50"
|
|
313
343
|
)
|
|
314
344
|
}
|
|
@@ -318,7 +348,9 @@ function Checkbox({
|
|
|
318
348
|
{
|
|
319
349
|
htmlFor: checkboxId,
|
|
320
350
|
className: cn(
|
|
321
|
-
|
|
351
|
+
labelSpacingStyles[size],
|
|
352
|
+
labelSizeStyles[size],
|
|
353
|
+
"font-medium text-gray-600",
|
|
322
354
|
disabled && "cursor-not-allowed opacity-50",
|
|
323
355
|
!disabled && "cursor-pointer"
|
|
324
356
|
),
|
|
@@ -336,7 +368,8 @@ function CheckboxGroup({
|
|
|
336
368
|
className,
|
|
337
369
|
orientation = "vertical",
|
|
338
370
|
required = false,
|
|
339
|
-
disabled = false
|
|
371
|
+
disabled = false,
|
|
372
|
+
size = "md"
|
|
340
373
|
}) {
|
|
341
374
|
const handleChange = (optionValue, checked) => {
|
|
342
375
|
if (onChange) {
|
|
@@ -347,6 +380,27 @@ function CheckboxGroup({
|
|
|
347
380
|
}
|
|
348
381
|
}
|
|
349
382
|
};
|
|
383
|
+
const sizeStyles = {
|
|
384
|
+
xs: `[width:var(--checkbox-size-xs)] [height:var(--checkbox-size-xs)]`,
|
|
385
|
+
sm: `[width:var(--checkbox-size-sm)] [height:var(--checkbox-size-sm)]`,
|
|
386
|
+
md: `[width:var(--checkbox-size-md)] [height:var(--checkbox-size-md)]`,
|
|
387
|
+
lg: `[width:var(--checkbox-size-lg)] [height:var(--checkbox-size-lg)]`,
|
|
388
|
+
xl: `[width:var(--checkbox-size-xl)] [height:var(--checkbox-size-xl)]`
|
|
389
|
+
};
|
|
390
|
+
const labelSizeStyles = {
|
|
391
|
+
xs: `[font-size:var(--checkbox-label-font-size-xs)]`,
|
|
392
|
+
sm: `[font-size:var(--checkbox-label-font-size-sm)]`,
|
|
393
|
+
md: `[font-size:var(--checkbox-label-font-size-md)]`,
|
|
394
|
+
lg: `[font-size:var(--checkbox-label-font-size-lg)]`,
|
|
395
|
+
xl: `[font-size:var(--checkbox-label-font-size-xl)]`
|
|
396
|
+
};
|
|
397
|
+
const labelSpacingStyles = {
|
|
398
|
+
xs: `[margin-left:var(--checkbox-label-spacing-xs)]`,
|
|
399
|
+
sm: `[margin-left:var(--checkbox-label-spacing-sm)]`,
|
|
400
|
+
md: `[margin-left:var(--checkbox-label-spacing-md)]`,
|
|
401
|
+
lg: `[margin-left:var(--checkbox-label-spacing-lg)]`,
|
|
402
|
+
xl: `[margin-left:var(--checkbox-label-spacing-xl)]`
|
|
403
|
+
};
|
|
350
404
|
return /* @__PURE__ */ jsxs4("div", { className, children: [
|
|
351
405
|
label && /* @__PURE__ */ jsxs4("label", { className: "block text-sm font-semibold text-gray-600 mb-1", children: [
|
|
352
406
|
label,
|
|
@@ -373,7 +427,8 @@ function CheckboxGroup({
|
|
|
373
427
|
onChange: (e) => handleChange(option.value, e.target.checked),
|
|
374
428
|
disabled: isDisabled,
|
|
375
429
|
className: cn(
|
|
376
|
-
|
|
430
|
+
sizeStyles[size],
|
|
431
|
+
"rounded-(--checkbox-radius) border-gray-400 text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
377
432
|
isDisabled && "cursor-not-allowed opacity-50"
|
|
378
433
|
)
|
|
379
434
|
}
|
|
@@ -383,7 +438,9 @@ function CheckboxGroup({
|
|
|
383
438
|
{
|
|
384
439
|
htmlFor: `${name}-${option.value}`,
|
|
385
440
|
className: cn(
|
|
386
|
-
|
|
441
|
+
labelSpacingStyles[size],
|
|
442
|
+
labelSizeStyles[size],
|
|
443
|
+
"font-medium text-gray-600",
|
|
387
444
|
isDisabled && "cursor-not-allowed opacity-50",
|
|
388
445
|
!isDisabled && "cursor-pointer"
|
|
389
446
|
),
|
|
@@ -408,13 +465,35 @@ function RadioGroup({
|
|
|
408
465
|
className,
|
|
409
466
|
orientation = "vertical",
|
|
410
467
|
required = false,
|
|
411
|
-
disabled = false
|
|
468
|
+
disabled = false,
|
|
469
|
+
size = "md"
|
|
412
470
|
}) {
|
|
413
471
|
const handleChange = (e) => {
|
|
414
472
|
if (onChange) {
|
|
415
473
|
onChange(e.target.value);
|
|
416
474
|
}
|
|
417
475
|
};
|
|
476
|
+
const sizeStyles = {
|
|
477
|
+
xs: `[width:var(--radio-size-xs)] [height:var(--radio-size-xs)]`,
|
|
478
|
+
sm: `[width:var(--radio-size-sm)] [height:var(--radio-size-sm)]`,
|
|
479
|
+
md: `[width:var(--radio-size-md)] [height:var(--radio-size-md)]`,
|
|
480
|
+
lg: `[width:var(--radio-size-lg)] [height:var(--radio-size-lg)]`,
|
|
481
|
+
xl: `[width:var(--radio-size-xl)] [height:var(--radio-size-xl)]`
|
|
482
|
+
};
|
|
483
|
+
const labelSizeStyles = {
|
|
484
|
+
xs: `[font-size:var(--radio-label-font-size-xs)]`,
|
|
485
|
+
sm: `[font-size:var(--radio-label-font-size-sm)]`,
|
|
486
|
+
md: `[font-size:var(--radio-label-font-size-md)]`,
|
|
487
|
+
lg: `[font-size:var(--radio-label-font-size-lg)]`,
|
|
488
|
+
xl: `[font-size:var(--radio-label-font-size-xl)]`
|
|
489
|
+
};
|
|
490
|
+
const labelSpacingStyles = {
|
|
491
|
+
xs: `[margin-left:var(--radio-label-spacing-xs)]`,
|
|
492
|
+
sm: `[margin-left:var(--radio-label-spacing-sm)]`,
|
|
493
|
+
md: `[margin-left:var(--radio-label-spacing-md)]`,
|
|
494
|
+
lg: `[margin-left:var(--radio-label-spacing-lg)]`,
|
|
495
|
+
xl: `[margin-left:var(--radio-label-spacing-xl)]`
|
|
496
|
+
};
|
|
418
497
|
return /* @__PURE__ */ jsxs5("div", { className, children: [
|
|
419
498
|
label && /* @__PURE__ */ jsxs5("label", { className: "block text-sm font-semibold text-gray-600 mb-1", children: [
|
|
420
499
|
label,
|
|
@@ -441,7 +520,8 @@ function RadioGroup({
|
|
|
441
520
|
onChange: handleChange,
|
|
442
521
|
disabled: isDisabled,
|
|
443
522
|
className: cn(
|
|
444
|
-
|
|
523
|
+
sizeStyles[size],
|
|
524
|
+
"border-gray-400 text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
445
525
|
isDisabled && "cursor-not-allowed opacity-50"
|
|
446
526
|
)
|
|
447
527
|
}
|
|
@@ -451,7 +531,9 @@ function RadioGroup({
|
|
|
451
531
|
{
|
|
452
532
|
htmlFor: `${name}-${option.value}`,
|
|
453
533
|
className: cn(
|
|
454
|
-
|
|
534
|
+
labelSpacingStyles[size],
|
|
535
|
+
labelSizeStyles[size],
|
|
536
|
+
"font-medium text-gray-600",
|
|
455
537
|
isDisabled && "cursor-not-allowed opacity-50",
|
|
456
538
|
!isDisabled && "cursor-pointer"
|
|
457
539
|
),
|
|
@@ -480,6 +562,7 @@ function Dropdown({
|
|
|
480
562
|
error,
|
|
481
563
|
helperText,
|
|
482
564
|
required = false,
|
|
565
|
+
size = "md",
|
|
483
566
|
className = ""
|
|
484
567
|
}) {
|
|
485
568
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -489,6 +572,27 @@ function Dropdown({
|
|
|
489
572
|
const selected = options.find((opt) => opt.value === value);
|
|
490
573
|
return selected ? selected.label : placeholder;
|
|
491
574
|
};
|
|
575
|
+
const sizeStyles = {
|
|
576
|
+
xs: `[padding-left:var(--dropdown-padding-xs-x)] [padding-right:var(--dropdown-padding-xs-x)] [padding-top:var(--dropdown-padding-xs-y)] [padding-bottom:var(--dropdown-padding-xs-y)] [font-size:var(--dropdown-font-size-xs)]`,
|
|
577
|
+
sm: `[padding-left:var(--dropdown-padding-sm-x)] [padding-right:var(--dropdown-padding-sm-x)] [padding-top:var(--dropdown-padding-sm-y)] [padding-bottom:var(--dropdown-padding-sm-y)] [font-size:var(--dropdown-font-size-sm)]`,
|
|
578
|
+
md: `[padding-left:var(--dropdown-padding-md-x)] [padding-right:var(--dropdown-padding-md-x)] [padding-top:var(--dropdown-padding-md-y)] [padding-bottom:var(--dropdown-padding-md-y)] [font-size:var(--dropdown-font-size-md)]`,
|
|
579
|
+
lg: `[padding-left:var(--dropdown-padding-lg-x)] [padding-right:var(--dropdown-padding-lg-x)] [padding-top:var(--dropdown-padding-lg-y)] [padding-bottom:var(--dropdown-padding-lg-y)] [font-size:var(--dropdown-font-size-lg)]`,
|
|
580
|
+
xl: `[padding-left:var(--dropdown-padding-xl-x)] [padding-right:var(--dropdown-padding-xl-x)] [padding-top:var(--dropdown-padding-xl-y)] [padding-bottom:var(--dropdown-padding-xl-y)] [font-size:var(--dropdown-font-size-xl)]`
|
|
581
|
+
};
|
|
582
|
+
const iconSizeStyles = {
|
|
583
|
+
xs: `[width:var(--dropdown-icon-size-xs)] [height:var(--dropdown-icon-size-xs)]`,
|
|
584
|
+
sm: `[width:var(--dropdown-icon-size-sm)] [height:var(--dropdown-icon-size-sm)]`,
|
|
585
|
+
md: `[width:var(--dropdown-icon-size-md)] [height:var(--dropdown-icon-size-md)]`,
|
|
586
|
+
lg: `[width:var(--dropdown-icon-size-lg)] [height:var(--dropdown-icon-size-lg)]`,
|
|
587
|
+
xl: `[width:var(--dropdown-icon-size-xl)] [height:var(--dropdown-icon-size-xl)]`
|
|
588
|
+
};
|
|
589
|
+
const optionSizeStyles = {
|
|
590
|
+
xs: `[padding-left:var(--dropdown-option-padding-xs-x)] [padding-right:var(--dropdown-option-padding-xs-x)] [padding-top:var(--dropdown-option-padding-xs-y)] [padding-bottom:var(--dropdown-option-padding-xs-y)] [font-size:var(--dropdown-option-font-size-xs)]`,
|
|
591
|
+
sm: `[padding-left:var(--dropdown-option-padding-sm-x)] [padding-right:var(--dropdown-option-padding-sm-x)] [padding-top:var(--dropdown-option-padding-sm-y)] [padding-bottom:var(--dropdown-option-padding-sm-y)] [font-size:var(--dropdown-option-font-size-sm)]`,
|
|
592
|
+
md: `[padding-left:var(--dropdown-option-padding-md-x)] [padding-right:var(--dropdown-option-padding-md-x)] [padding-top:var(--dropdown-option-padding-md-y)] [padding-bottom:var(--dropdown-option-padding-md-y)] [font-size:var(--dropdown-option-font-size-md)]`,
|
|
593
|
+
lg: `[padding-left:var(--dropdown-option-padding-lg-x)] [padding-right:var(--dropdown-option-padding-lg-x)] [padding-top:var(--dropdown-option-padding-lg-y)] [padding-bottom:var(--dropdown-option-padding-lg-y)] [font-size:var(--dropdown-option-font-size-lg)]`,
|
|
594
|
+
xl: `[padding-left:var(--dropdown-option-padding-xl-x)] [padding-right:var(--dropdown-option-padding-xl-x)] [padding-top:var(--dropdown-option-padding-xl-y)] [padding-bottom:var(--dropdown-option-padding-xl-y)] [font-size:var(--dropdown-option-font-size-xl)]`
|
|
595
|
+
};
|
|
492
596
|
useEffect(() => {
|
|
493
597
|
const handleClickOutside = (event) => {
|
|
494
598
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
@@ -525,7 +629,7 @@ function Dropdown({
|
|
|
525
629
|
onKeyDown: handleKeyDown,
|
|
526
630
|
disabled,
|
|
527
631
|
className: `
|
|
528
|
-
w-full
|
|
632
|
+
w-full ${sizeStyles[size]} text-left bg-white border rounded-(--dropdown-radius)
|
|
529
633
|
flex items-center justify-between
|
|
530
634
|
transition-all duration-200
|
|
531
635
|
${error ? "border-red-500 focus:ring-2 focus:ring-red-200 focus:border-red-500" : "border-gray-400 focus:ring-2 focus:ring-blue-200 focus:border-blue-500"}
|
|
@@ -537,7 +641,7 @@ function Dropdown({
|
|
|
537
641
|
/* @__PURE__ */ jsx7(
|
|
538
642
|
ChevronDown,
|
|
539
643
|
{
|
|
540
|
-
className:
|
|
644
|
+
className: `${iconSizeStyles[size]} text-gray-400 transition-transform duration-200 shrink-0 ml-2 ${isOpen ? "transform rotate-180" : ""}`
|
|
541
645
|
}
|
|
542
646
|
)
|
|
543
647
|
]
|
|
@@ -560,7 +664,7 @@ function Dropdown({
|
|
|
560
664
|
onClick: () => !option.disabled && handleSelect(option.value),
|
|
561
665
|
disabled: option.disabled,
|
|
562
666
|
className: `
|
|
563
|
-
w-full
|
|
667
|
+
w-full ${optionSizeStyles[size]} text-left
|
|
564
668
|
transition-colors duration-150
|
|
565
669
|
${option.value === value ? "bg-blue-50 text-blue-700 font-medium" : "text-gray-900 hover:bg-gray-100"}
|
|
566
670
|
${option.disabled ? "opacity-50 cursor-not-allowed" : ""}
|
|
@@ -912,48 +1016,308 @@ function SectionLayout({
|
|
|
912
1016
|
] });
|
|
913
1017
|
}
|
|
914
1018
|
|
|
915
|
-
// src/layout/
|
|
916
|
-
import { useState as useState3 } from "react";
|
|
917
|
-
import { Menu, X } from "lucide-react";
|
|
1019
|
+
// src/layout/nav.tsx
|
|
1020
|
+
import React9, { useState as useState3, useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
1021
|
+
import { Menu, X, ChevronDown as ChevronDown2 } from "lucide-react";
|
|
918
1022
|
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1023
|
+
var Nav = React9.forwardRef(
|
|
1024
|
+
({
|
|
1025
|
+
className,
|
|
1026
|
+
items,
|
|
1027
|
+
variant = "primary",
|
|
1028
|
+
orientation = "horizontal",
|
|
1029
|
+
size = "md",
|
|
1030
|
+
mobileBreakpoint = "md",
|
|
1031
|
+
logo,
|
|
1032
|
+
actions,
|
|
1033
|
+
sticky = false,
|
|
1034
|
+
activeId,
|
|
1035
|
+
onItemClick,
|
|
1036
|
+
...props
|
|
1037
|
+
}, ref) => {
|
|
1038
|
+
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState3(false);
|
|
1039
|
+
const [openDropdownId, setOpenDropdownId] = useState3(null);
|
|
1040
|
+
const dropdownRef = useRef2(null);
|
|
1041
|
+
useEffect2(() => {
|
|
1042
|
+
function handleClickOutside(event) {
|
|
1043
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1044
|
+
setOpenDropdownId(null);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1048
|
+
return () => {
|
|
1049
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
1050
|
+
};
|
|
1051
|
+
}, []);
|
|
1052
|
+
useEffect2(() => {
|
|
1053
|
+
function handleEscape(event) {
|
|
1054
|
+
if (event.key === "Escape") {
|
|
1055
|
+
setIsMobileMenuOpen(false);
|
|
1056
|
+
setOpenDropdownId(null);
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
document.addEventListener("keydown", handleEscape);
|
|
1060
|
+
return () => {
|
|
1061
|
+
document.removeEventListener("keydown", handleEscape);
|
|
1062
|
+
};
|
|
1063
|
+
}, []);
|
|
1064
|
+
const baseStyles = cn(
|
|
1065
|
+
"bg-[var(--color-background)] border-b border-[var(--color-border)]",
|
|
1066
|
+
sticky && "sticky top-0 z-50"
|
|
1067
|
+
);
|
|
1068
|
+
const containerStyles = cn(
|
|
1069
|
+
"[min-height:var(--nav-height)]",
|
|
1070
|
+
"flex items-center justify-between",
|
|
1071
|
+
"px-[var(--spacing-lg)]"
|
|
1072
|
+
);
|
|
1073
|
+
const itemPaddingStyles = {
|
|
1074
|
+
xs: "[padding-left:var(--nav-item-padding-xs-x)] [padding-right:var(--nav-item-padding-xs-x)] [padding-top:var(--nav-item-padding-xs-y)] [padding-bottom:var(--nav-item-padding-xs-y)]",
|
|
1075
|
+
sm: "[padding-left:var(--nav-item-padding-sm-x)] [padding-right:var(--nav-item-padding-sm-x)] [padding-top:var(--nav-item-padding-sm-y)] [padding-bottom:var(--nav-item-padding-sm-y)]",
|
|
1076
|
+
md: "[padding-left:var(--nav-item-padding-md-x)] [padding-right:var(--nav-item-padding-md-x)] [padding-top:var(--nav-item-padding-md-y)] [padding-bottom:var(--nav-item-padding-md-y)]",
|
|
1077
|
+
lg: "[padding-left:var(--nav-item-padding-lg-x)] [padding-right:var(--nav-item-padding-lg-x)] [padding-top:var(--nav-item-padding-lg-y)] [padding-bottom:var(--nav-item-padding-lg-y)]",
|
|
1078
|
+
xl: "[padding-left:var(--nav-item-padding-xl-x)] [padding-right:var(--nav-item-padding-xl-x)] [padding-top:var(--nav-item-padding-xl-y)] [padding-bottom:var(--nav-item-padding-xl-y)]"
|
|
1079
|
+
};
|
|
1080
|
+
const fontSizeStyles = {
|
|
1081
|
+
xs: "[font-size:var(--nav-font-size-xs)]",
|
|
1082
|
+
sm: "[font-size:var(--nav-font-size-sm)]",
|
|
1083
|
+
md: "[font-size:var(--nav-font-size-md)]",
|
|
1084
|
+
lg: "[font-size:var(--nav-font-size-lg)]",
|
|
1085
|
+
xl: "[font-size:var(--nav-font-size-xl)]"
|
|
1086
|
+
};
|
|
1087
|
+
const variantItemStyles = {
|
|
1088
|
+
primary: "rounded-[var(--nav-border-radius)] hover:bg-blue-50 transition-colors",
|
|
1089
|
+
secondary: "rounded-[var(--nav-border-radius)] hover:bg-[var(--color-muted)] transition-colors",
|
|
1090
|
+
outline: cn(
|
|
1091
|
+
"rounded-[var(--nav-border-radius)] border border-[var(--color-border)] hover:bg-[var(--color-muted)] transition-colors"
|
|
1092
|
+
),
|
|
1093
|
+
ghost: "rounded-[var(--nav-border-radius)] hover:bg-[var(--color-muted)]/50 transition-colors"
|
|
1094
|
+
};
|
|
1095
|
+
const activeItemStyles = {
|
|
1096
|
+
primary: "bg-blue-100 text-blue-700",
|
|
1097
|
+
secondary: "bg-[var(--color-muted)] [font-weight:var(--font-semibold)]",
|
|
1098
|
+
outline: "border-blue-600 bg-blue-50 text-blue-700",
|
|
1099
|
+
ghost: "bg-[var(--color-muted)]"
|
|
1100
|
+
};
|
|
1101
|
+
const breakpointClasses = {
|
|
1102
|
+
sm: "sm:hidden",
|
|
1103
|
+
md: "md:hidden",
|
|
1104
|
+
lg: "lg:hidden"
|
|
1105
|
+
};
|
|
1106
|
+
const breakpointShowClasses = {
|
|
1107
|
+
sm: "hidden sm:flex",
|
|
1108
|
+
md: "hidden md:flex",
|
|
1109
|
+
lg: "hidden lg:flex"
|
|
1110
|
+
};
|
|
1111
|
+
const handleItemClick = (item) => {
|
|
1112
|
+
if (item.disabled) return;
|
|
1113
|
+
if (item.type === "dropdown") {
|
|
1114
|
+
setOpenDropdownId(openDropdownId === item.id ? null : item.id);
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
if (item.onClick) {
|
|
1118
|
+
item.onClick();
|
|
1119
|
+
}
|
|
1120
|
+
if (onItemClick) {
|
|
1121
|
+
onItemClick(item);
|
|
1122
|
+
}
|
|
1123
|
+
setIsMobileMenuOpen(false);
|
|
1124
|
+
setOpenDropdownId(null);
|
|
1125
|
+
};
|
|
1126
|
+
const renderNavItem = (item, isMobile = false) => {
|
|
1127
|
+
if (item.type === "divider") {
|
|
1128
|
+
return /* @__PURE__ */ jsx13(
|
|
1129
|
+
"div",
|
|
1130
|
+
{
|
|
1131
|
+
className: cn(
|
|
1132
|
+
orientation === "horizontal" && !isMobile && "h-6 border-l border-[var(--color-border)] mx-2",
|
|
1133
|
+
(orientation === "vertical" || isMobile) && "w-full h-0 border-t border-[var(--color-border)] my-2"
|
|
1134
|
+
)
|
|
1135
|
+
},
|
|
1136
|
+
item.id
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
if (item.type === "custom" && item.render) {
|
|
1140
|
+
return /* @__PURE__ */ jsx13("div", { children: item.render() }, item.id);
|
|
1141
|
+
}
|
|
1142
|
+
const isActive = activeId === item.id;
|
|
1143
|
+
const isDropdownOpen = openDropdownId === item.id;
|
|
1144
|
+
const hasChildren = item.children && item.children.length > 0;
|
|
1145
|
+
const itemBaseStyles = cn(
|
|
1146
|
+
"flex items-center [gap:var(--nav-gap)] font-medium text-[var(--color-foreground)] cursor-pointer select-none",
|
|
1147
|
+
itemPaddingStyles[size],
|
|
1148
|
+
fontSizeStyles[size],
|
|
1149
|
+
variantItemStyles[variant],
|
|
1150
|
+
isActive && activeItemStyles[variant],
|
|
1151
|
+
orientation === "vertical" && "w-full",
|
|
1152
|
+
item.disabled && "opacity-50 cursor-not-allowed"
|
|
1153
|
+
);
|
|
1154
|
+
const content = /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
1155
|
+
item.icon && /* @__PURE__ */ jsx13("span", { className: "flex-shrink-0", children: item.icon }),
|
|
1156
|
+
/* @__PURE__ */ jsx13("span", { children: item.label }),
|
|
1157
|
+
item.badge && /* @__PURE__ */ jsx13("span", { className: "ml-auto px-2 py-0.5 [font-size:var(--text-xs)] font-semibold bg-red-500 text-white rounded-[var(--radius-full)]", children: item.badge }),
|
|
1158
|
+
hasChildren && /* @__PURE__ */ jsx13(
|
|
1159
|
+
ChevronDown2,
|
|
1160
|
+
{
|
|
1161
|
+
className: cn(
|
|
1162
|
+
"w-4 h-4 transition-transform",
|
|
1163
|
+
isDropdownOpen && "rotate-180"
|
|
1164
|
+
)
|
|
1165
|
+
}
|
|
1166
|
+
)
|
|
1167
|
+
] });
|
|
1168
|
+
if (hasChildren) {
|
|
1169
|
+
return /* @__PURE__ */ jsxs11("div", { className: "relative", ref: dropdownRef, children: [
|
|
1170
|
+
/* @__PURE__ */ jsx13(
|
|
1171
|
+
"button",
|
|
1172
|
+
{
|
|
1173
|
+
onClick: () => handleItemClick(item),
|
|
1174
|
+
className: itemBaseStyles,
|
|
1175
|
+
disabled: item.disabled,
|
|
1176
|
+
children: content
|
|
1177
|
+
}
|
|
1178
|
+
),
|
|
1179
|
+
isDropdownOpen && /* @__PURE__ */ jsx13(
|
|
1180
|
+
"div",
|
|
1181
|
+
{
|
|
1182
|
+
className: cn(
|
|
1183
|
+
"absolute left-0 mt-[var(--nav-gap)] min-w-[200px] bg-[var(--color-background)] border border-[var(--color-border)] rounded-[var(--nav-border-radius)] shadow-lg z-50",
|
|
1184
|
+
orientation === "vertical" && "left-full top-0 ml-2 mt-0"
|
|
1185
|
+
),
|
|
1186
|
+
children: /* @__PURE__ */ jsx13("div", { className: "py-1", children: item.children.map((child) => /* @__PURE__ */ jsxs11(
|
|
1187
|
+
"button",
|
|
1188
|
+
{
|
|
1189
|
+
onClick: () => handleItemClick(child),
|
|
1190
|
+
disabled: child.disabled,
|
|
1191
|
+
className: cn(
|
|
1192
|
+
"w-full flex items-center gap-2 px-4 py-2 [font-size:var(--text-sm)] text-[var(--color-foreground)] hover:bg-[var(--color-muted)] transition-colors",
|
|
1193
|
+
child.disabled && "opacity-50 cursor-not-allowed",
|
|
1194
|
+
activeId === child.id && "bg-[var(--color-muted)] [font-weight:var(--font-semibold)]"
|
|
1195
|
+
),
|
|
1196
|
+
children: [
|
|
1197
|
+
child.icon && /* @__PURE__ */ jsx13("span", { className: "flex-shrink-0", children: child.icon }),
|
|
1198
|
+
/* @__PURE__ */ jsx13("span", { children: child.label }),
|
|
1199
|
+
child.badge && /* @__PURE__ */ jsx13("span", { className: "ml-auto px-2 py-0.5 [font-size:var(--text-xs)] font-semibold bg-red-500 text-white rounded-[var(--radius-full)]", children: child.badge })
|
|
1200
|
+
]
|
|
1201
|
+
},
|
|
1202
|
+
child.id
|
|
1203
|
+
)) })
|
|
1204
|
+
}
|
|
1205
|
+
)
|
|
1206
|
+
] }, item.id);
|
|
1207
|
+
}
|
|
1208
|
+
if (item.href) {
|
|
1209
|
+
return /* @__PURE__ */ jsx13(
|
|
1210
|
+
"a",
|
|
1211
|
+
{
|
|
1212
|
+
href: item.href,
|
|
1213
|
+
target: item.target,
|
|
1214
|
+
onClick: () => handleItemClick(item),
|
|
1215
|
+
className: itemBaseStyles,
|
|
1216
|
+
children: content
|
|
1217
|
+
},
|
|
1218
|
+
item.id
|
|
1219
|
+
);
|
|
1220
|
+
}
|
|
1221
|
+
return /* @__PURE__ */ jsx13(
|
|
1222
|
+
"button",
|
|
1223
|
+
{
|
|
1224
|
+
onClick: () => handleItemClick(item),
|
|
1225
|
+
disabled: item.disabled,
|
|
1226
|
+
className: itemBaseStyles,
|
|
1227
|
+
children: content
|
|
1228
|
+
},
|
|
1229
|
+
item.id
|
|
1230
|
+
);
|
|
1231
|
+
};
|
|
1232
|
+
const desktopNav = /* @__PURE__ */ jsx13(
|
|
1233
|
+
"div",
|
|
1234
|
+
{
|
|
1235
|
+
className: cn(
|
|
1236
|
+
"items-center [gap:var(--nav-gap)]",
|
|
1237
|
+
breakpointShowClasses[mobileBreakpoint],
|
|
1238
|
+
orientation === "horizontal" ? "flex flex-row" : "flex flex-col"
|
|
1239
|
+
),
|
|
1240
|
+
children: items.map((item) => renderNavItem(item))
|
|
1241
|
+
}
|
|
1242
|
+
);
|
|
1243
|
+
const mobileNav = /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
1244
|
+
/* @__PURE__ */ jsx13(
|
|
1245
|
+
"button",
|
|
1246
|
+
{
|
|
1247
|
+
onClick: () => setIsMobileMenuOpen(!isMobileMenuOpen),
|
|
1248
|
+
className: cn(
|
|
1249
|
+
"p-2 text-[var(--color-foreground)] hover:bg-[var(--color-muted)] rounded-[var(--nav-border-radius)] transition-colors",
|
|
1250
|
+
breakpointClasses[mobileBreakpoint]
|
|
1251
|
+
),
|
|
1252
|
+
"aria-label": "Toggle menu",
|
|
1253
|
+
children: isMobileMenuOpen ? /* @__PURE__ */ jsx13(X, { className: "w-6 h-6" }) : /* @__PURE__ */ jsx13(Menu, { className: "w-6 h-6" })
|
|
1254
|
+
}
|
|
1255
|
+
),
|
|
1256
|
+
isMobileMenuOpen && /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
1257
|
+
/* @__PURE__ */ jsx13(
|
|
1258
|
+
"div",
|
|
1259
|
+
{
|
|
1260
|
+
className: "fixed inset-0 bg-black/20 z-40",
|
|
1261
|
+
onClick: () => setIsMobileMenuOpen(false)
|
|
1262
|
+
}
|
|
1263
|
+
),
|
|
1264
|
+
/* @__PURE__ */ jsx13("div", { className: "fixed top-[var(--nav-height)] left-0 right-0 bg-[var(--color-background)] border-b border-[var(--color-border)] shadow-lg z-50 max-h-[calc(100vh-var(--nav-height))] overflow-y-auto", children: /* @__PURE__ */ jsx13("div", { className: "flex flex-col py-2", children: items.map((item) => renderNavItem(item, true)) }) })
|
|
1265
|
+
] })
|
|
1266
|
+
] });
|
|
1267
|
+
return /* @__PURE__ */ jsx13("nav", { ref, className: cn(baseStyles, className), ...props, children: /* @__PURE__ */ jsxs11("div", { className: containerStyles, children: [
|
|
1268
|
+
logo && /* @__PURE__ */ jsx13("div", { className: "flex-shrink-0", children: logo }),
|
|
1269
|
+
desktopNav,
|
|
1270
|
+
actions && /* @__PURE__ */ jsx13("div", { className: "flex-shrink-0 flex items-center gap-2", children: actions }),
|
|
1271
|
+
mobileNav
|
|
1272
|
+
] }) });
|
|
1273
|
+
}
|
|
1274
|
+
);
|
|
1275
|
+
Nav.displayName = "Nav";
|
|
1276
|
+
|
|
1277
|
+
// src/layout/sidebar-nav.tsx
|
|
1278
|
+
import { useState as useState4 } from "react";
|
|
1279
|
+
import { Menu as Menu2, X as X2 } from "lucide-react";
|
|
1280
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
919
1281
|
function SidebarNav({
|
|
920
1282
|
title,
|
|
921
1283
|
subtitle,
|
|
922
1284
|
items,
|
|
1285
|
+
sections,
|
|
923
1286
|
activeItem,
|
|
924
1287
|
onItemClick,
|
|
925
1288
|
footer,
|
|
926
1289
|
position = "right"
|
|
927
1290
|
}) {
|
|
928
|
-
const [mobileMenuOpen, setMobileMenuOpen] =
|
|
1291
|
+
const [mobileMenuOpen, setMobileMenuOpen] = useState4(false);
|
|
929
1292
|
const isLeft = position === "left";
|
|
930
1293
|
const handleItemClick = (itemId) => {
|
|
931
1294
|
onItemClick(itemId);
|
|
932
1295
|
setMobileMenuOpen(false);
|
|
933
1296
|
};
|
|
934
|
-
|
|
935
|
-
|
|
1297
|
+
const useSections = sections || (items ? [{ title: "", items }] : []);
|
|
1298
|
+
return /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
1299
|
+
/* @__PURE__ */ jsx14("div", { className: "lg:hidden fixed top-0 left-0 right-0 z-50 bg-white border-b border-gray-200 px-4 py-3", children: /* @__PURE__ */ jsxs12(
|
|
936
1300
|
"div",
|
|
937
1301
|
{
|
|
938
1302
|
className: `flex items-center ${isLeft ? "justify-between" : "justify-between flex-row-reverse"}`,
|
|
939
1303
|
children: [
|
|
940
|
-
/* @__PURE__ */
|
|
1304
|
+
/* @__PURE__ */ jsx14(
|
|
941
1305
|
"button",
|
|
942
1306
|
{
|
|
943
1307
|
onClick: () => setMobileMenuOpen(!mobileMenuOpen),
|
|
944
1308
|
className: "p-2 rounded-lg hover:bg-gray-100 transition-colors",
|
|
945
1309
|
"aria-label": "Toggle menu",
|
|
946
|
-
children: mobileMenuOpen ? /* @__PURE__ */
|
|
1310
|
+
children: mobileMenuOpen ? /* @__PURE__ */ jsx14(X2, { className: "w-6 h-6 text-gray-700" }) : /* @__PURE__ */ jsx14(Menu2, { className: "w-6 h-6 text-gray-700" })
|
|
947
1311
|
}
|
|
948
1312
|
),
|
|
949
|
-
/* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
951
|
-
subtitle && /* @__PURE__ */
|
|
1313
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
1314
|
+
/* @__PURE__ */ jsx14("h1", { className: "text-lg font-bold text-gray-900", children: title }),
|
|
1315
|
+
subtitle && /* @__PURE__ */ jsx14("p", { className: "text-xs text-gray-500", children: subtitle })
|
|
952
1316
|
] })
|
|
953
1317
|
]
|
|
954
1318
|
}
|
|
955
1319
|
) }),
|
|
956
|
-
mobileMenuOpen && /* @__PURE__ */
|
|
1320
|
+
mobileMenuOpen && /* @__PURE__ */ jsx14(
|
|
957
1321
|
"div",
|
|
958
1322
|
{
|
|
959
1323
|
className: "fixed inset-0 bg-black/50 lg:hidden",
|
|
@@ -961,7 +1325,7 @@ function SidebarNav({
|
|
|
961
1325
|
onClick: () => setMobileMenuOpen(false)
|
|
962
1326
|
}
|
|
963
1327
|
),
|
|
964
|
-
/* @__PURE__ */
|
|
1328
|
+
/* @__PURE__ */ jsxs12(
|
|
965
1329
|
"aside",
|
|
966
1330
|
{
|
|
967
1331
|
className: `
|
|
@@ -972,26 +1336,29 @@ function SidebarNav({
|
|
|
972
1336
|
${mobileMenuOpen ? "translate-x-0" : `${isLeft ? "-translate-x-full" : "translate-x-full"} lg:translate-x-0`}
|
|
973
1337
|
`,
|
|
974
1338
|
children: [
|
|
975
|
-
/* @__PURE__ */
|
|
976
|
-
/* @__PURE__ */
|
|
977
|
-
subtitle && /* @__PURE__ */
|
|
1339
|
+
/* @__PURE__ */ jsxs12("div", { className: "hidden lg:block p-6 border-b border-gray-200", children: [
|
|
1340
|
+
/* @__PURE__ */ jsx14("h1", { className: "text-xl font-bold text-gray-900", children: title }),
|
|
1341
|
+
subtitle && /* @__PURE__ */ jsx14("p", { className: "text-xs text-gray-500 mt-1", children: subtitle })
|
|
978
1342
|
] }),
|
|
979
|
-
/* @__PURE__ */
|
|
980
|
-
/* @__PURE__ */
|
|
981
|
-
"
|
|
982
|
-
{
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1343
|
+
/* @__PURE__ */ jsx14("div", { className: "lg:hidden h-[57px]", "aria-hidden": "true" }),
|
|
1344
|
+
/* @__PURE__ */ jsx14("nav", { className: "p-4", children: useSections.map((section, sectionIndex) => /* @__PURE__ */ jsxs12("div", { className: sectionIndex > 0 ? "mt-6" : "", children: [
|
|
1345
|
+
section.title && /* @__PURE__ */ jsx14("h3", { className: "px-4 mb-2 text-xs font-semibold text-gray-500 uppercase tracking-wider", children: section.title }),
|
|
1346
|
+
/* @__PURE__ */ jsx14("ul", { className: "space-y-1", children: section.items.map((item) => /* @__PURE__ */ jsx14("li", { children: /* @__PURE__ */ jsxs12(
|
|
1347
|
+
"button",
|
|
1348
|
+
{
|
|
1349
|
+
onClick: () => handleItemClick(item.id),
|
|
1350
|
+
className: `
|
|
1351
|
+
w-full flex items-center gap-3 px-4 py-3 rounded-lg text-sm font-medium transition-colors
|
|
1352
|
+
${activeItem === item.id ? "bg-blue-50 text-blue-700" : "text-gray-700 hover:bg-gray-50"}
|
|
1353
|
+
`,
|
|
1354
|
+
children: [
|
|
1355
|
+
item.icon && /* @__PURE__ */ jsx14("span", { className: "shrink-0", children: item.icon }),
|
|
1356
|
+
/* @__PURE__ */ jsx14("span", { children: item.label })
|
|
1357
|
+
]
|
|
1358
|
+
}
|
|
1359
|
+
) }, item.id)) })
|
|
1360
|
+
] }, sectionIndex)) }),
|
|
1361
|
+
footer && /* @__PURE__ */ jsx14("div", { className: "p-4 border-t border-gray-200 mt-auto", children: footer })
|
|
995
1362
|
]
|
|
996
1363
|
}
|
|
997
1364
|
)
|
|
@@ -999,11 +1366,11 @@ function SidebarNav({
|
|
|
999
1366
|
}
|
|
1000
1367
|
|
|
1001
1368
|
// src/shared/empty-state.tsx
|
|
1002
|
-
import
|
|
1003
|
-
import { jsx as
|
|
1004
|
-
var EmptyState =
|
|
1369
|
+
import React11 from "react";
|
|
1370
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1371
|
+
var EmptyState = React11.forwardRef(
|
|
1005
1372
|
({ className, icon, title, description, action, ...props }, ref) => {
|
|
1006
|
-
return /* @__PURE__ */
|
|
1373
|
+
return /* @__PURE__ */ jsxs13(
|
|
1007
1374
|
"div",
|
|
1008
1375
|
{
|
|
1009
1376
|
ref,
|
|
@@ -1013,16 +1380,457 @@ var EmptyState = React10.forwardRef(
|
|
|
1013
1380
|
),
|
|
1014
1381
|
...props,
|
|
1015
1382
|
children: [
|
|
1016
|
-
icon && /* @__PURE__ */
|
|
1017
|
-
/* @__PURE__ */
|
|
1018
|
-
description && /* @__PURE__ */
|
|
1019
|
-
action && /* @__PURE__ */
|
|
1383
|
+
icon && /* @__PURE__ */ jsx15("div", { className: "mb-4 text-gray-400", children: icon }),
|
|
1384
|
+
/* @__PURE__ */ jsx15("h3", { className: "text-lg font-semibold text-gray-900 mb-2", children: title }),
|
|
1385
|
+
description && /* @__PURE__ */ jsx15("p", { className: "text-sm text-gray-500 mb-6 max-w-sm", children: description }),
|
|
1386
|
+
action && /* @__PURE__ */ jsx15("div", { children: action })
|
|
1020
1387
|
]
|
|
1021
1388
|
}
|
|
1022
1389
|
);
|
|
1023
1390
|
}
|
|
1024
1391
|
);
|
|
1025
1392
|
EmptyState.displayName = "EmptyState";
|
|
1393
|
+
|
|
1394
|
+
// src/shared/contexts/ThemeContext.tsx
|
|
1395
|
+
import {
|
|
1396
|
+
createContext,
|
|
1397
|
+
useContext,
|
|
1398
|
+
useState as useState5,
|
|
1399
|
+
useEffect as useEffect3
|
|
1400
|
+
} from "react";
|
|
1401
|
+
|
|
1402
|
+
// src/styles/themes/default.json
|
|
1403
|
+
var default_default = {
|
|
1404
|
+
name: "Default Theme",
|
|
1405
|
+
version: "1.0.0",
|
|
1406
|
+
colors: {
|
|
1407
|
+
primary: {
|
|
1408
|
+
"50": "#eff6ff",
|
|
1409
|
+
"100": "#dbeafe",
|
|
1410
|
+
"200": "#bfdbfe",
|
|
1411
|
+
"300": "#93c5fd",
|
|
1412
|
+
"400": "#60a5fa",
|
|
1413
|
+
"500": "#3b82f6",
|
|
1414
|
+
"600": "#2563eb",
|
|
1415
|
+
"700": "#1d4ed8",
|
|
1416
|
+
"800": "#1e40af",
|
|
1417
|
+
"900": "#1e3a8a"
|
|
1418
|
+
},
|
|
1419
|
+
secondary: {
|
|
1420
|
+
"50": "#f8fafc",
|
|
1421
|
+
"100": "#f1f5f9",
|
|
1422
|
+
"200": "#e2e8f0",
|
|
1423
|
+
"300": "#cbd5e1",
|
|
1424
|
+
"400": "#94a3b8",
|
|
1425
|
+
"500": "#64748b",
|
|
1426
|
+
"600": "#475569",
|
|
1427
|
+
"700": "#334155",
|
|
1428
|
+
"800": "#1e293b",
|
|
1429
|
+
"900": "#0f172a"
|
|
1430
|
+
},
|
|
1431
|
+
success: "#10b981",
|
|
1432
|
+
error: "#ef4444",
|
|
1433
|
+
warning: "#f59e0b",
|
|
1434
|
+
info: "#3b82f6",
|
|
1435
|
+
gray: {
|
|
1436
|
+
"50": "#f9fafb",
|
|
1437
|
+
"100": "#f3f4f6",
|
|
1438
|
+
"200": "#e5e7eb",
|
|
1439
|
+
"300": "#d1d5db",
|
|
1440
|
+
"400": "#9ca3af",
|
|
1441
|
+
"500": "#6b7280",
|
|
1442
|
+
"600": "#4b5563",
|
|
1443
|
+
"700": "#374151",
|
|
1444
|
+
"800": "#1f2937",
|
|
1445
|
+
"900": "#111827"
|
|
1446
|
+
},
|
|
1447
|
+
background: "#ffffff",
|
|
1448
|
+
foreground: "#111827",
|
|
1449
|
+
muted: "#f3f4f6",
|
|
1450
|
+
mutedForeground: "#6b7280"
|
|
1451
|
+
},
|
|
1452
|
+
spacing: {
|
|
1453
|
+
xs: "0.25rem",
|
|
1454
|
+
sm: "0.5rem",
|
|
1455
|
+
md: "1rem",
|
|
1456
|
+
lg: "1.5rem",
|
|
1457
|
+
xl: "2rem",
|
|
1458
|
+
"2xl": "3rem"
|
|
1459
|
+
},
|
|
1460
|
+
borderRadius: {
|
|
1461
|
+
none: "0",
|
|
1462
|
+
sm: "0.25rem",
|
|
1463
|
+
md: "0.5rem",
|
|
1464
|
+
lg: "0.75rem",
|
|
1465
|
+
xl: "1rem",
|
|
1466
|
+
full: "9999px"
|
|
1467
|
+
},
|
|
1468
|
+
typography: {
|
|
1469
|
+
fontFamily: {
|
|
1470
|
+
sans: [
|
|
1471
|
+
"Inter",
|
|
1472
|
+
"system-ui",
|
|
1473
|
+
"-apple-system",
|
|
1474
|
+
"BlinkMacSystemFont",
|
|
1475
|
+
"Segoe UI",
|
|
1476
|
+
"Roboto",
|
|
1477
|
+
"Helvetica Neue",
|
|
1478
|
+
"Arial",
|
|
1479
|
+
"sans-serif"
|
|
1480
|
+
],
|
|
1481
|
+
mono: [
|
|
1482
|
+
"Monaco",
|
|
1483
|
+
"Consolas",
|
|
1484
|
+
"Liberation Mono",
|
|
1485
|
+
"Courier New",
|
|
1486
|
+
"monospace"
|
|
1487
|
+
]
|
|
1488
|
+
},
|
|
1489
|
+
fontSize: {
|
|
1490
|
+
xs: "0.75rem",
|
|
1491
|
+
sm: "0.875rem",
|
|
1492
|
+
base: "1rem",
|
|
1493
|
+
lg: "1.125rem",
|
|
1494
|
+
xl: "1.25rem",
|
|
1495
|
+
"2xl": "1.5rem",
|
|
1496
|
+
"3xl": "1.875rem"
|
|
1497
|
+
},
|
|
1498
|
+
fontWeight: {
|
|
1499
|
+
normal: "400",
|
|
1500
|
+
medium: "500",
|
|
1501
|
+
semibold: "600",
|
|
1502
|
+
bold: "700"
|
|
1503
|
+
}
|
|
1504
|
+
},
|
|
1505
|
+
components: {
|
|
1506
|
+
button: {
|
|
1507
|
+
padding: {
|
|
1508
|
+
xs: { x: "0.5rem", y: "0.375rem" },
|
|
1509
|
+
sm: { x: "0.75rem", y: "0.5rem" },
|
|
1510
|
+
md: { x: "1rem", y: "0.625rem" },
|
|
1511
|
+
lg: { x: "1.25rem", y: "0.75rem" },
|
|
1512
|
+
xl: { x: "1.5rem", y: "0.875rem" }
|
|
1513
|
+
},
|
|
1514
|
+
fontSize: {
|
|
1515
|
+
xs: "0.75rem",
|
|
1516
|
+
sm: "0.875rem",
|
|
1517
|
+
md: "1rem",
|
|
1518
|
+
lg: "1.125rem",
|
|
1519
|
+
xl: "1.25rem"
|
|
1520
|
+
},
|
|
1521
|
+
borderRadius: "0.5rem",
|
|
1522
|
+
fontWeight: "500"
|
|
1523
|
+
},
|
|
1524
|
+
card: {
|
|
1525
|
+
padding: {
|
|
1526
|
+
none: "0",
|
|
1527
|
+
sm: "0.75rem",
|
|
1528
|
+
md: "1rem",
|
|
1529
|
+
lg: "1.5rem"
|
|
1530
|
+
},
|
|
1531
|
+
borderRadius: "0.75rem",
|
|
1532
|
+
borderWidth: "1px",
|
|
1533
|
+
shadow: {
|
|
1534
|
+
flat: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
1535
|
+
elevated: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"
|
|
1536
|
+
}
|
|
1537
|
+
},
|
|
1538
|
+
input: {
|
|
1539
|
+
padding: {
|
|
1540
|
+
xs: "0.375rem 0.5rem",
|
|
1541
|
+
sm: "0.5rem 0.75rem",
|
|
1542
|
+
md: "0.625rem 1rem",
|
|
1543
|
+
lg: "0.75rem 1.25rem",
|
|
1544
|
+
xl: "0.875rem 1.5rem"
|
|
1545
|
+
},
|
|
1546
|
+
fontSize: {
|
|
1547
|
+
xs: "0.75rem",
|
|
1548
|
+
sm: "0.875rem",
|
|
1549
|
+
md: "1rem",
|
|
1550
|
+
lg: "1.125rem",
|
|
1551
|
+
xl: "1.25rem"
|
|
1552
|
+
},
|
|
1553
|
+
borderRadius: "0.5rem",
|
|
1554
|
+
borderWidth: "1px"
|
|
1555
|
+
},
|
|
1556
|
+
checkbox: {
|
|
1557
|
+
size: {
|
|
1558
|
+
xs: "0.75rem",
|
|
1559
|
+
sm: "0.875rem",
|
|
1560
|
+
md: "1rem",
|
|
1561
|
+
lg: "1.25rem",
|
|
1562
|
+
xl: "1.5rem"
|
|
1563
|
+
},
|
|
1564
|
+
labelSpacing: {
|
|
1565
|
+
xs: "0.25rem",
|
|
1566
|
+
sm: "0.375rem",
|
|
1567
|
+
md: "0.5rem",
|
|
1568
|
+
lg: "0.625rem",
|
|
1569
|
+
xl: "0.75rem"
|
|
1570
|
+
},
|
|
1571
|
+
labelFontSize: {
|
|
1572
|
+
xs: "0.625rem",
|
|
1573
|
+
sm: "0.75rem",
|
|
1574
|
+
md: "0.875rem",
|
|
1575
|
+
lg: "1rem",
|
|
1576
|
+
xl: "1.125rem"
|
|
1577
|
+
},
|
|
1578
|
+
borderRadius: "0.25rem"
|
|
1579
|
+
},
|
|
1580
|
+
radio: {
|
|
1581
|
+
size: {
|
|
1582
|
+
xs: "0.75rem",
|
|
1583
|
+
sm: "0.875rem",
|
|
1584
|
+
md: "1rem",
|
|
1585
|
+
lg: "1.25rem",
|
|
1586
|
+
xl: "1.5rem"
|
|
1587
|
+
},
|
|
1588
|
+
labelSpacing: {
|
|
1589
|
+
xs: "0.25rem",
|
|
1590
|
+
sm: "0.375rem",
|
|
1591
|
+
md: "0.5rem",
|
|
1592
|
+
lg: "0.625rem",
|
|
1593
|
+
xl: "0.75rem"
|
|
1594
|
+
},
|
|
1595
|
+
labelFontSize: {
|
|
1596
|
+
xs: "0.625rem",
|
|
1597
|
+
sm: "0.75rem",
|
|
1598
|
+
md: "0.875rem",
|
|
1599
|
+
lg: "1rem",
|
|
1600
|
+
xl: "1.125rem"
|
|
1601
|
+
}
|
|
1602
|
+
},
|
|
1603
|
+
dropdown: {
|
|
1604
|
+
padding: {
|
|
1605
|
+
xs: { x: "0.5rem", y: "0.25rem" },
|
|
1606
|
+
sm: { x: "0.75rem", y: "0.375rem" },
|
|
1607
|
+
md: { x: "1rem", y: "0.5rem" },
|
|
1608
|
+
lg: { x: "1.25rem", y: "0.625rem" },
|
|
1609
|
+
xl: { x: "1.5rem", y: "0.75rem" }
|
|
1610
|
+
},
|
|
1611
|
+
fontSize: {
|
|
1612
|
+
xs: "0.75rem",
|
|
1613
|
+
sm: "0.875rem",
|
|
1614
|
+
md: "1rem",
|
|
1615
|
+
lg: "1.125rem",
|
|
1616
|
+
xl: "1.25rem"
|
|
1617
|
+
},
|
|
1618
|
+
iconSize: {
|
|
1619
|
+
xs: "0.875rem",
|
|
1620
|
+
sm: "1rem",
|
|
1621
|
+
md: "1.25rem",
|
|
1622
|
+
lg: "1.5rem",
|
|
1623
|
+
xl: "1.75rem"
|
|
1624
|
+
},
|
|
1625
|
+
optionPadding: {
|
|
1626
|
+
xs: { x: "0.5rem", y: "0.25rem" },
|
|
1627
|
+
sm: { x: "0.75rem", y: "0.375rem" },
|
|
1628
|
+
md: { x: "1rem", y: "0.5rem" },
|
|
1629
|
+
lg: { x: "1.25rem", y: "0.625rem" },
|
|
1630
|
+
xl: { x: "1.5rem", y: "0.75rem" }
|
|
1631
|
+
},
|
|
1632
|
+
optionFontSize: {
|
|
1633
|
+
xs: "0.625rem",
|
|
1634
|
+
sm: "0.75rem",
|
|
1635
|
+
md: "0.875rem",
|
|
1636
|
+
lg: "1rem",
|
|
1637
|
+
xl: "1.125rem"
|
|
1638
|
+
},
|
|
1639
|
+
borderRadius: "0.5rem",
|
|
1640
|
+
borderWidth: "1px"
|
|
1641
|
+
},
|
|
1642
|
+
nav: {
|
|
1643
|
+
height: "4rem",
|
|
1644
|
+
itemPadding: {
|
|
1645
|
+
xs: { x: "0.375rem", y: "0.25rem" },
|
|
1646
|
+
sm: { x: "0.5rem", y: "0.375rem" },
|
|
1647
|
+
md: { x: "0.75rem", y: "0.5rem" },
|
|
1648
|
+
lg: { x: "1rem", y: "0.625rem" },
|
|
1649
|
+
xl: { x: "1.25rem", y: "0.75rem" }
|
|
1650
|
+
},
|
|
1651
|
+
fontSize: {
|
|
1652
|
+
xs: "0.625rem",
|
|
1653
|
+
sm: "0.75rem",
|
|
1654
|
+
md: "0.875rem",
|
|
1655
|
+
lg: "1rem",
|
|
1656
|
+
xl: "1.125rem"
|
|
1657
|
+
},
|
|
1658
|
+
borderRadius: "0.375rem",
|
|
1659
|
+
gap: "0.25rem"
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
};
|
|
1663
|
+
|
|
1664
|
+
// src/shared/contexts/ThemeContext.tsx
|
|
1665
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1666
|
+
var ThemeContext = createContext(void 0);
|
|
1667
|
+
function ThemeProvider({ children }) {
|
|
1668
|
+
const [theme, setThemeState] = useState5(default_default);
|
|
1669
|
+
const applyTheme = (newTheme) => {
|
|
1670
|
+
const root = document.documentElement;
|
|
1671
|
+
const colors = newTheme.colors;
|
|
1672
|
+
Object.entries(colors.primary).forEach(([shade, value]) => {
|
|
1673
|
+
if (value) {
|
|
1674
|
+
root.style.setProperty(`--color-primary-${shade}`, value);
|
|
1675
|
+
}
|
|
1676
|
+
});
|
|
1677
|
+
Object.entries(colors.secondary).forEach(([shade, value]) => {
|
|
1678
|
+
if (value) {
|
|
1679
|
+
root.style.setProperty(`--color-secondary-${shade}`, value);
|
|
1680
|
+
}
|
|
1681
|
+
});
|
|
1682
|
+
root.style.setProperty("--color-success", colors.success);
|
|
1683
|
+
root.style.setProperty("--color-error", colors.error);
|
|
1684
|
+
root.style.setProperty("--color-warning", colors.warning);
|
|
1685
|
+
root.style.setProperty("--color-info", colors.info);
|
|
1686
|
+
Object.entries(colors.gray).forEach(([shade, value]) => {
|
|
1687
|
+
if (value) {
|
|
1688
|
+
root.style.setProperty(`--color-gray-${shade}`, value);
|
|
1689
|
+
}
|
|
1690
|
+
});
|
|
1691
|
+
root.style.setProperty("--color-background", colors.background);
|
|
1692
|
+
root.style.setProperty("--color-foreground", colors.foreground);
|
|
1693
|
+
root.style.setProperty("--color-muted", colors.muted);
|
|
1694
|
+
root.style.setProperty("--color-muted-foreground", colors.mutedForeground);
|
|
1695
|
+
Object.entries(newTheme.spacing).forEach(([key, value]) => {
|
|
1696
|
+
root.style.setProperty(`--spacing-${key}`, value);
|
|
1697
|
+
});
|
|
1698
|
+
Object.entries(newTheme.borderRadius).forEach(([key, value]) => {
|
|
1699
|
+
root.style.setProperty(`--radius-${key}`, value);
|
|
1700
|
+
});
|
|
1701
|
+
const { typography } = newTheme;
|
|
1702
|
+
root.style.setProperty(
|
|
1703
|
+
"--font-sans",
|
|
1704
|
+
typography.fontFamily.sans.join(", ")
|
|
1705
|
+
);
|
|
1706
|
+
root.style.setProperty(
|
|
1707
|
+
"--font-mono",
|
|
1708
|
+
typography.fontFamily.mono.join(", ")
|
|
1709
|
+
);
|
|
1710
|
+
Object.entries(typography.fontSize).forEach(([key, value]) => {
|
|
1711
|
+
root.style.setProperty(`--text-${key}`, value);
|
|
1712
|
+
});
|
|
1713
|
+
Object.entries(typography.fontWeight).forEach(([key, value]) => {
|
|
1714
|
+
root.style.setProperty(`--font-${key}`, value);
|
|
1715
|
+
});
|
|
1716
|
+
const button = newTheme.components.button;
|
|
1717
|
+
Object.entries(button.padding).forEach(([size, padding]) => {
|
|
1718
|
+
root.style.setProperty(`--button-padding-${size}-x`, padding.x);
|
|
1719
|
+
root.style.setProperty(`--button-padding-${size}-y`, padding.y);
|
|
1720
|
+
});
|
|
1721
|
+
Object.entries(button.fontSize).forEach(([size, fontSize]) => {
|
|
1722
|
+
root.style.setProperty(`--button-font-size-${size}`, fontSize);
|
|
1723
|
+
});
|
|
1724
|
+
root.style.setProperty("--button-radius", button.borderRadius);
|
|
1725
|
+
root.style.setProperty("--button-font-weight", button.fontWeight);
|
|
1726
|
+
const card = newTheme.components.card;
|
|
1727
|
+
Object.entries(card.padding).forEach(([size, padding]) => {
|
|
1728
|
+
root.style.setProperty(`--card-padding-${size}`, padding);
|
|
1729
|
+
});
|
|
1730
|
+
root.style.setProperty("--card-radius", card.borderRadius);
|
|
1731
|
+
root.style.setProperty("--card-border-width", card.borderWidth);
|
|
1732
|
+
root.style.setProperty("--card-shadow-flat", card.shadow.flat);
|
|
1733
|
+
root.style.setProperty("--card-shadow-elevated", card.shadow.elevated);
|
|
1734
|
+
const input = newTheme.components.input;
|
|
1735
|
+
Object.entries(input.padding).forEach(([size, padding]) => {
|
|
1736
|
+
root.style.setProperty(`--input-padding-${size}`, padding);
|
|
1737
|
+
});
|
|
1738
|
+
Object.entries(input.fontSize).forEach(([size, fontSize]) => {
|
|
1739
|
+
root.style.setProperty(`--input-font-size-${size}`, fontSize);
|
|
1740
|
+
});
|
|
1741
|
+
root.style.setProperty("--input-radius", input.borderRadius);
|
|
1742
|
+
root.style.setProperty("--input-border-width", input.borderWidth);
|
|
1743
|
+
const checkbox = newTheme.components.checkbox;
|
|
1744
|
+
Object.entries(checkbox.size).forEach(([size, dimension]) => {
|
|
1745
|
+
root.style.setProperty(`--checkbox-size-${size}`, dimension);
|
|
1746
|
+
});
|
|
1747
|
+
Object.entries(checkbox.labelSpacing).forEach(([size, spacing]) => {
|
|
1748
|
+
root.style.setProperty(`--checkbox-label-spacing-${size}`, spacing);
|
|
1749
|
+
});
|
|
1750
|
+
Object.entries(checkbox.labelFontSize).forEach(([size, fontSize]) => {
|
|
1751
|
+
root.style.setProperty(`--checkbox-label-font-size-${size}`, fontSize);
|
|
1752
|
+
});
|
|
1753
|
+
root.style.setProperty("--checkbox-radius", checkbox.borderRadius);
|
|
1754
|
+
const radio = newTheme.components.radio;
|
|
1755
|
+
Object.entries(radio.size).forEach(([size, dimension]) => {
|
|
1756
|
+
root.style.setProperty(`--radio-size-${size}`, dimension);
|
|
1757
|
+
});
|
|
1758
|
+
Object.entries(radio.labelSpacing).forEach(([size, spacing]) => {
|
|
1759
|
+
root.style.setProperty(`--radio-label-spacing-${size}`, spacing);
|
|
1760
|
+
});
|
|
1761
|
+
Object.entries(radio.labelFontSize).forEach(([size, fontSize]) => {
|
|
1762
|
+
root.style.setProperty(`--radio-label-font-size-${size}`, fontSize);
|
|
1763
|
+
});
|
|
1764
|
+
const dropdown = newTheme.components.dropdown;
|
|
1765
|
+
Object.entries(dropdown.padding).forEach(([size, padding]) => {
|
|
1766
|
+
root.style.setProperty(`--dropdown-padding-${size}-x`, padding.x);
|
|
1767
|
+
root.style.setProperty(`--dropdown-padding-${size}-y`, padding.y);
|
|
1768
|
+
});
|
|
1769
|
+
Object.entries(dropdown.fontSize).forEach(([size, fontSize]) => {
|
|
1770
|
+
root.style.setProperty(`--dropdown-font-size-${size}`, fontSize);
|
|
1771
|
+
});
|
|
1772
|
+
Object.entries(dropdown.iconSize).forEach(([size, iconSize]) => {
|
|
1773
|
+
root.style.setProperty(`--dropdown-icon-size-${size}`, iconSize);
|
|
1774
|
+
});
|
|
1775
|
+
Object.entries(dropdown.optionPadding).forEach(([size, padding]) => {
|
|
1776
|
+
root.style.setProperty(`--dropdown-option-padding-${size}-x`, padding.x);
|
|
1777
|
+
root.style.setProperty(`--dropdown-option-padding-${size}-y`, padding.y);
|
|
1778
|
+
});
|
|
1779
|
+
Object.entries(dropdown.optionFontSize).forEach(([size, fontSize]) => {
|
|
1780
|
+
root.style.setProperty(`--dropdown-option-font-size-${size}`, fontSize);
|
|
1781
|
+
});
|
|
1782
|
+
root.style.setProperty("--dropdown-radius", dropdown.borderRadius);
|
|
1783
|
+
root.style.setProperty("--dropdown-border-width", dropdown.borderWidth);
|
|
1784
|
+
const nav = newTheme.components.nav;
|
|
1785
|
+
root.style.setProperty("--nav-height", nav.height);
|
|
1786
|
+
Object.entries(nav.itemPadding).forEach(([size, padding]) => {
|
|
1787
|
+
root.style.setProperty(`--nav-item-padding-${size}-x`, padding.x);
|
|
1788
|
+
root.style.setProperty(`--nav-item-padding-${size}-y`, padding.y);
|
|
1789
|
+
});
|
|
1790
|
+
Object.entries(nav.fontSize).forEach(([size, fontSize]) => {
|
|
1791
|
+
root.style.setProperty(`--nav-font-size-${size}`, fontSize);
|
|
1792
|
+
});
|
|
1793
|
+
root.style.setProperty("--nav-border-radius", nav.borderRadius);
|
|
1794
|
+
root.style.setProperty("--nav-gap", nav.gap);
|
|
1795
|
+
setThemeState(newTheme);
|
|
1796
|
+
};
|
|
1797
|
+
const setTheme = (newTheme) => {
|
|
1798
|
+
applyTheme(newTheme);
|
|
1799
|
+
if (typeof window !== "undefined") {
|
|
1800
|
+
localStorage.setItem("theme", JSON.stringify(newTheme));
|
|
1801
|
+
}
|
|
1802
|
+
};
|
|
1803
|
+
const resetTheme = () => {
|
|
1804
|
+
applyTheme(default_default);
|
|
1805
|
+
if (typeof window !== "undefined") {
|
|
1806
|
+
localStorage.removeItem("theme");
|
|
1807
|
+
}
|
|
1808
|
+
};
|
|
1809
|
+
useEffect3(() => {
|
|
1810
|
+
if (typeof window !== "undefined") {
|
|
1811
|
+
const savedTheme = localStorage.getItem("theme");
|
|
1812
|
+
if (savedTheme) {
|
|
1813
|
+
try {
|
|
1814
|
+
const parsedTheme = JSON.parse(savedTheme);
|
|
1815
|
+
applyTheme(parsedTheme);
|
|
1816
|
+
} catch (error) {
|
|
1817
|
+
console.error("Failed to parse saved theme:", error);
|
|
1818
|
+
applyTheme(default_default);
|
|
1819
|
+
}
|
|
1820
|
+
} else {
|
|
1821
|
+
applyTheme(default_default);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
}, []);
|
|
1825
|
+
return /* @__PURE__ */ jsx16(ThemeContext.Provider, { value: { theme, setTheme, applyTheme, resetTheme }, children });
|
|
1826
|
+
}
|
|
1827
|
+
function useTheme() {
|
|
1828
|
+
const context = useContext(ThemeContext);
|
|
1829
|
+
if (context === void 0) {
|
|
1830
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
1831
|
+
}
|
|
1832
|
+
return context;
|
|
1833
|
+
}
|
|
1026
1834
|
export {
|
|
1027
1835
|
Alert,
|
|
1028
1836
|
Badge,
|
|
@@ -1040,10 +1848,13 @@ export {
|
|
|
1040
1848
|
Dropdown,
|
|
1041
1849
|
EmptyState,
|
|
1042
1850
|
Input,
|
|
1851
|
+
Nav,
|
|
1043
1852
|
RadioGroup,
|
|
1044
1853
|
SectionLayout,
|
|
1045
1854
|
SidebarNav,
|
|
1046
1855
|
Spinner,
|
|
1047
|
-
|
|
1856
|
+
ThemeProvider,
|
|
1857
|
+
cn,
|
|
1858
|
+
useTheme
|
|
1048
1859
|
};
|
|
1049
1860
|
//# sourceMappingURL=index.mjs.map
|