@refinn/core-ui 0.1.2 → 0.1.3
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 +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +307 -259
- package/dist/index.mjs +284 -236
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -505,77 +505,119 @@ var Badge = (0, import_react4.forwardRef)(
|
|
|
505
505
|
Badge.displayName = "Badge";
|
|
506
506
|
|
|
507
507
|
// src/components/Button/Button.tsx
|
|
508
|
+
var import_react6 = require("react");
|
|
509
|
+
|
|
510
|
+
// src/components/Loading/Loading.tsx
|
|
508
511
|
var import_react5 = require("react");
|
|
509
512
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
513
|
+
var Loading = (0, import_react5.forwardRef)(
|
|
514
|
+
(_a, ref) => {
|
|
515
|
+
var _b = _a, { size = "sm", isDark = false, className = "" } = _b, rest = __objRest(_b, ["size", "isDark", "className"]);
|
|
516
|
+
const containerClasses = [
|
|
517
|
+
isDark ? "text-white-100" : "text-blue-600",
|
|
518
|
+
className
|
|
519
|
+
].filter(Boolean).join(" ");
|
|
520
|
+
return size === "sm" && !isDark ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", __spreadProps(__spreadValues({ ref, className: containerClasses }, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
521
|
+
"svg",
|
|
522
|
+
{
|
|
523
|
+
className: "animate-spin",
|
|
524
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
525
|
+
width: "18",
|
|
526
|
+
height: "18",
|
|
527
|
+
viewBox: "0 0 18 18",
|
|
528
|
+
fill: "none",
|
|
529
|
+
children: [
|
|
530
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
531
|
+
"path",
|
|
532
|
+
{
|
|
533
|
+
d: "M1 9C1 6.87827 1.84286 4.84344 3.34315 3.34315C4.84344 1.84285 6.87827 1 9 1C11.1217 1 13.1566 1.84286 14.6569 3.34315C16.1571 4.84344 17 6.87827 17 9C17 11.1217 16.1571 13.1566 14.6569 14.6569C13.1566 16.1571 11.1217 17 9 17C6.87827 17 4.84344 16.1571 3.34315 14.6569C1.84285 13.1566 1 11.1217 1 9L1 9Z",
|
|
534
|
+
stroke: "#F3F4F6",
|
|
535
|
+
"stroke-width": "2"
|
|
536
|
+
}
|
|
537
|
+
),
|
|
538
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
539
|
+
"path",
|
|
540
|
+
{
|
|
541
|
+
d: "M1 9C1 7.31057 1.53484 5.6645 2.52786 4.29772C3.52089 2.93094 4.92112 1.91361 6.52787 1.39155C8.13461 0.869484 9.86539 0.869484 11.4721 1.39155C13.0789 1.91361 14.4791 2.93094 15.4721 4.29772",
|
|
542
|
+
stroke: "#0193D7",
|
|
543
|
+
"stroke-width": "2"
|
|
544
|
+
}
|
|
545
|
+
)
|
|
546
|
+
]
|
|
547
|
+
}
|
|
548
|
+
) })) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", __spreadProps(__spreadValues({ ref, className: containerClasses }, rest), { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
549
|
+
"svg",
|
|
550
|
+
{
|
|
551
|
+
className: "animate-spin",
|
|
552
|
+
width: size === "sm" ? 18 : 88,
|
|
553
|
+
height: size === "sm" ? 18 : 88,
|
|
554
|
+
viewBox: "0 0 20 20",
|
|
555
|
+
fill: "none",
|
|
556
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
557
|
+
"path",
|
|
558
|
+
{
|
|
559
|
+
d: "M10 2.5a7.5 7.5 0 1 0 7.5 7.5",
|
|
560
|
+
stroke: "currentColor",
|
|
561
|
+
strokeWidth: size === "sm" ? 2 : 1,
|
|
562
|
+
strokeLinecap: "round"
|
|
563
|
+
}
|
|
564
|
+
)
|
|
565
|
+
}
|
|
566
|
+
) }));
|
|
567
|
+
}
|
|
568
|
+
);
|
|
569
|
+
Loading.displayName = "Loading";
|
|
570
|
+
|
|
571
|
+
// src/components/Button/Button.tsx
|
|
572
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
510
573
|
var variantClasses = {
|
|
511
574
|
primary: [
|
|
512
|
-
"bg-
|
|
513
|
-
"hover:bg-
|
|
514
|
-
"active:bg-
|
|
515
|
-
"focus-visible:ring-2 focus-visible:ring-
|
|
516
|
-
"disabled:bg-
|
|
575
|
+
"bg-blue-600 text-white-100",
|
|
576
|
+
"hover:bg-blue-700",
|
|
577
|
+
"active:bg-blue-800",
|
|
578
|
+
"focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",
|
|
579
|
+
"disabled:bg-gray-100 disabled:text-gray-400"
|
|
517
580
|
].join(" "),
|
|
518
581
|
secondary: [
|
|
519
|
-
"bg-
|
|
520
|
-
"hover:bg-
|
|
521
|
-
"active:bg-
|
|
522
|
-
"focus-visible:ring-2 focus-visible:ring-
|
|
523
|
-
"disabled:bg-
|
|
582
|
+
"bg-gray-100 text-gray-900",
|
|
583
|
+
"hover:bg-gray-200",
|
|
584
|
+
"active:bg-gray-300",
|
|
585
|
+
"focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",
|
|
586
|
+
"disabled:bg-gray-100 disabled:text-gray-400"
|
|
524
587
|
].join(" "),
|
|
525
588
|
tertiary: [
|
|
526
|
-
"bg-
|
|
527
|
-
"hover:bg-
|
|
528
|
-
"active:bg-
|
|
529
|
-
"focus-visible:ring-2 focus-visible:ring-
|
|
530
|
-
"disabled:bg-
|
|
589
|
+
"bg-black-0 text-gray-900",
|
|
590
|
+
"hover:bg-gray-200",
|
|
591
|
+
"active:bg-gray-300",
|
|
592
|
+
"focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2",
|
|
593
|
+
"disabled:bg-gray-100 disabled:text-gray-400"
|
|
531
594
|
].join(" "),
|
|
532
595
|
contrast: [
|
|
533
|
-
"bg-
|
|
534
|
-
"hover:bg-
|
|
535
|
-
"active:bg-
|
|
536
|
-
"focus-visible:ring-2 focus-visible:ring-
|
|
537
|
-
"disabled:bg-
|
|
596
|
+
"bg-white-100 text-blue-600",
|
|
597
|
+
"hover:bg-white-90",
|
|
598
|
+
"active:bg-white-80",
|
|
599
|
+
"focus-visible:ring-2 focus-visible:ring-white-100 focus-visible:ring-offset-2",
|
|
600
|
+
"disabled:bg-gray-50 disabled:text-gray-400"
|
|
538
601
|
].join(" "),
|
|
539
602
|
transparent: [
|
|
540
|
-
"bg-
|
|
541
|
-
"hover:bg-
|
|
542
|
-
"active:bg-
|
|
543
|
-
"focus-visible:ring-2 focus-visible:ring-
|
|
544
|
-
"disabled:bg-
|
|
603
|
+
"bg-black-0 text-white-100",
|
|
604
|
+
"hover:bg-white-20",
|
|
605
|
+
"active:bg-white-30",
|
|
606
|
+
"focus-visible:ring-2 focus-visible:ring-white-100 focus-visible:bg-black-0 focus-visible:ring-offset-2",
|
|
607
|
+
"disabled:bg-black-0 disabled:text-white-40"
|
|
545
608
|
].join(" ")
|
|
546
609
|
};
|
|
547
610
|
var sizeClasses3 = {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
611
|
+
sm: "px-16 py-6 text-label-medium",
|
|
612
|
+
md: "px-20 py-8 text-label-large",
|
|
613
|
+
lg: "px-24 py-12 text-label-large",
|
|
614
|
+
xl: "px-32 py-16 text-label-large"
|
|
552
615
|
};
|
|
553
|
-
|
|
554
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
555
|
-
"svg",
|
|
556
|
-
{
|
|
557
|
-
className,
|
|
558
|
-
width: "1em",
|
|
559
|
-
height: "1em",
|
|
560
|
-
viewBox: "0 0 20 20",
|
|
561
|
-
fill: "none",
|
|
562
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
563
|
-
"path",
|
|
564
|
-
{
|
|
565
|
-
d: "M10 2.5a7.5 7.5 0 1 0 7.5 7.5",
|
|
566
|
-
stroke: "currentColor",
|
|
567
|
-
strokeWidth: "2",
|
|
568
|
-
strokeLinecap: "round"
|
|
569
|
-
}
|
|
570
|
-
)
|
|
571
|
-
}
|
|
572
|
-
);
|
|
573
|
-
}
|
|
574
|
-
var Button = (0, import_react5.forwardRef)(
|
|
616
|
+
var Button = (0, import_react6.forwardRef)(
|
|
575
617
|
(_a, ref) => {
|
|
576
618
|
var _b = _a, {
|
|
577
619
|
variant = "primary",
|
|
578
|
-
size = "
|
|
620
|
+
size = "md",
|
|
579
621
|
rounded = false,
|
|
580
622
|
loading = false,
|
|
581
623
|
disabled = false,
|
|
@@ -594,40 +636,32 @@ var Button = (0, import_react5.forwardRef)(
|
|
|
594
636
|
"children",
|
|
595
637
|
"className"
|
|
596
638
|
]);
|
|
597
|
-
const isDisabled = disabled
|
|
639
|
+
const isDisabled = disabled;
|
|
598
640
|
const classes = [
|
|
599
|
-
"inline-flex items-center justify-center
|
|
641
|
+
"inline-flex items-center justify-center gap-8",
|
|
600
642
|
"transition-colors duration-150",
|
|
601
643
|
"outline-none",
|
|
602
644
|
"disabled:cursor-not-allowed",
|
|
645
|
+
loading ? "pointer-events-none" : "cursor-pointer",
|
|
603
646
|
sizeClasses3[size],
|
|
604
647
|
variantClasses[variant],
|
|
605
|
-
rounded ? "rounded-full" : "rounded-
|
|
648
|
+
rounded ? "rounded-full" : size === "sm" ? "rounded-6" : size === "xl" ? "rounded-12" : "rounded-8",
|
|
606
649
|
className
|
|
607
650
|
].filter(Boolean).join(" ");
|
|
608
|
-
return /* @__PURE__ */ (0,
|
|
609
|
-
"
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
className: classes
|
|
614
|
-
}, rest), {
|
|
615
|
-
children: [
|
|
616
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Spinner, { className: "animate-spin" }) : startIcon,
|
|
617
|
-
children,
|
|
618
|
-
!loading && endIcon
|
|
619
|
-
]
|
|
620
|
-
})
|
|
621
|
-
);
|
|
651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", __spreadProps(__spreadValues({ ref, disabled: isDisabled, className: classes }, rest), { children: [
|
|
652
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Loading, { size: "sm", isDark: variant === "primary" || variant === "transparent" }) : startIcon,
|
|
653
|
+
children,
|
|
654
|
+
!loading && endIcon
|
|
655
|
+
] }));
|
|
622
656
|
}
|
|
623
657
|
);
|
|
624
658
|
Button.displayName = "Button";
|
|
625
659
|
|
|
626
660
|
// src/components/BottomSheet/BottomSheet.tsx
|
|
627
|
-
var
|
|
661
|
+
var import_react7 = __toESM(require("react"));
|
|
628
662
|
var import_react_dom = require("react-dom");
|
|
629
|
-
var
|
|
630
|
-
var BottomSheet = (0,
|
|
663
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
664
|
+
var BottomSheet = (0, import_react7.forwardRef)(
|
|
631
665
|
(_a, ref) => {
|
|
632
666
|
var _b = _a, {
|
|
633
667
|
isForceOpen = false,
|
|
@@ -654,10 +688,10 @@ var BottomSheet = (0, import_react6.forwardRef)(
|
|
|
654
688
|
"modalDesc",
|
|
655
689
|
"className"
|
|
656
690
|
]);
|
|
657
|
-
const [isOpen, setIsOpen] = (0,
|
|
658
|
-
const [shouldRender, setShouldRender] = (0,
|
|
659
|
-
const [animate, setAnimate] = (0,
|
|
660
|
-
(0,
|
|
691
|
+
const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
|
|
692
|
+
const [shouldRender, setShouldRender] = (0, import_react7.useState)(false);
|
|
693
|
+
const [animate, setAnimate] = (0, import_react7.useState)(false);
|
|
694
|
+
(0, import_react7.useEffect)(() => {
|
|
661
695
|
if (isOpen) {
|
|
662
696
|
setShouldRender(true);
|
|
663
697
|
setTimeout(() => setAnimate(true), 10);
|
|
@@ -667,14 +701,14 @@ var BottomSheet = (0, import_react6.forwardRef)(
|
|
|
667
701
|
return () => clearTimeout(timer);
|
|
668
702
|
}
|
|
669
703
|
}, [isOpen]);
|
|
670
|
-
(0,
|
|
704
|
+
(0, import_react7.useEffect)(() => {
|
|
671
705
|
if (isForceOpen) {
|
|
672
706
|
setIsOpen(true);
|
|
673
707
|
} else {
|
|
674
708
|
setIsOpen(false);
|
|
675
709
|
}
|
|
676
710
|
}, [isForceOpen]);
|
|
677
|
-
const handleStartClick = (0,
|
|
711
|
+
const handleStartClick = (0, import_react7.useCallback)(
|
|
678
712
|
(e) => {
|
|
679
713
|
var _a2, _b2;
|
|
680
714
|
(_b2 = startModalBtn == null ? void 0 : (_a2 = startModalBtn.props).onClick) == null ? void 0 : _b2.call(_a2, e);
|
|
@@ -683,7 +717,7 @@ var BottomSheet = (0, import_react6.forwardRef)(
|
|
|
683
717
|
},
|
|
684
718
|
[startModalBtn]
|
|
685
719
|
);
|
|
686
|
-
const handleStopClick = (0,
|
|
720
|
+
const handleStopClick = (0, import_react7.useCallback)(
|
|
687
721
|
(e) => {
|
|
688
722
|
var _a2, _b2;
|
|
689
723
|
(_b2 = stopModalBtn == null ? void 0 : (_a2 = stopModalBtn.props).onClick) == null ? void 0 : _b2.call(_a2, e);
|
|
@@ -696,19 +730,19 @@ var BottomSheet = (0, import_react6.forwardRef)(
|
|
|
696
730
|
setIsForceOpen == null ? void 0 : setIsForceOpen(false);
|
|
697
731
|
setIsOpen(false);
|
|
698
732
|
};
|
|
699
|
-
return /* @__PURE__ */ (0,
|
|
700
|
-
startModalBtn &&
|
|
733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { ref, style: { display: "contents" }, children: [
|
|
734
|
+
startModalBtn && import_react7.default.cloneElement(startModalBtn, {
|
|
701
735
|
onClick: handleStartClick
|
|
702
736
|
}),
|
|
703
737
|
shouldRender && (0, import_react_dom.createPortal)(
|
|
704
|
-
/* @__PURE__ */ (0,
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
705
739
|
"div",
|
|
706
740
|
{
|
|
707
741
|
className: `fixed inset-0 z-50 flex items-end justify-center transition-opacity duration-300 ${animate ? "opacity-100" : "opacity-0"}`,
|
|
708
742
|
"aria-modal": "true",
|
|
709
743
|
role: "dialog",
|
|
710
744
|
children: [
|
|
711
|
-
/* @__PURE__ */ (0,
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
712
746
|
"div",
|
|
713
747
|
{
|
|
714
748
|
className: "absolute inset-0 bg-black/40",
|
|
@@ -716,26 +750,26 @@ var BottomSheet = (0, import_react6.forwardRef)(
|
|
|
716
750
|
"aria-label": "Close modal"
|
|
717
751
|
}
|
|
718
752
|
),
|
|
719
|
-
/* @__PURE__ */ (0,
|
|
753
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
720
754
|
"div",
|
|
721
755
|
{
|
|
722
756
|
className: `flex flex-col z-10 w-full rounded-t-xl bg-white pt-8 pb-16 px-16 shadow-lg transform transition-all duration-300
|
|
723
757
|
${size === "sm" ? "h-auto max-h-auto" : size === "md" ? "h-full max-h-[85vh]" : "h-full max-h-screen rounded-t-none!"}
|
|
724
758
|
${animate ? "scale-100 translate-y-0" : "scale-95 translate-y-full"}`,
|
|
725
759
|
children: [
|
|
726
|
-
/* @__PURE__ */ (0,
|
|
727
|
-
/* @__PURE__ */ (0,
|
|
728
|
-
/* @__PURE__ */ (0,
|
|
729
|
-
/* @__PURE__ */ (0,
|
|
760
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w-full flex flex-row relative items-center pt-8 pb-16", children: [
|
|
761
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex flex-col px-8 max-w-225", children: [
|
|
762
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-heading-3 text-button-sheet-text-primary", children: modalTitle }),
|
|
763
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "text-body-small text-button-sheet-text-secondary", children: modalDesc })
|
|
730
764
|
] }),
|
|
731
|
-
/* @__PURE__ */ (0,
|
|
765
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
732
766
|
"i",
|
|
733
767
|
{
|
|
734
768
|
className: "fi fi-br-cross-small flex text-xl text-gray-600 w-44 h-44 absolute top-0 right-0 p-12",
|
|
735
769
|
onClick: () => handleCloseClick()
|
|
736
770
|
}
|
|
737
771
|
),
|
|
738
|
-
/* @__PURE__ */ (0,
|
|
772
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
739
773
|
"div",
|
|
740
774
|
{
|
|
741
775
|
className: "text-gray-600 text-xl absolute top-0 right-0 p-12",
|
|
@@ -744,9 +778,9 @@ var BottomSheet = (0, import_react6.forwardRef)(
|
|
|
744
778
|
}
|
|
745
779
|
)
|
|
746
780
|
] }),
|
|
747
|
-
/* @__PURE__ */ (0,
|
|
781
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "w-full h-full grow overflow-y-auto overflow-x-visible", children: [
|
|
748
782
|
children,
|
|
749
|
-
stopModalBtn &&
|
|
783
|
+
stopModalBtn && import_react7.default.cloneElement(stopModalBtn, {
|
|
750
784
|
onClick: handleStopClick
|
|
751
785
|
}),
|
|
752
786
|
afterStopBtn && afterStopBtn
|
|
@@ -765,17 +799,17 @@ var BottomSheet = (0, import_react6.forwardRef)(
|
|
|
765
799
|
BottomSheet.displayName = "BottomSheet";
|
|
766
800
|
|
|
767
801
|
// src/components/Checkbox/Checkbox.tsx
|
|
768
|
-
var
|
|
769
|
-
var
|
|
802
|
+
var import_react8 = require("react");
|
|
803
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
770
804
|
function CheckIcon({ className }) {
|
|
771
|
-
return /* @__PURE__ */ (0,
|
|
805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
772
806
|
"svg",
|
|
773
807
|
{
|
|
774
808
|
className,
|
|
775
809
|
viewBox: "0 0 16 16",
|
|
776
810
|
fill: "none",
|
|
777
811
|
"aria-hidden": "true",
|
|
778
|
-
children: /* @__PURE__ */ (0,
|
|
812
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
779
813
|
"path",
|
|
780
814
|
{
|
|
781
815
|
d: "M13.333 4.667 6 12l-3.333-3.333",
|
|
@@ -789,14 +823,14 @@ function CheckIcon({ className }) {
|
|
|
789
823
|
);
|
|
790
824
|
}
|
|
791
825
|
function IndeterminateIcon({ className }) {
|
|
792
|
-
return /* @__PURE__ */ (0,
|
|
826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
793
827
|
"svg",
|
|
794
828
|
{
|
|
795
829
|
className,
|
|
796
830
|
viewBox: "0 0 16 16",
|
|
797
831
|
fill: "none",
|
|
798
832
|
"aria-hidden": "true",
|
|
799
|
-
children: /* @__PURE__ */ (0,
|
|
833
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
800
834
|
"path",
|
|
801
835
|
{
|
|
802
836
|
d: "M3.333 8h9.334",
|
|
@@ -808,7 +842,7 @@ function IndeterminateIcon({ className }) {
|
|
|
808
842
|
}
|
|
809
843
|
);
|
|
810
844
|
}
|
|
811
|
-
var Checkbox = (0,
|
|
845
|
+
var Checkbox = (0, import_react8.forwardRef)(
|
|
812
846
|
(_a, ref) => {
|
|
813
847
|
var _b = _a, {
|
|
814
848
|
label,
|
|
@@ -831,17 +865,17 @@ var Checkbox = (0, import_react7.forwardRef)(
|
|
|
831
865
|
"id",
|
|
832
866
|
"defaultChecked"
|
|
833
867
|
]);
|
|
834
|
-
const reactId = (0,
|
|
868
|
+
const reactId = (0, import_react8.useId)();
|
|
835
869
|
const inputId = id != null ? id : reactId;
|
|
836
|
-
const [isChecked, setIsChecked] = (0,
|
|
837
|
-
return /* @__PURE__ */ (0,
|
|
870
|
+
const [isChecked, setIsChecked] = (0, import_react8.useState)(defaultChecked != null ? defaultChecked : false);
|
|
871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
838
872
|
"label",
|
|
839
873
|
{
|
|
840
874
|
htmlFor: inputId,
|
|
841
875
|
className: `flex select-none font-sans ${disabled ? "cursor-not-allowed" : "cursor-pointer"} ${className}`,
|
|
842
876
|
children: [
|
|
843
|
-
/* @__PURE__ */ (0,
|
|
844
|
-
/* @__PURE__ */ (0,
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative mr-16", children: [
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
845
879
|
"input",
|
|
846
880
|
__spreadValues({
|
|
847
881
|
ref,
|
|
@@ -858,16 +892,16 @@ var Checkbox = (0, import_react7.forwardRef)(
|
|
|
858
892
|
className: "sr-only"
|
|
859
893
|
}, rest)
|
|
860
894
|
),
|
|
861
|
-
/* @__PURE__ */ (0,
|
|
895
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
862
896
|
"div",
|
|
863
897
|
{
|
|
864
898
|
className: `box m-6 flex h-20 w-20 rounded-md items-center justify-center border ${contrast ? isChecked || indeterminate ? "border-white bg-white" : "border-white" : isChecked || indeterminate ? "bg-static-icon-brand border-static-icon-brand" : "border-static-icon-primary"}`,
|
|
865
|
-
children: isChecked ? /* @__PURE__ */ (0,
|
|
899
|
+
children: isChecked ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
866
900
|
CheckIcon,
|
|
867
901
|
{
|
|
868
902
|
className: `h-20 ${contrast ? "text-static-icon-brand" : "text-white"}`
|
|
869
903
|
}
|
|
870
|
-
) : indeterminate ? /* @__PURE__ */ (0,
|
|
904
|
+
) : indeterminate ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
871
905
|
IndeterminateIcon,
|
|
872
906
|
{
|
|
873
907
|
className: `h-20 ${contrast ? "text-static-icon-brand" : "text-white"}`
|
|
@@ -876,15 +910,15 @@ var Checkbox = (0, import_react7.forwardRef)(
|
|
|
876
910
|
}
|
|
877
911
|
)
|
|
878
912
|
] }),
|
|
879
|
-
(label || description) && /* @__PURE__ */ (0,
|
|
880
|
-
label && /* @__PURE__ */ (0,
|
|
913
|
+
(label || description) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: "flex flex-col", children: [
|
|
914
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
881
915
|
"span",
|
|
882
916
|
{
|
|
883
917
|
className: `text-label-large ${disabled ? "text-checkbox-text-disabled" : contrast ? "text-checkbox-text-primary-inverse" : "text-checkbox-text-primary"}`,
|
|
884
918
|
children: label
|
|
885
919
|
}
|
|
886
920
|
),
|
|
887
|
-
description && /* @__PURE__ */ (0,
|
|
921
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
888
922
|
"span",
|
|
889
923
|
{
|
|
890
924
|
className: `text-body-small ${error ? "text-checkbox-text-danger" : disabled ? "text-checkbox-text-disabled" : contrast ? "text-checkbox-text-primary-inverse" : "text-checkbox-text-secondary"}`,
|
|
@@ -900,41 +934,42 @@ var Checkbox = (0, import_react7.forwardRef)(
|
|
|
900
934
|
Checkbox.displayName = "Checkbox";
|
|
901
935
|
|
|
902
936
|
// src/components/Dialog/Dialog.tsx
|
|
903
|
-
var
|
|
937
|
+
var import_react9 = __toESM(require("react"));
|
|
904
938
|
var import_react_dom2 = require("react-dom");
|
|
905
|
-
var
|
|
906
|
-
var Dialog = (0,
|
|
939
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
940
|
+
var Dialog = (0, import_react9.forwardRef)(
|
|
907
941
|
({
|
|
908
942
|
isForceOpen = false,
|
|
909
943
|
setIsForceOpen,
|
|
910
944
|
isClosedAble = true,
|
|
945
|
+
isCloseIcon = true,
|
|
911
946
|
children,
|
|
912
947
|
startModalBtn,
|
|
913
948
|
stopModalBtn,
|
|
914
949
|
afterStopBtn,
|
|
915
950
|
p = "20"
|
|
916
951
|
}, ref) => {
|
|
917
|
-
const [isOpen, setIsOpen] = (0,
|
|
918
|
-
const [
|
|
919
|
-
const [animate, setAnimate] = (0,
|
|
920
|
-
(0,
|
|
952
|
+
const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
|
|
953
|
+
const [isRender, setIsRender] = (0, import_react9.useState)(false);
|
|
954
|
+
const [animate, setAnimate] = (0, import_react9.useState)(false);
|
|
955
|
+
(0, import_react9.useEffect)(() => {
|
|
921
956
|
if (isOpen) {
|
|
922
|
-
|
|
957
|
+
setIsRender(true);
|
|
923
958
|
setTimeout(() => setAnimate(true), 10);
|
|
924
959
|
} else {
|
|
925
960
|
setAnimate(false);
|
|
926
|
-
const timer = setTimeout(() =>
|
|
961
|
+
const timer = setTimeout(() => setIsRender(false), 300);
|
|
927
962
|
return () => clearTimeout(timer);
|
|
928
963
|
}
|
|
929
964
|
}, [isOpen]);
|
|
930
|
-
(0,
|
|
965
|
+
(0, import_react9.useEffect)(() => {
|
|
931
966
|
if (isForceOpen) {
|
|
932
967
|
setIsOpen(true);
|
|
933
968
|
} else {
|
|
934
969
|
setIsOpen(false);
|
|
935
970
|
}
|
|
936
971
|
}, [isForceOpen]);
|
|
937
|
-
const handleStartClick = (0,
|
|
972
|
+
const handleStartClick = (0, import_react9.useCallback)(
|
|
938
973
|
(e) => {
|
|
939
974
|
var _a, _b;
|
|
940
975
|
(_b = startModalBtn == null ? void 0 : (_a = startModalBtn.props).onClick) == null ? void 0 : _b.call(_a, e);
|
|
@@ -943,7 +978,7 @@ var Dialog = (0, import_react8.forwardRef)(
|
|
|
943
978
|
},
|
|
944
979
|
[startModalBtn]
|
|
945
980
|
);
|
|
946
|
-
const handleStopClick = (0,
|
|
981
|
+
const handleStopClick = (0, import_react9.useCallback)(
|
|
947
982
|
(e) => {
|
|
948
983
|
var _a, _b;
|
|
949
984
|
(_b = stopModalBtn == null ? void 0 : (_a = stopModalBtn.props).onClick) == null ? void 0 : _b.call(_a, e);
|
|
@@ -956,19 +991,19 @@ var Dialog = (0, import_react8.forwardRef)(
|
|
|
956
991
|
setIsForceOpen == null ? void 0 : setIsForceOpen(false);
|
|
957
992
|
setIsOpen(false);
|
|
958
993
|
};
|
|
959
|
-
return /* @__PURE__ */ (0,
|
|
960
|
-
startModalBtn &&
|
|
994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { ref, style: { display: "contents" }, children: [
|
|
995
|
+
startModalBtn && import_react9.default.cloneElement(startModalBtn, {
|
|
961
996
|
onClick: handleStartClick
|
|
962
997
|
}),
|
|
963
|
-
|
|
964
|
-
/* @__PURE__ */ (0,
|
|
998
|
+
isRender && (0, import_react_dom2.createPortal)(
|
|
999
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
965
1000
|
"div",
|
|
966
1001
|
{
|
|
967
1002
|
className: `fixed inset-0 z-50 flex items-center justify-center transition-opacity duration-300 ${animate ? "opacity-100" : "opacity-0"}`,
|
|
968
1003
|
"aria-modal": "true",
|
|
969
1004
|
role: "dialog",
|
|
970
1005
|
children: [
|
|
971
|
-
/* @__PURE__ */ (0,
|
|
1006
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
972
1007
|
"div",
|
|
973
1008
|
{
|
|
974
1009
|
className: "absolute inset-0 bg-black/40",
|
|
@@ -976,13 +1011,35 @@ var Dialog = (0, import_react8.forwardRef)(
|
|
|
976
1011
|
"aria-label": "Close modal"
|
|
977
1012
|
}
|
|
978
1013
|
),
|
|
979
|
-
/* @__PURE__ */ (0,
|
|
1014
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
980
1015
|
"div",
|
|
981
1016
|
{
|
|
982
1017
|
className: `relative z-10 w-[calc(100%-40px)] max-w-md rounded-xl bg-white p-${p || "20"} shadow-lg transform transition-all duration-300 ${animate ? "scale-100 opacity-100" : "scale-95 opacity-0"}`,
|
|
983
1018
|
children: [
|
|
1019
|
+
isCloseIcon && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1020
|
+
"svg",
|
|
1021
|
+
{
|
|
1022
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1023
|
+
width: "20",
|
|
1024
|
+
height: "20",
|
|
1025
|
+
viewBox: "0 0 20 20",
|
|
1026
|
+
fill: "none",
|
|
1027
|
+
className: "text-gray-900 flex h-20 w-20 items-center justify-center absolute right-16 top-16 cursor-pointer",
|
|
1028
|
+
onMouseDown: (e) => {
|
|
1029
|
+
e.preventDefault();
|
|
1030
|
+
handleCloseClick();
|
|
1031
|
+
},
|
|
1032
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1033
|
+
"path",
|
|
1034
|
+
{
|
|
1035
|
+
d: "M14.7119 6.0625L10.7744 10L14.7119 13.9375L13.9375 14.7119L10 10.7744L6.0625 14.7119L5.28809 13.9375L9.22559 10L5.28809 6.0625L6.0625 5.28809L10 9.22559L13.9375 5.28809L14.7119 6.0625Z",
|
|
1036
|
+
fill: "#111827"
|
|
1037
|
+
}
|
|
1038
|
+
)
|
|
1039
|
+
}
|
|
1040
|
+
),
|
|
984
1041
|
children,
|
|
985
|
-
stopModalBtn &&
|
|
1042
|
+
stopModalBtn && import_react9.default.cloneElement(stopModalBtn, {
|
|
986
1043
|
onClick: handleStopClick
|
|
987
1044
|
}),
|
|
988
1045
|
afterStopBtn && afterStopBtn
|
|
@@ -1000,9 +1057,9 @@ var Dialog = (0, import_react8.forwardRef)(
|
|
|
1000
1057
|
Dialog.displayName = "Dialog";
|
|
1001
1058
|
|
|
1002
1059
|
// src/components/Icon/Icon.tsx
|
|
1003
|
-
var
|
|
1004
|
-
var
|
|
1005
|
-
var Icon = (0,
|
|
1060
|
+
var import_react10 = require("react");
|
|
1061
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1062
|
+
var Icon = (0, import_react10.forwardRef)(
|
|
1006
1063
|
(_a, ref) => {
|
|
1007
1064
|
var _b = _a, {
|
|
1008
1065
|
name,
|
|
@@ -1030,7 +1087,7 @@ var Icon = (0, import_react9.forwardRef)(
|
|
|
1030
1087
|
"material-symbols-outlined select-none shrink-0 inline-block leading-none",
|
|
1031
1088
|
className
|
|
1032
1089
|
].filter(Boolean).join(" ");
|
|
1033
|
-
return /* @__PURE__ */ (0,
|
|
1090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1034
1091
|
"span",
|
|
1035
1092
|
__spreadProps(__spreadValues({
|
|
1036
1093
|
ref,
|
|
@@ -1053,114 +1110,105 @@ var Icon = (0, import_react9.forwardRef)(
|
|
|
1053
1110
|
Icon.displayName = "Icon";
|
|
1054
1111
|
|
|
1055
1112
|
// src/components/Radio/Radio.tsx
|
|
1056
|
-
var
|
|
1057
|
-
var
|
|
1058
|
-
var
|
|
1059
|
-
small: {
|
|
1060
|
-
box: "h-4 w-4",
|
|
1061
|
-
dot: "h-1.5 w-1.5",
|
|
1062
|
-
label: "text-sm leading-5",
|
|
1063
|
-
description: "text-xs leading-4",
|
|
1064
|
-
gap: "gap-2"
|
|
1065
|
-
},
|
|
1066
|
-
medium: {
|
|
1067
|
-
box: "h-5 w-5",
|
|
1068
|
-
dot: "h-2 w-2",
|
|
1069
|
-
label: "text-base leading-6",
|
|
1070
|
-
description: "text-sm leading-5",
|
|
1071
|
-
gap: "gap-2.5"
|
|
1072
|
-
}
|
|
1073
|
-
};
|
|
1074
|
-
var Radio = (0, import_react10.forwardRef)(
|
|
1113
|
+
var import_react11 = require("react");
|
|
1114
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1115
|
+
var Radio = (0, import_react11.forwardRef)(
|
|
1075
1116
|
(_a, ref) => {
|
|
1076
1117
|
var _b = _a, {
|
|
1077
|
-
size = "
|
|
1118
|
+
size = "sm",
|
|
1078
1119
|
label,
|
|
1079
1120
|
description,
|
|
1080
1121
|
error = false,
|
|
1081
|
-
contrast = false,
|
|
1082
1122
|
checked,
|
|
1083
1123
|
defaultChecked,
|
|
1084
1124
|
disabled = false,
|
|
1085
1125
|
className = "",
|
|
1086
|
-
id
|
|
1126
|
+
id,
|
|
1127
|
+
name
|
|
1087
1128
|
} = _b, rest = __objRest(_b, [
|
|
1088
1129
|
"size",
|
|
1089
1130
|
"label",
|
|
1090
1131
|
"description",
|
|
1091
1132
|
"error",
|
|
1092
|
-
"contrast",
|
|
1093
1133
|
"checked",
|
|
1094
1134
|
"defaultChecked",
|
|
1095
1135
|
"disabled",
|
|
1096
1136
|
"className",
|
|
1097
|
-
"id"
|
|
1137
|
+
"id",
|
|
1138
|
+
"name"
|
|
1098
1139
|
]);
|
|
1099
|
-
const reactId = (0,
|
|
1140
|
+
const reactId = (0, import_react11.useId)();
|
|
1100
1141
|
const inputId = id != null ? id : reactId;
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
"relative inline-flex items-center justify-center shrink-0",
|
|
1104
|
-
"rounded-full",
|
|
1105
|
-
"border",
|
|
1106
|
-
"transition-colors duration-150",
|
|
1107
|
-
sz.box
|
|
1108
|
-
].join(" ");
|
|
1109
|
-
let circleState;
|
|
1110
|
-
if (disabled) {
|
|
1111
|
-
circleState = checked ? "bg-radio-disabled-selected-bg border-radio-disabled-border" : "bg-radio-disabled-bg border-radio-disabled-border";
|
|
1112
|
-
} else if (contrast) {
|
|
1113
|
-
circleState = checked ? "bg-radio-contrast-selected-bg border-radio-contrast-selected-bg" : "bg-radio-contrast-bg border-radio-contrast-border";
|
|
1114
|
-
} else if (error) {
|
|
1115
|
-
circleState = checked ? "bg-radio-selected-bg border-radio-error-border" : "bg-radio-error-bg border-radio-error-border";
|
|
1116
|
-
} else if (checked) {
|
|
1117
|
-
circleState = "bg-radio-selected-bg border-radio-selected-border";
|
|
1118
|
-
} else {
|
|
1119
|
-
circleState = "bg-radio-bg border-radio-border hover:border-radio-hover-border";
|
|
1120
|
-
}
|
|
1121
|
-
const ringColor = error ? "peer-focus-visible:ring-radio-error-ring" : contrast ? "peer-focus-visible:ring-radio-contrast-ring" : "peer-focus-visible:ring-radio-ring";
|
|
1122
|
-
const ringClasses = `peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2 ${ringColor}`;
|
|
1123
|
-
let dotColor;
|
|
1124
|
-
if (disabled) {
|
|
1125
|
-
dotColor = "bg-radio-disabled-dot";
|
|
1126
|
-
} else if (contrast) {
|
|
1127
|
-
dotColor = "bg-radio-contrast-selected-dot";
|
|
1128
|
-
} else {
|
|
1129
|
-
dotColor = "bg-radio-selected-dot";
|
|
1130
|
-
}
|
|
1131
|
-
const labelColor = disabled ? "text-radio-label-disabled" : contrast ? "text-radio-contrast-label" : error ? "text-radio-label-error" : "text-radio-label";
|
|
1132
|
-
const descriptionColor = disabled ? "text-radio-label-disabled" : contrast ? "text-radio-contrast-description" : "text-radio-description";
|
|
1133
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1134
|
-
"label",
|
|
1142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1143
|
+
"div",
|
|
1135
1144
|
{
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
"
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1145
|
+
className: `${disabled ? "cursor-not-allowed" : "cursor-pointer"} ${className}`,
|
|
1146
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1147
|
+
"label",
|
|
1148
|
+
{
|
|
1149
|
+
htmlFor: inputId,
|
|
1150
|
+
className: `flex gap-4 ${disabled ? "pointer-events-none text-gray-400" : "text-gray-900 cursor-pointer"}`,
|
|
1151
|
+
children: [
|
|
1152
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1154
|
+
"input",
|
|
1155
|
+
__spreadValues({
|
|
1156
|
+
ref,
|
|
1157
|
+
id: inputId,
|
|
1158
|
+
type: "radio",
|
|
1159
|
+
className: "sr-only peer",
|
|
1160
|
+
checked,
|
|
1161
|
+
defaultChecked,
|
|
1162
|
+
disabled,
|
|
1163
|
+
name
|
|
1164
|
+
}, rest)
|
|
1165
|
+
),
|
|
1166
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1167
|
+
"div",
|
|
1168
|
+
{
|
|
1169
|
+
className: `relative box flex items-center justify-center rounded-full border-2 group bg-white
|
|
1170
|
+
${size === "sm" ? "h-16 w-16 my-4 ml-3 mr-3" : "m-3 h-20 w-20 text-label-large"}
|
|
1171
|
+
${error ? "border-red-500" : "border-gray-600 peer-checked:border-blue-600 peer-disabled:border-gray-400!"}
|
|
1172
|
+
`,
|
|
1173
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1174
|
+
"span",
|
|
1175
|
+
{
|
|
1176
|
+
className: `absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2
|
|
1177
|
+
${size === "sm" ? "h-8 w-8" : "h-10 w-10"}
|
|
1178
|
+
rounded-full bg-white group-peer-checked:bg-blue-600 group-peer-disabled:bg-white`
|
|
1179
|
+
}
|
|
1180
|
+
)
|
|
1181
|
+
}
|
|
1182
|
+
)
|
|
1183
|
+
] }),
|
|
1184
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1185
|
+
"div",
|
|
1186
|
+
{
|
|
1187
|
+
className: `flex flex-col gap-1 ${size === "sm" ? "mt-2" : "mt-4"}`,
|
|
1188
|
+
children: [
|
|
1189
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1190
|
+
"p",
|
|
1191
|
+
{
|
|
1192
|
+
className: `
|
|
1193
|
+
${size === "sm" ? "text-label-medium" : "text-label-large"}
|
|
1194
|
+
${disabled ? "text-gray-400" : "text-gray-900"}
|
|
1195
|
+
`,
|
|
1196
|
+
children: label
|
|
1197
|
+
}
|
|
1198
|
+
),
|
|
1199
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1200
|
+
"p",
|
|
1201
|
+
{
|
|
1202
|
+
className: `text-caption-caption ${disabled ? "text-gray-400" : error ? "text-red-600" : "text-gray-600"}`,
|
|
1203
|
+
children: description
|
|
1204
|
+
}
|
|
1205
|
+
)
|
|
1206
|
+
]
|
|
1207
|
+
}
|
|
1208
|
+
)
|
|
1209
|
+
]
|
|
1210
|
+
}
|
|
1211
|
+
)
|
|
1164
1212
|
}
|
|
1165
1213
|
);
|
|
1166
1214
|
}
|
|
@@ -1168,8 +1216,8 @@ var Radio = (0, import_react10.forwardRef)(
|
|
|
1168
1216
|
Radio.displayName = "Radio";
|
|
1169
1217
|
|
|
1170
1218
|
// src/components/Slider/Slider.tsx
|
|
1171
|
-
var
|
|
1172
|
-
var
|
|
1219
|
+
var import_react12 = require("react");
|
|
1220
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1173
1221
|
var sizeConfig = {
|
|
1174
1222
|
small: {
|
|
1175
1223
|
trackH: "h-4",
|
|
@@ -1200,7 +1248,7 @@ var sizeConfig = {
|
|
|
1200
1248
|
}
|
|
1201
1249
|
};
|
|
1202
1250
|
function ChevronGlyphs({ size, color }) {
|
|
1203
|
-
return /* @__PURE__ */ (0,
|
|
1251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1204
1252
|
"svg",
|
|
1205
1253
|
{
|
|
1206
1254
|
width: size,
|
|
@@ -1210,7 +1258,7 @@ function ChevronGlyphs({ size, color }) {
|
|
|
1210
1258
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1211
1259
|
"aria-hidden": "true",
|
|
1212
1260
|
children: [
|
|
1213
|
-
/* @__PURE__ */ (0,
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1214
1262
|
"path",
|
|
1215
1263
|
{
|
|
1216
1264
|
d: "M4.75 3.25L2.25 6L4.75 8.75",
|
|
@@ -1220,7 +1268,7 @@ function ChevronGlyphs({ size, color }) {
|
|
|
1220
1268
|
strokeLinejoin: "round"
|
|
1221
1269
|
}
|
|
1222
1270
|
),
|
|
1223
|
-
/* @__PURE__ */ (0,
|
|
1271
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1224
1272
|
"path",
|
|
1225
1273
|
{
|
|
1226
1274
|
d: "M7.25 3.25L9.75 6L7.25 8.75",
|
|
@@ -1234,7 +1282,7 @@ function ChevronGlyphs({ size, color }) {
|
|
|
1234
1282
|
}
|
|
1235
1283
|
);
|
|
1236
1284
|
}
|
|
1237
|
-
var Slider = (0,
|
|
1285
|
+
var Slider = (0, import_react12.forwardRef)(
|
|
1238
1286
|
(_a, ref) => {
|
|
1239
1287
|
var _b = _a, {
|
|
1240
1288
|
size = "medium",
|
|
@@ -1269,15 +1317,15 @@ var Slider = (0, import_react11.forwardRef)(
|
|
|
1269
1317
|
"onChange",
|
|
1270
1318
|
"aria-label"
|
|
1271
1319
|
]);
|
|
1272
|
-
const reactId = (0,
|
|
1320
|
+
const reactId = (0, import_react12.useId)();
|
|
1273
1321
|
const inputId = id != null ? id : reactId;
|
|
1274
1322
|
const sz = sizeConfig[size];
|
|
1275
1323
|
const ariaLabel = ariaLabelProp != null ? ariaLabelProp : typeof label === "string" ? void 0 : "Slider";
|
|
1276
1324
|
const ariaDescriptionId = description ? `${inputId}-description` : void 0;
|
|
1277
1325
|
const isControlled = controlledValue !== void 0;
|
|
1278
|
-
const [internalValue, setInternalValue] = (0,
|
|
1326
|
+
const [internalValue, setInternalValue] = (0, import_react12.useState)(defaultValue != null ? defaultValue : min);
|
|
1279
1327
|
const currentValue = isControlled ? controlledValue : internalValue;
|
|
1280
|
-
const handleChange = (0,
|
|
1328
|
+
const handleChange = (0, import_react12.useCallback)(
|
|
1281
1329
|
(e) => {
|
|
1282
1330
|
const val = Number(e.target.value);
|
|
1283
1331
|
if (!isControlled) {
|
|
@@ -1297,13 +1345,13 @@ var Slider = (0, import_react11.forwardRef)(
|
|
|
1297
1345
|
const descriptionColor = disabled ? "text-slider-label-disabled" : "text-slider-description";
|
|
1298
1346
|
const thumbOffset = percent * sz.thumbPx / 100;
|
|
1299
1347
|
const fillOffset = sz.thumbPx / 2 - thumbOffset;
|
|
1300
|
-
return /* @__PURE__ */ (0,
|
|
1348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1301
1349
|
"div",
|
|
1302
1350
|
{
|
|
1303
1351
|
className: ["flex w-full flex-col gap-8 font-sans", className].filter(Boolean).join(" "),
|
|
1304
1352
|
children: [
|
|
1305
|
-
(label || showValue && !disabled) && /* @__PURE__ */ (0,
|
|
1306
|
-
label && /* @__PURE__ */ (0,
|
|
1353
|
+
(label || showValue && !disabled) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
1354
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1307
1355
|
"label",
|
|
1308
1356
|
{
|
|
1309
1357
|
htmlFor: inputId,
|
|
@@ -1316,7 +1364,7 @@ var Slider = (0, import_react11.forwardRef)(
|
|
|
1316
1364
|
children: label
|
|
1317
1365
|
}
|
|
1318
1366
|
),
|
|
1319
|
-
showValue && /* @__PURE__ */ (0,
|
|
1367
|
+
showValue && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1320
1368
|
"span",
|
|
1321
1369
|
{
|
|
1322
1370
|
className: [sz.description, "tabular-nums", labelColor].join(" "),
|
|
@@ -1324,7 +1372,7 @@ var Slider = (0, import_react11.forwardRef)(
|
|
|
1324
1372
|
}
|
|
1325
1373
|
)
|
|
1326
1374
|
] }),
|
|
1327
|
-
/* @__PURE__ */ (0,
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1328
1376
|
"div",
|
|
1329
1377
|
{
|
|
1330
1378
|
className: [
|
|
@@ -1333,7 +1381,7 @@ var Slider = (0, import_react11.forwardRef)(
|
|
|
1333
1381
|
disabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1334
1382
|
].join(" "),
|
|
1335
1383
|
children: [
|
|
1336
|
-
/* @__PURE__ */ (0,
|
|
1384
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1337
1385
|
"div",
|
|
1338
1386
|
{
|
|
1339
1387
|
className: [
|
|
@@ -1343,14 +1391,14 @@ var Slider = (0, import_react11.forwardRef)(
|
|
|
1343
1391
|
].join(" ")
|
|
1344
1392
|
}
|
|
1345
1393
|
),
|
|
1346
|
-
/* @__PURE__ */ (0,
|
|
1394
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1347
1395
|
"div",
|
|
1348
1396
|
{
|
|
1349
1397
|
className: ["absolute left-0 rounded-full", sz.trackH, fillBg].join(" "),
|
|
1350
1398
|
style: { width: `calc(${percent}% + ${fillOffset}px)` }
|
|
1351
1399
|
}
|
|
1352
1400
|
),
|
|
1353
|
-
/* @__PURE__ */ (0,
|
|
1401
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1354
1402
|
"input",
|
|
1355
1403
|
__spreadValues({
|
|
1356
1404
|
ref,
|
|
@@ -1371,7 +1419,7 @@ var Slider = (0, import_react11.forwardRef)(
|
|
|
1371
1419
|
].join(" ")
|
|
1372
1420
|
}, rest)
|
|
1373
1421
|
),
|
|
1374
|
-
/* @__PURE__ */ (0,
|
|
1422
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1375
1423
|
"div",
|
|
1376
1424
|
{
|
|
1377
1425
|
className: [
|
|
@@ -1384,13 +1432,13 @@ var Slider = (0, import_react11.forwardRef)(
|
|
|
1384
1432
|
!disabled && "peer-hover:shadow-medium"
|
|
1385
1433
|
].filter(Boolean).join(" "),
|
|
1386
1434
|
style: { left: `calc(${percent}% - ${thumbOffset}px)` },
|
|
1387
|
-
children: /* @__PURE__ */ (0,
|
|
1435
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChevronGlyphs, { size: sz.iconPx, color: iconColor })
|
|
1388
1436
|
}
|
|
1389
1437
|
)
|
|
1390
1438
|
]
|
|
1391
1439
|
}
|
|
1392
1440
|
),
|
|
1393
|
-
description && /* @__PURE__ */ (0,
|
|
1441
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1394
1442
|
"span",
|
|
1395
1443
|
{
|
|
1396
1444
|
id: ariaDescriptionId,
|
|
@@ -1406,28 +1454,28 @@ var Slider = (0, import_react11.forwardRef)(
|
|
|
1406
1454
|
Slider.displayName = "Slider";
|
|
1407
1455
|
|
|
1408
1456
|
// src/components/Toast/Toast.tsx
|
|
1409
|
-
var
|
|
1410
|
-
var
|
|
1457
|
+
var import_react13 = require("react");
|
|
1458
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1411
1459
|
function CheckCircleIcon({ className }) {
|
|
1412
|
-
return /* @__PURE__ */ (0,
|
|
1413
|
-
/* @__PURE__ */ (0,
|
|
1414
|
-
/* @__PURE__ */ (0,
|
|
1460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1461
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
1462
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "m7 10 2 2 4-4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
1415
1463
|
] });
|
|
1416
1464
|
}
|
|
1417
1465
|
function ProgressIcon({ className }) {
|
|
1418
|
-
return /* @__PURE__ */ (0,
|
|
1419
|
-
/* @__PURE__ */ (0,
|
|
1420
|
-
/* @__PURE__ */ (0,
|
|
1466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1467
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5", opacity: "0.3" }),
|
|
1468
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M10 2a8 8 0 0 1 8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("animateTransform", { attributeName: "transform", type: "rotate", from: "0 10 10", to: "360 10 10", dur: "1s", repeatCount: "indefinite" }) })
|
|
1421
1469
|
] });
|
|
1422
1470
|
}
|
|
1423
1471
|
function ErrorIcon({ className }) {
|
|
1424
|
-
return /* @__PURE__ */ (0,
|
|
1425
|
-
/* @__PURE__ */ (0,
|
|
1426
|
-
/* @__PURE__ */ (0,
|
|
1472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { className, width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", "aria-hidden": "true", children: [
|
|
1473
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("circle", { cx: "10", cy: "10", r: "8", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
1474
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M10 6.5v4M10 13.5h.01", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
|
|
1427
1475
|
] });
|
|
1428
1476
|
}
|
|
1429
1477
|
function CloseIcon2({ className }) {
|
|
1430
|
-
return /* @__PURE__ */ (0,
|
|
1478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { className, width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M12 4 4 12M4 4l8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
1431
1479
|
}
|
|
1432
1480
|
var defaultIcons2 = {
|
|
1433
1481
|
default: CheckCircleIcon,
|
|
@@ -1444,7 +1492,7 @@ var iconColorClasses = {
|
|
|
1444
1492
|
progress: "text-toast-progress-icon",
|
|
1445
1493
|
error: "text-toast-error-icon"
|
|
1446
1494
|
};
|
|
1447
|
-
var Toast = (0,
|
|
1495
|
+
var Toast = (0, import_react13.forwardRef)(
|
|
1448
1496
|
(_a, ref) => {
|
|
1449
1497
|
var _b = _a, {
|
|
1450
1498
|
type = "default",
|
|
@@ -1472,10 +1520,10 @@ var Toast = (0, import_react12.forwardRef)(
|
|
|
1472
1520
|
typeClasses[type],
|
|
1473
1521
|
className
|
|
1474
1522
|
].filter(Boolean).join(" ");
|
|
1475
|
-
return /* @__PURE__ */ (0,
|
|
1476
|
-
icon && /* @__PURE__ */ (0,
|
|
1477
|
-
/* @__PURE__ */ (0,
|
|
1478
|
-
actionLabel && onAction && /* @__PURE__ */ (0,
|
|
1523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", __spreadProps(__spreadValues({ ref, role: "alert", className: classes }, rest), { children: [
|
|
1524
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: `shrink-0 ${iconColorClasses[type]}`, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(DefaultIcon, { className: "h-20 w-20" }) }),
|
|
1525
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "flex-1 text-sm font-medium leading-20 truncate", children }),
|
|
1526
|
+
actionLabel && onAction && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1479
1527
|
"button",
|
|
1480
1528
|
{
|
|
1481
1529
|
type: "button",
|
|
@@ -1484,14 +1532,14 @@ var Toast = (0, import_react12.forwardRef)(
|
|
|
1484
1532
|
children: actionLabel
|
|
1485
1533
|
}
|
|
1486
1534
|
),
|
|
1487
|
-
onDismiss && /* @__PURE__ */ (0,
|
|
1535
|
+
onDismiss && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1488
1536
|
"button",
|
|
1489
1537
|
{
|
|
1490
1538
|
type: "button",
|
|
1491
1539
|
onClick: onDismiss,
|
|
1492
1540
|
className: "shrink-0 p-4 rounded-md text-toast-dismiss hover:text-toast-dismiss-hover transition-colors",
|
|
1493
1541
|
"aria-label": "Dismiss",
|
|
1494
|
-
children: /* @__PURE__ */ (0,
|
|
1542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseIcon2, { className: "h-16 w-16" })
|
|
1495
1543
|
}
|
|
1496
1544
|
)
|
|
1497
1545
|
] }));
|