@northslopetech/altitude-ui 2.0.2 → 2.0.5
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 +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +394 -327
- package/dist/index.mjs +394 -325
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55,10 +55,8 @@ __export(index_exports, {
|
|
|
55
55
|
badgeVariants: () => badgeVariants,
|
|
56
56
|
buttonVariants: () => buttonVariants,
|
|
57
57
|
checkboxVariants: () => checkboxVariants,
|
|
58
|
-
datePickerTriggerVariants: () => datePickerTriggerVariants,
|
|
59
58
|
inputVariants: () => inputVariants,
|
|
60
59
|
selectTriggerVariants: () => selectTriggerVariants,
|
|
61
|
-
tabsListVariants: () => tabsListVariants,
|
|
62
60
|
tabsVariants: () => tabsVariants,
|
|
63
61
|
typographyVariants: () => typographyVariants,
|
|
64
62
|
uploadVariants: () => uploadVariants
|
|
@@ -90,7 +88,7 @@ var buttonVariants = (0, import_class_variance_authority2.cva)(
|
|
|
90
88
|
destructive: "bg-error text-light shadow-sm hover:brightness-[60%] active:brightness-[80%] focus-visible:ring-2 focus-visible:ring-error focus-visible:ring-offset-2",
|
|
91
89
|
"destructive-subtle": "bg-light text-error border border-secondary shadow-sm hover:brightness-[70%] active:brightness-[90%] focus-visible:ring-2 focus-visible:ring-error focus-visible:ring-offset-2",
|
|
92
90
|
ghost: "bg-light text-dark hover:brightness-[70%] active:brightness-[90%] focus-visible:ring-2 focus-visible:ring-interactive focus-visible:ring-offset-2",
|
|
93
|
-
link: "bg-light text-dark underline underline-offset-4 hover:
|
|
91
|
+
link: "bg-light text-dark underline underline-offset-4 hover:cursor-pointer active:text-info"
|
|
94
92
|
},
|
|
95
93
|
size: {
|
|
96
94
|
sm: "h-8 rounded-md px-2 py-2 min-w-[120px]",
|
|
@@ -223,7 +221,19 @@ var import_class_variance_authority4 = require("class-variance-authority");
|
|
|
223
221
|
var import_lucide_react = require("lucide-react");
|
|
224
222
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
225
223
|
var selectTriggerVariants = (0, import_class_variance_authority4.cva)(
|
|
226
|
-
"flex
|
|
224
|
+
"flex items-center justify-between border bg-light text-dark focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 transition-colors rounded-md px-3",
|
|
225
|
+
{
|
|
226
|
+
variants: {
|
|
227
|
+
width: {
|
|
228
|
+
default: "w-full min-w-80",
|
|
229
|
+
fill: "w-full",
|
|
230
|
+
compact: "w-auto min-w-32"
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
defaultVariants: {
|
|
234
|
+
width: "default"
|
|
235
|
+
}
|
|
236
|
+
}
|
|
227
237
|
);
|
|
228
238
|
var selectContentVariants = (0, import_class_variance_authority4.cva)(
|
|
229
239
|
"relative z-50 max-h-60 min-w-32 overflow-hidden rounded-lg border border-secondary bg-light text-dark shadow-lg animate-in fade-in-0 zoom-in-95 duration-200",
|
|
@@ -245,7 +255,7 @@ var SelectGroup = SelectPrimitive.Group;
|
|
|
245
255
|
SelectGroup.displayName = "SelectGroup";
|
|
246
256
|
var SelectValue = SelectPrimitive.Value;
|
|
247
257
|
SelectValue.displayName = "SelectValue";
|
|
248
|
-
var SelectTrigger = React3.forwardRef(({ className, children, style, ...props }, ref) => {
|
|
258
|
+
var SelectTrigger = React3.forwardRef(({ className, children, style, width, ...props }, ref) => {
|
|
249
259
|
const tokenStyles = {
|
|
250
260
|
font: "var(--typography-label-md-regular)",
|
|
251
261
|
...style
|
|
@@ -255,7 +265,7 @@ var SelectTrigger = React3.forwardRef(({ className, children, style, ...props },
|
|
|
255
265
|
{
|
|
256
266
|
ref,
|
|
257
267
|
className: cn(
|
|
258
|
-
selectTriggerVariants(),
|
|
268
|
+
selectTriggerVariants({ width }),
|
|
259
269
|
"border-secondary focus-visible:border-2 focus-visible:border-strong data-[state=open]:[&_svg]:rotate-180 data-[placeholder]:text-secondary h-10 py-2",
|
|
260
270
|
className
|
|
261
271
|
),
|
|
@@ -471,30 +481,190 @@ var FormField = React4.forwardRef(
|
|
|
471
481
|
FormField.displayName = "FormField";
|
|
472
482
|
|
|
473
483
|
// src/components/ui/date-picker.tsx
|
|
474
|
-
var
|
|
484
|
+
var React6 = __toESM(require("react"));
|
|
475
485
|
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"));
|
|
486
|
+
var import_lucide_react3 = require("lucide-react");
|
|
487
|
+
|
|
488
|
+
// src/components/ui/input.tsx
|
|
489
|
+
var React5 = __toESM(require("react"));
|
|
476
490
|
var import_class_variance_authority5 = require("class-variance-authority");
|
|
477
491
|
var import_lucide_react2 = require("lucide-react");
|
|
478
492
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
479
|
-
var
|
|
480
|
-
"flex w-full
|
|
493
|
+
var inputVariants = (0, import_class_variance_authority5.cva)(
|
|
494
|
+
"flex w-full border bg-light text-dark focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:border-secondary transition-colors rounded-md px-3 min-w-80 border-secondary focus-visible:border-2 focus-visible:border-strong placeholder:text-secondary read-only:bg-gray read-only:cursor-default read-only:border-transparent read-only:text-secondary read-only:focus-visible:border-transparent",
|
|
495
|
+
{
|
|
496
|
+
variants: {
|
|
497
|
+
variant: {
|
|
498
|
+
input: "h-10 py-2",
|
|
499
|
+
textarea: "min-h-20 resize-none pt-4 pb-2"
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
defaultVariants: {
|
|
503
|
+
variant: "input"
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
);
|
|
507
|
+
var Input = React5.forwardRef(
|
|
508
|
+
({
|
|
509
|
+
className,
|
|
510
|
+
variant = "input",
|
|
511
|
+
style,
|
|
512
|
+
value,
|
|
513
|
+
onChange,
|
|
514
|
+
onClear,
|
|
515
|
+
showClear: showClearProp,
|
|
516
|
+
readOnly,
|
|
517
|
+
...props
|
|
518
|
+
}, ref) => {
|
|
519
|
+
const [internalValue, setInternalValue] = React5.useState(value || "");
|
|
520
|
+
const isControlled = value !== void 0;
|
|
521
|
+
const currentValue = isControlled ? value : internalValue;
|
|
522
|
+
const showClear = showClearProp !== false && currentValue && currentValue.toString().length > 0 && !readOnly;
|
|
523
|
+
const showLock = readOnly;
|
|
524
|
+
const tokenStyles = {
|
|
525
|
+
font: "var(--typography-label-md-regular)",
|
|
526
|
+
...style
|
|
527
|
+
};
|
|
528
|
+
const handleInputChange = (e) => {
|
|
529
|
+
if (!isControlled) {
|
|
530
|
+
setInternalValue(e.target.value);
|
|
531
|
+
}
|
|
532
|
+
if (variant === "input" && onChange) {
|
|
533
|
+
onChange(e);
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
const handleTextareaChange = (e) => {
|
|
537
|
+
if (!isControlled) {
|
|
538
|
+
setInternalValue(e.target.value);
|
|
539
|
+
}
|
|
540
|
+
if (variant === "textarea" && onChange) {
|
|
541
|
+
onChange(e);
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
const handleClear = () => {
|
|
545
|
+
if (!isControlled) {
|
|
546
|
+
setInternalValue("");
|
|
547
|
+
}
|
|
548
|
+
if (onChange) {
|
|
549
|
+
if (variant === "input") {
|
|
550
|
+
const inputEvent = {
|
|
551
|
+
target: { value: "" },
|
|
552
|
+
currentTarget: { value: "" }
|
|
553
|
+
};
|
|
554
|
+
onChange(inputEvent);
|
|
555
|
+
} else {
|
|
556
|
+
const textareaEvent = {
|
|
557
|
+
target: { value: "" },
|
|
558
|
+
currentTarget: { value: "" }
|
|
559
|
+
};
|
|
560
|
+
onChange(
|
|
561
|
+
textareaEvent
|
|
562
|
+
);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
onClear?.();
|
|
566
|
+
};
|
|
567
|
+
if (variant === "textarea") {
|
|
568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
|
|
569
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
570
|
+
"textarea",
|
|
571
|
+
{
|
|
572
|
+
className: cn(
|
|
573
|
+
inputVariants({ variant }),
|
|
574
|
+
(showClear || showLock) && "pr-10",
|
|
575
|
+
className
|
|
576
|
+
),
|
|
577
|
+
style: tokenStyles,
|
|
578
|
+
ref,
|
|
579
|
+
value: currentValue,
|
|
580
|
+
onChange: handleTextareaChange,
|
|
581
|
+
readOnly,
|
|
582
|
+
...props
|
|
583
|
+
}
|
|
584
|
+
),
|
|
585
|
+
showClear && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
586
|
+
"button",
|
|
587
|
+
{
|
|
588
|
+
type: "button",
|
|
589
|
+
onClick: handleClear,
|
|
590
|
+
className: "absolute right-3 top-3 h-4 w-4 text-secondary hover:text-dark transition-colors",
|
|
591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.X, { className: "h-4 w-4" })
|
|
592
|
+
}
|
|
593
|
+
),
|
|
594
|
+
showLock && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Lock, { className: "absolute right-3 top-3 h-4 w-4 text-secondary" })
|
|
595
|
+
] });
|
|
596
|
+
}
|
|
597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "relative", children: [
|
|
598
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
599
|
+
"input",
|
|
600
|
+
{
|
|
601
|
+
className: cn(
|
|
602
|
+
inputVariants({ variant }),
|
|
603
|
+
(showClear || showLock) && "pr-10",
|
|
604
|
+
className
|
|
605
|
+
),
|
|
606
|
+
style: tokenStyles,
|
|
607
|
+
ref,
|
|
608
|
+
value: currentValue,
|
|
609
|
+
onChange: handleInputChange,
|
|
610
|
+
readOnly,
|
|
611
|
+
...props
|
|
612
|
+
}
|
|
613
|
+
),
|
|
614
|
+
showClear && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
615
|
+
"button",
|
|
616
|
+
{
|
|
617
|
+
type: "button",
|
|
618
|
+
onClick: handleClear,
|
|
619
|
+
className: "absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-secondary hover:text-dark transition-colors",
|
|
620
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.X, { className: "h-4 w-4" })
|
|
621
|
+
}
|
|
622
|
+
),
|
|
623
|
+
showLock && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react2.Lock, { className: "absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-secondary" })
|
|
624
|
+
] });
|
|
625
|
+
}
|
|
481
626
|
);
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
627
|
+
Input.displayName = "Input";
|
|
628
|
+
var TypedInput = Input;
|
|
629
|
+
|
|
630
|
+
// src/components/ui/date-picker.tsx
|
|
631
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
632
|
+
var getDayNames = () => {
|
|
633
|
+
const days = [];
|
|
634
|
+
for (let i = 0; i < 7; i++) {
|
|
635
|
+
days.push(
|
|
636
|
+
new Intl.DateTimeFormat("en-US", { weekday: "narrow" }).format(
|
|
637
|
+
new Date(2e3, 0, i + 1)
|
|
638
|
+
)
|
|
639
|
+
);
|
|
640
|
+
}
|
|
641
|
+
return days;
|
|
642
|
+
};
|
|
643
|
+
var getMonthNames = () => {
|
|
644
|
+
const months = [];
|
|
645
|
+
for (let i = 0; i < 12; i++) {
|
|
646
|
+
months.push(
|
|
647
|
+
new Intl.DateTimeFormat("en-US", { month: "long" }).format(
|
|
648
|
+
new Date(2e3, i, 1)
|
|
649
|
+
)
|
|
650
|
+
);
|
|
651
|
+
}
|
|
652
|
+
return months;
|
|
653
|
+
};
|
|
654
|
+
var parseDateInput = (input) => {
|
|
655
|
+
if (!input.trim()) return null;
|
|
656
|
+
const date = new Date(input);
|
|
657
|
+
if (isNaN(date.getTime())) return null;
|
|
658
|
+
return date;
|
|
659
|
+
};
|
|
660
|
+
var formatDateInput = (date) => {
|
|
661
|
+
return date.toLocaleDateString("en-US", {
|
|
662
|
+
year: "numeric",
|
|
663
|
+
month: "2-digit",
|
|
664
|
+
day: "2-digit"
|
|
665
|
+
});
|
|
666
|
+
};
|
|
667
|
+
var DatePicker = React6.forwardRef(
|
|
498
668
|
({
|
|
499
669
|
value,
|
|
500
670
|
onValueChange,
|
|
@@ -511,20 +681,30 @@ var DatePicker = React5.forwardRef(
|
|
|
511
681
|
if (isNaN(parsed.getTime())) return void 0;
|
|
512
682
|
return parsed;
|
|
513
683
|
};
|
|
514
|
-
const [selectedDate, setSelectedDate] =
|
|
684
|
+
const [selectedDate, setSelectedDate] = React6.useState(
|
|
515
685
|
value || parseDate(defaultValue)
|
|
516
686
|
);
|
|
517
|
-
const [currentMonth, setCurrentMonth] =
|
|
687
|
+
const [currentMonth, setCurrentMonth] = React6.useState(() => {
|
|
518
688
|
const date = value || parseDate(defaultValue) || /* @__PURE__ */ new Date();
|
|
519
689
|
return new Date(date.getFullYear(), date.getMonth());
|
|
520
690
|
});
|
|
521
|
-
const [open, setOpen] =
|
|
522
|
-
|
|
691
|
+
const [open, setOpen] = React6.useState(false);
|
|
692
|
+
const [inputValue, setInputValue] = React6.useState(() => {
|
|
693
|
+
const initialDate = value || parseDate(defaultValue);
|
|
694
|
+
return initialDate ? formatDateInput(initialDate) : "";
|
|
695
|
+
});
|
|
696
|
+
React6.useEffect(() => {
|
|
523
697
|
setSelectedDate(value);
|
|
524
|
-
if (
|
|
525
|
-
|
|
698
|
+
if (value) {
|
|
699
|
+
setCurrentMonth(new Date(value.getFullYear(), value.getMonth()));
|
|
700
|
+
setInputValue(formatDateInput(value));
|
|
701
|
+
} else if (value === void 0) {
|
|
702
|
+
return;
|
|
703
|
+
} else {
|
|
704
|
+
setInputValue("");
|
|
705
|
+
}
|
|
526
706
|
}, [value]);
|
|
527
|
-
|
|
707
|
+
React6.useEffect(() => {
|
|
528
708
|
if (value) return;
|
|
529
709
|
const parsedDefault = parseDate(defaultValue);
|
|
530
710
|
if (!parsedDefault) return;
|
|
@@ -532,13 +712,51 @@ var DatePicker = React5.forwardRef(
|
|
|
532
712
|
setCurrentMonth(
|
|
533
713
|
new Date(parsedDefault.getFullYear(), parsedDefault.getMonth())
|
|
534
714
|
);
|
|
715
|
+
setInputValue(formatDateInput(parsedDefault));
|
|
535
716
|
}, [defaultValue, value]);
|
|
536
717
|
const handleDateSelect = (date) => {
|
|
537
718
|
const newDate = new Date(date);
|
|
538
719
|
setSelectedDate(newDate);
|
|
720
|
+
setInputValue(formatDateInput(newDate));
|
|
539
721
|
onValueChange?.(newDate);
|
|
540
722
|
setOpen(false);
|
|
541
723
|
};
|
|
724
|
+
const handleInputChange = (e) => {
|
|
725
|
+
const rawValue = e.target.value;
|
|
726
|
+
const cursorPosition = e.target.selectionStart || 0;
|
|
727
|
+
const input = e.target;
|
|
728
|
+
const numbersOnly = rawValue.replace(/\D/g, "");
|
|
729
|
+
let formattedValue = "";
|
|
730
|
+
if (numbersOnly.length > 0) {
|
|
731
|
+
if (numbersOnly.length <= 2) {
|
|
732
|
+
formattedValue = numbersOnly;
|
|
733
|
+
} else if (numbersOnly.length <= 4) {
|
|
734
|
+
formattedValue = `${numbersOnly.slice(0, 2)}/${numbersOnly.slice(2)}`;
|
|
735
|
+
} else {
|
|
736
|
+
formattedValue = `${numbersOnly.slice(0, 2)}/${numbersOnly.slice(2, 4)}/${numbersOnly.slice(4, 8)}`;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
setInputValue(formattedValue);
|
|
740
|
+
setTimeout(() => {
|
|
741
|
+
let newPosition = cursorPosition;
|
|
742
|
+
if (formattedValue.length > rawValue.length) {
|
|
743
|
+
newPosition = Math.min(cursorPosition + 1, formattedValue.length);
|
|
744
|
+
}
|
|
745
|
+
newPosition = Math.max(0, Math.min(newPosition, formattedValue.length));
|
|
746
|
+
input.setSelectionRange(newPosition, newPosition);
|
|
747
|
+
}, 0);
|
|
748
|
+
const parsedDate = parseDateInput(formattedValue);
|
|
749
|
+
if (parsedDate) {
|
|
750
|
+
setSelectedDate(parsedDate);
|
|
751
|
+
setCurrentMonth(
|
|
752
|
+
new Date(parsedDate.getFullYear(), parsedDate.getMonth())
|
|
753
|
+
);
|
|
754
|
+
onValueChange?.(parsedDate);
|
|
755
|
+
} else if (formattedValue === "") {
|
|
756
|
+
setSelectedDate(void 0);
|
|
757
|
+
onValueChange?.(void 0);
|
|
758
|
+
}
|
|
759
|
+
};
|
|
542
760
|
const handleMonthChange = (direction) => {
|
|
543
761
|
setCurrentMonth((prev) => {
|
|
544
762
|
const newMonth = new Date(prev);
|
|
@@ -550,112 +768,129 @@ var DatePicker = React5.forwardRef(
|
|
|
550
768
|
return newMonth;
|
|
551
769
|
});
|
|
552
770
|
};
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
771
|
+
const handleMonthSelect = (monthIndex) => {
|
|
772
|
+
const newMonth = new Date(currentMonth);
|
|
773
|
+
newMonth.setMonth(parseInt(monthIndex, 10));
|
|
774
|
+
setCurrentMonth(newMonth);
|
|
775
|
+
};
|
|
776
|
+
const handleYearSelect = (year) => {
|
|
777
|
+
const newMonth = new Date(currentMonth);
|
|
778
|
+
newMonth.setFullYear(parseInt(year, 10));
|
|
779
|
+
setCurrentMonth(newMonth);
|
|
559
780
|
};
|
|
560
781
|
const getDaysInMonth = (date) => {
|
|
561
782
|
const year = date.getFullYear();
|
|
562
783
|
const month = date.getMonth();
|
|
563
784
|
const firstDay = new Date(year, month, 1);
|
|
564
|
-
const
|
|
565
|
-
const daysInMonth = lastDay.getDate();
|
|
785
|
+
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
566
786
|
const startingDayOfWeek = firstDay.getDay();
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
787
|
+
return [
|
|
788
|
+
// Empty cells for days before the first day of the month
|
|
789
|
+
...Array(startingDayOfWeek).fill(null),
|
|
790
|
+
// All days of the month
|
|
791
|
+
...Array.from(
|
|
792
|
+
{ length: daysInMonth },
|
|
793
|
+
(_, i) => new Date(year, month, i + 1)
|
|
794
|
+
)
|
|
795
|
+
];
|
|
575
796
|
};
|
|
576
797
|
const isDateSelected = (date) => {
|
|
577
798
|
if (!selectedDate) return false;
|
|
578
799
|
return date.getTime() === selectedDate.getTime();
|
|
579
800
|
};
|
|
580
801
|
const isToday = (date) => {
|
|
581
|
-
|
|
802
|
+
const today = /* @__PURE__ */ new Date();
|
|
803
|
+
return date.toDateString() === today.toDateString();
|
|
582
804
|
};
|
|
583
805
|
const days = getDaysInMonth(currentMonth);
|
|
584
|
-
|
|
806
|
+
const months = getMonthNames();
|
|
807
|
+
const dayNames = getDayNames();
|
|
808
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
809
|
+
const years = Array.from({ length: 100 }, (_, i) => currentYear - 50 + i);
|
|
810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
585
811
|
PopoverPrimitive.Root,
|
|
586
812
|
{
|
|
587
813
|
open: disabled ? false : open,
|
|
588
814
|
onOpenChange: disabled ? void 0 : setOpen,
|
|
589
815
|
children: [
|
|
590
|
-
/* @__PURE__ */ (0,
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
disabled && "text-secondary"
|
|
611
|
-
),
|
|
612
|
-
children: selectedDate ? formatDate(selectedDate) : placeholder
|
|
613
|
-
}
|
|
614
|
-
),
|
|
615
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
616
|
-
import_lucide_react2.Calendar,
|
|
617
|
-
{
|
|
618
|
-
className: cn(
|
|
619
|
-
"h-5 w-5 flex-shrink-0",
|
|
620
|
-
disabled ? "text-secondary opacity-50" : "text-secondary"
|
|
621
|
-
)
|
|
622
|
-
}
|
|
816
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative", children: [
|
|
817
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
818
|
+
TypedInput,
|
|
819
|
+
{
|
|
820
|
+
ref,
|
|
821
|
+
value: inputValue,
|
|
822
|
+
onChange: handleInputChange,
|
|
823
|
+
placeholder,
|
|
824
|
+
disabled,
|
|
825
|
+
className: cn("pr-10", className),
|
|
826
|
+
showClear: false,
|
|
827
|
+
...props
|
|
828
|
+
}
|
|
829
|
+
),
|
|
830
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { className: "absolute right-3 top-1/2 transform -translate-y-1/2 hover:bg-gray rounded p-0.5 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
831
|
+
import_lucide_react3.Calendar,
|
|
832
|
+
{
|
|
833
|
+
className: cn(
|
|
834
|
+
"h-5 w-5 flex-shrink-0",
|
|
835
|
+
disabled ? "text-secondary opacity-50" : "text-secondary"
|
|
623
836
|
)
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
/* @__PURE__ */ (0,
|
|
837
|
+
}
|
|
838
|
+
) }) })
|
|
839
|
+
] }),
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
628
841
|
PopoverPrimitive.Content,
|
|
629
842
|
{
|
|
630
843
|
className: "z-50 w-80 rounded-lg border border-secondary bg-light text-dark shadow-lg animate-in fade-in-0 zoom-in-95 duration-200",
|
|
631
|
-
sideOffset:
|
|
632
|
-
align: "
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
844
|
+
sideOffset: 8,
|
|
845
|
+
align: "end",
|
|
846
|
+
alignOffset: -12,
|
|
847
|
+
side: "bottom",
|
|
848
|
+
sticky: "always",
|
|
849
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "p-4", children: [
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex items-center justify-between mb-4 gap-1", children: [
|
|
851
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
636
852
|
"button",
|
|
637
853
|
{
|
|
638
854
|
onClick: () => handleMonthChange("prev"),
|
|
639
|
-
className: "p-1 hover:bg-gray rounded transition-colors",
|
|
640
|
-
children: /* @__PURE__ */ (0,
|
|
855
|
+
className: "p-1 hover:bg-gray rounded transition-colors flex-shrink-0",
|
|
856
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react3.ChevronLeft, { className: "h-4 w-4" })
|
|
641
857
|
}
|
|
642
858
|
),
|
|
643
|
-
/* @__PURE__ */ (0,
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
859
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex gap-1 flex-1 min-w-0", children: [
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
861
|
+
Select,
|
|
862
|
+
{
|
|
863
|
+
value: currentMonth.getMonth().toString(),
|
|
864
|
+
onValueChange: handleMonthSelect,
|
|
865
|
+
children: [
|
|
866
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectTrigger, { className: "min-w-fit h-8 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectValue, {}) }),
|
|
867
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectContent, { children: months.map((month, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectItem, { value: index.toString(), children: month }, month)) })
|
|
868
|
+
]
|
|
869
|
+
}
|
|
870
|
+
),
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
872
|
+
Select,
|
|
873
|
+
{
|
|
874
|
+
value: currentMonth.getFullYear().toString(),
|
|
875
|
+
onValueChange: handleYearSelect,
|
|
876
|
+
children: [
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectTrigger, { className: "min-w-fit h-8 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectValue, {}) }),
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectContent, { children: years.map((year) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(SelectItem, { value: year.toString(), children: year }, year)) })
|
|
879
|
+
]
|
|
880
|
+
}
|
|
881
|
+
)
|
|
647
882
|
] }),
|
|
648
|
-
/* @__PURE__ */ (0,
|
|
883
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
649
884
|
"button",
|
|
650
885
|
{
|
|
651
886
|
onClick: () => handleMonthChange("next"),
|
|
652
|
-
className: "p-1 hover:bg-gray rounded transition-colors",
|
|
653
|
-
children: /* @__PURE__ */ (0,
|
|
887
|
+
className: "p-1 hover:bg-gray rounded transition-colors flex-shrink-0",
|
|
888
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react3.ChevronRight, { className: "h-4 w-4" })
|
|
654
889
|
}
|
|
655
890
|
)
|
|
656
891
|
] }),
|
|
657
|
-
/* @__PURE__ */ (0,
|
|
658
|
-
/* @__PURE__ */ (0,
|
|
892
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "space-y-1", children: [
|
|
893
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "grid grid-cols-7 gap-1 mb-2", children: dayNames.map((day) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
659
894
|
Typography,
|
|
660
895
|
{
|
|
661
896
|
variant: "label-xs-bold",
|
|
@@ -665,11 +900,11 @@ var DatePicker = React5.forwardRef(
|
|
|
665
900
|
},
|
|
666
901
|
day
|
|
667
902
|
)) }),
|
|
668
|
-
/* @__PURE__ */ (0,
|
|
903
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "grid grid-cols-7 gap-1", children: days.map((date, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
669
904
|
"div",
|
|
670
905
|
{
|
|
671
906
|
className: "h-8 w-8 flex items-center justify-center",
|
|
672
|
-
children: date && /* @__PURE__ */ (0,
|
|
907
|
+
children: date && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
673
908
|
"button",
|
|
674
909
|
{
|
|
675
910
|
onClick: () => handleDateSelect(date),
|
|
@@ -681,7 +916,7 @@ var DatePicker = React5.forwardRef(
|
|
|
681
916
|
!isDateSelected(date) && "rounded-full",
|
|
682
917
|
isToday(date) && !isDateSelected(date) && "text-blue-600 after:content-[''] after:absolute after:bottom-1 after:left-1/2 after:-translate-x-1/2 after:w-1 after:h-1 after:bg-blue-600 after:rounded-full"
|
|
683
918
|
),
|
|
684
|
-
children: /* @__PURE__ */ (0,
|
|
919
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Typography, { variant: "label-sm", as: "span", children: date.getDate() })
|
|
685
920
|
}
|
|
686
921
|
)
|
|
687
922
|
},
|
|
@@ -699,9 +934,9 @@ var DatePicker = React5.forwardRef(
|
|
|
699
934
|
DatePicker.displayName = "DatePicker";
|
|
700
935
|
|
|
701
936
|
// src/components/ui/upload.tsx
|
|
702
|
-
var
|
|
937
|
+
var React7 = __toESM(require("react"));
|
|
703
938
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
704
|
-
var
|
|
939
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
705
940
|
var DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
706
941
|
var uploadVariants = (0, import_class_variance_authority6.cva)(
|
|
707
942
|
"relative flex flex-col items-center justify-center rounded-lg transition-all duration-200 ease-in-out overflow-hidden",
|
|
@@ -725,7 +960,7 @@ var uploadVariants = (0, import_class_variance_authority6.cva)(
|
|
|
725
960
|
}
|
|
726
961
|
}
|
|
727
962
|
);
|
|
728
|
-
var Upload =
|
|
963
|
+
var Upload = React7.forwardRef(
|
|
729
964
|
({
|
|
730
965
|
className,
|
|
731
966
|
endpoint,
|
|
@@ -743,23 +978,23 @@ var Upload = React6.forwardRef(
|
|
|
743
978
|
loading = false,
|
|
744
979
|
...props
|
|
745
980
|
}, ref) => {
|
|
746
|
-
const [currentState, setCurrentState] =
|
|
747
|
-
const [currentProgress, setCurrentProgress] =
|
|
748
|
-
const fileInputRef =
|
|
749
|
-
const [selectedFiles, setSelectedFiles] =
|
|
750
|
-
|
|
981
|
+
const [currentState, setCurrentState] = React7.useState(state);
|
|
982
|
+
const [currentProgress, setCurrentProgress] = React7.useState(progress);
|
|
983
|
+
const fileInputRef = React7.useRef(null);
|
|
984
|
+
const [selectedFiles, setSelectedFiles] = React7.useState([]);
|
|
985
|
+
React7.useEffect(() => {
|
|
751
986
|
if (loading) {
|
|
752
987
|
setCurrentState("uploading");
|
|
753
988
|
} else {
|
|
754
989
|
setCurrentState(state);
|
|
755
990
|
}
|
|
756
991
|
}, [state, loading]);
|
|
757
|
-
|
|
992
|
+
React7.useEffect(() => {
|
|
758
993
|
if (loading || progress !== void 0) {
|
|
759
994
|
setCurrentProgress(progress);
|
|
760
995
|
}
|
|
761
996
|
}, [progress, loading]);
|
|
762
|
-
const uploadFile =
|
|
997
|
+
const uploadFile = React7.useCallback(
|
|
763
998
|
(file) => {
|
|
764
999
|
if (!endpoint) {
|
|
765
1000
|
console.warn("Upload endpoint not provided");
|
|
@@ -901,17 +1136,17 @@ var Upload = React6.forwardRef(
|
|
|
901
1136
|
const renderContent = () => {
|
|
902
1137
|
switch (currentState) {
|
|
903
1138
|
case "error":
|
|
904
|
-
return /* @__PURE__ */ (0,
|
|
1139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
905
1140
|
"div",
|
|
906
1141
|
{
|
|
907
1142
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
908
1143
|
style: { gap: "32px" },
|
|
909
1144
|
children: [
|
|
910
|
-
/* @__PURE__ */ (0,
|
|
911
|
-
/* @__PURE__ */ (0,
|
|
912
|
-
/* @__PURE__ */ (0,
|
|
1145
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-4", children: [
|
|
1146
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Typography, { variant: "heading-sm", children: "Upload fail" }),
|
|
1147
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Typography, { variant: "body-md", className: "text-error", children: errorMessage })
|
|
913
1148
|
] }),
|
|
914
|
-
/* @__PURE__ */ (0,
|
|
1149
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
915
1150
|
Button,
|
|
916
1151
|
{
|
|
917
1152
|
variant: "destructive",
|
|
@@ -925,22 +1160,22 @@ var Upload = React6.forwardRef(
|
|
|
925
1160
|
}
|
|
926
1161
|
);
|
|
927
1162
|
case "uploading":
|
|
928
|
-
return /* @__PURE__ */ (0,
|
|
1163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
929
1164
|
"div",
|
|
930
1165
|
{
|
|
931
1166
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
932
1167
|
style: { gap: "32px" },
|
|
933
1168
|
children: [
|
|
934
|
-
/* @__PURE__ */ (0,
|
|
935
|
-
/* @__PURE__ */ (0,
|
|
936
|
-
/* @__PURE__ */ (0,
|
|
1169
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Typography, { variant: "heading-sm", className: "text-dark", children: "Uploading files" }),
|
|
1170
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w-full max-w-[720px] space-y-2", children: [
|
|
1171
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "w-full bg-gray rounded-full h-2", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
937
1172
|
"div",
|
|
938
1173
|
{
|
|
939
1174
|
className: "bg-primary h-2 rounded-full transition-all duration-300 ease-in-out",
|
|
940
1175
|
style: { width: `${currentProgress}%` }
|
|
941
1176
|
}
|
|
942
1177
|
) }),
|
|
943
|
-
/* @__PURE__ */ (0,
|
|
1178
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
944
1179
|
Typography,
|
|
945
1180
|
{
|
|
946
1181
|
variant: "body-sm",
|
|
@@ -956,29 +1191,29 @@ var Upload = React6.forwardRef(
|
|
|
956
1191
|
}
|
|
957
1192
|
);
|
|
958
1193
|
case "success":
|
|
959
|
-
return /* @__PURE__ */ (0,
|
|
1194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
960
1195
|
"div",
|
|
961
1196
|
{
|
|
962
1197
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
963
1198
|
style: { gap: "32px" },
|
|
964
|
-
children: /* @__PURE__ */ (0,
|
|
965
|
-
/* @__PURE__ */ (0,
|
|
966
|
-
selectedFiles.length > 0 && /* @__PURE__ */ (0,
|
|
1199
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-4", children: [
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Typography, { variant: "heading-sm", className: "text-success", children: "Upload successful!" }),
|
|
1201
|
+
selectedFiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-center", children: selectedFiles.map((file, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Typography, { variant: "body-sm", children: file.name }, index)) })
|
|
967
1202
|
] })
|
|
968
1203
|
}
|
|
969
1204
|
);
|
|
970
1205
|
default:
|
|
971
|
-
return /* @__PURE__ */ (0,
|
|
1206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
972
1207
|
"div",
|
|
973
1208
|
{
|
|
974
1209
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
975
1210
|
style: { gap: "32px" },
|
|
976
1211
|
children: [
|
|
977
|
-
/* @__PURE__ */ (0,
|
|
978
|
-
/* @__PURE__ */ (0,
|
|
979
|
-
/* @__PURE__ */ (0,
|
|
1212
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-4", children: [
|
|
1213
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Typography, { variant: "heading-sm", className: "text-dark", children: "Drag & drop files here" }),
|
|
1214
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Typography, { variant: "body-md", className: "text-secondary", children: "or click to browse from your computer" })
|
|
980
1215
|
] }),
|
|
981
|
-
/* @__PURE__ */ (0,
|
|
1216
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
982
1217
|
Button,
|
|
983
1218
|
{
|
|
984
1219
|
variant: "default",
|
|
@@ -992,10 +1227,10 @@ var Upload = React6.forwardRef(
|
|
|
992
1227
|
children: "Choose files"
|
|
993
1228
|
}
|
|
994
1229
|
),
|
|
995
|
-
/* @__PURE__ */ (0,
|
|
1230
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Typography, { variant: "body-sm", className: "text-secondary", children: [
|
|
996
1231
|
"Supported file: ",
|
|
997
1232
|
getFileTypeDisplay(),
|
|
998
|
-
/* @__PURE__ */ (0,
|
|
1233
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("br", {}),
|
|
999
1234
|
"Max: ",
|
|
1000
1235
|
Math.round(maxFileSize / 1024 / 1024),
|
|
1001
1236
|
" MB each"
|
|
@@ -1005,7 +1240,7 @@ var Upload = React6.forwardRef(
|
|
|
1005
1240
|
);
|
|
1006
1241
|
}
|
|
1007
1242
|
};
|
|
1008
|
-
return /* @__PURE__ */ (0,
|
|
1243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
1009
1244
|
"div",
|
|
1010
1245
|
{
|
|
1011
1246
|
ref,
|
|
@@ -1029,7 +1264,7 @@ var Upload = React6.forwardRef(
|
|
|
1029
1264
|
"aria-disabled": disabled,
|
|
1030
1265
|
...props,
|
|
1031
1266
|
children: [
|
|
1032
|
-
/* @__PURE__ */ (0,
|
|
1267
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1033
1268
|
"input",
|
|
1034
1269
|
{
|
|
1035
1270
|
ref: fileInputRef,
|
|
@@ -1049,171 +1284,30 @@ var Upload = React6.forwardRef(
|
|
|
1049
1284
|
Upload.displayName = "Upload";
|
|
1050
1285
|
|
|
1051
1286
|
// src/components/ui/checkbox.tsx
|
|
1052
|
-
var
|
|
1287
|
+
var React8 = __toESM(require("react"));
|
|
1053
1288
|
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
|
|
1054
|
-
var
|
|
1289
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1055
1290
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
1056
|
-
var
|
|
1291
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1057
1292
|
var checkboxVariants = (0, import_class_variance_authority7.cva)(
|
|
1058
1293
|
"peer size-4 shrink-0 rounded-[4px] border border-strong bg-light hover:bg-info-subtle transition-colors focus-visible:outline-none focus-visible:border-2 focus-visible:border-interactive disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:border-primary data-[state=checked]:text-light [&_svg]:pointer-events-none [&_svg]:size-3 [&_svg]:shrink-0"
|
|
1059
1294
|
);
|
|
1060
|
-
var Checkbox =
|
|
1295
|
+
var Checkbox = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1061
1296
|
CheckboxPrimitive.Root,
|
|
1062
1297
|
{
|
|
1063
1298
|
ref,
|
|
1064
1299
|
className: cn(checkboxVariants(), className),
|
|
1065
1300
|
...props,
|
|
1066
|
-
children: /* @__PURE__ */ (0,
|
|
1301
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react4.CheckIcon, { className: "size-3" }) })
|
|
1067
1302
|
}
|
|
1068
1303
|
));
|
|
1069
1304
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
1070
1305
|
|
|
1071
|
-
// src/components/ui/input.tsx
|
|
1072
|
-
var React8 = __toESM(require("react"));
|
|
1073
|
-
var import_class_variance_authority8 = require("class-variance-authority");
|
|
1074
|
-
var import_lucide_react4 = require("lucide-react");
|
|
1075
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
1076
|
-
var inputVariants = (0, import_class_variance_authority8.cva)(
|
|
1077
|
-
"flex w-full border bg-light text-dark focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:border-secondary transition-colors rounded-md px-3 min-w-80 border-secondary focus-visible:border-2 focus-visible:border-strong placeholder:text-secondary read-only:bg-gray read-only:cursor-default read-only:border-transparent read-only:text-secondary read-only:focus-visible:border-transparent",
|
|
1078
|
-
{
|
|
1079
|
-
variants: {
|
|
1080
|
-
variant: {
|
|
1081
|
-
input: "h-10 py-2",
|
|
1082
|
-
textarea: "min-h-20 resize-none pt-4 pb-2"
|
|
1083
|
-
}
|
|
1084
|
-
},
|
|
1085
|
-
defaultVariants: {
|
|
1086
|
-
variant: "input"
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
);
|
|
1090
|
-
var Input = React8.forwardRef(
|
|
1091
|
-
({
|
|
1092
|
-
className,
|
|
1093
|
-
variant = "input",
|
|
1094
|
-
style,
|
|
1095
|
-
value,
|
|
1096
|
-
onChange,
|
|
1097
|
-
onClear,
|
|
1098
|
-
readOnly,
|
|
1099
|
-
...props
|
|
1100
|
-
}, ref) => {
|
|
1101
|
-
const [internalValue, setInternalValue] = React8.useState(value || "");
|
|
1102
|
-
const isControlled = value !== void 0;
|
|
1103
|
-
const currentValue = isControlled ? value : internalValue;
|
|
1104
|
-
const showClear = currentValue && currentValue.toString().length > 0 && !readOnly;
|
|
1105
|
-
const showLock = readOnly;
|
|
1106
|
-
const tokenStyles = {
|
|
1107
|
-
font: "var(--typography-label-md-regular)",
|
|
1108
|
-
...style
|
|
1109
|
-
};
|
|
1110
|
-
const handleInputChange = (e) => {
|
|
1111
|
-
if (!isControlled) {
|
|
1112
|
-
setInternalValue(e.target.value);
|
|
1113
|
-
}
|
|
1114
|
-
if (variant === "input" && onChange) {
|
|
1115
|
-
onChange(e);
|
|
1116
|
-
}
|
|
1117
|
-
};
|
|
1118
|
-
const handleTextareaChange = (e) => {
|
|
1119
|
-
if (!isControlled) {
|
|
1120
|
-
setInternalValue(e.target.value);
|
|
1121
|
-
}
|
|
1122
|
-
if (variant === "textarea" && onChange) {
|
|
1123
|
-
onChange(e);
|
|
1124
|
-
}
|
|
1125
|
-
};
|
|
1126
|
-
const handleClear = () => {
|
|
1127
|
-
if (!isControlled) {
|
|
1128
|
-
setInternalValue("");
|
|
1129
|
-
}
|
|
1130
|
-
if (onChange) {
|
|
1131
|
-
if (variant === "input") {
|
|
1132
|
-
const inputEvent = {
|
|
1133
|
-
target: { value: "" },
|
|
1134
|
-
currentTarget: { value: "" }
|
|
1135
|
-
};
|
|
1136
|
-
onChange(inputEvent);
|
|
1137
|
-
} else {
|
|
1138
|
-
const textareaEvent = {
|
|
1139
|
-
target: { value: "" },
|
|
1140
|
-
currentTarget: { value: "" }
|
|
1141
|
-
};
|
|
1142
|
-
onChange(
|
|
1143
|
-
textareaEvent
|
|
1144
|
-
);
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
onClear?.();
|
|
1148
|
-
};
|
|
1149
|
-
if (variant === "textarea") {
|
|
1150
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
|
|
1151
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1152
|
-
"textarea",
|
|
1153
|
-
{
|
|
1154
|
-
className: cn(
|
|
1155
|
-
inputVariants({ variant }),
|
|
1156
|
-
(showClear || showLock) && "pr-10",
|
|
1157
|
-
className
|
|
1158
|
-
),
|
|
1159
|
-
style: tokenStyles,
|
|
1160
|
-
ref,
|
|
1161
|
-
value: currentValue,
|
|
1162
|
-
onChange: handleTextareaChange,
|
|
1163
|
-
readOnly,
|
|
1164
|
-
...props
|
|
1165
|
-
}
|
|
1166
|
-
),
|
|
1167
|
-
showClear && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1168
|
-
"button",
|
|
1169
|
-
{
|
|
1170
|
-
type: "button",
|
|
1171
|
-
onClick: handleClear,
|
|
1172
|
-
className: "absolute right-3 top-3 h-4 w-4 text-secondary hover:text-dark transition-colors",
|
|
1173
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react4.X, { className: "h-4 w-4" })
|
|
1174
|
-
}
|
|
1175
|
-
),
|
|
1176
|
-
showLock && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react4.Lock, { className: "absolute right-3 top-3 h-4 w-4 text-secondary" })
|
|
1177
|
-
] });
|
|
1178
|
-
}
|
|
1179
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative", children: [
|
|
1180
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1181
|
-
"input",
|
|
1182
|
-
{
|
|
1183
|
-
className: cn(
|
|
1184
|
-
inputVariants({ variant }),
|
|
1185
|
-
(showClear || showLock) && "pr-10",
|
|
1186
|
-
className
|
|
1187
|
-
),
|
|
1188
|
-
style: tokenStyles,
|
|
1189
|
-
ref,
|
|
1190
|
-
value: currentValue,
|
|
1191
|
-
onChange: handleInputChange,
|
|
1192
|
-
readOnly,
|
|
1193
|
-
...props
|
|
1194
|
-
}
|
|
1195
|
-
),
|
|
1196
|
-
showClear && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1197
|
-
"button",
|
|
1198
|
-
{
|
|
1199
|
-
type: "button",
|
|
1200
|
-
onClick: handleClear,
|
|
1201
|
-
className: "absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-secondary hover:text-dark transition-colors",
|
|
1202
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react4.X, { className: "h-4 w-4" })
|
|
1203
|
-
}
|
|
1204
|
-
),
|
|
1205
|
-
showLock && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react4.Lock, { className: "absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-secondary" })
|
|
1206
|
-
] });
|
|
1207
|
-
}
|
|
1208
|
-
);
|
|
1209
|
-
Input.displayName = "Input";
|
|
1210
|
-
var TypedInput = Input;
|
|
1211
|
-
|
|
1212
1306
|
// src/components/ui/badge.tsx
|
|
1213
1307
|
var React9 = __toESM(require("react"));
|
|
1214
|
-
var
|
|
1308
|
+
var import_class_variance_authority8 = require("class-variance-authority");
|
|
1215
1309
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1216
|
-
var badgeVariants = (0,
|
|
1310
|
+
var badgeVariants = (0, import_class_variance_authority8.cva)(
|
|
1217
1311
|
"inline-flex items-center justify-center gap-1 whitespace-nowrap transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",
|
|
1218
1312
|
{
|
|
1219
1313
|
variants: {
|
|
@@ -1263,14 +1357,14 @@ Badge.displayName = "Badge";
|
|
|
1263
1357
|
|
|
1264
1358
|
// src/components/ui/tabs.tsx
|
|
1265
1359
|
var React10 = __toESM(require("react"));
|
|
1266
|
-
var
|
|
1360
|
+
var import_class_variance_authority9 = require("class-variance-authority");
|
|
1267
1361
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1268
|
-
var tabsVariants = (0,
|
|
1269
|
-
"inline-flex items-center justify-start whitespace-nowrap transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-interactive focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50
|
|
1362
|
+
var tabsVariants = (0, import_class_variance_authority9.cva)(
|
|
1363
|
+
"inline-flex items-center justify-start whitespace-nowrap transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-border-interactive focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 h-10",
|
|
1270
1364
|
{
|
|
1271
1365
|
variants: {
|
|
1272
1366
|
variant: {
|
|
1273
|
-
default: "border-b-2 border-
|
|
1367
|
+
default: "border-b-2 border-transparent hover:border-interactive data-[state=active]:border-interactive data-[state=active]:text-primary disabled:border-subtle disabled:text-muted disabled:cursor-not-allowed"
|
|
1274
1368
|
}
|
|
1275
1369
|
},
|
|
1276
1370
|
defaultVariants: {
|
|
@@ -1278,16 +1372,6 @@ var tabsVariants = (0, import_class_variance_authority10.cva)(
|
|
|
1278
1372
|
}
|
|
1279
1373
|
}
|
|
1280
1374
|
);
|
|
1281
|
-
var tabsListVariants = (0, import_class_variance_authority10.cva)("inline-flex items-center justify-center", {
|
|
1282
|
-
variants: {
|
|
1283
|
-
variant: {
|
|
1284
|
-
default: "border-b border-secondary"
|
|
1285
|
-
}
|
|
1286
|
-
},
|
|
1287
|
-
defaultVariants: {
|
|
1288
|
-
variant: "default"
|
|
1289
|
-
}
|
|
1290
|
-
});
|
|
1291
1375
|
var TabsContext = React10.createContext(
|
|
1292
1376
|
void 0
|
|
1293
1377
|
);
|
|
@@ -1307,19 +1391,13 @@ var Tabs = React10.forwardRef((props, ref) => {
|
|
|
1307
1391
|
children,
|
|
1308
1392
|
...restProps
|
|
1309
1393
|
} = props;
|
|
1310
|
-
const handleValueChange = React10.useCallback(
|
|
1311
|
-
(newValue) => {
|
|
1312
|
-
onValueChange(newValue);
|
|
1313
|
-
},
|
|
1314
|
-
[onValueChange]
|
|
1315
|
-
);
|
|
1316
1394
|
const contextValue = React10.useMemo(
|
|
1317
1395
|
() => ({
|
|
1318
1396
|
activeTab: value,
|
|
1319
|
-
setActiveTab:
|
|
1397
|
+
setActiveTab: onValueChange,
|
|
1320
1398
|
variant
|
|
1321
1399
|
}),
|
|
1322
|
-
[value,
|
|
1400
|
+
[value, onValueChange, variant]
|
|
1323
1401
|
);
|
|
1324
1402
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TabsContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { ref, className: cn("w-full", className), ...restProps, children }) });
|
|
1325
1403
|
});
|
|
@@ -1327,17 +1405,12 @@ Tabs.displayName = "Tabs";
|
|
|
1327
1405
|
var TabsList = React10.forwardRef(
|
|
1328
1406
|
(props, ref) => {
|
|
1329
1407
|
const { className, children, ...restProps } = props;
|
|
1330
|
-
const { variant } = useTabsContext();
|
|
1331
|
-
const tabsListClassName = React10.useMemo(
|
|
1332
|
-
() => cn(tabsListVariants({ variant }), className),
|
|
1333
|
-
[variant, className]
|
|
1334
|
-
);
|
|
1335
1408
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1336
1409
|
"div",
|
|
1337
1410
|
{
|
|
1338
1411
|
ref,
|
|
1339
1412
|
role: "tablist",
|
|
1340
|
-
className:
|
|
1413
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
1341
1414
|
...restProps,
|
|
1342
1415
|
children
|
|
1343
1416
|
}
|
|
@@ -1345,8 +1418,8 @@ var TabsList = React10.forwardRef(
|
|
|
1345
1418
|
}
|
|
1346
1419
|
);
|
|
1347
1420
|
TabsList.displayName = "TabsList";
|
|
1348
|
-
var getTabTypographyStyles = () => ({
|
|
1349
|
-
font: "var(--typography-label-sm-bold)"
|
|
1421
|
+
var getTabTypographyStyles = (isActive) => ({
|
|
1422
|
+
font: isActive ? "var(--typography-label-sm-bold)" : "var(--typography-label-sm-regular)"
|
|
1350
1423
|
});
|
|
1351
1424
|
var TabsTrigger = React10.forwardRef(
|
|
1352
1425
|
(props, ref) => {
|
|
@@ -1358,10 +1431,10 @@ var TabsTrigger = React10.forwardRef(
|
|
|
1358
1431
|
const isActive = activeTab === value;
|
|
1359
1432
|
const tokenStyles = React10.useMemo(
|
|
1360
1433
|
() => ({
|
|
1361
|
-
...getTabTypographyStyles(),
|
|
1434
|
+
...getTabTypographyStyles(isActive),
|
|
1362
1435
|
...style
|
|
1363
1436
|
}),
|
|
1364
|
-
[style]
|
|
1437
|
+
[isActive, style]
|
|
1365
1438
|
);
|
|
1366
1439
|
const triggerClassName = React10.useMemo(
|
|
1367
1440
|
() => cn(tabsVariants({ variant }), className),
|
|
@@ -1385,7 +1458,7 @@ var TabsTrigger = React10.forwardRef(
|
|
|
1385
1458
|
disabled,
|
|
1386
1459
|
onClick: handleClick,
|
|
1387
1460
|
...restProps,
|
|
1388
|
-
children
|
|
1461
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "pl-3 pr-6 py-2", children })
|
|
1389
1462
|
}
|
|
1390
1463
|
);
|
|
1391
1464
|
}
|
|
@@ -1399,10 +1472,6 @@ var TabsContent = React10.forwardRef(
|
|
|
1399
1472
|
throw new Error("TabsContent must have a value prop");
|
|
1400
1473
|
}
|
|
1401
1474
|
const isActive = activeTab === value;
|
|
1402
|
-
const contentClassName = React10.useMemo(
|
|
1403
|
-
() => cn("mt-6", className),
|
|
1404
|
-
[className]
|
|
1405
|
-
);
|
|
1406
1475
|
if (!isActive) {
|
|
1407
1476
|
return null;
|
|
1408
1477
|
}
|
|
@@ -1414,7 +1483,7 @@ var TabsContent = React10.forwardRef(
|
|
|
1414
1483
|
id: `tabpanel-${value}`,
|
|
1415
1484
|
"aria-labelledby": `tab-${value}`,
|
|
1416
1485
|
tabIndex: 0,
|
|
1417
|
-
className:
|
|
1486
|
+
className: cn("mt-6", className),
|
|
1418
1487
|
...restProps,
|
|
1419
1488
|
children
|
|
1420
1489
|
}
|
|
@@ -1449,10 +1518,8 @@ TabsContent.displayName = "TabsContent";
|
|
|
1449
1518
|
badgeVariants,
|
|
1450
1519
|
buttonVariants,
|
|
1451
1520
|
checkboxVariants,
|
|
1452
|
-
datePickerTriggerVariants,
|
|
1453
1521
|
inputVariants,
|
|
1454
1522
|
selectTriggerVariants,
|
|
1455
|
-
tabsListVariants,
|
|
1456
1523
|
tabsVariants,
|
|
1457
1524
|
typographyVariants,
|
|
1458
1525
|
uploadVariants
|