@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.mjs
CHANGED
|
@@ -23,7 +23,7 @@ var buttonVariants = cva2(
|
|
|
23
23
|
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",
|
|
24
24
|
"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",
|
|
25
25
|
ghost: "bg-light text-dark hover:brightness-[70%] active:brightness-[90%] focus-visible:ring-2 focus-visible:ring-interactive focus-visible:ring-offset-2",
|
|
26
|
-
link: "bg-light text-dark underline underline-offset-4 hover:
|
|
26
|
+
link: "bg-light text-dark underline underline-offset-4 hover:cursor-pointer active:text-info"
|
|
27
27
|
},
|
|
28
28
|
size: {
|
|
29
29
|
sm: "h-8 rounded-md px-2 py-2 min-w-[120px]",
|
|
@@ -156,7 +156,19 @@ import { cva as cva4 } from "class-variance-authority";
|
|
|
156
156
|
import { Check, ChevronDown, ChevronUp } from "lucide-react";
|
|
157
157
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
158
158
|
var selectTriggerVariants = cva4(
|
|
159
|
-
"flex
|
|
159
|
+
"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",
|
|
160
|
+
{
|
|
161
|
+
variants: {
|
|
162
|
+
width: {
|
|
163
|
+
default: "w-full min-w-80",
|
|
164
|
+
fill: "w-full",
|
|
165
|
+
compact: "w-auto min-w-32"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
defaultVariants: {
|
|
169
|
+
width: "default"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
160
172
|
);
|
|
161
173
|
var selectContentVariants = cva4(
|
|
162
174
|
"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",
|
|
@@ -178,7 +190,7 @@ var SelectGroup = SelectPrimitive.Group;
|
|
|
178
190
|
SelectGroup.displayName = "SelectGroup";
|
|
179
191
|
var SelectValue = SelectPrimitive.Value;
|
|
180
192
|
SelectValue.displayName = "SelectValue";
|
|
181
|
-
var SelectTrigger = React3.forwardRef(({ className, children, style, ...props }, ref) => {
|
|
193
|
+
var SelectTrigger = React3.forwardRef(({ className, children, style, width, ...props }, ref) => {
|
|
182
194
|
const tokenStyles = {
|
|
183
195
|
font: "var(--typography-label-md-regular)",
|
|
184
196
|
...style
|
|
@@ -188,7 +200,7 @@ var SelectTrigger = React3.forwardRef(({ className, children, style, ...props },
|
|
|
188
200
|
{
|
|
189
201
|
ref,
|
|
190
202
|
className: cn(
|
|
191
|
-
selectTriggerVariants(),
|
|
203
|
+
selectTriggerVariants({ width }),
|
|
192
204
|
"border-secondary focus-visible:border-2 focus-visible:border-strong data-[state=open]:[&_svg]:rotate-180 data-[placeholder]:text-secondary h-10 py-2",
|
|
193
205
|
className
|
|
194
206
|
),
|
|
@@ -404,30 +416,190 @@ var FormField = React4.forwardRef(
|
|
|
404
416
|
FormField.displayName = "FormField";
|
|
405
417
|
|
|
406
418
|
// src/components/ui/date-picker.tsx
|
|
407
|
-
import * as
|
|
419
|
+
import * as React6 from "react";
|
|
408
420
|
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
409
|
-
import { cva as cva5 } from "class-variance-authority";
|
|
410
421
|
import { Calendar, ChevronLeft, ChevronRight } from "lucide-react";
|
|
422
|
+
|
|
423
|
+
// src/components/ui/input.tsx
|
|
424
|
+
import * as React5 from "react";
|
|
425
|
+
import { cva as cva5 } from "class-variance-authority";
|
|
426
|
+
import { X, Lock } from "lucide-react";
|
|
411
427
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
412
|
-
var
|
|
413
|
-
"flex w-full
|
|
428
|
+
var inputVariants = cva5(
|
|
429
|
+
"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",
|
|
430
|
+
{
|
|
431
|
+
variants: {
|
|
432
|
+
variant: {
|
|
433
|
+
input: "h-10 py-2",
|
|
434
|
+
textarea: "min-h-20 resize-none pt-4 pb-2"
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
defaultVariants: {
|
|
438
|
+
variant: "input"
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
);
|
|
442
|
+
var Input = React5.forwardRef(
|
|
443
|
+
({
|
|
444
|
+
className,
|
|
445
|
+
variant = "input",
|
|
446
|
+
style,
|
|
447
|
+
value,
|
|
448
|
+
onChange,
|
|
449
|
+
onClear,
|
|
450
|
+
showClear: showClearProp,
|
|
451
|
+
readOnly,
|
|
452
|
+
...props
|
|
453
|
+
}, ref) => {
|
|
454
|
+
const [internalValue, setInternalValue] = React5.useState(value || "");
|
|
455
|
+
const isControlled = value !== void 0;
|
|
456
|
+
const currentValue = isControlled ? value : internalValue;
|
|
457
|
+
const showClear = showClearProp !== false && currentValue && currentValue.toString().length > 0 && !readOnly;
|
|
458
|
+
const showLock = readOnly;
|
|
459
|
+
const tokenStyles = {
|
|
460
|
+
font: "var(--typography-label-md-regular)",
|
|
461
|
+
...style
|
|
462
|
+
};
|
|
463
|
+
const handleInputChange = (e) => {
|
|
464
|
+
if (!isControlled) {
|
|
465
|
+
setInternalValue(e.target.value);
|
|
466
|
+
}
|
|
467
|
+
if (variant === "input" && onChange) {
|
|
468
|
+
onChange(e);
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
const handleTextareaChange = (e) => {
|
|
472
|
+
if (!isControlled) {
|
|
473
|
+
setInternalValue(e.target.value);
|
|
474
|
+
}
|
|
475
|
+
if (variant === "textarea" && onChange) {
|
|
476
|
+
onChange(e);
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
const handleClear = () => {
|
|
480
|
+
if (!isControlled) {
|
|
481
|
+
setInternalValue("");
|
|
482
|
+
}
|
|
483
|
+
if (onChange) {
|
|
484
|
+
if (variant === "input") {
|
|
485
|
+
const inputEvent = {
|
|
486
|
+
target: { value: "" },
|
|
487
|
+
currentTarget: { value: "" }
|
|
488
|
+
};
|
|
489
|
+
onChange(inputEvent);
|
|
490
|
+
} else {
|
|
491
|
+
const textareaEvent = {
|
|
492
|
+
target: { value: "" },
|
|
493
|
+
currentTarget: { value: "" }
|
|
494
|
+
};
|
|
495
|
+
onChange(
|
|
496
|
+
textareaEvent
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
onClear?.();
|
|
501
|
+
};
|
|
502
|
+
if (variant === "textarea") {
|
|
503
|
+
return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
504
|
+
/* @__PURE__ */ jsx4(
|
|
505
|
+
"textarea",
|
|
506
|
+
{
|
|
507
|
+
className: cn(
|
|
508
|
+
inputVariants({ variant }),
|
|
509
|
+
(showClear || showLock) && "pr-10",
|
|
510
|
+
className
|
|
511
|
+
),
|
|
512
|
+
style: tokenStyles,
|
|
513
|
+
ref,
|
|
514
|
+
value: currentValue,
|
|
515
|
+
onChange: handleTextareaChange,
|
|
516
|
+
readOnly,
|
|
517
|
+
...props
|
|
518
|
+
}
|
|
519
|
+
),
|
|
520
|
+
showClear && /* @__PURE__ */ jsx4(
|
|
521
|
+
"button",
|
|
522
|
+
{
|
|
523
|
+
type: "button",
|
|
524
|
+
onClick: handleClear,
|
|
525
|
+
className: "absolute right-3 top-3 h-4 w-4 text-secondary hover:text-dark transition-colors",
|
|
526
|
+
children: /* @__PURE__ */ jsx4(X, { className: "h-4 w-4" })
|
|
527
|
+
}
|
|
528
|
+
),
|
|
529
|
+
showLock && /* @__PURE__ */ jsx4(Lock, { className: "absolute right-3 top-3 h-4 w-4 text-secondary" })
|
|
530
|
+
] });
|
|
531
|
+
}
|
|
532
|
+
return /* @__PURE__ */ jsxs4("div", { className: "relative", children: [
|
|
533
|
+
/* @__PURE__ */ jsx4(
|
|
534
|
+
"input",
|
|
535
|
+
{
|
|
536
|
+
className: cn(
|
|
537
|
+
inputVariants({ variant }),
|
|
538
|
+
(showClear || showLock) && "pr-10",
|
|
539
|
+
className
|
|
540
|
+
),
|
|
541
|
+
style: tokenStyles,
|
|
542
|
+
ref,
|
|
543
|
+
value: currentValue,
|
|
544
|
+
onChange: handleInputChange,
|
|
545
|
+
readOnly,
|
|
546
|
+
...props
|
|
547
|
+
}
|
|
548
|
+
),
|
|
549
|
+
showClear && /* @__PURE__ */ jsx4(
|
|
550
|
+
"button",
|
|
551
|
+
{
|
|
552
|
+
type: "button",
|
|
553
|
+
onClick: handleClear,
|
|
554
|
+
className: "absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-secondary hover:text-dark transition-colors",
|
|
555
|
+
children: /* @__PURE__ */ jsx4(X, { className: "h-4 w-4" })
|
|
556
|
+
}
|
|
557
|
+
),
|
|
558
|
+
showLock && /* @__PURE__ */ jsx4(Lock, { className: "absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-secondary" })
|
|
559
|
+
] });
|
|
560
|
+
}
|
|
414
561
|
);
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
562
|
+
Input.displayName = "Input";
|
|
563
|
+
var TypedInput = Input;
|
|
564
|
+
|
|
565
|
+
// src/components/ui/date-picker.tsx
|
|
566
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
567
|
+
var getDayNames = () => {
|
|
568
|
+
const days = [];
|
|
569
|
+
for (let i = 0; i < 7; i++) {
|
|
570
|
+
days.push(
|
|
571
|
+
new Intl.DateTimeFormat("en-US", { weekday: "narrow" }).format(
|
|
572
|
+
new Date(2e3, 0, i + 1)
|
|
573
|
+
)
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
return days;
|
|
577
|
+
};
|
|
578
|
+
var getMonthNames = () => {
|
|
579
|
+
const months = [];
|
|
580
|
+
for (let i = 0; i < 12; i++) {
|
|
581
|
+
months.push(
|
|
582
|
+
new Intl.DateTimeFormat("en-US", { month: "long" }).format(
|
|
583
|
+
new Date(2e3, i, 1)
|
|
584
|
+
)
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
return months;
|
|
588
|
+
};
|
|
589
|
+
var parseDateInput = (input) => {
|
|
590
|
+
if (!input.trim()) return null;
|
|
591
|
+
const date = new Date(input);
|
|
592
|
+
if (isNaN(date.getTime())) return null;
|
|
593
|
+
return date;
|
|
594
|
+
};
|
|
595
|
+
var formatDateInput = (date) => {
|
|
596
|
+
return date.toLocaleDateString("en-US", {
|
|
597
|
+
year: "numeric",
|
|
598
|
+
month: "2-digit",
|
|
599
|
+
day: "2-digit"
|
|
600
|
+
});
|
|
601
|
+
};
|
|
602
|
+
var DatePicker = React6.forwardRef(
|
|
431
603
|
({
|
|
432
604
|
value,
|
|
433
605
|
onValueChange,
|
|
@@ -444,20 +616,30 @@ var DatePicker = React5.forwardRef(
|
|
|
444
616
|
if (isNaN(parsed.getTime())) return void 0;
|
|
445
617
|
return parsed;
|
|
446
618
|
};
|
|
447
|
-
const [selectedDate, setSelectedDate] =
|
|
619
|
+
const [selectedDate, setSelectedDate] = React6.useState(
|
|
448
620
|
value || parseDate(defaultValue)
|
|
449
621
|
);
|
|
450
|
-
const [currentMonth, setCurrentMonth] =
|
|
622
|
+
const [currentMonth, setCurrentMonth] = React6.useState(() => {
|
|
451
623
|
const date = value || parseDate(defaultValue) || /* @__PURE__ */ new Date();
|
|
452
624
|
return new Date(date.getFullYear(), date.getMonth());
|
|
453
625
|
});
|
|
454
|
-
const [open, setOpen] =
|
|
455
|
-
|
|
626
|
+
const [open, setOpen] = React6.useState(false);
|
|
627
|
+
const [inputValue, setInputValue] = React6.useState(() => {
|
|
628
|
+
const initialDate = value || parseDate(defaultValue);
|
|
629
|
+
return initialDate ? formatDateInput(initialDate) : "";
|
|
630
|
+
});
|
|
631
|
+
React6.useEffect(() => {
|
|
456
632
|
setSelectedDate(value);
|
|
457
|
-
if (
|
|
458
|
-
|
|
633
|
+
if (value) {
|
|
634
|
+
setCurrentMonth(new Date(value.getFullYear(), value.getMonth()));
|
|
635
|
+
setInputValue(formatDateInput(value));
|
|
636
|
+
} else if (value === void 0) {
|
|
637
|
+
return;
|
|
638
|
+
} else {
|
|
639
|
+
setInputValue("");
|
|
640
|
+
}
|
|
459
641
|
}, [value]);
|
|
460
|
-
|
|
642
|
+
React6.useEffect(() => {
|
|
461
643
|
if (value) return;
|
|
462
644
|
const parsedDefault = parseDate(defaultValue);
|
|
463
645
|
if (!parsedDefault) return;
|
|
@@ -465,13 +647,51 @@ var DatePicker = React5.forwardRef(
|
|
|
465
647
|
setCurrentMonth(
|
|
466
648
|
new Date(parsedDefault.getFullYear(), parsedDefault.getMonth())
|
|
467
649
|
);
|
|
650
|
+
setInputValue(formatDateInput(parsedDefault));
|
|
468
651
|
}, [defaultValue, value]);
|
|
469
652
|
const handleDateSelect = (date) => {
|
|
470
653
|
const newDate = new Date(date);
|
|
471
654
|
setSelectedDate(newDate);
|
|
655
|
+
setInputValue(formatDateInput(newDate));
|
|
472
656
|
onValueChange?.(newDate);
|
|
473
657
|
setOpen(false);
|
|
474
658
|
};
|
|
659
|
+
const handleInputChange = (e) => {
|
|
660
|
+
const rawValue = e.target.value;
|
|
661
|
+
const cursorPosition = e.target.selectionStart || 0;
|
|
662
|
+
const input = e.target;
|
|
663
|
+
const numbersOnly = rawValue.replace(/\D/g, "");
|
|
664
|
+
let formattedValue = "";
|
|
665
|
+
if (numbersOnly.length > 0) {
|
|
666
|
+
if (numbersOnly.length <= 2) {
|
|
667
|
+
formattedValue = numbersOnly;
|
|
668
|
+
} else if (numbersOnly.length <= 4) {
|
|
669
|
+
formattedValue = `${numbersOnly.slice(0, 2)}/${numbersOnly.slice(2)}`;
|
|
670
|
+
} else {
|
|
671
|
+
formattedValue = `${numbersOnly.slice(0, 2)}/${numbersOnly.slice(2, 4)}/${numbersOnly.slice(4, 8)}`;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
setInputValue(formattedValue);
|
|
675
|
+
setTimeout(() => {
|
|
676
|
+
let newPosition = cursorPosition;
|
|
677
|
+
if (formattedValue.length > rawValue.length) {
|
|
678
|
+
newPosition = Math.min(cursorPosition + 1, formattedValue.length);
|
|
679
|
+
}
|
|
680
|
+
newPosition = Math.max(0, Math.min(newPosition, formattedValue.length));
|
|
681
|
+
input.setSelectionRange(newPosition, newPosition);
|
|
682
|
+
}, 0);
|
|
683
|
+
const parsedDate = parseDateInput(formattedValue);
|
|
684
|
+
if (parsedDate) {
|
|
685
|
+
setSelectedDate(parsedDate);
|
|
686
|
+
setCurrentMonth(
|
|
687
|
+
new Date(parsedDate.getFullYear(), parsedDate.getMonth())
|
|
688
|
+
);
|
|
689
|
+
onValueChange?.(parsedDate);
|
|
690
|
+
} else if (formattedValue === "") {
|
|
691
|
+
setSelectedDate(void 0);
|
|
692
|
+
onValueChange?.(void 0);
|
|
693
|
+
}
|
|
694
|
+
};
|
|
475
695
|
const handleMonthChange = (direction) => {
|
|
476
696
|
setCurrentMonth((prev) => {
|
|
477
697
|
const newMonth = new Date(prev);
|
|
@@ -483,112 +703,129 @@ var DatePicker = React5.forwardRef(
|
|
|
483
703
|
return newMonth;
|
|
484
704
|
});
|
|
485
705
|
};
|
|
486
|
-
const
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
706
|
+
const handleMonthSelect = (monthIndex) => {
|
|
707
|
+
const newMonth = new Date(currentMonth);
|
|
708
|
+
newMonth.setMonth(parseInt(monthIndex, 10));
|
|
709
|
+
setCurrentMonth(newMonth);
|
|
710
|
+
};
|
|
711
|
+
const handleYearSelect = (year) => {
|
|
712
|
+
const newMonth = new Date(currentMonth);
|
|
713
|
+
newMonth.setFullYear(parseInt(year, 10));
|
|
714
|
+
setCurrentMonth(newMonth);
|
|
492
715
|
};
|
|
493
716
|
const getDaysInMonth = (date) => {
|
|
494
717
|
const year = date.getFullYear();
|
|
495
718
|
const month = date.getMonth();
|
|
496
719
|
const firstDay = new Date(year, month, 1);
|
|
497
|
-
const
|
|
498
|
-
const daysInMonth = lastDay.getDate();
|
|
720
|
+
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
499
721
|
const startingDayOfWeek = firstDay.getDay();
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
722
|
+
return [
|
|
723
|
+
// Empty cells for days before the first day of the month
|
|
724
|
+
...Array(startingDayOfWeek).fill(null),
|
|
725
|
+
// All days of the month
|
|
726
|
+
...Array.from(
|
|
727
|
+
{ length: daysInMonth },
|
|
728
|
+
(_, i) => new Date(year, month, i + 1)
|
|
729
|
+
)
|
|
730
|
+
];
|
|
508
731
|
};
|
|
509
732
|
const isDateSelected = (date) => {
|
|
510
733
|
if (!selectedDate) return false;
|
|
511
734
|
return date.getTime() === selectedDate.getTime();
|
|
512
735
|
};
|
|
513
736
|
const isToday = (date) => {
|
|
514
|
-
|
|
737
|
+
const today = /* @__PURE__ */ new Date();
|
|
738
|
+
return date.toDateString() === today.toDateString();
|
|
515
739
|
};
|
|
516
740
|
const days = getDaysInMonth(currentMonth);
|
|
517
|
-
|
|
741
|
+
const months = getMonthNames();
|
|
742
|
+
const dayNames = getDayNames();
|
|
743
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
744
|
+
const years = Array.from({ length: 100 }, (_, i) => currentYear - 50 + i);
|
|
745
|
+
return /* @__PURE__ */ jsxs5(
|
|
518
746
|
PopoverPrimitive.Root,
|
|
519
747
|
{
|
|
520
748
|
open: disabled ? false : open,
|
|
521
749
|
onOpenChange: disabled ? void 0 : setOpen,
|
|
522
750
|
children: [
|
|
523
|
-
/* @__PURE__ */
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
disabled && "text-secondary"
|
|
544
|
-
),
|
|
545
|
-
children: selectedDate ? formatDate(selectedDate) : placeholder
|
|
546
|
-
}
|
|
547
|
-
),
|
|
548
|
-
/* @__PURE__ */ jsx4(
|
|
549
|
-
Calendar,
|
|
550
|
-
{
|
|
551
|
-
className: cn(
|
|
552
|
-
"h-5 w-5 flex-shrink-0",
|
|
553
|
-
disabled ? "text-secondary opacity-50" : "text-secondary"
|
|
554
|
-
)
|
|
555
|
-
}
|
|
751
|
+
/* @__PURE__ */ jsxs5("div", { className: "relative", children: [
|
|
752
|
+
/* @__PURE__ */ jsx5(
|
|
753
|
+
TypedInput,
|
|
754
|
+
{
|
|
755
|
+
ref,
|
|
756
|
+
value: inputValue,
|
|
757
|
+
onChange: handleInputChange,
|
|
758
|
+
placeholder,
|
|
759
|
+
disabled,
|
|
760
|
+
className: cn("pr-10", className),
|
|
761
|
+
showClear: false,
|
|
762
|
+
...props
|
|
763
|
+
}
|
|
764
|
+
),
|
|
765
|
+
/* @__PURE__ */ jsx5(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx5("button", { className: "absolute right-3 top-1/2 transform -translate-y-1/2 hover:bg-gray rounded p-0.5 transition-colors", children: /* @__PURE__ */ jsx5(
|
|
766
|
+
Calendar,
|
|
767
|
+
{
|
|
768
|
+
className: cn(
|
|
769
|
+
"h-5 w-5 flex-shrink-0",
|
|
770
|
+
disabled ? "text-secondary opacity-50" : "text-secondary"
|
|
556
771
|
)
|
|
557
|
-
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
/* @__PURE__ */
|
|
772
|
+
}
|
|
773
|
+
) }) })
|
|
774
|
+
] }),
|
|
775
|
+
/* @__PURE__ */ jsx5(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx5(
|
|
561
776
|
PopoverPrimitive.Content,
|
|
562
777
|
{
|
|
563
778
|
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",
|
|
564
|
-
sideOffset:
|
|
565
|
-
align: "
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
779
|
+
sideOffset: 8,
|
|
780
|
+
align: "end",
|
|
781
|
+
alignOffset: -12,
|
|
782
|
+
side: "bottom",
|
|
783
|
+
sticky: "always",
|
|
784
|
+
children: /* @__PURE__ */ jsxs5("div", { className: "p-4", children: [
|
|
785
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between mb-4 gap-1", children: [
|
|
786
|
+
/* @__PURE__ */ jsx5(
|
|
569
787
|
"button",
|
|
570
788
|
{
|
|
571
789
|
onClick: () => handleMonthChange("prev"),
|
|
572
|
-
className: "p-1 hover:bg-gray rounded transition-colors",
|
|
573
|
-
children: /* @__PURE__ */
|
|
790
|
+
className: "p-1 hover:bg-gray rounded transition-colors flex-shrink-0",
|
|
791
|
+
children: /* @__PURE__ */ jsx5(ChevronLeft, { className: "h-4 w-4" })
|
|
574
792
|
}
|
|
575
793
|
),
|
|
576
|
-
/* @__PURE__ */
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
794
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex gap-1 flex-1 min-w-0", children: [
|
|
795
|
+
/* @__PURE__ */ jsxs5(
|
|
796
|
+
Select,
|
|
797
|
+
{
|
|
798
|
+
value: currentMonth.getMonth().toString(),
|
|
799
|
+
onValueChange: handleMonthSelect,
|
|
800
|
+
children: [
|
|
801
|
+
/* @__PURE__ */ jsx5(SelectTrigger, { className: "min-w-fit h-8 text-sm", children: /* @__PURE__ */ jsx5(SelectValue, {}) }),
|
|
802
|
+
/* @__PURE__ */ jsx5(SelectContent, { children: months.map((month, index) => /* @__PURE__ */ jsx5(SelectItem, { value: index.toString(), children: month }, month)) })
|
|
803
|
+
]
|
|
804
|
+
}
|
|
805
|
+
),
|
|
806
|
+
/* @__PURE__ */ jsxs5(
|
|
807
|
+
Select,
|
|
808
|
+
{
|
|
809
|
+
value: currentMonth.getFullYear().toString(),
|
|
810
|
+
onValueChange: handleYearSelect,
|
|
811
|
+
children: [
|
|
812
|
+
/* @__PURE__ */ jsx5(SelectTrigger, { className: "min-w-fit h-8 text-sm", children: /* @__PURE__ */ jsx5(SelectValue, {}) }),
|
|
813
|
+
/* @__PURE__ */ jsx5(SelectContent, { children: years.map((year) => /* @__PURE__ */ jsx5(SelectItem, { value: year.toString(), children: year }, year)) })
|
|
814
|
+
]
|
|
815
|
+
}
|
|
816
|
+
)
|
|
580
817
|
] }),
|
|
581
|
-
/* @__PURE__ */
|
|
818
|
+
/* @__PURE__ */ jsx5(
|
|
582
819
|
"button",
|
|
583
820
|
{
|
|
584
821
|
onClick: () => handleMonthChange("next"),
|
|
585
|
-
className: "p-1 hover:bg-gray rounded transition-colors",
|
|
586
|
-
children: /* @__PURE__ */
|
|
822
|
+
className: "p-1 hover:bg-gray rounded transition-colors flex-shrink-0",
|
|
823
|
+
children: /* @__PURE__ */ jsx5(ChevronRight, { className: "h-4 w-4" })
|
|
587
824
|
}
|
|
588
825
|
)
|
|
589
826
|
] }),
|
|
590
|
-
/* @__PURE__ */
|
|
591
|
-
/* @__PURE__ */
|
|
827
|
+
/* @__PURE__ */ jsxs5("div", { className: "space-y-1", children: [
|
|
828
|
+
/* @__PURE__ */ jsx5("div", { className: "grid grid-cols-7 gap-1 mb-2", children: dayNames.map((day) => /* @__PURE__ */ jsx5(
|
|
592
829
|
Typography,
|
|
593
830
|
{
|
|
594
831
|
variant: "label-xs-bold",
|
|
@@ -598,11 +835,11 @@ var DatePicker = React5.forwardRef(
|
|
|
598
835
|
},
|
|
599
836
|
day
|
|
600
837
|
)) }),
|
|
601
|
-
/* @__PURE__ */
|
|
838
|
+
/* @__PURE__ */ jsx5("div", { className: "grid grid-cols-7 gap-1", children: days.map((date, index) => /* @__PURE__ */ jsx5(
|
|
602
839
|
"div",
|
|
603
840
|
{
|
|
604
841
|
className: "h-8 w-8 flex items-center justify-center",
|
|
605
|
-
children: date && /* @__PURE__ */
|
|
842
|
+
children: date && /* @__PURE__ */ jsx5(
|
|
606
843
|
"button",
|
|
607
844
|
{
|
|
608
845
|
onClick: () => handleDateSelect(date),
|
|
@@ -614,7 +851,7 @@ var DatePicker = React5.forwardRef(
|
|
|
614
851
|
!isDateSelected(date) && "rounded-full",
|
|
615
852
|
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"
|
|
616
853
|
),
|
|
617
|
-
children: /* @__PURE__ */
|
|
854
|
+
children: /* @__PURE__ */ jsx5(Typography, { variant: "label-sm", as: "span", children: date.getDate() })
|
|
618
855
|
}
|
|
619
856
|
)
|
|
620
857
|
},
|
|
@@ -632,9 +869,9 @@ var DatePicker = React5.forwardRef(
|
|
|
632
869
|
DatePicker.displayName = "DatePicker";
|
|
633
870
|
|
|
634
871
|
// src/components/ui/upload.tsx
|
|
635
|
-
import * as
|
|
872
|
+
import * as React7 from "react";
|
|
636
873
|
import { cva as cva6 } from "class-variance-authority";
|
|
637
|
-
import { jsx as
|
|
874
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
638
875
|
var DEFAULT_MAX_FILE_SIZE = 10 * 1024 * 1024;
|
|
639
876
|
var uploadVariants = cva6(
|
|
640
877
|
"relative flex flex-col items-center justify-center rounded-lg transition-all duration-200 ease-in-out overflow-hidden",
|
|
@@ -658,7 +895,7 @@ var uploadVariants = cva6(
|
|
|
658
895
|
}
|
|
659
896
|
}
|
|
660
897
|
);
|
|
661
|
-
var Upload =
|
|
898
|
+
var Upload = React7.forwardRef(
|
|
662
899
|
({
|
|
663
900
|
className,
|
|
664
901
|
endpoint,
|
|
@@ -676,23 +913,23 @@ var Upload = React6.forwardRef(
|
|
|
676
913
|
loading = false,
|
|
677
914
|
...props
|
|
678
915
|
}, ref) => {
|
|
679
|
-
const [currentState, setCurrentState] =
|
|
680
|
-
const [currentProgress, setCurrentProgress] =
|
|
681
|
-
const fileInputRef =
|
|
682
|
-
const [selectedFiles, setSelectedFiles] =
|
|
683
|
-
|
|
916
|
+
const [currentState, setCurrentState] = React7.useState(state);
|
|
917
|
+
const [currentProgress, setCurrentProgress] = React7.useState(progress);
|
|
918
|
+
const fileInputRef = React7.useRef(null);
|
|
919
|
+
const [selectedFiles, setSelectedFiles] = React7.useState([]);
|
|
920
|
+
React7.useEffect(() => {
|
|
684
921
|
if (loading) {
|
|
685
922
|
setCurrentState("uploading");
|
|
686
923
|
} else {
|
|
687
924
|
setCurrentState(state);
|
|
688
925
|
}
|
|
689
926
|
}, [state, loading]);
|
|
690
|
-
|
|
927
|
+
React7.useEffect(() => {
|
|
691
928
|
if (loading || progress !== void 0) {
|
|
692
929
|
setCurrentProgress(progress);
|
|
693
930
|
}
|
|
694
931
|
}, [progress, loading]);
|
|
695
|
-
const uploadFile =
|
|
932
|
+
const uploadFile = React7.useCallback(
|
|
696
933
|
(file) => {
|
|
697
934
|
if (!endpoint) {
|
|
698
935
|
console.warn("Upload endpoint not provided");
|
|
@@ -834,17 +1071,17 @@ var Upload = React6.forwardRef(
|
|
|
834
1071
|
const renderContent = () => {
|
|
835
1072
|
switch (currentState) {
|
|
836
1073
|
case "error":
|
|
837
|
-
return /* @__PURE__ */
|
|
1074
|
+
return /* @__PURE__ */ jsxs6(
|
|
838
1075
|
"div",
|
|
839
1076
|
{
|
|
840
1077
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
841
1078
|
style: { gap: "32px" },
|
|
842
1079
|
children: [
|
|
843
|
-
/* @__PURE__ */
|
|
844
|
-
/* @__PURE__ */
|
|
845
|
-
/* @__PURE__ */
|
|
1080
|
+
/* @__PURE__ */ jsxs6("div", { className: "space-y-4", children: [
|
|
1081
|
+
/* @__PURE__ */ jsx6(Typography, { variant: "heading-sm", children: "Upload fail" }),
|
|
1082
|
+
/* @__PURE__ */ jsx6(Typography, { variant: "body-md", className: "text-error", children: errorMessage })
|
|
846
1083
|
] }),
|
|
847
|
-
/* @__PURE__ */
|
|
1084
|
+
/* @__PURE__ */ jsx6(
|
|
848
1085
|
Button,
|
|
849
1086
|
{
|
|
850
1087
|
variant: "destructive",
|
|
@@ -858,22 +1095,22 @@ var Upload = React6.forwardRef(
|
|
|
858
1095
|
}
|
|
859
1096
|
);
|
|
860
1097
|
case "uploading":
|
|
861
|
-
return /* @__PURE__ */
|
|
1098
|
+
return /* @__PURE__ */ jsxs6(
|
|
862
1099
|
"div",
|
|
863
1100
|
{
|
|
864
1101
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
865
1102
|
style: { gap: "32px" },
|
|
866
1103
|
children: [
|
|
867
|
-
/* @__PURE__ */
|
|
868
|
-
/* @__PURE__ */
|
|
869
|
-
/* @__PURE__ */
|
|
1104
|
+
/* @__PURE__ */ jsx6(Typography, { variant: "heading-sm", className: "text-dark", children: "Uploading files" }),
|
|
1105
|
+
/* @__PURE__ */ jsxs6("div", { className: "w-full max-w-[720px] space-y-2", children: [
|
|
1106
|
+
/* @__PURE__ */ jsx6("div", { className: "w-full bg-gray rounded-full h-2", children: /* @__PURE__ */ jsx6(
|
|
870
1107
|
"div",
|
|
871
1108
|
{
|
|
872
1109
|
className: "bg-primary h-2 rounded-full transition-all duration-300 ease-in-out",
|
|
873
1110
|
style: { width: `${currentProgress}%` }
|
|
874
1111
|
}
|
|
875
1112
|
) }),
|
|
876
|
-
/* @__PURE__ */
|
|
1113
|
+
/* @__PURE__ */ jsxs6(
|
|
877
1114
|
Typography,
|
|
878
1115
|
{
|
|
879
1116
|
variant: "body-sm",
|
|
@@ -889,29 +1126,29 @@ var Upload = React6.forwardRef(
|
|
|
889
1126
|
}
|
|
890
1127
|
);
|
|
891
1128
|
case "success":
|
|
892
|
-
return /* @__PURE__ */
|
|
1129
|
+
return /* @__PURE__ */ jsx6(
|
|
893
1130
|
"div",
|
|
894
1131
|
{
|
|
895
1132
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
896
1133
|
style: { gap: "32px" },
|
|
897
|
-
children: /* @__PURE__ */
|
|
898
|
-
/* @__PURE__ */
|
|
899
|
-
selectedFiles.length > 0 && /* @__PURE__ */
|
|
1134
|
+
children: /* @__PURE__ */ jsxs6("div", { className: "space-y-4", children: [
|
|
1135
|
+
/* @__PURE__ */ jsx6(Typography, { variant: "heading-sm", className: "text-success", children: "Upload successful!" }),
|
|
1136
|
+
selectedFiles.length > 0 && /* @__PURE__ */ jsx6("div", { className: "text-center", children: selectedFiles.map((file, index) => /* @__PURE__ */ jsx6(Typography, { variant: "body-sm", children: file.name }, index)) })
|
|
900
1137
|
] })
|
|
901
1138
|
}
|
|
902
1139
|
);
|
|
903
1140
|
default:
|
|
904
|
-
return /* @__PURE__ */
|
|
1141
|
+
return /* @__PURE__ */ jsxs6(
|
|
905
1142
|
"div",
|
|
906
1143
|
{
|
|
907
1144
|
className: "flex flex-col items-center text-center max-w-[289px]",
|
|
908
1145
|
style: { gap: "32px" },
|
|
909
1146
|
children: [
|
|
910
|
-
/* @__PURE__ */
|
|
911
|
-
/* @__PURE__ */
|
|
912
|
-
/* @__PURE__ */
|
|
1147
|
+
/* @__PURE__ */ jsxs6("div", { className: "space-y-4", children: [
|
|
1148
|
+
/* @__PURE__ */ jsx6(Typography, { variant: "heading-sm", className: "text-dark", children: "Drag & drop files here" }),
|
|
1149
|
+
/* @__PURE__ */ jsx6(Typography, { variant: "body-md", className: "text-secondary", children: "or click to browse from your computer" })
|
|
913
1150
|
] }),
|
|
914
|
-
/* @__PURE__ */
|
|
1151
|
+
/* @__PURE__ */ jsx6(
|
|
915
1152
|
Button,
|
|
916
1153
|
{
|
|
917
1154
|
variant: "default",
|
|
@@ -925,10 +1162,10 @@ var Upload = React6.forwardRef(
|
|
|
925
1162
|
children: "Choose files"
|
|
926
1163
|
}
|
|
927
1164
|
),
|
|
928
|
-
/* @__PURE__ */
|
|
1165
|
+
/* @__PURE__ */ jsxs6(Typography, { variant: "body-sm", className: "text-secondary", children: [
|
|
929
1166
|
"Supported file: ",
|
|
930
1167
|
getFileTypeDisplay(),
|
|
931
|
-
/* @__PURE__ */
|
|
1168
|
+
/* @__PURE__ */ jsx6("br", {}),
|
|
932
1169
|
"Max: ",
|
|
933
1170
|
Math.round(maxFileSize / 1024 / 1024),
|
|
934
1171
|
" MB each"
|
|
@@ -938,7 +1175,7 @@ var Upload = React6.forwardRef(
|
|
|
938
1175
|
);
|
|
939
1176
|
}
|
|
940
1177
|
};
|
|
941
|
-
return /* @__PURE__ */
|
|
1178
|
+
return /* @__PURE__ */ jsxs6(
|
|
942
1179
|
"div",
|
|
943
1180
|
{
|
|
944
1181
|
ref,
|
|
@@ -962,7 +1199,7 @@ var Upload = React6.forwardRef(
|
|
|
962
1199
|
"aria-disabled": disabled,
|
|
963
1200
|
...props,
|
|
964
1201
|
children: [
|
|
965
|
-
/* @__PURE__ */
|
|
1202
|
+
/* @__PURE__ */ jsx6(
|
|
966
1203
|
"input",
|
|
967
1204
|
{
|
|
968
1205
|
ref: fileInputRef,
|
|
@@ -982,171 +1219,30 @@ var Upload = React6.forwardRef(
|
|
|
982
1219
|
Upload.displayName = "Upload";
|
|
983
1220
|
|
|
984
1221
|
// src/components/ui/checkbox.tsx
|
|
985
|
-
import * as
|
|
1222
|
+
import * as React8 from "react";
|
|
986
1223
|
import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
|
|
987
1224
|
import { CheckIcon } from "lucide-react";
|
|
988
1225
|
import { cva as cva7 } from "class-variance-authority";
|
|
989
|
-
import { jsx as
|
|
1226
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
990
1227
|
var checkboxVariants = cva7(
|
|
991
1228
|
"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"
|
|
992
1229
|
);
|
|
993
|
-
var Checkbox =
|
|
1230
|
+
var Checkbox = React8.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
|
|
994
1231
|
CheckboxPrimitive.Root,
|
|
995
1232
|
{
|
|
996
1233
|
ref,
|
|
997
1234
|
className: cn(checkboxVariants(), className),
|
|
998
1235
|
...props,
|
|
999
|
-
children: /* @__PURE__ */
|
|
1236
|
+
children: /* @__PURE__ */ jsx7(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: /* @__PURE__ */ jsx7(CheckIcon, { className: "size-3" }) })
|
|
1000
1237
|
}
|
|
1001
1238
|
));
|
|
1002
1239
|
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
1003
1240
|
|
|
1004
|
-
// src/components/ui/input.tsx
|
|
1005
|
-
import * as React8 from "react";
|
|
1006
|
-
import { cva as cva8 } from "class-variance-authority";
|
|
1007
|
-
import { X, Lock } from "lucide-react";
|
|
1008
|
-
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1009
|
-
var inputVariants = cva8(
|
|
1010
|
-
"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",
|
|
1011
|
-
{
|
|
1012
|
-
variants: {
|
|
1013
|
-
variant: {
|
|
1014
|
-
input: "h-10 py-2",
|
|
1015
|
-
textarea: "min-h-20 resize-none pt-4 pb-2"
|
|
1016
|
-
}
|
|
1017
|
-
},
|
|
1018
|
-
defaultVariants: {
|
|
1019
|
-
variant: "input"
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
);
|
|
1023
|
-
var Input = React8.forwardRef(
|
|
1024
|
-
({
|
|
1025
|
-
className,
|
|
1026
|
-
variant = "input",
|
|
1027
|
-
style,
|
|
1028
|
-
value,
|
|
1029
|
-
onChange,
|
|
1030
|
-
onClear,
|
|
1031
|
-
readOnly,
|
|
1032
|
-
...props
|
|
1033
|
-
}, ref) => {
|
|
1034
|
-
const [internalValue, setInternalValue] = React8.useState(value || "");
|
|
1035
|
-
const isControlled = value !== void 0;
|
|
1036
|
-
const currentValue = isControlled ? value : internalValue;
|
|
1037
|
-
const showClear = currentValue && currentValue.toString().length > 0 && !readOnly;
|
|
1038
|
-
const showLock = readOnly;
|
|
1039
|
-
const tokenStyles = {
|
|
1040
|
-
font: "var(--typography-label-md-regular)",
|
|
1041
|
-
...style
|
|
1042
|
-
};
|
|
1043
|
-
const handleInputChange = (e) => {
|
|
1044
|
-
if (!isControlled) {
|
|
1045
|
-
setInternalValue(e.target.value);
|
|
1046
|
-
}
|
|
1047
|
-
if (variant === "input" && onChange) {
|
|
1048
|
-
onChange(e);
|
|
1049
|
-
}
|
|
1050
|
-
};
|
|
1051
|
-
const handleTextareaChange = (e) => {
|
|
1052
|
-
if (!isControlled) {
|
|
1053
|
-
setInternalValue(e.target.value);
|
|
1054
|
-
}
|
|
1055
|
-
if (variant === "textarea" && onChange) {
|
|
1056
|
-
onChange(e);
|
|
1057
|
-
}
|
|
1058
|
-
};
|
|
1059
|
-
const handleClear = () => {
|
|
1060
|
-
if (!isControlled) {
|
|
1061
|
-
setInternalValue("");
|
|
1062
|
-
}
|
|
1063
|
-
if (onChange) {
|
|
1064
|
-
if (variant === "input") {
|
|
1065
|
-
const inputEvent = {
|
|
1066
|
-
target: { value: "" },
|
|
1067
|
-
currentTarget: { value: "" }
|
|
1068
|
-
};
|
|
1069
|
-
onChange(inputEvent);
|
|
1070
|
-
} else {
|
|
1071
|
-
const textareaEvent = {
|
|
1072
|
-
target: { value: "" },
|
|
1073
|
-
currentTarget: { value: "" }
|
|
1074
|
-
};
|
|
1075
|
-
onChange(
|
|
1076
|
-
textareaEvent
|
|
1077
|
-
);
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
onClear?.();
|
|
1081
|
-
};
|
|
1082
|
-
if (variant === "textarea") {
|
|
1083
|
-
return /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
|
|
1084
|
-
/* @__PURE__ */ jsx7(
|
|
1085
|
-
"textarea",
|
|
1086
|
-
{
|
|
1087
|
-
className: cn(
|
|
1088
|
-
inputVariants({ variant }),
|
|
1089
|
-
(showClear || showLock) && "pr-10",
|
|
1090
|
-
className
|
|
1091
|
-
),
|
|
1092
|
-
style: tokenStyles,
|
|
1093
|
-
ref,
|
|
1094
|
-
value: currentValue,
|
|
1095
|
-
onChange: handleTextareaChange,
|
|
1096
|
-
readOnly,
|
|
1097
|
-
...props
|
|
1098
|
-
}
|
|
1099
|
-
),
|
|
1100
|
-
showClear && /* @__PURE__ */ jsx7(
|
|
1101
|
-
"button",
|
|
1102
|
-
{
|
|
1103
|
-
type: "button",
|
|
1104
|
-
onClick: handleClear,
|
|
1105
|
-
className: "absolute right-3 top-3 h-4 w-4 text-secondary hover:text-dark transition-colors",
|
|
1106
|
-
children: /* @__PURE__ */ jsx7(X, { className: "h-4 w-4" })
|
|
1107
|
-
}
|
|
1108
|
-
),
|
|
1109
|
-
showLock && /* @__PURE__ */ jsx7(Lock, { className: "absolute right-3 top-3 h-4 w-4 text-secondary" })
|
|
1110
|
-
] });
|
|
1111
|
-
}
|
|
1112
|
-
return /* @__PURE__ */ jsxs6("div", { className: "relative", children: [
|
|
1113
|
-
/* @__PURE__ */ jsx7(
|
|
1114
|
-
"input",
|
|
1115
|
-
{
|
|
1116
|
-
className: cn(
|
|
1117
|
-
inputVariants({ variant }),
|
|
1118
|
-
(showClear || showLock) && "pr-10",
|
|
1119
|
-
className
|
|
1120
|
-
),
|
|
1121
|
-
style: tokenStyles,
|
|
1122
|
-
ref,
|
|
1123
|
-
value: currentValue,
|
|
1124
|
-
onChange: handleInputChange,
|
|
1125
|
-
readOnly,
|
|
1126
|
-
...props
|
|
1127
|
-
}
|
|
1128
|
-
),
|
|
1129
|
-
showClear && /* @__PURE__ */ jsx7(
|
|
1130
|
-
"button",
|
|
1131
|
-
{
|
|
1132
|
-
type: "button",
|
|
1133
|
-
onClick: handleClear,
|
|
1134
|
-
className: "absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-secondary hover:text-dark transition-colors",
|
|
1135
|
-
children: /* @__PURE__ */ jsx7(X, { className: "h-4 w-4" })
|
|
1136
|
-
}
|
|
1137
|
-
),
|
|
1138
|
-
showLock && /* @__PURE__ */ jsx7(Lock, { className: "absolute right-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-secondary" })
|
|
1139
|
-
] });
|
|
1140
|
-
}
|
|
1141
|
-
);
|
|
1142
|
-
Input.displayName = "Input";
|
|
1143
|
-
var TypedInput = Input;
|
|
1144
|
-
|
|
1145
1241
|
// src/components/ui/badge.tsx
|
|
1146
1242
|
import * as React9 from "react";
|
|
1147
|
-
import { cva as
|
|
1243
|
+
import { cva as cva8 } from "class-variance-authority";
|
|
1148
1244
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1149
|
-
var badgeVariants =
|
|
1245
|
+
var badgeVariants = cva8(
|
|
1150
1246
|
"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",
|
|
1151
1247
|
{
|
|
1152
1248
|
variants: {
|
|
@@ -1196,14 +1292,14 @@ Badge.displayName = "Badge";
|
|
|
1196
1292
|
|
|
1197
1293
|
// src/components/ui/tabs.tsx
|
|
1198
1294
|
import * as React10 from "react";
|
|
1199
|
-
import { cva as
|
|
1295
|
+
import { cva as cva9 } from "class-variance-authority";
|
|
1200
1296
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
1201
|
-
var tabsVariants =
|
|
1202
|
-
"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
|
|
1297
|
+
var tabsVariants = cva9(
|
|
1298
|
+
"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",
|
|
1203
1299
|
{
|
|
1204
1300
|
variants: {
|
|
1205
1301
|
variant: {
|
|
1206
|
-
default: "border-b-2 border-
|
|
1302
|
+
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"
|
|
1207
1303
|
}
|
|
1208
1304
|
},
|
|
1209
1305
|
defaultVariants: {
|
|
@@ -1211,16 +1307,6 @@ var tabsVariants = cva10(
|
|
|
1211
1307
|
}
|
|
1212
1308
|
}
|
|
1213
1309
|
);
|
|
1214
|
-
var tabsListVariants = cva10("inline-flex items-center justify-center", {
|
|
1215
|
-
variants: {
|
|
1216
|
-
variant: {
|
|
1217
|
-
default: "border-b border-secondary"
|
|
1218
|
-
}
|
|
1219
|
-
},
|
|
1220
|
-
defaultVariants: {
|
|
1221
|
-
variant: "default"
|
|
1222
|
-
}
|
|
1223
|
-
});
|
|
1224
1310
|
var TabsContext = React10.createContext(
|
|
1225
1311
|
void 0
|
|
1226
1312
|
);
|
|
@@ -1240,19 +1326,13 @@ var Tabs = React10.forwardRef((props, ref) => {
|
|
|
1240
1326
|
children,
|
|
1241
1327
|
...restProps
|
|
1242
1328
|
} = props;
|
|
1243
|
-
const handleValueChange = React10.useCallback(
|
|
1244
|
-
(newValue) => {
|
|
1245
|
-
onValueChange(newValue);
|
|
1246
|
-
},
|
|
1247
|
-
[onValueChange]
|
|
1248
|
-
);
|
|
1249
1329
|
const contextValue = React10.useMemo(
|
|
1250
1330
|
() => ({
|
|
1251
1331
|
activeTab: value,
|
|
1252
|
-
setActiveTab:
|
|
1332
|
+
setActiveTab: onValueChange,
|
|
1253
1333
|
variant
|
|
1254
1334
|
}),
|
|
1255
|
-
[value,
|
|
1335
|
+
[value, onValueChange, variant]
|
|
1256
1336
|
);
|
|
1257
1337
|
return /* @__PURE__ */ jsx9(TabsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx9("div", { ref, className: cn("w-full", className), ...restProps, children }) });
|
|
1258
1338
|
});
|
|
@@ -1260,17 +1340,12 @@ Tabs.displayName = "Tabs";
|
|
|
1260
1340
|
var TabsList = React10.forwardRef(
|
|
1261
1341
|
(props, ref) => {
|
|
1262
1342
|
const { className, children, ...restProps } = props;
|
|
1263
|
-
const { variant } = useTabsContext();
|
|
1264
|
-
const tabsListClassName = React10.useMemo(
|
|
1265
|
-
() => cn(tabsListVariants({ variant }), className),
|
|
1266
|
-
[variant, className]
|
|
1267
|
-
);
|
|
1268
1343
|
return /* @__PURE__ */ jsx9(
|
|
1269
1344
|
"div",
|
|
1270
1345
|
{
|
|
1271
1346
|
ref,
|
|
1272
1347
|
role: "tablist",
|
|
1273
|
-
className:
|
|
1348
|
+
className: cn("inline-flex items-center justify-center", className),
|
|
1274
1349
|
...restProps,
|
|
1275
1350
|
children
|
|
1276
1351
|
}
|
|
@@ -1278,8 +1353,8 @@ var TabsList = React10.forwardRef(
|
|
|
1278
1353
|
}
|
|
1279
1354
|
);
|
|
1280
1355
|
TabsList.displayName = "TabsList";
|
|
1281
|
-
var getTabTypographyStyles = () => ({
|
|
1282
|
-
font: "var(--typography-label-sm-bold)"
|
|
1356
|
+
var getTabTypographyStyles = (isActive) => ({
|
|
1357
|
+
font: isActive ? "var(--typography-label-sm-bold)" : "var(--typography-label-sm-regular)"
|
|
1283
1358
|
});
|
|
1284
1359
|
var TabsTrigger = React10.forwardRef(
|
|
1285
1360
|
(props, ref) => {
|
|
@@ -1291,10 +1366,10 @@ var TabsTrigger = React10.forwardRef(
|
|
|
1291
1366
|
const isActive = activeTab === value;
|
|
1292
1367
|
const tokenStyles = React10.useMemo(
|
|
1293
1368
|
() => ({
|
|
1294
|
-
...getTabTypographyStyles(),
|
|
1369
|
+
...getTabTypographyStyles(isActive),
|
|
1295
1370
|
...style
|
|
1296
1371
|
}),
|
|
1297
|
-
[style]
|
|
1372
|
+
[isActive, style]
|
|
1298
1373
|
);
|
|
1299
1374
|
const triggerClassName = React10.useMemo(
|
|
1300
1375
|
() => cn(tabsVariants({ variant }), className),
|
|
@@ -1318,7 +1393,7 @@ var TabsTrigger = React10.forwardRef(
|
|
|
1318
1393
|
disabled,
|
|
1319
1394
|
onClick: handleClick,
|
|
1320
1395
|
...restProps,
|
|
1321
|
-
children
|
|
1396
|
+
children: /* @__PURE__ */ jsx9("span", { className: "pl-3 pr-6 py-2", children })
|
|
1322
1397
|
}
|
|
1323
1398
|
);
|
|
1324
1399
|
}
|
|
@@ -1332,10 +1407,6 @@ var TabsContent = React10.forwardRef(
|
|
|
1332
1407
|
throw new Error("TabsContent must have a value prop");
|
|
1333
1408
|
}
|
|
1334
1409
|
const isActive = activeTab === value;
|
|
1335
|
-
const contentClassName = React10.useMemo(
|
|
1336
|
-
() => cn("mt-6", className),
|
|
1337
|
-
[className]
|
|
1338
|
-
);
|
|
1339
1410
|
if (!isActive) {
|
|
1340
1411
|
return null;
|
|
1341
1412
|
}
|
|
@@ -1347,7 +1418,7 @@ var TabsContent = React10.forwardRef(
|
|
|
1347
1418
|
id: `tabpanel-${value}`,
|
|
1348
1419
|
"aria-labelledby": `tab-${value}`,
|
|
1349
1420
|
tabIndex: 0,
|
|
1350
|
-
className:
|
|
1421
|
+
className: cn("mt-6", className),
|
|
1351
1422
|
...restProps,
|
|
1352
1423
|
children
|
|
1353
1424
|
}
|
|
@@ -1381,10 +1452,8 @@ export {
|
|
|
1381
1452
|
badgeVariants,
|
|
1382
1453
|
buttonVariants,
|
|
1383
1454
|
checkboxVariants,
|
|
1384
|
-
datePickerTriggerVariants,
|
|
1385
1455
|
inputVariants,
|
|
1386
1456
|
selectTriggerVariants,
|
|
1387
|
-
tabsListVariants,
|
|
1388
1457
|
tabsVariants,
|
|
1389
1458
|
typographyVariants,
|
|
1390
1459
|
uploadVariants
|