@yomologic/react-ui 0.2.5 → 0.2.7
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/README.md +2 -1
- package/dist/index.d.mts +401 -9
- package/dist/index.d.ts +401 -9
- package/dist/index.js +1049 -74
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1036 -60
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +739 -46
- package/dist/styles.css.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -44,14 +44,18 @@ __export(index_exports, {
|
|
|
44
44
|
CheckboxGroup: () => CheckboxGroup,
|
|
45
45
|
CodeSnippet: () => CodeSnippet,
|
|
46
46
|
Container: () => Container,
|
|
47
|
+
Drawer: () => Drawer,
|
|
47
48
|
Dropdown: () => Dropdown,
|
|
48
49
|
EmptyState: () => EmptyState,
|
|
49
50
|
Input: () => Input,
|
|
51
|
+
Nav: () => Nav,
|
|
50
52
|
RadioGroup: () => RadioGroup,
|
|
51
53
|
SectionLayout: () => SectionLayout,
|
|
52
54
|
SidebarNav: () => SidebarNav,
|
|
53
55
|
Spinner: () => Spinner,
|
|
54
|
-
|
|
56
|
+
ThemeProvider: () => ThemeProvider,
|
|
57
|
+
cn: () => cn,
|
|
58
|
+
useTheme: () => useTheme
|
|
55
59
|
});
|
|
56
60
|
module.exports = __toCommonJS(index_exports);
|
|
57
61
|
|
|
@@ -87,9 +91,11 @@ var Button = import_react.default.forwardRef(
|
|
|
87
91
|
danger: "[background-color:var(--color-error)] text-white hover:bg-red-700 focus:[--tw-ring-color:var(--color-error)]"
|
|
88
92
|
};
|
|
89
93
|
const sizes = {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
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",
|
|
95
|
+
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",
|
|
96
|
+
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",
|
|
97
|
+
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",
|
|
98
|
+
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"
|
|
93
99
|
};
|
|
94
100
|
const radiusStyle = "[border-radius:var(--button-radius)]";
|
|
95
101
|
const fontWeightStyle = "[font-weight:var(--button-font-weight)]";
|
|
@@ -164,7 +170,8 @@ var Input = import_react2.default.forwardRef(
|
|
|
164
170
|
id,
|
|
165
171
|
...props
|
|
166
172
|
}, ref) => {
|
|
167
|
-
const
|
|
173
|
+
const autoId = (0, import_react2.useId)();
|
|
174
|
+
const inputId = id || `input-${autoId}`;
|
|
168
175
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: cn("flex flex-col", fullWidth && "w-full"), children: [
|
|
169
176
|
label && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
170
177
|
"label",
|
|
@@ -304,9 +311,11 @@ var Badge = import_react4.default.forwardRef(
|
|
|
304
311
|
info: "bg-cyan-100 text-cyan-800"
|
|
305
312
|
};
|
|
306
313
|
const sizes = {
|
|
314
|
+
xs: "text-[0.625rem] px-1.5 py-0.5",
|
|
307
315
|
sm: "text-xs px-2 py-0.5",
|
|
308
316
|
md: "text-sm px-2.5 py-1",
|
|
309
|
-
lg: "text-base px-3 py-1.5"
|
|
317
|
+
lg: "text-base px-3 py-1.5",
|
|
318
|
+
xl: "text-lg px-3.5 py-2"
|
|
310
319
|
};
|
|
311
320
|
const dotVariants = {
|
|
312
321
|
default: "bg-gray-600",
|
|
@@ -338,6 +347,7 @@ var Badge = import_react4.default.forwardRef(
|
|
|
338
347
|
Badge.displayName = "Badge";
|
|
339
348
|
|
|
340
349
|
// src/ui/checkbox.tsx
|
|
350
|
+
var import_react5 = require("react");
|
|
341
351
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
342
352
|
function Checkbox({
|
|
343
353
|
label,
|
|
@@ -345,14 +355,37 @@ function Checkbox({
|
|
|
345
355
|
onChange,
|
|
346
356
|
disabled = false,
|
|
347
357
|
className,
|
|
348
|
-
id
|
|
358
|
+
id,
|
|
359
|
+
size = "md"
|
|
349
360
|
}) {
|
|
350
|
-
const
|
|
361
|
+
const autoId = (0, import_react5.useId)();
|
|
362
|
+
const checkboxId = id || `checkbox-${autoId}`;
|
|
351
363
|
const handleChange = (e) => {
|
|
352
364
|
if (onChange) {
|
|
353
365
|
onChange(e.target.checked);
|
|
354
366
|
}
|
|
355
367
|
};
|
|
368
|
+
const sizeStyles = {
|
|
369
|
+
xs: `[width:var(--checkbox-size-xs)] [height:var(--checkbox-size-xs)]`,
|
|
370
|
+
sm: `[width:var(--checkbox-size-sm)] [height:var(--checkbox-size-sm)]`,
|
|
371
|
+
md: `[width:var(--checkbox-size-md)] [height:var(--checkbox-size-md)]`,
|
|
372
|
+
lg: `[width:var(--checkbox-size-lg)] [height:var(--checkbox-size-lg)]`,
|
|
373
|
+
xl: `[width:var(--checkbox-size-xl)] [height:var(--checkbox-size-xl)]`
|
|
374
|
+
};
|
|
375
|
+
const labelSizeStyles = {
|
|
376
|
+
xs: `[font-size:var(--checkbox-label-font-size-xs)]`,
|
|
377
|
+
sm: `[font-size:var(--checkbox-label-font-size-sm)]`,
|
|
378
|
+
md: `[font-size:var(--checkbox-label-font-size-md)]`,
|
|
379
|
+
lg: `[font-size:var(--checkbox-label-font-size-lg)]`,
|
|
380
|
+
xl: `[font-size:var(--checkbox-label-font-size-xl)]`
|
|
381
|
+
};
|
|
382
|
+
const labelSpacingStyles = {
|
|
383
|
+
xs: `[margin-left:var(--checkbox-label-spacing-xs)]`,
|
|
384
|
+
sm: `[margin-left:var(--checkbox-label-spacing-sm)]`,
|
|
385
|
+
md: `[margin-left:var(--checkbox-label-spacing-md)]`,
|
|
386
|
+
lg: `[margin-left:var(--checkbox-label-spacing-lg)]`,
|
|
387
|
+
xl: `[margin-left:var(--checkbox-label-spacing-xl)]`
|
|
388
|
+
};
|
|
356
389
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cn("flex items-center", className), children: [
|
|
357
390
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
358
391
|
"input",
|
|
@@ -363,7 +396,8 @@ function Checkbox({
|
|
|
363
396
|
onChange: handleChange,
|
|
364
397
|
disabled,
|
|
365
398
|
className: cn(
|
|
366
|
-
|
|
399
|
+
sizeStyles[size],
|
|
400
|
+
"rounded-(--checkbox-radius) border-gray-400 text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
367
401
|
disabled && "cursor-not-allowed opacity-50"
|
|
368
402
|
)
|
|
369
403
|
}
|
|
@@ -373,7 +407,9 @@ function Checkbox({
|
|
|
373
407
|
{
|
|
374
408
|
htmlFor: checkboxId,
|
|
375
409
|
className: cn(
|
|
376
|
-
|
|
410
|
+
labelSpacingStyles[size],
|
|
411
|
+
labelSizeStyles[size],
|
|
412
|
+
"font-medium text-gray-600",
|
|
377
413
|
disabled && "cursor-not-allowed opacity-50",
|
|
378
414
|
!disabled && "cursor-pointer"
|
|
379
415
|
),
|
|
@@ -391,7 +427,8 @@ function CheckboxGroup({
|
|
|
391
427
|
className,
|
|
392
428
|
orientation = "vertical",
|
|
393
429
|
required = false,
|
|
394
|
-
disabled = false
|
|
430
|
+
disabled = false,
|
|
431
|
+
size = "md"
|
|
395
432
|
}) {
|
|
396
433
|
const handleChange = (optionValue, checked) => {
|
|
397
434
|
if (onChange) {
|
|
@@ -402,6 +439,27 @@ function CheckboxGroup({
|
|
|
402
439
|
}
|
|
403
440
|
}
|
|
404
441
|
};
|
|
442
|
+
const sizeStyles = {
|
|
443
|
+
xs: `[width:var(--checkbox-size-xs)] [height:var(--checkbox-size-xs)]`,
|
|
444
|
+
sm: `[width:var(--checkbox-size-sm)] [height:var(--checkbox-size-sm)]`,
|
|
445
|
+
md: `[width:var(--checkbox-size-md)] [height:var(--checkbox-size-md)]`,
|
|
446
|
+
lg: `[width:var(--checkbox-size-lg)] [height:var(--checkbox-size-lg)]`,
|
|
447
|
+
xl: `[width:var(--checkbox-size-xl)] [height:var(--checkbox-size-xl)]`
|
|
448
|
+
};
|
|
449
|
+
const labelSizeStyles = {
|
|
450
|
+
xs: `[font-size:var(--checkbox-label-font-size-xs)]`,
|
|
451
|
+
sm: `[font-size:var(--checkbox-label-font-size-sm)]`,
|
|
452
|
+
md: `[font-size:var(--checkbox-label-font-size-md)]`,
|
|
453
|
+
lg: `[font-size:var(--checkbox-label-font-size-lg)]`,
|
|
454
|
+
xl: `[font-size:var(--checkbox-label-font-size-xl)]`
|
|
455
|
+
};
|
|
456
|
+
const labelSpacingStyles = {
|
|
457
|
+
xs: `[margin-left:var(--checkbox-label-spacing-xs)]`,
|
|
458
|
+
sm: `[margin-left:var(--checkbox-label-spacing-sm)]`,
|
|
459
|
+
md: `[margin-left:var(--checkbox-label-spacing-md)]`,
|
|
460
|
+
lg: `[margin-left:var(--checkbox-label-spacing-lg)]`,
|
|
461
|
+
xl: `[margin-left:var(--checkbox-label-spacing-xl)]`
|
|
462
|
+
};
|
|
405
463
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className, children: [
|
|
406
464
|
label && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "block text-sm font-semibold text-gray-600 mb-1", children: [
|
|
407
465
|
label,
|
|
@@ -428,7 +486,8 @@ function CheckboxGroup({
|
|
|
428
486
|
onChange: (e) => handleChange(option.value, e.target.checked),
|
|
429
487
|
disabled: isDisabled,
|
|
430
488
|
className: cn(
|
|
431
|
-
|
|
489
|
+
sizeStyles[size],
|
|
490
|
+
"rounded-(--checkbox-radius) border-gray-400 text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
432
491
|
isDisabled && "cursor-not-allowed opacity-50"
|
|
433
492
|
)
|
|
434
493
|
}
|
|
@@ -438,7 +497,9 @@ function CheckboxGroup({
|
|
|
438
497
|
{
|
|
439
498
|
htmlFor: `${name}-${option.value}`,
|
|
440
499
|
className: cn(
|
|
441
|
-
|
|
500
|
+
labelSpacingStyles[size],
|
|
501
|
+
labelSizeStyles[size],
|
|
502
|
+
"font-medium text-gray-600",
|
|
442
503
|
isDisabled && "cursor-not-allowed opacity-50",
|
|
443
504
|
!isDisabled && "cursor-pointer"
|
|
444
505
|
),
|
|
@@ -463,13 +524,35 @@ function RadioGroup({
|
|
|
463
524
|
className,
|
|
464
525
|
orientation = "vertical",
|
|
465
526
|
required = false,
|
|
466
|
-
disabled = false
|
|
527
|
+
disabled = false,
|
|
528
|
+
size = "md"
|
|
467
529
|
}) {
|
|
468
530
|
const handleChange = (e) => {
|
|
469
531
|
if (onChange) {
|
|
470
532
|
onChange(e.target.value);
|
|
471
533
|
}
|
|
472
534
|
};
|
|
535
|
+
const sizeStyles = {
|
|
536
|
+
xs: `[width:var(--radio-size-xs)] [height:var(--radio-size-xs)]`,
|
|
537
|
+
sm: `[width:var(--radio-size-sm)] [height:var(--radio-size-sm)]`,
|
|
538
|
+
md: `[width:var(--radio-size-md)] [height:var(--radio-size-md)]`,
|
|
539
|
+
lg: `[width:var(--radio-size-lg)] [height:var(--radio-size-lg)]`,
|
|
540
|
+
xl: `[width:var(--radio-size-xl)] [height:var(--radio-size-xl)]`
|
|
541
|
+
};
|
|
542
|
+
const labelSizeStyles = {
|
|
543
|
+
xs: `[font-size:var(--radio-label-font-size-xs)]`,
|
|
544
|
+
sm: `[font-size:var(--radio-label-font-size-sm)]`,
|
|
545
|
+
md: `[font-size:var(--radio-label-font-size-md)]`,
|
|
546
|
+
lg: `[font-size:var(--radio-label-font-size-lg)]`,
|
|
547
|
+
xl: `[font-size:var(--radio-label-font-size-xl)]`
|
|
548
|
+
};
|
|
549
|
+
const labelSpacingStyles = {
|
|
550
|
+
xs: `[margin-left:var(--radio-label-spacing-xs)]`,
|
|
551
|
+
sm: `[margin-left:var(--radio-label-spacing-sm)]`,
|
|
552
|
+
md: `[margin-left:var(--radio-label-spacing-md)]`,
|
|
553
|
+
lg: `[margin-left:var(--radio-label-spacing-lg)]`,
|
|
554
|
+
xl: `[margin-left:var(--radio-label-spacing-xl)]`
|
|
555
|
+
};
|
|
473
556
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className, children: [
|
|
474
557
|
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "block text-sm font-semibold text-gray-600 mb-1", children: [
|
|
475
558
|
label,
|
|
@@ -496,7 +579,8 @@ function RadioGroup({
|
|
|
496
579
|
onChange: handleChange,
|
|
497
580
|
disabled: isDisabled,
|
|
498
581
|
className: cn(
|
|
499
|
-
|
|
582
|
+
sizeStyles[size],
|
|
583
|
+
"border-gray-400 text-blue-600 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2",
|
|
500
584
|
isDisabled && "cursor-not-allowed opacity-50"
|
|
501
585
|
)
|
|
502
586
|
}
|
|
@@ -506,7 +590,9 @@ function RadioGroup({
|
|
|
506
590
|
{
|
|
507
591
|
htmlFor: `${name}-${option.value}`,
|
|
508
592
|
className: cn(
|
|
509
|
-
|
|
593
|
+
labelSpacingStyles[size],
|
|
594
|
+
labelSizeStyles[size],
|
|
595
|
+
"font-medium text-gray-600",
|
|
510
596
|
isDisabled && "cursor-not-allowed opacity-50",
|
|
511
597
|
!isDisabled && "cursor-pointer"
|
|
512
598
|
),
|
|
@@ -521,7 +607,7 @@ function RadioGroup({
|
|
|
521
607
|
}
|
|
522
608
|
|
|
523
609
|
// src/ui/dropdown.tsx
|
|
524
|
-
var
|
|
610
|
+
var import_react6 = require("react");
|
|
525
611
|
var import_lucide_react = require("lucide-react");
|
|
526
612
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
527
613
|
function Dropdown({
|
|
@@ -535,16 +621,38 @@ function Dropdown({
|
|
|
535
621
|
error,
|
|
536
622
|
helperText,
|
|
537
623
|
required = false,
|
|
624
|
+
size = "md",
|
|
538
625
|
className = ""
|
|
539
626
|
}) {
|
|
540
|
-
const [isOpen, setIsOpen] = (0,
|
|
541
|
-
const dropdownRef = (0,
|
|
627
|
+
const [isOpen, setIsOpen] = (0, import_react6.useState)(false);
|
|
628
|
+
const dropdownRef = (0, import_react6.useRef)(null);
|
|
542
629
|
const getSelectedLabel = () => {
|
|
543
630
|
if (!value) return placeholder;
|
|
544
631
|
const selected = options.find((opt) => opt.value === value);
|
|
545
632
|
return selected ? selected.label : placeholder;
|
|
546
633
|
};
|
|
547
|
-
|
|
634
|
+
const sizeStyles = {
|
|
635
|
+
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)]`,
|
|
636
|
+
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)]`,
|
|
637
|
+
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)]`,
|
|
638
|
+
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)]`,
|
|
639
|
+
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)]`
|
|
640
|
+
};
|
|
641
|
+
const iconSizeStyles = {
|
|
642
|
+
xs: `[width:var(--dropdown-icon-size-xs)] [height:var(--dropdown-icon-size-xs)]`,
|
|
643
|
+
sm: `[width:var(--dropdown-icon-size-sm)] [height:var(--dropdown-icon-size-sm)]`,
|
|
644
|
+
md: `[width:var(--dropdown-icon-size-md)] [height:var(--dropdown-icon-size-md)]`,
|
|
645
|
+
lg: `[width:var(--dropdown-icon-size-lg)] [height:var(--dropdown-icon-size-lg)]`,
|
|
646
|
+
xl: `[width:var(--dropdown-icon-size-xl)] [height:var(--dropdown-icon-size-xl)]`
|
|
647
|
+
};
|
|
648
|
+
const optionSizeStyles = {
|
|
649
|
+
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)]`,
|
|
650
|
+
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)]`,
|
|
651
|
+
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)]`,
|
|
652
|
+
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)]`,
|
|
653
|
+
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)]`
|
|
654
|
+
};
|
|
655
|
+
(0, import_react6.useEffect)(() => {
|
|
548
656
|
const handleClickOutside = (event) => {
|
|
549
657
|
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
550
658
|
setIsOpen(false);
|
|
@@ -580,7 +688,7 @@ function Dropdown({
|
|
|
580
688
|
onKeyDown: handleKeyDown,
|
|
581
689
|
disabled,
|
|
582
690
|
className: `
|
|
583
|
-
w-full
|
|
691
|
+
w-full ${sizeStyles[size]} text-left bg-white border rounded-(--dropdown-radius)
|
|
584
692
|
flex items-center justify-between
|
|
585
693
|
transition-all duration-200
|
|
586
694
|
${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"}
|
|
@@ -592,7 +700,7 @@ function Dropdown({
|
|
|
592
700
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
593
701
|
import_lucide_react.ChevronDown,
|
|
594
702
|
{
|
|
595
|
-
className:
|
|
703
|
+
className: `${iconSizeStyles[size]} text-gray-400 transition-transform duration-200 shrink-0 ml-2 ${isOpen ? "transform rotate-180" : ""}`
|
|
596
704
|
}
|
|
597
705
|
)
|
|
598
706
|
]
|
|
@@ -615,7 +723,7 @@ function Dropdown({
|
|
|
615
723
|
onClick: () => !option.disabled && handleSelect(option.value),
|
|
616
724
|
disabled: option.disabled,
|
|
617
725
|
className: `
|
|
618
|
-
w-full
|
|
726
|
+
w-full ${optionSizeStyles[size]} text-left
|
|
619
727
|
transition-colors duration-150
|
|
620
728
|
${option.value === value ? "bg-blue-50 text-blue-700 font-medium" : "text-gray-900 hover:bg-gray-100"}
|
|
621
729
|
${option.disabled ? "opacity-50 cursor-not-allowed" : ""}
|
|
@@ -640,9 +748,9 @@ function Dropdown({
|
|
|
640
748
|
}
|
|
641
749
|
|
|
642
750
|
// src/ui/spinner.tsx
|
|
643
|
-
var
|
|
751
|
+
var import_react7 = __toESM(require("react"));
|
|
644
752
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
645
|
-
var Spinner =
|
|
753
|
+
var Spinner = import_react7.default.forwardRef(
|
|
646
754
|
({ className, size = "md", color = "primary", label, ...props }, ref) => {
|
|
647
755
|
const sizes = {
|
|
648
756
|
sm: "h-4 w-4",
|
|
@@ -704,13 +812,13 @@ var Spinner = import_react6.default.forwardRef(
|
|
|
704
812
|
Spinner.displayName = "Spinner";
|
|
705
813
|
|
|
706
814
|
// src/ui/code-snippet.tsx
|
|
707
|
-
var
|
|
815
|
+
var import_react8 = require("react");
|
|
708
816
|
var import_react_syntax_highlighter = require("react-syntax-highlighter");
|
|
709
817
|
var import_prism = require("react-syntax-highlighter/dist/esm/styles/prism");
|
|
710
818
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
711
819
|
function CodeSnippet({ code, language = "tsx" }) {
|
|
712
|
-
const [copied, setCopied] = (0,
|
|
713
|
-
const [showTooltip, setShowTooltip] = (0,
|
|
820
|
+
const [copied, setCopied] = (0, import_react8.useState)(false);
|
|
821
|
+
const [showTooltip, setShowTooltip] = (0, import_react8.useState)(false);
|
|
714
822
|
const handleCopy = async () => {
|
|
715
823
|
try {
|
|
716
824
|
await navigator.clipboard.writeText(code);
|
|
@@ -802,9 +910,9 @@ function CodeSnippet({ code, language = "tsx" }) {
|
|
|
802
910
|
}
|
|
803
911
|
|
|
804
912
|
// src/feedback/alert.tsx
|
|
805
|
-
var
|
|
913
|
+
var import_react9 = __toESM(require("react"));
|
|
806
914
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
807
|
-
var Alert =
|
|
915
|
+
var Alert = import_react9.default.forwardRef(
|
|
808
916
|
({
|
|
809
917
|
className,
|
|
810
918
|
variant = "info",
|
|
@@ -907,9 +1015,9 @@ var Alert = import_react8.default.forwardRef(
|
|
|
907
1015
|
Alert.displayName = "Alert";
|
|
908
1016
|
|
|
909
1017
|
// src/layout/container.tsx
|
|
910
|
-
var
|
|
1018
|
+
var import_react10 = __toESM(require("react"));
|
|
911
1019
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
912
|
-
var Container =
|
|
1020
|
+
var Container = import_react10.default.forwardRef(
|
|
913
1021
|
({
|
|
914
1022
|
className,
|
|
915
1023
|
maxWidth = "xl",
|
|
@@ -946,7 +1054,7 @@ var Container = import_react9.default.forwardRef(
|
|
|
946
1054
|
Container.displayName = "Container";
|
|
947
1055
|
|
|
948
1056
|
// src/layout/section-layout.tsx
|
|
949
|
-
var
|
|
1057
|
+
var import_react11 = __toESM(require("react"));
|
|
950
1058
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
951
1059
|
function SectionLayout({
|
|
952
1060
|
children,
|
|
@@ -955,7 +1063,7 @@ function SectionLayout({
|
|
|
955
1063
|
if (!hasStickyPreview) {
|
|
956
1064
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children });
|
|
957
1065
|
}
|
|
958
|
-
const childArray =
|
|
1066
|
+
const childArray = import_react11.default.Children.toArray(children);
|
|
959
1067
|
if (childArray.length === 0) {
|
|
960
1068
|
return null;
|
|
961
1069
|
}
|
|
@@ -967,48 +1075,452 @@ function SectionLayout({
|
|
|
967
1075
|
] });
|
|
968
1076
|
}
|
|
969
1077
|
|
|
970
|
-
// src/layout/
|
|
971
|
-
var
|
|
1078
|
+
// src/layout/nav.tsx
|
|
1079
|
+
var import_react12 = __toESM(require("react"));
|
|
972
1080
|
var import_lucide_react2 = require("lucide-react");
|
|
973
1081
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1082
|
+
var Nav = import_react12.default.forwardRef(
|
|
1083
|
+
({
|
|
1084
|
+
className,
|
|
1085
|
+
items,
|
|
1086
|
+
variant = "primary",
|
|
1087
|
+
orientation = "horizontal",
|
|
1088
|
+
size = "md",
|
|
1089
|
+
mobileBreakpoint = "md",
|
|
1090
|
+
mobileMenuDirection = "top",
|
|
1091
|
+
logo,
|
|
1092
|
+
actions,
|
|
1093
|
+
sticky = false,
|
|
1094
|
+
activeId,
|
|
1095
|
+
onItemClick,
|
|
1096
|
+
...props
|
|
1097
|
+
}, ref) => {
|
|
1098
|
+
const [isMobileMenuOpen, setIsMobileMenuOpen] = (0, import_react12.useState)(false);
|
|
1099
|
+
const [openDropdownId, setOpenDropdownId] = (0, import_react12.useState)(null);
|
|
1100
|
+
const dropdownRef = (0, import_react12.useRef)(null);
|
|
1101
|
+
(0, import_react12.useEffect)(() => {
|
|
1102
|
+
function handleClickOutside(event) {
|
|
1103
|
+
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
|
|
1104
|
+
setOpenDropdownId(null);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1108
|
+
return () => {
|
|
1109
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
1110
|
+
};
|
|
1111
|
+
}, []);
|
|
1112
|
+
(0, import_react12.useEffect)(() => {
|
|
1113
|
+
function handleEscape(event) {
|
|
1114
|
+
if (event.key === "Escape") {
|
|
1115
|
+
setIsMobileMenuOpen(false);
|
|
1116
|
+
setOpenDropdownId(null);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
document.addEventListener("keydown", handleEscape);
|
|
1120
|
+
return () => {
|
|
1121
|
+
document.removeEventListener("keydown", handleEscape);
|
|
1122
|
+
};
|
|
1123
|
+
}, []);
|
|
1124
|
+
(0, import_react12.useEffect)(() => {
|
|
1125
|
+
setIsMobileMenuOpen(false);
|
|
1126
|
+
}, [mobileMenuDirection]);
|
|
1127
|
+
const baseStyles = cn(
|
|
1128
|
+
"bg-[var(--color-background)] border-b border-[var(--color-border)]",
|
|
1129
|
+
sticky && "sticky top-0 [z-index:var(--z-index-nav)]"
|
|
1130
|
+
);
|
|
1131
|
+
const containerStyles = cn(
|
|
1132
|
+
"[min-height:var(--nav-height)]",
|
|
1133
|
+
"flex items-center justify-between",
|
|
1134
|
+
"px-[var(--spacing-lg)]"
|
|
1135
|
+
);
|
|
1136
|
+
const itemPaddingStyles = {
|
|
1137
|
+
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)]",
|
|
1138
|
+
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)]",
|
|
1139
|
+
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)]",
|
|
1140
|
+
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)]",
|
|
1141
|
+
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)]"
|
|
1142
|
+
};
|
|
1143
|
+
const fontSizeStyles = {
|
|
1144
|
+
xs: "[font-size:var(--nav-font-size-xs)]",
|
|
1145
|
+
sm: "[font-size:var(--nav-font-size-sm)]",
|
|
1146
|
+
md: "[font-size:var(--nav-font-size-md)]",
|
|
1147
|
+
lg: "[font-size:var(--nav-font-size-lg)]",
|
|
1148
|
+
xl: "[font-size:var(--nav-font-size-xl)]"
|
|
1149
|
+
};
|
|
1150
|
+
const variantItemStyles = {
|
|
1151
|
+
primary: "rounded-[var(--nav-border-radius)] hover:bg-blue-50 transition-colors",
|
|
1152
|
+
secondary: "rounded-[var(--nav-border-radius)] hover:bg-[var(--color-muted)] transition-colors",
|
|
1153
|
+
outline: cn(
|
|
1154
|
+
"rounded-[var(--nav-border-radius)] border border-[var(--color-border)] hover:bg-[var(--color-muted)] transition-colors"
|
|
1155
|
+
),
|
|
1156
|
+
ghost: "rounded-[var(--nav-border-radius)] hover:bg-[var(--color-muted)]/50 transition-colors"
|
|
1157
|
+
};
|
|
1158
|
+
const activeItemStyles = {
|
|
1159
|
+
primary: "bg-blue-100 text-blue-700",
|
|
1160
|
+
secondary: "bg-[var(--color-muted)] [font-weight:var(--font-semibold)]",
|
|
1161
|
+
outline: "border-blue-600 bg-blue-50 text-blue-700",
|
|
1162
|
+
ghost: "bg-[var(--color-muted)]"
|
|
1163
|
+
};
|
|
1164
|
+
const breakpointClasses = {
|
|
1165
|
+
sm: "sm:hidden",
|
|
1166
|
+
md: "md:hidden",
|
|
1167
|
+
lg: "lg:hidden"
|
|
1168
|
+
};
|
|
1169
|
+
const breakpointShowClasses = {
|
|
1170
|
+
sm: "hidden sm:flex",
|
|
1171
|
+
md: "hidden md:flex",
|
|
1172
|
+
lg: "hidden lg:flex"
|
|
1173
|
+
};
|
|
1174
|
+
const handleItemClick = (item) => {
|
|
1175
|
+
if (item.disabled) return;
|
|
1176
|
+
if (item.type === "dropdown") {
|
|
1177
|
+
setOpenDropdownId(openDropdownId === item.id ? null : item.id);
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
if (item.onClick) {
|
|
1181
|
+
item.onClick();
|
|
1182
|
+
}
|
|
1183
|
+
if (onItemClick) {
|
|
1184
|
+
onItemClick(item);
|
|
1185
|
+
}
|
|
1186
|
+
setIsMobileMenuOpen(false);
|
|
1187
|
+
setOpenDropdownId(null);
|
|
1188
|
+
};
|
|
1189
|
+
const renderNavItem = (item, isMobile = false) => {
|
|
1190
|
+
if (item.type === "divider") {
|
|
1191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1192
|
+
"div",
|
|
1193
|
+
{
|
|
1194
|
+
className: cn(
|
|
1195
|
+
orientation === "horizontal" && !isMobile && "h-6 border-l border-[var(--color-border)] mx-2",
|
|
1196
|
+
(orientation === "vertical" || isMobile) && "w-full h-0 border-t border-[var(--color-border)] my-2"
|
|
1197
|
+
)
|
|
1198
|
+
},
|
|
1199
|
+
item.id
|
|
1200
|
+
);
|
|
1201
|
+
}
|
|
1202
|
+
if (item.type === "custom" && item.render) {
|
|
1203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: item.render() }, item.id);
|
|
1204
|
+
}
|
|
1205
|
+
const isActive = activeId === item.id;
|
|
1206
|
+
const isDropdownOpen = openDropdownId === item.id;
|
|
1207
|
+
const hasChildren = item.children && item.children.length > 0;
|
|
1208
|
+
const itemBaseStyles = cn(
|
|
1209
|
+
"flex items-center [gap:var(--nav-gap)] font-medium text-[var(--color-foreground)] cursor-pointer select-none",
|
|
1210
|
+
itemPaddingStyles[size],
|
|
1211
|
+
fontSizeStyles[size],
|
|
1212
|
+
variantItemStyles[variant],
|
|
1213
|
+
isActive && activeItemStyles[variant],
|
|
1214
|
+
orientation === "vertical" && "w-full",
|
|
1215
|
+
item.disabled && "opacity-50 cursor-not-allowed"
|
|
1216
|
+
);
|
|
1217
|
+
const content = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1218
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex-shrink-0", children: item.icon }),
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: item.label }),
|
|
1220
|
+
item.badge && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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 }),
|
|
1221
|
+
hasChildren && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1222
|
+
import_lucide_react2.ChevronDown,
|
|
1223
|
+
{
|
|
1224
|
+
className: cn(
|
|
1225
|
+
"w-4 h-4 transition-transform",
|
|
1226
|
+
isDropdownOpen && "rotate-180"
|
|
1227
|
+
)
|
|
1228
|
+
}
|
|
1229
|
+
)
|
|
1230
|
+
] });
|
|
1231
|
+
if (hasChildren) {
|
|
1232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "relative", ref: dropdownRef, children: [
|
|
1233
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1234
|
+
"button",
|
|
1235
|
+
{
|
|
1236
|
+
onClick: () => handleItemClick(item),
|
|
1237
|
+
className: itemBaseStyles,
|
|
1238
|
+
disabled: item.disabled,
|
|
1239
|
+
children: content
|
|
1240
|
+
}
|
|
1241
|
+
),
|
|
1242
|
+
isDropdownOpen && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1243
|
+
"div",
|
|
1244
|
+
{
|
|
1245
|
+
className: cn(
|
|
1246
|
+
"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",
|
|
1247
|
+
orientation === "vertical" && "left-full top-0 ml-2 mt-0"
|
|
1248
|
+
),
|
|
1249
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "py-1", children: item.children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1250
|
+
"button",
|
|
1251
|
+
{
|
|
1252
|
+
onClick: () => handleItemClick(child),
|
|
1253
|
+
disabled: child.disabled,
|
|
1254
|
+
className: cn(
|
|
1255
|
+
"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",
|
|
1256
|
+
child.disabled && "opacity-50 cursor-not-allowed",
|
|
1257
|
+
activeId === child.id && "bg-[var(--color-muted)] [font-weight:var(--font-semibold)]"
|
|
1258
|
+
),
|
|
1259
|
+
children: [
|
|
1260
|
+
child.icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex-shrink-0", children: child.icon }),
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: child.label }),
|
|
1262
|
+
child.badge && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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 })
|
|
1263
|
+
]
|
|
1264
|
+
},
|
|
1265
|
+
child.id
|
|
1266
|
+
)) })
|
|
1267
|
+
}
|
|
1268
|
+
)
|
|
1269
|
+
] }, item.id);
|
|
1270
|
+
}
|
|
1271
|
+
if (item.href) {
|
|
1272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1273
|
+
"a",
|
|
1274
|
+
{
|
|
1275
|
+
href: item.href,
|
|
1276
|
+
target: item.target,
|
|
1277
|
+
onClick: () => handleItemClick(item),
|
|
1278
|
+
className: itemBaseStyles,
|
|
1279
|
+
children: content
|
|
1280
|
+
},
|
|
1281
|
+
item.id
|
|
1282
|
+
);
|
|
1283
|
+
}
|
|
1284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1285
|
+
"button",
|
|
1286
|
+
{
|
|
1287
|
+
onClick: () => handleItemClick(item),
|
|
1288
|
+
disabled: item.disabled,
|
|
1289
|
+
className: itemBaseStyles,
|
|
1290
|
+
children: content
|
|
1291
|
+
},
|
|
1292
|
+
item.id
|
|
1293
|
+
);
|
|
1294
|
+
};
|
|
1295
|
+
const desktopNav = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1296
|
+
"div",
|
|
1297
|
+
{
|
|
1298
|
+
className: cn(
|
|
1299
|
+
"items-center [gap:var(--nav-gap)]",
|
|
1300
|
+
breakpointShowClasses[mobileBreakpoint],
|
|
1301
|
+
orientation === "horizontal" ? "flex flex-row" : "flex flex-col"
|
|
1302
|
+
),
|
|
1303
|
+
children: items.map((item) => renderNavItem(item))
|
|
1304
|
+
}
|
|
1305
|
+
);
|
|
1306
|
+
const mobileNav = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
|
|
1307
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1308
|
+
"button",
|
|
1309
|
+
{
|
|
1310
|
+
onClick: () => setIsMobileMenuOpen(!isMobileMenuOpen),
|
|
1311
|
+
className: cn(
|
|
1312
|
+
"p-2 text-[var(--color-foreground)] hover:bg-[var(--color-muted)] rounded-[var(--nav-border-radius)] transition-colors",
|
|
1313
|
+
breakpointClasses[mobileBreakpoint]
|
|
1314
|
+
),
|
|
1315
|
+
"aria-label": "Toggle menu",
|
|
1316
|
+
children: isMobileMenuOpen ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react2.X, { className: "w-6 h-6" }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react2.Menu, { className: "w-6 h-6" })
|
|
1317
|
+
}
|
|
1318
|
+
),
|
|
1319
|
+
isMobileMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1320
|
+
"div",
|
|
1321
|
+
{
|
|
1322
|
+
className: cn(
|
|
1323
|
+
"fixed inset-0 bg-black/50 [z-index:var(--z-index-nav-mobile-overlay)]",
|
|
1324
|
+
breakpointClasses[mobileBreakpoint]
|
|
1325
|
+
),
|
|
1326
|
+
onClick: () => setIsMobileMenuOpen(false)
|
|
1327
|
+
}
|
|
1328
|
+
),
|
|
1329
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1330
|
+
"div",
|
|
1331
|
+
{
|
|
1332
|
+
className: cn(
|
|
1333
|
+
"fixed bg-[var(--color-background)] shadow-lg [z-index:var(--z-index-nav-mobile-menu)] overflow-y-auto transition-transform duration-300 ease-in-out",
|
|
1334
|
+
breakpointClasses[mobileBreakpoint],
|
|
1335
|
+
// Always hide when closed
|
|
1336
|
+
!isMobileMenuOpen && "invisible",
|
|
1337
|
+
// Direction-specific positioning and animation
|
|
1338
|
+
mobileMenuDirection === "top" && [
|
|
1339
|
+
"top-0 left-0 right-0 border-b border-[var(--color-border)] max-h-screen",
|
|
1340
|
+
isMobileMenuOpen ? "translate-y-0" : "-translate-y-full"
|
|
1341
|
+
],
|
|
1342
|
+
mobileMenuDirection === "left" && [
|
|
1343
|
+
"top-0 left-0 bottom-0 w-64 border-r border-[var(--color-border)]",
|
|
1344
|
+
isMobileMenuOpen ? "translate-x-0" : "-translate-x-full"
|
|
1345
|
+
],
|
|
1346
|
+
mobileMenuDirection === "right" && [
|
|
1347
|
+
"top-0 right-0 bottom-0 w-64 border-l border-[var(--color-border)]",
|
|
1348
|
+
isMobileMenuOpen ? "translate-x-0" : "translate-x-full"
|
|
1349
|
+
]
|
|
1350
|
+
),
|
|
1351
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1352
|
+
"div",
|
|
1353
|
+
{
|
|
1354
|
+
className: cn(
|
|
1355
|
+
"flex flex-col",
|
|
1356
|
+
mobileMenuDirection === "top" ? "py-2" : "space-y-1 px-2 pt-2"
|
|
1357
|
+
),
|
|
1358
|
+
children: items.map((item) => renderNavItem(item, true))
|
|
1359
|
+
}
|
|
1360
|
+
)
|
|
1361
|
+
}
|
|
1362
|
+
)
|
|
1363
|
+
] });
|
|
1364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("nav", { ref, className: cn(baseStyles, className), ...props, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: containerStyles, children: [
|
|
1365
|
+
logo && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "shrink-0", children: logo }),
|
|
1366
|
+
desktopNav,
|
|
1367
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "shrink-0 flex items-center gap-2", children: actions }),
|
|
1368
|
+
mobileNav
|
|
1369
|
+
] }) });
|
|
1370
|
+
}
|
|
1371
|
+
);
|
|
1372
|
+
Nav.displayName = "Nav";
|
|
1373
|
+
|
|
1374
|
+
// src/layout/drawer.tsx
|
|
1375
|
+
var import_react13 = require("react");
|
|
1376
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1377
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1378
|
+
function Drawer({
|
|
1379
|
+
title,
|
|
1380
|
+
subtitle,
|
|
1381
|
+
items,
|
|
1382
|
+
sections,
|
|
1383
|
+
activeItem,
|
|
1384
|
+
onItemClick,
|
|
1385
|
+
footer,
|
|
1386
|
+
position = "right"
|
|
1387
|
+
}) {
|
|
1388
|
+
const [mobileMenuOpen, setMobileMenuOpen] = (0, import_react13.useState)(false);
|
|
1389
|
+
const isLeft = position === "left";
|
|
1390
|
+
const handleItemClick = (itemId) => {
|
|
1391
|
+
onItemClick(itemId);
|
|
1392
|
+
setMobileMenuOpen(false);
|
|
1393
|
+
};
|
|
1394
|
+
const useSections = sections || (items ? [{ title: "", items }] : []);
|
|
1395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
1396
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "lg:hidden fixed top-0 left-0 right-0 bg-white border-b border-gray-200 px-4 py-3 [z-index:var(--z-index-drawer-header)]", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1397
|
+
"div",
|
|
1398
|
+
{
|
|
1399
|
+
className: `flex items-center ${isLeft ? "justify-between" : "justify-between flex-row-reverse"}`,
|
|
1400
|
+
children: [
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1402
|
+
"button",
|
|
1403
|
+
{
|
|
1404
|
+
onClick: () => setMobileMenuOpen(!mobileMenuOpen),
|
|
1405
|
+
className: "p-2 rounded-lg hover:bg-gray-100 transition-colors relative [z-index:var(--z-index-drawer-button)]",
|
|
1406
|
+
"aria-label": "Toggle menu",
|
|
1407
|
+
children: mobileMenuOpen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.X, { className: "w-6 h-6 text-gray-700" }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.Menu, { className: "w-6 h-6 text-gray-700" })
|
|
1408
|
+
}
|
|
1409
|
+
),
|
|
1410
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
1411
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h1", { className: "text-lg font-bold text-gray-900", children: title }),
|
|
1412
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-gray-500", children: subtitle })
|
|
1413
|
+
] })
|
|
1414
|
+
]
|
|
1415
|
+
}
|
|
1416
|
+
) }),
|
|
1417
|
+
mobileMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1418
|
+
"div",
|
|
1419
|
+
{
|
|
1420
|
+
className: "fixed inset-0 bg-black/50 lg:hidden",
|
|
1421
|
+
style: { zIndex: 9998 },
|
|
1422
|
+
onClick: () => setMobileMenuOpen(false)
|
|
1423
|
+
}
|
|
1424
|
+
),
|
|
1425
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1426
|
+
"aside",
|
|
1427
|
+
{
|
|
1428
|
+
className: `
|
|
1429
|
+
fixed top-0 bottom-0 w-64 bg-white
|
|
1430
|
+
transition-transform duration-300 ease-in-out overflow-y-auto
|
|
1431
|
+
${isLeft ? "left-0 border-r" : "right-0 border-l"} border-gray-200
|
|
1432
|
+
lg:translate-x-0 lg:top-0
|
|
1433
|
+
${mobileMenuOpen ? "translate-x-0 top-0" : `${isLeft ? "-translate-x-full" : "translate-x-full"} top-0`}
|
|
1434
|
+
`,
|
|
1435
|
+
style: mobileMenuOpen && typeof window !== "undefined" && window.innerWidth < 1024 ? { zIndex: 9999 } : void 0,
|
|
1436
|
+
children: [
|
|
1437
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "hidden lg:block p-6 border-b border-gray-200", children: [
|
|
1438
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h1", { className: "text-xl font-bold text-gray-900", children: title }),
|
|
1439
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-gray-500 mt-1", children: subtitle })
|
|
1440
|
+
] }),
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "lg:hidden p-4 border-b border-gray-200 flex items-center justify-between", children: [
|
|
1442
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
|
|
1443
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h1", { className: "text-lg font-bold text-gray-900", children: title }),
|
|
1444
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "text-xs text-gray-500 mt-1", children: subtitle })
|
|
1445
|
+
] }),
|
|
1446
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1447
|
+
"button",
|
|
1448
|
+
{
|
|
1449
|
+
onClick: () => setMobileMenuOpen(false),
|
|
1450
|
+
className: "p-2 rounded-lg hover:bg-gray-100 transition-colors",
|
|
1451
|
+
"aria-label": "Close menu",
|
|
1452
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react3.X, { className: "w-5 h-5 text-gray-700" })
|
|
1453
|
+
}
|
|
1454
|
+
)
|
|
1455
|
+
] }),
|
|
1456
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("nav", { className: "p-4", children: useSections.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: sectionIndex > 0 ? "mt-6" : "", children: [
|
|
1457
|
+
section.title && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "px-4 mb-2 text-xs font-semibold text-gray-500 uppercase tracking-wider", children: section.title }),
|
|
1458
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "space-y-1", children: section.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1459
|
+
"button",
|
|
1460
|
+
{
|
|
1461
|
+
onClick: () => handleItemClick(item.id),
|
|
1462
|
+
className: `
|
|
1463
|
+
w-full flex items-center gap-3 px-4 py-3 rounded-lg text-sm font-medium transition-colors
|
|
1464
|
+
${activeItem === item.id ? "bg-blue-50 text-blue-700" : "text-gray-700 hover:bg-gray-50"}
|
|
1465
|
+
`,
|
|
1466
|
+
children: [
|
|
1467
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "shrink-0", children: item.icon }),
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: item.label })
|
|
1469
|
+
]
|
|
1470
|
+
}
|
|
1471
|
+
) }, item.id)) })
|
|
1472
|
+
] }, sectionIndex)) }),
|
|
1473
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "p-4 border-t border-gray-200 mt-auto", children: footer })
|
|
1474
|
+
]
|
|
1475
|
+
}
|
|
1476
|
+
)
|
|
1477
|
+
] });
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
// src/layout/sidebar-nav.tsx
|
|
1481
|
+
var import_react14 = require("react");
|
|
1482
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1483
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
974
1484
|
function SidebarNav({
|
|
975
1485
|
title,
|
|
976
1486
|
subtitle,
|
|
977
1487
|
items,
|
|
1488
|
+
sections,
|
|
978
1489
|
activeItem,
|
|
979
1490
|
onItemClick,
|
|
980
1491
|
footer,
|
|
981
1492
|
position = "right"
|
|
982
1493
|
}) {
|
|
983
|
-
const [mobileMenuOpen, setMobileMenuOpen] = (0,
|
|
1494
|
+
const [mobileMenuOpen, setMobileMenuOpen] = (0, import_react14.useState)(false);
|
|
984
1495
|
const isLeft = position === "left";
|
|
985
1496
|
const handleItemClick = (itemId) => {
|
|
986
1497
|
onItemClick(itemId);
|
|
987
1498
|
setMobileMenuOpen(false);
|
|
988
1499
|
};
|
|
989
|
-
|
|
990
|
-
|
|
1500
|
+
const useSections = sections || (items ? [{ title: "", items }] : []);
|
|
1501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
|
|
1502
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("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__ */ (0, import_jsx_runtime15.jsxs)(
|
|
991
1503
|
"div",
|
|
992
1504
|
{
|
|
993
1505
|
className: `flex items-center ${isLeft ? "justify-between" : "justify-between flex-row-reverse"}`,
|
|
994
1506
|
children: [
|
|
995
|
-
/* @__PURE__ */ (0,
|
|
1507
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
996
1508
|
"button",
|
|
997
1509
|
{
|
|
998
1510
|
onClick: () => setMobileMenuOpen(!mobileMenuOpen),
|
|
999
1511
|
className: "p-2 rounded-lg hover:bg-gray-100 transition-colors",
|
|
1000
1512
|
"aria-label": "Toggle menu",
|
|
1001
|
-
children: mobileMenuOpen ? /* @__PURE__ */ (0,
|
|
1513
|
+
children: mobileMenuOpen ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.X, { className: "w-6 h-6 text-gray-700" }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react4.Menu, { className: "w-6 h-6 text-gray-700" })
|
|
1002
1514
|
}
|
|
1003
1515
|
),
|
|
1004
|
-
/* @__PURE__ */ (0,
|
|
1005
|
-
/* @__PURE__ */ (0,
|
|
1006
|
-
subtitle && /* @__PURE__ */ (0,
|
|
1516
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
|
|
1517
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h1", { className: "text-lg font-bold text-gray-900", children: title }),
|
|
1518
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-xs text-gray-500", children: subtitle })
|
|
1007
1519
|
] })
|
|
1008
1520
|
]
|
|
1009
1521
|
}
|
|
1010
1522
|
) }),
|
|
1011
|
-
mobileMenuOpen && /* @__PURE__ */ (0,
|
|
1523
|
+
mobileMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1012
1524
|
"div",
|
|
1013
1525
|
{
|
|
1014
1526
|
className: "fixed inset-0 bg-black/50 lg:hidden",
|
|
@@ -1016,7 +1528,7 @@ function SidebarNav({
|
|
|
1016
1528
|
onClick: () => setMobileMenuOpen(false)
|
|
1017
1529
|
}
|
|
1018
1530
|
),
|
|
1019
|
-
/* @__PURE__ */ (0,
|
|
1531
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1020
1532
|
"aside",
|
|
1021
1533
|
{
|
|
1022
1534
|
className: `
|
|
@@ -1027,26 +1539,29 @@ function SidebarNav({
|
|
|
1027
1539
|
${mobileMenuOpen ? "translate-x-0" : `${isLeft ? "-translate-x-full" : "translate-x-full"} lg:translate-x-0`}
|
|
1028
1540
|
`,
|
|
1029
1541
|
children: [
|
|
1030
|
-
/* @__PURE__ */ (0,
|
|
1031
|
-
/* @__PURE__ */ (0,
|
|
1032
|
-
subtitle && /* @__PURE__ */ (0,
|
|
1542
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "hidden lg:block p-6 border-b border-gray-200", children: [
|
|
1543
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h1", { className: "text-xl font-bold text-gray-900", children: title }),
|
|
1544
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "text-xs text-gray-500 mt-1", children: subtitle })
|
|
1033
1545
|
] }),
|
|
1034
|
-
/* @__PURE__ */ (0,
|
|
1035
|
-
/* @__PURE__ */ (0,
|
|
1036
|
-
"
|
|
1037
|
-
{
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1546
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "lg:hidden h-[57px]", "aria-hidden": "true" }),
|
|
1547
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("nav", { className: "p-4", children: useSections.map((section, sectionIndex) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: sectionIndex > 0 ? "mt-6" : "", children: [
|
|
1548
|
+
section.title && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h3", { className: "px-4 mb-2 text-xs font-semibold text-gray-500 uppercase tracking-wider", children: section.title }),
|
|
1549
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "space-y-1", children: section.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1550
|
+
"button",
|
|
1551
|
+
{
|
|
1552
|
+
onClick: () => handleItemClick(item.id),
|
|
1553
|
+
className: `
|
|
1554
|
+
w-full flex items-center gap-3 px-4 py-3 rounded-lg text-sm font-medium transition-colors
|
|
1555
|
+
${activeItem === item.id ? "bg-blue-50 text-blue-700" : "text-gray-700 hover:bg-gray-50"}
|
|
1556
|
+
`,
|
|
1557
|
+
children: [
|
|
1558
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "shrink-0", children: item.icon }),
|
|
1559
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: item.label })
|
|
1560
|
+
]
|
|
1561
|
+
}
|
|
1562
|
+
) }, item.id)) })
|
|
1563
|
+
] }, sectionIndex)) }),
|
|
1564
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "p-4 border-t border-gray-200 mt-auto", children: footer })
|
|
1050
1565
|
]
|
|
1051
1566
|
}
|
|
1052
1567
|
)
|
|
@@ -1054,11 +1569,11 @@ function SidebarNav({
|
|
|
1054
1569
|
}
|
|
1055
1570
|
|
|
1056
1571
|
// src/shared/empty-state.tsx
|
|
1057
|
-
var
|
|
1058
|
-
var
|
|
1059
|
-
var EmptyState =
|
|
1572
|
+
var import_react15 = __toESM(require("react"));
|
|
1573
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1574
|
+
var EmptyState = import_react15.default.forwardRef(
|
|
1060
1575
|
({ className, icon, title, description, action, ...props }, ref) => {
|
|
1061
|
-
return /* @__PURE__ */ (0,
|
|
1576
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1062
1577
|
"div",
|
|
1063
1578
|
{
|
|
1064
1579
|
ref,
|
|
@@ -1068,16 +1583,472 @@ var EmptyState = import_react12.default.forwardRef(
|
|
|
1068
1583
|
),
|
|
1069
1584
|
...props,
|
|
1070
1585
|
children: [
|
|
1071
|
-
icon && /* @__PURE__ */ (0,
|
|
1072
|
-
/* @__PURE__ */ (0,
|
|
1073
|
-
description && /* @__PURE__ */ (0,
|
|
1074
|
-
action && /* @__PURE__ */ (0,
|
|
1586
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mb-4 text-gray-400", children: icon }),
|
|
1587
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { className: "text-lg font-semibold text-gray-900 mb-2", children: title }),
|
|
1588
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-sm text-gray-500 mb-6 max-w-sm", children: description }),
|
|
1589
|
+
action && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: action })
|
|
1075
1590
|
]
|
|
1076
1591
|
}
|
|
1077
1592
|
);
|
|
1078
1593
|
}
|
|
1079
1594
|
);
|
|
1080
1595
|
EmptyState.displayName = "EmptyState";
|
|
1596
|
+
|
|
1597
|
+
// src/shared/contexts/ThemeContext.tsx
|
|
1598
|
+
var import_react16 = require("react");
|
|
1599
|
+
|
|
1600
|
+
// src/styles/themes/default.json
|
|
1601
|
+
var default_default = {
|
|
1602
|
+
name: "Default Theme",
|
|
1603
|
+
version: "1.0.0",
|
|
1604
|
+
colors: {
|
|
1605
|
+
primary: {
|
|
1606
|
+
"50": "#eff6ff",
|
|
1607
|
+
"100": "#dbeafe",
|
|
1608
|
+
"200": "#bfdbfe",
|
|
1609
|
+
"300": "#93c5fd",
|
|
1610
|
+
"400": "#60a5fa",
|
|
1611
|
+
"500": "#3b82f6",
|
|
1612
|
+
"600": "#2563eb",
|
|
1613
|
+
"700": "#1d4ed8",
|
|
1614
|
+
"800": "#1e40af",
|
|
1615
|
+
"900": "#1e3a8a"
|
|
1616
|
+
},
|
|
1617
|
+
secondary: {
|
|
1618
|
+
"50": "#f8fafc",
|
|
1619
|
+
"100": "#f1f5f9",
|
|
1620
|
+
"200": "#e2e8f0",
|
|
1621
|
+
"300": "#cbd5e1",
|
|
1622
|
+
"400": "#94a3b8",
|
|
1623
|
+
"500": "#64748b",
|
|
1624
|
+
"600": "#475569",
|
|
1625
|
+
"700": "#334155",
|
|
1626
|
+
"800": "#1e293b",
|
|
1627
|
+
"900": "#0f172a"
|
|
1628
|
+
},
|
|
1629
|
+
success: "#10b981",
|
|
1630
|
+
error: "#ef4444",
|
|
1631
|
+
warning: "#f59e0b",
|
|
1632
|
+
info: "#3b82f6",
|
|
1633
|
+
gray: {
|
|
1634
|
+
"50": "#f9fafb",
|
|
1635
|
+
"100": "#f3f4f6",
|
|
1636
|
+
"200": "#e5e7eb",
|
|
1637
|
+
"300": "#d1d5db",
|
|
1638
|
+
"400": "#9ca3af",
|
|
1639
|
+
"500": "#6b7280",
|
|
1640
|
+
"600": "#4b5563",
|
|
1641
|
+
"700": "#374151",
|
|
1642
|
+
"800": "#1f2937",
|
|
1643
|
+
"900": "#111827"
|
|
1644
|
+
},
|
|
1645
|
+
background: "#ffffff",
|
|
1646
|
+
foreground: "#111827",
|
|
1647
|
+
muted: "#f3f4f6",
|
|
1648
|
+
mutedForeground: "#6b7280"
|
|
1649
|
+
},
|
|
1650
|
+
spacing: {
|
|
1651
|
+
xs: "0.25rem",
|
|
1652
|
+
sm: "0.5rem",
|
|
1653
|
+
md: "1rem",
|
|
1654
|
+
lg: "1.5rem",
|
|
1655
|
+
xl: "2rem",
|
|
1656
|
+
"2xl": "3rem"
|
|
1657
|
+
},
|
|
1658
|
+
borderRadius: {
|
|
1659
|
+
none: "0",
|
|
1660
|
+
sm: "0.25rem",
|
|
1661
|
+
md: "0.5rem",
|
|
1662
|
+
lg: "0.75rem",
|
|
1663
|
+
xl: "1rem",
|
|
1664
|
+
full: "9999px"
|
|
1665
|
+
},
|
|
1666
|
+
typography: {
|
|
1667
|
+
fontFamily: {
|
|
1668
|
+
sans: [
|
|
1669
|
+
"Inter",
|
|
1670
|
+
"system-ui",
|
|
1671
|
+
"-apple-system",
|
|
1672
|
+
"BlinkMacSystemFont",
|
|
1673
|
+
"Segoe UI",
|
|
1674
|
+
"Roboto",
|
|
1675
|
+
"Helvetica Neue",
|
|
1676
|
+
"Arial",
|
|
1677
|
+
"sans-serif"
|
|
1678
|
+
],
|
|
1679
|
+
mono: [
|
|
1680
|
+
"Monaco",
|
|
1681
|
+
"Consolas",
|
|
1682
|
+
"Liberation Mono",
|
|
1683
|
+
"Courier New",
|
|
1684
|
+
"monospace"
|
|
1685
|
+
]
|
|
1686
|
+
},
|
|
1687
|
+
fontSize: {
|
|
1688
|
+
xs: "0.75rem",
|
|
1689
|
+
sm: "0.875rem",
|
|
1690
|
+
base: "1rem",
|
|
1691
|
+
lg: "1.125rem",
|
|
1692
|
+
xl: "1.25rem",
|
|
1693
|
+
"2xl": "1.5rem",
|
|
1694
|
+
"3xl": "1.875rem"
|
|
1695
|
+
},
|
|
1696
|
+
fontWeight: {
|
|
1697
|
+
normal: "400",
|
|
1698
|
+
medium: "500",
|
|
1699
|
+
semibold: "600",
|
|
1700
|
+
bold: "700"
|
|
1701
|
+
}
|
|
1702
|
+
},
|
|
1703
|
+
zIndex: {
|
|
1704
|
+
dropdown: 1e3,
|
|
1705
|
+
popover: 1100,
|
|
1706
|
+
tooltip: 1500,
|
|
1707
|
+
overlay: 1200,
|
|
1708
|
+
nav: 50,
|
|
1709
|
+
navMobileOverlay: 60,
|
|
1710
|
+
navMobileMenu: 70,
|
|
1711
|
+
drawerHeader: 100,
|
|
1712
|
+
drawerButton: 101,
|
|
1713
|
+
drawerOverlay: 90,
|
|
1714
|
+
drawerPanel: 95,
|
|
1715
|
+
modalBackdrop: 1300,
|
|
1716
|
+
modal: 1400,
|
|
1717
|
+
snackbar: 1600,
|
|
1718
|
+
toast: 1700
|
|
1719
|
+
},
|
|
1720
|
+
components: {
|
|
1721
|
+
button: {
|
|
1722
|
+
padding: {
|
|
1723
|
+
xs: { x: "0.5rem", y: "0.375rem" },
|
|
1724
|
+
sm: { x: "0.75rem", y: "0.5rem" },
|
|
1725
|
+
md: { x: "1rem", y: "0.625rem" },
|
|
1726
|
+
lg: { x: "1.25rem", y: "0.75rem" },
|
|
1727
|
+
xl: { x: "1.5rem", y: "0.875rem" }
|
|
1728
|
+
},
|
|
1729
|
+
fontSize: {
|
|
1730
|
+
xs: "0.75rem",
|
|
1731
|
+
sm: "0.875rem",
|
|
1732
|
+
md: "1rem",
|
|
1733
|
+
lg: "1.125rem",
|
|
1734
|
+
xl: "1.25rem"
|
|
1735
|
+
},
|
|
1736
|
+
borderRadius: "0.5rem",
|
|
1737
|
+
fontWeight: "500"
|
|
1738
|
+
},
|
|
1739
|
+
card: {
|
|
1740
|
+
padding: {
|
|
1741
|
+
none: "0",
|
|
1742
|
+
sm: "0.75rem",
|
|
1743
|
+
md: "1rem",
|
|
1744
|
+
lg: "1.5rem"
|
|
1745
|
+
},
|
|
1746
|
+
borderRadius: "0.75rem",
|
|
1747
|
+
borderWidth: "1px",
|
|
1748
|
+
shadow: {
|
|
1749
|
+
flat: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
|
|
1750
|
+
elevated: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"
|
|
1751
|
+
}
|
|
1752
|
+
},
|
|
1753
|
+
input: {
|
|
1754
|
+
padding: {
|
|
1755
|
+
xs: "0.375rem 0.5rem",
|
|
1756
|
+
sm: "0.5rem 0.75rem",
|
|
1757
|
+
md: "0.625rem 1rem",
|
|
1758
|
+
lg: "0.75rem 1.25rem",
|
|
1759
|
+
xl: "0.875rem 1.5rem"
|
|
1760
|
+
},
|
|
1761
|
+
fontSize: {
|
|
1762
|
+
xs: "0.75rem",
|
|
1763
|
+
sm: "0.875rem",
|
|
1764
|
+
md: "1rem",
|
|
1765
|
+
lg: "1.125rem",
|
|
1766
|
+
xl: "1.25rem"
|
|
1767
|
+
},
|
|
1768
|
+
borderRadius: "0.5rem",
|
|
1769
|
+
borderWidth: "1px"
|
|
1770
|
+
},
|
|
1771
|
+
checkbox: {
|
|
1772
|
+
size: {
|
|
1773
|
+
xs: "0.75rem",
|
|
1774
|
+
sm: "0.875rem",
|
|
1775
|
+
md: "1rem",
|
|
1776
|
+
lg: "1.25rem",
|
|
1777
|
+
xl: "1.5rem"
|
|
1778
|
+
},
|
|
1779
|
+
labelSpacing: {
|
|
1780
|
+
xs: "0.25rem",
|
|
1781
|
+
sm: "0.375rem",
|
|
1782
|
+
md: "0.5rem",
|
|
1783
|
+
lg: "0.625rem",
|
|
1784
|
+
xl: "0.75rem"
|
|
1785
|
+
},
|
|
1786
|
+
labelFontSize: {
|
|
1787
|
+
xs: "0.625rem",
|
|
1788
|
+
sm: "0.75rem",
|
|
1789
|
+
md: "0.875rem",
|
|
1790
|
+
lg: "1rem",
|
|
1791
|
+
xl: "1.125rem"
|
|
1792
|
+
},
|
|
1793
|
+
borderRadius: "0.25rem"
|
|
1794
|
+
},
|
|
1795
|
+
radio: {
|
|
1796
|
+
size: {
|
|
1797
|
+
xs: "0.75rem",
|
|
1798
|
+
sm: "0.875rem",
|
|
1799
|
+
md: "1rem",
|
|
1800
|
+
lg: "1.25rem",
|
|
1801
|
+
xl: "1.5rem"
|
|
1802
|
+
},
|
|
1803
|
+
labelSpacing: {
|
|
1804
|
+
xs: "0.25rem",
|
|
1805
|
+
sm: "0.375rem",
|
|
1806
|
+
md: "0.5rem",
|
|
1807
|
+
lg: "0.625rem",
|
|
1808
|
+
xl: "0.75rem"
|
|
1809
|
+
},
|
|
1810
|
+
labelFontSize: {
|
|
1811
|
+
xs: "0.625rem",
|
|
1812
|
+
sm: "0.75rem",
|
|
1813
|
+
md: "0.875rem",
|
|
1814
|
+
lg: "1rem",
|
|
1815
|
+
xl: "1.125rem"
|
|
1816
|
+
}
|
|
1817
|
+
},
|
|
1818
|
+
dropdown: {
|
|
1819
|
+
padding: {
|
|
1820
|
+
xs: { x: "0.5rem", y: "0.25rem" },
|
|
1821
|
+
sm: { x: "0.75rem", y: "0.375rem" },
|
|
1822
|
+
md: { x: "1rem", y: "0.5rem" },
|
|
1823
|
+
lg: { x: "1.25rem", y: "0.625rem" },
|
|
1824
|
+
xl: { x: "1.5rem", y: "0.75rem" }
|
|
1825
|
+
},
|
|
1826
|
+
fontSize: {
|
|
1827
|
+
xs: "0.75rem",
|
|
1828
|
+
sm: "0.875rem",
|
|
1829
|
+
md: "1rem",
|
|
1830
|
+
lg: "1.125rem",
|
|
1831
|
+
xl: "1.25rem"
|
|
1832
|
+
},
|
|
1833
|
+
iconSize: {
|
|
1834
|
+
xs: "0.875rem",
|
|
1835
|
+
sm: "1rem",
|
|
1836
|
+
md: "1.25rem",
|
|
1837
|
+
lg: "1.5rem",
|
|
1838
|
+
xl: "1.75rem"
|
|
1839
|
+
},
|
|
1840
|
+
optionPadding: {
|
|
1841
|
+
xs: { x: "0.5rem", y: "0.25rem" },
|
|
1842
|
+
sm: { x: "0.75rem", y: "0.375rem" },
|
|
1843
|
+
md: { x: "1rem", y: "0.5rem" },
|
|
1844
|
+
lg: { x: "1.25rem", y: "0.625rem" },
|
|
1845
|
+
xl: { x: "1.5rem", y: "0.75rem" }
|
|
1846
|
+
},
|
|
1847
|
+
optionFontSize: {
|
|
1848
|
+
xs: "0.625rem",
|
|
1849
|
+
sm: "0.75rem",
|
|
1850
|
+
md: "0.875rem",
|
|
1851
|
+
lg: "1rem",
|
|
1852
|
+
xl: "1.125rem"
|
|
1853
|
+
},
|
|
1854
|
+
borderRadius: "0.5rem",
|
|
1855
|
+
borderWidth: "1px"
|
|
1856
|
+
},
|
|
1857
|
+
nav: {
|
|
1858
|
+
height: "4rem",
|
|
1859
|
+
itemPadding: {
|
|
1860
|
+
xs: { x: "0.375rem", y: "0.25rem" },
|
|
1861
|
+
sm: { x: "0.5rem", y: "0.375rem" },
|
|
1862
|
+
md: { x: "0.75rem", y: "0.5rem" },
|
|
1863
|
+
lg: { x: "1rem", y: "0.625rem" },
|
|
1864
|
+
xl: { x: "1.25rem", y: "0.75rem" }
|
|
1865
|
+
},
|
|
1866
|
+
fontSize: {
|
|
1867
|
+
xs: "0.625rem",
|
|
1868
|
+
sm: "0.75rem",
|
|
1869
|
+
md: "0.875rem",
|
|
1870
|
+
lg: "1rem",
|
|
1871
|
+
xl: "1.125rem"
|
|
1872
|
+
},
|
|
1873
|
+
borderRadius: "0.375rem",
|
|
1874
|
+
gap: "0.25rem"
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
};
|
|
1878
|
+
|
|
1879
|
+
// src/shared/contexts/ThemeContext.tsx
|
|
1880
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1881
|
+
var ThemeContext = (0, import_react16.createContext)(void 0);
|
|
1882
|
+
function ThemeProvider({ children }) {
|
|
1883
|
+
const [theme, setThemeState] = (0, import_react16.useState)(default_default);
|
|
1884
|
+
const applyTheme = (newTheme) => {
|
|
1885
|
+
const root = document.documentElement;
|
|
1886
|
+
const colors = newTheme.colors;
|
|
1887
|
+
Object.entries(colors.primary).forEach(([shade, value]) => {
|
|
1888
|
+
if (value) {
|
|
1889
|
+
root.style.setProperty(`--color-primary-${shade}`, value);
|
|
1890
|
+
}
|
|
1891
|
+
});
|
|
1892
|
+
Object.entries(colors.secondary).forEach(([shade, value]) => {
|
|
1893
|
+
if (value) {
|
|
1894
|
+
root.style.setProperty(`--color-secondary-${shade}`, value);
|
|
1895
|
+
}
|
|
1896
|
+
});
|
|
1897
|
+
root.style.setProperty("--color-success", colors.success);
|
|
1898
|
+
root.style.setProperty("--color-error", colors.error);
|
|
1899
|
+
root.style.setProperty("--color-warning", colors.warning);
|
|
1900
|
+
root.style.setProperty("--color-info", colors.info);
|
|
1901
|
+
Object.entries(colors.gray).forEach(([shade, value]) => {
|
|
1902
|
+
if (value) {
|
|
1903
|
+
root.style.setProperty(`--color-gray-${shade}`, value);
|
|
1904
|
+
}
|
|
1905
|
+
});
|
|
1906
|
+
root.style.setProperty("--color-background", colors.background);
|
|
1907
|
+
root.style.setProperty("--color-foreground", colors.foreground);
|
|
1908
|
+
root.style.setProperty("--color-muted", colors.muted);
|
|
1909
|
+
root.style.setProperty("--color-muted-foreground", colors.mutedForeground);
|
|
1910
|
+
Object.entries(newTheme.spacing).forEach(([key, value]) => {
|
|
1911
|
+
root.style.setProperty(`--spacing-${key}`, value);
|
|
1912
|
+
});
|
|
1913
|
+
Object.entries(newTheme.borderRadius).forEach(([key, value]) => {
|
|
1914
|
+
root.style.setProperty(`--radius-${key}`, value);
|
|
1915
|
+
});
|
|
1916
|
+
const { typography } = newTheme;
|
|
1917
|
+
root.style.setProperty(
|
|
1918
|
+
"--font-sans",
|
|
1919
|
+
typography.fontFamily.sans.join(", ")
|
|
1920
|
+
);
|
|
1921
|
+
root.style.setProperty(
|
|
1922
|
+
"--font-mono",
|
|
1923
|
+
typography.fontFamily.mono.join(", ")
|
|
1924
|
+
);
|
|
1925
|
+
Object.entries(typography.fontSize).forEach(([key, value]) => {
|
|
1926
|
+
root.style.setProperty(`--text-${key}`, value);
|
|
1927
|
+
});
|
|
1928
|
+
Object.entries(typography.fontWeight).forEach(([key, value]) => {
|
|
1929
|
+
root.style.setProperty(`--font-${key}`, value);
|
|
1930
|
+
});
|
|
1931
|
+
const button = newTheme.components.button;
|
|
1932
|
+
Object.entries(button.padding).forEach(([size, padding]) => {
|
|
1933
|
+
root.style.setProperty(`--button-padding-${size}-x`, padding.x);
|
|
1934
|
+
root.style.setProperty(`--button-padding-${size}-y`, padding.y);
|
|
1935
|
+
});
|
|
1936
|
+
Object.entries(button.fontSize).forEach(([size, fontSize]) => {
|
|
1937
|
+
root.style.setProperty(`--button-font-size-${size}`, fontSize);
|
|
1938
|
+
});
|
|
1939
|
+
root.style.setProperty("--button-radius", button.borderRadius);
|
|
1940
|
+
root.style.setProperty("--button-font-weight", button.fontWeight);
|
|
1941
|
+
const card = newTheme.components.card;
|
|
1942
|
+
Object.entries(card.padding).forEach(([size, padding]) => {
|
|
1943
|
+
root.style.setProperty(`--card-padding-${size}`, padding);
|
|
1944
|
+
});
|
|
1945
|
+
root.style.setProperty("--card-radius", card.borderRadius);
|
|
1946
|
+
root.style.setProperty("--card-border-width", card.borderWidth);
|
|
1947
|
+
root.style.setProperty("--card-shadow-flat", card.shadow.flat);
|
|
1948
|
+
root.style.setProperty("--card-shadow-elevated", card.shadow.elevated);
|
|
1949
|
+
const input = newTheme.components.input;
|
|
1950
|
+
Object.entries(input.padding).forEach(([size, padding]) => {
|
|
1951
|
+
root.style.setProperty(`--input-padding-${size}`, padding);
|
|
1952
|
+
});
|
|
1953
|
+
Object.entries(input.fontSize).forEach(([size, fontSize]) => {
|
|
1954
|
+
root.style.setProperty(`--input-font-size-${size}`, fontSize);
|
|
1955
|
+
});
|
|
1956
|
+
root.style.setProperty("--input-radius", input.borderRadius);
|
|
1957
|
+
root.style.setProperty("--input-border-width", input.borderWidth);
|
|
1958
|
+
const checkbox = newTheme.components.checkbox;
|
|
1959
|
+
Object.entries(checkbox.size).forEach(([size, dimension]) => {
|
|
1960
|
+
root.style.setProperty(`--checkbox-size-${size}`, dimension);
|
|
1961
|
+
});
|
|
1962
|
+
Object.entries(checkbox.labelSpacing).forEach(([size, spacing]) => {
|
|
1963
|
+
root.style.setProperty(`--checkbox-label-spacing-${size}`, spacing);
|
|
1964
|
+
});
|
|
1965
|
+
Object.entries(checkbox.labelFontSize).forEach(([size, fontSize]) => {
|
|
1966
|
+
root.style.setProperty(`--checkbox-label-font-size-${size}`, fontSize);
|
|
1967
|
+
});
|
|
1968
|
+
root.style.setProperty("--checkbox-radius", checkbox.borderRadius);
|
|
1969
|
+
const radio = newTheme.components.radio;
|
|
1970
|
+
Object.entries(radio.size).forEach(([size, dimension]) => {
|
|
1971
|
+
root.style.setProperty(`--radio-size-${size}`, dimension);
|
|
1972
|
+
});
|
|
1973
|
+
Object.entries(radio.labelSpacing).forEach(([size, spacing]) => {
|
|
1974
|
+
root.style.setProperty(`--radio-label-spacing-${size}`, spacing);
|
|
1975
|
+
});
|
|
1976
|
+
Object.entries(radio.labelFontSize).forEach(([size, fontSize]) => {
|
|
1977
|
+
root.style.setProperty(`--radio-label-font-size-${size}`, fontSize);
|
|
1978
|
+
});
|
|
1979
|
+
const dropdown = newTheme.components.dropdown;
|
|
1980
|
+
Object.entries(dropdown.padding).forEach(([size, padding]) => {
|
|
1981
|
+
root.style.setProperty(`--dropdown-padding-${size}-x`, padding.x);
|
|
1982
|
+
root.style.setProperty(`--dropdown-padding-${size}-y`, padding.y);
|
|
1983
|
+
});
|
|
1984
|
+
Object.entries(dropdown.fontSize).forEach(([size, fontSize]) => {
|
|
1985
|
+
root.style.setProperty(`--dropdown-font-size-${size}`, fontSize);
|
|
1986
|
+
});
|
|
1987
|
+
Object.entries(dropdown.iconSize).forEach(([size, iconSize]) => {
|
|
1988
|
+
root.style.setProperty(`--dropdown-icon-size-${size}`, iconSize);
|
|
1989
|
+
});
|
|
1990
|
+
Object.entries(dropdown.optionPadding).forEach(([size, padding]) => {
|
|
1991
|
+
root.style.setProperty(`--dropdown-option-padding-${size}-x`, padding.x);
|
|
1992
|
+
root.style.setProperty(`--dropdown-option-padding-${size}-y`, padding.y);
|
|
1993
|
+
});
|
|
1994
|
+
Object.entries(dropdown.optionFontSize).forEach(([size, fontSize]) => {
|
|
1995
|
+
root.style.setProperty(`--dropdown-option-font-size-${size}`, fontSize);
|
|
1996
|
+
});
|
|
1997
|
+
root.style.setProperty("--dropdown-radius", dropdown.borderRadius);
|
|
1998
|
+
root.style.setProperty("--dropdown-border-width", dropdown.borderWidth);
|
|
1999
|
+
const nav = newTheme.components.nav;
|
|
2000
|
+
root.style.setProperty("--nav-height", nav.height);
|
|
2001
|
+
Object.entries(nav.itemPadding).forEach(([size, padding]) => {
|
|
2002
|
+
root.style.setProperty(`--nav-item-padding-${size}-x`, padding.x);
|
|
2003
|
+
root.style.setProperty(`--nav-item-padding-${size}-y`, padding.y);
|
|
2004
|
+
});
|
|
2005
|
+
Object.entries(nav.fontSize).forEach(([size, fontSize]) => {
|
|
2006
|
+
root.style.setProperty(`--nav-font-size-${size}`, fontSize);
|
|
2007
|
+
});
|
|
2008
|
+
root.style.setProperty("--nav-border-radius", nav.borderRadius);
|
|
2009
|
+
root.style.setProperty("--nav-gap", nav.gap);
|
|
2010
|
+
Object.entries(newTheme.zIndex).forEach(([key, value]) => {
|
|
2011
|
+
root.style.setProperty(`--z-index-${key}`, value.toString());
|
|
2012
|
+
});
|
|
2013
|
+
setThemeState(newTheme);
|
|
2014
|
+
};
|
|
2015
|
+
const setTheme = (newTheme) => {
|
|
2016
|
+
applyTheme(newTheme);
|
|
2017
|
+
if (typeof window !== "undefined") {
|
|
2018
|
+
localStorage.setItem("theme", JSON.stringify(newTheme));
|
|
2019
|
+
}
|
|
2020
|
+
};
|
|
2021
|
+
const resetTheme = () => {
|
|
2022
|
+
applyTheme(default_default);
|
|
2023
|
+
if (typeof window !== "undefined") {
|
|
2024
|
+
localStorage.removeItem("theme");
|
|
2025
|
+
}
|
|
2026
|
+
};
|
|
2027
|
+
(0, import_react16.useEffect)(() => {
|
|
2028
|
+
if (typeof window !== "undefined") {
|
|
2029
|
+
const savedTheme = localStorage.getItem("theme");
|
|
2030
|
+
if (savedTheme) {
|
|
2031
|
+
try {
|
|
2032
|
+
const parsedTheme = JSON.parse(savedTheme);
|
|
2033
|
+
applyTheme(parsedTheme);
|
|
2034
|
+
} catch (error) {
|
|
2035
|
+
console.error("Failed to parse saved theme:", error);
|
|
2036
|
+
applyTheme(default_default);
|
|
2037
|
+
}
|
|
2038
|
+
} else {
|
|
2039
|
+
applyTheme(default_default);
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
}, []);
|
|
2043
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ThemeContext.Provider, { value: { theme, setTheme, applyTheme, resetTheme }, children });
|
|
2044
|
+
}
|
|
2045
|
+
function useTheme() {
|
|
2046
|
+
const context = (0, import_react16.useContext)(ThemeContext);
|
|
2047
|
+
if (context === void 0) {
|
|
2048
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
2049
|
+
}
|
|
2050
|
+
return context;
|
|
2051
|
+
}
|
|
1081
2052
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1082
2053
|
0 && (module.exports = {
|
|
1083
2054
|
Alert,
|
|
@@ -1093,13 +2064,17 @@ EmptyState.displayName = "EmptyState";
|
|
|
1093
2064
|
CheckboxGroup,
|
|
1094
2065
|
CodeSnippet,
|
|
1095
2066
|
Container,
|
|
2067
|
+
Drawer,
|
|
1096
2068
|
Dropdown,
|
|
1097
2069
|
EmptyState,
|
|
1098
2070
|
Input,
|
|
2071
|
+
Nav,
|
|
1099
2072
|
RadioGroup,
|
|
1100
2073
|
SectionLayout,
|
|
1101
2074
|
SidebarNav,
|
|
1102
2075
|
Spinner,
|
|
1103
|
-
|
|
2076
|
+
ThemeProvider,
|
|
2077
|
+
cn,
|
|
2078
|
+
useTheme
|
|
1104
2079
|
});
|
|
1105
2080
|
//# sourceMappingURL=index.js.map
|