@bigstack-oss/cube-ui 0.1.0 → 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 +433 -0
- package/dist/index.d.cts +286 -26
- package/dist/index.d.ts +286 -26
- package/dist/index.js +2162 -310
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2163 -317
- package/dist/index.mjs.map +1 -1
- 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 }; }
|
|
@@ -582,6 +583,56 @@ var SvgCheckboxUndeterminateFilled = ({
|
|
|
582
583
|
] });
|
|
583
584
|
var ForwardRef3 = react.forwardRef(SvgCheckboxUndeterminateFilled);
|
|
584
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;
|
|
585
636
|
var SvgRadioButton = ({
|
|
586
637
|
title,
|
|
587
638
|
titleId,
|
|
@@ -590,8 +641,8 @@ var SvgRadioButton = ({
|
|
|
590
641
|
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
591
642
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: 8, cy: 8, r: 6.5, stroke: "currentColor", strokeWidth: 1.2 })
|
|
592
643
|
] });
|
|
593
|
-
var
|
|
594
|
-
var RadioButton_default =
|
|
644
|
+
var ForwardRef9 = react.forwardRef(SvgRadioButton);
|
|
645
|
+
var RadioButton_default = ForwardRef9;
|
|
595
646
|
var SvgRadioButtonFilled = ({
|
|
596
647
|
title,
|
|
597
648
|
titleId,
|
|
@@ -601,8 +652,18 @@ var SvgRadioButtonFilled = ({
|
|
|
601
652
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: 8, cy: 8, r: 6.5, stroke: "currentColor", strokeWidth: 1.2 }),
|
|
602
653
|
/* @__PURE__ */ jsxRuntime.jsx("path", { fill: "currentColor", d: "M8 13A5 5 0 1 0 8 3a5 5 0 0 0 0 10" })
|
|
603
654
|
] });
|
|
604
|
-
var
|
|
605
|
-
var RadioButtonFilled_default =
|
|
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;
|
|
606
667
|
var SvgView = ({
|
|
607
668
|
title,
|
|
608
669
|
titleId,
|
|
@@ -611,8 +672,8 @@ var SvgView = ({
|
|
|
611
672
|
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
612
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" })
|
|
613
674
|
] });
|
|
614
|
-
var
|
|
615
|
-
var View_default =
|
|
675
|
+
var ForwardRef12 = react.forwardRef(SvgView);
|
|
676
|
+
var View_default = ForwardRef12;
|
|
616
677
|
var SvgViewOff = ({
|
|
617
678
|
title,
|
|
618
679
|
titleId,
|
|
@@ -621,8 +682,8 @@ var SvgViewOff = ({
|
|
|
621
682
|
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
622
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" })
|
|
623
684
|
] });
|
|
624
|
-
var
|
|
625
|
-
var ViewOff_default =
|
|
685
|
+
var ForwardRef13 = react.forwardRef(SvgViewOff);
|
|
686
|
+
var ViewOff_default = ForwardRef13;
|
|
626
687
|
var SvgWarningFilled = ({
|
|
627
688
|
title,
|
|
628
689
|
titleId,
|
|
@@ -631,8 +692,8 @@ var SvgWarningFilled = ({
|
|
|
631
692
|
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
632
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" })
|
|
633
694
|
] });
|
|
634
|
-
var
|
|
635
|
-
var WarningFilled_default =
|
|
695
|
+
var ForwardRef14 = react.forwardRef(SvgWarningFilled);
|
|
696
|
+
var WarningFilled_default = ForwardRef14;
|
|
636
697
|
var SvgX = ({
|
|
637
698
|
title,
|
|
638
699
|
titleId,
|
|
@@ -641,8 +702,18 @@ var SvgX = ({
|
|
|
641
702
|
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { id: titleId, children: title }) : null,
|
|
642
703
|
/* @__PURE__ */ jsxRuntime.jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.2, d: "m12.5 3.5-9 9m9 0-9-9" })
|
|
643
704
|
] });
|
|
644
|
-
var
|
|
645
|
-
var X_default =
|
|
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;
|
|
646
717
|
var container = classVarianceAuthority.cva(
|
|
647
718
|
"inline-flex w-fit cursor-pointer items-start gap-x-2",
|
|
648
719
|
{
|
|
@@ -801,7 +872,7 @@ var CubeCheckbox = (props) => {
|
|
|
801
872
|
const {
|
|
802
873
|
containerClassName,
|
|
803
874
|
color = "primary",
|
|
804
|
-
label:
|
|
875
|
+
label: label6,
|
|
805
876
|
labelSize = "md",
|
|
806
877
|
labelClassName,
|
|
807
878
|
id,
|
|
@@ -866,11 +937,11 @@ var CubeCheckbox = (props) => {
|
|
|
866
937
|
}
|
|
867
938
|
),
|
|
868
939
|
renderIcon(),
|
|
869
|
-
|
|
940
|
+
label6 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
870
941
|
"span",
|
|
871
942
|
{
|
|
872
943
|
className: tailwindMerge.twMerge(label({ color, disabled }), labelClassName),
|
|
873
|
-
children:
|
|
944
|
+
children: label6
|
|
874
945
|
}
|
|
875
946
|
)
|
|
876
947
|
]
|
|
@@ -879,176 +950,1326 @@ var CubeCheckbox = (props) => {
|
|
|
879
950
|
};
|
|
880
951
|
CubeCheckbox.Skeleton = CubeCheckboxSkeleton;
|
|
881
952
|
CubeCheckbox.Grid = CubeCheckboxGrid;
|
|
882
|
-
var
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
"hover:text-functional-hover-primary",
|
|
890
|
-
"visited:text-primary-700"
|
|
891
|
-
],
|
|
892
|
-
secondary: [
|
|
893
|
-
"text-functional-border-darker",
|
|
894
|
-
"hover:text-functional-text-light",
|
|
895
|
-
"visited:text-functional-border-darker"
|
|
896
|
-
]
|
|
897
|
-
},
|
|
898
|
-
size: {
|
|
899
|
-
md: "primary-body2",
|
|
900
|
-
sm: "primary-body4"
|
|
901
|
-
},
|
|
902
|
-
variant: {
|
|
903
|
-
"text-only": "",
|
|
904
|
-
"text-inline": "underline underline-offset-4",
|
|
905
|
-
"icon-left": "",
|
|
906
|
-
"icon-right": ""
|
|
907
|
-
},
|
|
908
|
-
disabled: {
|
|
909
|
-
true: "text-functional-disable-text hover:cursor-default hover:text-functional-disable-text"
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
);
|
|
914
|
-
var sizeMapping = {
|
|
915
|
-
sm: { iconSize: "sm", iconFrameSize: "size-[15px]" },
|
|
916
|
-
md: { iconSize: "md-sm", iconFrameSize: "size-[17px]" }
|
|
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];
|
|
917
960
|
};
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
href,
|
|
927
|
-
target,
|
|
928
|
-
onClick
|
|
929
|
-
} = props;
|
|
930
|
-
if (!href && !onClick) {
|
|
931
|
-
console.warn(
|
|
932
|
-
"CubeHyperlink: href or onClick must be provided to make the hyperlink interactive"
|
|
933
|
-
);
|
|
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);
|
|
934
969
|
}
|
|
935
|
-
|
|
936
|
-
if (
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
if (props.variant !== iconVariant) {
|
|
941
|
-
return null;
|
|
970
|
+
if (horizontal !== "follow-cursor") {
|
|
971
|
+
if (overflowPx.left > 0) {
|
|
972
|
+
newHorizontal = "left";
|
|
973
|
+
} else if (overflowPx.right > 0) {
|
|
974
|
+
newHorizontal = "right";
|
|
942
975
|
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
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"
|
|
953
986
|
};
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
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
|
|
1001
|
+
};
|
|
1002
|
+
},
|
|
1003
|
+
center: (anchorDomRect, elementWidth) => {
|
|
1004
|
+
const left = anchorDomRect.left + anchorDomRect.width / 2 - elementWidth / 2;
|
|
1005
|
+
return {
|
|
1006
|
+
left,
|
|
1007
|
+
right: left + elementWidth
|
|
1008
|
+
};
|
|
1009
|
+
},
|
|
1010
|
+
right: (anchorDomRect, elementWidth, xOffset) => {
|
|
1011
|
+
const right = anchorDomRect.right + xOffset;
|
|
1012
|
+
return {
|
|
1013
|
+
left: right - elementWidth,
|
|
1014
|
+
right
|
|
1015
|
+
};
|
|
1016
|
+
},
|
|
1017
|
+
"follow-cursor": (_anchorDomRect, elementWidth, _xOffset, mouseX) => {
|
|
1018
|
+
const left = mouseX - elementWidth / 2;
|
|
1019
|
+
return {
|
|
1020
|
+
left,
|
|
1021
|
+
right: left + elementWidth
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
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
|
|
973
1067
|
};
|
|
974
|
-
return renderHyperlink();
|
|
975
1068
|
};
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
const
|
|
980
|
-
|
|
981
|
-
|
|
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;
|
|
982
1081
|
};
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
{
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
},
|
|
999
|
-
disabled: {
|
|
1000
|
-
true: [
|
|
1001
|
-
"disabled:border-functional-disable-text disabled:text-functional-disable-text disabled:placeholder:text-functional-border-divider",
|
|
1002
|
-
"disabled:hover:border-functional-disable-text"
|
|
1003
|
-
]
|
|
1004
|
-
},
|
|
1005
|
-
hasIcon: {
|
|
1006
|
-
true: "pl-4 pr-8",
|
|
1007
|
-
false: "px-4"
|
|
1008
|
-
}
|
|
1009
|
-
},
|
|
1010
|
-
compoundVariants: [
|
|
1011
|
-
{ isError: true, hasIcon: true, class: "pr-[56px]" },
|
|
1012
|
-
{ isError: true, hasIcon: false, class: "pr-9" }
|
|
1013
|
-
]
|
|
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;
|
|
1014
1097
|
}
|
|
1015
|
-
)
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
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
|
+
);
|
|
1021
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
|
+
};
|
|
1022
1133
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
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
|
+
};
|
|
1030
1143
|
}
|
|
1031
|
-
}
|
|
1032
|
-
var
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
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;
|
|
1038
1173
|
}
|
|
1039
|
-
}
|
|
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
|
|
1040
1210
|
});
|
|
1041
|
-
var
|
|
1042
|
-
const {
|
|
1043
|
-
|
|
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
|
|
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
|
+
};
|
|
1044
1247
|
};
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1248
|
+
|
|
1249
|
+
// src/i18n/resources/en-US.json
|
|
1250
|
+
var en_US_default = {
|
|
1251
|
+
"component.common.loading": "Loading",
|
|
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"
|
|
1277
|
+
};
|
|
1278
|
+
|
|
1279
|
+
// src/i18n/resources/zh-TW.json
|
|
1280
|
+
var zh_TW_default = {
|
|
1281
|
+
"component.common.loading": "\u8F09\u5165\u4E2D",
|
|
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"
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
// src/i18n/i18n.ts
|
|
1310
|
+
var i18n = i18next__default.default.createInstance();
|
|
1311
|
+
i18n.use(reactI18next.initReactI18next).init({
|
|
1312
|
+
resources: {
|
|
1313
|
+
"en-US": { translation: en_US_default },
|
|
1314
|
+
"zh-TW": { translation: zh_TW_default }
|
|
1315
|
+
},
|
|
1316
|
+
lng: "en-US",
|
|
1317
|
+
fallbackLng: "en-US",
|
|
1318
|
+
interpolation: {
|
|
1319
|
+
escapeValue: false
|
|
1320
|
+
// react already escapes from xss
|
|
1321
|
+
}
|
|
1322
|
+
});
|
|
1323
|
+
var i18n_default = i18n;
|
|
1324
|
+
|
|
1325
|
+
// src/i18n/useCubeUiTranslation.ts
|
|
1326
|
+
var useCubeUiTranslation = (ns, options) => {
|
|
1327
|
+
return reactI18next.useTranslation(ns, { ...options, i18n: i18n_default });
|
|
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,
|
|
1052
2273
|
tooltip,
|
|
1053
2274
|
helpMessage,
|
|
1054
2275
|
errorMessage,
|
|
@@ -1062,7 +2283,7 @@ var CubeInput = Object.assign(
|
|
|
1062
2283
|
const hasFooter = !!helpMessage || isError;
|
|
1063
2284
|
const hasIcon = !!trailingIcon;
|
|
1064
2285
|
const renderLabel = () => {
|
|
1065
|
-
if (!
|
|
2286
|
+
if (!label6 && !tooltip) return null;
|
|
1066
2287
|
if (isLoading) return /* @__PURE__ */ jsxRuntime.jsx(CubeInputSkeleton, { type: "label" });
|
|
1067
2288
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "primary-body2 flex items-center space-x-1", children: [
|
|
1068
2289
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -1070,7 +2291,7 @@ var CubeInput = Object.assign(
|
|
|
1070
2291
|
{
|
|
1071
2292
|
htmlFor: inputId,
|
|
1072
2293
|
className: "font-semibold text-functional-title",
|
|
1073
|
-
children:
|
|
2294
|
+
children: label6
|
|
1074
2295
|
}
|
|
1075
2296
|
),
|
|
1076
2297
|
required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-status-negative", children: "*" }),
|
|
@@ -1129,6 +2350,330 @@ var CubeInput = Object.assign(
|
|
|
1129
2350
|
{ Skeleton: CubeInputSkeleton }
|
|
1130
2351
|
);
|
|
1131
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;
|
|
1132
2677
|
var CubePasswordInput = (props) => {
|
|
1133
2678
|
const { initialShowPassword = false, disabled, ...restProps } = props;
|
|
1134
2679
|
const [showPassword, setShowPassword] = react.useState(initialShowPassword);
|
|
@@ -1172,7 +2717,7 @@ var iconWrap2 = classVarianceAuthority.cva(
|
|
|
1172
2717
|
}
|
|
1173
2718
|
}
|
|
1174
2719
|
);
|
|
1175
|
-
var
|
|
2720
|
+
var label4 = classVarianceAuthority.cva("max-w-[152px] break-words text-functional-text", {
|
|
1176
2721
|
variants: {
|
|
1177
2722
|
disabled: {
|
|
1178
2723
|
true: "text-functional-disable-text"
|
|
@@ -1195,7 +2740,7 @@ var CubeRadioButtonGrid = (props) => {
|
|
|
1195
2740
|
};
|
|
1196
2741
|
var CubeRadioButton = (props) => {
|
|
1197
2742
|
const {
|
|
1198
|
-
label:
|
|
2743
|
+
label: label6,
|
|
1199
2744
|
id,
|
|
1200
2745
|
ref,
|
|
1201
2746
|
defaultChecked = false,
|
|
@@ -1242,11 +2787,245 @@ var CubeRadioButton = (props) => {
|
|
|
1242
2787
|
}
|
|
1243
2788
|
),
|
|
1244
2789
|
renderIcon(),
|
|
1245
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: tailwindMerge.twMerge(
|
|
2790
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: tailwindMerge.twMerge(label4({ disabled })), children: label6 })
|
|
1246
2791
|
] });
|
|
1247
2792
|
};
|
|
1248
2793
|
CubeRadioButton.Skeleton = CubeRadioButtonSkeleton;
|
|
1249
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;
|
|
1250
3029
|
var stroke = classVarianceAuthority.cva("", {
|
|
1251
3030
|
variants: {
|
|
1252
3031
|
type: {
|
|
@@ -1327,8 +3106,8 @@ var numberSpan = classVarianceAuthority.cva(
|
|
|
1327
3106
|
}
|
|
1328
3107
|
);
|
|
1329
3108
|
var NumberSpan = (props) => {
|
|
1330
|
-
const { number, disabled } = props;
|
|
1331
|
-
const text =
|
|
3109
|
+
const { number: number2, disabled } = props;
|
|
3110
|
+
const text = number2 > 99 ? "N" : number2;
|
|
1332
3111
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1333
3112
|
"span",
|
|
1334
3113
|
{
|
|
@@ -1367,7 +3146,7 @@ var CubeTab = (props) => {
|
|
|
1367
3146
|
href,
|
|
1368
3147
|
isActive,
|
|
1369
3148
|
disabled = false,
|
|
1370
|
-
number,
|
|
3149
|
+
number: number2,
|
|
1371
3150
|
dot,
|
|
1372
3151
|
onClick: onClickProp
|
|
1373
3152
|
} = props;
|
|
@@ -1389,8 +3168,8 @@ var CubeTab = (props) => {
|
|
|
1389
3168
|
}
|
|
1390
3169
|
);
|
|
1391
3170
|
const renderDecoration = () => {
|
|
1392
|
-
if (
|
|
1393
|
-
return /* @__PURE__ */ jsxRuntime.jsx(NumberSpan, { number, disabled });
|
|
3171
|
+
if (number2 !== void 0) {
|
|
3172
|
+
return /* @__PURE__ */ jsxRuntime.jsx(NumberSpan, { number: number2, disabled });
|
|
1394
3173
|
} else if (dot) {
|
|
1395
3174
|
return /* @__PURE__ */ jsxRuntime.jsx(DotSpan, { disabled });
|
|
1396
3175
|
} else {
|
|
@@ -1957,26 +3736,6 @@ var CubeTextareaSkeleton = () => /* @__PURE__ */ jsxRuntime.jsxs("div", { classN
|
|
|
1957
3736
|
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-[20px] min-w-[280px] max-w-[380px]" }),
|
|
1958
3737
|
/* @__PURE__ */ jsxRuntime.jsx(CubeSkeleton, { className: "h-[140px] min-w-[280px] max-w-[380px]" })
|
|
1959
3738
|
] });
|
|
1960
|
-
|
|
1961
|
-
// src/components/CubeTextarea/cubeTextareaUtils.ts
|
|
1962
|
-
var normalizeValue = (value) => {
|
|
1963
|
-
if (typeof value === "string") return value;
|
|
1964
|
-
if (typeof value === "number") return value.toString();
|
|
1965
|
-
if (Array.isArray(value)) return value.join("");
|
|
1966
|
-
return "";
|
|
1967
|
-
};
|
|
1968
|
-
var calculateValueLength = (value) => {
|
|
1969
|
-
const normalizedValue = normalizeValue(value);
|
|
1970
|
-
return normalizedValue.length;
|
|
1971
|
-
};
|
|
1972
|
-
var assignRefValue = (ref, element) => {
|
|
1973
|
-
if (!ref) return;
|
|
1974
|
-
if (typeof ref === "function") {
|
|
1975
|
-
ref(element);
|
|
1976
|
-
} else {
|
|
1977
|
-
ref.current = element;
|
|
1978
|
-
}
|
|
1979
|
-
};
|
|
1980
3739
|
var useVisibleRowsCount = () => {
|
|
1981
3740
|
const textareaRef = react.useRef(null);
|
|
1982
3741
|
const [visibleRowsCount, setVisibleRowsCount] = react.useState(0);
|
|
@@ -2033,7 +3792,7 @@ var CubeTextarea = (props) => {
|
|
|
2033
3792
|
disabled,
|
|
2034
3793
|
value: valueProps,
|
|
2035
3794
|
onChange,
|
|
2036
|
-
label:
|
|
3795
|
+
label: label6,
|
|
2037
3796
|
maxLength,
|
|
2038
3797
|
isLoading,
|
|
2039
3798
|
errorMessage,
|
|
@@ -2064,7 +3823,7 @@ var CubeTextarea = (props) => {
|
|
|
2064
3823
|
{
|
|
2065
3824
|
htmlFor: textareaId,
|
|
2066
3825
|
className: "primary-body2 font-semibold text-functional-text",
|
|
2067
|
-
children:
|
|
3826
|
+
children: label6
|
|
2068
3827
|
}
|
|
2069
3828
|
),
|
|
2070
3829
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "secondary-body4 text-functional-text-light", children: [
|
|
@@ -2103,134 +3862,224 @@ var CubeTextarea = (props) => {
|
|
|
2103
3862
|
] });
|
|
2104
3863
|
};
|
|
2105
3864
|
CubeTextarea.Skeleton = CubeTextareaSkeleton;
|
|
2106
|
-
var
|
|
2107
|
-
"
|
|
3865
|
+
var caret = classVarianceAuthority.cva(
|
|
3866
|
+
"inline-block size-0 border-[6px] border-t-0 border-solid border-transparent border-b-dark-700",
|
|
2108
3867
|
{
|
|
2109
3868
|
variants: {
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
false: "cursor-pointer",
|
|
2116
|
-
true: "cursor-default"
|
|
2117
|
-
}
|
|
2118
|
-
},
|
|
2119
|
-
compoundVariants: [
|
|
2120
|
-
// Not disabled
|
|
2121
|
-
{
|
|
2122
|
-
checked: true,
|
|
2123
|
-
disabled: false,
|
|
2124
|
-
className: "hover:bg-green-400"
|
|
2125
|
-
},
|
|
2126
|
-
{
|
|
2127
|
-
checked: false,
|
|
2128
|
-
disabled: false,
|
|
2129
|
-
className: "hover:bg-grey-400"
|
|
2130
|
-
},
|
|
2131
|
-
// Disabled
|
|
2132
|
-
{
|
|
2133
|
-
checked: true,
|
|
2134
|
-
disabled: true,
|
|
2135
|
-
className: "border-green-200 bg-green-100"
|
|
2136
|
-
},
|
|
2137
|
-
{
|
|
2138
|
-
checked: false,
|
|
2139
|
-
disabled: true,
|
|
2140
|
-
className: "border-functional-disable bg-grey-150"
|
|
3869
|
+
horizontalPlacement: {
|
|
3870
|
+
left: "ml-4 self-start",
|
|
3871
|
+
center: "self-center",
|
|
3872
|
+
right: "mr-4 self-end",
|
|
3873
|
+
"follow-cursor": "self-center"
|
|
2141
3874
|
}
|
|
2142
|
-
|
|
3875
|
+
}
|
|
2143
3876
|
}
|
|
2144
3877
|
);
|
|
2145
|
-
var
|
|
2146
|
-
"
|
|
3878
|
+
var infoBoxContainer = classVarianceAuthority.cva(
|
|
3879
|
+
"pointer-events-none flex min-w-[50px] max-w-[480px]",
|
|
2147
3880
|
{
|
|
2148
3881
|
variants: {
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
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"
|
|
2152
3894
|
}
|
|
2153
3895
|
}
|
|
2154
3896
|
}
|
|
2155
3897
|
);
|
|
2156
|
-
var
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
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;
|
|
2161
3906
|
}
|
|
2162
|
-
|
|
2163
|
-
})
|
|
2164
|
-
|
|
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) => {
|
|
2165
3924
|
const {
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
"aria-label": ariaLabel
|
|
3925
|
+
id,
|
|
3926
|
+
information: { title, subtext, message },
|
|
3927
|
+
placement,
|
|
3928
|
+
mouseX,
|
|
3929
|
+
anchorRef
|
|
2172
3930
|
} = props;
|
|
2173
|
-
const
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
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
|
+
] });
|
|
2178
3955
|
};
|
|
2179
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3956
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2180
3957
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2181
|
-
"
|
|
3958
|
+
"div",
|
|
2182
3959
|
{
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
disabled,
|
|
2191
|
-
onClick: toggleChecked,
|
|
2192
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: thumb({ checked }), "aria-hidden": true })
|
|
3960
|
+
ref: elementRef,
|
|
3961
|
+
"aria-hidden": true,
|
|
3962
|
+
className: infoBoxContainer({
|
|
3963
|
+
verticalPlacement,
|
|
3964
|
+
isMeasuring: true
|
|
3965
|
+
}),
|
|
3966
|
+
children: renderContent()
|
|
2193
3967
|
}
|
|
2194
3968
|
),
|
|
2195
|
-
|
|
2196
|
-
"
|
|
3969
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3970
|
+
"div",
|
|
2197
3971
|
{
|
|
2198
|
-
id
|
|
2199
|
-
|
|
2200
|
-
className:
|
|
2201
|
-
|
|
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
|
+
]
|
|
2202
3983
|
}
|
|
2203
3984
|
)
|
|
2204
3985
|
] });
|
|
2205
3986
|
};
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
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");
|
|
2231
4049
|
}
|
|
2232
|
-
|
|
2233
|
-
|
|
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
|
+
};
|
|
2234
4083
|
|
|
2235
4084
|
// src/i18n/addCubeUiTranslations.ts
|
|
2236
4085
|
function addCubeUiTranslations(locale, resources) {
|
|
@@ -2246,9 +4095,6 @@ var CubeUiLocaleProvider = (props) => {
|
|
|
2246
4095
|
}, [locale]);
|
|
2247
4096
|
return children;
|
|
2248
4097
|
};
|
|
2249
|
-
var useCubeUiTranslation = (ns, options) => {
|
|
2250
|
-
return reactI18next.useTranslation(ns, { ...options, i18n: i18n_default });
|
|
2251
|
-
};
|
|
2252
4098
|
var CubeThemeProvider = (props) => {
|
|
2253
4099
|
const { theme, children } = props;
|
|
2254
4100
|
react.useEffect(() => {
|
|
@@ -2918,19 +4764,25 @@ var cubePreset = {
|
|
|
2918
4764
|
|
|
2919
4765
|
exports.CubeButton = CubeButton;
|
|
2920
4766
|
exports.CubeCheckbox = CubeCheckbox;
|
|
4767
|
+
exports.CubeDropdown = CubeDropdown;
|
|
2921
4768
|
exports.CubeHyperlink = CubeHyperlink;
|
|
2922
4769
|
exports.CubeIconFrame = CubeIconFrame;
|
|
2923
4770
|
exports.CubeInput = CubeInput;
|
|
2924
4771
|
exports.CubeLoadingSpinner = CubeLoadingSpinner;
|
|
4772
|
+
exports.CubeOverflowMenu = CubeOverflowMenu;
|
|
2925
4773
|
exports.CubePasswordInput = CubePasswordInput;
|
|
2926
4774
|
exports.CubeRadioButton = CubeRadioButton;
|
|
2927
4775
|
exports.CubeSkeleton = CubeSkeleton;
|
|
4776
|
+
exports.CubeStatus = CubeStatus;
|
|
4777
|
+
exports.CubeStatusReaction = CubeStatusReaction;
|
|
4778
|
+
exports.CubeStepProcess = CubeStepProcess;
|
|
2928
4779
|
exports.CubeStroke = CubeStroke;
|
|
2929
4780
|
exports.CubeTabs = CubeTabs;
|
|
2930
4781
|
exports.CubeTag = CubeTag;
|
|
2931
4782
|
exports.CubeTextarea = CubeTextarea;
|
|
2932
4783
|
exports.CubeThemeProvider = CubeThemeProvider;
|
|
2933
4784
|
exports.CubeToggle = CubeToggle;
|
|
4785
|
+
exports.CubeTooltip = CubeTooltip;
|
|
2934
4786
|
exports.CubeUiLocaleProvider = CubeUiLocaleProvider;
|
|
2935
4787
|
exports.addCubeUiTranslations = addCubeUiTranslations;
|
|
2936
4788
|
exports.cubePreset = cubePreset;
|