@bigstack-oss/cube-ui 0.0.2 → 0.2.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 +950 -0
- package/dist/index.d.cts +505 -11
- package/dist/index.d.ts +505 -11
- package/dist/index.js +3495 -185
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3489 -192
- 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
|
@@ -5,8 +5,9 @@ var tailwindMerge = require('tailwind-merge');
|
|
|
5
5
|
var classVarianceAuthority = require('class-variance-authority');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var react = require('react');
|
|
8
|
-
var i18next = require('i18next');
|
|
9
8
|
var reactI18next = require('react-i18next');
|
|
9
|
+
var i18next = require('i18next');
|
|
10
|
+
var reactDom = require('react-dom');
|
|
10
11
|
var defaultTheme = require('tailwindcss/defaultTheme');
|
|
11
12
|
|
|
12
13
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -281,12 +282,12 @@ var getIconClasses = (size, classNameProps) => {
|
|
|
281
282
|
|
|
282
283
|
// src/components/CubeButton/cubeButtonUtils.ts
|
|
283
284
|
var getIconSizeByButtonSize = (size) => {
|
|
284
|
-
const
|
|
285
|
+
const sizeMapping2 = {
|
|
285
286
|
sm: "md-sm",
|
|
286
287
|
md: "md",
|
|
287
288
|
lg: "md"
|
|
288
289
|
};
|
|
289
|
-
const iconSize =
|
|
290
|
+
const iconSize = sizeMapping2[size];
|
|
290
291
|
return getIconSizeClass(iconSize);
|
|
291
292
|
};
|
|
292
293
|
var CubeLeft = (props) => {
|
|
@@ -481,6 +482,23 @@ var CubeButtonLoadingSpinner = (props) => {
|
|
|
481
482
|
}
|
|
482
483
|
);
|
|
483
484
|
};
|
|
485
|
+
var CubeSkeleton = (props) => {
|
|
486
|
+
const { className, style } = props;
|
|
487
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
488
|
+
"div",
|
|
489
|
+
{
|
|
490
|
+
className: tailwindMerge.twMerge(
|
|
491
|
+
"cube-skeleton animate-cube-skeleton rounded-[5px]",
|
|
492
|
+
className
|
|
493
|
+
),
|
|
494
|
+
style
|
|
495
|
+
}
|
|
496
|
+
);
|
|
497
|
+
};
|
|
498
|
+
var CubeButtonSkeleton = (props) => {
|
|
499
|
+
const { size = "md", usage = "text-only" } = props;
|
|
500
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: tailwindMerge.twMerge(buttonSkeleton({ size, usage })) });
|
|
501
|
+
};
|
|
484
502
|
var CubeButton = (props) => {
|
|
485
503
|
const {
|
|
486
504
|
htmlType = "button",
|
|
@@ -534,30 +552,118 @@ var CubeButton = (props) => {
|
|
|
534
552
|
}
|
|
535
553
|
);
|
|
536
554
|
};
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
555
|
+
CubeButton.Skeleton = CubeButtonSkeleton;
|
|
556
|
+
var SvgCheckbox = ({
|
|
557
|
+
title,
|
|
558
|
+
titleId,
|
|
559
|
+
...props
|
|
560
|
+
}, 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: [
|
|
561
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
562
|
+
/* @__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" })
|
|
563
|
+
] });
|
|
564
|
+
var ForwardRef = react.forwardRef(SvgCheckbox);
|
|
565
|
+
var Checkbox_default = ForwardRef;
|
|
566
|
+
var SvgCheckboxCheckedFilled = ({
|
|
567
|
+
title,
|
|
568
|
+
titleId,
|
|
569
|
+
...props
|
|
570
|
+
}, 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: [
|
|
571
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
572
|
+
/* @__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" })
|
|
573
|
+
] });
|
|
574
|
+
var ForwardRef2 = react.forwardRef(SvgCheckboxCheckedFilled);
|
|
575
|
+
var CheckboxCheckedFilled_default = ForwardRef2;
|
|
576
|
+
var SvgCheckboxUndeterminateFilled = ({
|
|
577
|
+
title,
|
|
578
|
+
titleId,
|
|
579
|
+
...props
|
|
580
|
+
}, 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: [
|
|
581
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
582
|
+
/* @__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" })
|
|
583
|
+
] });
|
|
584
|
+
var ForwardRef3 = react.forwardRef(SvgCheckboxUndeterminateFilled);
|
|
585
|
+
var CheckboxUndeterminateFilled_default = ForwardRef3;
|
|
586
|
+
var SvgCheckmarkBold = ({
|
|
587
|
+
title,
|
|
588
|
+
titleId,
|
|
589
|
+
...props
|
|
590
|
+
}, 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: [
|
|
591
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
592
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m3 7.3 3.75 4.2 6.25-7" })
|
|
593
|
+
] });
|
|
594
|
+
var ForwardRef4 = react.forwardRef(SvgCheckmarkBold);
|
|
595
|
+
var CheckmarkBold_default = ForwardRef4;
|
|
596
|
+
var SvgCheckmarkCircleFill = ({
|
|
597
|
+
title,
|
|
598
|
+
titleId,
|
|
599
|
+
...props
|
|
600
|
+
}, 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: [
|
|
601
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
602
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M8 1.1C4.134 1.1 1 4.19 1 8s3.134 6.9 7 6.9 7-3.09 7-6.9-3.134-6.9-7-6.9m3.446 5.413a.74.74 0 0 0-.034-1.06.77.77 0 0 0-1.076.034L7.087 8.903 5.359 7.087a.77.77 0 0 0-1.075-.034.74.74 0 0 0-.035 1.06l2.283 2.4a.766.766 0 0 0 1.11 0z", clipRule: "evenodd" })
|
|
603
|
+
] });
|
|
604
|
+
var ForwardRef5 = react.forwardRef(SvgCheckmarkCircleFill);
|
|
605
|
+
var CheckmarkCircleFill_default = ForwardRef5;
|
|
606
|
+
var SvgChevronDown = ({
|
|
607
|
+
title,
|
|
608
|
+
titleId,
|
|
609
|
+
...props
|
|
610
|
+
}, 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: [
|
|
611
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
612
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2, d: "M12.5 5.75 8 10.25l-4.5-4.5" })
|
|
613
|
+
] });
|
|
614
|
+
var ForwardRef6 = react.forwardRef(SvgChevronDown);
|
|
615
|
+
var ChevronDown_default = ForwardRef6;
|
|
616
|
+
var SvgChevronRight = ({
|
|
617
|
+
title,
|
|
618
|
+
titleId,
|
|
619
|
+
...props
|
|
620
|
+
}, 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: [
|
|
621
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
622
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2, d: "m5.75 3.5 4.5 4.5-4.5 4.5" })
|
|
623
|
+
] });
|
|
624
|
+
var ForwardRef7 = react.forwardRef(SvgChevronRight);
|
|
625
|
+
var ChevronRight_default = ForwardRef7;
|
|
626
|
+
var SvgCrossFill = ({
|
|
627
|
+
title,
|
|
628
|
+
titleId,
|
|
629
|
+
...props
|
|
630
|
+
}, 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: [
|
|
631
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
632
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", fillRule: "evenodd", d: "M8 1.1C4.134 1.1 1 4.19 1 8s3.134 6.9 7 6.9 7-3.09 7-6.9-3.134-6.9-7-6.9m2.924 4.824a.6.6 0 0 0-.848-.848L8 7.15 5.924 5.076a.6.6 0 1 0-.848.848L7.15 8l-2.075 2.076a.6.6 0 0 0 .848.848L8 8.85l2.076 2.075a.6.6 0 0 0 .848-.848L8.85 8z", clipRule: "evenodd" })
|
|
633
|
+
] });
|
|
634
|
+
var ForwardRef8 = react.forwardRef(SvgCrossFill);
|
|
635
|
+
var CrossFill_default = ForwardRef8;
|
|
636
|
+
var SvgRadioButton = ({
|
|
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("circle", { cx: 8, cy: 8, r: 6.5, stroke: "currentColor", strokeWidth: 1.2 })
|
|
643
|
+
] });
|
|
644
|
+
var ForwardRef9 = react.forwardRef(SvgRadioButton);
|
|
645
|
+
var RadioButton_default = ForwardRef9;
|
|
646
|
+
var SvgRadioButtonFilled = ({
|
|
647
|
+
title,
|
|
648
|
+
titleId,
|
|
649
|
+
...props
|
|
650
|
+
}, 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: [
|
|
651
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
652
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: 8, cy: 8, r: 6.5, stroke: "currentColor", strokeWidth: 1.2 }),
|
|
653
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", d: "M8 13A5 5 0 1 0 8 3a5 5 0 0 0 0 10" })
|
|
654
|
+
] });
|
|
655
|
+
var ForwardRef10 = react.forwardRef(SvgRadioButtonFilled);
|
|
656
|
+
var RadioButtonFilled_default = ForwardRef10;
|
|
657
|
+
var SvgSearch = ({
|
|
658
|
+
title,
|
|
659
|
+
titleId,
|
|
660
|
+
...props
|
|
661
|
+
}, 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: [
|
|
662
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
663
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.2, d: "M11.083 11.107 14 14m-1.313-6.688c0 2.934-2.392 5.312-5.343 5.312S2 10.247 2 7.312 4.392 2 7.344 2c2.95 0 5.343 2.378 5.343 5.312Z" })
|
|
664
|
+
] });
|
|
665
|
+
var ForwardRef11 = react.forwardRef(SvgSearch);
|
|
666
|
+
var Search_default = ForwardRef11;
|
|
561
667
|
var SvgView = ({
|
|
562
668
|
title,
|
|
563
669
|
titleId,
|
|
@@ -566,8 +672,8 @@ var SvgView = ({
|
|
|
566
672
|
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
567
673
|
/* @__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
674
|
] });
|
|
569
|
-
var
|
|
570
|
-
var View_default =
|
|
675
|
+
var ForwardRef12 = react.forwardRef(SvgView);
|
|
676
|
+
var View_default = ForwardRef12;
|
|
571
677
|
var SvgViewOff = ({
|
|
572
678
|
title,
|
|
573
679
|
titleId,
|
|
@@ -576,8 +682,8 @@ var SvgViewOff = ({
|
|
|
576
682
|
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
577
683
|
/* @__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
684
|
] });
|
|
579
|
-
var
|
|
580
|
-
var ViewOff_default =
|
|
685
|
+
var ForwardRef13 = react.forwardRef(SvgViewOff);
|
|
686
|
+
var ViewOff_default = ForwardRef13;
|
|
581
687
|
var SvgWarningFilled = ({
|
|
582
688
|
title,
|
|
583
689
|
titleId,
|
|
@@ -586,183 +692,618 @@ var SvgWarningFilled = ({
|
|
|
586
692
|
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
587
693
|
/* @__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
694
|
] });
|
|
589
|
-
var
|
|
590
|
-
var WarningFilled_default =
|
|
591
|
-
var
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
695
|
+
var ForwardRef14 = react.forwardRef(SvgWarningFilled);
|
|
696
|
+
var WarningFilled_default = ForwardRef14;
|
|
697
|
+
var SvgX = ({
|
|
698
|
+
title,
|
|
699
|
+
titleId,
|
|
700
|
+
...props
|
|
701
|
+
}, 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: [
|
|
702
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
703
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.2, d: "m12.5 3.5-9 9m9 0-9-9" })
|
|
704
|
+
] });
|
|
705
|
+
var ForwardRef15 = react.forwardRef(SvgX);
|
|
706
|
+
var X_default = ForwardRef15;
|
|
707
|
+
var SvgXSmall = ({
|
|
708
|
+
title,
|
|
709
|
+
titleId,
|
|
710
|
+
...props
|
|
711
|
+
}, 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: [
|
|
712
|
+
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
713
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.2, d: "m11 5-6 6m6 0L5 5" })
|
|
714
|
+
] });
|
|
715
|
+
var ForwardRef16 = react.forwardRef(SvgXSmall);
|
|
716
|
+
var XSmall_default = ForwardRef16;
|
|
717
|
+
var container = classVarianceAuthority.cva(
|
|
718
|
+
"inline-flex w-fit cursor-pointer items-start gap-x-2",
|
|
599
719
|
{
|
|
600
720
|
variants: {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
]
|
|
721
|
+
labelSize: {
|
|
722
|
+
md: "primary-body2",
|
|
723
|
+
sm: "primary-body3",
|
|
724
|
+
xs: "primary-body4"
|
|
606
725
|
},
|
|
607
726
|
disabled: {
|
|
608
|
-
true:
|
|
609
|
-
"disabled:border-functional-disable-text disabled:text-functional-disable-text disabled:placeholder:text-functional-border-divider",
|
|
610
|
-
"disabled:hover:border-functional-disable-text"
|
|
611
|
-
]
|
|
612
|
-
},
|
|
613
|
-
hasIcon: {
|
|
614
|
-
true: "pl-4 pr-8",
|
|
615
|
-
false: "px-4"
|
|
727
|
+
true: "cursor-default"
|
|
616
728
|
}
|
|
617
|
-
}
|
|
618
|
-
compoundVariants: [
|
|
619
|
-
{ isError: true, hasIcon: true, class: "pr-[56px]" },
|
|
620
|
-
{ isError: true, hasIcon: false, class: "pr-9" }
|
|
621
|
-
]
|
|
729
|
+
}
|
|
622
730
|
}
|
|
623
731
|
);
|
|
624
|
-
var
|
|
732
|
+
var iconWrap = classVarianceAuthority.cva("shrink-0 p-0.5 transition-colors duration-100", {
|
|
625
733
|
variants: {
|
|
734
|
+
color: {},
|
|
735
|
+
isSelected: {
|
|
736
|
+
true: ""
|
|
737
|
+
},
|
|
626
738
|
disabled: {
|
|
627
|
-
true: "
|
|
628
|
-
false: "cursor-pointer text-functional-text"
|
|
739
|
+
true: ""
|
|
629
740
|
}
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
741
|
+
},
|
|
742
|
+
compoundVariants: [
|
|
743
|
+
/** Primary */
|
|
744
|
+
{
|
|
745
|
+
color: "primary",
|
|
746
|
+
isSelected: false,
|
|
747
|
+
className: "text-functional-border-darker peer-hover:text-functional-hover-primary"
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
color: "primary",
|
|
751
|
+
isSelected: true,
|
|
752
|
+
className: "text-primary peer-hover:text-functional-hover-primary"
|
|
753
|
+
},
|
|
754
|
+
{
|
|
755
|
+
color: "primary",
|
|
756
|
+
disabled: true,
|
|
757
|
+
className: "text-functional-disable-text peer-hover:text-functional-disable-text"
|
|
758
|
+
},
|
|
759
|
+
/** Primary (dark) */
|
|
760
|
+
{
|
|
761
|
+
color: "primary-dark",
|
|
762
|
+
isSelected: false,
|
|
763
|
+
className: "text-functional-text peer-hover:text-functional-hover-primary"
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
color: "primary-dark",
|
|
767
|
+
isSelected: true,
|
|
768
|
+
className: "text-primary-700 peer-hover:text-primary-500"
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
color: "primary-dark",
|
|
772
|
+
disabled: true,
|
|
773
|
+
className: "text-functional-disable-text peer-hover:text-functional-disable-text"
|
|
774
|
+
},
|
|
775
|
+
/** Secondary */
|
|
776
|
+
{
|
|
777
|
+
color: "secondary",
|
|
778
|
+
isSelected: false,
|
|
779
|
+
className: "text-functional-border-darker peer-hover:text-blue-700"
|
|
780
|
+
},
|
|
781
|
+
{
|
|
782
|
+
color: "secondary",
|
|
783
|
+
isSelected: true,
|
|
784
|
+
className: "text-blue-600 peer-hover:text-blue-700"
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
color: "secondary",
|
|
788
|
+
disabled: true,
|
|
789
|
+
className: "text-functional-disable-text peer-hover:text-functional-disable-text"
|
|
790
|
+
},
|
|
791
|
+
/** Secondary (dark) */
|
|
792
|
+
{
|
|
793
|
+
color: "secondary-dark",
|
|
794
|
+
isSelected: false,
|
|
795
|
+
className: "text-functional-text peer-hover:text-blue-600"
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
color: "secondary-dark",
|
|
799
|
+
isSelected: true,
|
|
800
|
+
className: "text-blue-700 peer-hover:text-blue-600"
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
color: "secondary-dark",
|
|
804
|
+
disabled: true,
|
|
805
|
+
className: "text-functional-disable-text peer-hover:text-functional-disable-text"
|
|
637
806
|
}
|
|
638
|
-
|
|
807
|
+
]
|
|
639
808
|
});
|
|
640
|
-
var
|
|
809
|
+
var label = classVarianceAuthority.cva("max-w-[152px] break-words text-functional-text", {
|
|
641
810
|
variants: {
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
footer: "h-[16px]"
|
|
811
|
+
color: {},
|
|
812
|
+
disabled: {
|
|
813
|
+
true: "text-functional-disable-text"
|
|
646
814
|
}
|
|
647
|
-
}
|
|
815
|
+
},
|
|
816
|
+
compoundVariants: [
|
|
817
|
+
{
|
|
818
|
+
color: "primary",
|
|
819
|
+
disabled: false,
|
|
820
|
+
className: "text-functional-text"
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
color: "primary",
|
|
824
|
+
disabled: true,
|
|
825
|
+
className: "text-functional-disable-text"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
color: "primary-dark",
|
|
829
|
+
disabled: false,
|
|
830
|
+
className: "font-semibold text-functional-text"
|
|
831
|
+
},
|
|
832
|
+
{
|
|
833
|
+
color: "primary-dark",
|
|
834
|
+
disabled: true,
|
|
835
|
+
className: "font-semibold text-functional-disable-text"
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
color: "secondary",
|
|
839
|
+
disabled: false,
|
|
840
|
+
className: "text-functional-text"
|
|
841
|
+
},
|
|
842
|
+
{
|
|
843
|
+
color: "secondary",
|
|
844
|
+
disabled: true,
|
|
845
|
+
className: "text-functional-disable-text"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
color: "secondary-dark",
|
|
849
|
+
disabled: false,
|
|
850
|
+
className: "font-semibold text-functional-text"
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
color: "secondary-dark",
|
|
854
|
+
disabled: true,
|
|
855
|
+
className: "font-semibold text-functional-disable-text"
|
|
856
|
+
}
|
|
857
|
+
]
|
|
648
858
|
});
|
|
649
|
-
var
|
|
650
|
-
|
|
651
|
-
|
|
859
|
+
var CubeCheckboxSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex gap-x-2", children: [
|
|
860
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "size-5" }),
|
|
861
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-5 w-[152px]" })
|
|
862
|
+
] });
|
|
863
|
+
var CubeCheckboxGrid = (props) => {
|
|
864
|
+
const { children, className: classNameProp, direction } = props;
|
|
865
|
+
const className = tailwindMerge.twMerge(
|
|
866
|
+
direction === "vertical" ? "flex flex-col gap-y-3" : "grid grid-cols-[repeat(auto-fill,180px)] gap-x-4 gap-y-6",
|
|
867
|
+
classNameProp
|
|
868
|
+
);
|
|
869
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
|
|
652
870
|
};
|
|
653
|
-
var
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
871
|
+
var CubeCheckbox = (props) => {
|
|
872
|
+
const {
|
|
873
|
+
containerClassName,
|
|
874
|
+
color = "primary",
|
|
875
|
+
label: label6,
|
|
876
|
+
labelSize = "md",
|
|
877
|
+
labelClassName,
|
|
878
|
+
id,
|
|
879
|
+
defaultChecked = false,
|
|
880
|
+
checked: controlledChecked,
|
|
881
|
+
onChange: onControlledCheckedChange,
|
|
882
|
+
disabled,
|
|
883
|
+
isLoading = false,
|
|
884
|
+
ref,
|
|
885
|
+
...restProps
|
|
886
|
+
} = props;
|
|
887
|
+
const [uncontrolledChecked, setUncontrolledChecked] = react.useState(defaultChecked);
|
|
888
|
+
const isControlled = controlledChecked !== void 0;
|
|
889
|
+
const effectiveChecked = isControlled ? controlledChecked : uncontrolledChecked;
|
|
890
|
+
const isIndeterminate = effectiveChecked === null;
|
|
891
|
+
const handleChange = (event) => {
|
|
892
|
+
if (!isControlled) {
|
|
893
|
+
setUncontrolledChecked(event.target.checked);
|
|
894
|
+
}
|
|
895
|
+
onControlledCheckedChange?.(event);
|
|
896
|
+
};
|
|
897
|
+
const renderIcon = () => {
|
|
898
|
+
const IconComponent = (() => {
|
|
899
|
+
if (isIndeterminate) return CheckboxUndeterminateFilled_default;
|
|
900
|
+
return effectiveChecked ? CheckboxCheckedFilled_default : Checkbox_default;
|
|
901
|
+
})();
|
|
902
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
903
|
+
"div",
|
|
904
|
+
{
|
|
905
|
+
className: tailwindMerge.twMerge(
|
|
906
|
+
iconWrap({
|
|
907
|
+
color,
|
|
908
|
+
isSelected: effectiveChecked || isIndeterminate,
|
|
909
|
+
disabled
|
|
910
|
+
})
|
|
911
|
+
),
|
|
912
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "icon-md" })
|
|
913
|
+
}
|
|
914
|
+
);
|
|
915
|
+
};
|
|
916
|
+
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeCheckboxSkeleton, {});
|
|
917
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
918
|
+
"label",
|
|
919
|
+
{
|
|
920
|
+
htmlFor: id,
|
|
921
|
+
className: tailwindMerge.twMerge(
|
|
922
|
+
container({ labelSize, disabled }),
|
|
923
|
+
containerClassName
|
|
924
|
+
),
|
|
925
|
+
children: [
|
|
676
926
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
677
|
-
"
|
|
927
|
+
"input",
|
|
678
928
|
{
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
929
|
+
...restProps,
|
|
930
|
+
id,
|
|
931
|
+
ref,
|
|
932
|
+
type: "checkbox",
|
|
933
|
+
checked: effectiveChecked ?? false,
|
|
934
|
+
onChange: handleChange,
|
|
935
|
+
disabled,
|
|
936
|
+
className: "peer hidden"
|
|
682
937
|
}
|
|
683
938
|
),
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
939
|
+
renderIcon(),
|
|
940
|
+
label6 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
941
|
+
"span",
|
|
942
|
+
{
|
|
943
|
+
className: tailwindMerge.twMerge(label({ color, disabled }), labelClassName),
|
|
944
|
+
children: label6
|
|
945
|
+
}
|
|
946
|
+
)
|
|
947
|
+
]
|
|
948
|
+
}
|
|
949
|
+
);
|
|
950
|
+
};
|
|
951
|
+
CubeCheckbox.Skeleton = CubeCheckboxSkeleton;
|
|
952
|
+
CubeCheckbox.Grid = CubeCheckboxGrid;
|
|
953
|
+
var UseFloatingExternalContext = react.createContext({});
|
|
954
|
+
|
|
955
|
+
// src/internals/utils/floating/splitPlacements.ts
|
|
956
|
+
var splitPlacements = (placement) => {
|
|
957
|
+
const [verticalPlacement, ...horizontalPlacementParts] = placement.split("-");
|
|
958
|
+
const horizontalPlacement = horizontalPlacementParts.join("-");
|
|
959
|
+
return [verticalPlacement, horizontalPlacement];
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
// src/internals/utils/floating/autoPlacement/computeIdealPlacement.ts
|
|
963
|
+
var computeIdealPlacement = (placement, overflowPx) => {
|
|
964
|
+
const [vertical, horizontal] = splitPlacements(placement);
|
|
965
|
+
let newVertical = vertical;
|
|
966
|
+
let newHorizontal = horizontal;
|
|
967
|
+
if (shouldFlipVertically(vertical, overflowPx)) {
|
|
968
|
+
newVertical = flipVerticalPlacement(vertical);
|
|
969
|
+
}
|
|
970
|
+
if (horizontal !== "follow-cursor") {
|
|
971
|
+
if (overflowPx.left > 0) {
|
|
972
|
+
newHorizontal = "left";
|
|
973
|
+
} else if (overflowPx.right > 0) {
|
|
974
|
+
newHorizontal = "right";
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
return `${newVertical}-${newHorizontal}`;
|
|
978
|
+
};
|
|
979
|
+
var shouldFlipVertically = (verticalPlacement, overflowPx) => {
|
|
980
|
+
return verticalPlacement === "top" && overflowPx.top > 0 || verticalPlacement === "bottom" && overflowPx.bottom > 0;
|
|
981
|
+
};
|
|
982
|
+
var flipVerticalPlacement = (verticalPlacement) => {
|
|
983
|
+
const flippedMap = {
|
|
984
|
+
top: "bottom",
|
|
985
|
+
bottom: "top"
|
|
986
|
+
};
|
|
987
|
+
return flippedMap[verticalPlacement];
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
// src/internals/utils/floating/rect/computeXBound.ts
|
|
991
|
+
var computeXBound = (anchorDomRect, elementWidth, horizontalPlacement, xOffset, mouseX) => {
|
|
992
|
+
const fn = computeFn[horizontalPlacement];
|
|
993
|
+
return fn(anchorDomRect, elementWidth, xOffset, mouseX);
|
|
994
|
+
};
|
|
995
|
+
var computeFn = {
|
|
996
|
+
left: (anchorDomRect, elementWidth, xOffset) => {
|
|
997
|
+
const left = anchorDomRect.left - xOffset;
|
|
998
|
+
return {
|
|
999
|
+
left,
|
|
1000
|
+
right: left + elementWidth
|
|
687
1001
|
};
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
if (!hasIcon) return null;
|
|
695
|
-
return react.cloneElement(trailingIcon, {
|
|
696
|
-
className: tailwindMerge.twMerge(
|
|
697
|
-
trailingIcon.props.className,
|
|
698
|
-
// Overrides icon size, color, and cursor style within the input.
|
|
699
|
-
customIcon({ disabled })
|
|
700
|
-
)
|
|
701
|
-
});
|
|
702
|
-
})();
|
|
703
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "absolute right-0 flex h-4 shrink-0 -translate-x-4 items-center justify-center gap-2 overflow-hidden", children: [
|
|
704
|
-
errorIcon,
|
|
705
|
-
customIcon2
|
|
706
|
-
] });
|
|
1002
|
+
},
|
|
1003
|
+
center: (anchorDomRect, elementWidth) => {
|
|
1004
|
+
const left = anchorDomRect.left + anchorDomRect.width / 2 - elementWidth / 2;
|
|
1005
|
+
return {
|
|
1006
|
+
left,
|
|
1007
|
+
right: left + elementWidth
|
|
707
1008
|
};
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
id: inputId,
|
|
715
|
-
ref,
|
|
716
|
-
disabled,
|
|
717
|
-
className: tailwindMerge.twMerge(input({ isError, disabled, hasIcon }), className),
|
|
718
|
-
required
|
|
719
|
-
}
|
|
720
|
-
);
|
|
1009
|
+
},
|
|
1010
|
+
right: (anchorDomRect, elementWidth, xOffset) => {
|
|
1011
|
+
const right = anchorDomRect.right + xOffset;
|
|
1012
|
+
return {
|
|
1013
|
+
left: right - elementWidth,
|
|
1014
|
+
right
|
|
721
1015
|
};
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
1016
|
+
},
|
|
1017
|
+
"follow-cursor": (_anchorDomRect, elementWidth, _xOffset, mouseX) => {
|
|
1018
|
+
const left = mouseX - elementWidth / 2;
|
|
1019
|
+
return {
|
|
1020
|
+
left,
|
|
1021
|
+
right: left + elementWidth
|
|
726
1022
|
};
|
|
727
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-[202px] space-y-[6px]", children: [
|
|
728
|
-
renderLabel(),
|
|
729
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
|
|
730
|
-
renderInput(),
|
|
731
|
-
renderIcon()
|
|
732
|
-
] }),
|
|
733
|
-
renderFooter()
|
|
734
|
-
] });
|
|
735
1023
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
const
|
|
741
|
-
|
|
742
|
-
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
// src/internals/utils/floating/rect/computeYBound.ts
|
|
1027
|
+
var computeYBound = (anchorDomRect, elementHeight, verticalPlacement, yOffset) => {
|
|
1028
|
+
const fn = computeFn2[verticalPlacement];
|
|
1029
|
+
return fn(anchorDomRect, elementHeight, yOffset);
|
|
1030
|
+
};
|
|
1031
|
+
var computeFn2 = {
|
|
1032
|
+
top: (anchorDomRect, elementHeight, yOffset) => {
|
|
1033
|
+
const bottom = anchorDomRect.top - yOffset;
|
|
1034
|
+
return {
|
|
1035
|
+
top: bottom - elementHeight,
|
|
1036
|
+
bottom
|
|
1037
|
+
};
|
|
1038
|
+
},
|
|
1039
|
+
bottom: (anchorDomRect, elementHeight, yOffset) => {
|
|
1040
|
+
const top = anchorDomRect.bottom + yOffset;
|
|
1041
|
+
return {
|
|
1042
|
+
top,
|
|
1043
|
+
bottom: top + elementHeight
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
};
|
|
1047
|
+
|
|
1048
|
+
// src/internals/utils/floating/rect/computeFloatingBoundary.ts
|
|
1049
|
+
var computeFloatingBoundary = (anchorDomRect, elementSize, placement, offsets, mouseX) => {
|
|
1050
|
+
const [verticalPlacement, horizontalPlacement] = splitPlacements(placement);
|
|
1051
|
+
const xBound = computeXBound(
|
|
1052
|
+
anchorDomRect,
|
|
1053
|
+
elementSize.width,
|
|
1054
|
+
horizontalPlacement,
|
|
1055
|
+
offsets?.x ?? 0,
|
|
1056
|
+
mouseX ?? 0
|
|
1057
|
+
);
|
|
1058
|
+
const yBound = computeYBound(
|
|
1059
|
+
anchorDomRect,
|
|
1060
|
+
elementSize.height,
|
|
1061
|
+
verticalPlacement,
|
|
1062
|
+
offsets?.y ?? 0
|
|
1063
|
+
);
|
|
1064
|
+
return {
|
|
1065
|
+
...xBound,
|
|
1066
|
+
...yBound
|
|
743
1067
|
};
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
1068
|
+
};
|
|
1069
|
+
|
|
1070
|
+
// src/internals/utils/floating/rect/computeTranslateX.ts
|
|
1071
|
+
var computeTranslateX = (placement, overflowPx) => {
|
|
1072
|
+
const [, horizontalPlacement] = splitPlacements(placement);
|
|
1073
|
+
if (horizontalPlacement !== "follow-cursor") return 0;
|
|
1074
|
+
if (overflowPx.left > 0) {
|
|
1075
|
+
return overflowPx.left;
|
|
1076
|
+
}
|
|
1077
|
+
if (overflowPx.right > 0) {
|
|
1078
|
+
return -1 * overflowPx.right;
|
|
1079
|
+
}
|
|
1080
|
+
return 0;
|
|
1081
|
+
};
|
|
1082
|
+
|
|
1083
|
+
// src/internals/utils/floating/rect/FloatingRect.ts
|
|
1084
|
+
var FloatingRect = class {
|
|
1085
|
+
_anchorDomRect;
|
|
1086
|
+
_size;
|
|
1087
|
+
_originalPlacement;
|
|
1088
|
+
_offsets = void 0;
|
|
1089
|
+
_mouseX = 0;
|
|
1090
|
+
constructor(args) {
|
|
1091
|
+
const { anchorDomRect, size, placement, offsets, mouseX } = args;
|
|
1092
|
+
this._anchorDomRect = anchorDomRect;
|
|
1093
|
+
this._size = size;
|
|
1094
|
+
this._originalPlacement = placement;
|
|
1095
|
+
this._offsets = offsets;
|
|
1096
|
+
this._mouseX = mouseX ?? 0;
|
|
1097
|
+
}
|
|
1098
|
+
resolveStyles() {
|
|
1099
|
+
const floatingBoundary = computeFloatingBoundary(
|
|
1100
|
+
this._anchorDomRect,
|
|
1101
|
+
this._size,
|
|
1102
|
+
this._originalPlacement,
|
|
1103
|
+
this._offsets,
|
|
1104
|
+
this._mouseX
|
|
1105
|
+
);
|
|
1106
|
+
let finalBoundary = { ...floatingBoundary };
|
|
1107
|
+
const overflowPx = this.computeOverflowPx(floatingBoundary);
|
|
1108
|
+
const idealPlacement = computeIdealPlacement(
|
|
1109
|
+
this._originalPlacement,
|
|
1110
|
+
overflowPx
|
|
1111
|
+
);
|
|
1112
|
+
if (idealPlacement !== this._originalPlacement) {
|
|
1113
|
+
finalBoundary = computeFloatingBoundary(
|
|
1114
|
+
this._anchorDomRect,
|
|
1115
|
+
this._size,
|
|
1116
|
+
idealPlacement,
|
|
1117
|
+
this._offsets,
|
|
1118
|
+
this._mouseX
|
|
1119
|
+
);
|
|
1120
|
+
}
|
|
1121
|
+
const translateX = computeTranslateX(idealPlacement, overflowPx);
|
|
1122
|
+
const floatingStyle = {
|
|
1123
|
+
position: "absolute",
|
|
1124
|
+
// Convert the position from viewport-relative coordinates to document-relative coordinates.
|
|
1125
|
+
top: finalBoundary.top + window.scrollY,
|
|
1126
|
+
left: finalBoundary.left + window.scrollX + translateX
|
|
1127
|
+
};
|
|
1128
|
+
return {
|
|
1129
|
+
idealPlacement,
|
|
1130
|
+
floatingStyle,
|
|
1131
|
+
translateX
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
computeOverflowPx(floatingBoundary) {
|
|
1135
|
+
const { top, left } = floatingBoundary;
|
|
1136
|
+
const { clientWidth, clientHeight } = document.documentElement;
|
|
1137
|
+
return {
|
|
1138
|
+
top: top < 0 ? Math.abs(top) : 0,
|
|
1139
|
+
right: Math.max(floatingBoundary.right - clientWidth, 0),
|
|
1140
|
+
bottom: Math.max(floatingBoundary.bottom - clientHeight, 0),
|
|
1141
|
+
left: left < 0 ? Math.abs(left) : 0
|
|
1142
|
+
};
|
|
1143
|
+
}
|
|
1144
|
+
};
|
|
1145
|
+
var isRectEqual = (rectA, rectB) => {
|
|
1146
|
+
if (!rectA && !rectB) return true;
|
|
1147
|
+
if (!!rectA !== !!rectB) return false;
|
|
1148
|
+
const keys = [
|
|
1149
|
+
"top",
|
|
1150
|
+
"right",
|
|
1151
|
+
"bottom",
|
|
1152
|
+
"left",
|
|
1153
|
+
"width",
|
|
1154
|
+
"height",
|
|
1155
|
+
"x",
|
|
1156
|
+
"y"
|
|
1157
|
+
];
|
|
1158
|
+
return keys.every((key) => rectA[key] === rectB[key]);
|
|
1159
|
+
};
|
|
1160
|
+
var useElementDomRect = (elementRef, scrollableRootSelector) => {
|
|
1161
|
+
const [rect, setRect] = react.useState();
|
|
1162
|
+
const getScrollableRoot = react.useCallback(() => {
|
|
1163
|
+
if (scrollableRootSelector) {
|
|
1164
|
+
const element = document.querySelector(scrollableRootSelector);
|
|
1165
|
+
if (!element) {
|
|
1166
|
+
console.warn(
|
|
1167
|
+
`Cannot find element with selector ${scrollableRootSelector}`
|
|
1168
|
+
);
|
|
1169
|
+
}
|
|
1170
|
+
return element;
|
|
1171
|
+
} else {
|
|
1172
|
+
return window;
|
|
752
1173
|
}
|
|
1174
|
+
}, [scrollableRootSelector]);
|
|
1175
|
+
react.useEffect(() => {
|
|
1176
|
+
const syncRect = () => {
|
|
1177
|
+
setRect((prevRect) => {
|
|
1178
|
+
const currentRect = elementRef.current?.getBoundingClientRect();
|
|
1179
|
+
if (isRectEqual(prevRect, currentRect)) return prevRect;
|
|
1180
|
+
return currentRect;
|
|
1181
|
+
});
|
|
1182
|
+
};
|
|
1183
|
+
const debouncedSync = lodash.debounce(syncRect, 100);
|
|
1184
|
+
syncRect();
|
|
1185
|
+
const scrollableRoot = getScrollableRoot();
|
|
1186
|
+
scrollableRoot?.addEventListener("scroll", debouncedSync);
|
|
1187
|
+
scrollableRoot?.addEventListener("resize", debouncedSync);
|
|
1188
|
+
const intervalId = setInterval(() => {
|
|
1189
|
+
syncRect();
|
|
1190
|
+
}, 250);
|
|
1191
|
+
return () => {
|
|
1192
|
+
scrollableRoot?.removeEventListener("scroll", debouncedSync);
|
|
1193
|
+
scrollableRoot?.removeEventListener("resize", debouncedSync);
|
|
1194
|
+
clearInterval(intervalId);
|
|
1195
|
+
};
|
|
1196
|
+
}, [elementRef, getScrollableRoot]);
|
|
1197
|
+
return rect;
|
|
1198
|
+
};
|
|
1199
|
+
|
|
1200
|
+
// src/internals/utils/floating/useFloating.ts
|
|
1201
|
+
var createInvisibleFloatingStyles = (originalPlacement) => ({
|
|
1202
|
+
idealPlacement: originalPlacement,
|
|
1203
|
+
floatingStyle: {
|
|
1204
|
+
position: "absolute",
|
|
1205
|
+
visibility: "hidden",
|
|
1206
|
+
top: "-9999px",
|
|
1207
|
+
left: "-9999px"
|
|
1208
|
+
},
|
|
1209
|
+
translateX: 0
|
|
1210
|
+
});
|
|
1211
|
+
var useFloating = (options) => {
|
|
1212
|
+
const {
|
|
1213
|
+
isOpen,
|
|
1214
|
+
anchorRef: anchorRefOption,
|
|
1215
|
+
placement,
|
|
1216
|
+
offsets,
|
|
1217
|
+
mouseX = 0
|
|
1218
|
+
} = options;
|
|
1219
|
+
const anchorRef = react.useRef(null);
|
|
1220
|
+
const elementRef = react.useRef(null);
|
|
1221
|
+
const { scrollableRootSelector } = react.useContext(UseFloatingExternalContext);
|
|
1222
|
+
const anchorRect = useElementDomRect(
|
|
1223
|
+
anchorRefOption ?? anchorRef,
|
|
1224
|
+
scrollableRootSelector
|
|
753
1225
|
);
|
|
1226
|
+
const elementRect = useElementDomRect(elementRef, scrollableRootSelector);
|
|
1227
|
+
const resolvedStyles = react.useMemo(() => {
|
|
1228
|
+
if (!anchorRect || !elementRect) return void 0;
|
|
1229
|
+
if (!isOpen) return createInvisibleFloatingStyles(placement);
|
|
1230
|
+
const floatingRect = new FloatingRect({
|
|
1231
|
+
anchorDomRect: anchorRect,
|
|
1232
|
+
size: {
|
|
1233
|
+
width: elementRect.width,
|
|
1234
|
+
height: elementRect.height
|
|
1235
|
+
},
|
|
1236
|
+
placement,
|
|
1237
|
+
offsets,
|
|
1238
|
+
mouseX
|
|
1239
|
+
});
|
|
1240
|
+
return floatingRect.resolveStyles();
|
|
1241
|
+
}, [isOpen, anchorRect, elementRect, placement, offsets, mouseX]);
|
|
1242
|
+
return {
|
|
1243
|
+
anchorRef,
|
|
1244
|
+
elementRef,
|
|
1245
|
+
resolvedStyles
|
|
1246
|
+
};
|
|
754
1247
|
};
|
|
755
1248
|
|
|
756
1249
|
// src/i18n/resources/en-US.json
|
|
757
1250
|
var en_US_default = {
|
|
758
1251
|
"component.common.loading": "Loading",
|
|
759
|
-
"component.common.noData": "No Data"
|
|
1252
|
+
"component.common.noData": "No Data",
|
|
1253
|
+
"component.dropdown.choose": "Choose",
|
|
1254
|
+
"component.dropdown.all": "All",
|
|
1255
|
+
"component.dropdown.search": "Search",
|
|
1256
|
+
"component.status.host.neutral": "Neutral",
|
|
1257
|
+
"component.status.host.inUse": "In-Use",
|
|
1258
|
+
"component.status.host.finished": "Finished",
|
|
1259
|
+
"component.status.host.ok": "Ok",
|
|
1260
|
+
"component.status.host.success": "Success",
|
|
1261
|
+
"component.status.host.active": "Active",
|
|
1262
|
+
"component.status.host.available": "Available",
|
|
1263
|
+
"component.status.host.poweringOn": "Powering-On",
|
|
1264
|
+
"component.status.host.warning": "Warning",
|
|
1265
|
+
"component.status.host.error": "Error",
|
|
1266
|
+
"component.status.host.fail": "Fail",
|
|
1267
|
+
"component.status.host.failed": "Failed",
|
|
1268
|
+
"component.status.host.stopped": "Stopped",
|
|
1269
|
+
"component.status.host.poweringOff": "Powering-Off",
|
|
1270
|
+
"component.status.reaction.neutral": "Neutral",
|
|
1271
|
+
"component.status.reaction.success": "Success",
|
|
1272
|
+
"component.status.reaction.available": "Available",
|
|
1273
|
+
"component.status.reaction.done": "Done",
|
|
1274
|
+
"component.status.reaction.error": "Error",
|
|
1275
|
+
"component.status.reaction.duplicate": "Duplicate",
|
|
1276
|
+
"component.status.reaction.failed": "Failed"
|
|
760
1277
|
};
|
|
761
1278
|
|
|
762
1279
|
// src/i18n/resources/zh-TW.json
|
|
763
1280
|
var zh_TW_default = {
|
|
764
1281
|
"component.common.loading": "\u8F09\u5165\u4E2D",
|
|
765
|
-
"component.common.noData": "\u6C92\u6709\u8CC7\u6599"
|
|
1282
|
+
"component.common.noData": "\u6C92\u6709\u8CC7\u6599",
|
|
1283
|
+
"component.dropdown.choose": "\u9078\u64C7",
|
|
1284
|
+
"component.dropdown.all": "\u5168\u90E8",
|
|
1285
|
+
"component.dropdown.search": "\u641C\u5C0B",
|
|
1286
|
+
"component.status.host.neutral": "\u4E2D\u6027",
|
|
1287
|
+
"component.status.host.inUse": "\u4F7F\u7528\u4E2D",
|
|
1288
|
+
"component.status.host.finished": "\u5DF2\u5B8C\u6210",
|
|
1289
|
+
"component.status.host.ok": "\u6B63\u5E38",
|
|
1290
|
+
"component.status.host.success": "\u6210\u529F",
|
|
1291
|
+
"component.status.host.active": "\u555F\u7528",
|
|
1292
|
+
"component.status.host.available": "\u53EF\u7528",
|
|
1293
|
+
"component.status.host.poweringOn": "\u555F\u52D5\u4E2D",
|
|
1294
|
+
"component.status.host.warning": "\u8B66\u544A",
|
|
1295
|
+
"component.status.host.error": "\u932F\u8AA4",
|
|
1296
|
+
"component.status.host.fail": "\u5931\u6557",
|
|
1297
|
+
"component.status.host.failed": "\u5DF2\u5931\u6557",
|
|
1298
|
+
"component.status.host.stopped": "\u5DF2\u505C\u6B62",
|
|
1299
|
+
"component.status.host.poweringOff": "\u95DC\u6A5F\u4E2D",
|
|
1300
|
+
"component.status.reaction.neutral": "\u4E2D\u6027",
|
|
1301
|
+
"component.status.reaction.success": "\u6210\u529F",
|
|
1302
|
+
"component.status.reaction.available": "\u53EF\u7528",
|
|
1303
|
+
"component.status.reaction.done": "\u5B8C\u6210",
|
|
1304
|
+
"component.status.reaction.error": "\u932F\u8AA4",
|
|
1305
|
+
"component.status.reaction.duplicate": "\u91CD\u8907",
|
|
1306
|
+
"component.status.reaction.failed": "\u5931\u6557"
|
|
766
1307
|
};
|
|
767
1308
|
|
|
768
1309
|
// src/i18n/i18n.ts
|
|
@@ -781,23 +1322,2779 @@ i18n.use(reactI18next.initReactI18next).init({
|
|
|
781
1322
|
});
|
|
782
1323
|
var i18n_default = i18n;
|
|
783
1324
|
|
|
784
|
-
// src/i18n/
|
|
785
|
-
function addCubeUiTranslations(locale, resources) {
|
|
786
|
-
i18n_default.addResourceBundle(locale, "translation", resources, true, true);
|
|
787
|
-
if (i18n_default.isInitialized) {
|
|
788
|
-
i18n_default.emit("languageChanged", i18n_default.language);
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
var CubeUiLocaleProvider = (props) => {
|
|
792
|
-
const { locale, children } = props;
|
|
793
|
-
react.useEffect(() => {
|
|
794
|
-
i18n_default.changeLanguage(locale);
|
|
795
|
-
}, [locale]);
|
|
796
|
-
return children;
|
|
797
|
-
};
|
|
1325
|
+
// src/i18n/useCubeUiTranslation.ts
|
|
798
1326
|
var useCubeUiTranslation = (ns, options) => {
|
|
799
1327
|
return reactI18next.useTranslation(ns, { ...options, i18n: i18n_default });
|
|
800
1328
|
};
|
|
1329
|
+
var CubeDropdownContext = react.createContext({
|
|
1330
|
+
floatingProps: void 0,
|
|
1331
|
+
dropdownOpen: false,
|
|
1332
|
+
toggleDropdownOpen: () => {
|
|
1333
|
+
},
|
|
1334
|
+
size: "md",
|
|
1335
|
+
type: "radio",
|
|
1336
|
+
variant: "regular",
|
|
1337
|
+
disabled: false,
|
|
1338
|
+
selectedItems: [],
|
|
1339
|
+
enabledItemCount: 0,
|
|
1340
|
+
onAllCheckChange: void 0,
|
|
1341
|
+
onClearSelection: void 0,
|
|
1342
|
+
searchValue: "",
|
|
1343
|
+
handleSearchValueChange: void 0
|
|
1344
|
+
});
|
|
1345
|
+
var label2 = classVarianceAuthority.cva("primary-body3 font-semibold text-functional-title", {
|
|
1346
|
+
variants: {
|
|
1347
|
+
size: {
|
|
1348
|
+
md: "mb-2",
|
|
1349
|
+
sm: "mb-1.5"
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
});
|
|
1353
|
+
var skeletonContainer = classVarianceAuthority.cva("w-full", {
|
|
1354
|
+
variants: {
|
|
1355
|
+
size: {
|
|
1356
|
+
md: "space-y-[8px]",
|
|
1357
|
+
sm: "space-y-[6px]"
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
});
|
|
1361
|
+
var skeletonInput = classVarianceAuthority.cva("w-full", {
|
|
1362
|
+
variants: {
|
|
1363
|
+
size: {
|
|
1364
|
+
md: "h-[38px]",
|
|
1365
|
+
sm: "h-[34px]"
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
});
|
|
1369
|
+
var triggerContainer = classVarianceAuthority.cva(
|
|
1370
|
+
"primary-body3 flex w-full items-center justify-between gap-x-3 rounded-[5px] border",
|
|
1371
|
+
{
|
|
1372
|
+
variants: {
|
|
1373
|
+
size: {
|
|
1374
|
+
md: "h-[38px] min-w-[116px] max-w-[360px] px-4 py-[10px]",
|
|
1375
|
+
sm: "h-[34px] min-w-[80px] max-w-[240px] px-3 py-2"
|
|
1376
|
+
},
|
|
1377
|
+
variant: {
|
|
1378
|
+
regular: "",
|
|
1379
|
+
withFilter: ""
|
|
1380
|
+
},
|
|
1381
|
+
dropdownOpen: {
|
|
1382
|
+
true: "",
|
|
1383
|
+
false: ""
|
|
1384
|
+
},
|
|
1385
|
+
isSelected: {
|
|
1386
|
+
true: "",
|
|
1387
|
+
false: ""
|
|
1388
|
+
},
|
|
1389
|
+
disabled: {
|
|
1390
|
+
true: "",
|
|
1391
|
+
false: ""
|
|
1392
|
+
}
|
|
1393
|
+
},
|
|
1394
|
+
compoundVariants: [
|
|
1395
|
+
// Regular Dropdown
|
|
1396
|
+
{
|
|
1397
|
+
variant: "regular",
|
|
1398
|
+
dropdownOpen: false,
|
|
1399
|
+
isSelected: false,
|
|
1400
|
+
disabled: false,
|
|
1401
|
+
class: [
|
|
1402
|
+
"hover:border-functional-hover-primary",
|
|
1403
|
+
"border-functional-border-divider",
|
|
1404
|
+
"text-functional-text-light",
|
|
1405
|
+
"bg-white"
|
|
1406
|
+
]
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
variant: "regular",
|
|
1410
|
+
dropdownOpen: false,
|
|
1411
|
+
isSelected: true,
|
|
1412
|
+
disabled: false,
|
|
1413
|
+
class: [
|
|
1414
|
+
"hover:border-functional-hover-primary",
|
|
1415
|
+
"border-functional-border-divider",
|
|
1416
|
+
"text-functional-text",
|
|
1417
|
+
"bg-white"
|
|
1418
|
+
]
|
|
1419
|
+
},
|
|
1420
|
+
{
|
|
1421
|
+
variant: "regular",
|
|
1422
|
+
dropdownOpen: false,
|
|
1423
|
+
isSelected: false,
|
|
1424
|
+
disabled: true,
|
|
1425
|
+
class: [
|
|
1426
|
+
"hover:border-functional-border-divider",
|
|
1427
|
+
"border-functional-border-divider",
|
|
1428
|
+
"text-functional-disable-text",
|
|
1429
|
+
"bg-white"
|
|
1430
|
+
]
|
|
1431
|
+
},
|
|
1432
|
+
{
|
|
1433
|
+
variant: "regular",
|
|
1434
|
+
dropdownOpen: false,
|
|
1435
|
+
isSelected: true,
|
|
1436
|
+
disabled: true,
|
|
1437
|
+
class: [
|
|
1438
|
+
"hover:border-functional-border-divider",
|
|
1439
|
+
"border-functional-border-divider",
|
|
1440
|
+
"text-functional-disable-text",
|
|
1441
|
+
"bg-white"
|
|
1442
|
+
]
|
|
1443
|
+
},
|
|
1444
|
+
{
|
|
1445
|
+
variant: "regular",
|
|
1446
|
+
dropdownOpen: true,
|
|
1447
|
+
isSelected: false,
|
|
1448
|
+
disabled: false,
|
|
1449
|
+
class: [
|
|
1450
|
+
"border-functional-hover-primary",
|
|
1451
|
+
"text-functional-text-light",
|
|
1452
|
+
"bg-white"
|
|
1453
|
+
]
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
variant: "regular",
|
|
1457
|
+
dropdownOpen: true,
|
|
1458
|
+
isSelected: true,
|
|
1459
|
+
disabled: false,
|
|
1460
|
+
class: [
|
|
1461
|
+
"border-functional-hover-primary",
|
|
1462
|
+
"text-functional-text",
|
|
1463
|
+
"bg-white"
|
|
1464
|
+
]
|
|
1465
|
+
},
|
|
1466
|
+
// Dropdown with filter
|
|
1467
|
+
{
|
|
1468
|
+
variant: "withFilter",
|
|
1469
|
+
isSelected: false,
|
|
1470
|
+
disabled: false,
|
|
1471
|
+
class: [
|
|
1472
|
+
"hover:border-blue-700",
|
|
1473
|
+
"border-blue-700",
|
|
1474
|
+
"text-functional-text",
|
|
1475
|
+
"bg-white"
|
|
1476
|
+
]
|
|
1477
|
+
},
|
|
1478
|
+
{
|
|
1479
|
+
variant: "withFilter",
|
|
1480
|
+
isSelected: true,
|
|
1481
|
+
disabled: false,
|
|
1482
|
+
class: [
|
|
1483
|
+
"hover:border-blue-800 hover:bg-secondary-100",
|
|
1484
|
+
"border-blue-700",
|
|
1485
|
+
"text-blue-850",
|
|
1486
|
+
"bg-secondary-50"
|
|
1487
|
+
]
|
|
1488
|
+
},
|
|
1489
|
+
{
|
|
1490
|
+
variant: "withFilter",
|
|
1491
|
+
isSelected: false,
|
|
1492
|
+
disabled: true,
|
|
1493
|
+
class: [
|
|
1494
|
+
"hover:border-blue-200",
|
|
1495
|
+
"border-blue-200",
|
|
1496
|
+
"text-functional-disable-text",
|
|
1497
|
+
"bg-white"
|
|
1498
|
+
]
|
|
1499
|
+
},
|
|
1500
|
+
{
|
|
1501
|
+
variant: "withFilter",
|
|
1502
|
+
isSelected: true,
|
|
1503
|
+
disabled: true,
|
|
1504
|
+
class: [
|
|
1505
|
+
"hover:border-blue-200",
|
|
1506
|
+
"border-blue-200",
|
|
1507
|
+
"text-functional-disable-text",
|
|
1508
|
+
"bg-secondary-0"
|
|
1509
|
+
]
|
|
1510
|
+
}
|
|
1511
|
+
]
|
|
1512
|
+
}
|
|
1513
|
+
);
|
|
1514
|
+
var triggerIcon = classVarianceAuthority.cva("icon-md shrink-0 transition-transform", {
|
|
1515
|
+
variants: {
|
|
1516
|
+
dropdownOpen: {
|
|
1517
|
+
true: "rotate-180",
|
|
1518
|
+
false: "rotate-0"
|
|
1519
|
+
},
|
|
1520
|
+
disabled: {
|
|
1521
|
+
true: "text-functional-disable-text",
|
|
1522
|
+
false: "text-functional-text"
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
});
|
|
1526
|
+
var triggerCount = classVarianceAuthority.cva("primary-body3", {
|
|
1527
|
+
variants: {
|
|
1528
|
+
variant: {
|
|
1529
|
+
regular: "",
|
|
1530
|
+
withFilter: ""
|
|
1531
|
+
},
|
|
1532
|
+
disabled: {
|
|
1533
|
+
true: "",
|
|
1534
|
+
false: ""
|
|
1535
|
+
}
|
|
1536
|
+
},
|
|
1537
|
+
compoundVariants: [
|
|
1538
|
+
{
|
|
1539
|
+
variant: "regular",
|
|
1540
|
+
disabled: true,
|
|
1541
|
+
class: "text-functional-disable-text"
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
variant: "regular",
|
|
1545
|
+
disabled: false,
|
|
1546
|
+
class: "text-functional-text-light"
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
variant: "withFilter",
|
|
1550
|
+
disabled: true,
|
|
1551
|
+
class: "text-functional-disable-text"
|
|
1552
|
+
},
|
|
1553
|
+
{ variant: "withFilter", disabled: false, class: "text-blue-850" }
|
|
1554
|
+
]
|
|
1555
|
+
});
|
|
1556
|
+
var triggerClearButton = classVarianceAuthority.cva("icon-md text-functional-text-light", {
|
|
1557
|
+
variants: {
|
|
1558
|
+
disabled: {
|
|
1559
|
+
true: "hidden"
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
});
|
|
1563
|
+
var menu = classVarianceAuthority.cva(
|
|
1564
|
+
[
|
|
1565
|
+
"z-10 overflow-y-auto rounded-[5px] border bg-white py-2",
|
|
1566
|
+
"shadow-[0_0_2px_0_rgba(0,0,0,0.2)]"
|
|
1567
|
+
],
|
|
1568
|
+
{
|
|
1569
|
+
variants: {
|
|
1570
|
+
size: {
|
|
1571
|
+
md: "max-h-[442px] min-w-[116px] max-w-[360px]",
|
|
1572
|
+
sm: "max-h-[390px] min-w-[80px] max-w-[240px]"
|
|
1573
|
+
},
|
|
1574
|
+
dropdownOpen: { false: "invisible" }
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
);
|
|
1578
|
+
var filterContainer = classVarianceAuthority.cva("relative flex shrink-0 items-center", {
|
|
1579
|
+
variants: {
|
|
1580
|
+
size: {
|
|
1581
|
+
md: "",
|
|
1582
|
+
sm: ""
|
|
1583
|
+
},
|
|
1584
|
+
type: {
|
|
1585
|
+
radio: "",
|
|
1586
|
+
checkbox: ""
|
|
1587
|
+
}
|
|
1588
|
+
},
|
|
1589
|
+
compoundVariants: [
|
|
1590
|
+
{ size: "md", type: "radio", class: "px-[24px] py-[10px]" },
|
|
1591
|
+
{ size: "md", type: "checkbox", class: "px-[22px] py-[11px]" },
|
|
1592
|
+
{ size: "sm", type: "radio", class: "px-[24px] py-[9px]" },
|
|
1593
|
+
{ size: "sm", type: "checkbox", class: "px-[16px] py-[9.5px]" }
|
|
1594
|
+
]
|
|
1595
|
+
});
|
|
1596
|
+
var filterInput = classVarianceAuthority.cva([
|
|
1597
|
+
"primary-body2 w-full rounded-[5px] px-4 py-[7px] outline-none",
|
|
1598
|
+
"bg-secondary-0 text-functional-text placeholder:text-functional-text-light"
|
|
1599
|
+
]);
|
|
1600
|
+
var filterIcon = classVarianceAuthority.cva(
|
|
1601
|
+
"icon-md absolute shrink-0 text-functional-text",
|
|
1602
|
+
{
|
|
1603
|
+
variants: {
|
|
1604
|
+
size: {
|
|
1605
|
+
md: "",
|
|
1606
|
+
sm: ""
|
|
1607
|
+
},
|
|
1608
|
+
type: {
|
|
1609
|
+
radio: "",
|
|
1610
|
+
checkbox: ""
|
|
1611
|
+
}
|
|
1612
|
+
},
|
|
1613
|
+
compoundVariants: [
|
|
1614
|
+
{ size: "md", type: "radio", class: "right-[40px]" },
|
|
1615
|
+
{ size: "md", type: "checkbox", class: "right-[38px]" },
|
|
1616
|
+
{ size: "sm", type: "radio", class: "right-[40px]" },
|
|
1617
|
+
{ size: "sm", type: "checkbox", class: "right-[32px]" }
|
|
1618
|
+
]
|
|
1619
|
+
}
|
|
1620
|
+
);
|
|
1621
|
+
var itemRadio = classVarianceAuthority.cva(
|
|
1622
|
+
"cursor-pointer truncate text-functional-text hover:bg-functional-hover-grey",
|
|
1623
|
+
{
|
|
1624
|
+
variants: {
|
|
1625
|
+
size: {
|
|
1626
|
+
md: "primary-body3",
|
|
1627
|
+
sm: "primary-body4"
|
|
1628
|
+
},
|
|
1629
|
+
variant: {
|
|
1630
|
+
regular: "",
|
|
1631
|
+
withFilter: ""
|
|
1632
|
+
},
|
|
1633
|
+
isSelected: {
|
|
1634
|
+
true: "font-semibold"
|
|
1635
|
+
},
|
|
1636
|
+
disabled: {
|
|
1637
|
+
true: "cursor-default text-functional-disable-text hover:bg-white"
|
|
1638
|
+
}
|
|
1639
|
+
},
|
|
1640
|
+
compoundVariants: [
|
|
1641
|
+
{ size: "md", variant: "regular", class: "px-[24px] py-[10px]" },
|
|
1642
|
+
{ size: "md", variant: "withFilter", class: "px-[24px] py-[10px]" },
|
|
1643
|
+
{ size: "sm", variant: "regular", class: "px-[24px] py-[9px]" },
|
|
1644
|
+
{ size: "sm", variant: "withFilter", class: "px-[24px] py-[9px]" }
|
|
1645
|
+
]
|
|
1646
|
+
}
|
|
1647
|
+
);
|
|
1648
|
+
var itemCheckbox = classVarianceAuthority.cva(
|
|
1649
|
+
"truncate text-functional-text hover:bg-functional-hover-grey",
|
|
1650
|
+
{
|
|
1651
|
+
variants: {
|
|
1652
|
+
size: {
|
|
1653
|
+
md: "primary-body3",
|
|
1654
|
+
sm: "primary-body4"
|
|
1655
|
+
},
|
|
1656
|
+
variant: {
|
|
1657
|
+
regular: "",
|
|
1658
|
+
withFilter: ""
|
|
1659
|
+
},
|
|
1660
|
+
isSelected: {
|
|
1661
|
+
true: "font-semibold"
|
|
1662
|
+
},
|
|
1663
|
+
disabled: {
|
|
1664
|
+
true: "cursor-default text-functional-disable-text hover:bg-white"
|
|
1665
|
+
}
|
|
1666
|
+
},
|
|
1667
|
+
compoundVariants: [
|
|
1668
|
+
{ size: "md", variant: "regular", class: "px-[22px] py-[11px]" },
|
|
1669
|
+
{ size: "md", variant: "withFilter", class: "px-[22px] py-[11px]" },
|
|
1670
|
+
{ size: "sm", variant: "regular", class: "px-[16px] py-[9.5px]" },
|
|
1671
|
+
{ size: "sm", variant: "withFilter", class: "px-[16px] py-[9.5px]" }
|
|
1672
|
+
]
|
|
1673
|
+
}
|
|
1674
|
+
);
|
|
1675
|
+
var itemNoData = classVarianceAuthority.cva("text-functional-text", {
|
|
1676
|
+
variants: {
|
|
1677
|
+
size: {
|
|
1678
|
+
md: "primary-body3",
|
|
1679
|
+
sm: "primary-body4"
|
|
1680
|
+
},
|
|
1681
|
+
type: {
|
|
1682
|
+
radio: "",
|
|
1683
|
+
checkbox: ""
|
|
1684
|
+
}
|
|
1685
|
+
},
|
|
1686
|
+
compoundVariants: [
|
|
1687
|
+
{ size: "md", type: "radio", class: "px-[24px] py-[10px]" },
|
|
1688
|
+
{ size: "md", type: "checkbox", class: "px-[22px] py-[11px]" },
|
|
1689
|
+
{ size: "sm", type: "radio", class: "px-[24px] py-[9px]" },
|
|
1690
|
+
{ size: "sm", type: "checkbox", class: "px-[16px] py-[9.5px]" }
|
|
1691
|
+
]
|
|
1692
|
+
});
|
|
1693
|
+
var CubeDropdownTrigger = (props) => {
|
|
1694
|
+
const { children, placeholder, className } = props;
|
|
1695
|
+
const {
|
|
1696
|
+
dropdownOpen,
|
|
1697
|
+
toggleDropdownOpen,
|
|
1698
|
+
floatingProps,
|
|
1699
|
+
size,
|
|
1700
|
+
type,
|
|
1701
|
+
variant,
|
|
1702
|
+
selectedItems,
|
|
1703
|
+
disabled,
|
|
1704
|
+
onClearSelection
|
|
1705
|
+
} = react.useContext(CubeDropdownContext);
|
|
1706
|
+
const { t } = useCubeUiTranslation();
|
|
1707
|
+
const isSelected = selectedItems.length > 0;
|
|
1708
|
+
const placeholderText = placeholder ?? t("component.dropdown.choose");
|
|
1709
|
+
const displayText = isSelected ? children : placeholderText;
|
|
1710
|
+
const renderSelectedItemCount = () => {
|
|
1711
|
+
if (type === "radio" || !isSelected) return null;
|
|
1712
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { className: triggerCount({ variant, disabled }), children: `(${selectedItems.length})` });
|
|
1713
|
+
};
|
|
1714
|
+
const renderClearButton = () => {
|
|
1715
|
+
const handleClearClick = (e) => {
|
|
1716
|
+
e.stopPropagation();
|
|
1717
|
+
onClearSelection?.();
|
|
1718
|
+
};
|
|
1719
|
+
if (type === "checkbox" && variant === "withFilter" && isSelected)
|
|
1720
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1721
|
+
XSmall_default,
|
|
1722
|
+
{
|
|
1723
|
+
className: tailwindMerge.twMerge(triggerClearButton({ disabled })),
|
|
1724
|
+
onClick: (e) => handleClearClick(e)
|
|
1725
|
+
}
|
|
1726
|
+
);
|
|
1727
|
+
return null;
|
|
1728
|
+
};
|
|
1729
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1730
|
+
"button",
|
|
1731
|
+
{
|
|
1732
|
+
ref: floatingProps.anchorRef,
|
|
1733
|
+
type: "button",
|
|
1734
|
+
disabled,
|
|
1735
|
+
onClick: toggleDropdownOpen,
|
|
1736
|
+
className: tailwindMerge.twMerge(
|
|
1737
|
+
triggerContainer({
|
|
1738
|
+
size,
|
|
1739
|
+
variant,
|
|
1740
|
+
dropdownOpen,
|
|
1741
|
+
isSelected,
|
|
1742
|
+
disabled
|
|
1743
|
+
}),
|
|
1744
|
+
className
|
|
1745
|
+
),
|
|
1746
|
+
children: [
|
|
1747
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-full truncate text-left", children: displayText }),
|
|
1748
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex shrink-0 items-center gap-2", children: [
|
|
1749
|
+
renderSelectedItemCount(),
|
|
1750
|
+
renderClearButton(),
|
|
1751
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1752
|
+
ChevronDown_default,
|
|
1753
|
+
{
|
|
1754
|
+
className: tailwindMerge.twMerge(triggerIcon({ dropdownOpen, disabled }))
|
|
1755
|
+
}
|
|
1756
|
+
)
|
|
1757
|
+
] })
|
|
1758
|
+
]
|
|
1759
|
+
}
|
|
1760
|
+
);
|
|
1761
|
+
};
|
|
1762
|
+
var ItemCheckbox = (props) => {
|
|
1763
|
+
const {
|
|
1764
|
+
isDark = false,
|
|
1765
|
+
size,
|
|
1766
|
+
variant,
|
|
1767
|
+
label: label6,
|
|
1768
|
+
onClick,
|
|
1769
|
+
isSelected,
|
|
1770
|
+
disabled
|
|
1771
|
+
} = props;
|
|
1772
|
+
const getColor = () => {
|
|
1773
|
+
if (variant === "regular") {
|
|
1774
|
+
return isDark ? "primary-dark" : "primary";
|
|
1775
|
+
} else {
|
|
1776
|
+
return isDark ? "secondary-dark" : "secondary";
|
|
1777
|
+
}
|
|
1778
|
+
};
|
|
1779
|
+
const getLabelSize = () => {
|
|
1780
|
+
return size === "md" ? "sm" : "xs";
|
|
1781
|
+
};
|
|
1782
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1783
|
+
"div",
|
|
1784
|
+
{
|
|
1785
|
+
className: tailwindMerge.twMerge(itemCheckbox({ size, variant, isSelected, disabled })),
|
|
1786
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1787
|
+
CubeCheckbox,
|
|
1788
|
+
{
|
|
1789
|
+
label: label6,
|
|
1790
|
+
labelClassName: "truncate",
|
|
1791
|
+
disabled,
|
|
1792
|
+
checked: isSelected,
|
|
1793
|
+
onChange: onClick,
|
|
1794
|
+
color: getColor(),
|
|
1795
|
+
labelSize: getLabelSize()
|
|
1796
|
+
}
|
|
1797
|
+
)
|
|
1798
|
+
}
|
|
1799
|
+
);
|
|
1800
|
+
};
|
|
1801
|
+
var ItemNoData = (props) => {
|
|
1802
|
+
const { size, type } = props;
|
|
1803
|
+
const { t } = useCubeUiTranslation();
|
|
1804
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge(itemNoData({ size, type })), children: t("component.common.noData") });
|
|
1805
|
+
};
|
|
1806
|
+
var CubeDropdownFilter = () => {
|
|
1807
|
+
const { size, type, searchValue, handleSearchValueChange } = react.useContext(CubeDropdownContext);
|
|
1808
|
+
const { t } = useCubeUiTranslation();
|
|
1809
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tailwindMerge.twMerge(filterContainer({ size, type })), children: [
|
|
1810
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1811
|
+
"input",
|
|
1812
|
+
{
|
|
1813
|
+
type: "text",
|
|
1814
|
+
className: tailwindMerge.twMerge(filterInput()),
|
|
1815
|
+
placeholder: t("component.dropdown.search"),
|
|
1816
|
+
value: searchValue,
|
|
1817
|
+
onChange: handleSearchValueChange
|
|
1818
|
+
}
|
|
1819
|
+
),
|
|
1820
|
+
/* @__PURE__ */ jsxRuntime.jsx(Search_default, { className: tailwindMerge.twMerge(filterIcon({ size, type })) })
|
|
1821
|
+
] });
|
|
1822
|
+
};
|
|
1823
|
+
var ItemRadio = (props) => {
|
|
1824
|
+
const { size, variant, label: label6, onClick, isSelected, disabled } = props;
|
|
1825
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1826
|
+
"div",
|
|
1827
|
+
{
|
|
1828
|
+
className: tailwindMerge.twMerge(itemRadio({ size, variant, isSelected, disabled })),
|
|
1829
|
+
onClick,
|
|
1830
|
+
children: label6
|
|
1831
|
+
}
|
|
1832
|
+
);
|
|
1833
|
+
};
|
|
1834
|
+
var CubeDropdownItem = (props) => {
|
|
1835
|
+
const {
|
|
1836
|
+
children: label6,
|
|
1837
|
+
item,
|
|
1838
|
+
disabled = false,
|
|
1839
|
+
onClick: onClickProp
|
|
1840
|
+
} = props;
|
|
1841
|
+
const { size, type, variant, selectedItems, toggleDropdownOpen } = react.useContext(CubeDropdownContext);
|
|
1842
|
+
const isSelected = selectedItems.includes(item);
|
|
1843
|
+
const onClick = () => {
|
|
1844
|
+
if (disabled) return;
|
|
1845
|
+
onClickProp();
|
|
1846
|
+
if (type === "radio") toggleDropdownOpen();
|
|
1847
|
+
};
|
|
1848
|
+
if (type === "checkbox")
|
|
1849
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1850
|
+
ItemCheckbox,
|
|
1851
|
+
{
|
|
1852
|
+
size,
|
|
1853
|
+
variant,
|
|
1854
|
+
label: label6,
|
|
1855
|
+
isSelected,
|
|
1856
|
+
disabled,
|
|
1857
|
+
onClick
|
|
1858
|
+
}
|
|
1859
|
+
);
|
|
1860
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1861
|
+
ItemRadio,
|
|
1862
|
+
{
|
|
1863
|
+
size,
|
|
1864
|
+
variant,
|
|
1865
|
+
label: label6,
|
|
1866
|
+
isSelected,
|
|
1867
|
+
disabled,
|
|
1868
|
+
onClick
|
|
1869
|
+
}
|
|
1870
|
+
);
|
|
1871
|
+
};
|
|
1872
|
+
|
|
1873
|
+
// src/components/CubeDropdown/cubeDropdownUtils.ts
|
|
1874
|
+
var getOptionalProps = (props) => {
|
|
1875
|
+
return {
|
|
1876
|
+
onAllCheckChange: props.type === "checkbox" ? props.onAllCheckChange : void 0,
|
|
1877
|
+
onClearSelection: props.type === "checkbox" && props.variant === "withFilter" ? props.onClearSelection : void 0
|
|
1878
|
+
};
|
|
1879
|
+
};
|
|
1880
|
+
var checkIsCubeDropdownItemElement = (child) => react.isValidElement(child) && child.type === CubeDropdownItem;
|
|
1881
|
+
var CubeDropdownMenu = (props) => {
|
|
1882
|
+
const { children, className } = props;
|
|
1883
|
+
const {
|
|
1884
|
+
floatingProps,
|
|
1885
|
+
dropdownOpen,
|
|
1886
|
+
size,
|
|
1887
|
+
variant,
|
|
1888
|
+
type,
|
|
1889
|
+
onAllCheckChange,
|
|
1890
|
+
selectedItems,
|
|
1891
|
+
enabledItemCount,
|
|
1892
|
+
searchValue
|
|
1893
|
+
} = react.useContext(CubeDropdownContext);
|
|
1894
|
+
const { t } = useCubeUiTranslation();
|
|
1895
|
+
const { elementRef, resolvedStyles } = floatingProps;
|
|
1896
|
+
const isAllSelected = react.useMemo(() => {
|
|
1897
|
+
return selectedItems.length === enabledItemCount;
|
|
1898
|
+
}, [selectedItems.length, enabledItemCount]);
|
|
1899
|
+
const onAllClick = react.useCallback(() => {
|
|
1900
|
+
onAllCheckChange?.(!isAllSelected);
|
|
1901
|
+
}, [isAllSelected, onAllCheckChange]);
|
|
1902
|
+
const renderFilter = () => {
|
|
1903
|
+
if (variant === "regular") return null;
|
|
1904
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CubeDropdownFilter, {});
|
|
1905
|
+
};
|
|
1906
|
+
const renderSelectAllCheckbox = () => {
|
|
1907
|
+
if (type === "radio" || searchValue || !children) return null;
|
|
1908
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1909
|
+
ItemCheckbox,
|
|
1910
|
+
{
|
|
1911
|
+
isDark: true,
|
|
1912
|
+
size,
|
|
1913
|
+
variant,
|
|
1914
|
+
label: t("component.dropdown.all"),
|
|
1915
|
+
onClick: onAllClick,
|
|
1916
|
+
isSelected: isAllSelected,
|
|
1917
|
+
disabled: false
|
|
1918
|
+
}
|
|
1919
|
+
);
|
|
1920
|
+
};
|
|
1921
|
+
const renderMenuItems = () => {
|
|
1922
|
+
const allItems = react.Children.toArray(children).filter(
|
|
1923
|
+
checkIsCubeDropdownItemElement
|
|
1924
|
+
);
|
|
1925
|
+
const visibleItems = variant !== "withFilter" || !searchValue ? allItems : allItems.filter(
|
|
1926
|
+
(child) => child.props.children.toLowerCase().includes(searchValue.toLowerCase())
|
|
1927
|
+
);
|
|
1928
|
+
if (visibleItems.length === 0) {
|
|
1929
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ItemNoData, { size, type });
|
|
1930
|
+
}
|
|
1931
|
+
return visibleItems;
|
|
1932
|
+
};
|
|
1933
|
+
return reactDom.createPortal(
|
|
1934
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1935
|
+
"div",
|
|
1936
|
+
{
|
|
1937
|
+
ref: elementRef,
|
|
1938
|
+
className: tailwindMerge.twMerge(menu({ size, dropdownOpen }), className),
|
|
1939
|
+
style: resolvedStyles?.floatingStyle,
|
|
1940
|
+
children: [
|
|
1941
|
+
renderFilter(),
|
|
1942
|
+
renderSelectAllCheckbox(),
|
|
1943
|
+
renderMenuItems()
|
|
1944
|
+
]
|
|
1945
|
+
}
|
|
1946
|
+
),
|
|
1947
|
+
document.body
|
|
1948
|
+
);
|
|
1949
|
+
};
|
|
1950
|
+
var CubeDropdownSkeleton = (props) => {
|
|
1951
|
+
const { className, size, hasLabel } = props;
|
|
1952
|
+
const renderLabelSkeleton = () => {
|
|
1953
|
+
return hasLabel ? /* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-[18px] w-full" }) : null;
|
|
1954
|
+
};
|
|
1955
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tailwindMerge.twMerge(skeletonContainer({ size }), className), children: [
|
|
1956
|
+
renderLabelSkeleton(),
|
|
1957
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: tailwindMerge.twMerge(skeletonInput({ size })) })
|
|
1958
|
+
] });
|
|
1959
|
+
};
|
|
1960
|
+
var parseNodes = (node) => {
|
|
1961
|
+
const payload = {
|
|
1962
|
+
triggerNode: void 0,
|
|
1963
|
+
menuNode: void 0,
|
|
1964
|
+
enabledItemCount: 0
|
|
1965
|
+
};
|
|
1966
|
+
react.Children.toArray(node).forEach((child) => {
|
|
1967
|
+
if (!react.isValidElement(child)) {
|
|
1968
|
+
return;
|
|
1969
|
+
}
|
|
1970
|
+
if (child.type === CubeDropdownTrigger) {
|
|
1971
|
+
assignTriggerNode(payload, child);
|
|
1972
|
+
} else if (child.type === CubeDropdownMenu) {
|
|
1973
|
+
assignMenuNode(payload, child);
|
|
1974
|
+
}
|
|
1975
|
+
});
|
|
1976
|
+
return payload;
|
|
1977
|
+
};
|
|
1978
|
+
var assignTriggerNode = (payload, value) => {
|
|
1979
|
+
if (payload.triggerNode) {
|
|
1980
|
+
console.warn(
|
|
1981
|
+
"Found multiple trigger nodes. Only one trigger node is allowed in a CubeDropdown."
|
|
1982
|
+
);
|
|
1983
|
+
} else {
|
|
1984
|
+
payload.triggerNode = value;
|
|
1985
|
+
}
|
|
1986
|
+
};
|
|
1987
|
+
var assignMenuNode = (payload, value) => {
|
|
1988
|
+
if (payload.menuNode) {
|
|
1989
|
+
console.warn(
|
|
1990
|
+
"Found multiple menu nodes. Only one menu node is allowed in a CubeDropdown."
|
|
1991
|
+
);
|
|
1992
|
+
} else {
|
|
1993
|
+
payload.menuNode = value;
|
|
1994
|
+
payload.enabledItemCount = computeEnabledItemCount(
|
|
1995
|
+
react.Children.toArray(value.props.children)
|
|
1996
|
+
);
|
|
1997
|
+
}
|
|
1998
|
+
};
|
|
1999
|
+
var computeEnabledItemCount = (menuChildren) => {
|
|
2000
|
+
const enabledItems = menuChildren.filter((child) => {
|
|
2001
|
+
if (!react.isValidElement(child) || child.type !== CubeDropdownItem) {
|
|
2002
|
+
console.warn(
|
|
2003
|
+
"The children of CubeDropdown.Menu can only be CubeDropdown.Item, but found: ",
|
|
2004
|
+
child
|
|
2005
|
+
);
|
|
2006
|
+
return false;
|
|
2007
|
+
}
|
|
2008
|
+
const itemProps = child.props;
|
|
2009
|
+
return !itemProps.disabled;
|
|
2010
|
+
});
|
|
2011
|
+
return enabledItems.length;
|
|
2012
|
+
};
|
|
2013
|
+
var CubeDropdown = (props) => {
|
|
2014
|
+
const {
|
|
2015
|
+
size = "md",
|
|
2016
|
+
type,
|
|
2017
|
+
variant = "regular",
|
|
2018
|
+
selectedItems,
|
|
2019
|
+
isLoading = false,
|
|
2020
|
+
disabled = false,
|
|
2021
|
+
label: label6,
|
|
2022
|
+
skeletonClassName,
|
|
2023
|
+
children
|
|
2024
|
+
} = props;
|
|
2025
|
+
const optionalProps = getOptionalProps(props);
|
|
2026
|
+
const [dropdownOpen, setDropdownOpen] = react.useState(false);
|
|
2027
|
+
const [searchValue, setSearchValue] = react.useState("");
|
|
2028
|
+
const toggleDropdownOpen = () => {
|
|
2029
|
+
setDropdownOpen((prev) => !prev);
|
|
2030
|
+
};
|
|
2031
|
+
const handleSearchValueChange = (e) => {
|
|
2032
|
+
setSearchValue(e.target.value);
|
|
2033
|
+
};
|
|
2034
|
+
const floatingProps = useFloating({
|
|
2035
|
+
isOpen: dropdownOpen,
|
|
2036
|
+
placement: "bottom-left",
|
|
2037
|
+
offsets: {
|
|
2038
|
+
y: 8
|
|
2039
|
+
}
|
|
2040
|
+
});
|
|
2041
|
+
const { anchorRef, elementRef } = floatingProps;
|
|
2042
|
+
const { triggerNode, menuNode, enabledItemCount } = parseNodes(children);
|
|
2043
|
+
const handleClickOutside = react.useCallback(
|
|
2044
|
+
(event) => {
|
|
2045
|
+
const target = event.target;
|
|
2046
|
+
const isTrigger = anchorRef.current?.contains(target);
|
|
2047
|
+
const isMenu = elementRef.current?.contains(target);
|
|
2048
|
+
if (!isTrigger && !isMenu) {
|
|
2049
|
+
setDropdownOpen(false);
|
|
2050
|
+
}
|
|
2051
|
+
},
|
|
2052
|
+
[anchorRef, elementRef]
|
|
2053
|
+
);
|
|
2054
|
+
react.useEffect(() => {
|
|
2055
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2056
|
+
return () => {
|
|
2057
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
2058
|
+
};
|
|
2059
|
+
}, [handleClickOutside]);
|
|
2060
|
+
const renderLabel = () => {
|
|
2061
|
+
if (!label6) return null;
|
|
2062
|
+
return /* @__PURE__ */ jsxRuntime.jsx("p", { className: tailwindMerge.twMerge(label2({ size })), children: label6 });
|
|
2063
|
+
};
|
|
2064
|
+
if (isLoading) {
|
|
2065
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2066
|
+
CubeDropdownSkeleton,
|
|
2067
|
+
{
|
|
2068
|
+
className: skeletonClassName,
|
|
2069
|
+
size,
|
|
2070
|
+
hasLabel: !!label6
|
|
2071
|
+
}
|
|
2072
|
+
);
|
|
2073
|
+
}
|
|
2074
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2075
|
+
CubeDropdownContext.Provider,
|
|
2076
|
+
{
|
|
2077
|
+
value: {
|
|
2078
|
+
floatingProps,
|
|
2079
|
+
dropdownOpen,
|
|
2080
|
+
toggleDropdownOpen,
|
|
2081
|
+
size,
|
|
2082
|
+
type,
|
|
2083
|
+
variant,
|
|
2084
|
+
disabled,
|
|
2085
|
+
selectedItems,
|
|
2086
|
+
enabledItemCount,
|
|
2087
|
+
onAllCheckChange: optionalProps.onAllCheckChange,
|
|
2088
|
+
onClearSelection: optionalProps.onClearSelection,
|
|
2089
|
+
searchValue,
|
|
2090
|
+
handleSearchValueChange
|
|
2091
|
+
},
|
|
2092
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
2093
|
+
renderLabel(),
|
|
2094
|
+
triggerNode,
|
|
2095
|
+
menuNode
|
|
2096
|
+
] })
|
|
2097
|
+
}
|
|
2098
|
+
);
|
|
2099
|
+
};
|
|
2100
|
+
CubeDropdown.Trigger = CubeDropdownTrigger;
|
|
2101
|
+
CubeDropdown.Menu = CubeDropdownMenu;
|
|
2102
|
+
CubeDropdown.Item = CubeDropdownItem;
|
|
2103
|
+
var hyperlink = classVarianceAuthority.cva(
|
|
2104
|
+
["flex cursor-pointer items-center gap-x-1 font-medium"],
|
|
2105
|
+
{
|
|
2106
|
+
variants: {
|
|
2107
|
+
color: {
|
|
2108
|
+
primary: [
|
|
2109
|
+
"text-primary",
|
|
2110
|
+
"hover:text-functional-hover-primary",
|
|
2111
|
+
"visited:text-primary-700"
|
|
2112
|
+
],
|
|
2113
|
+
secondary: [
|
|
2114
|
+
"text-functional-border-darker",
|
|
2115
|
+
"hover:text-functional-text-light",
|
|
2116
|
+
"visited:text-functional-border-darker"
|
|
2117
|
+
]
|
|
2118
|
+
},
|
|
2119
|
+
size: {
|
|
2120
|
+
md: "primary-body2",
|
|
2121
|
+
sm: "primary-body4"
|
|
2122
|
+
},
|
|
2123
|
+
variant: {
|
|
2124
|
+
"text-only": "",
|
|
2125
|
+
"text-inline": "underline underline-offset-4",
|
|
2126
|
+
"icon-left": "",
|
|
2127
|
+
"icon-right": ""
|
|
2128
|
+
},
|
|
2129
|
+
disabled: {
|
|
2130
|
+
true: "text-functional-disable-text hover:cursor-default hover:text-functional-disable-text"
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
);
|
|
2135
|
+
var sizeMapping = {
|
|
2136
|
+
sm: { iconSize: "sm", iconFrameSize: "size-[15px]" },
|
|
2137
|
+
md: { iconSize: "md-sm", iconFrameSize: "size-[17px]" }
|
|
2138
|
+
};
|
|
2139
|
+
var CubeHyperlink = (props) => {
|
|
2140
|
+
const {
|
|
2141
|
+
className: classNameProps,
|
|
2142
|
+
color = "primary",
|
|
2143
|
+
size = "md",
|
|
2144
|
+
variant = "text-only",
|
|
2145
|
+
disabled = false,
|
|
2146
|
+
children,
|
|
2147
|
+
href,
|
|
2148
|
+
target,
|
|
2149
|
+
onClick
|
|
2150
|
+
} = props;
|
|
2151
|
+
if (!href && !onClick) {
|
|
2152
|
+
console.warn(
|
|
2153
|
+
"CubeHyperlink: href or onClick must be provided to make the hyperlink interactive"
|
|
2154
|
+
);
|
|
2155
|
+
}
|
|
2156
|
+
const handleClick = (e) => {
|
|
2157
|
+
if (disabled) return;
|
|
2158
|
+
onClick?.(e);
|
|
2159
|
+
};
|
|
2160
|
+
const renderIcon = (iconVariant) => {
|
|
2161
|
+
if (props.variant !== iconVariant) {
|
|
2162
|
+
return null;
|
|
2163
|
+
}
|
|
2164
|
+
const { Icon } = props;
|
|
2165
|
+
const { iconSize, iconFrameSize } = sizeMapping[size];
|
|
2166
|
+
const iconSizeClass = getIconSizeClass(iconSize);
|
|
2167
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2168
|
+
"div",
|
|
2169
|
+
{
|
|
2170
|
+
className: tailwindMerge.twMerge("flex items-center justify-center", iconFrameSize),
|
|
2171
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: iconSizeClass })
|
|
2172
|
+
}
|
|
2173
|
+
);
|
|
2174
|
+
};
|
|
2175
|
+
const renderHyperlink = () => {
|
|
2176
|
+
const hyperlinkType = !disabled && href ? "a" : "div";
|
|
2177
|
+
const hrefAttribute = hyperlinkType === "a" ? href : void 0;
|
|
2178
|
+
const targetAttribute = hyperlinkType === "a" ? target : void 0;
|
|
2179
|
+
return react.createElement(
|
|
2180
|
+
hyperlinkType,
|
|
2181
|
+
{
|
|
2182
|
+
className: tailwindMerge.twMerge(
|
|
2183
|
+
hyperlink({ color, size, variant, disabled }),
|
|
2184
|
+
classNameProps
|
|
2185
|
+
),
|
|
2186
|
+
href: hrefAttribute,
|
|
2187
|
+
target: targetAttribute,
|
|
2188
|
+
onClick: handleClick
|
|
2189
|
+
},
|
|
2190
|
+
renderIcon("icon-left"),
|
|
2191
|
+
children,
|
|
2192
|
+
renderIcon("icon-right")
|
|
2193
|
+
);
|
|
2194
|
+
};
|
|
2195
|
+
return renderHyperlink();
|
|
2196
|
+
};
|
|
2197
|
+
var CubeIconFrame = (props) => {
|
|
2198
|
+
const { className: classNameProps, size = "md", children, onClick } = props;
|
|
2199
|
+
const containerClasses = getContainerClasses(size, classNameProps);
|
|
2200
|
+
const iconClasses = getIconClasses(size, children.props.className);
|
|
2201
|
+
const icon = react.cloneElement(children, { className: iconClasses });
|
|
2202
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: containerClasses, onClick, children: icon });
|
|
2203
|
+
};
|
|
2204
|
+
var input = classVarianceAuthority.cva(
|
|
2205
|
+
[
|
|
2206
|
+
"primary-body2 w-full truncate rounded-[6px] py-[9px] outline-none",
|
|
2207
|
+
"bg-grey-0",
|
|
2208
|
+
"text-functional-text placeholder:text-functional-border-darker",
|
|
2209
|
+
"border border-functional-border-divider",
|
|
2210
|
+
"hover:border-functional-hover-primary focus:border-functional-hover-primary"
|
|
2211
|
+
],
|
|
2212
|
+
{
|
|
2213
|
+
variants: {
|
|
2214
|
+
isError: {
|
|
2215
|
+
true: [
|
|
2216
|
+
"pl-4 pr-8",
|
|
2217
|
+
"border-status-negative hover:border-status-negative"
|
|
2218
|
+
]
|
|
2219
|
+
},
|
|
2220
|
+
disabled: {
|
|
2221
|
+
true: [
|
|
2222
|
+
"disabled:border-functional-disable-text disabled:text-functional-disable-text disabled:placeholder:text-functional-border-divider",
|
|
2223
|
+
"disabled:hover:border-functional-disable-text"
|
|
2224
|
+
]
|
|
2225
|
+
},
|
|
2226
|
+
hasIcon: {
|
|
2227
|
+
true: "pl-4 pr-8",
|
|
2228
|
+
false: "px-4"
|
|
2229
|
+
}
|
|
2230
|
+
},
|
|
2231
|
+
compoundVariants: [
|
|
2232
|
+
{ isError: true, hasIcon: true, class: "pr-[56px]" },
|
|
2233
|
+
{ isError: true, hasIcon: false, class: "pr-9" }
|
|
2234
|
+
]
|
|
2235
|
+
}
|
|
2236
|
+
);
|
|
2237
|
+
var customIcon = classVarianceAuthority.cva("icon-md", {
|
|
2238
|
+
variants: {
|
|
2239
|
+
disabled: {
|
|
2240
|
+
true: "cursor-default text-functional-border-divider",
|
|
2241
|
+
false: "cursor-pointer text-functional-text"
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
});
|
|
2245
|
+
var footer = classVarianceAuthority.cva("primary-body4", {
|
|
2246
|
+
variants: {
|
|
2247
|
+
isError: {
|
|
2248
|
+
true: "text-status-negative",
|
|
2249
|
+
false: "text-functional-text-light"
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
});
|
|
2253
|
+
var skeleton = classVarianceAuthority.cva("w-full", {
|
|
2254
|
+
variants: {
|
|
2255
|
+
type: {
|
|
2256
|
+
label: "h-[20px]",
|
|
2257
|
+
input: "h-[38px]",
|
|
2258
|
+
footer: "h-[16px]"
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
});
|
|
2262
|
+
var CubeInputSkeleton = (props) => {
|
|
2263
|
+
const { type } = props;
|
|
2264
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: skeleton({ type }) });
|
|
2265
|
+
};
|
|
2266
|
+
var CubeInput = Object.assign(
|
|
2267
|
+
react.forwardRef((props, ref) => {
|
|
2268
|
+
const {
|
|
2269
|
+
className,
|
|
2270
|
+
required = false,
|
|
2271
|
+
isLoading = false,
|
|
2272
|
+
label: label6,
|
|
2273
|
+
tooltip,
|
|
2274
|
+
helpMessage,
|
|
2275
|
+
errorMessage,
|
|
2276
|
+
trailingIcon,
|
|
2277
|
+
disabled,
|
|
2278
|
+
...restProps
|
|
2279
|
+
} = props;
|
|
2280
|
+
const defaultId = react.useId();
|
|
2281
|
+
const inputId = restProps.id || defaultId;
|
|
2282
|
+
const isError = !!errorMessage && typeof errorMessage === "string";
|
|
2283
|
+
const hasFooter = !!helpMessage || isError;
|
|
2284
|
+
const hasIcon = !!trailingIcon;
|
|
2285
|
+
const renderLabel = () => {
|
|
2286
|
+
if (!label6 && !tooltip) return null;
|
|
2287
|
+
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeInputSkeleton, { type: "label" });
|
|
2288
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "primary-body2 flex items-center space-x-1", children: [
|
|
2289
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2290
|
+
"label",
|
|
2291
|
+
{
|
|
2292
|
+
htmlFor: inputId,
|
|
2293
|
+
className: "font-semibold text-functional-title",
|
|
2294
|
+
children: label6
|
|
2295
|
+
}
|
|
2296
|
+
),
|
|
2297
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-status-negative", children: "*" }),
|
|
2298
|
+
tooltip
|
|
2299
|
+
] });
|
|
2300
|
+
};
|
|
2301
|
+
const renderIcon = () => {
|
|
2302
|
+
if (isLoading) return null;
|
|
2303
|
+
const errorIcon = (() => {
|
|
2304
|
+
if (!isError) return null;
|
|
2305
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WarningFilled_default, { className: "icon-md text-status-negative" });
|
|
2306
|
+
})();
|
|
2307
|
+
const customIcon2 = (() => {
|
|
2308
|
+
if (!hasIcon) return null;
|
|
2309
|
+
return react.cloneElement(trailingIcon, {
|
|
2310
|
+
className: tailwindMerge.twMerge(
|
|
2311
|
+
trailingIcon.props.className,
|
|
2312
|
+
// Overrides icon size, color, and cursor style within the input.
|
|
2313
|
+
customIcon({ disabled })
|
|
2314
|
+
)
|
|
2315
|
+
});
|
|
2316
|
+
})();
|
|
2317
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "absolute right-0 flex h-4 shrink-0 -translate-x-4 items-center justify-center gap-2 overflow-hidden", children: [
|
|
2318
|
+
errorIcon,
|
|
2319
|
+
customIcon2
|
|
2320
|
+
] });
|
|
2321
|
+
};
|
|
2322
|
+
const renderInput = () => {
|
|
2323
|
+
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeInputSkeleton, { type: "input" });
|
|
2324
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2325
|
+
"input",
|
|
2326
|
+
{
|
|
2327
|
+
...restProps,
|
|
2328
|
+
id: inputId,
|
|
2329
|
+
ref,
|
|
2330
|
+
disabled,
|
|
2331
|
+
className: tailwindMerge.twMerge(input({ isError, disabled, hasIcon }), className),
|
|
2332
|
+
required
|
|
2333
|
+
}
|
|
2334
|
+
);
|
|
2335
|
+
};
|
|
2336
|
+
const renderFooter = () => {
|
|
2337
|
+
if (!hasFooter) return null;
|
|
2338
|
+
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeInputSkeleton, { type: "footer" });
|
|
2339
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge(footer({ isError })), children: errorMessage ?? helpMessage });
|
|
2340
|
+
};
|
|
2341
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-[202px] space-y-[6px]", children: [
|
|
2342
|
+
renderLabel(),
|
|
2343
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex items-center", children: [
|
|
2344
|
+
renderInput(),
|
|
2345
|
+
renderIcon()
|
|
2346
|
+
] }),
|
|
2347
|
+
renderFooter()
|
|
2348
|
+
] });
|
|
2349
|
+
}),
|
|
2350
|
+
{ Skeleton: CubeInputSkeleton }
|
|
2351
|
+
);
|
|
2352
|
+
CubeInput.displayName = "CubeInput";
|
|
2353
|
+
|
|
2354
|
+
// src/components/CubeTextarea/cubeTextareaUtils.ts
|
|
2355
|
+
var normalizeValue = (value) => {
|
|
2356
|
+
if (typeof value === "string") return value;
|
|
2357
|
+
if (typeof value === "number") return value.toString();
|
|
2358
|
+
if (Array.isArray(value)) return value.join("");
|
|
2359
|
+
return "";
|
|
2360
|
+
};
|
|
2361
|
+
var calculateValueLength = (value) => {
|
|
2362
|
+
const normalizedValue = normalizeValue(value);
|
|
2363
|
+
return normalizedValue.length;
|
|
2364
|
+
};
|
|
2365
|
+
var assignRefValue = (ref, element) => {
|
|
2366
|
+
if (!ref) return;
|
|
2367
|
+
if (typeof ref === "function") {
|
|
2368
|
+
ref(element);
|
|
2369
|
+
} else {
|
|
2370
|
+
ref.current = element;
|
|
2371
|
+
}
|
|
2372
|
+
};
|
|
2373
|
+
var CubeOverflowMenuContext = react.createContext(() => void 0);
|
|
2374
|
+
var CubeOverflowMenuDivider = () => {
|
|
2375
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-2 h-px bg-functional-border-divider" });
|
|
2376
|
+
};
|
|
2377
|
+
|
|
2378
|
+
// src/components/CubeOverflowMenu/cubeOverflowMenuUtils.ts
|
|
2379
|
+
var renderNothing = () => void 0;
|
|
2380
|
+
var CubeOverflowMenuItemLeadingContent = (props) => {
|
|
2381
|
+
const { type } = props;
|
|
2382
|
+
const renderMenuIcon = () => {
|
|
2383
|
+
const { MenuIcon } = props;
|
|
2384
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-[3px] flex size-8 shrink-0 items-center justify-center rounded-[5px] bg-primary-100 p-1 group-[.group]:bg-primary-50", children: /* @__PURE__ */ jsxRuntime.jsx(MenuIcon, { className: "icon-xl text-functional-text group-[.group]:text-functional-disable-text" }) });
|
|
2385
|
+
};
|
|
2386
|
+
const renderCheckmark = () => {
|
|
2387
|
+
const { isChecked } = props;
|
|
2388
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 px-2.5", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2389
|
+
CheckmarkBold_default,
|
|
2390
|
+
{
|
|
2391
|
+
className: tailwindMerge.twMerge(
|
|
2392
|
+
"icon-md text-functional-text group-[.group]:text-functional-disable-text",
|
|
2393
|
+
!isChecked && "invisible"
|
|
2394
|
+
)
|
|
2395
|
+
}
|
|
2396
|
+
) });
|
|
2397
|
+
};
|
|
2398
|
+
const renderCustomLeadingElement = () => {
|
|
2399
|
+
const { element } = props;
|
|
2400
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 px-2.5", children: element });
|
|
2401
|
+
};
|
|
2402
|
+
const renderFnMap = {
|
|
2403
|
+
plain: renderNothing,
|
|
2404
|
+
"menu-icon": renderMenuIcon,
|
|
2405
|
+
"check-mark": renderCheckmark,
|
|
2406
|
+
toggle: renderNothing,
|
|
2407
|
+
"trailing-icon": renderNothing,
|
|
2408
|
+
"custom-leading-element": renderCustomLeadingElement
|
|
2409
|
+
};
|
|
2410
|
+
return !!type && renderFnMap[type]();
|
|
2411
|
+
};
|
|
2412
|
+
var track = classVarianceAuthority.cva(
|
|
2413
|
+
"flex h-[20px] w-9 items-center rounded-full border border-transparent transition-colors",
|
|
2414
|
+
{
|
|
2415
|
+
variants: {
|
|
2416
|
+
checked: {
|
|
2417
|
+
true: "bg-status-positive",
|
|
2418
|
+
false: "bg-functional-disable-text"
|
|
2419
|
+
},
|
|
2420
|
+
disabled: {
|
|
2421
|
+
false: "cursor-pointer",
|
|
2422
|
+
true: "cursor-default"
|
|
2423
|
+
}
|
|
2424
|
+
},
|
|
2425
|
+
compoundVariants: [
|
|
2426
|
+
// Not disabled
|
|
2427
|
+
{
|
|
2428
|
+
checked: true,
|
|
2429
|
+
disabled: false,
|
|
2430
|
+
className: "hover:bg-green-400"
|
|
2431
|
+
},
|
|
2432
|
+
{
|
|
2433
|
+
checked: false,
|
|
2434
|
+
disabled: false,
|
|
2435
|
+
className: "hover:bg-grey-400"
|
|
2436
|
+
},
|
|
2437
|
+
// Disabled
|
|
2438
|
+
{
|
|
2439
|
+
checked: true,
|
|
2440
|
+
disabled: true,
|
|
2441
|
+
className: "border-green-200 bg-green-100"
|
|
2442
|
+
},
|
|
2443
|
+
{
|
|
2444
|
+
checked: false,
|
|
2445
|
+
disabled: true,
|
|
2446
|
+
className: "border-functional-disable bg-grey-150"
|
|
2447
|
+
}
|
|
2448
|
+
]
|
|
2449
|
+
}
|
|
2450
|
+
);
|
|
2451
|
+
var thumb = classVarianceAuthority.cva(
|
|
2452
|
+
"size-[17px] rounded-full bg-grey-0 shadow-md transition-transform",
|
|
2453
|
+
{
|
|
2454
|
+
variants: {
|
|
2455
|
+
checked: {
|
|
2456
|
+
true: "translate-x-4",
|
|
2457
|
+
false: "translate-x-px"
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
);
|
|
2462
|
+
var label3 = classVarianceAuthority.cva("primary-body4 text-functional-text", {
|
|
2463
|
+
variants: {
|
|
2464
|
+
disabled: {
|
|
2465
|
+
false: "cursor-pointer",
|
|
2466
|
+
true: "cursor-default"
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
});
|
|
2470
|
+
var CubeToggle = (props) => {
|
|
2471
|
+
const {
|
|
2472
|
+
className,
|
|
2473
|
+
checked,
|
|
2474
|
+
onCheckedChange,
|
|
2475
|
+
label: label6,
|
|
2476
|
+
disabled = false,
|
|
2477
|
+
"aria-label": ariaLabel
|
|
2478
|
+
} = props;
|
|
2479
|
+
const toggleId = react.useId();
|
|
2480
|
+
const labelId = react.useId();
|
|
2481
|
+
const toggleChecked = () => {
|
|
2482
|
+
if (disabled) return;
|
|
2483
|
+
onCheckedChange(!checked);
|
|
2484
|
+
};
|
|
2485
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tailwindMerge.twMerge("flex items-center gap-x-[6px]", className), children: [
|
|
2486
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2487
|
+
"button",
|
|
2488
|
+
{
|
|
2489
|
+
id: toggleId,
|
|
2490
|
+
type: "button",
|
|
2491
|
+
role: "switch",
|
|
2492
|
+
"aria-checked": checked,
|
|
2493
|
+
"aria-labelledby": label6 ? labelId : void 0,
|
|
2494
|
+
"aria-label": label6 ? void 0 : ariaLabel,
|
|
2495
|
+
className: tailwindMerge.twMerge(track({ checked, disabled })),
|
|
2496
|
+
disabled,
|
|
2497
|
+
onClick: toggleChecked,
|
|
2498
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: thumb({ checked }), "aria-hidden": true })
|
|
2499
|
+
}
|
|
2500
|
+
),
|
|
2501
|
+
label6 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2502
|
+
"label",
|
|
2503
|
+
{
|
|
2504
|
+
id: labelId,
|
|
2505
|
+
htmlFor: toggleId,
|
|
2506
|
+
className: label3({ disabled }),
|
|
2507
|
+
children: label6
|
|
2508
|
+
}
|
|
2509
|
+
)
|
|
2510
|
+
] });
|
|
2511
|
+
};
|
|
2512
|
+
var CubeOverflowMenuItemTrailingContent = (props) => {
|
|
2513
|
+
const { type, title } = props;
|
|
2514
|
+
const renderToggle = () => {
|
|
2515
|
+
const { disabled, checked, onCheckedChange } = props;
|
|
2516
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2517
|
+
CubeToggle,
|
|
2518
|
+
{
|
|
2519
|
+
className: "ml-8 shrink-0",
|
|
2520
|
+
checked,
|
|
2521
|
+
disabled,
|
|
2522
|
+
"aria-label": title,
|
|
2523
|
+
onCheckedChange: (next) => onCheckedChange?.(next)
|
|
2524
|
+
}
|
|
2525
|
+
);
|
|
2526
|
+
};
|
|
2527
|
+
const renderTrailingIcon = () => {
|
|
2528
|
+
const { TrailingIcon } = props;
|
|
2529
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 px-2.5", children: /* @__PURE__ */ jsxRuntime.jsx(TrailingIcon, { className: "icon-md text-functional-text group-[.group]:text-functional-disable-text" }) });
|
|
2530
|
+
};
|
|
2531
|
+
const renderFnMap = {
|
|
2532
|
+
plain: renderNothing,
|
|
2533
|
+
"menu-icon": renderNothing,
|
|
2534
|
+
"check-mark": renderNothing,
|
|
2535
|
+
toggle: renderToggle,
|
|
2536
|
+
"trailing-icon": renderTrailingIcon,
|
|
2537
|
+
"custom-leading-element": renderNothing
|
|
2538
|
+
};
|
|
2539
|
+
return !!type && renderFnMap[type]();
|
|
2540
|
+
};
|
|
2541
|
+
var menu2 = classVarianceAuthority.cva([
|
|
2542
|
+
"z-10",
|
|
2543
|
+
"rounded-[5px] border border-functional-border-divider bg-grey-0 py-2",
|
|
2544
|
+
"shadow-[0px_0px_2px_0px_rgba(0,_0,_0,_0.20)]"
|
|
2545
|
+
]);
|
|
2546
|
+
var itemContainer = classVarianceAuthority.cva(
|
|
2547
|
+
[
|
|
2548
|
+
"flex items-center gap-x-1",
|
|
2549
|
+
"min-w-40 max-w-[360px] px-[22px] py-2",
|
|
2550
|
+
"bg-transparent transition-colors"
|
|
2551
|
+
],
|
|
2552
|
+
{
|
|
2553
|
+
variants: {
|
|
2554
|
+
hasOnClickProp: {
|
|
2555
|
+
true: "cursor-pointer",
|
|
2556
|
+
false: "cursor-default"
|
|
2557
|
+
},
|
|
2558
|
+
withSubtext: {
|
|
2559
|
+
true: "h-[53px]",
|
|
2560
|
+
false: "h-[36ox]"
|
|
2561
|
+
},
|
|
2562
|
+
disabled: {
|
|
2563
|
+
true: "group cursor-default",
|
|
2564
|
+
false: "hover:bg-functional-hover-grey"
|
|
2565
|
+
}
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
);
|
|
2569
|
+
var CubeOverflowMenuItem = (props) => {
|
|
2570
|
+
const { type, title, boldTitle, subText } = props;
|
|
2571
|
+
const closeMenu = react.useContext(CubeOverflowMenuContext);
|
|
2572
|
+
const getIsDisabled = () => {
|
|
2573
|
+
return "disabled" in props && !!props.disabled;
|
|
2574
|
+
};
|
|
2575
|
+
const onClick = () => {
|
|
2576
|
+
if (getIsDisabled()) {
|
|
2577
|
+
return;
|
|
2578
|
+
}
|
|
2579
|
+
if ("onClick" in props) {
|
|
2580
|
+
props.onClick?.();
|
|
2581
|
+
if (type !== "check-mark" && type !== "toggle") {
|
|
2582
|
+
closeMenu();
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
};
|
|
2586
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2587
|
+
"div",
|
|
2588
|
+
{
|
|
2589
|
+
className: tailwindMerge.twMerge(
|
|
2590
|
+
itemContainer({
|
|
2591
|
+
hasOnClickProp: "onClick" in props,
|
|
2592
|
+
withSubtext: !!subText,
|
|
2593
|
+
disabled: getIsDisabled()
|
|
2594
|
+
})
|
|
2595
|
+
),
|
|
2596
|
+
onClick,
|
|
2597
|
+
children: [
|
|
2598
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeOverflowMenuItemLeadingContent, { ...props }),
|
|
2599
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex grow flex-col gap-y-0.5 overflow-hidden", children: [
|
|
2600
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2601
|
+
"div",
|
|
2602
|
+
{
|
|
2603
|
+
className: tailwindMerge.twMerge(
|
|
2604
|
+
"primary-body2 truncate text-functional-title group-[.group]:text-functional-disable-text",
|
|
2605
|
+
boldTitle && "font-semibold"
|
|
2606
|
+
),
|
|
2607
|
+
children: title
|
|
2608
|
+
}
|
|
2609
|
+
),
|
|
2610
|
+
subText && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "primary-body5 truncate text-functional-text-light group-[.group]:text-functional-disable-text", children: subText })
|
|
2611
|
+
] }),
|
|
2612
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeOverflowMenuItemTrailingContent, { ...props })
|
|
2613
|
+
]
|
|
2614
|
+
}
|
|
2615
|
+
);
|
|
2616
|
+
};
|
|
2617
|
+
var CubeOverflowMenuTitle = (props) => {
|
|
2618
|
+
const { children } = props;
|
|
2619
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "primary-body4 truncate px-[22px] pb-1 pt-2 text-functional-text-light", children });
|
|
2620
|
+
};
|
|
2621
|
+
var CubeOverflowMenu = (props) => {
|
|
2622
|
+
const { triggerElement, children } = props;
|
|
2623
|
+
const [isOpen, setIsOpen] = react.useState(false);
|
|
2624
|
+
const { anchorRef, elementRef, resolvedStyles } = useFloating({
|
|
2625
|
+
isOpen,
|
|
2626
|
+
placement: "bottom-left",
|
|
2627
|
+
offsets: {
|
|
2628
|
+
y: 8
|
|
2629
|
+
}
|
|
2630
|
+
});
|
|
2631
|
+
const closeMenu = react.useCallback(() => {
|
|
2632
|
+
setIsOpen(false);
|
|
2633
|
+
}, []);
|
|
2634
|
+
react.useEffect(() => {
|
|
2635
|
+
const onOutsideClick = (e) => {
|
|
2636
|
+
const target = e.target;
|
|
2637
|
+
const isAnchor = anchorRef.current?.contains(target);
|
|
2638
|
+
const isMenu = elementRef.current?.contains(target);
|
|
2639
|
+
if (!isAnchor && !isMenu) {
|
|
2640
|
+
setIsOpen(false);
|
|
2641
|
+
}
|
|
2642
|
+
};
|
|
2643
|
+
window.addEventListener("click", onOutsideClick);
|
|
2644
|
+
return () => {
|
|
2645
|
+
window.removeEventListener("click", onOutsideClick);
|
|
2646
|
+
};
|
|
2647
|
+
}, [anchorRef, elementRef]);
|
|
2648
|
+
const clonedAnchor = react.cloneElement(triggerElement, {
|
|
2649
|
+
ref: (element) => {
|
|
2650
|
+
assignRefValue(triggerElement.props.ref, element);
|
|
2651
|
+
assignRefValue(anchorRef, element);
|
|
2652
|
+
},
|
|
2653
|
+
onClick: (e) => {
|
|
2654
|
+
setIsOpen((prev) => !prev);
|
|
2655
|
+
triggerElement.props.onClick?.(e);
|
|
2656
|
+
}
|
|
2657
|
+
});
|
|
2658
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(CubeOverflowMenuContext.Provider, { value: closeMenu, children: [
|
|
2659
|
+
clonedAnchor,
|
|
2660
|
+
reactDom.createPortal(
|
|
2661
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2662
|
+
"div",
|
|
2663
|
+
{
|
|
2664
|
+
ref: elementRef,
|
|
2665
|
+
className: menu2(),
|
|
2666
|
+
style: resolvedStyles?.floatingStyle,
|
|
2667
|
+
children
|
|
2668
|
+
}
|
|
2669
|
+
),
|
|
2670
|
+
document.body
|
|
2671
|
+
)
|
|
2672
|
+
] });
|
|
2673
|
+
};
|
|
2674
|
+
CubeOverflowMenu.Item = CubeOverflowMenuItem;
|
|
2675
|
+
CubeOverflowMenu.Divider = CubeOverflowMenuDivider;
|
|
2676
|
+
CubeOverflowMenu.Title = CubeOverflowMenuTitle;
|
|
2677
|
+
var CubePasswordInput = (props) => {
|
|
2678
|
+
const { initialShowPassword = false, disabled, ...restProps } = props;
|
|
2679
|
+
const [showPassword, setShowPassword] = react.useState(initialShowPassword);
|
|
2680
|
+
const handleShowHide = () => {
|
|
2681
|
+
setShowPassword((prev) => !prev);
|
|
2682
|
+
};
|
|
2683
|
+
const IconComponent = showPassword ? View_default : ViewOff_default;
|
|
2684
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2685
|
+
CubeInput,
|
|
2686
|
+
{
|
|
2687
|
+
...restProps,
|
|
2688
|
+
type: showPassword ? "text" : "password",
|
|
2689
|
+
disabled,
|
|
2690
|
+
trailingIcon: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { onClick: disabled ? void 0 : handleShowHide })
|
|
2691
|
+
}
|
|
2692
|
+
);
|
|
2693
|
+
};
|
|
2694
|
+
var container2 = classVarianceAuthority.cva(
|
|
2695
|
+
"primary-body2 inline-flex w-fit cursor-pointer items-start gap-x-2",
|
|
2696
|
+
{
|
|
2697
|
+
variants: {
|
|
2698
|
+
disabled: {
|
|
2699
|
+
true: "cursor-default"
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
);
|
|
2704
|
+
var iconWrap2 = classVarianceAuthority.cva(
|
|
2705
|
+
[
|
|
2706
|
+
"shrink-0 p-0.5",
|
|
2707
|
+
"text-functional-border-darker transition-colors duration-100 peer-hover:text-functional-hover-primary"
|
|
2708
|
+
],
|
|
2709
|
+
{
|
|
2710
|
+
variants: {
|
|
2711
|
+
isSelected: {
|
|
2712
|
+
true: "text-primary"
|
|
2713
|
+
},
|
|
2714
|
+
disabled: {
|
|
2715
|
+
true: "text-functional-disable-text peer-hover:text-functional-disable-text"
|
|
2716
|
+
}
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
);
|
|
2720
|
+
var label4 = classVarianceAuthority.cva("max-w-[152px] break-words text-functional-text", {
|
|
2721
|
+
variants: {
|
|
2722
|
+
disabled: {
|
|
2723
|
+
true: "text-functional-disable-text"
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
});
|
|
2727
|
+
var CubeRadioButtonSkeleton = () => {
|
|
2728
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex gap-x-2", children: [
|
|
2729
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "size-5" }),
|
|
2730
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-5 w-[152px]" })
|
|
2731
|
+
] });
|
|
2732
|
+
};
|
|
2733
|
+
var CubeRadioButtonGrid = (props) => {
|
|
2734
|
+
const { children, className: classNameProp, direction } = props;
|
|
2735
|
+
const className = tailwindMerge.twMerge(
|
|
2736
|
+
direction === "vertical" ? "flex flex-col gap-y-3" : "grid grid-cols-[repeat(auto-fill,180px)] gap-x-4 gap-y-6",
|
|
2737
|
+
classNameProp
|
|
2738
|
+
);
|
|
2739
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, children });
|
|
2740
|
+
};
|
|
2741
|
+
var CubeRadioButton = (props) => {
|
|
2742
|
+
const {
|
|
2743
|
+
label: label6,
|
|
2744
|
+
id,
|
|
2745
|
+
ref,
|
|
2746
|
+
defaultChecked = false,
|
|
2747
|
+
checked: controlledChecked,
|
|
2748
|
+
onChange: onControlledCheckedChange,
|
|
2749
|
+
disabled,
|
|
2750
|
+
isLoading = false,
|
|
2751
|
+
...restProps
|
|
2752
|
+
} = props;
|
|
2753
|
+
const [uncontrolledChecked, setUncontrolledChecked] = react.useState(defaultChecked);
|
|
2754
|
+
const isControlled = controlledChecked !== void 0;
|
|
2755
|
+
const effectiveChecked = isControlled ? controlledChecked : uncontrolledChecked;
|
|
2756
|
+
const handleChange = (event) => {
|
|
2757
|
+
if (!isControlled) {
|
|
2758
|
+
setUncontrolledChecked(event.target.checked);
|
|
2759
|
+
}
|
|
2760
|
+
onControlledCheckedChange?.(event);
|
|
2761
|
+
};
|
|
2762
|
+
const renderIcon = () => {
|
|
2763
|
+
const IconComponent = effectiveChecked ? RadioButtonFilled_default : RadioButton_default;
|
|
2764
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2765
|
+
"div",
|
|
2766
|
+
{
|
|
2767
|
+
className: tailwindMerge.twMerge(
|
|
2768
|
+
iconWrap2({ disabled, isSelected: effectiveChecked })
|
|
2769
|
+
),
|
|
2770
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "icon-md" })
|
|
2771
|
+
}
|
|
2772
|
+
);
|
|
2773
|
+
};
|
|
2774
|
+
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeRadioButtonSkeleton, {});
|
|
2775
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor: id, className: tailwindMerge.twMerge(container2({ disabled })), children: [
|
|
2776
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2777
|
+
"input",
|
|
2778
|
+
{
|
|
2779
|
+
...restProps,
|
|
2780
|
+
id,
|
|
2781
|
+
ref,
|
|
2782
|
+
type: "radio",
|
|
2783
|
+
checked: effectiveChecked ?? false,
|
|
2784
|
+
onChange: handleChange,
|
|
2785
|
+
disabled,
|
|
2786
|
+
className: "peer hidden"
|
|
2787
|
+
}
|
|
2788
|
+
),
|
|
2789
|
+
renderIcon(),
|
|
2790
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: tailwindMerge.twMerge(label4({ disabled })), children: label6 })
|
|
2791
|
+
] });
|
|
2792
|
+
};
|
|
2793
|
+
CubeRadioButton.Skeleton = CubeRadioButtonSkeleton;
|
|
2794
|
+
CubeRadioButton.Grid = CubeRadioButtonGrid;
|
|
2795
|
+
|
|
2796
|
+
// src/components/CubeStatus/cubeStatusTypes.ts
|
|
2797
|
+
var cubeStatusNeutralValues = [
|
|
2798
|
+
"neutral",
|
|
2799
|
+
"in-use",
|
|
2800
|
+
"finished"
|
|
2801
|
+
];
|
|
2802
|
+
var cubeStatusSuccessValues = [
|
|
2803
|
+
"ok",
|
|
2804
|
+
"success",
|
|
2805
|
+
"active",
|
|
2806
|
+
"available",
|
|
2807
|
+
"powering on"
|
|
2808
|
+
];
|
|
2809
|
+
var cubeStatusWarningValues = [
|
|
2810
|
+
"warning",
|
|
2811
|
+
"error",
|
|
2812
|
+
"fail",
|
|
2813
|
+
"failed",
|
|
2814
|
+
"stopped",
|
|
2815
|
+
"powering off"
|
|
2816
|
+
];
|
|
2817
|
+
|
|
2818
|
+
// src/components/CubeStatus/cubeStatusUtils.ts
|
|
2819
|
+
var neutralStatusSet = new Set(cubeStatusNeutralValues);
|
|
2820
|
+
var successStatusSet = new Set(cubeStatusSuccessValues);
|
|
2821
|
+
var warningStatusSet = new Set(cubeStatusWarningValues);
|
|
2822
|
+
var computeStatusType = (status2) => {
|
|
2823
|
+
if (neutralStatusSet.has(status2)) {
|
|
2824
|
+
return "neutral";
|
|
2825
|
+
} else if (successStatusSet.has(status2)) {
|
|
2826
|
+
return "success";
|
|
2827
|
+
} else if (warningStatusSet.has(status2)) {
|
|
2828
|
+
return "warning";
|
|
2829
|
+
}
|
|
2830
|
+
return "others";
|
|
2831
|
+
};
|
|
2832
|
+
var formatOtherStatusText = (status2) => {
|
|
2833
|
+
const substrings = status2.split("-").filter((text) => !!text);
|
|
2834
|
+
if (!substrings.length) {
|
|
2835
|
+
return status2;
|
|
2836
|
+
}
|
|
2837
|
+
const [firstSubstring = "", ...otherSubstrings] = substrings;
|
|
2838
|
+
const capitalizedFirstSubstring = firstSubstring.charAt(0).toUpperCase() + firstSubstring.substring(1);
|
|
2839
|
+
return [capitalizedFirstSubstring, ...otherSubstrings].join("-");
|
|
2840
|
+
};
|
|
2841
|
+
var status = classVarianceAuthority.cva(
|
|
2842
|
+
[
|
|
2843
|
+
"flex h-[19px] w-fit cursor-default items-center rounded-[20px] border px-2.5",
|
|
2844
|
+
"secondary-body6 whitespace-nowrap font-semibold"
|
|
2845
|
+
],
|
|
2846
|
+
{
|
|
2847
|
+
variants: {
|
|
2848
|
+
type: {
|
|
2849
|
+
neutral: "border-cosmos-primary text-cosmos-primary",
|
|
2850
|
+
success: "border-status-positive text-status-positive",
|
|
2851
|
+
warning: "border-status-negative text-status-negative",
|
|
2852
|
+
others: "border-functional-text-light text-functional-text-light"
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
}
|
|
2856
|
+
);
|
|
2857
|
+
|
|
2858
|
+
// src/components/CubeStatus/useCubeStatusTranslation.ts
|
|
2859
|
+
var useCubeStatusTranslation = () => {
|
|
2860
|
+
const { t } = useCubeUiTranslation();
|
|
2861
|
+
return {
|
|
2862
|
+
neutral: t("component.status.host.neutral"),
|
|
2863
|
+
"in-use": t("component.status.host.inUse"),
|
|
2864
|
+
finished: t("component.status.host.finished"),
|
|
2865
|
+
ok: t("component.status.host.ok"),
|
|
2866
|
+
success: t("component.status.host.success"),
|
|
2867
|
+
active: t("component.status.host.active"),
|
|
2868
|
+
available: t("component.status.host.available"),
|
|
2869
|
+
"powering on": t("component.status.host.poweringOn"),
|
|
2870
|
+
warning: t("component.status.host.warning"),
|
|
2871
|
+
error: t("component.status.host.error"),
|
|
2872
|
+
fail: t("component.status.host.fail"),
|
|
2873
|
+
failed: t("component.status.host.failed"),
|
|
2874
|
+
stopped: t("component.status.host.stopped"),
|
|
2875
|
+
"powering off": t("component.status.host.poweringOff")
|
|
2876
|
+
};
|
|
2877
|
+
};
|
|
2878
|
+
var CubeStatusSkeleton = () => {
|
|
2879
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-[17px] w-[49px] rounded-[20px]" });
|
|
2880
|
+
};
|
|
2881
|
+
var CubeStatus = (props) => {
|
|
2882
|
+
const { status: status2, message } = props;
|
|
2883
|
+
const type = computeStatusType(status2);
|
|
2884
|
+
const translationMap = useCubeStatusTranslation();
|
|
2885
|
+
const getMessage = () => {
|
|
2886
|
+
if (message) {
|
|
2887
|
+
return message;
|
|
2888
|
+
}
|
|
2889
|
+
if (status2 in translationMap) {
|
|
2890
|
+
return translationMap[status2];
|
|
2891
|
+
}
|
|
2892
|
+
return formatOtherStatusText(status2);
|
|
2893
|
+
};
|
|
2894
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: tailwindMerge.twMerge(status({ type })), children: getMessage() });
|
|
2895
|
+
};
|
|
2896
|
+
CubeStatus.Skeleton = CubeStatusSkeleton;
|
|
2897
|
+
|
|
2898
|
+
// src/components/CubeStatusReaction/cubeStatusReactionTypes.ts
|
|
2899
|
+
var cubeStatusReactionNeutralStatuses = ["neutral"];
|
|
2900
|
+
var cubeStatusReactionSuccessStatuses = [
|
|
2901
|
+
"success",
|
|
2902
|
+
"available",
|
|
2903
|
+
"done"
|
|
2904
|
+
];
|
|
2905
|
+
var cubeStatusReactionWarningStatuses = [
|
|
2906
|
+
"error",
|
|
2907
|
+
"duplicate",
|
|
2908
|
+
"failed"
|
|
2909
|
+
];
|
|
2910
|
+
|
|
2911
|
+
// src/components/CubeStatusReaction/cubeStatusReactionUtils.ts
|
|
2912
|
+
var neutralStatusSet2 = new Set(cubeStatusReactionNeutralStatuses);
|
|
2913
|
+
var successStatusSet2 = new Set(cubeStatusReactionSuccessStatuses);
|
|
2914
|
+
var warningStatusSet2 = new Set(cubeStatusReactionWarningStatuses);
|
|
2915
|
+
var computeStatusType2 = (status2) => {
|
|
2916
|
+
if (neutralStatusSet2.has(status2)) {
|
|
2917
|
+
return "neutral";
|
|
2918
|
+
} else if (successStatusSet2.has(status2)) {
|
|
2919
|
+
return "success";
|
|
2920
|
+
} else if (warningStatusSet2.has(status2)) {
|
|
2921
|
+
return "warning";
|
|
2922
|
+
}
|
|
2923
|
+
throw new Error(`Status ${status2} is not defined in CubeStatusReaction`);
|
|
2924
|
+
};
|
|
2925
|
+
var baseClass = "inline-flex w-fit items-center gap-x-2 px-2 py-[5px]";
|
|
2926
|
+
var statusReaction = classVarianceAuthority.cva(
|
|
2927
|
+
[baseClass, "secondary-body3 whitespace-nowrap font-semibold"],
|
|
2928
|
+
{
|
|
2929
|
+
variants: {
|
|
2930
|
+
type: {
|
|
2931
|
+
neutral: "text-status-neutral",
|
|
2932
|
+
success: "text-status-positive",
|
|
2933
|
+
warning: "text-status-negative"
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
);
|
|
2938
|
+
|
|
2939
|
+
// src/components/CubeStatusReaction/useCubeStatusReactionTranslation.ts
|
|
2940
|
+
var useCubeStatusReactionTranslation = () => {
|
|
2941
|
+
const { t } = useCubeUiTranslation();
|
|
2942
|
+
return {
|
|
2943
|
+
neutral: t("component.status.reaction.neutral"),
|
|
2944
|
+
success: t("component.status.reaction.success"),
|
|
2945
|
+
available: t("component.status.reaction.available"),
|
|
2946
|
+
done: t("component.status.reaction.done"),
|
|
2947
|
+
error: t("component.status.reaction.error"),
|
|
2948
|
+
duplicate: t("component.status.reaction.duplicate"),
|
|
2949
|
+
failed: t("component.status.reaction.failed")
|
|
2950
|
+
};
|
|
2951
|
+
};
|
|
2952
|
+
var CubeStatusReactionSkeleton = () => {
|
|
2953
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: baseClass, children: [
|
|
2954
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "size-4" }),
|
|
2955
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-4 w-11" })
|
|
2956
|
+
] });
|
|
2957
|
+
};
|
|
2958
|
+
var iconMap = {
|
|
2959
|
+
neutral: CheckmarkBold_default,
|
|
2960
|
+
success: CheckmarkCircleFill_default,
|
|
2961
|
+
warning: CrossFill_default
|
|
2962
|
+
};
|
|
2963
|
+
var CubeStatusReaction = (props) => {
|
|
2964
|
+
const { status: status2, message } = props;
|
|
2965
|
+
const type = computeStatusType2(status2);
|
|
2966
|
+
const Icon = iconMap[type];
|
|
2967
|
+
const translationMap = useCubeStatusReactionTranslation();
|
|
2968
|
+
const getMessage = () => {
|
|
2969
|
+
if (message) {
|
|
2970
|
+
return message;
|
|
2971
|
+
}
|
|
2972
|
+
if (status2 in translationMap) {
|
|
2973
|
+
return translationMap[status2];
|
|
2974
|
+
}
|
|
2975
|
+
return lodash.upperFirst(status2);
|
|
2976
|
+
};
|
|
2977
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: tailwindMerge.twMerge(statusReaction({ type })), children: [
|
|
2978
|
+
/* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "icon-md-sm shrink-0" }),
|
|
2979
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: getMessage() })
|
|
2980
|
+
] });
|
|
2981
|
+
};
|
|
2982
|
+
CubeStatusReaction.Skeleton = CubeStatusReactionSkeleton;
|
|
2983
|
+
var number = classVarianceAuthority.cva(
|
|
2984
|
+
"secondary-body7 flex size-4 shrink-0 items-center justify-center rounded-full font-extrabold text-white",
|
|
2985
|
+
{
|
|
2986
|
+
variants: {
|
|
2987
|
+
isActive: {
|
|
2988
|
+
true: "bg-functional-text",
|
|
2989
|
+
false: "bg-functional-disable-text"
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
}
|
|
2993
|
+
);
|
|
2994
|
+
var label5 = classVarianceAuthority.cva("primary-body3", {
|
|
2995
|
+
variants: {
|
|
2996
|
+
isActive: {
|
|
2997
|
+
true: "font-semibold text-functional-text",
|
|
2998
|
+
false: "text-functional-disable-text"
|
|
2999
|
+
}
|
|
3000
|
+
}
|
|
3001
|
+
});
|
|
3002
|
+
var CubeStepProcessItem = (props) => {
|
|
3003
|
+
const { stepNumber, label: label6, isActive } = props;
|
|
3004
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group flex items-center gap-3", children: [
|
|
3005
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
3006
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge(number({ isActive })), children: stepNumber.toString() }),
|
|
3007
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: tailwindMerge.twMerge(label5({ isActive })), children: label6 })
|
|
3008
|
+
] }),
|
|
3009
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChevronRight_default, { className: "icon-lg text-functional-text-light group-last:hidden" })
|
|
3010
|
+
] });
|
|
3011
|
+
};
|
|
3012
|
+
var CubeStepProcessSkeleton = (props) => {
|
|
3013
|
+
const { length = 5 } = props;
|
|
3014
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex gap-3", children: lodash.range(0, length).map((_, index) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "group flex", children: [
|
|
3015
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "mr-2 size-[18px]" }),
|
|
3016
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "mr-3 h-[18px] w-[58px]" }),
|
|
3017
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "size-[18px] group-last:hidden" })
|
|
3018
|
+
] }, index)) });
|
|
3019
|
+
};
|
|
3020
|
+
var CubeStepProcess = (props) => {
|
|
3021
|
+
const { className, children, isLoading } = props;
|
|
3022
|
+
if (isLoading) {
|
|
3023
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CubeStepProcessSkeleton, {});
|
|
3024
|
+
}
|
|
3025
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("flex items-center gap-3", className), children });
|
|
3026
|
+
};
|
|
3027
|
+
CubeStepProcess.Item = CubeStepProcessItem;
|
|
3028
|
+
CubeStepProcess.Skeleton = CubeStepProcessSkeleton;
|
|
3029
|
+
var stroke = classVarianceAuthority.cva("", {
|
|
3030
|
+
variants: {
|
|
3031
|
+
type: {
|
|
3032
|
+
regular: "border-functional-border-divider",
|
|
3033
|
+
dot: "border-t-4 border-dotted border-primary-50"
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
});
|
|
3037
|
+
var CubeStroke = (props) => {
|
|
3038
|
+
const { className, type = "regular", color } = props;
|
|
3039
|
+
return /* @__PURE__ */ jsxRuntime.jsx("hr", { className: tailwindMerge.twMerge(stroke({ type }), color, className) });
|
|
3040
|
+
};
|
|
3041
|
+
var tab = classVarianceAuthority.cva(
|
|
3042
|
+
"inline-block min-h-[34px] max-w-[200px] border-b border-b-functional-border-divider",
|
|
3043
|
+
{
|
|
3044
|
+
variants: {
|
|
3045
|
+
isActive: {
|
|
3046
|
+
false: "text-functional-text-light"
|
|
3047
|
+
},
|
|
3048
|
+
disabled: {
|
|
3049
|
+
false: ["cursor-pointer hover:text-functional-hover-primary"],
|
|
3050
|
+
true: ["cursor-default text-functional-disable-text"]
|
|
3051
|
+
}
|
|
3052
|
+
},
|
|
3053
|
+
compoundVariants: [
|
|
3054
|
+
{
|
|
3055
|
+
isActive: true,
|
|
3056
|
+
disabled: false,
|
|
3057
|
+
className: "border-b-cosmos-primary text-cosmos-primary"
|
|
3058
|
+
}
|
|
3059
|
+
],
|
|
3060
|
+
defaultVariants: {
|
|
3061
|
+
isActive: false,
|
|
3062
|
+
disabled: false
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
);
|
|
3066
|
+
var innerContainer = classVarianceAuthority.cva(
|
|
3067
|
+
[
|
|
3068
|
+
"secondary-body2 flex items-center justify-center px-2.5 py-2",
|
|
3069
|
+
"border-b border-b-transparent"
|
|
3070
|
+
],
|
|
3071
|
+
{
|
|
3072
|
+
variants: {
|
|
3073
|
+
isActive: {
|
|
3074
|
+
true: "",
|
|
3075
|
+
false: ""
|
|
3076
|
+
},
|
|
3077
|
+
disabled: {
|
|
3078
|
+
false: "font-medium"
|
|
3079
|
+
}
|
|
3080
|
+
},
|
|
3081
|
+
compoundVariants: [
|
|
3082
|
+
{
|
|
3083
|
+
isActive: true,
|
|
3084
|
+
disabled: false,
|
|
3085
|
+
className: "border-b-cosmos-primary font-semibold"
|
|
3086
|
+
}
|
|
3087
|
+
],
|
|
3088
|
+
defaultVariants: {
|
|
3089
|
+
isActive: false,
|
|
3090
|
+
disabled: false
|
|
3091
|
+
}
|
|
3092
|
+
}
|
|
3093
|
+
);
|
|
3094
|
+
var numberSpan = classVarianceAuthority.cva(
|
|
3095
|
+
"secondary-body7 ml-1 inline-flex size-4 shrink-0 items-center justify-center rounded-full text-[9px] font-extrabold",
|
|
3096
|
+
{
|
|
3097
|
+
variants: {
|
|
3098
|
+
disabled: {
|
|
3099
|
+
false: ["bg-cosmos-secondary text-functional-text"],
|
|
3100
|
+
true: ["bg-secondary-150 text-functional-text-light"]
|
|
3101
|
+
}
|
|
3102
|
+
},
|
|
3103
|
+
defaultVariants: {
|
|
3104
|
+
disabled: false
|
|
3105
|
+
}
|
|
3106
|
+
}
|
|
3107
|
+
);
|
|
3108
|
+
var NumberSpan = (props) => {
|
|
3109
|
+
const { number: number2, disabled } = props;
|
|
3110
|
+
const text = number2 > 99 ? "N" : number2;
|
|
3111
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3112
|
+
"span",
|
|
3113
|
+
{
|
|
3114
|
+
className: numberSpan({
|
|
3115
|
+
disabled
|
|
3116
|
+
}),
|
|
3117
|
+
children: text
|
|
3118
|
+
}
|
|
3119
|
+
);
|
|
3120
|
+
};
|
|
3121
|
+
var dotSpan = classVarianceAuthority.cva("ml-2.5 size-1 shrink-0 rounded-full", {
|
|
3122
|
+
variants: {
|
|
3123
|
+
disabled: {
|
|
3124
|
+
false: ["bg-cosmos-secondary"],
|
|
3125
|
+
true: ["bg-secondary-150"]
|
|
3126
|
+
}
|
|
3127
|
+
},
|
|
3128
|
+
defaultVariants: {
|
|
3129
|
+
disabled: false
|
|
3130
|
+
}
|
|
3131
|
+
});
|
|
3132
|
+
var DotSpan = (props) => {
|
|
3133
|
+
const { disabled } = props;
|
|
3134
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3135
|
+
"span",
|
|
3136
|
+
{
|
|
3137
|
+
className: dotSpan({
|
|
3138
|
+
disabled
|
|
3139
|
+
})
|
|
3140
|
+
}
|
|
3141
|
+
);
|
|
3142
|
+
};
|
|
3143
|
+
var CubeTab = (props) => {
|
|
3144
|
+
const {
|
|
3145
|
+
children,
|
|
3146
|
+
href,
|
|
3147
|
+
isActive,
|
|
3148
|
+
disabled = false,
|
|
3149
|
+
number: number2,
|
|
3150
|
+
dot,
|
|
3151
|
+
onClick: onClickProp
|
|
3152
|
+
} = props;
|
|
3153
|
+
const onClick = (e) => {
|
|
3154
|
+
if (!disabled) {
|
|
3155
|
+
onClickProp?.(e);
|
|
3156
|
+
}
|
|
3157
|
+
};
|
|
3158
|
+
const renderLabel = () => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3159
|
+
"span",
|
|
3160
|
+
{
|
|
3161
|
+
"data-label": children,
|
|
3162
|
+
className: tailwindMerge.twJoin(
|
|
3163
|
+
"inline-flex flex-col items-center",
|
|
3164
|
+
// Use pseudo element to avoid slight layout shift caused by the font weight changes between inactive and active states.
|
|
3165
|
+
"before:secondary-body2 before:pointer-events-none before:invisible before:h-0 before:select-none before:font-semibold before:content-[attr(data-label)]"
|
|
3166
|
+
),
|
|
3167
|
+
children
|
|
3168
|
+
}
|
|
3169
|
+
);
|
|
3170
|
+
const renderDecoration = () => {
|
|
3171
|
+
if (number2 !== void 0) {
|
|
3172
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NumberSpan, { number: number2, disabled });
|
|
3173
|
+
} else if (dot) {
|
|
3174
|
+
return /* @__PURE__ */ jsxRuntime.jsx(DotSpan, { disabled });
|
|
3175
|
+
} else {
|
|
3176
|
+
return void 0;
|
|
3177
|
+
}
|
|
3178
|
+
};
|
|
3179
|
+
const renderTab = () => {
|
|
3180
|
+
const tagType = href && !disabled ? "a" : "span";
|
|
3181
|
+
const hrefAttribute = tagType === "a" ? href : void 0;
|
|
3182
|
+
return react.createElement(
|
|
3183
|
+
tagType,
|
|
3184
|
+
{
|
|
3185
|
+
className: tailwindMerge.twMerge(
|
|
3186
|
+
tab({
|
|
3187
|
+
isActive,
|
|
3188
|
+
disabled
|
|
3189
|
+
})
|
|
3190
|
+
),
|
|
3191
|
+
href: hrefAttribute,
|
|
3192
|
+
onClick
|
|
3193
|
+
},
|
|
3194
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3195
|
+
"div",
|
|
3196
|
+
{
|
|
3197
|
+
className: tailwindMerge.twMerge(
|
|
3198
|
+
innerContainer({
|
|
3199
|
+
isActive,
|
|
3200
|
+
disabled
|
|
3201
|
+
})
|
|
3202
|
+
),
|
|
3203
|
+
children: [
|
|
3204
|
+
renderLabel(),
|
|
3205
|
+
renderDecoration()
|
|
3206
|
+
]
|
|
3207
|
+
}
|
|
3208
|
+
)
|
|
3209
|
+
);
|
|
3210
|
+
};
|
|
3211
|
+
return renderTab();
|
|
3212
|
+
};
|
|
3213
|
+
var CubeTabSkeleton = () => {
|
|
3214
|
+
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" }) });
|
|
3215
|
+
};
|
|
3216
|
+
var CubeTabs = (props) => {
|
|
3217
|
+
const { children } = props;
|
|
3218
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-end", children });
|
|
3219
|
+
};
|
|
3220
|
+
CubeTabs.Tab = CubeTab;
|
|
3221
|
+
CubeTabs.Skeleton = CubeTabSkeleton;
|
|
3222
|
+
var compoundsCreator = (color, variant, entries) => entries.map((entry) => ({ color, variant, ...entry }));
|
|
3223
|
+
var defaultCompounds = [
|
|
3224
|
+
// Filled - Base
|
|
3225
|
+
{
|
|
3226
|
+
color: "default",
|
|
3227
|
+
variant: "filled",
|
|
3228
|
+
disabled: false,
|
|
3229
|
+
className: tailwindMerge.twMerge(
|
|
3230
|
+
"bg-functional-border-divider hover:bg-grey-300",
|
|
3231
|
+
"text-functional-text"
|
|
3232
|
+
)
|
|
3233
|
+
},
|
|
3234
|
+
{
|
|
3235
|
+
color: "default",
|
|
3236
|
+
variant: "filled",
|
|
3237
|
+
disabled: true,
|
|
3238
|
+
className: tailwindMerge.twMerge(
|
|
3239
|
+
"bg-functional-disable-light",
|
|
3240
|
+
"text-functional-disable-text"
|
|
3241
|
+
)
|
|
3242
|
+
},
|
|
3243
|
+
// Filled - Close button
|
|
3244
|
+
{
|
|
3245
|
+
color: "default",
|
|
3246
|
+
variant: "filled",
|
|
3247
|
+
hasCloseButton: true,
|
|
3248
|
+
disabled: false,
|
|
3249
|
+
className: tailwindMerge.twMerge(
|
|
3250
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
3251
|
+
)
|
|
3252
|
+
},
|
|
3253
|
+
{
|
|
3254
|
+
color: "default",
|
|
3255
|
+
variant: "filled",
|
|
3256
|
+
hasCloseButton: true,
|
|
3257
|
+
disabled: true,
|
|
3258
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3259
|
+
},
|
|
3260
|
+
// Filled - Icon
|
|
3261
|
+
{
|
|
3262
|
+
color: "default",
|
|
3263
|
+
variant: "filled",
|
|
3264
|
+
hasIcon: true,
|
|
3265
|
+
disabled: false,
|
|
3266
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
3267
|
+
},
|
|
3268
|
+
{
|
|
3269
|
+
color: "default",
|
|
3270
|
+
variant: "filled",
|
|
3271
|
+
hasIcon: true,
|
|
3272
|
+
disabled: true,
|
|
3273
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3274
|
+
},
|
|
3275
|
+
// Stroke - Base
|
|
3276
|
+
{
|
|
3277
|
+
color: "default",
|
|
3278
|
+
variant: "stroke",
|
|
3279
|
+
disabled: false,
|
|
3280
|
+
className: tailwindMerge.twMerge(
|
|
3281
|
+
"bg-functional-border-divider hover:bg-grey-300",
|
|
3282
|
+
"text-functional-text",
|
|
3283
|
+
"border border-functional-border-darker"
|
|
3284
|
+
)
|
|
3285
|
+
},
|
|
3286
|
+
{
|
|
3287
|
+
color: "default",
|
|
3288
|
+
variant: "stroke",
|
|
3289
|
+
disabled: true,
|
|
3290
|
+
className: tailwindMerge.twMerge(
|
|
3291
|
+
"bg-functional-disable-light",
|
|
3292
|
+
"text-functional-disable-text",
|
|
3293
|
+
"border border-functional-border-divider"
|
|
3294
|
+
)
|
|
3295
|
+
},
|
|
3296
|
+
// Stroke - Close button
|
|
3297
|
+
{
|
|
3298
|
+
color: "default",
|
|
3299
|
+
variant: "stroke",
|
|
3300
|
+
hasCloseButton: true,
|
|
3301
|
+
disabled: false,
|
|
3302
|
+
className: tailwindMerge.twMerge(
|
|
3303
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
3304
|
+
)
|
|
3305
|
+
},
|
|
3306
|
+
{
|
|
3307
|
+
color: "default",
|
|
3308
|
+
variant: "stroke",
|
|
3309
|
+
hasCloseButton: true,
|
|
3310
|
+
disabled: true,
|
|
3311
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3312
|
+
},
|
|
3313
|
+
// Stroke - Icon
|
|
3314
|
+
{
|
|
3315
|
+
color: "default",
|
|
3316
|
+
variant: "stroke",
|
|
3317
|
+
hasIcon: true,
|
|
3318
|
+
disabled: false,
|
|
3319
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
3320
|
+
},
|
|
3321
|
+
{
|
|
3322
|
+
color: "default",
|
|
3323
|
+
variant: "stroke",
|
|
3324
|
+
hasIcon: true,
|
|
3325
|
+
disabled: true,
|
|
3326
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3327
|
+
}
|
|
3328
|
+
];
|
|
3329
|
+
var primaryBlueCompounds = [
|
|
3330
|
+
...compoundsCreator("primary-blue", "filled", [
|
|
3331
|
+
{
|
|
3332
|
+
disabled: false,
|
|
3333
|
+
className: tailwindMerge.twMerge(
|
|
3334
|
+
"bg-primary-200 hover:bg-primary-150",
|
|
3335
|
+
"text-functional-text"
|
|
3336
|
+
)
|
|
3337
|
+
},
|
|
3338
|
+
{
|
|
3339
|
+
disabled: true,
|
|
3340
|
+
className: tailwindMerge.twMerge("bg-primary-50", "text-functional-disable-text")
|
|
3341
|
+
},
|
|
3342
|
+
{
|
|
3343
|
+
hasCloseButton: true,
|
|
3344
|
+
disabled: false,
|
|
3345
|
+
className: tailwindMerge.twMerge(
|
|
3346
|
+
"[&>svg]:text-grey-0 [&>svg]:hover:text-functional-text"
|
|
3347
|
+
)
|
|
3348
|
+
},
|
|
3349
|
+
{
|
|
3350
|
+
hasCloseButton: true,
|
|
3351
|
+
disabled: true,
|
|
3352
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3353
|
+
},
|
|
3354
|
+
{
|
|
3355
|
+
hasIcon: true,
|
|
3356
|
+
disabled: false,
|
|
3357
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
3358
|
+
},
|
|
3359
|
+
{
|
|
3360
|
+
hasIcon: true,
|
|
3361
|
+
disabled: true,
|
|
3362
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3363
|
+
}
|
|
3364
|
+
]),
|
|
3365
|
+
...compoundsCreator("primary-blue", "stroke", [
|
|
3366
|
+
{
|
|
3367
|
+
disabled: false,
|
|
3368
|
+
className: tailwindMerge.twMerge(
|
|
3369
|
+
"bg-primary-0 hover:bg-primary-50",
|
|
3370
|
+
"text-functional-text",
|
|
3371
|
+
"border border-primary-200"
|
|
3372
|
+
)
|
|
3373
|
+
},
|
|
3374
|
+
{
|
|
3375
|
+
disabled: true,
|
|
3376
|
+
className: tailwindMerge.twMerge(
|
|
3377
|
+
"bg-primary-0",
|
|
3378
|
+
"text-functional-disable-text",
|
|
3379
|
+
"border border-primary-50"
|
|
3380
|
+
)
|
|
3381
|
+
},
|
|
3382
|
+
{
|
|
3383
|
+
hasCloseButton: true,
|
|
3384
|
+
disabled: false,
|
|
3385
|
+
className: tailwindMerge.twMerge(
|
|
3386
|
+
"[&>svg]:text-primary-200 [&>svg]:hover:text-functional-text"
|
|
3387
|
+
)
|
|
3388
|
+
},
|
|
3389
|
+
{
|
|
3390
|
+
hasCloseButton: true,
|
|
3391
|
+
disabled: true,
|
|
3392
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3393
|
+
},
|
|
3394
|
+
{
|
|
3395
|
+
hasIcon: true,
|
|
3396
|
+
disabled: false,
|
|
3397
|
+
className: tailwindMerge.twMerge("[&>svg]:text-primary-200")
|
|
3398
|
+
},
|
|
3399
|
+
{
|
|
3400
|
+
hasIcon: true,
|
|
3401
|
+
disabled: true,
|
|
3402
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3403
|
+
}
|
|
3404
|
+
])
|
|
3405
|
+
];
|
|
3406
|
+
var blueCompounds = [
|
|
3407
|
+
...compoundsCreator("blue", "filled", [
|
|
3408
|
+
{
|
|
3409
|
+
disabled: false,
|
|
3410
|
+
className: tailwindMerge.twMerge(
|
|
3411
|
+
"bg-blue-200 hover:bg-blue-150",
|
|
3412
|
+
"text-functional-text"
|
|
3413
|
+
)
|
|
3414
|
+
},
|
|
3415
|
+
{
|
|
3416
|
+
disabled: true,
|
|
3417
|
+
className: tailwindMerge.twMerge("bg-blue-50", "text-functional-disable-text")
|
|
3418
|
+
},
|
|
3419
|
+
{
|
|
3420
|
+
hasCloseButton: true,
|
|
3421
|
+
disabled: false,
|
|
3422
|
+
className: tailwindMerge.twMerge(
|
|
3423
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
3424
|
+
)
|
|
3425
|
+
},
|
|
3426
|
+
{
|
|
3427
|
+
hasCloseButton: true,
|
|
3428
|
+
disabled: true,
|
|
3429
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3430
|
+
},
|
|
3431
|
+
{
|
|
3432
|
+
hasIcon: true,
|
|
3433
|
+
disabled: false,
|
|
3434
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
3435
|
+
},
|
|
3436
|
+
{
|
|
3437
|
+
hasIcon: true,
|
|
3438
|
+
disabled: true,
|
|
3439
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3440
|
+
}
|
|
3441
|
+
]),
|
|
3442
|
+
...compoundsCreator("blue", "stroke", [
|
|
3443
|
+
{
|
|
3444
|
+
disabled: false,
|
|
3445
|
+
className: tailwindMerge.twMerge(
|
|
3446
|
+
"bg-blue-50 hover:bg-blue-100",
|
|
3447
|
+
"text-functional-text",
|
|
3448
|
+
"border border-primary-400"
|
|
3449
|
+
)
|
|
3450
|
+
},
|
|
3451
|
+
{
|
|
3452
|
+
disabled: true,
|
|
3453
|
+
className: tailwindMerge.twMerge(
|
|
3454
|
+
"bg-blue-0",
|
|
3455
|
+
"text-functional-disable-text",
|
|
3456
|
+
"border border-primary-150"
|
|
3457
|
+
)
|
|
3458
|
+
},
|
|
3459
|
+
{
|
|
3460
|
+
hasCloseButton: true,
|
|
3461
|
+
disabled: false,
|
|
3462
|
+
className: tailwindMerge.twMerge(
|
|
3463
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
3464
|
+
)
|
|
3465
|
+
},
|
|
3466
|
+
{
|
|
3467
|
+
hasCloseButton: true,
|
|
3468
|
+
disabled: true,
|
|
3469
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3470
|
+
},
|
|
3471
|
+
{
|
|
3472
|
+
hasIcon: true,
|
|
3473
|
+
disabled: false,
|
|
3474
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
3475
|
+
},
|
|
3476
|
+
{
|
|
3477
|
+
hasIcon: true,
|
|
3478
|
+
disabled: true,
|
|
3479
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3480
|
+
}
|
|
3481
|
+
])
|
|
3482
|
+
];
|
|
3483
|
+
var cyanCompounds = [
|
|
3484
|
+
...compoundsCreator("cyan", "filled", [
|
|
3485
|
+
{
|
|
3486
|
+
disabled: false,
|
|
3487
|
+
className: tailwindMerge.twMerge(
|
|
3488
|
+
"bg-secondary-200 hover:bg-secondary-150",
|
|
3489
|
+
"text-functional-text"
|
|
3490
|
+
)
|
|
3491
|
+
},
|
|
3492
|
+
{
|
|
3493
|
+
disabled: true,
|
|
3494
|
+
className: tailwindMerge.twMerge("bg-secondary-50", "text-functional-disable-text")
|
|
3495
|
+
},
|
|
3496
|
+
{
|
|
3497
|
+
hasCloseButton: true,
|
|
3498
|
+
disabled: false,
|
|
3499
|
+
className: tailwindMerge.twMerge(
|
|
3500
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
3501
|
+
)
|
|
3502
|
+
},
|
|
3503
|
+
{
|
|
3504
|
+
hasCloseButton: true,
|
|
3505
|
+
disabled: true,
|
|
3506
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3507
|
+
},
|
|
3508
|
+
{
|
|
3509
|
+
hasIcon: true,
|
|
3510
|
+
disabled: false,
|
|
3511
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
3512
|
+
},
|
|
3513
|
+
{
|
|
3514
|
+
hasIcon: true,
|
|
3515
|
+
disabled: true,
|
|
3516
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3517
|
+
}
|
|
3518
|
+
]),
|
|
3519
|
+
...compoundsCreator("cyan", "stroke", [
|
|
3520
|
+
{
|
|
3521
|
+
disabled: false,
|
|
3522
|
+
className: tailwindMerge.twMerge(
|
|
3523
|
+
"bg-secondary-50 hover:bg-secondary-100",
|
|
3524
|
+
"text-functional-text",
|
|
3525
|
+
"border border-secondary-600"
|
|
3526
|
+
)
|
|
3527
|
+
},
|
|
3528
|
+
{
|
|
3529
|
+
disabled: true,
|
|
3530
|
+
className: tailwindMerge.twMerge(
|
|
3531
|
+
"bg-secondary-0",
|
|
3532
|
+
"text-functional-disable-text",
|
|
3533
|
+
"border border-secondary-150"
|
|
3534
|
+
)
|
|
3535
|
+
},
|
|
3536
|
+
{
|
|
3537
|
+
hasCloseButton: true,
|
|
3538
|
+
disabled: false,
|
|
3539
|
+
className: tailwindMerge.twMerge(
|
|
3540
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
3541
|
+
)
|
|
3542
|
+
},
|
|
3543
|
+
{
|
|
3544
|
+
hasCloseButton: true,
|
|
3545
|
+
disabled: true,
|
|
3546
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3547
|
+
},
|
|
3548
|
+
{
|
|
3549
|
+
hasIcon: true,
|
|
3550
|
+
disabled: false,
|
|
3551
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
3552
|
+
},
|
|
3553
|
+
{
|
|
3554
|
+
hasIcon: true,
|
|
3555
|
+
disabled: true,
|
|
3556
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-disable-text")
|
|
3557
|
+
}
|
|
3558
|
+
])
|
|
3559
|
+
];
|
|
3560
|
+
var darkCompounds = [
|
|
3561
|
+
...compoundsCreator("dark", "filled", [
|
|
3562
|
+
{
|
|
3563
|
+
disabled: false,
|
|
3564
|
+
className: tailwindMerge.twMerge("bg-dark-500 hover:bg-dark-400", "text-grey-0")
|
|
3565
|
+
},
|
|
3566
|
+
{
|
|
3567
|
+
disabled: true,
|
|
3568
|
+
className: tailwindMerge.twMerge("bg-functional-disable", "text-grey-0")
|
|
3569
|
+
},
|
|
3570
|
+
{
|
|
3571
|
+
hasCloseButton: true,
|
|
3572
|
+
disabled: false,
|
|
3573
|
+
className: tailwindMerge.twMerge("[&>svg]:text-dark-150 [&>svg]:hover:text-grey-0")
|
|
3574
|
+
},
|
|
3575
|
+
{
|
|
3576
|
+
hasCloseButton: true,
|
|
3577
|
+
disabled: true,
|
|
3578
|
+
className: tailwindMerge.twMerge("[&>svg]:text-grey-0")
|
|
3579
|
+
},
|
|
3580
|
+
{
|
|
3581
|
+
hasIcon: true,
|
|
3582
|
+
disabled: false,
|
|
3583
|
+
className: tailwindMerge.twMerge("[&>svg]:text-dark-150")
|
|
3584
|
+
},
|
|
3585
|
+
{
|
|
3586
|
+
hasIcon: true,
|
|
3587
|
+
disabled: true,
|
|
3588
|
+
className: tailwindMerge.twMerge("[&>svg]:text-grey-0")
|
|
3589
|
+
}
|
|
3590
|
+
]),
|
|
3591
|
+
...compoundsCreator("dark", "stroke", [
|
|
3592
|
+
{
|
|
3593
|
+
disabled: false,
|
|
3594
|
+
className: tailwindMerge.twMerge(
|
|
3595
|
+
"bg-dark-50 hover:bg-dark-100",
|
|
3596
|
+
"text-functional-text",
|
|
3597
|
+
"border border-functional-text"
|
|
3598
|
+
)
|
|
3599
|
+
},
|
|
3600
|
+
{
|
|
3601
|
+
disabled: true,
|
|
3602
|
+
className: tailwindMerge.twMerge(
|
|
3603
|
+
"bg-dark-0",
|
|
3604
|
+
"text-functional-border-divider",
|
|
3605
|
+
"border border-functional-border-divider"
|
|
3606
|
+
)
|
|
3607
|
+
},
|
|
3608
|
+
{
|
|
3609
|
+
hasCloseButton: true,
|
|
3610
|
+
disabled: false,
|
|
3611
|
+
className: tailwindMerge.twMerge(
|
|
3612
|
+
"[&>svg]:text-functional-text-light [&>svg]:hover:text-functional-text"
|
|
3613
|
+
)
|
|
3614
|
+
},
|
|
3615
|
+
{
|
|
3616
|
+
hasCloseButton: true,
|
|
3617
|
+
disabled: true,
|
|
3618
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-border-divider")
|
|
3619
|
+
},
|
|
3620
|
+
{
|
|
3621
|
+
hasIcon: true,
|
|
3622
|
+
disabled: false,
|
|
3623
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-text-light")
|
|
3624
|
+
},
|
|
3625
|
+
{
|
|
3626
|
+
hasIcon: true,
|
|
3627
|
+
disabled: true,
|
|
3628
|
+
className: tailwindMerge.twMerge("[&>svg]:text-functional-border-divider")
|
|
3629
|
+
}
|
|
3630
|
+
])
|
|
3631
|
+
];
|
|
3632
|
+
var tag = classVarianceAuthority.cva(
|
|
3633
|
+
[
|
|
3634
|
+
"inline-flex items-center gap-x-[5px] whitespace-nowrap",
|
|
3635
|
+
"h-[21px] w-fit cursor-default rounded-[20px] px-2.5 py-1",
|
|
3636
|
+
"secondary-body5 font-semibold"
|
|
3637
|
+
],
|
|
3638
|
+
{
|
|
3639
|
+
variants: {
|
|
3640
|
+
// Use `as` for `compoundVariants` to infer the type.
|
|
3641
|
+
color: {},
|
|
3642
|
+
variant: {},
|
|
3643
|
+
hasCloseButton: {
|
|
3644
|
+
true: void 0
|
|
3645
|
+
},
|
|
3646
|
+
hasIcon: {
|
|
3647
|
+
true: void 0
|
|
3648
|
+
},
|
|
3649
|
+
disabled: {
|
|
3650
|
+
true: void 0
|
|
3651
|
+
}
|
|
3652
|
+
},
|
|
3653
|
+
compoundVariants: [
|
|
3654
|
+
...defaultCompounds,
|
|
3655
|
+
...primaryBlueCompounds,
|
|
3656
|
+
...blueCompounds,
|
|
3657
|
+
...cyanCompounds,
|
|
3658
|
+
...darkCompounds
|
|
3659
|
+
]
|
|
3660
|
+
}
|
|
3661
|
+
);
|
|
3662
|
+
var closeButton = classVarianceAuthority.cva("icon-xs", {
|
|
3663
|
+
variants: {
|
|
3664
|
+
disabled: {
|
|
3665
|
+
false: "cursor-pointer",
|
|
3666
|
+
true: "cursor-default"
|
|
3667
|
+
}
|
|
3668
|
+
}
|
|
3669
|
+
});
|
|
3670
|
+
var skeleton2 = classVarianceAuthority.cva("h-[23px] rounded-full", {
|
|
3671
|
+
variants: {
|
|
3672
|
+
hasIcon: {
|
|
3673
|
+
true: "w-[95px]",
|
|
3674
|
+
false: "w-[80px]"
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
});
|
|
3678
|
+
var CubeTagSkeleton = (props) => {
|
|
3679
|
+
const { hasIcon } = props;
|
|
3680
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: tailwindMerge.twMerge(skeleton2({ hasIcon })) });
|
|
3681
|
+
};
|
|
3682
|
+
var CubeTag = (props) => {
|
|
3683
|
+
const {
|
|
3684
|
+
className,
|
|
3685
|
+
children,
|
|
3686
|
+
color = "default",
|
|
3687
|
+
variant,
|
|
3688
|
+
disabled = false,
|
|
3689
|
+
isLoading = false
|
|
3690
|
+
} = props;
|
|
3691
|
+
const hasIcon = "Icon" in props;
|
|
3692
|
+
const hasCloseButton = "showCloseButton" in props && props.showCloseButton;
|
|
3693
|
+
const renderIcon = () => {
|
|
3694
|
+
if (!hasIcon) {
|
|
3695
|
+
return void 0;
|
|
3696
|
+
}
|
|
3697
|
+
const { Icon } = props;
|
|
3698
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: "icon-xs" });
|
|
3699
|
+
};
|
|
3700
|
+
const renderCloseButton = () => {
|
|
3701
|
+
if (!hasCloseButton) {
|
|
3702
|
+
return void 0;
|
|
3703
|
+
}
|
|
3704
|
+
const { onClose: onCloseProp } = props;
|
|
3705
|
+
const onClose = () => {
|
|
3706
|
+
if (!disabled) {
|
|
3707
|
+
onCloseProp?.();
|
|
3708
|
+
}
|
|
3709
|
+
};
|
|
3710
|
+
return /* @__PURE__ */ jsxRuntime.jsx(X_default, { className: closeButton({ disabled }), onClick: onClose });
|
|
3711
|
+
};
|
|
3712
|
+
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeTagSkeleton, { hasIcon: hasIcon || hasCloseButton });
|
|
3713
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3714
|
+
"span",
|
|
3715
|
+
{
|
|
3716
|
+
className: tailwindMerge.twMerge(
|
|
3717
|
+
tag({
|
|
3718
|
+
color,
|
|
3719
|
+
variant,
|
|
3720
|
+
hasCloseButton,
|
|
3721
|
+
hasIcon,
|
|
3722
|
+
disabled
|
|
3723
|
+
}),
|
|
3724
|
+
className
|
|
3725
|
+
),
|
|
3726
|
+
children: [
|
|
3727
|
+
renderIcon(),
|
|
3728
|
+
children,
|
|
3729
|
+
renderCloseButton()
|
|
3730
|
+
]
|
|
3731
|
+
}
|
|
3732
|
+
);
|
|
3733
|
+
};
|
|
3734
|
+
CubeTag.Skeleton = CubeTagSkeleton;
|
|
3735
|
+
var CubeTextareaSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-[6px]", children: [
|
|
3736
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-[20px] min-w-[280px] max-w-[380px]" }),
|
|
3737
|
+
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-[140px] min-w-[280px] max-w-[380px]" })
|
|
3738
|
+
] });
|
|
3739
|
+
var useVisibleRowsCount = () => {
|
|
3740
|
+
const textareaRef = react.useRef(null);
|
|
3741
|
+
const [visibleRowsCount, setVisibleRowsCount] = react.useState(0);
|
|
3742
|
+
react.useEffect(() => {
|
|
3743
|
+
const textarea2 = textareaRef.current;
|
|
3744
|
+
let observer = void 0;
|
|
3745
|
+
if (textarea2) {
|
|
3746
|
+
observer = new ResizeObserver((entries) => {
|
|
3747
|
+
const { lineHeight } = getComputedStyle(textarea2);
|
|
3748
|
+
const lineHeightPx = parseInt(lineHeight);
|
|
3749
|
+
const textareaHeight = entries[0]?.contentBoxSize[0]?.blockSize ?? 0;
|
|
3750
|
+
setVisibleRowsCount(
|
|
3751
|
+
Math.ceil((textareaHeight + textarea2.scrollTop) / lineHeightPx)
|
|
3752
|
+
);
|
|
3753
|
+
});
|
|
3754
|
+
observer.observe(textarea2);
|
|
3755
|
+
}
|
|
3756
|
+
return () => {
|
|
3757
|
+
observer?.disconnect();
|
|
3758
|
+
};
|
|
3759
|
+
}, []);
|
|
3760
|
+
return {
|
|
3761
|
+
textareaRef,
|
|
3762
|
+
visibleRowsCount
|
|
3763
|
+
};
|
|
3764
|
+
};
|
|
3765
|
+
var textarea = classVarianceAuthority.cva(
|
|
3766
|
+
[
|
|
3767
|
+
"primary-body2 rounded-[5px] bg-grey-0 px-4 py-[10px] outline-none",
|
|
3768
|
+
"max-h-[260px] min-h-[140px] min-w-[280px]",
|
|
3769
|
+
"text-functional-text placeholder:text-functional-border-darker",
|
|
3770
|
+
"border border-functional-border-divider",
|
|
3771
|
+
"hover:border-functional-hover-primary focus:border-functional-hover-primary"
|
|
3772
|
+
],
|
|
3773
|
+
{
|
|
3774
|
+
variants: {
|
|
3775
|
+
isError: {
|
|
3776
|
+
true: "border-status-negative hover:border-status-negative"
|
|
3777
|
+
},
|
|
3778
|
+
disabled: {
|
|
3779
|
+
true: [
|
|
3780
|
+
"disabled:border-functional-disable-text disabled:text-functional-disable-text disabled:placeholder:text-functional-border-divider",
|
|
3781
|
+
"disabled:hover:border-functional-disable-text"
|
|
3782
|
+
]
|
|
3783
|
+
}
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
);
|
|
3787
|
+
var CubeTextarea = (props) => {
|
|
3788
|
+
const {
|
|
3789
|
+
id: textareaId,
|
|
3790
|
+
ref,
|
|
3791
|
+
className,
|
|
3792
|
+
disabled,
|
|
3793
|
+
value: valueProps,
|
|
3794
|
+
onChange,
|
|
3795
|
+
label: label6,
|
|
3796
|
+
maxLength,
|
|
3797
|
+
isLoading,
|
|
3798
|
+
errorMessage,
|
|
3799
|
+
...restProps
|
|
3800
|
+
} = props;
|
|
3801
|
+
const [charCount, setCharCount] = react.useState(
|
|
3802
|
+
() => calculateValueLength(valueProps)
|
|
3803
|
+
);
|
|
3804
|
+
const [isFocused, setIsFocused] = react.useState(false);
|
|
3805
|
+
react.useEffect(() => {
|
|
3806
|
+
setCharCount(calculateValueLength(valueProps));
|
|
3807
|
+
}, [valueProps]);
|
|
3808
|
+
const { textareaRef: localRef, visibleRowsCount } = useVisibleRowsCount();
|
|
3809
|
+
const handleChange = (e) => {
|
|
3810
|
+
const newValue = e.target.value;
|
|
3811
|
+
if (newValue.length <= maxLength) {
|
|
3812
|
+
setCharCount(newValue.length);
|
|
3813
|
+
onChange?.(e);
|
|
3814
|
+
}
|
|
3815
|
+
};
|
|
3816
|
+
if (isLoading) {
|
|
3817
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CubeTextareaSkeleton, {});
|
|
3818
|
+
}
|
|
3819
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-[6px]", children: [
|
|
3820
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
3821
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3822
|
+
"label",
|
|
3823
|
+
{
|
|
3824
|
+
htmlFor: textareaId,
|
|
3825
|
+
className: "primary-body2 font-semibold text-functional-text",
|
|
3826
|
+
children: label6
|
|
3827
|
+
}
|
|
3828
|
+
),
|
|
3829
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "secondary-body4 text-functional-text-light", children: [
|
|
3830
|
+
charCount.toLocaleString("en-US"),
|
|
3831
|
+
"/",
|
|
3832
|
+
maxLength.toLocaleString("en-US")
|
|
3833
|
+
] })
|
|
3834
|
+
] }),
|
|
3835
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3836
|
+
"textarea",
|
|
3837
|
+
{
|
|
3838
|
+
...restProps,
|
|
3839
|
+
id: textareaId,
|
|
3840
|
+
disabled,
|
|
3841
|
+
ref: (element) => {
|
|
3842
|
+
assignRefValue(ref, element);
|
|
3843
|
+
assignRefValue(localRef, element);
|
|
3844
|
+
},
|
|
3845
|
+
value: valueProps,
|
|
3846
|
+
onChange: handleChange,
|
|
3847
|
+
onFocus: () => setIsFocused(true),
|
|
3848
|
+
onBlur: () => setIsFocused(false),
|
|
3849
|
+
className: tailwindMerge.twMerge(
|
|
3850
|
+
textarea({ isError: !!errorMessage, disabled }),
|
|
3851
|
+
className
|
|
3852
|
+
),
|
|
3853
|
+
style: isFocused ? void 0 : {
|
|
3854
|
+
overflow: "hidden",
|
|
3855
|
+
display: "-webkit-box",
|
|
3856
|
+
WebkitBoxOrient: "vertical",
|
|
3857
|
+
WebkitLineClamp: visibleRowsCount
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
),
|
|
3861
|
+
errorMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "primary-body4 text-status-negative", children: errorMessage })
|
|
3862
|
+
] });
|
|
3863
|
+
};
|
|
3864
|
+
CubeTextarea.Skeleton = CubeTextareaSkeleton;
|
|
3865
|
+
var caret = classVarianceAuthority.cva(
|
|
3866
|
+
"inline-block size-0 border-[6px] border-t-0 border-solid border-transparent border-b-dark-700",
|
|
3867
|
+
{
|
|
3868
|
+
variants: {
|
|
3869
|
+
horizontalPlacement: {
|
|
3870
|
+
left: "ml-4 self-start",
|
|
3871
|
+
center: "self-center",
|
|
3872
|
+
right: "mr-4 self-end",
|
|
3873
|
+
"follow-cursor": "self-center"
|
|
3874
|
+
}
|
|
3875
|
+
}
|
|
3876
|
+
}
|
|
3877
|
+
);
|
|
3878
|
+
var infoBoxContainer = classVarianceAuthority.cva(
|
|
3879
|
+
"pointer-events-none flex min-w-[50px] max-w-[480px]",
|
|
3880
|
+
{
|
|
3881
|
+
variants: {
|
|
3882
|
+
verticalPlacement: {
|
|
3883
|
+
top: "flex-col",
|
|
3884
|
+
bottom: "flex-col-reverse"
|
|
3885
|
+
},
|
|
3886
|
+
/**
|
|
3887
|
+
* Hidden and pinned to the viewport's top-left corner: `fixed` keeps it
|
|
3888
|
+
* out of the document flow (no extra scroll height), and the left edge
|
|
3889
|
+
* gives it the full viewport width so it's measured without wrapping.
|
|
3890
|
+
*/
|
|
3891
|
+
isMeasuring: {
|
|
3892
|
+
true: "invisible fixed left-0 top-0",
|
|
3893
|
+
false: "absolute"
|
|
3894
|
+
}
|
|
3895
|
+
}
|
|
3896
|
+
}
|
|
3897
|
+
);
|
|
3898
|
+
var Caret = (props) => {
|
|
3899
|
+
const { placement, translateX: translateXProp } = props;
|
|
3900
|
+
const [verticalPlacement, horizontalPlacement] = splitPlacements(placement);
|
|
3901
|
+
const style = react.useMemo(() => {
|
|
3902
|
+
const rotateAngle = verticalPlacement === "top" ? 180 : 0;
|
|
3903
|
+
let translateX = translateXProp;
|
|
3904
|
+
if (verticalPlacement === "bottom" && horizontalPlacement === "follow-cursor" && translateXProp < 0) {
|
|
3905
|
+
translateX = translateXProp * -1;
|
|
3906
|
+
}
|
|
3907
|
+
return {
|
|
3908
|
+
transform: `rotate(${rotateAngle}deg) translateX(${translateX}px)`
|
|
3909
|
+
};
|
|
3910
|
+
}, [verticalPlacement, horizontalPlacement, translateXProp]);
|
|
3911
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3912
|
+
"span",
|
|
3913
|
+
{
|
|
3914
|
+
className: tailwindMerge.twMerge(
|
|
3915
|
+
caret({
|
|
3916
|
+
horizontalPlacement
|
|
3917
|
+
})
|
|
3918
|
+
),
|
|
3919
|
+
style
|
|
3920
|
+
}
|
|
3921
|
+
);
|
|
3922
|
+
};
|
|
3923
|
+
var InfoBox = (props) => {
|
|
3924
|
+
const {
|
|
3925
|
+
id,
|
|
3926
|
+
information: { title, subtext, message },
|
|
3927
|
+
placement,
|
|
3928
|
+
mouseX,
|
|
3929
|
+
anchorRef
|
|
3930
|
+
} = props;
|
|
3931
|
+
const { elementRef, resolvedStyles } = useFloating({
|
|
3932
|
+
isOpen: true,
|
|
3933
|
+
anchorRef,
|
|
3934
|
+
placement,
|
|
3935
|
+
offsets: {
|
|
3936
|
+
x: 14,
|
|
3937
|
+
y: 2
|
|
3938
|
+
},
|
|
3939
|
+
mouseX
|
|
3940
|
+
});
|
|
3941
|
+
const {
|
|
3942
|
+
idealPlacement = placement,
|
|
3943
|
+
floatingStyle,
|
|
3944
|
+
translateX = 0
|
|
3945
|
+
} = resolvedStyles ?? {};
|
|
3946
|
+
const [verticalPlacement] = splitPlacements(idealPlacement);
|
|
3947
|
+
const renderContent = () => {
|
|
3948
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-y-0.5 rounded-[5px] bg-dark-700 px-3 pb-2.5 pt-2", children: [
|
|
3949
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-x-6 text-primary-200", children: [
|
|
3950
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "primary-body2 shrink-0 font-semibold", children: title }),
|
|
3951
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "primary-body4 shrink-0", children: subtext })
|
|
3952
|
+
] }),
|
|
3953
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "primary-body3 text-grey-0", children: message })
|
|
3954
|
+
] });
|
|
3955
|
+
};
|
|
3956
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3957
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3958
|
+
"div",
|
|
3959
|
+
{
|
|
3960
|
+
ref: elementRef,
|
|
3961
|
+
"aria-hidden": true,
|
|
3962
|
+
className: infoBoxContainer({
|
|
3963
|
+
verticalPlacement,
|
|
3964
|
+
isMeasuring: true
|
|
3965
|
+
}),
|
|
3966
|
+
children: renderContent()
|
|
3967
|
+
}
|
|
3968
|
+
),
|
|
3969
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3970
|
+
"div",
|
|
3971
|
+
{
|
|
3972
|
+
id,
|
|
3973
|
+
role: "tooltip",
|
|
3974
|
+
className: infoBoxContainer({
|
|
3975
|
+
verticalPlacement,
|
|
3976
|
+
isMeasuring: !floatingStyle
|
|
3977
|
+
}),
|
|
3978
|
+
style: floatingStyle,
|
|
3979
|
+
children: [
|
|
3980
|
+
renderContent(),
|
|
3981
|
+
/* @__PURE__ */ jsxRuntime.jsx(Caret, { placement: idealPlacement, translateX })
|
|
3982
|
+
]
|
|
3983
|
+
}
|
|
3984
|
+
)
|
|
3985
|
+
] });
|
|
3986
|
+
};
|
|
3987
|
+
var CubeTooltip = (props) => {
|
|
3988
|
+
const {
|
|
3989
|
+
placement = "top-center",
|
|
3990
|
+
hoverContent,
|
|
3991
|
+
clickContent,
|
|
3992
|
+
children: anchorElement
|
|
3993
|
+
} = props;
|
|
3994
|
+
const [visibilityState, setVisibilityState] = react.useState(void 0);
|
|
3995
|
+
const [mouseX, setMouseX] = react.useState(0);
|
|
3996
|
+
const anchorRef = react.useRef(null);
|
|
3997
|
+
const tooltipId = react.useId();
|
|
3998
|
+
const infoMap = {
|
|
3999
|
+
hover: hoverContent,
|
|
4000
|
+
click: clickContent
|
|
4001
|
+
};
|
|
4002
|
+
const isVisible = visibilityState !== void 0 && infoMap[visibilityState] !== void 0;
|
|
4003
|
+
react.useEffect(() => {
|
|
4004
|
+
if (!isVisible) return;
|
|
4005
|
+
const onKeyDown = (e) => {
|
|
4006
|
+
if (e.key === "Escape") {
|
|
4007
|
+
setVisibilityState(void 0);
|
|
4008
|
+
}
|
|
4009
|
+
};
|
|
4010
|
+
document.addEventListener("keydown", onKeyDown);
|
|
4011
|
+
return () => {
|
|
4012
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
4013
|
+
};
|
|
4014
|
+
}, [isVisible]);
|
|
4015
|
+
const onMouseEnter = (e) => {
|
|
4016
|
+
if (hoverContent) {
|
|
4017
|
+
setVisibilityState("hover");
|
|
4018
|
+
}
|
|
4019
|
+
anchorElement.props.onMouseEnter?.(e);
|
|
4020
|
+
};
|
|
4021
|
+
const onMouseMove = (e) => {
|
|
4022
|
+
setMouseX(e.clientX);
|
|
4023
|
+
anchorElement.props.onMouseMove?.(e);
|
|
4024
|
+
};
|
|
4025
|
+
const onMouseLeave = (e) => {
|
|
4026
|
+
setVisibilityState(void 0);
|
|
4027
|
+
anchorElement.props.onMouseLeave?.(e);
|
|
4028
|
+
};
|
|
4029
|
+
const onClick = (e) => {
|
|
4030
|
+
if (clickContent) {
|
|
4031
|
+
setVisibilityState("click");
|
|
4032
|
+
}
|
|
4033
|
+
anchorElement.props.onClick?.(e);
|
|
4034
|
+
};
|
|
4035
|
+
const onFocus = (e) => {
|
|
4036
|
+
if (hoverContent) {
|
|
4037
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
4038
|
+
setMouseX(rect.left + rect.width / 2);
|
|
4039
|
+
setVisibilityState("hover");
|
|
4040
|
+
}
|
|
4041
|
+
anchorElement.props.onFocus?.(e);
|
|
4042
|
+
};
|
|
4043
|
+
const onBlur = (e) => {
|
|
4044
|
+
setVisibilityState(void 0);
|
|
4045
|
+
anchorElement.props.onBlur?.(e);
|
|
4046
|
+
};
|
|
4047
|
+
if (anchorElement.type === react.Fragment) {
|
|
4048
|
+
throw new Error("Fragment children is not supported in CubeTooltip");
|
|
4049
|
+
}
|
|
4050
|
+
const ariaDescribedBy = [anchorElement.props["aria-describedby"], isVisible ? tooltipId : null].filter(Boolean).join(" ") || void 0;
|
|
4051
|
+
const clonedAnchor = react.cloneElement(anchorElement, {
|
|
4052
|
+
ref: (element) => {
|
|
4053
|
+
const { ref: anchorRefProp } = anchorElement.props;
|
|
4054
|
+
assignRefValue(anchorRefProp, element);
|
|
4055
|
+
assignRefValue(anchorRef, element);
|
|
4056
|
+
},
|
|
4057
|
+
onMouseEnter,
|
|
4058
|
+
onMouseMove,
|
|
4059
|
+
onMouseLeave,
|
|
4060
|
+
onClick,
|
|
4061
|
+
onFocus,
|
|
4062
|
+
onBlur,
|
|
4063
|
+
"aria-describedby": ariaDescribedBy
|
|
4064
|
+
});
|
|
4065
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4066
|
+
clonedAnchor,
|
|
4067
|
+
visibilityState !== void 0 && infoMap[visibilityState] && reactDom.createPortal(
|
|
4068
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4069
|
+
InfoBox,
|
|
4070
|
+
{
|
|
4071
|
+
id: tooltipId,
|
|
4072
|
+
information: infoMap[visibilityState],
|
|
4073
|
+
placement,
|
|
4074
|
+
mouseX,
|
|
4075
|
+
anchorRef
|
|
4076
|
+
},
|
|
4077
|
+
visibilityState
|
|
4078
|
+
),
|
|
4079
|
+
document.body
|
|
4080
|
+
)
|
|
4081
|
+
] });
|
|
4082
|
+
};
|
|
4083
|
+
|
|
4084
|
+
// src/i18n/addCubeUiTranslations.ts
|
|
4085
|
+
function addCubeUiTranslations(locale, resources) {
|
|
4086
|
+
i18n_default.addResourceBundle(locale, "translation", resources, true, true);
|
|
4087
|
+
if (i18n_default.isInitialized) {
|
|
4088
|
+
i18n_default.emit("languageChanged", i18n_default.language);
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
var CubeUiLocaleProvider = (props) => {
|
|
4092
|
+
const { locale, children } = props;
|
|
4093
|
+
react.useEffect(() => {
|
|
4094
|
+
i18n_default.changeLanguage(locale);
|
|
4095
|
+
}, [locale]);
|
|
4096
|
+
return children;
|
|
4097
|
+
};
|
|
801
4098
|
var CubeThemeProvider = (props) => {
|
|
802
4099
|
const { theme, children } = props;
|
|
803
4100
|
react.useEffect(() => {
|
|
@@ -1466,13 +4763,26 @@ var cubePreset = {
|
|
|
1466
4763
|
};
|
|
1467
4764
|
|
|
1468
4765
|
exports.CubeButton = CubeButton;
|
|
1469
|
-
exports.
|
|
4766
|
+
exports.CubeCheckbox = CubeCheckbox;
|
|
4767
|
+
exports.CubeDropdown = CubeDropdown;
|
|
4768
|
+
exports.CubeHyperlink = CubeHyperlink;
|
|
1470
4769
|
exports.CubeIconFrame = CubeIconFrame;
|
|
1471
4770
|
exports.CubeInput = CubeInput;
|
|
1472
4771
|
exports.CubeLoadingSpinner = CubeLoadingSpinner;
|
|
4772
|
+
exports.CubeOverflowMenu = CubeOverflowMenu;
|
|
1473
4773
|
exports.CubePasswordInput = CubePasswordInput;
|
|
4774
|
+
exports.CubeRadioButton = CubeRadioButton;
|
|
1474
4775
|
exports.CubeSkeleton = CubeSkeleton;
|
|
4776
|
+
exports.CubeStatus = CubeStatus;
|
|
4777
|
+
exports.CubeStatusReaction = CubeStatusReaction;
|
|
4778
|
+
exports.CubeStepProcess = CubeStepProcess;
|
|
4779
|
+
exports.CubeStroke = CubeStroke;
|
|
4780
|
+
exports.CubeTabs = CubeTabs;
|
|
4781
|
+
exports.CubeTag = CubeTag;
|
|
4782
|
+
exports.CubeTextarea = CubeTextarea;
|
|
1475
4783
|
exports.CubeThemeProvider = CubeThemeProvider;
|
|
4784
|
+
exports.CubeToggle = CubeToggle;
|
|
4785
|
+
exports.CubeTooltip = CubeTooltip;
|
|
1476
4786
|
exports.CubeUiLocaleProvider = CubeUiLocaleProvider;
|
|
1477
4787
|
exports.addCubeUiTranslations = addCubeUiTranslations;
|
|
1478
4788
|
exports.cubePreset = cubePreset;
|