@bigstack-oss/cube-ui 0.0.2 → 0.1.0
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.css +517 -0
- package/dist/index.d.cts +244 -10
- package/dist/index.d.ts +244 -10
- package/dist/index.js +1497 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1492 -41
- package/dist/index.mjs.map +1 -1
- package/dist/theme.d.cts +405 -405
- package/dist/theme.d.ts +405 -405
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -281,12 +281,12 @@ var getIconClasses = (size, classNameProps) => {
|
|
|
281
281
|
|
|
282
282
|
// src/components/CubeButton/cubeButtonUtils.ts
|
|
283
283
|
var getIconSizeByButtonSize = (size) => {
|
|
284
|
-
const
|
|
284
|
+
const sizeMapping2 = {
|
|
285
285
|
sm: "md-sm",
|
|
286
286
|
md: "md",
|
|
287
287
|
lg: "md"
|
|
288
288
|
};
|
|
289
|
-
const iconSize =
|
|
289
|
+
const iconSize = sizeMapping2[size];
|
|
290
290
|
return getIconSizeClass(iconSize);
|
|
291
291
|
};
|
|
292
292
|
var CubeLeft = (props) => {
|
|
@@ -481,6 +481,23 @@ var CubeButtonLoadingSpinner = (props) => {
|
|
|
481
481
|
}
|
|
482
482
|
);
|
|
483
483
|
};
|
|
484
|
+
var CubeSkeleton = (props) => {
|
|
485
|
+
const { className, style } = props;
|
|
486
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
487
|
+
"div",
|
|
488
|
+
{
|
|
489
|
+
className: tailwindMerge.twMerge(
|
|
490
|
+
"cube-skeleton animate-cube-skeleton rounded-[5px]",
|
|
491
|
+
className
|
|
492
|
+
),
|
|
493
|
+
style
|
|
494
|
+
}
|
|
495
|
+
);
|
|
496
|
+
};
|
|
497
|
+
var CubeButtonSkeleton = (props) => {
|
|
498
|
+
const { size = "md", usage = "text-only" } = props;
|
|
499
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: tailwindMerge.twMerge(buttonSkeleton({ size, usage })) });
|
|
500
|
+
};
|
|
484
501
|
var CubeButton = (props) => {
|
|
485
502
|
const {
|
|
486
503
|
htmlType = "button",
|
|
@@ -534,30 +551,58 @@ var CubeButton = (props) => {
|
|
|
534
551
|
}
|
|
535
552
|
);
|
|
536
553
|
};
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
554
|
+
CubeButton.Skeleton = CubeButtonSkeleton;
|
|
555
|
+
var SvgCheckbox = ({
|
|
556
|
+
title,
|
|
557
|
+
titleId,
|
|
558
|
+
...props
|
|
559
|
+
}, ref) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
560
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
561
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "currentColor", strokeWidth: 1.2, d: "M2 4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2z" })
|
|
562
|
+
] });
|
|
563
|
+
var ForwardRef = react.forwardRef(SvgCheckbox);
|
|
564
|
+
var Checkbox_default = ForwardRef;
|
|
565
|
+
var SvgCheckboxCheckedFilled = ({
|
|
566
|
+
title,
|
|
567
|
+
titleId,
|
|
568
|
+
...props
|
|
569
|
+
}, ref) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
570
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
571
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M3.6 1.6a2 2 0 0 0-2 2v8.8a2 2 0 0 0 2 2h8.8a2 2 0 0 0 2-2V3.6a2 2 0 0 0-2-2zm7.796 4.824a.74.74 0 0 0-1.08-1.013L7.151 8.785 5.471 6.991a.74.74 0 1 0-1.08 1.013l2.22 2.37a.74.74 0 0 0 1.082 0z", clipRule: "evenodd" })
|
|
572
|
+
] });
|
|
573
|
+
var ForwardRef2 = react.forwardRef(SvgCheckboxCheckedFilled);
|
|
574
|
+
var CheckboxCheckedFilled_default = ForwardRef2;
|
|
575
|
+
var SvgCheckboxUndeterminateFilled = ({
|
|
576
|
+
title,
|
|
577
|
+
titleId,
|
|
578
|
+
...props
|
|
579
|
+
}, ref) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
580
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
581
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M3.6 1.6a2 2 0 0 0-2 2v8.8a2 2 0 0 0 2 2h8.8a2 2 0 0 0 2-2V3.6a2 2 0 0 0-2-2zm1.9 5.65a.75.75 0 0 0 0 1.5h5a.75.75 0 0 0 0-1.5z", clipRule: "evenodd" })
|
|
582
|
+
] });
|
|
583
|
+
var ForwardRef3 = react.forwardRef(SvgCheckboxUndeterminateFilled);
|
|
584
|
+
var CheckboxUndeterminateFilled_default = ForwardRef3;
|
|
585
|
+
var SvgRadioButton = ({
|
|
586
|
+
title,
|
|
587
|
+
titleId,
|
|
588
|
+
...props
|
|
589
|
+
}, ref) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
590
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
591
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: 8, cy: 8, r: 6.5, stroke: "currentColor", strokeWidth: 1.2 })
|
|
592
|
+
] });
|
|
593
|
+
var ForwardRef4 = react.forwardRef(SvgRadioButton);
|
|
594
|
+
var RadioButton_default = ForwardRef4;
|
|
595
|
+
var SvgRadioButtonFilled = ({
|
|
596
|
+
title,
|
|
597
|
+
titleId,
|
|
598
|
+
...props
|
|
599
|
+
}, ref) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
600
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: 8, cy: 8, r: 6.5, stroke: "currentColor", strokeWidth: 1.2 }),
|
|
602
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", d: "M8 13A5 5 0 1 0 8 3a5 5 0 0 0 0 10" })
|
|
603
|
+
] });
|
|
604
|
+
var ForwardRef5 = react.forwardRef(SvgRadioButtonFilled);
|
|
605
|
+
var RadioButtonFilled_default = ForwardRef5;
|
|
561
606
|
var SvgView = ({
|
|
562
607
|
title,
|
|
563
608
|
titleId,
|
|
@@ -566,8 +611,8 @@ var SvgView = ({
|
|
|
566
611
|
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
567
612
|
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", d: "m1.5 8-.58-.154a.6.6 0 0 0 0 .308zm13 0 .58.154a.6.6 0 0 0 0-.308zM9.718 8c0 .95-.77 1.721-1.721 1.721v1.2A2.92 2.92 0 0 0 10.918 8zM7.997 9.721c-.951 0-1.722-.77-1.722-1.721h-1.2a2.92 2.92 0 0 0 2.922 2.921zM6.275 8c0-.95.771-1.721 1.722-1.721v-1.2A2.92 2.92 0 0 0 5.075 8zm1.722-1.721c.95 0 1.721.77 1.721 1.721h1.2a2.92 2.92 0 0 0-2.921-2.921zm0-3.522C4.122 2.757 1.6 5.276.92 7.847l1.16.307c.549-2.073 2.615-4.197 5.917-4.197zM.92 8.154c.68 2.57 3.202 5.089 7.08 5.089v-1.2c-3.305 0-5.371-2.125-5.92-4.197zM8 13.243c3.878 0 6.396-2.519 7.08-5.089l-1.16-.308c-.552 2.073-2.615 4.197-5.92 4.197zm7.08-5.397c-.685-2.57-3.209-5.089-7.083-5.089v1.2c3.302 0 5.371 2.125 5.923 4.197z" })
|
|
568
613
|
] });
|
|
569
|
-
var
|
|
570
|
-
var View_default =
|
|
614
|
+
var ForwardRef6 = react.forwardRef(SvgView);
|
|
615
|
+
var View_default = ForwardRef6;
|
|
571
616
|
var SvgViewOff = ({
|
|
572
617
|
title,
|
|
573
618
|
titleId,
|
|
@@ -576,8 +621,8 @@ var SvgViewOff = ({
|
|
|
576
621
|
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
577
622
|
/* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.2, d: "M5.675 8.143A2.32 2.32 0 0 1 7.997 5.82M6.41 9.838a2.321 2.321 0 0 0 3.322-3.237M11.715 4.5c1.464.893 2.419 2.268 2.785 3.643-.618 2.321-2.908 4.643-6.5 4.643-1.424 0-2.643-.365-3.635-.95M3 10.76a6.04 6.04 0 0 1-1.5-2.617C2.115 5.82 4.408 3.5 7.997 3.5c.761 0 1.464.105 2.106.291M14.2 2l-12 12" })
|
|
578
623
|
] });
|
|
579
|
-
var
|
|
580
|
-
var ViewOff_default =
|
|
624
|
+
var ForwardRef7 = react.forwardRef(SvgViewOff);
|
|
625
|
+
var ViewOff_default = ForwardRef7;
|
|
581
626
|
var SvgWarningFilled = ({
|
|
582
627
|
title,
|
|
583
628
|
titleId,
|
|
@@ -586,8 +631,355 @@ var SvgWarningFilled = ({
|
|
|
586
631
|
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
587
632
|
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M8.1 15.2A7.1 7.1 0 1 0 8.1 1a7.1 7.1 0 0 0 0 14.2m.9-4.1a.9.9 0 1 1-1.8 0 .9.9 0 0 1 1.8 0M7.5 8.5a.6.6 0 0 0 1.2 0v-4a.6.6 0 1 0-1.2 0z", clipRule: "evenodd" })
|
|
588
633
|
] });
|
|
589
|
-
var
|
|
590
|
-
var WarningFilled_default =
|
|
634
|
+
var ForwardRef8 = react.forwardRef(SvgWarningFilled);
|
|
635
|
+
var WarningFilled_default = ForwardRef8;
|
|
636
|
+
var SvgX = ({
|
|
637
|
+
title,
|
|
638
|
+
titleId,
|
|
639
|
+
...props
|
|
640
|
+
}, ref) => /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
641
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
642
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.2, d: "m12.5 3.5-9 9m9 0-9-9" })
|
|
643
|
+
] });
|
|
644
|
+
var ForwardRef9 = react.forwardRef(SvgX);
|
|
645
|
+
var X_default = ForwardRef9;
|
|
646
|
+
var container = classVarianceAuthority.cva(
|
|
647
|
+
"inline-flex w-fit cursor-pointer items-start gap-x-2",
|
|
648
|
+
{
|
|
649
|
+
variants: {
|
|
650
|
+
labelSize: {
|
|
651
|
+
md: "primary-body2",
|
|
652
|
+
sm: "primary-body3",
|
|
653
|
+
xs: "primary-body4"
|
|
654
|
+
},
|
|
655
|
+
disabled: {
|
|
656
|
+
true: "cursor-default"
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
);
|
|
661
|
+
var iconWrap = classVarianceAuthority.cva("shrink-0 p-0.5 transition-colors duration-100", {
|
|
662
|
+
variants: {
|
|
663
|
+
color: {},
|
|
664
|
+
isSelected: {
|
|
665
|
+
true: ""
|
|
666
|
+
},
|
|
667
|
+
disabled: {
|
|
668
|
+
true: ""
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
compoundVariants: [
|
|
672
|
+
/** Primary */
|
|
673
|
+
{
|
|
674
|
+
color: "primary",
|
|
675
|
+
isSelected: false,
|
|
676
|
+
className: "text-functional-border-darker peer-hover:text-functional-hover-primary"
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
color: "primary",
|
|
680
|
+
isSelected: true,
|
|
681
|
+
className: "text-primary peer-hover:text-functional-hover-primary"
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
color: "primary",
|
|
685
|
+
disabled: true,
|
|
686
|
+
className: "text-functional-disable-text peer-hover:text-functional-disable-text"
|
|
687
|
+
},
|
|
688
|
+
/** Primary (dark) */
|
|
689
|
+
{
|
|
690
|
+
color: "primary-dark",
|
|
691
|
+
isSelected: false,
|
|
692
|
+
className: "text-functional-text peer-hover:text-functional-hover-primary"
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
color: "primary-dark",
|
|
696
|
+
isSelected: true,
|
|
697
|
+
className: "text-primary-700 peer-hover:text-primary-500"
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
color: "primary-dark",
|
|
701
|
+
disabled: true,
|
|
702
|
+
className: "text-functional-disable-text peer-hover:text-functional-disable-text"
|
|
703
|
+
},
|
|
704
|
+
/** Secondary */
|
|
705
|
+
{
|
|
706
|
+
color: "secondary",
|
|
707
|
+
isSelected: false,
|
|
708
|
+
className: "text-functional-border-darker peer-hover:text-blue-700"
|
|
709
|
+
},
|
|
710
|
+
{
|
|
711
|
+
color: "secondary",
|
|
712
|
+
isSelected: true,
|
|
713
|
+
className: "text-blue-600 peer-hover:text-blue-700"
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
color: "secondary",
|
|
717
|
+
disabled: true,
|
|
718
|
+
className: "text-functional-disable-text peer-hover:text-functional-disable-text"
|
|
719
|
+
},
|
|
720
|
+
/** Secondary (dark) */
|
|
721
|
+
{
|
|
722
|
+
color: "secondary-dark",
|
|
723
|
+
isSelected: false,
|
|
724
|
+
className: "text-functional-text peer-hover:text-blue-600"
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
color: "secondary-dark",
|
|
728
|
+
isSelected: true,
|
|
729
|
+
className: "text-blue-700 peer-hover:text-blue-600"
|
|
730
|
+
},
|
|
731
|
+
{
|
|
732
|
+
color: "secondary-dark",
|
|
733
|
+
disabled: true,
|
|
734
|
+
className: "text-functional-disable-text peer-hover:text-functional-disable-text"
|
|
735
|
+
}
|
|
736
|
+
]
|
|
737
|
+
});
|
|
738
|
+
var label = classVarianceAuthority.cva("max-w-[152px] break-words text-functional-text", {
|
|
739
|
+
variants: {
|
|
740
|
+
color: {},
|
|
741
|
+
disabled: {
|
|
742
|
+
true: "text-functional-disable-text"
|
|
743
|
+
}
|
|
744
|
+
},
|
|
745
|
+
compoundVariants: [
|
|
746
|
+
{
|
|
747
|
+
color: "primary",
|
|
748
|
+
disabled: false,
|
|
749
|
+
className: "text-functional-text"
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
color: "primary",
|
|
753
|
+
disabled: true,
|
|
754
|
+
className: "text-functional-disable-text"
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
color: "primary-dark",
|
|
758
|
+
disabled: false,
|
|
759
|
+
className: "font-semibold text-functional-text"
|
|
760
|
+
},
|
|
761
|
+
{
|
|
762
|
+
color: "primary-dark",
|
|
763
|
+
disabled: true,
|
|
764
|
+
className: "font-semibold text-functional-disable-text"
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
color: "secondary",
|
|
768
|
+
disabled: false,
|
|
769
|
+
className: "text-functional-text"
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
color: "secondary",
|
|
773
|
+
disabled: true,
|
|
774
|
+
className: "text-functional-disable-text"
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
color: "secondary-dark",
|
|
778
|
+
disabled: false,
|
|
779
|
+
className: "font-semibold text-functional-text"
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
color: "secondary-dark",
|
|
783
|
+
disabled: true,
|
|
784
|
+
className: "font-semibold text-functional-disable-text"
|
|
785
|
+
}
|
|
786
|
+
]
|
|
787
|
+
});
|
|
788
|
+
var CubeCheckboxSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex gap-x-2", children: [
|
|
789
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "size-5" }),
|
|
790
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-5 w-[152px]" })
|
|
791
|
+
] });
|
|
792
|
+
var CubeCheckboxGrid = (props) => {
|
|
793
|
+
const { children, className: classNameProp, direction } = props;
|
|
794
|
+
const className = tailwindMerge.twMerge(
|
|
795
|
+
direction === "vertical" ? "flex flex-col gap-y-3" : "grid grid-cols-[repeat(auto-fill,180px)] gap-x-4 gap-y-6",
|
|
796
|
+
classNameProp
|
|
797
|
+
);
|
|
798
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
|
|
799
|
+
};
|
|
800
|
+
var CubeCheckbox = (props) => {
|
|
801
|
+
const {
|
|
802
|
+
containerClassName,
|
|
803
|
+
color = "primary",
|
|
804
|
+
label: label4,
|
|
805
|
+
labelSize = "md",
|
|
806
|
+
labelClassName,
|
|
807
|
+
id,
|
|
808
|
+
defaultChecked = false,
|
|
809
|
+
checked: controlledChecked,
|
|
810
|
+
onChange: onControlledCheckedChange,
|
|
811
|
+
disabled,
|
|
812
|
+
isLoading = false,
|
|
813
|
+
ref,
|
|
814
|
+
...restProps
|
|
815
|
+
} = props;
|
|
816
|
+
const [uncontrolledChecked, setUncontrolledChecked] = react.useState(defaultChecked);
|
|
817
|
+
const isControlled = controlledChecked !== void 0;
|
|
818
|
+
const effectiveChecked = isControlled ? controlledChecked : uncontrolledChecked;
|
|
819
|
+
const isIndeterminate = effectiveChecked === null;
|
|
820
|
+
const handleChange = (event) => {
|
|
821
|
+
if (!isControlled) {
|
|
822
|
+
setUncontrolledChecked(event.target.checked);
|
|
823
|
+
}
|
|
824
|
+
onControlledCheckedChange?.(event);
|
|
825
|
+
};
|
|
826
|
+
const renderIcon = () => {
|
|
827
|
+
const IconComponent = (() => {
|
|
828
|
+
if (isIndeterminate) return CheckboxUndeterminateFilled_default;
|
|
829
|
+
return effectiveChecked ? CheckboxCheckedFilled_default : Checkbox_default;
|
|
830
|
+
})();
|
|
831
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
832
|
+
"div",
|
|
833
|
+
{
|
|
834
|
+
className: tailwindMerge.twMerge(
|
|
835
|
+
iconWrap({
|
|
836
|
+
color,
|
|
837
|
+
isSelected: effectiveChecked || isIndeterminate,
|
|
838
|
+
disabled
|
|
839
|
+
})
|
|
840
|
+
),
|
|
841
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "icon-md" })
|
|
842
|
+
}
|
|
843
|
+
);
|
|
844
|
+
};
|
|
845
|
+
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeCheckboxSkeleton, {});
|
|
846
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
847
|
+
"label",
|
|
848
|
+
{
|
|
849
|
+
htmlFor: id,
|
|
850
|
+
className: tailwindMerge.twMerge(
|
|
851
|
+
container({ labelSize, disabled }),
|
|
852
|
+
containerClassName
|
|
853
|
+
),
|
|
854
|
+
children: [
|
|
855
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
856
|
+
"input",
|
|
857
|
+
{
|
|
858
|
+
...restProps,
|
|
859
|
+
id,
|
|
860
|
+
ref,
|
|
861
|
+
type: "checkbox",
|
|
862
|
+
checked: effectiveChecked ?? false,
|
|
863
|
+
onChange: handleChange,
|
|
864
|
+
disabled,
|
|
865
|
+
className: "peer hidden"
|
|
866
|
+
}
|
|
867
|
+
),
|
|
868
|
+
renderIcon(),
|
|
869
|
+
label4 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
870
|
+
"span",
|
|
871
|
+
{
|
|
872
|
+
className: tailwindMerge.twMerge(label({ color, disabled }), labelClassName),
|
|
873
|
+
children: label4
|
|
874
|
+
}
|
|
875
|
+
)
|
|
876
|
+
]
|
|
877
|
+
}
|
|
878
|
+
);
|
|
879
|
+
};
|
|
880
|
+
CubeCheckbox.Skeleton = CubeCheckboxSkeleton;
|
|
881
|
+
CubeCheckbox.Grid = CubeCheckboxGrid;
|
|
882
|
+
var hyperlink = classVarianceAuthority.cva(
|
|
883
|
+
["flex cursor-pointer items-center gap-x-1 font-medium"],
|
|
884
|
+
{
|
|
885
|
+
variants: {
|
|
886
|
+
color: {
|
|
887
|
+
primary: [
|
|
888
|
+
"text-primary",
|
|
889
|
+
"hover:text-functional-hover-primary",
|
|
890
|
+
"visited:text-primary-700"
|
|
891
|
+
],
|
|
892
|
+
secondary: [
|
|
893
|
+
"text-functional-border-darker",
|
|
894
|
+
"hover:text-functional-text-light",
|
|
895
|
+
"visited:text-functional-border-darker"
|
|
896
|
+
]
|
|
897
|
+
},
|
|
898
|
+
size: {
|
|
899
|
+
md: "primary-body2",
|
|
900
|
+
sm: "primary-body4"
|
|
901
|
+
},
|
|
902
|
+
variant: {
|
|
903
|
+
"text-only": "",
|
|
904
|
+
"text-inline": "underline underline-offset-4",
|
|
905
|
+
"icon-left": "",
|
|
906
|
+
"icon-right": ""
|
|
907
|
+
},
|
|
908
|
+
disabled: {
|
|
909
|
+
true: "text-functional-disable-text hover:cursor-default hover:text-functional-disable-text"
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
);
|
|
914
|
+
var sizeMapping = {
|
|
915
|
+
sm: { iconSize: "sm", iconFrameSize: "size-[15px]" },
|
|
916
|
+
md: { iconSize: "md-sm", iconFrameSize: "size-[17px]" }
|
|
917
|
+
};
|
|
918
|
+
var CubeHyperlink = (props) => {
|
|
919
|
+
const {
|
|
920
|
+
className: classNameProps,
|
|
921
|
+
color = "primary",
|
|
922
|
+
size = "md",
|
|
923
|
+
variant = "text-only",
|
|
924
|
+
disabled = false,
|
|
925
|
+
children,
|
|
926
|
+
href,
|
|
927
|
+
target,
|
|
928
|
+
onClick
|
|
929
|
+
} = props;
|
|
930
|
+
if (!href && !onClick) {
|
|
931
|
+
console.warn(
|
|
932
|
+
"CubeHyperlink: href or onClick must be provided to make the hyperlink interactive"
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
const handleClick = (e) => {
|
|
936
|
+
if (disabled) return;
|
|
937
|
+
onClick?.(e);
|
|
938
|
+
};
|
|
939
|
+
const renderIcon = (iconVariant) => {
|
|
940
|
+
if (props.variant !== iconVariant) {
|
|
941
|
+
return null;
|
|
942
|
+
}
|
|
943
|
+
const { Icon } = props;
|
|
944
|
+
const { iconSize, iconFrameSize } = sizeMapping[size];
|
|
945
|
+
const iconSizeClass = getIconSizeClass(iconSize);
|
|
946
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
947
|
+
"div",
|
|
948
|
+
{
|
|
949
|
+
className: tailwindMerge.twMerge("flex items-center justify-center", iconFrameSize),
|
|
950
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: iconSizeClass })
|
|
951
|
+
}
|
|
952
|
+
);
|
|
953
|
+
};
|
|
954
|
+
const renderHyperlink = () => {
|
|
955
|
+
const hyperlinkType = !disabled && href ? "a" : "div";
|
|
956
|
+
const hrefAttribute = hyperlinkType === "a" ? href : void 0;
|
|
957
|
+
const targetAttribute = hyperlinkType === "a" ? target : void 0;
|
|
958
|
+
return react.createElement(
|
|
959
|
+
hyperlinkType,
|
|
960
|
+
{
|
|
961
|
+
className: tailwindMerge.twMerge(
|
|
962
|
+
hyperlink({ color, size, variant, disabled }),
|
|
963
|
+
classNameProps
|
|
964
|
+
),
|
|
965
|
+
href: hrefAttribute,
|
|
966
|
+
target: targetAttribute,
|
|
967
|
+
onClick: handleClick
|
|
968
|
+
},
|
|
969
|
+
renderIcon("icon-left"),
|
|
970
|
+
children,
|
|
971
|
+
renderIcon("icon-right")
|
|
972
|
+
);
|
|
973
|
+
};
|
|
974
|
+
return renderHyperlink();
|
|
975
|
+
};
|
|
976
|
+
var CubeIconFrame = (props) => {
|
|
977
|
+
const { className: classNameProps, size = "md", children, onClick } = props;
|
|
978
|
+
const containerClasses = getContainerClasses(size, classNameProps);
|
|
979
|
+
const iconClasses = getIconClasses(size, children.props.className);
|
|
980
|
+
const icon = react.cloneElement(children, { className: iconClasses });
|
|
981
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: containerClasses, onClick, children: icon });
|
|
982
|
+
};
|
|
591
983
|
var input = classVarianceAuthority.cva(
|
|
592
984
|
[
|
|
593
985
|
"primary-body2 w-full truncate rounded-[6px] py-[9px] outline-none",
|
|
@@ -650,13 +1042,13 @@ var CubeInputSkeleton = (props) => {
|
|
|
650
1042
|
const { type } = props;
|
|
651
1043
|
return /* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: skeleton({ type }) });
|
|
652
1044
|
};
|
|
653
|
-
var CubeInput =
|
|
654
|
-
(props, ref) => {
|
|
1045
|
+
var CubeInput = Object.assign(
|
|
1046
|
+
react.forwardRef((props, ref) => {
|
|
655
1047
|
const {
|
|
656
1048
|
className,
|
|
657
1049
|
required = false,
|
|
658
1050
|
isLoading = false,
|
|
659
|
-
label,
|
|
1051
|
+
label: label4,
|
|
660
1052
|
tooltip,
|
|
661
1053
|
helpMessage,
|
|
662
1054
|
errorMessage,
|
|
@@ -670,7 +1062,7 @@ var CubeInput = react.forwardRef(
|
|
|
670
1062
|
const hasFooter = !!helpMessage || isError;
|
|
671
1063
|
const hasIcon = !!trailingIcon;
|
|
672
1064
|
const renderLabel = () => {
|
|
673
|
-
if (!
|
|
1065
|
+
if (!label4 && !tooltip) return null;
|
|
674
1066
|
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeInputSkeleton, { type: "label" });
|
|
675
1067
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "primary-body2 flex items-center space-x-1", children: [
|
|
676
1068
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -678,7 +1070,7 @@ var CubeInput = react.forwardRef(
|
|
|
678
1070
|
{
|
|
679
1071
|
htmlFor: inputId,
|
|
680
1072
|
className: "font-semibold text-functional-title",
|
|
681
|
-
children:
|
|
1073
|
+
children: label4
|
|
682
1074
|
}
|
|
683
1075
|
),
|
|
684
1076
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-status-negative", children: "*" }),
|
|
@@ -686,6 +1078,7 @@ var CubeInput = react.forwardRef(
|
|
|
686
1078
|
] });
|
|
687
1079
|
};
|
|
688
1080
|
const renderIcon = () => {
|
|
1081
|
+
if (isLoading) return null;
|
|
689
1082
|
const errorIcon = (() => {
|
|
690
1083
|
if (!isError) return null;
|
|
691
1084
|
return /* @__PURE__ */ jsxRuntime.jsx(WarningFilled_default, { className: "icon-md text-status-negative" });
|
|
@@ -732,7 +1125,8 @@ var CubeInput = react.forwardRef(
|
|
|
732
1125
|
] }),
|
|
733
1126
|
renderFooter()
|
|
734
1127
|
] });
|
|
735
|
-
}
|
|
1128
|
+
}),
|
|
1129
|
+
{ Skeleton: CubeInputSkeleton }
|
|
736
1130
|
);
|
|
737
1131
|
CubeInput.displayName = "CubeInput";
|
|
738
1132
|
var CubePasswordInput = (props) => {
|
|
@@ -752,6 +1146,1063 @@ var CubePasswordInput = (props) => {
|
|
|
752
1146
|
}
|
|
753
1147
|
);
|
|
754
1148
|
};
|
|
1149
|
+
var container2 = classVarianceAuthority.cva(
|
|
1150
|
+
"primary-body2 inline-flex w-fit cursor-pointer items-start gap-x-2",
|
|
1151
|
+
{
|
|
1152
|
+
variants: {
|
|
1153
|
+
disabled: {
|
|
1154
|
+
true: "cursor-default"
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
);
|
|
1159
|
+
var iconWrap2 = classVarianceAuthority.cva(
|
|
1160
|
+
[
|
|
1161
|
+
"shrink-0 p-0.5",
|
|
1162
|
+
"text-functional-border-darker transition-colors duration-100 peer-hover:text-functional-hover-primary"
|
|
1163
|
+
],
|
|
1164
|
+
{
|
|
1165
|
+
variants: {
|
|
1166
|
+
isSelected: {
|
|
1167
|
+
true: "text-primary"
|
|
1168
|
+
},
|
|
1169
|
+
disabled: {
|
|
1170
|
+
true: "text-functional-disable-text peer-hover:text-functional-disable-text"
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
);
|
|
1175
|
+
var label2 = classVarianceAuthority.cva("max-w-[152px] break-words text-functional-text", {
|
|
1176
|
+
variants: {
|
|
1177
|
+
disabled: {
|
|
1178
|
+
true: "text-functional-disable-text"
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
var CubeRadioButtonSkeleton = () => {
|
|
1183
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex gap-x-2", children: [
|
|
1184
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "size-5" }),
|
|
1185
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-5 w-[152px]" })
|
|
1186
|
+
] });
|
|
1187
|
+
};
|
|
1188
|
+
var CubeRadioButtonGrid = (props) => {
|
|
1189
|
+
const { children, className: classNameProp, direction } = props;
|
|
1190
|
+
const className = tailwindMerge.twMerge(
|
|
1191
|
+
direction === "vertical" ? "flex flex-col gap-y-3" : "grid grid-cols-[repeat(auto-fill,180px)] gap-x-4 gap-y-6",
|
|
1192
|
+
classNameProp
|
|
1193
|
+
);
|
|
1194
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
|
|
1195
|
+
};
|
|
1196
|
+
var CubeRadioButton = (props) => {
|
|
1197
|
+
const {
|
|
1198
|
+
label: label4,
|
|
1199
|
+
id,
|
|
1200
|
+
ref,
|
|
1201
|
+
defaultChecked = false,
|
|
1202
|
+
checked: controlledChecked,
|
|
1203
|
+
onChange: onControlledCheckedChange,
|
|
1204
|
+
disabled,
|
|
1205
|
+
isLoading = false,
|
|
1206
|
+
...restProps
|
|
1207
|
+
} = props;
|
|
1208
|
+
const [uncontrolledChecked, setUncontrolledChecked] = react.useState(defaultChecked);
|
|
1209
|
+
const isControlled = controlledChecked !== void 0;
|
|
1210
|
+
const effectiveChecked = isControlled ? controlledChecked : uncontrolledChecked;
|
|
1211
|
+
const handleChange = (event) => {
|
|
1212
|
+
if (!isControlled) {
|
|
1213
|
+
setUncontrolledChecked(event.target.checked);
|
|
1214
|
+
}
|
|
1215
|
+
onControlledCheckedChange?.(event);
|
|
1216
|
+
};
|
|
1217
|
+
const renderIcon = () => {
|
|
1218
|
+
const IconComponent = effectiveChecked ? RadioButtonFilled_default : RadioButton_default;
|
|
1219
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1220
|
+
"div",
|
|
1221
|
+
{
|
|
1222
|
+
className: tailwindMerge.twMerge(
|
|
1223
|
+
iconWrap2({ disabled, isSelected: effectiveChecked })
|
|
1224
|
+
),
|
|
1225
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "icon-md" })
|
|
1226
|
+
}
|
|
1227
|
+
);
|
|
1228
|
+
};
|
|
1229
|
+
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeRadioButtonSkeleton, {});
|
|
1230
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: id, className: tailwindMerge.twMerge(container2({ disabled })), children: [
|
|
1231
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1232
|
+
"input",
|
|
1233
|
+
{
|
|
1234
|
+
...restProps,
|
|
1235
|
+
id,
|
|
1236
|
+
ref,
|
|
1237
|
+
type: "radio",
|
|
1238
|
+
checked: effectiveChecked ?? false,
|
|
1239
|
+
onChange: handleChange,
|
|
1240
|
+
disabled,
|
|
1241
|
+
className: "peer hidden"
|
|
1242
|
+
}
|
|
1243
|
+
),
|
|
1244
|
+
renderIcon(),
|
|
1245
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: tailwindMerge.twMerge(label2({ disabled })), children: label4 })
|
|
1246
|
+
] });
|
|
1247
|
+
};
|
|
1248
|
+
CubeRadioButton.Skeleton = CubeRadioButtonSkeleton;
|
|
1249
|
+
CubeRadioButton.Grid = CubeRadioButtonGrid;
|
|
1250
|
+
var stroke = classVarianceAuthority.cva("", {
|
|
1251
|
+
variants: {
|
|
1252
|
+
type: {
|
|
1253
|
+
regular: "border-functional-border-divider",
|
|
1254
|
+
dot: "border-t-4 border-dotted border-primary-50"
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
});
|
|
1258
|
+
var CubeStroke = (props) => {
|
|
1259
|
+
const { className, type = "regular", color } = props;
|
|
1260
|
+
return /* @__PURE__ */ jsxRuntime.jsx("hr", { className: tailwindMerge.twMerge(stroke({ type }), color, className) });
|
|
1261
|
+
};
|
|
1262
|
+
var tab = classVarianceAuthority.cva(
|
|
1263
|
+
"inline-block min-h-[34px] max-w-[200px] border-b border-b-functional-border-divider",
|
|
1264
|
+
{
|
|
1265
|
+
variants: {
|
|
1266
|
+
isActive: {
|
|
1267
|
+
false: "text-functional-text-light"
|
|
1268
|
+
},
|
|
1269
|
+
disabled: {
|
|
1270
|
+
false: ["cursor-pointer hover:text-functional-hover-primary"],
|
|
1271
|
+
true: ["cursor-default text-functional-disable-text"]
|
|
1272
|
+
}
|
|
1273
|
+
},
|
|
1274
|
+
compoundVariants: [
|
|
1275
|
+
{
|
|
1276
|
+
isActive: true,
|
|
1277
|
+
disabled: false,
|
|
1278
|
+
className: "border-b-cosmos-primary text-cosmos-primary"
|
|
1279
|
+
}
|
|
1280
|
+
],
|
|
1281
|
+
defaultVariants: {
|
|
1282
|
+
isActive: false,
|
|
1283
|
+
disabled: false
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
);
|
|
1287
|
+
var innerContainer = classVarianceAuthority.cva(
|
|
1288
|
+
[
|
|
1289
|
+
"secondary-body2 flex items-center justify-center px-2.5 py-2",
|
|
1290
|
+
"border-b border-b-transparent"
|
|
1291
|
+
],
|
|
1292
|
+
{
|
|
1293
|
+
variants: {
|
|
1294
|
+
isActive: {
|
|
1295
|
+
true: "",
|
|
1296
|
+
false: ""
|
|
1297
|
+
},
|
|
1298
|
+
disabled: {
|
|
1299
|
+
false: "font-medium"
|
|
1300
|
+
}
|
|
1301
|
+
},
|
|
1302
|
+
compoundVariants: [
|
|
1303
|
+
{
|
|
1304
|
+
isActive: true,
|
|
1305
|
+
disabled: false,
|
|
1306
|
+
className: "border-b-cosmos-primary font-semibold"
|
|
1307
|
+
}
|
|
1308
|
+
],
|
|
1309
|
+
defaultVariants: {
|
|
1310
|
+
isActive: false,
|
|
1311
|
+
disabled: false
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
);
|
|
1315
|
+
var numberSpan = classVarianceAuthority.cva(
|
|
1316
|
+
"secondary-body7 ml-1 inline-flex size-4 shrink-0 items-center justify-center rounded-full text-[9px] font-extrabold",
|
|
1317
|
+
{
|
|
1318
|
+
variants: {
|
|
1319
|
+
disabled: {
|
|
1320
|
+
false: ["bg-cosmos-secondary text-functional-text"],
|
|
1321
|
+
true: ["bg-secondary-150 text-functional-text-light"]
|
|
1322
|
+
}
|
|
1323
|
+
},
|
|
1324
|
+
defaultVariants: {
|
|
1325
|
+
disabled: false
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
);
|
|
1329
|
+
var NumberSpan = (props) => {
|
|
1330
|
+
const { number, disabled } = props;
|
|
1331
|
+
const text = number > 99 ? "N" : number;
|
|
1332
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1333
|
+
"span",
|
|
1334
|
+
{
|
|
1335
|
+
className: numberSpan({
|
|
1336
|
+
disabled
|
|
1337
|
+
}),
|
|
1338
|
+
children: text
|
|
1339
|
+
}
|
|
1340
|
+
);
|
|
1341
|
+
};
|
|
1342
|
+
var dotSpan = classVarianceAuthority.cva("ml-2.5 size-1 shrink-0 rounded-full", {
|
|
1343
|
+
variants: {
|
|
1344
|
+
disabled: {
|
|
1345
|
+
false: ["bg-cosmos-secondary"],
|
|
1346
|
+
true: ["bg-secondary-150"]
|
|
1347
|
+
}
|
|
1348
|
+
},
|
|
1349
|
+
defaultVariants: {
|
|
1350
|
+
disabled: false
|
|
1351
|
+
}
|
|
1352
|
+
});
|
|
1353
|
+
var DotSpan = (props) => {
|
|
1354
|
+
const { disabled } = props;
|
|
1355
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1356
|
+
"span",
|
|
1357
|
+
{
|
|
1358
|
+
className: dotSpan({
|
|
1359
|
+
disabled
|
|
1360
|
+
})
|
|
1361
|
+
}
|
|
1362
|
+
);
|
|
1363
|
+
};
|
|
1364
|
+
var CubeTab = (props) => {
|
|
1365
|
+
const {
|
|
1366
|
+
children,
|
|
1367
|
+
href,
|
|
1368
|
+
isActive,
|
|
1369
|
+
disabled = false,
|
|
1370
|
+
number,
|
|
1371
|
+
dot,
|
|
1372
|
+
onClick: onClickProp
|
|
1373
|
+
} = props;
|
|
1374
|
+
const onClick = (e) => {
|
|
1375
|
+
if (!disabled) {
|
|
1376
|
+
onClickProp?.(e);
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
const renderLabel = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1380
|
+
"span",
|
|
1381
|
+
{
|
|
1382
|
+
"data-label": children,
|
|
1383
|
+
className: tailwindMerge.twJoin(
|
|
1384
|
+
"inline-flex flex-col items-center",
|
|
1385
|
+
// Use pseudo element to avoid slight layout shift caused by the font weight changes between inactive and active states.
|
|
1386
|
+
"before:secondary-body2 before:pointer-events-none before:invisible before:h-0 before:select-none before:font-semibold before:content-[attr(data-label)]"
|
|
1387
|
+
),
|
|
1388
|
+
children
|
|
1389
|
+
}
|
|
1390
|
+
);
|
|
1391
|
+
const renderDecoration = () => {
|
|
1392
|
+
if (number !== void 0) {
|
|
1393
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NumberSpan, { number, disabled });
|
|
1394
|
+
} else if (dot) {
|
|
1395
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DotSpan, { disabled });
|
|
1396
|
+
} else {
|
|
1397
|
+
return void 0;
|
|
1398
|
+
}
|
|
1399
|
+
};
|
|
1400
|
+
const renderTab = () => {
|
|
1401
|
+
const tagType = href && !disabled ? "a" : "span";
|
|
1402
|
+
const hrefAttribute = tagType === "a" ? href : void 0;
|
|
1403
|
+
return react.createElement(
|
|
1404
|
+
tagType,
|
|
1405
|
+
{
|
|
1406
|
+
className: tailwindMerge.twMerge(
|
|
1407
|
+
tab({
|
|
1408
|
+
isActive,
|
|
1409
|
+
disabled
|
|
1410
|
+
})
|
|
1411
|
+
),
|
|
1412
|
+
href: hrefAttribute,
|
|
1413
|
+
onClick
|
|
1414
|
+
},
|
|
1415
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1416
|
+
"div",
|
|
1417
|
+
{
|
|
1418
|
+
className: tailwindMerge.twMerge(
|
|
1419
|
+
innerContainer({
|
|
1420
|
+
isActive,
|
|
1421
|
+
disabled
|
|
1422
|
+
})
|
|
1423
|
+
),
|
|
1424
|
+
children: [
|
|
1425
|
+
renderLabel(),
|
|
1426
|
+
renderDecoration()
|
|
1427
|
+
]
|
|
1428
|
+
}
|
|
1429
|
+
)
|
|
1430
|
+
);
|
|
1431
|
+
};
|
|
1432
|
+
return renderTab();
|
|
1433
|
+
};
|
|
1434
|
+
var CubeTabSkeleton = () => {
|
|
1435
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-b border-b-functional-border-divider px-5 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-4 w-9" }) });
|
|
1436
|
+
};
|
|
1437
|
+
var CubeTabs = (props) => {
|
|
1438
|
+
const { children } = props;
|
|
1439
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-end", children });
|
|
1440
|
+
};
|
|
1441
|
+
CubeTabs.Tab = CubeTab;
|
|
1442
|
+
CubeTabs.Skeleton = CubeTabSkeleton;
|
|
1443
|
+
var compoundsCreator = (color, variant, entries) => entries.map((entry) => ({ color, variant, ...entry }));
|
|
1444
|
+
var defaultCompounds = [
|
|
1445
|
+
// Filled - Base
|
|
1446
|
+
{
|
|
1447
|
+
color: "default",
|
|
1448
|
+
variant: "filled",
|
|
1449
|
+
disabled: false,
|
|
1450
|
+
className: tailwindMerge.twMerge(
|
|
1451
|
+
"bg-functional-border-divider hover:bg-grey-300",
|
|
1452
|
+
"text-functional-text"
|
|
1453
|
+
)
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
color: "default",
|
|
1457
|
+
variant: "filled",
|
|
1458
|
+
disabled: true,
|
|
1459
|
+
className: tailwindMerge.twMerge(
|
|
1460
|
+
"bg-functional-disable-light",
|
|
1461
|
+
"text-functional-disable-text"
|
|
1462
|
+
)
|
|
1463
|
+
},
|
|
1464
|
+
// Filled - Close button
|
|
1465
|
+
{
|
|
1466
|
+
color: "default",
|
|
1467
|
+
variant: "filled",
|
|
1468
|
+
hasCloseButton: true,
|
|
1469
|
+
disabled: false,
|
|
1470
|
+
className: tailwindMerge.twMerge(
|
|
1471
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
1472
|
+
)
|
|
1473
|
+
},
|
|
1474
|
+
{
|
|
1475
|
+
color: "default",
|
|
1476
|
+
variant: "filled",
|
|
1477
|
+
hasCloseButton: true,
|
|
1478
|
+
disabled: true,
|
|
1479
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1480
|
+
},
|
|
1481
|
+
// Filled - Icon
|
|
1482
|
+
{
|
|
1483
|
+
color: "default",
|
|
1484
|
+
variant: "filled",
|
|
1485
|
+
hasIcon: true,
|
|
1486
|
+
disabled: false,
|
|
1487
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
1488
|
+
},
|
|
1489
|
+
{
|
|
1490
|
+
color: "default",
|
|
1491
|
+
variant: "filled",
|
|
1492
|
+
hasIcon: true,
|
|
1493
|
+
disabled: true,
|
|
1494
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1495
|
+
},
|
|
1496
|
+
// Stroke - Base
|
|
1497
|
+
{
|
|
1498
|
+
color: "default",
|
|
1499
|
+
variant: "stroke",
|
|
1500
|
+
disabled: false,
|
|
1501
|
+
className: tailwindMerge.twMerge(
|
|
1502
|
+
"bg-functional-border-divider hover:bg-grey-300",
|
|
1503
|
+
"text-functional-text",
|
|
1504
|
+
"border border-functional-border-darker"
|
|
1505
|
+
)
|
|
1506
|
+
},
|
|
1507
|
+
{
|
|
1508
|
+
color: "default",
|
|
1509
|
+
variant: "stroke",
|
|
1510
|
+
disabled: true,
|
|
1511
|
+
className: tailwindMerge.twMerge(
|
|
1512
|
+
"bg-functional-disable-light",
|
|
1513
|
+
"text-functional-disable-text",
|
|
1514
|
+
"border border-functional-border-divider"
|
|
1515
|
+
)
|
|
1516
|
+
},
|
|
1517
|
+
// Stroke - Close button
|
|
1518
|
+
{
|
|
1519
|
+
color: "default",
|
|
1520
|
+
variant: "stroke",
|
|
1521
|
+
hasCloseButton: true,
|
|
1522
|
+
disabled: false,
|
|
1523
|
+
className: tailwindMerge.twMerge(
|
|
1524
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
1525
|
+
)
|
|
1526
|
+
},
|
|
1527
|
+
{
|
|
1528
|
+
color: "default",
|
|
1529
|
+
variant: "stroke",
|
|
1530
|
+
hasCloseButton: true,
|
|
1531
|
+
disabled: true,
|
|
1532
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1533
|
+
},
|
|
1534
|
+
// Stroke - Icon
|
|
1535
|
+
{
|
|
1536
|
+
color: "default",
|
|
1537
|
+
variant: "stroke",
|
|
1538
|
+
hasIcon: true,
|
|
1539
|
+
disabled: false,
|
|
1540
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
1541
|
+
},
|
|
1542
|
+
{
|
|
1543
|
+
color: "default",
|
|
1544
|
+
variant: "stroke",
|
|
1545
|
+
hasIcon: true,
|
|
1546
|
+
disabled: true,
|
|
1547
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1548
|
+
}
|
|
1549
|
+
];
|
|
1550
|
+
var primaryBlueCompounds = [
|
|
1551
|
+
...compoundsCreator("primary-blue", "filled", [
|
|
1552
|
+
{
|
|
1553
|
+
disabled: false,
|
|
1554
|
+
className: tailwindMerge.twMerge(
|
|
1555
|
+
"bg-primary-200 hover:bg-primary-150",
|
|
1556
|
+
"text-functional-text"
|
|
1557
|
+
)
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
disabled: true,
|
|
1561
|
+
className: tailwindMerge.twMerge("bg-primary-50", "text-functional-disable-text")
|
|
1562
|
+
},
|
|
1563
|
+
{
|
|
1564
|
+
hasCloseButton: true,
|
|
1565
|
+
disabled: false,
|
|
1566
|
+
className: tailwindMerge.twMerge(
|
|
1567
|
+
"[&>svg]:text-grey-0 [&>svg]:hover:text-functional-text"
|
|
1568
|
+
)
|
|
1569
|
+
},
|
|
1570
|
+
{
|
|
1571
|
+
hasCloseButton: true,
|
|
1572
|
+
disabled: true,
|
|
1573
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
hasIcon: true,
|
|
1577
|
+
disabled: false,
|
|
1578
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
hasIcon: true,
|
|
1582
|
+
disabled: true,
|
|
1583
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1584
|
+
}
|
|
1585
|
+
]),
|
|
1586
|
+
...compoundsCreator("primary-blue", "stroke", [
|
|
1587
|
+
{
|
|
1588
|
+
disabled: false,
|
|
1589
|
+
className: tailwindMerge.twMerge(
|
|
1590
|
+
"bg-primary-0 hover:bg-primary-50",
|
|
1591
|
+
"text-functional-text",
|
|
1592
|
+
"border border-primary-200"
|
|
1593
|
+
)
|
|
1594
|
+
},
|
|
1595
|
+
{
|
|
1596
|
+
disabled: true,
|
|
1597
|
+
className: tailwindMerge.twMerge(
|
|
1598
|
+
"bg-primary-0",
|
|
1599
|
+
"text-functional-disable-text",
|
|
1600
|
+
"border border-primary-50"
|
|
1601
|
+
)
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
hasCloseButton: true,
|
|
1605
|
+
disabled: false,
|
|
1606
|
+
className: tailwindMerge.twMerge(
|
|
1607
|
+
"[&>svg]:text-primary-200 [&>svg]:hover:text-functional-text"
|
|
1608
|
+
)
|
|
1609
|
+
},
|
|
1610
|
+
{
|
|
1611
|
+
hasCloseButton: true,
|
|
1612
|
+
disabled: true,
|
|
1613
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1614
|
+
},
|
|
1615
|
+
{
|
|
1616
|
+
hasIcon: true,
|
|
1617
|
+
disabled: false,
|
|
1618
|
+
className: tailwindMerge.twMerge("[&>svg]:text-primary-200")
|
|
1619
|
+
},
|
|
1620
|
+
{
|
|
1621
|
+
hasIcon: true,
|
|
1622
|
+
disabled: true,
|
|
1623
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1624
|
+
}
|
|
1625
|
+
])
|
|
1626
|
+
];
|
|
1627
|
+
var blueCompounds = [
|
|
1628
|
+
...compoundsCreator("blue", "filled", [
|
|
1629
|
+
{
|
|
1630
|
+
disabled: false,
|
|
1631
|
+
className: tailwindMerge.twMerge(
|
|
1632
|
+
"bg-blue-200 hover:bg-blue-150",
|
|
1633
|
+
"text-functional-text"
|
|
1634
|
+
)
|
|
1635
|
+
},
|
|
1636
|
+
{
|
|
1637
|
+
disabled: true,
|
|
1638
|
+
className: tailwindMerge.twMerge("bg-blue-50", "text-functional-disable-text")
|
|
1639
|
+
},
|
|
1640
|
+
{
|
|
1641
|
+
hasCloseButton: true,
|
|
1642
|
+
disabled: false,
|
|
1643
|
+
className: tailwindMerge.twMerge(
|
|
1644
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
1645
|
+
)
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
hasCloseButton: true,
|
|
1649
|
+
disabled: true,
|
|
1650
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1651
|
+
},
|
|
1652
|
+
{
|
|
1653
|
+
hasIcon: true,
|
|
1654
|
+
disabled: false,
|
|
1655
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
1656
|
+
},
|
|
1657
|
+
{
|
|
1658
|
+
hasIcon: true,
|
|
1659
|
+
disabled: true,
|
|
1660
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1661
|
+
}
|
|
1662
|
+
]),
|
|
1663
|
+
...compoundsCreator("blue", "stroke", [
|
|
1664
|
+
{
|
|
1665
|
+
disabled: false,
|
|
1666
|
+
className: tailwindMerge.twMerge(
|
|
1667
|
+
"bg-blue-50 hover:bg-blue-100",
|
|
1668
|
+
"text-functional-text",
|
|
1669
|
+
"border border-primary-400"
|
|
1670
|
+
)
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
disabled: true,
|
|
1674
|
+
className: tailwindMerge.twMerge(
|
|
1675
|
+
"bg-blue-0",
|
|
1676
|
+
"text-functional-disable-text",
|
|
1677
|
+
"border border-primary-150"
|
|
1678
|
+
)
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
hasCloseButton: true,
|
|
1682
|
+
disabled: false,
|
|
1683
|
+
className: tailwindMerge.twMerge(
|
|
1684
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
1685
|
+
)
|
|
1686
|
+
},
|
|
1687
|
+
{
|
|
1688
|
+
hasCloseButton: true,
|
|
1689
|
+
disabled: true,
|
|
1690
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1691
|
+
},
|
|
1692
|
+
{
|
|
1693
|
+
hasIcon: true,
|
|
1694
|
+
disabled: false,
|
|
1695
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
1696
|
+
},
|
|
1697
|
+
{
|
|
1698
|
+
hasIcon: true,
|
|
1699
|
+
disabled: true,
|
|
1700
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1701
|
+
}
|
|
1702
|
+
])
|
|
1703
|
+
];
|
|
1704
|
+
var cyanCompounds = [
|
|
1705
|
+
...compoundsCreator("cyan", "filled", [
|
|
1706
|
+
{
|
|
1707
|
+
disabled: false,
|
|
1708
|
+
className: tailwindMerge.twMerge(
|
|
1709
|
+
"bg-secondary-200 hover:bg-secondary-150",
|
|
1710
|
+
"text-functional-text"
|
|
1711
|
+
)
|
|
1712
|
+
},
|
|
1713
|
+
{
|
|
1714
|
+
disabled: true,
|
|
1715
|
+
className: tailwindMerge.twMerge("bg-secondary-50", "text-functional-disable-text")
|
|
1716
|
+
},
|
|
1717
|
+
{
|
|
1718
|
+
hasCloseButton: true,
|
|
1719
|
+
disabled: false,
|
|
1720
|
+
className: tailwindMerge.twMerge(
|
|
1721
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
1722
|
+
)
|
|
1723
|
+
},
|
|
1724
|
+
{
|
|
1725
|
+
hasCloseButton: true,
|
|
1726
|
+
disabled: true,
|
|
1727
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1728
|
+
},
|
|
1729
|
+
{
|
|
1730
|
+
hasIcon: true,
|
|
1731
|
+
disabled: false,
|
|
1732
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
1733
|
+
},
|
|
1734
|
+
{
|
|
1735
|
+
hasIcon: true,
|
|
1736
|
+
disabled: true,
|
|
1737
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1738
|
+
}
|
|
1739
|
+
]),
|
|
1740
|
+
...compoundsCreator("cyan", "stroke", [
|
|
1741
|
+
{
|
|
1742
|
+
disabled: false,
|
|
1743
|
+
className: tailwindMerge.twMerge(
|
|
1744
|
+
"bg-secondary-50 hover:bg-secondary-100",
|
|
1745
|
+
"text-functional-text",
|
|
1746
|
+
"border border-secondary-600"
|
|
1747
|
+
)
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
disabled: true,
|
|
1751
|
+
className: tailwindMerge.twMerge(
|
|
1752
|
+
"bg-secondary-0",
|
|
1753
|
+
"text-functional-disable-text",
|
|
1754
|
+
"border border-secondary-150"
|
|
1755
|
+
)
|
|
1756
|
+
},
|
|
1757
|
+
{
|
|
1758
|
+
hasCloseButton: true,
|
|
1759
|
+
disabled: false,
|
|
1760
|
+
className: tailwindMerge.twMerge(
|
|
1761
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
1762
|
+
)
|
|
1763
|
+
},
|
|
1764
|
+
{
|
|
1765
|
+
hasCloseButton: true,
|
|
1766
|
+
disabled: true,
|
|
1767
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1768
|
+
},
|
|
1769
|
+
{
|
|
1770
|
+
hasIcon: true,
|
|
1771
|
+
disabled: false,
|
|
1772
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
hasIcon: true,
|
|
1776
|
+
disabled: true,
|
|
1777
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
1778
|
+
}
|
|
1779
|
+
])
|
|
1780
|
+
];
|
|
1781
|
+
var darkCompounds = [
|
|
1782
|
+
...compoundsCreator("dark", "filled", [
|
|
1783
|
+
{
|
|
1784
|
+
disabled: false,
|
|
1785
|
+
className: tailwindMerge.twMerge("bg-dark-500 hover:bg-dark-400", "text-grey-0")
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
disabled: true,
|
|
1789
|
+
className: tailwindMerge.twMerge("bg-functional-disable", "text-grey-0")
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
hasCloseButton: true,
|
|
1793
|
+
disabled: false,
|
|
1794
|
+
className: tailwindMerge.twMerge("[&>svg]:text-dark-150 [&>svg]:hover:text-grey-0")
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
hasCloseButton: true,
|
|
1798
|
+
disabled: true,
|
|
1799
|
+
className: tailwindMerge.twMerge("[&>svg]:text-grey-0")
|
|
1800
|
+
},
|
|
1801
|
+
{
|
|
1802
|
+
hasIcon: true,
|
|
1803
|
+
disabled: false,
|
|
1804
|
+
className: tailwindMerge.twMerge("[&>svg]:text-dark-150")
|
|
1805
|
+
},
|
|
1806
|
+
{
|
|
1807
|
+
hasIcon: true,
|
|
1808
|
+
disabled: true,
|
|
1809
|
+
className: tailwindMerge.twMerge("[&>svg]:text-grey-0")
|
|
1810
|
+
}
|
|
1811
|
+
]),
|
|
1812
|
+
...compoundsCreator("dark", "stroke", [
|
|
1813
|
+
{
|
|
1814
|
+
disabled: false,
|
|
1815
|
+
className: tailwindMerge.twMerge(
|
|
1816
|
+
"bg-dark-50 hover:bg-dark-100",
|
|
1817
|
+
"text-functional-text",
|
|
1818
|
+
"border border-functional-text"
|
|
1819
|
+
)
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
disabled: true,
|
|
1823
|
+
className: tailwindMerge.twMerge(
|
|
1824
|
+
"bg-dark-0",
|
|
1825
|
+
"text-functional-border-divider",
|
|
1826
|
+
"border border-functional-border-divider"
|
|
1827
|
+
)
|
|
1828
|
+
},
|
|
1829
|
+
{
|
|
1830
|
+
hasCloseButton: true,
|
|
1831
|
+
disabled: false,
|
|
1832
|
+
className: tailwindMerge.twMerge(
|
|
1833
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
1834
|
+
)
|
|
1835
|
+
},
|
|
1836
|
+
{
|
|
1837
|
+
hasCloseButton: true,
|
|
1838
|
+
disabled: true,
|
|
1839
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-border-divider")
|
|
1840
|
+
},
|
|
1841
|
+
{
|
|
1842
|
+
hasIcon: true,
|
|
1843
|
+
disabled: false,
|
|
1844
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
1845
|
+
},
|
|
1846
|
+
{
|
|
1847
|
+
hasIcon: true,
|
|
1848
|
+
disabled: true,
|
|
1849
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-border-divider")
|
|
1850
|
+
}
|
|
1851
|
+
])
|
|
1852
|
+
];
|
|
1853
|
+
var tag = classVarianceAuthority.cva(
|
|
1854
|
+
[
|
|
1855
|
+
"inline-flex items-center gap-x-[5px] whitespace-nowrap",
|
|
1856
|
+
"h-[21px] w-fit cursor-default rounded-[20px] px-2.5 py-1",
|
|
1857
|
+
"secondary-body5 font-semibold"
|
|
1858
|
+
],
|
|
1859
|
+
{
|
|
1860
|
+
variants: {
|
|
1861
|
+
// Use `as` for `compoundVariants` to infer the type.
|
|
1862
|
+
color: {},
|
|
1863
|
+
variant: {},
|
|
1864
|
+
hasCloseButton: {
|
|
1865
|
+
true: void 0
|
|
1866
|
+
},
|
|
1867
|
+
hasIcon: {
|
|
1868
|
+
true: void 0
|
|
1869
|
+
},
|
|
1870
|
+
disabled: {
|
|
1871
|
+
true: void 0
|
|
1872
|
+
}
|
|
1873
|
+
},
|
|
1874
|
+
compoundVariants: [
|
|
1875
|
+
...defaultCompounds,
|
|
1876
|
+
...primaryBlueCompounds,
|
|
1877
|
+
...blueCompounds,
|
|
1878
|
+
...cyanCompounds,
|
|
1879
|
+
...darkCompounds
|
|
1880
|
+
]
|
|
1881
|
+
}
|
|
1882
|
+
);
|
|
1883
|
+
var closeButton = classVarianceAuthority.cva("icon-xs", {
|
|
1884
|
+
variants: {
|
|
1885
|
+
disabled: {
|
|
1886
|
+
false: "cursor-pointer",
|
|
1887
|
+
true: "cursor-default"
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
});
|
|
1891
|
+
var skeleton2 = classVarianceAuthority.cva("h-[23px] rounded-full", {
|
|
1892
|
+
variants: {
|
|
1893
|
+
hasIcon: {
|
|
1894
|
+
true: "w-[95px]",
|
|
1895
|
+
false: "w-[80px]"
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
});
|
|
1899
|
+
var CubeTagSkeleton = (props) => {
|
|
1900
|
+
const { hasIcon } = props;
|
|
1901
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: tailwindMerge.twMerge(skeleton2({ hasIcon })) });
|
|
1902
|
+
};
|
|
1903
|
+
var CubeTag = (props) => {
|
|
1904
|
+
const {
|
|
1905
|
+
className,
|
|
1906
|
+
children,
|
|
1907
|
+
color = "default",
|
|
1908
|
+
variant,
|
|
1909
|
+
disabled = false,
|
|
1910
|
+
isLoading = false
|
|
1911
|
+
} = props;
|
|
1912
|
+
const hasIcon = "Icon" in props;
|
|
1913
|
+
const hasCloseButton = "showCloseButton" in props && props.showCloseButton;
|
|
1914
|
+
const renderIcon = () => {
|
|
1915
|
+
if (!hasIcon) {
|
|
1916
|
+
return void 0;
|
|
1917
|
+
}
|
|
1918
|
+
const { Icon } = props;
|
|
1919
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "icon-xs" });
|
|
1920
|
+
};
|
|
1921
|
+
const renderCloseButton = () => {
|
|
1922
|
+
if (!hasCloseButton) {
|
|
1923
|
+
return void 0;
|
|
1924
|
+
}
|
|
1925
|
+
const { onClose: onCloseProp } = props;
|
|
1926
|
+
const onClose = () => {
|
|
1927
|
+
if (!disabled) {
|
|
1928
|
+
onCloseProp?.();
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1931
|
+
return /* @__PURE__ */ jsxRuntime.jsx(X_default, { className: closeButton({ disabled }), onClick: onClose });
|
|
1932
|
+
};
|
|
1933
|
+
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeTagSkeleton, { hasIcon: hasIcon || hasCloseButton });
|
|
1934
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1935
|
+
"span",
|
|
1936
|
+
{
|
|
1937
|
+
className: tailwindMerge.twMerge(
|
|
1938
|
+
tag({
|
|
1939
|
+
color,
|
|
1940
|
+
variant,
|
|
1941
|
+
hasCloseButton,
|
|
1942
|
+
hasIcon,
|
|
1943
|
+
disabled
|
|
1944
|
+
}),
|
|
1945
|
+
className
|
|
1946
|
+
),
|
|
1947
|
+
children: [
|
|
1948
|
+
renderIcon(),
|
|
1949
|
+
children,
|
|
1950
|
+
renderCloseButton()
|
|
1951
|
+
]
|
|
1952
|
+
}
|
|
1953
|
+
);
|
|
1954
|
+
};
|
|
1955
|
+
CubeTag.Skeleton = CubeTagSkeleton;
|
|
1956
|
+
var CubeTextareaSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-[6px]", children: [
|
|
1957
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-[20px] min-w-[280px] max-w-[380px]" }),
|
|
1958
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-[140px] min-w-[280px] max-w-[380px]" })
|
|
1959
|
+
] });
|
|
1960
|
+
|
|
1961
|
+
// src/components/CubeTextarea/cubeTextareaUtils.ts
|
|
1962
|
+
var normalizeValue = (value) => {
|
|
1963
|
+
if (typeof value === "string") return value;
|
|
1964
|
+
if (typeof value === "number") return value.toString();
|
|
1965
|
+
if (Array.isArray(value)) return value.join("");
|
|
1966
|
+
return "";
|
|
1967
|
+
};
|
|
1968
|
+
var calculateValueLength = (value) => {
|
|
1969
|
+
const normalizedValue = normalizeValue(value);
|
|
1970
|
+
return normalizedValue.length;
|
|
1971
|
+
};
|
|
1972
|
+
var assignRefValue = (ref, element) => {
|
|
1973
|
+
if (!ref) return;
|
|
1974
|
+
if (typeof ref === "function") {
|
|
1975
|
+
ref(element);
|
|
1976
|
+
} else {
|
|
1977
|
+
ref.current = element;
|
|
1978
|
+
}
|
|
1979
|
+
};
|
|
1980
|
+
var useVisibleRowsCount = () => {
|
|
1981
|
+
const textareaRef = react.useRef(null);
|
|
1982
|
+
const [visibleRowsCount, setVisibleRowsCount] = react.useState(0);
|
|
1983
|
+
react.useEffect(() => {
|
|
1984
|
+
const textarea2 = textareaRef.current;
|
|
1985
|
+
let observer = void 0;
|
|
1986
|
+
if (textarea2) {
|
|
1987
|
+
observer = new ResizeObserver((entries) => {
|
|
1988
|
+
const { lineHeight } = getComputedStyle(textarea2);
|
|
1989
|
+
const lineHeightPx = parseInt(lineHeight);
|
|
1990
|
+
const textareaHeight = entries[0]?.contentBoxSize[0]?.blockSize ?? 0;
|
|
1991
|
+
setVisibleRowsCount(
|
|
1992
|
+
Math.ceil((textareaHeight + textarea2.scrollTop) / lineHeightPx)
|
|
1993
|
+
);
|
|
1994
|
+
});
|
|
1995
|
+
observer.observe(textarea2);
|
|
1996
|
+
}
|
|
1997
|
+
return () => {
|
|
1998
|
+
observer?.disconnect();
|
|
1999
|
+
};
|
|
2000
|
+
}, []);
|
|
2001
|
+
return {
|
|
2002
|
+
textareaRef,
|
|
2003
|
+
visibleRowsCount
|
|
2004
|
+
};
|
|
2005
|
+
};
|
|
2006
|
+
var textarea = classVarianceAuthority.cva(
|
|
2007
|
+
[
|
|
2008
|
+
"primary-body2 rounded-[5px] bg-grey-0 px-4 py-[10px] outline-none",
|
|
2009
|
+
"max-h-[260px] min-h-[140px] min-w-[280px]",
|
|
2010
|
+
"text-functional-text placeholder:text-functional-border-darker",
|
|
2011
|
+
"border border-functional-border-divider",
|
|
2012
|
+
"hover:border-functional-hover-primary focus:border-functional-hover-primary"
|
|
2013
|
+
],
|
|
2014
|
+
{
|
|
2015
|
+
variants: {
|
|
2016
|
+
isError: {
|
|
2017
|
+
true: "border-status-negative hover:border-status-negative"
|
|
2018
|
+
},
|
|
2019
|
+
disabled: {
|
|
2020
|
+
true: [
|
|
2021
|
+
"disabled:border-functional-disable-text disabled:text-functional-disable-text disabled:placeholder:text-functional-border-divider",
|
|
2022
|
+
"disabled:hover:border-functional-disable-text"
|
|
2023
|
+
]
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
);
|
|
2028
|
+
var CubeTextarea = (props) => {
|
|
2029
|
+
const {
|
|
2030
|
+
id: textareaId,
|
|
2031
|
+
ref,
|
|
2032
|
+
className,
|
|
2033
|
+
disabled,
|
|
2034
|
+
value: valueProps,
|
|
2035
|
+
onChange,
|
|
2036
|
+
label: label4,
|
|
2037
|
+
maxLength,
|
|
2038
|
+
isLoading,
|
|
2039
|
+
errorMessage,
|
|
2040
|
+
...restProps
|
|
2041
|
+
} = props;
|
|
2042
|
+
const [charCount, setCharCount] = react.useState(
|
|
2043
|
+
() => calculateValueLength(valueProps)
|
|
2044
|
+
);
|
|
2045
|
+
const [isFocused, setIsFocused] = react.useState(false);
|
|
2046
|
+
react.useEffect(() => {
|
|
2047
|
+
setCharCount(calculateValueLength(valueProps));
|
|
2048
|
+
}, [valueProps]);
|
|
2049
|
+
const { textareaRef: localRef, visibleRowsCount } = useVisibleRowsCount();
|
|
2050
|
+
const handleChange = (e) => {
|
|
2051
|
+
const newValue = e.target.value;
|
|
2052
|
+
if (newValue.length <= maxLength) {
|
|
2053
|
+
setCharCount(newValue.length);
|
|
2054
|
+
onChange?.(e);
|
|
2055
|
+
}
|
|
2056
|
+
};
|
|
2057
|
+
if (isLoading) {
|
|
2058
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CubeTextareaSkeleton, {});
|
|
2059
|
+
}
|
|
2060
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-[6px]", children: [
|
|
2061
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2062
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2063
|
+
"label",
|
|
2064
|
+
{
|
|
2065
|
+
htmlFor: textareaId,
|
|
2066
|
+
className: "primary-body2 font-semibold text-functional-text",
|
|
2067
|
+
children: label4
|
|
2068
|
+
}
|
|
2069
|
+
),
|
|
2070
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "secondary-body4 text-functional-text-light", children: [
|
|
2071
|
+
charCount.toLocaleString("en-US"),
|
|
2072
|
+
"/",
|
|
2073
|
+
maxLength.toLocaleString("en-US")
|
|
2074
|
+
] })
|
|
2075
|
+
] }),
|
|
2076
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2077
|
+
"textarea",
|
|
2078
|
+
{
|
|
2079
|
+
...restProps,
|
|
2080
|
+
id: textareaId,
|
|
2081
|
+
disabled,
|
|
2082
|
+
ref: (element) => {
|
|
2083
|
+
assignRefValue(ref, element);
|
|
2084
|
+
assignRefValue(localRef, element);
|
|
2085
|
+
},
|
|
2086
|
+
value: valueProps,
|
|
2087
|
+
onChange: handleChange,
|
|
2088
|
+
onFocus: () => setIsFocused(true),
|
|
2089
|
+
onBlur: () => setIsFocused(false),
|
|
2090
|
+
className: tailwindMerge.twMerge(
|
|
2091
|
+
textarea({ isError: !!errorMessage, disabled }),
|
|
2092
|
+
className
|
|
2093
|
+
),
|
|
2094
|
+
style: isFocused ? void 0 : {
|
|
2095
|
+
overflow: "hidden",
|
|
2096
|
+
display: "-webkit-box",
|
|
2097
|
+
WebkitBoxOrient: "vertical",
|
|
2098
|
+
WebkitLineClamp: visibleRowsCount
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
),
|
|
2102
|
+
errorMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "primary-body4 text-status-negative", children: errorMessage })
|
|
2103
|
+
] });
|
|
2104
|
+
};
|
|
2105
|
+
CubeTextarea.Skeleton = CubeTextareaSkeleton;
|
|
2106
|
+
var track = classVarianceAuthority.cva(
|
|
2107
|
+
"flex h-[20px] w-9 items-center rounded-full border border-transparent transition-colors",
|
|
2108
|
+
{
|
|
2109
|
+
variants: {
|
|
2110
|
+
checked: {
|
|
2111
|
+
true: "bg-status-positive",
|
|
2112
|
+
false: "bg-functional-disable-text"
|
|
2113
|
+
},
|
|
2114
|
+
disabled: {
|
|
2115
|
+
false: "cursor-pointer",
|
|
2116
|
+
true: "cursor-default"
|
|
2117
|
+
}
|
|
2118
|
+
},
|
|
2119
|
+
compoundVariants: [
|
|
2120
|
+
// Not disabled
|
|
2121
|
+
{
|
|
2122
|
+
checked: true,
|
|
2123
|
+
disabled: false,
|
|
2124
|
+
className: "hover:bg-green-400"
|
|
2125
|
+
},
|
|
2126
|
+
{
|
|
2127
|
+
checked: false,
|
|
2128
|
+
disabled: false,
|
|
2129
|
+
className: "hover:bg-grey-400"
|
|
2130
|
+
},
|
|
2131
|
+
// Disabled
|
|
2132
|
+
{
|
|
2133
|
+
checked: true,
|
|
2134
|
+
disabled: true,
|
|
2135
|
+
className: "border-green-200 bg-green-100"
|
|
2136
|
+
},
|
|
2137
|
+
{
|
|
2138
|
+
checked: false,
|
|
2139
|
+
disabled: true,
|
|
2140
|
+
className: "border-functional-disable bg-grey-150"
|
|
2141
|
+
}
|
|
2142
|
+
]
|
|
2143
|
+
}
|
|
2144
|
+
);
|
|
2145
|
+
var thumb = classVarianceAuthority.cva(
|
|
2146
|
+
"size-[17px] rounded-full bg-grey-0 shadow-md transition-transform",
|
|
2147
|
+
{
|
|
2148
|
+
variants: {
|
|
2149
|
+
checked: {
|
|
2150
|
+
true: "translate-x-4",
|
|
2151
|
+
false: "translate-x-px"
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
);
|
|
2156
|
+
var label3 = classVarianceAuthority.cva("primary-body4 text-functional-text", {
|
|
2157
|
+
variants: {
|
|
2158
|
+
disabled: {
|
|
2159
|
+
false: "cursor-pointer",
|
|
2160
|
+
true: "cursor-default"
|
|
2161
|
+
}
|
|
2162
|
+
}
|
|
2163
|
+
});
|
|
2164
|
+
var CubeToggle = (props) => {
|
|
2165
|
+
const {
|
|
2166
|
+
className,
|
|
2167
|
+
checked,
|
|
2168
|
+
onCheckedChange,
|
|
2169
|
+
label: label4,
|
|
2170
|
+
disabled = false,
|
|
2171
|
+
"aria-label": ariaLabel
|
|
2172
|
+
} = props;
|
|
2173
|
+
const toggleId = react.useId();
|
|
2174
|
+
const labelId = react.useId();
|
|
2175
|
+
const toggleChecked = () => {
|
|
2176
|
+
if (disabled) return;
|
|
2177
|
+
onCheckedChange(!checked);
|
|
2178
|
+
};
|
|
2179
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tailwindMerge.twMerge("flex items-center gap-x-[6px]", className), children: [
|
|
2180
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2181
|
+
"button",
|
|
2182
|
+
{
|
|
2183
|
+
id: toggleId,
|
|
2184
|
+
type: "button",
|
|
2185
|
+
role: "switch",
|
|
2186
|
+
"aria-checked": checked,
|
|
2187
|
+
"aria-labelledby": label4 ? labelId : void 0,
|
|
2188
|
+
"aria-label": label4 ? void 0 : ariaLabel,
|
|
2189
|
+
className: tailwindMerge.twMerge(track({ checked, disabled })),
|
|
2190
|
+
disabled,
|
|
2191
|
+
onClick: toggleChecked,
|
|
2192
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: thumb({ checked }), "aria-hidden": true })
|
|
2193
|
+
}
|
|
2194
|
+
),
|
|
2195
|
+
label4 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2196
|
+
"label",
|
|
2197
|
+
{
|
|
2198
|
+
id: labelId,
|
|
2199
|
+
htmlFor: toggleId,
|
|
2200
|
+
className: label3({ disabled }),
|
|
2201
|
+
children: label4
|
|
2202
|
+
}
|
|
2203
|
+
)
|
|
2204
|
+
] });
|
|
2205
|
+
};
|
|
755
2206
|
|
|
756
2207
|
// src/i18n/resources/en-US.json
|
|
757
2208
|
var en_US_default = {
|
|
@@ -1466,13 +2917,20 @@ var cubePreset = {
|
|
|
1466
2917
|
};
|
|
1467
2918
|
|
|
1468
2919
|
exports.CubeButton = CubeButton;
|
|
1469
|
-
exports.
|
|
2920
|
+
exports.CubeCheckbox = CubeCheckbox;
|
|
2921
|
+
exports.CubeHyperlink = CubeHyperlink;
|
|
1470
2922
|
exports.CubeIconFrame = CubeIconFrame;
|
|
1471
2923
|
exports.CubeInput = CubeInput;
|
|
1472
2924
|
exports.CubeLoadingSpinner = CubeLoadingSpinner;
|
|
1473
2925
|
exports.CubePasswordInput = CubePasswordInput;
|
|
2926
|
+
exports.CubeRadioButton = CubeRadioButton;
|
|
1474
2927
|
exports.CubeSkeleton = CubeSkeleton;
|
|
2928
|
+
exports.CubeStroke = CubeStroke;
|
|
2929
|
+
exports.CubeTabs = CubeTabs;
|
|
2930
|
+
exports.CubeTag = CubeTag;
|
|
2931
|
+
exports.CubeTextarea = CubeTextarea;
|
|
1475
2932
|
exports.CubeThemeProvider = CubeThemeProvider;
|
|
2933
|
+
exports.CubeToggle = CubeToggle;
|
|
1476
2934
|
exports.CubeUiLocaleProvider = CubeUiLocaleProvider;
|
|
1477
2935
|
exports.addCubeUiTranslations = addCubeUiTranslations;
|
|
1478
2936
|
exports.cubePreset = cubePreset;
|