@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.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { omit } from 'lodash';
|
|
1
|
+
import { omit, upperFirst, range, debounce } from 'lodash';
|
|
2
2
|
import { twMerge, twJoin } from 'tailwind-merge';
|
|
3
3
|
import { cva } from 'class-variance-authority';
|
|
4
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import { forwardRef, useId, cloneElement, useState, useEffect, createElement,
|
|
6
|
-
import i18next from 'i18next';
|
|
4
|
+
import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
5
|
+
import { forwardRef, createContext, useId, cloneElement, useState, useCallback, useEffect, useRef, Fragment, createElement, useContext, useMemo, Children, isValidElement } from 'react';
|
|
7
6
|
import { initReactI18next, useTranslation } from 'react-i18next';
|
|
7
|
+
import i18next from 'i18next';
|
|
8
|
+
import { createPortal } from 'react-dom';
|
|
8
9
|
import defaultTheme from 'tailwindcss/defaultTheme';
|
|
9
10
|
|
|
10
11
|
// src/components/CubeButton/CubeButton.tsx
|
|
@@ -512,18 +513,18 @@ var CubeButton = (props) => {
|
|
|
512
513
|
case "icon-only":
|
|
513
514
|
return renderIcon(props.Icon);
|
|
514
515
|
case "icon-left":
|
|
515
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
516
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
516
517
|
renderIcon(props.Icon),
|
|
517
518
|
props.children
|
|
518
519
|
] });
|
|
519
520
|
case "icon-right":
|
|
520
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
521
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
521
522
|
props.children,
|
|
522
523
|
renderIcon(props.Icon)
|
|
523
524
|
] });
|
|
524
525
|
case "text-only":
|
|
525
526
|
default:
|
|
526
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
527
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
527
528
|
props.children,
|
|
528
529
|
loading && /* @__PURE__ */ jsx(CubeButtonLoadingSpinner, { type, usage })
|
|
529
530
|
] });
|
|
@@ -575,6 +576,56 @@ var SvgCheckboxUndeterminateFilled = ({
|
|
|
575
576
|
] });
|
|
576
577
|
var ForwardRef3 = forwardRef(SvgCheckboxUndeterminateFilled);
|
|
577
578
|
var CheckboxUndeterminateFilled_default = ForwardRef3;
|
|
579
|
+
var SvgCheckmarkBold = ({
|
|
580
|
+
title,
|
|
581
|
+
titleId,
|
|
582
|
+
...props
|
|
583
|
+
}, ref) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
584
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
585
|
+
/* @__PURE__ */ jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m3 7.3 3.75 4.2 6.25-7" })
|
|
586
|
+
] });
|
|
587
|
+
var ForwardRef4 = forwardRef(SvgCheckmarkBold);
|
|
588
|
+
var CheckmarkBold_default = ForwardRef4;
|
|
589
|
+
var SvgCheckmarkCircleFill = ({
|
|
590
|
+
title,
|
|
591
|
+
titleId,
|
|
592
|
+
...props
|
|
593
|
+
}, ref) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
594
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
595
|
+
/* @__PURE__ */ 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" })
|
|
596
|
+
] });
|
|
597
|
+
var ForwardRef5 = forwardRef(SvgCheckmarkCircleFill);
|
|
598
|
+
var CheckmarkCircleFill_default = ForwardRef5;
|
|
599
|
+
var SvgChevronDown = ({
|
|
600
|
+
title,
|
|
601
|
+
titleId,
|
|
602
|
+
...props
|
|
603
|
+
}, ref) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
604
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
605
|
+
/* @__PURE__ */ jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2, d: "M12.5 5.75 8 10.25l-4.5-4.5" })
|
|
606
|
+
] });
|
|
607
|
+
var ForwardRef6 = forwardRef(SvgChevronDown);
|
|
608
|
+
var ChevronDown_default = ForwardRef6;
|
|
609
|
+
var SvgChevronRight = ({
|
|
610
|
+
title,
|
|
611
|
+
titleId,
|
|
612
|
+
...props
|
|
613
|
+
}, ref) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
614
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
615
|
+
/* @__PURE__ */ jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.2, d: "m5.75 3.5 4.5 4.5-4.5 4.5" })
|
|
616
|
+
] });
|
|
617
|
+
var ForwardRef7 = forwardRef(SvgChevronRight);
|
|
618
|
+
var ChevronRight_default = ForwardRef7;
|
|
619
|
+
var SvgCrossFill = ({
|
|
620
|
+
title,
|
|
621
|
+
titleId,
|
|
622
|
+
...props
|
|
623
|
+
}, ref) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
624
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
625
|
+
/* @__PURE__ */ 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" })
|
|
626
|
+
] });
|
|
627
|
+
var ForwardRef8 = forwardRef(SvgCrossFill);
|
|
628
|
+
var CrossFill_default = ForwardRef8;
|
|
578
629
|
var SvgRadioButton = ({
|
|
579
630
|
title,
|
|
580
631
|
titleId,
|
|
@@ -583,8 +634,8 @@ var SvgRadioButton = ({
|
|
|
583
634
|
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
584
635
|
/* @__PURE__ */ jsx("circle", { cx: 8, cy: 8, r: 6.5, stroke: "currentColor", strokeWidth: 1.2 })
|
|
585
636
|
] });
|
|
586
|
-
var
|
|
587
|
-
var RadioButton_default =
|
|
637
|
+
var ForwardRef9 = forwardRef(SvgRadioButton);
|
|
638
|
+
var RadioButton_default = ForwardRef9;
|
|
588
639
|
var SvgRadioButtonFilled = ({
|
|
589
640
|
title,
|
|
590
641
|
titleId,
|
|
@@ -594,8 +645,18 @@ var SvgRadioButtonFilled = ({
|
|
|
594
645
|
/* @__PURE__ */ jsx("circle", { cx: 8, cy: 8, r: 6.5, stroke: "currentColor", strokeWidth: 1.2 }),
|
|
595
646
|
/* @__PURE__ */ jsx("path", { fill: "currentColor", d: "M8 13A5 5 0 1 0 8 3a5 5 0 0 0 0 10" })
|
|
596
647
|
] });
|
|
597
|
-
var
|
|
598
|
-
var RadioButtonFilled_default =
|
|
648
|
+
var ForwardRef10 = forwardRef(SvgRadioButtonFilled);
|
|
649
|
+
var RadioButtonFilled_default = ForwardRef10;
|
|
650
|
+
var SvgSearch = ({
|
|
651
|
+
title,
|
|
652
|
+
titleId,
|
|
653
|
+
...props
|
|
654
|
+
}, ref) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
655
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
656
|
+
/* @__PURE__ */ 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" })
|
|
657
|
+
] });
|
|
658
|
+
var ForwardRef11 = forwardRef(SvgSearch);
|
|
659
|
+
var Search_default = ForwardRef11;
|
|
599
660
|
var SvgView = ({
|
|
600
661
|
title,
|
|
601
662
|
titleId,
|
|
@@ -604,8 +665,8 @@ var SvgView = ({
|
|
|
604
665
|
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
605
666
|
/* @__PURE__ */ 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" })
|
|
606
667
|
] });
|
|
607
|
-
var
|
|
608
|
-
var View_default =
|
|
668
|
+
var ForwardRef12 = forwardRef(SvgView);
|
|
669
|
+
var View_default = ForwardRef12;
|
|
609
670
|
var SvgViewOff = ({
|
|
610
671
|
title,
|
|
611
672
|
titleId,
|
|
@@ -614,8 +675,8 @@ var SvgViewOff = ({
|
|
|
614
675
|
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
615
676
|
/* @__PURE__ */ 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" })
|
|
616
677
|
] });
|
|
617
|
-
var
|
|
618
|
-
var ViewOff_default =
|
|
678
|
+
var ForwardRef13 = forwardRef(SvgViewOff);
|
|
679
|
+
var ViewOff_default = ForwardRef13;
|
|
619
680
|
var SvgWarningFilled = ({
|
|
620
681
|
title,
|
|
621
682
|
titleId,
|
|
@@ -624,8 +685,8 @@ var SvgWarningFilled = ({
|
|
|
624
685
|
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
625
686
|
/* @__PURE__ */ 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" })
|
|
626
687
|
] });
|
|
627
|
-
var
|
|
628
|
-
var WarningFilled_default =
|
|
688
|
+
var ForwardRef14 = forwardRef(SvgWarningFilled);
|
|
689
|
+
var WarningFilled_default = ForwardRef14;
|
|
629
690
|
var SvgX = ({
|
|
630
691
|
title,
|
|
631
692
|
titleId,
|
|
@@ -634,8 +695,18 @@ var SvgX = ({
|
|
|
634
695
|
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
635
696
|
/* @__PURE__ */ jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.2, d: "m12.5 3.5-9 9m9 0-9-9" })
|
|
636
697
|
] });
|
|
637
|
-
var
|
|
638
|
-
var X_default =
|
|
698
|
+
var ForwardRef15 = forwardRef(SvgX);
|
|
699
|
+
var X_default = ForwardRef15;
|
|
700
|
+
var SvgXSmall = ({
|
|
701
|
+
title,
|
|
702
|
+
titleId,
|
|
703
|
+
...props
|
|
704
|
+
}, ref) => /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 16 16", ref, "aria-labelledby": titleId, ...props, children: [
|
|
705
|
+
title ? /* @__PURE__ */ jsx("title", { id: titleId, children: title }) : null,
|
|
706
|
+
/* @__PURE__ */ jsx("path", { stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.2, d: "m11 5-6 6m6 0L5 5" })
|
|
707
|
+
] });
|
|
708
|
+
var ForwardRef16 = forwardRef(SvgXSmall);
|
|
709
|
+
var XSmall_default = ForwardRef16;
|
|
639
710
|
var container = cva(
|
|
640
711
|
"inline-flex w-fit cursor-pointer items-start gap-x-2",
|
|
641
712
|
{
|
|
@@ -794,7 +865,7 @@ var CubeCheckbox = (props) => {
|
|
|
794
865
|
const {
|
|
795
866
|
containerClassName,
|
|
796
867
|
color = "primary",
|
|
797
|
-
label:
|
|
868
|
+
label: label6,
|
|
798
869
|
labelSize = "md",
|
|
799
870
|
labelClassName,
|
|
800
871
|
id,
|
|
@@ -859,11 +930,11 @@ var CubeCheckbox = (props) => {
|
|
|
859
930
|
}
|
|
860
931
|
),
|
|
861
932
|
renderIcon(),
|
|
862
|
-
|
|
933
|
+
label6 && /* @__PURE__ */ jsx(
|
|
863
934
|
"span",
|
|
864
935
|
{
|
|
865
936
|
className: twMerge(label({ color, disabled }), labelClassName),
|
|
866
|
-
children:
|
|
937
|
+
children: label6
|
|
867
938
|
}
|
|
868
939
|
)
|
|
869
940
|
]
|
|
@@ -872,176 +943,1326 @@ var CubeCheckbox = (props) => {
|
|
|
872
943
|
};
|
|
873
944
|
CubeCheckbox.Skeleton = CubeCheckboxSkeleton;
|
|
874
945
|
CubeCheckbox.Grid = CubeCheckboxGrid;
|
|
875
|
-
var
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
"hover:text-functional-hover-primary",
|
|
883
|
-
"visited:text-primary-700"
|
|
884
|
-
],
|
|
885
|
-
secondary: [
|
|
886
|
-
"text-functional-border-darker",
|
|
887
|
-
"hover:text-functional-text-light",
|
|
888
|
-
"visited:text-functional-border-darker"
|
|
889
|
-
]
|
|
890
|
-
},
|
|
891
|
-
size: {
|
|
892
|
-
md: "primary-body2",
|
|
893
|
-
sm: "primary-body4"
|
|
894
|
-
},
|
|
895
|
-
variant: {
|
|
896
|
-
"text-only": "",
|
|
897
|
-
"text-inline": "underline underline-offset-4",
|
|
898
|
-
"icon-left": "",
|
|
899
|
-
"icon-right": ""
|
|
900
|
-
},
|
|
901
|
-
disabled: {
|
|
902
|
-
true: "text-functional-disable-text hover:cursor-default hover:text-functional-disable-text"
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
);
|
|
907
|
-
var sizeMapping = {
|
|
908
|
-
sm: { iconSize: "sm", iconFrameSize: "size-[15px]" },
|
|
909
|
-
md: { iconSize: "md-sm", iconFrameSize: "size-[17px]" }
|
|
946
|
+
var UseFloatingExternalContext = createContext({});
|
|
947
|
+
|
|
948
|
+
// src/internals/utils/floating/splitPlacements.ts
|
|
949
|
+
var splitPlacements = (placement) => {
|
|
950
|
+
const [verticalPlacement, ...horizontalPlacementParts] = placement.split("-");
|
|
951
|
+
const horizontalPlacement = horizontalPlacementParts.join("-");
|
|
952
|
+
return [verticalPlacement, horizontalPlacement];
|
|
910
953
|
};
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
href,
|
|
920
|
-
target,
|
|
921
|
-
onClick
|
|
922
|
-
} = props;
|
|
923
|
-
if (!href && !onClick) {
|
|
924
|
-
console.warn(
|
|
925
|
-
"CubeHyperlink: href or onClick must be provided to make the hyperlink interactive"
|
|
926
|
-
);
|
|
954
|
+
|
|
955
|
+
// src/internals/utils/floating/autoPlacement/computeIdealPlacement.ts
|
|
956
|
+
var computeIdealPlacement = (placement, overflowPx) => {
|
|
957
|
+
const [vertical, horizontal] = splitPlacements(placement);
|
|
958
|
+
let newVertical = vertical;
|
|
959
|
+
let newHorizontal = horizontal;
|
|
960
|
+
if (shouldFlipVertically(vertical, overflowPx)) {
|
|
961
|
+
newVertical = flipVerticalPlacement(vertical);
|
|
927
962
|
}
|
|
928
|
-
|
|
929
|
-
if (
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
if (props.variant !== iconVariant) {
|
|
934
|
-
return null;
|
|
963
|
+
if (horizontal !== "follow-cursor") {
|
|
964
|
+
if (overflowPx.left > 0) {
|
|
965
|
+
newHorizontal = "left";
|
|
966
|
+
} else if (overflowPx.right > 0) {
|
|
967
|
+
newHorizontal = "right";
|
|
935
968
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
969
|
+
}
|
|
970
|
+
return `${newVertical}-${newHorizontal}`;
|
|
971
|
+
};
|
|
972
|
+
var shouldFlipVertically = (verticalPlacement, overflowPx) => {
|
|
973
|
+
return verticalPlacement === "top" && overflowPx.top > 0 || verticalPlacement === "bottom" && overflowPx.bottom > 0;
|
|
974
|
+
};
|
|
975
|
+
var flipVerticalPlacement = (verticalPlacement) => {
|
|
976
|
+
const flippedMap = {
|
|
977
|
+
top: "bottom",
|
|
978
|
+
bottom: "top"
|
|
946
979
|
};
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
980
|
+
return flippedMap[verticalPlacement];
|
|
981
|
+
};
|
|
982
|
+
|
|
983
|
+
// src/internals/utils/floating/rect/computeXBound.ts
|
|
984
|
+
var computeXBound = (anchorDomRect, elementWidth, horizontalPlacement, xOffset, mouseX) => {
|
|
985
|
+
const fn = computeFn[horizontalPlacement];
|
|
986
|
+
return fn(anchorDomRect, elementWidth, xOffset, mouseX);
|
|
987
|
+
};
|
|
988
|
+
var computeFn = {
|
|
989
|
+
left: (anchorDomRect, elementWidth, xOffset) => {
|
|
990
|
+
const left = anchorDomRect.left - xOffset;
|
|
991
|
+
return {
|
|
992
|
+
left,
|
|
993
|
+
right: left + elementWidth
|
|
994
|
+
};
|
|
995
|
+
},
|
|
996
|
+
center: (anchorDomRect, elementWidth) => {
|
|
997
|
+
const left = anchorDomRect.left + anchorDomRect.width / 2 - elementWidth / 2;
|
|
998
|
+
return {
|
|
999
|
+
left,
|
|
1000
|
+
right: left + elementWidth
|
|
1001
|
+
};
|
|
1002
|
+
},
|
|
1003
|
+
right: (anchorDomRect, elementWidth, xOffset) => {
|
|
1004
|
+
const right = anchorDomRect.right + xOffset;
|
|
1005
|
+
return {
|
|
1006
|
+
left: right - elementWidth,
|
|
1007
|
+
right
|
|
1008
|
+
};
|
|
1009
|
+
},
|
|
1010
|
+
"follow-cursor": (_anchorDomRect, elementWidth, _xOffset, mouseX) => {
|
|
1011
|
+
const left = mouseX - elementWidth / 2;
|
|
1012
|
+
return {
|
|
1013
|
+
left,
|
|
1014
|
+
right: left + elementWidth
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
// src/internals/utils/floating/rect/computeYBound.ts
|
|
1020
|
+
var computeYBound = (anchorDomRect, elementHeight, verticalPlacement, yOffset) => {
|
|
1021
|
+
const fn = computeFn2[verticalPlacement];
|
|
1022
|
+
return fn(anchorDomRect, elementHeight, yOffset);
|
|
1023
|
+
};
|
|
1024
|
+
var computeFn2 = {
|
|
1025
|
+
top: (anchorDomRect, elementHeight, yOffset) => {
|
|
1026
|
+
const bottom = anchorDomRect.top - yOffset;
|
|
1027
|
+
return {
|
|
1028
|
+
top: bottom - elementHeight,
|
|
1029
|
+
bottom
|
|
1030
|
+
};
|
|
1031
|
+
},
|
|
1032
|
+
bottom: (anchorDomRect, elementHeight, yOffset) => {
|
|
1033
|
+
const top = anchorDomRect.bottom + yOffset;
|
|
1034
|
+
return {
|
|
1035
|
+
top,
|
|
1036
|
+
bottom: top + elementHeight
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
|
|
1041
|
+
// src/internals/utils/floating/rect/computeFloatingBoundary.ts
|
|
1042
|
+
var computeFloatingBoundary = (anchorDomRect, elementSize, placement, offsets, mouseX) => {
|
|
1043
|
+
const [verticalPlacement, horizontalPlacement] = splitPlacements(placement);
|
|
1044
|
+
const xBound = computeXBound(
|
|
1045
|
+
anchorDomRect,
|
|
1046
|
+
elementSize.width,
|
|
1047
|
+
horizontalPlacement,
|
|
1048
|
+
offsets?.x ?? 0,
|
|
1049
|
+
mouseX ?? 0
|
|
1050
|
+
);
|
|
1051
|
+
const yBound = computeYBound(
|
|
1052
|
+
anchorDomRect,
|
|
1053
|
+
elementSize.height,
|
|
1054
|
+
verticalPlacement,
|
|
1055
|
+
offsets?.y ?? 0
|
|
1056
|
+
);
|
|
1057
|
+
return {
|
|
1058
|
+
...xBound,
|
|
1059
|
+
...yBound
|
|
966
1060
|
};
|
|
967
|
-
return renderHyperlink();
|
|
968
1061
|
};
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
const
|
|
973
|
-
|
|
974
|
-
|
|
1062
|
+
|
|
1063
|
+
// src/internals/utils/floating/rect/computeTranslateX.ts
|
|
1064
|
+
var computeTranslateX = (placement, overflowPx) => {
|
|
1065
|
+
const [, horizontalPlacement] = splitPlacements(placement);
|
|
1066
|
+
if (horizontalPlacement !== "follow-cursor") return 0;
|
|
1067
|
+
if (overflowPx.left > 0) {
|
|
1068
|
+
return overflowPx.left;
|
|
1069
|
+
}
|
|
1070
|
+
if (overflowPx.right > 0) {
|
|
1071
|
+
return -1 * overflowPx.right;
|
|
1072
|
+
}
|
|
1073
|
+
return 0;
|
|
975
1074
|
};
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
{
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
},
|
|
992
|
-
disabled: {
|
|
993
|
-
true: [
|
|
994
|
-
"disabled:border-functional-disable-text disabled:text-functional-disable-text disabled:placeholder:text-functional-border-divider",
|
|
995
|
-
"disabled:hover:border-functional-disable-text"
|
|
996
|
-
]
|
|
997
|
-
},
|
|
998
|
-
hasIcon: {
|
|
999
|
-
true: "pl-4 pr-8",
|
|
1000
|
-
false: "px-4"
|
|
1001
|
-
}
|
|
1002
|
-
},
|
|
1003
|
-
compoundVariants: [
|
|
1004
|
-
{ isError: true, hasIcon: true, class: "pr-[56px]" },
|
|
1005
|
-
{ isError: true, hasIcon: false, class: "pr-9" }
|
|
1006
|
-
]
|
|
1075
|
+
|
|
1076
|
+
// src/internals/utils/floating/rect/FloatingRect.ts
|
|
1077
|
+
var FloatingRect = class {
|
|
1078
|
+
_anchorDomRect;
|
|
1079
|
+
_size;
|
|
1080
|
+
_originalPlacement;
|
|
1081
|
+
_offsets = void 0;
|
|
1082
|
+
_mouseX = 0;
|
|
1083
|
+
constructor(args) {
|
|
1084
|
+
const { anchorDomRect, size, placement, offsets, mouseX } = args;
|
|
1085
|
+
this._anchorDomRect = anchorDomRect;
|
|
1086
|
+
this._size = size;
|
|
1087
|
+
this._originalPlacement = placement;
|
|
1088
|
+
this._offsets = offsets;
|
|
1089
|
+
this._mouseX = mouseX ?? 0;
|
|
1007
1090
|
}
|
|
1008
|
-
)
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1091
|
+
resolveStyles() {
|
|
1092
|
+
const floatingBoundary = computeFloatingBoundary(
|
|
1093
|
+
this._anchorDomRect,
|
|
1094
|
+
this._size,
|
|
1095
|
+
this._originalPlacement,
|
|
1096
|
+
this._offsets,
|
|
1097
|
+
this._mouseX
|
|
1098
|
+
);
|
|
1099
|
+
let finalBoundary = { ...floatingBoundary };
|
|
1100
|
+
const overflowPx = this.computeOverflowPx(floatingBoundary);
|
|
1101
|
+
const idealPlacement = computeIdealPlacement(
|
|
1102
|
+
this._originalPlacement,
|
|
1103
|
+
overflowPx
|
|
1104
|
+
);
|
|
1105
|
+
if (idealPlacement !== this._originalPlacement) {
|
|
1106
|
+
finalBoundary = computeFloatingBoundary(
|
|
1107
|
+
this._anchorDomRect,
|
|
1108
|
+
this._size,
|
|
1109
|
+
idealPlacement,
|
|
1110
|
+
this._offsets,
|
|
1111
|
+
this._mouseX
|
|
1112
|
+
);
|
|
1014
1113
|
}
|
|
1114
|
+
const translateX = computeTranslateX(idealPlacement, overflowPx);
|
|
1115
|
+
const floatingStyle = {
|
|
1116
|
+
position: "absolute",
|
|
1117
|
+
// Convert the position from viewport-relative coordinates to document-relative coordinates.
|
|
1118
|
+
top: finalBoundary.top + window.scrollY,
|
|
1119
|
+
left: finalBoundary.left + window.scrollX + translateX
|
|
1120
|
+
};
|
|
1121
|
+
return {
|
|
1122
|
+
idealPlacement,
|
|
1123
|
+
floatingStyle,
|
|
1124
|
+
translateX
|
|
1125
|
+
};
|
|
1015
1126
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1127
|
+
computeOverflowPx(floatingBoundary) {
|
|
1128
|
+
const { top, left } = floatingBoundary;
|
|
1129
|
+
const { clientWidth, clientHeight } = document.documentElement;
|
|
1130
|
+
return {
|
|
1131
|
+
top: top < 0 ? Math.abs(top) : 0,
|
|
1132
|
+
right: Math.max(floatingBoundary.right - clientWidth, 0),
|
|
1133
|
+
bottom: Math.max(floatingBoundary.bottom - clientHeight, 0),
|
|
1134
|
+
left: left < 0 ? Math.abs(left) : 0
|
|
1135
|
+
};
|
|
1023
1136
|
}
|
|
1024
|
-
}
|
|
1025
|
-
var
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1137
|
+
};
|
|
1138
|
+
var isRectEqual = (rectA, rectB) => {
|
|
1139
|
+
if (!rectA && !rectB) return true;
|
|
1140
|
+
if (!!rectA !== !!rectB) return false;
|
|
1141
|
+
const keys = [
|
|
1142
|
+
"top",
|
|
1143
|
+
"right",
|
|
1144
|
+
"bottom",
|
|
1145
|
+
"left",
|
|
1146
|
+
"width",
|
|
1147
|
+
"height",
|
|
1148
|
+
"x",
|
|
1149
|
+
"y"
|
|
1150
|
+
];
|
|
1151
|
+
return keys.every((key) => rectA[key] === rectB[key]);
|
|
1152
|
+
};
|
|
1153
|
+
var useElementDomRect = (elementRef, scrollableRootSelector) => {
|
|
1154
|
+
const [rect, setRect] = useState();
|
|
1155
|
+
const getScrollableRoot = useCallback(() => {
|
|
1156
|
+
if (scrollableRootSelector) {
|
|
1157
|
+
const element = document.querySelector(scrollableRootSelector);
|
|
1158
|
+
if (!element) {
|
|
1159
|
+
console.warn(
|
|
1160
|
+
`Cannot find element with selector ${scrollableRootSelector}`
|
|
1161
|
+
);
|
|
1162
|
+
}
|
|
1163
|
+
return element;
|
|
1164
|
+
} else {
|
|
1165
|
+
return window;
|
|
1031
1166
|
}
|
|
1032
|
-
}
|
|
1167
|
+
}, [scrollableRootSelector]);
|
|
1168
|
+
useEffect(() => {
|
|
1169
|
+
const syncRect = () => {
|
|
1170
|
+
setRect((prevRect) => {
|
|
1171
|
+
const currentRect = elementRef.current?.getBoundingClientRect();
|
|
1172
|
+
if (isRectEqual(prevRect, currentRect)) return prevRect;
|
|
1173
|
+
return currentRect;
|
|
1174
|
+
});
|
|
1175
|
+
};
|
|
1176
|
+
const debouncedSync = debounce(syncRect, 100);
|
|
1177
|
+
syncRect();
|
|
1178
|
+
const scrollableRoot = getScrollableRoot();
|
|
1179
|
+
scrollableRoot?.addEventListener("scroll", debouncedSync);
|
|
1180
|
+
scrollableRoot?.addEventListener("resize", debouncedSync);
|
|
1181
|
+
const intervalId = setInterval(() => {
|
|
1182
|
+
syncRect();
|
|
1183
|
+
}, 250);
|
|
1184
|
+
return () => {
|
|
1185
|
+
scrollableRoot?.removeEventListener("scroll", debouncedSync);
|
|
1186
|
+
scrollableRoot?.removeEventListener("resize", debouncedSync);
|
|
1187
|
+
clearInterval(intervalId);
|
|
1188
|
+
};
|
|
1189
|
+
}, [elementRef, getScrollableRoot]);
|
|
1190
|
+
return rect;
|
|
1191
|
+
};
|
|
1192
|
+
|
|
1193
|
+
// src/internals/utils/floating/useFloating.ts
|
|
1194
|
+
var createInvisibleFloatingStyles = (originalPlacement) => ({
|
|
1195
|
+
idealPlacement: originalPlacement,
|
|
1196
|
+
floatingStyle: {
|
|
1197
|
+
position: "absolute",
|
|
1198
|
+
visibility: "hidden",
|
|
1199
|
+
top: "-9999px",
|
|
1200
|
+
left: "-9999px"
|
|
1201
|
+
},
|
|
1202
|
+
translateX: 0
|
|
1033
1203
|
});
|
|
1034
|
-
var
|
|
1035
|
-
const {
|
|
1036
|
-
|
|
1204
|
+
var useFloating = (options) => {
|
|
1205
|
+
const {
|
|
1206
|
+
isOpen,
|
|
1207
|
+
anchorRef: anchorRefOption,
|
|
1208
|
+
placement,
|
|
1209
|
+
offsets,
|
|
1210
|
+
mouseX = 0
|
|
1211
|
+
} = options;
|
|
1212
|
+
const anchorRef = useRef(null);
|
|
1213
|
+
const elementRef = useRef(null);
|
|
1214
|
+
const { scrollableRootSelector } = useContext(UseFloatingExternalContext);
|
|
1215
|
+
const anchorRect = useElementDomRect(
|
|
1216
|
+
anchorRefOption ?? anchorRef,
|
|
1217
|
+
scrollableRootSelector
|
|
1218
|
+
);
|
|
1219
|
+
const elementRect = useElementDomRect(elementRef, scrollableRootSelector);
|
|
1220
|
+
const resolvedStyles = useMemo(() => {
|
|
1221
|
+
if (!anchorRect || !elementRect) return void 0;
|
|
1222
|
+
if (!isOpen) return createInvisibleFloatingStyles(placement);
|
|
1223
|
+
const floatingRect = new FloatingRect({
|
|
1224
|
+
anchorDomRect: anchorRect,
|
|
1225
|
+
size: {
|
|
1226
|
+
width: elementRect.width,
|
|
1227
|
+
height: elementRect.height
|
|
1228
|
+
},
|
|
1229
|
+
placement,
|
|
1230
|
+
offsets,
|
|
1231
|
+
mouseX
|
|
1232
|
+
});
|
|
1233
|
+
return floatingRect.resolveStyles();
|
|
1234
|
+
}, [isOpen, anchorRect, elementRect, placement, offsets, mouseX]);
|
|
1235
|
+
return {
|
|
1236
|
+
anchorRef,
|
|
1237
|
+
elementRef,
|
|
1238
|
+
resolvedStyles
|
|
1239
|
+
};
|
|
1037
1240
|
};
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1241
|
+
|
|
1242
|
+
// src/i18n/resources/en-US.json
|
|
1243
|
+
var en_US_default = {
|
|
1244
|
+
"component.common.loading": "Loading",
|
|
1245
|
+
"component.common.noData": "No Data",
|
|
1246
|
+
"component.dropdown.choose": "Choose",
|
|
1247
|
+
"component.dropdown.all": "All",
|
|
1248
|
+
"component.dropdown.search": "Search",
|
|
1249
|
+
"component.status.host.neutral": "Neutral",
|
|
1250
|
+
"component.status.host.inUse": "In-Use",
|
|
1251
|
+
"component.status.host.finished": "Finished",
|
|
1252
|
+
"component.status.host.ok": "Ok",
|
|
1253
|
+
"component.status.host.success": "Success",
|
|
1254
|
+
"component.status.host.active": "Active",
|
|
1255
|
+
"component.status.host.available": "Available",
|
|
1256
|
+
"component.status.host.poweringOn": "Powering-On",
|
|
1257
|
+
"component.status.host.warning": "Warning",
|
|
1258
|
+
"component.status.host.error": "Error",
|
|
1259
|
+
"component.status.host.fail": "Fail",
|
|
1260
|
+
"component.status.host.failed": "Failed",
|
|
1261
|
+
"component.status.host.stopped": "Stopped",
|
|
1262
|
+
"component.status.host.poweringOff": "Powering-Off",
|
|
1263
|
+
"component.status.reaction.neutral": "Neutral",
|
|
1264
|
+
"component.status.reaction.success": "Success",
|
|
1265
|
+
"component.status.reaction.available": "Available",
|
|
1266
|
+
"component.status.reaction.done": "Done",
|
|
1267
|
+
"component.status.reaction.error": "Error",
|
|
1268
|
+
"component.status.reaction.duplicate": "Duplicate",
|
|
1269
|
+
"component.status.reaction.failed": "Failed"
|
|
1270
|
+
};
|
|
1271
|
+
|
|
1272
|
+
// src/i18n/resources/zh-TW.json
|
|
1273
|
+
var zh_TW_default = {
|
|
1274
|
+
"component.common.loading": "\u8F09\u5165\u4E2D",
|
|
1275
|
+
"component.common.noData": "\u6C92\u6709\u8CC7\u6599",
|
|
1276
|
+
"component.dropdown.choose": "\u9078\u64C7",
|
|
1277
|
+
"component.dropdown.all": "\u5168\u90E8",
|
|
1278
|
+
"component.dropdown.search": "\u641C\u5C0B",
|
|
1279
|
+
"component.status.host.neutral": "\u4E2D\u6027",
|
|
1280
|
+
"component.status.host.inUse": "\u4F7F\u7528\u4E2D",
|
|
1281
|
+
"component.status.host.finished": "\u5DF2\u5B8C\u6210",
|
|
1282
|
+
"component.status.host.ok": "\u6B63\u5E38",
|
|
1283
|
+
"component.status.host.success": "\u6210\u529F",
|
|
1284
|
+
"component.status.host.active": "\u555F\u7528",
|
|
1285
|
+
"component.status.host.available": "\u53EF\u7528",
|
|
1286
|
+
"component.status.host.poweringOn": "\u555F\u52D5\u4E2D",
|
|
1287
|
+
"component.status.host.warning": "\u8B66\u544A",
|
|
1288
|
+
"component.status.host.error": "\u932F\u8AA4",
|
|
1289
|
+
"component.status.host.fail": "\u5931\u6557",
|
|
1290
|
+
"component.status.host.failed": "\u5DF2\u5931\u6557",
|
|
1291
|
+
"component.status.host.stopped": "\u5DF2\u505C\u6B62",
|
|
1292
|
+
"component.status.host.poweringOff": "\u95DC\u6A5F\u4E2D",
|
|
1293
|
+
"component.status.reaction.neutral": "\u4E2D\u6027",
|
|
1294
|
+
"component.status.reaction.success": "\u6210\u529F",
|
|
1295
|
+
"component.status.reaction.available": "\u53EF\u7528",
|
|
1296
|
+
"component.status.reaction.done": "\u5B8C\u6210",
|
|
1297
|
+
"component.status.reaction.error": "\u932F\u8AA4",
|
|
1298
|
+
"component.status.reaction.duplicate": "\u91CD\u8907",
|
|
1299
|
+
"component.status.reaction.failed": "\u5931\u6557"
|
|
1300
|
+
};
|
|
1301
|
+
|
|
1302
|
+
// src/i18n/i18n.ts
|
|
1303
|
+
var i18n = i18next.createInstance();
|
|
1304
|
+
i18n.use(initReactI18next).init({
|
|
1305
|
+
resources: {
|
|
1306
|
+
"en-US": { translation: en_US_default },
|
|
1307
|
+
"zh-TW": { translation: zh_TW_default }
|
|
1308
|
+
},
|
|
1309
|
+
lng: "en-US",
|
|
1310
|
+
fallbackLng: "en-US",
|
|
1311
|
+
interpolation: {
|
|
1312
|
+
escapeValue: false
|
|
1313
|
+
// react already escapes from xss
|
|
1314
|
+
}
|
|
1315
|
+
});
|
|
1316
|
+
var i18n_default = i18n;
|
|
1317
|
+
|
|
1318
|
+
// src/i18n/useCubeUiTranslation.ts
|
|
1319
|
+
var useCubeUiTranslation = (ns, options) => {
|
|
1320
|
+
return useTranslation(ns, { ...options, i18n: i18n_default });
|
|
1321
|
+
};
|
|
1322
|
+
var CubeDropdownContext = createContext({
|
|
1323
|
+
floatingProps: void 0,
|
|
1324
|
+
dropdownOpen: false,
|
|
1325
|
+
toggleDropdownOpen: () => {
|
|
1326
|
+
},
|
|
1327
|
+
size: "md",
|
|
1328
|
+
type: "radio",
|
|
1329
|
+
variant: "regular",
|
|
1330
|
+
disabled: false,
|
|
1331
|
+
selectedItems: [],
|
|
1332
|
+
enabledItemCount: 0,
|
|
1333
|
+
onAllCheckChange: void 0,
|
|
1334
|
+
onClearSelection: void 0,
|
|
1335
|
+
searchValue: "",
|
|
1336
|
+
handleSearchValueChange: void 0
|
|
1337
|
+
});
|
|
1338
|
+
var label2 = cva("primary-body3 font-semibold text-functional-title", {
|
|
1339
|
+
variants: {
|
|
1340
|
+
size: {
|
|
1341
|
+
md: "mb-2",
|
|
1342
|
+
sm: "mb-1.5"
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
var skeletonContainer = cva("w-full", {
|
|
1347
|
+
variants: {
|
|
1348
|
+
size: {
|
|
1349
|
+
md: "space-y-[8px]",
|
|
1350
|
+
sm: "space-y-[6px]"
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
});
|
|
1354
|
+
var skeletonInput = cva("w-full", {
|
|
1355
|
+
variants: {
|
|
1356
|
+
size: {
|
|
1357
|
+
md: "h-[38px]",
|
|
1358
|
+
sm: "h-[34px]"
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
var triggerContainer = cva(
|
|
1363
|
+
"primary-body3 flex w-full items-center justify-between gap-x-3 rounded-[5px] border",
|
|
1364
|
+
{
|
|
1365
|
+
variants: {
|
|
1366
|
+
size: {
|
|
1367
|
+
md: "h-[38px] min-w-[116px] max-w-[360px] px-4 py-[10px]",
|
|
1368
|
+
sm: "h-[34px] min-w-[80px] max-w-[240px] px-3 py-2"
|
|
1369
|
+
},
|
|
1370
|
+
variant: {
|
|
1371
|
+
regular: "",
|
|
1372
|
+
withFilter: ""
|
|
1373
|
+
},
|
|
1374
|
+
dropdownOpen: {
|
|
1375
|
+
true: "",
|
|
1376
|
+
false: ""
|
|
1377
|
+
},
|
|
1378
|
+
isSelected: {
|
|
1379
|
+
true: "",
|
|
1380
|
+
false: ""
|
|
1381
|
+
},
|
|
1382
|
+
disabled: {
|
|
1383
|
+
true: "",
|
|
1384
|
+
false: ""
|
|
1385
|
+
}
|
|
1386
|
+
},
|
|
1387
|
+
compoundVariants: [
|
|
1388
|
+
// Regular Dropdown
|
|
1389
|
+
{
|
|
1390
|
+
variant: "regular",
|
|
1391
|
+
dropdownOpen: false,
|
|
1392
|
+
isSelected: false,
|
|
1393
|
+
disabled: false,
|
|
1394
|
+
class: [
|
|
1395
|
+
"hover:border-functional-hover-primary",
|
|
1396
|
+
"border-functional-border-divider",
|
|
1397
|
+
"text-functional-text-light",
|
|
1398
|
+
"bg-white"
|
|
1399
|
+
]
|
|
1400
|
+
},
|
|
1401
|
+
{
|
|
1402
|
+
variant: "regular",
|
|
1403
|
+
dropdownOpen: false,
|
|
1404
|
+
isSelected: true,
|
|
1405
|
+
disabled: false,
|
|
1406
|
+
class: [
|
|
1407
|
+
"hover:border-functional-hover-primary",
|
|
1408
|
+
"border-functional-border-divider",
|
|
1409
|
+
"text-functional-text",
|
|
1410
|
+
"bg-white"
|
|
1411
|
+
]
|
|
1412
|
+
},
|
|
1413
|
+
{
|
|
1414
|
+
variant: "regular",
|
|
1415
|
+
dropdownOpen: false,
|
|
1416
|
+
isSelected: false,
|
|
1417
|
+
disabled: true,
|
|
1418
|
+
class: [
|
|
1419
|
+
"hover:border-functional-border-divider",
|
|
1420
|
+
"border-functional-border-divider",
|
|
1421
|
+
"text-functional-disable-text",
|
|
1422
|
+
"bg-white"
|
|
1423
|
+
]
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
variant: "regular",
|
|
1427
|
+
dropdownOpen: false,
|
|
1428
|
+
isSelected: true,
|
|
1429
|
+
disabled: true,
|
|
1430
|
+
class: [
|
|
1431
|
+
"hover:border-functional-border-divider",
|
|
1432
|
+
"border-functional-border-divider",
|
|
1433
|
+
"text-functional-disable-text",
|
|
1434
|
+
"bg-white"
|
|
1435
|
+
]
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
variant: "regular",
|
|
1439
|
+
dropdownOpen: true,
|
|
1440
|
+
isSelected: false,
|
|
1441
|
+
disabled: false,
|
|
1442
|
+
class: [
|
|
1443
|
+
"border-functional-hover-primary",
|
|
1444
|
+
"text-functional-text-light",
|
|
1445
|
+
"bg-white"
|
|
1446
|
+
]
|
|
1447
|
+
},
|
|
1448
|
+
{
|
|
1449
|
+
variant: "regular",
|
|
1450
|
+
dropdownOpen: true,
|
|
1451
|
+
isSelected: true,
|
|
1452
|
+
disabled: false,
|
|
1453
|
+
class: [
|
|
1454
|
+
"border-functional-hover-primary",
|
|
1455
|
+
"text-functional-text",
|
|
1456
|
+
"bg-white"
|
|
1457
|
+
]
|
|
1458
|
+
},
|
|
1459
|
+
// Dropdown with filter
|
|
1460
|
+
{
|
|
1461
|
+
variant: "withFilter",
|
|
1462
|
+
isSelected: false,
|
|
1463
|
+
disabled: false,
|
|
1464
|
+
class: [
|
|
1465
|
+
"hover:border-blue-700",
|
|
1466
|
+
"border-blue-700",
|
|
1467
|
+
"text-functional-text",
|
|
1468
|
+
"bg-white"
|
|
1469
|
+
]
|
|
1470
|
+
},
|
|
1471
|
+
{
|
|
1472
|
+
variant: "withFilter",
|
|
1473
|
+
isSelected: true,
|
|
1474
|
+
disabled: false,
|
|
1475
|
+
class: [
|
|
1476
|
+
"hover:border-blue-800 hover:bg-secondary-100",
|
|
1477
|
+
"border-blue-700",
|
|
1478
|
+
"text-blue-850",
|
|
1479
|
+
"bg-secondary-50"
|
|
1480
|
+
]
|
|
1481
|
+
},
|
|
1482
|
+
{
|
|
1483
|
+
variant: "withFilter",
|
|
1484
|
+
isSelected: false,
|
|
1485
|
+
disabled: true,
|
|
1486
|
+
class: [
|
|
1487
|
+
"hover:border-blue-200",
|
|
1488
|
+
"border-blue-200",
|
|
1489
|
+
"text-functional-disable-text",
|
|
1490
|
+
"bg-white"
|
|
1491
|
+
]
|
|
1492
|
+
},
|
|
1493
|
+
{
|
|
1494
|
+
variant: "withFilter",
|
|
1495
|
+
isSelected: true,
|
|
1496
|
+
disabled: true,
|
|
1497
|
+
class: [
|
|
1498
|
+
"hover:border-blue-200",
|
|
1499
|
+
"border-blue-200",
|
|
1500
|
+
"text-functional-disable-text",
|
|
1501
|
+
"bg-secondary-0"
|
|
1502
|
+
]
|
|
1503
|
+
}
|
|
1504
|
+
]
|
|
1505
|
+
}
|
|
1506
|
+
);
|
|
1507
|
+
var triggerIcon = cva("icon-md shrink-0 transition-transform", {
|
|
1508
|
+
variants: {
|
|
1509
|
+
dropdownOpen: {
|
|
1510
|
+
true: "rotate-180",
|
|
1511
|
+
false: "rotate-0"
|
|
1512
|
+
},
|
|
1513
|
+
disabled: {
|
|
1514
|
+
true: "text-functional-disable-text",
|
|
1515
|
+
false: "text-functional-text"
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
});
|
|
1519
|
+
var triggerCount = cva("primary-body3", {
|
|
1520
|
+
variants: {
|
|
1521
|
+
variant: {
|
|
1522
|
+
regular: "",
|
|
1523
|
+
withFilter: ""
|
|
1524
|
+
},
|
|
1525
|
+
disabled: {
|
|
1526
|
+
true: "",
|
|
1527
|
+
false: ""
|
|
1528
|
+
}
|
|
1529
|
+
},
|
|
1530
|
+
compoundVariants: [
|
|
1531
|
+
{
|
|
1532
|
+
variant: "regular",
|
|
1533
|
+
disabled: true,
|
|
1534
|
+
class: "text-functional-disable-text"
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
variant: "regular",
|
|
1538
|
+
disabled: false,
|
|
1539
|
+
class: "text-functional-text-light"
|
|
1540
|
+
},
|
|
1541
|
+
{
|
|
1542
|
+
variant: "withFilter",
|
|
1543
|
+
disabled: true,
|
|
1544
|
+
class: "text-functional-disable-text"
|
|
1545
|
+
},
|
|
1546
|
+
{ variant: "withFilter", disabled: false, class: "text-blue-850" }
|
|
1547
|
+
]
|
|
1548
|
+
});
|
|
1549
|
+
var triggerClearButton = cva("icon-md text-functional-text-light", {
|
|
1550
|
+
variants: {
|
|
1551
|
+
disabled: {
|
|
1552
|
+
true: "hidden"
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
});
|
|
1556
|
+
var menu = cva(
|
|
1557
|
+
[
|
|
1558
|
+
"z-10 overflow-y-auto rounded-[5px] border bg-white py-2",
|
|
1559
|
+
"shadow-[0_0_2px_0_rgba(0,0,0,0.2)]"
|
|
1560
|
+
],
|
|
1561
|
+
{
|
|
1562
|
+
variants: {
|
|
1563
|
+
size: {
|
|
1564
|
+
md: "max-h-[442px] min-w-[116px] max-w-[360px]",
|
|
1565
|
+
sm: "max-h-[390px] min-w-[80px] max-w-[240px]"
|
|
1566
|
+
},
|
|
1567
|
+
dropdownOpen: { false: "invisible" }
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
);
|
|
1571
|
+
var filterContainer = cva("relative flex shrink-0 items-center", {
|
|
1572
|
+
variants: {
|
|
1573
|
+
size: {
|
|
1574
|
+
md: "",
|
|
1575
|
+
sm: ""
|
|
1576
|
+
},
|
|
1577
|
+
type: {
|
|
1578
|
+
radio: "",
|
|
1579
|
+
checkbox: ""
|
|
1580
|
+
}
|
|
1581
|
+
},
|
|
1582
|
+
compoundVariants: [
|
|
1583
|
+
{ size: "md", type: "radio", class: "px-[24px] py-[10px]" },
|
|
1584
|
+
{ size: "md", type: "checkbox", class: "px-[22px] py-[11px]" },
|
|
1585
|
+
{ size: "sm", type: "radio", class: "px-[24px] py-[9px]" },
|
|
1586
|
+
{ size: "sm", type: "checkbox", class: "px-[16px] py-[9.5px]" }
|
|
1587
|
+
]
|
|
1588
|
+
});
|
|
1589
|
+
var filterInput = cva([
|
|
1590
|
+
"primary-body2 w-full rounded-[5px] px-4 py-[7px] outline-none",
|
|
1591
|
+
"bg-secondary-0 text-functional-text placeholder:text-functional-text-light"
|
|
1592
|
+
]);
|
|
1593
|
+
var filterIcon = cva(
|
|
1594
|
+
"icon-md absolute shrink-0 text-functional-text",
|
|
1595
|
+
{
|
|
1596
|
+
variants: {
|
|
1597
|
+
size: {
|
|
1598
|
+
md: "",
|
|
1599
|
+
sm: ""
|
|
1600
|
+
},
|
|
1601
|
+
type: {
|
|
1602
|
+
radio: "",
|
|
1603
|
+
checkbox: ""
|
|
1604
|
+
}
|
|
1605
|
+
},
|
|
1606
|
+
compoundVariants: [
|
|
1607
|
+
{ size: "md", type: "radio", class: "right-[40px]" },
|
|
1608
|
+
{ size: "md", type: "checkbox", class: "right-[38px]" },
|
|
1609
|
+
{ size: "sm", type: "radio", class: "right-[40px]" },
|
|
1610
|
+
{ size: "sm", type: "checkbox", class: "right-[32px]" }
|
|
1611
|
+
]
|
|
1612
|
+
}
|
|
1613
|
+
);
|
|
1614
|
+
var itemRadio = cva(
|
|
1615
|
+
"cursor-pointer truncate text-functional-text hover:bg-functional-hover-grey",
|
|
1616
|
+
{
|
|
1617
|
+
variants: {
|
|
1618
|
+
size: {
|
|
1619
|
+
md: "primary-body3",
|
|
1620
|
+
sm: "primary-body4"
|
|
1621
|
+
},
|
|
1622
|
+
variant: {
|
|
1623
|
+
regular: "",
|
|
1624
|
+
withFilter: ""
|
|
1625
|
+
},
|
|
1626
|
+
isSelected: {
|
|
1627
|
+
true: "font-semibold"
|
|
1628
|
+
},
|
|
1629
|
+
disabled: {
|
|
1630
|
+
true: "cursor-default text-functional-disable-text hover:bg-white"
|
|
1631
|
+
}
|
|
1632
|
+
},
|
|
1633
|
+
compoundVariants: [
|
|
1634
|
+
{ size: "md", variant: "regular", class: "px-[24px] py-[10px]" },
|
|
1635
|
+
{ size: "md", variant: "withFilter", class: "px-[24px] py-[10px]" },
|
|
1636
|
+
{ size: "sm", variant: "regular", class: "px-[24px] py-[9px]" },
|
|
1637
|
+
{ size: "sm", variant: "withFilter", class: "px-[24px] py-[9px]" }
|
|
1638
|
+
]
|
|
1639
|
+
}
|
|
1640
|
+
);
|
|
1641
|
+
var itemCheckbox = cva(
|
|
1642
|
+
"truncate text-functional-text hover:bg-functional-hover-grey",
|
|
1643
|
+
{
|
|
1644
|
+
variants: {
|
|
1645
|
+
size: {
|
|
1646
|
+
md: "primary-body3",
|
|
1647
|
+
sm: "primary-body4"
|
|
1648
|
+
},
|
|
1649
|
+
variant: {
|
|
1650
|
+
regular: "",
|
|
1651
|
+
withFilter: ""
|
|
1652
|
+
},
|
|
1653
|
+
isSelected: {
|
|
1654
|
+
true: "font-semibold"
|
|
1655
|
+
},
|
|
1656
|
+
disabled: {
|
|
1657
|
+
true: "cursor-default text-functional-disable-text hover:bg-white"
|
|
1658
|
+
}
|
|
1659
|
+
},
|
|
1660
|
+
compoundVariants: [
|
|
1661
|
+
{ size: "md", variant: "regular", class: "px-[22px] py-[11px]" },
|
|
1662
|
+
{ size: "md", variant: "withFilter", class: "px-[22px] py-[11px]" },
|
|
1663
|
+
{ size: "sm", variant: "regular", class: "px-[16px] py-[9.5px]" },
|
|
1664
|
+
{ size: "sm", variant: "withFilter", class: "px-[16px] py-[9.5px]" }
|
|
1665
|
+
]
|
|
1666
|
+
}
|
|
1667
|
+
);
|
|
1668
|
+
var itemNoData = cva("text-functional-text", {
|
|
1669
|
+
variants: {
|
|
1670
|
+
size: {
|
|
1671
|
+
md: "primary-body3",
|
|
1672
|
+
sm: "primary-body4"
|
|
1673
|
+
},
|
|
1674
|
+
type: {
|
|
1675
|
+
radio: "",
|
|
1676
|
+
checkbox: ""
|
|
1677
|
+
}
|
|
1678
|
+
},
|
|
1679
|
+
compoundVariants: [
|
|
1680
|
+
{ size: "md", type: "radio", class: "px-[24px] py-[10px]" },
|
|
1681
|
+
{ size: "md", type: "checkbox", class: "px-[22px] py-[11px]" },
|
|
1682
|
+
{ size: "sm", type: "radio", class: "px-[24px] py-[9px]" },
|
|
1683
|
+
{ size: "sm", type: "checkbox", class: "px-[16px] py-[9.5px]" }
|
|
1684
|
+
]
|
|
1685
|
+
});
|
|
1686
|
+
var CubeDropdownTrigger = (props) => {
|
|
1687
|
+
const { children, placeholder, className } = props;
|
|
1688
|
+
const {
|
|
1689
|
+
dropdownOpen,
|
|
1690
|
+
toggleDropdownOpen,
|
|
1691
|
+
floatingProps,
|
|
1692
|
+
size,
|
|
1693
|
+
type,
|
|
1694
|
+
variant,
|
|
1695
|
+
selectedItems,
|
|
1696
|
+
disabled,
|
|
1697
|
+
onClearSelection
|
|
1698
|
+
} = useContext(CubeDropdownContext);
|
|
1699
|
+
const { t } = useCubeUiTranslation();
|
|
1700
|
+
const isSelected = selectedItems.length > 0;
|
|
1701
|
+
const placeholderText = placeholder ?? t("component.dropdown.choose");
|
|
1702
|
+
const displayText = isSelected ? children : placeholderText;
|
|
1703
|
+
const renderSelectedItemCount = () => {
|
|
1704
|
+
if (type === "radio" || !isSelected) return null;
|
|
1705
|
+
return /* @__PURE__ */ jsx("p", { className: triggerCount({ variant, disabled }), children: `(${selectedItems.length})` });
|
|
1706
|
+
};
|
|
1707
|
+
const renderClearButton = () => {
|
|
1708
|
+
const handleClearClick = (e) => {
|
|
1709
|
+
e.stopPropagation();
|
|
1710
|
+
onClearSelection?.();
|
|
1711
|
+
};
|
|
1712
|
+
if (type === "checkbox" && variant === "withFilter" && isSelected)
|
|
1713
|
+
return /* @__PURE__ */ jsx(
|
|
1714
|
+
XSmall_default,
|
|
1715
|
+
{
|
|
1716
|
+
className: twMerge(triggerClearButton({ disabled })),
|
|
1717
|
+
onClick: (e) => handleClearClick(e)
|
|
1718
|
+
}
|
|
1719
|
+
);
|
|
1720
|
+
return null;
|
|
1721
|
+
};
|
|
1722
|
+
return /* @__PURE__ */ jsxs(
|
|
1723
|
+
"button",
|
|
1724
|
+
{
|
|
1725
|
+
ref: floatingProps.anchorRef,
|
|
1726
|
+
type: "button",
|
|
1727
|
+
disabled,
|
|
1728
|
+
onClick: toggleDropdownOpen,
|
|
1729
|
+
className: twMerge(
|
|
1730
|
+
triggerContainer({
|
|
1731
|
+
size,
|
|
1732
|
+
variant,
|
|
1733
|
+
dropdownOpen,
|
|
1734
|
+
isSelected,
|
|
1735
|
+
disabled
|
|
1736
|
+
}),
|
|
1737
|
+
className
|
|
1738
|
+
),
|
|
1739
|
+
children: [
|
|
1740
|
+
/* @__PURE__ */ jsx("span", { className: "w-full truncate text-left", children: displayText }),
|
|
1741
|
+
/* @__PURE__ */ jsxs("span", { className: "flex shrink-0 items-center gap-2", children: [
|
|
1742
|
+
renderSelectedItemCount(),
|
|
1743
|
+
renderClearButton(),
|
|
1744
|
+
/* @__PURE__ */ jsx(
|
|
1745
|
+
ChevronDown_default,
|
|
1746
|
+
{
|
|
1747
|
+
className: twMerge(triggerIcon({ dropdownOpen, disabled }))
|
|
1748
|
+
}
|
|
1749
|
+
)
|
|
1750
|
+
] })
|
|
1751
|
+
]
|
|
1752
|
+
}
|
|
1753
|
+
);
|
|
1754
|
+
};
|
|
1755
|
+
var ItemCheckbox = (props) => {
|
|
1756
|
+
const {
|
|
1757
|
+
isDark = false,
|
|
1758
|
+
size,
|
|
1759
|
+
variant,
|
|
1760
|
+
label: label6,
|
|
1761
|
+
onClick,
|
|
1762
|
+
isSelected,
|
|
1763
|
+
disabled
|
|
1764
|
+
} = props;
|
|
1765
|
+
const getColor = () => {
|
|
1766
|
+
if (variant === "regular") {
|
|
1767
|
+
return isDark ? "primary-dark" : "primary";
|
|
1768
|
+
} else {
|
|
1769
|
+
return isDark ? "secondary-dark" : "secondary";
|
|
1770
|
+
}
|
|
1771
|
+
};
|
|
1772
|
+
const getLabelSize = () => {
|
|
1773
|
+
return size === "md" ? "sm" : "xs";
|
|
1774
|
+
};
|
|
1775
|
+
return /* @__PURE__ */ jsx(
|
|
1776
|
+
"div",
|
|
1777
|
+
{
|
|
1778
|
+
className: twMerge(itemCheckbox({ size, variant, isSelected, disabled })),
|
|
1779
|
+
children: /* @__PURE__ */ jsx(
|
|
1780
|
+
CubeCheckbox,
|
|
1781
|
+
{
|
|
1782
|
+
label: label6,
|
|
1783
|
+
labelClassName: "truncate",
|
|
1784
|
+
disabled,
|
|
1785
|
+
checked: isSelected,
|
|
1786
|
+
onChange: onClick,
|
|
1787
|
+
color: getColor(),
|
|
1788
|
+
labelSize: getLabelSize()
|
|
1789
|
+
}
|
|
1790
|
+
)
|
|
1791
|
+
}
|
|
1792
|
+
);
|
|
1793
|
+
};
|
|
1794
|
+
var ItemNoData = (props) => {
|
|
1795
|
+
const { size, type } = props;
|
|
1796
|
+
const { t } = useCubeUiTranslation();
|
|
1797
|
+
return /* @__PURE__ */ jsx("div", { className: twMerge(itemNoData({ size, type })), children: t("component.common.noData") });
|
|
1798
|
+
};
|
|
1799
|
+
var CubeDropdownFilter = () => {
|
|
1800
|
+
const { size, type, searchValue, handleSearchValueChange } = useContext(CubeDropdownContext);
|
|
1801
|
+
const { t } = useCubeUiTranslation();
|
|
1802
|
+
return /* @__PURE__ */ jsxs("div", { className: twMerge(filterContainer({ size, type })), children: [
|
|
1803
|
+
/* @__PURE__ */ jsx(
|
|
1804
|
+
"input",
|
|
1805
|
+
{
|
|
1806
|
+
type: "text",
|
|
1807
|
+
className: twMerge(filterInput()),
|
|
1808
|
+
placeholder: t("component.dropdown.search"),
|
|
1809
|
+
value: searchValue,
|
|
1810
|
+
onChange: handleSearchValueChange
|
|
1811
|
+
}
|
|
1812
|
+
),
|
|
1813
|
+
/* @__PURE__ */ jsx(Search_default, { className: twMerge(filterIcon({ size, type })) })
|
|
1814
|
+
] });
|
|
1815
|
+
};
|
|
1816
|
+
var ItemRadio = (props) => {
|
|
1817
|
+
const { size, variant, label: label6, onClick, isSelected, disabled } = props;
|
|
1818
|
+
return /* @__PURE__ */ jsx(
|
|
1819
|
+
"div",
|
|
1820
|
+
{
|
|
1821
|
+
className: twMerge(itemRadio({ size, variant, isSelected, disabled })),
|
|
1822
|
+
onClick,
|
|
1823
|
+
children: label6
|
|
1824
|
+
}
|
|
1825
|
+
);
|
|
1826
|
+
};
|
|
1827
|
+
var CubeDropdownItem = (props) => {
|
|
1828
|
+
const {
|
|
1829
|
+
children: label6,
|
|
1830
|
+
item,
|
|
1831
|
+
disabled = false,
|
|
1832
|
+
onClick: onClickProp
|
|
1833
|
+
} = props;
|
|
1834
|
+
const { size, type, variant, selectedItems, toggleDropdownOpen } = useContext(CubeDropdownContext);
|
|
1835
|
+
const isSelected = selectedItems.includes(item);
|
|
1836
|
+
const onClick = () => {
|
|
1837
|
+
if (disabled) return;
|
|
1838
|
+
onClickProp();
|
|
1839
|
+
if (type === "radio") toggleDropdownOpen();
|
|
1840
|
+
};
|
|
1841
|
+
if (type === "checkbox")
|
|
1842
|
+
return /* @__PURE__ */ jsx(
|
|
1843
|
+
ItemCheckbox,
|
|
1844
|
+
{
|
|
1845
|
+
size,
|
|
1846
|
+
variant,
|
|
1847
|
+
label: label6,
|
|
1848
|
+
isSelected,
|
|
1849
|
+
disabled,
|
|
1850
|
+
onClick
|
|
1851
|
+
}
|
|
1852
|
+
);
|
|
1853
|
+
return /* @__PURE__ */ jsx(
|
|
1854
|
+
ItemRadio,
|
|
1855
|
+
{
|
|
1856
|
+
size,
|
|
1857
|
+
variant,
|
|
1858
|
+
label: label6,
|
|
1859
|
+
isSelected,
|
|
1860
|
+
disabled,
|
|
1861
|
+
onClick
|
|
1862
|
+
}
|
|
1863
|
+
);
|
|
1864
|
+
};
|
|
1865
|
+
|
|
1866
|
+
// src/components/CubeDropdown/cubeDropdownUtils.ts
|
|
1867
|
+
var getOptionalProps = (props) => {
|
|
1868
|
+
return {
|
|
1869
|
+
onAllCheckChange: props.type === "checkbox" ? props.onAllCheckChange : void 0,
|
|
1870
|
+
onClearSelection: props.type === "checkbox" && props.variant === "withFilter" ? props.onClearSelection : void 0
|
|
1871
|
+
};
|
|
1872
|
+
};
|
|
1873
|
+
var checkIsCubeDropdownItemElement = (child) => isValidElement(child) && child.type === CubeDropdownItem;
|
|
1874
|
+
var CubeDropdownMenu = (props) => {
|
|
1875
|
+
const { children, className } = props;
|
|
1876
|
+
const {
|
|
1877
|
+
floatingProps,
|
|
1878
|
+
dropdownOpen,
|
|
1879
|
+
size,
|
|
1880
|
+
variant,
|
|
1881
|
+
type,
|
|
1882
|
+
onAllCheckChange,
|
|
1883
|
+
selectedItems,
|
|
1884
|
+
enabledItemCount,
|
|
1885
|
+
searchValue
|
|
1886
|
+
} = useContext(CubeDropdownContext);
|
|
1887
|
+
const { t } = useCubeUiTranslation();
|
|
1888
|
+
const { elementRef, resolvedStyles } = floatingProps;
|
|
1889
|
+
const isAllSelected = useMemo(() => {
|
|
1890
|
+
return selectedItems.length === enabledItemCount;
|
|
1891
|
+
}, [selectedItems.length, enabledItemCount]);
|
|
1892
|
+
const onAllClick = useCallback(() => {
|
|
1893
|
+
onAllCheckChange?.(!isAllSelected);
|
|
1894
|
+
}, [isAllSelected, onAllCheckChange]);
|
|
1895
|
+
const renderFilter = () => {
|
|
1896
|
+
if (variant === "regular") return null;
|
|
1897
|
+
return /* @__PURE__ */ jsx(CubeDropdownFilter, {});
|
|
1898
|
+
};
|
|
1899
|
+
const renderSelectAllCheckbox = () => {
|
|
1900
|
+
if (type === "radio" || searchValue || !children) return null;
|
|
1901
|
+
return /* @__PURE__ */ jsx(
|
|
1902
|
+
ItemCheckbox,
|
|
1903
|
+
{
|
|
1904
|
+
isDark: true,
|
|
1905
|
+
size,
|
|
1906
|
+
variant,
|
|
1907
|
+
label: t("component.dropdown.all"),
|
|
1908
|
+
onClick: onAllClick,
|
|
1909
|
+
isSelected: isAllSelected,
|
|
1910
|
+
disabled: false
|
|
1911
|
+
}
|
|
1912
|
+
);
|
|
1913
|
+
};
|
|
1914
|
+
const renderMenuItems = () => {
|
|
1915
|
+
const allItems = Children.toArray(children).filter(
|
|
1916
|
+
checkIsCubeDropdownItemElement
|
|
1917
|
+
);
|
|
1918
|
+
const visibleItems = variant !== "withFilter" || !searchValue ? allItems : allItems.filter(
|
|
1919
|
+
(child) => child.props.children.toLowerCase().includes(searchValue.toLowerCase())
|
|
1920
|
+
);
|
|
1921
|
+
if (visibleItems.length === 0) {
|
|
1922
|
+
return /* @__PURE__ */ jsx(ItemNoData, { size, type });
|
|
1923
|
+
}
|
|
1924
|
+
return visibleItems;
|
|
1925
|
+
};
|
|
1926
|
+
return createPortal(
|
|
1927
|
+
/* @__PURE__ */ jsxs(
|
|
1928
|
+
"div",
|
|
1929
|
+
{
|
|
1930
|
+
ref: elementRef,
|
|
1931
|
+
className: twMerge(menu({ size, dropdownOpen }), className),
|
|
1932
|
+
style: resolvedStyles?.floatingStyle,
|
|
1933
|
+
children: [
|
|
1934
|
+
renderFilter(),
|
|
1935
|
+
renderSelectAllCheckbox(),
|
|
1936
|
+
renderMenuItems()
|
|
1937
|
+
]
|
|
1938
|
+
}
|
|
1939
|
+
),
|
|
1940
|
+
document.body
|
|
1941
|
+
);
|
|
1942
|
+
};
|
|
1943
|
+
var CubeDropdownSkeleton = (props) => {
|
|
1944
|
+
const { className, size, hasLabel } = props;
|
|
1945
|
+
const renderLabelSkeleton = () => {
|
|
1946
|
+
return hasLabel ? /* @__PURE__ */ jsx(CubeSkeleton, { className: "h-[18px] w-full" }) : null;
|
|
1947
|
+
};
|
|
1948
|
+
return /* @__PURE__ */ jsxs("div", { className: twMerge(skeletonContainer({ size }), className), children: [
|
|
1949
|
+
renderLabelSkeleton(),
|
|
1950
|
+
/* @__PURE__ */ jsx(CubeSkeleton, { className: twMerge(skeletonInput({ size })) })
|
|
1951
|
+
] });
|
|
1952
|
+
};
|
|
1953
|
+
var parseNodes = (node) => {
|
|
1954
|
+
const payload = {
|
|
1955
|
+
triggerNode: void 0,
|
|
1956
|
+
menuNode: void 0,
|
|
1957
|
+
enabledItemCount: 0
|
|
1958
|
+
};
|
|
1959
|
+
Children.toArray(node).forEach((child) => {
|
|
1960
|
+
if (!isValidElement(child)) {
|
|
1961
|
+
return;
|
|
1962
|
+
}
|
|
1963
|
+
if (child.type === CubeDropdownTrigger) {
|
|
1964
|
+
assignTriggerNode(payload, child);
|
|
1965
|
+
} else if (child.type === CubeDropdownMenu) {
|
|
1966
|
+
assignMenuNode(payload, child);
|
|
1967
|
+
}
|
|
1968
|
+
});
|
|
1969
|
+
return payload;
|
|
1970
|
+
};
|
|
1971
|
+
var assignTriggerNode = (payload, value) => {
|
|
1972
|
+
if (payload.triggerNode) {
|
|
1973
|
+
console.warn(
|
|
1974
|
+
"Found multiple trigger nodes. Only one trigger node is allowed in a CubeDropdown."
|
|
1975
|
+
);
|
|
1976
|
+
} else {
|
|
1977
|
+
payload.triggerNode = value;
|
|
1978
|
+
}
|
|
1979
|
+
};
|
|
1980
|
+
var assignMenuNode = (payload, value) => {
|
|
1981
|
+
if (payload.menuNode) {
|
|
1982
|
+
console.warn(
|
|
1983
|
+
"Found multiple menu nodes. Only one menu node is allowed in a CubeDropdown."
|
|
1984
|
+
);
|
|
1985
|
+
} else {
|
|
1986
|
+
payload.menuNode = value;
|
|
1987
|
+
payload.enabledItemCount = computeEnabledItemCount(
|
|
1988
|
+
Children.toArray(value.props.children)
|
|
1989
|
+
);
|
|
1990
|
+
}
|
|
1991
|
+
};
|
|
1992
|
+
var computeEnabledItemCount = (menuChildren) => {
|
|
1993
|
+
const enabledItems = menuChildren.filter((child) => {
|
|
1994
|
+
if (!isValidElement(child) || child.type !== CubeDropdownItem) {
|
|
1995
|
+
console.warn(
|
|
1996
|
+
"The children of CubeDropdown.Menu can only be CubeDropdown.Item, but found: ",
|
|
1997
|
+
child
|
|
1998
|
+
);
|
|
1999
|
+
return false;
|
|
2000
|
+
}
|
|
2001
|
+
const itemProps = child.props;
|
|
2002
|
+
return !itemProps.disabled;
|
|
2003
|
+
});
|
|
2004
|
+
return enabledItems.length;
|
|
2005
|
+
};
|
|
2006
|
+
var CubeDropdown = (props) => {
|
|
2007
|
+
const {
|
|
2008
|
+
size = "md",
|
|
2009
|
+
type,
|
|
2010
|
+
variant = "regular",
|
|
2011
|
+
selectedItems,
|
|
2012
|
+
isLoading = false,
|
|
2013
|
+
disabled = false,
|
|
2014
|
+
label: label6,
|
|
2015
|
+
skeletonClassName,
|
|
2016
|
+
children
|
|
2017
|
+
} = props;
|
|
2018
|
+
const optionalProps = getOptionalProps(props);
|
|
2019
|
+
const [dropdownOpen, setDropdownOpen] = useState(false);
|
|
2020
|
+
const [searchValue, setSearchValue] = useState("");
|
|
2021
|
+
const toggleDropdownOpen = () => {
|
|
2022
|
+
setDropdownOpen((prev) => !prev);
|
|
2023
|
+
};
|
|
2024
|
+
const handleSearchValueChange = (e) => {
|
|
2025
|
+
setSearchValue(e.target.value);
|
|
2026
|
+
};
|
|
2027
|
+
const floatingProps = useFloating({
|
|
2028
|
+
isOpen: dropdownOpen,
|
|
2029
|
+
placement: "bottom-left",
|
|
2030
|
+
offsets: {
|
|
2031
|
+
y: 8
|
|
2032
|
+
}
|
|
2033
|
+
});
|
|
2034
|
+
const { anchorRef, elementRef } = floatingProps;
|
|
2035
|
+
const { triggerNode, menuNode, enabledItemCount } = parseNodes(children);
|
|
2036
|
+
const handleClickOutside = useCallback(
|
|
2037
|
+
(event) => {
|
|
2038
|
+
const target = event.target;
|
|
2039
|
+
const isTrigger = anchorRef.current?.contains(target);
|
|
2040
|
+
const isMenu = elementRef.current?.contains(target);
|
|
2041
|
+
if (!isTrigger && !isMenu) {
|
|
2042
|
+
setDropdownOpen(false);
|
|
2043
|
+
}
|
|
2044
|
+
},
|
|
2045
|
+
[anchorRef, elementRef]
|
|
2046
|
+
);
|
|
2047
|
+
useEffect(() => {
|
|
2048
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2049
|
+
return () => {
|
|
2050
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
2051
|
+
};
|
|
2052
|
+
}, [handleClickOutside]);
|
|
2053
|
+
const renderLabel = () => {
|
|
2054
|
+
if (!label6) return null;
|
|
2055
|
+
return /* @__PURE__ */ jsx("p", { className: twMerge(label2({ size })), children: label6 });
|
|
2056
|
+
};
|
|
2057
|
+
if (isLoading) {
|
|
2058
|
+
return /* @__PURE__ */ jsx(
|
|
2059
|
+
CubeDropdownSkeleton,
|
|
2060
|
+
{
|
|
2061
|
+
className: skeletonClassName,
|
|
2062
|
+
size,
|
|
2063
|
+
hasLabel: !!label6
|
|
2064
|
+
}
|
|
2065
|
+
);
|
|
2066
|
+
}
|
|
2067
|
+
return /* @__PURE__ */ jsx(
|
|
2068
|
+
CubeDropdownContext.Provider,
|
|
2069
|
+
{
|
|
2070
|
+
value: {
|
|
2071
|
+
floatingProps,
|
|
2072
|
+
dropdownOpen,
|
|
2073
|
+
toggleDropdownOpen,
|
|
2074
|
+
size,
|
|
2075
|
+
type,
|
|
2076
|
+
variant,
|
|
2077
|
+
disabled,
|
|
2078
|
+
selectedItems,
|
|
2079
|
+
enabledItemCount,
|
|
2080
|
+
onAllCheckChange: optionalProps.onAllCheckChange,
|
|
2081
|
+
onClearSelection: optionalProps.onClearSelection,
|
|
2082
|
+
searchValue,
|
|
2083
|
+
handleSearchValueChange
|
|
2084
|
+
},
|
|
2085
|
+
children: /* @__PURE__ */ jsxs("div", { children: [
|
|
2086
|
+
renderLabel(),
|
|
2087
|
+
triggerNode,
|
|
2088
|
+
menuNode
|
|
2089
|
+
] })
|
|
2090
|
+
}
|
|
2091
|
+
);
|
|
2092
|
+
};
|
|
2093
|
+
CubeDropdown.Trigger = CubeDropdownTrigger;
|
|
2094
|
+
CubeDropdown.Menu = CubeDropdownMenu;
|
|
2095
|
+
CubeDropdown.Item = CubeDropdownItem;
|
|
2096
|
+
var hyperlink = cva(
|
|
2097
|
+
["flex cursor-pointer items-center gap-x-1 font-medium"],
|
|
2098
|
+
{
|
|
2099
|
+
variants: {
|
|
2100
|
+
color: {
|
|
2101
|
+
primary: [
|
|
2102
|
+
"text-primary",
|
|
2103
|
+
"hover:text-functional-hover-primary",
|
|
2104
|
+
"visited:text-primary-700"
|
|
2105
|
+
],
|
|
2106
|
+
secondary: [
|
|
2107
|
+
"text-functional-border-darker",
|
|
2108
|
+
"hover:text-functional-text-light",
|
|
2109
|
+
"visited:text-functional-border-darker"
|
|
2110
|
+
]
|
|
2111
|
+
},
|
|
2112
|
+
size: {
|
|
2113
|
+
md: "primary-body2",
|
|
2114
|
+
sm: "primary-body4"
|
|
2115
|
+
},
|
|
2116
|
+
variant: {
|
|
2117
|
+
"text-only": "",
|
|
2118
|
+
"text-inline": "underline underline-offset-4",
|
|
2119
|
+
"icon-left": "",
|
|
2120
|
+
"icon-right": ""
|
|
2121
|
+
},
|
|
2122
|
+
disabled: {
|
|
2123
|
+
true: "text-functional-disable-text hover:cursor-default hover:text-functional-disable-text"
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
);
|
|
2128
|
+
var sizeMapping = {
|
|
2129
|
+
sm: { iconSize: "sm", iconFrameSize: "size-[15px]" },
|
|
2130
|
+
md: { iconSize: "md-sm", iconFrameSize: "size-[17px]" }
|
|
2131
|
+
};
|
|
2132
|
+
var CubeHyperlink = (props) => {
|
|
2133
|
+
const {
|
|
2134
|
+
className: classNameProps,
|
|
2135
|
+
color = "primary",
|
|
2136
|
+
size = "md",
|
|
2137
|
+
variant = "text-only",
|
|
2138
|
+
disabled = false,
|
|
2139
|
+
children,
|
|
2140
|
+
href,
|
|
2141
|
+
target,
|
|
2142
|
+
onClick
|
|
2143
|
+
} = props;
|
|
2144
|
+
if (!href && !onClick) {
|
|
2145
|
+
console.warn(
|
|
2146
|
+
"CubeHyperlink: href or onClick must be provided to make the hyperlink interactive"
|
|
2147
|
+
);
|
|
2148
|
+
}
|
|
2149
|
+
const handleClick = (e) => {
|
|
2150
|
+
if (disabled) return;
|
|
2151
|
+
onClick?.(e);
|
|
2152
|
+
};
|
|
2153
|
+
const renderIcon = (iconVariant) => {
|
|
2154
|
+
if (props.variant !== iconVariant) {
|
|
2155
|
+
return null;
|
|
2156
|
+
}
|
|
2157
|
+
const { Icon } = props;
|
|
2158
|
+
const { iconSize, iconFrameSize } = sizeMapping[size];
|
|
2159
|
+
const iconSizeClass = getIconSizeClass(iconSize);
|
|
2160
|
+
return /* @__PURE__ */ jsx(
|
|
2161
|
+
"div",
|
|
2162
|
+
{
|
|
2163
|
+
className: twMerge("flex items-center justify-center", iconFrameSize),
|
|
2164
|
+
children: /* @__PURE__ */ jsx(Icon, { className: iconSizeClass })
|
|
2165
|
+
}
|
|
2166
|
+
);
|
|
2167
|
+
};
|
|
2168
|
+
const renderHyperlink = () => {
|
|
2169
|
+
const hyperlinkType = !disabled && href ? "a" : "div";
|
|
2170
|
+
const hrefAttribute = hyperlinkType === "a" ? href : void 0;
|
|
2171
|
+
const targetAttribute = hyperlinkType === "a" ? target : void 0;
|
|
2172
|
+
return createElement(
|
|
2173
|
+
hyperlinkType,
|
|
2174
|
+
{
|
|
2175
|
+
className: twMerge(
|
|
2176
|
+
hyperlink({ color, size, variant, disabled }),
|
|
2177
|
+
classNameProps
|
|
2178
|
+
),
|
|
2179
|
+
href: hrefAttribute,
|
|
2180
|
+
target: targetAttribute,
|
|
2181
|
+
onClick: handleClick
|
|
2182
|
+
},
|
|
2183
|
+
renderIcon("icon-left"),
|
|
2184
|
+
children,
|
|
2185
|
+
renderIcon("icon-right")
|
|
2186
|
+
);
|
|
2187
|
+
};
|
|
2188
|
+
return renderHyperlink();
|
|
2189
|
+
};
|
|
2190
|
+
var CubeIconFrame = (props) => {
|
|
2191
|
+
const { className: classNameProps, size = "md", children, onClick } = props;
|
|
2192
|
+
const containerClasses = getContainerClasses(size, classNameProps);
|
|
2193
|
+
const iconClasses = getIconClasses(size, children.props.className);
|
|
2194
|
+
const icon = cloneElement(children, { className: iconClasses });
|
|
2195
|
+
return /* @__PURE__ */ jsx("div", { className: containerClasses, onClick, children: icon });
|
|
2196
|
+
};
|
|
2197
|
+
var input = cva(
|
|
2198
|
+
[
|
|
2199
|
+
"primary-body2 w-full truncate rounded-[6px] py-[9px] outline-none",
|
|
2200
|
+
"bg-grey-0",
|
|
2201
|
+
"text-functional-text placeholder:text-functional-border-darker",
|
|
2202
|
+
"border border-functional-border-divider",
|
|
2203
|
+
"hover:border-functional-hover-primary focus:border-functional-hover-primary"
|
|
2204
|
+
],
|
|
2205
|
+
{
|
|
2206
|
+
variants: {
|
|
2207
|
+
isError: {
|
|
2208
|
+
true: [
|
|
2209
|
+
"pl-4 pr-8",
|
|
2210
|
+
"border-status-negative hover:border-status-negative"
|
|
2211
|
+
]
|
|
2212
|
+
},
|
|
2213
|
+
disabled: {
|
|
2214
|
+
true: [
|
|
2215
|
+
"disabled:border-functional-disable-text disabled:text-functional-disable-text disabled:placeholder:text-functional-border-divider",
|
|
2216
|
+
"disabled:hover:border-functional-disable-text"
|
|
2217
|
+
]
|
|
2218
|
+
},
|
|
2219
|
+
hasIcon: {
|
|
2220
|
+
true: "pl-4 pr-8",
|
|
2221
|
+
false: "px-4"
|
|
2222
|
+
}
|
|
2223
|
+
},
|
|
2224
|
+
compoundVariants: [
|
|
2225
|
+
{ isError: true, hasIcon: true, class: "pr-[56px]" },
|
|
2226
|
+
{ isError: true, hasIcon: false, class: "pr-9" }
|
|
2227
|
+
]
|
|
2228
|
+
}
|
|
2229
|
+
);
|
|
2230
|
+
var customIcon = cva("icon-md", {
|
|
2231
|
+
variants: {
|
|
2232
|
+
disabled: {
|
|
2233
|
+
true: "cursor-default text-functional-border-divider",
|
|
2234
|
+
false: "cursor-pointer text-functional-text"
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
});
|
|
2238
|
+
var footer = cva("primary-body4", {
|
|
2239
|
+
variants: {
|
|
2240
|
+
isError: {
|
|
2241
|
+
true: "text-status-negative",
|
|
2242
|
+
false: "text-functional-text-light"
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
});
|
|
2246
|
+
var skeleton = cva("w-full", {
|
|
2247
|
+
variants: {
|
|
2248
|
+
type: {
|
|
2249
|
+
label: "h-[20px]",
|
|
2250
|
+
input: "h-[38px]",
|
|
2251
|
+
footer: "h-[16px]"
|
|
2252
|
+
}
|
|
2253
|
+
}
|
|
2254
|
+
});
|
|
2255
|
+
var CubeInputSkeleton = (props) => {
|
|
2256
|
+
const { type } = props;
|
|
2257
|
+
return /* @__PURE__ */ jsx(CubeSkeleton, { className: skeleton({ type }) });
|
|
2258
|
+
};
|
|
2259
|
+
var CubeInput = Object.assign(
|
|
2260
|
+
forwardRef((props, ref) => {
|
|
2261
|
+
const {
|
|
2262
|
+
className,
|
|
2263
|
+
required = false,
|
|
2264
|
+
isLoading = false,
|
|
2265
|
+
label: label6,
|
|
1045
2266
|
tooltip,
|
|
1046
2267
|
helpMessage,
|
|
1047
2268
|
errorMessage,
|
|
@@ -1055,7 +2276,7 @@ var CubeInput = Object.assign(
|
|
|
1055
2276
|
const hasFooter = !!helpMessage || isError;
|
|
1056
2277
|
const hasIcon = !!trailingIcon;
|
|
1057
2278
|
const renderLabel = () => {
|
|
1058
|
-
if (!
|
|
2279
|
+
if (!label6 && !tooltip) return null;
|
|
1059
2280
|
if (isLoading) return /* @__PURE__ */ jsx(CubeInputSkeleton, { type: "label" });
|
|
1060
2281
|
return /* @__PURE__ */ jsxs("div", { className: "primary-body2 flex items-center space-x-1", children: [
|
|
1061
2282
|
/* @__PURE__ */ jsx(
|
|
@@ -1063,7 +2284,7 @@ var CubeInput = Object.assign(
|
|
|
1063
2284
|
{
|
|
1064
2285
|
htmlFor: inputId,
|
|
1065
2286
|
className: "font-semibold text-functional-title",
|
|
1066
|
-
children:
|
|
2287
|
+
children: label6
|
|
1067
2288
|
}
|
|
1068
2289
|
),
|
|
1069
2290
|
required && /* @__PURE__ */ jsx("span", { className: "text-status-negative", children: "*" }),
|
|
@@ -1122,6 +2343,330 @@ var CubeInput = Object.assign(
|
|
|
1122
2343
|
{ Skeleton: CubeInputSkeleton }
|
|
1123
2344
|
);
|
|
1124
2345
|
CubeInput.displayName = "CubeInput";
|
|
2346
|
+
|
|
2347
|
+
// src/components/CubeTextarea/cubeTextareaUtils.ts
|
|
2348
|
+
var normalizeValue = (value) => {
|
|
2349
|
+
if (typeof value === "string") return value;
|
|
2350
|
+
if (typeof value === "number") return value.toString();
|
|
2351
|
+
if (Array.isArray(value)) return value.join("");
|
|
2352
|
+
return "";
|
|
2353
|
+
};
|
|
2354
|
+
var calculateValueLength = (value) => {
|
|
2355
|
+
const normalizedValue = normalizeValue(value);
|
|
2356
|
+
return normalizedValue.length;
|
|
2357
|
+
};
|
|
2358
|
+
var assignRefValue = (ref, element) => {
|
|
2359
|
+
if (!ref) return;
|
|
2360
|
+
if (typeof ref === "function") {
|
|
2361
|
+
ref(element);
|
|
2362
|
+
} else {
|
|
2363
|
+
ref.current = element;
|
|
2364
|
+
}
|
|
2365
|
+
};
|
|
2366
|
+
var CubeOverflowMenuContext = createContext(() => void 0);
|
|
2367
|
+
var CubeOverflowMenuDivider = () => {
|
|
2368
|
+
return /* @__PURE__ */ jsx("div", { className: "my-2 h-px bg-functional-border-divider" });
|
|
2369
|
+
};
|
|
2370
|
+
|
|
2371
|
+
// src/components/CubeOverflowMenu/cubeOverflowMenuUtils.ts
|
|
2372
|
+
var renderNothing = () => void 0;
|
|
2373
|
+
var CubeOverflowMenuItemLeadingContent = (props) => {
|
|
2374
|
+
const { type } = props;
|
|
2375
|
+
const renderMenuIcon = () => {
|
|
2376
|
+
const { MenuIcon } = props;
|
|
2377
|
+
return /* @__PURE__ */ 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__ */ jsx(MenuIcon, { className: "icon-xl text-functional-text group-[.group]:text-functional-disable-text" }) });
|
|
2378
|
+
};
|
|
2379
|
+
const renderCheckmark = () => {
|
|
2380
|
+
const { isChecked } = props;
|
|
2381
|
+
return /* @__PURE__ */ jsx("div", { className: "shrink-0 px-2.5", children: /* @__PURE__ */ jsx(
|
|
2382
|
+
CheckmarkBold_default,
|
|
2383
|
+
{
|
|
2384
|
+
className: twMerge(
|
|
2385
|
+
"icon-md text-functional-text group-[.group]:text-functional-disable-text",
|
|
2386
|
+
!isChecked && "invisible"
|
|
2387
|
+
)
|
|
2388
|
+
}
|
|
2389
|
+
) });
|
|
2390
|
+
};
|
|
2391
|
+
const renderCustomLeadingElement = () => {
|
|
2392
|
+
const { element } = props;
|
|
2393
|
+
return /* @__PURE__ */ jsx("div", { className: "shrink-0 px-2.5", children: element });
|
|
2394
|
+
};
|
|
2395
|
+
const renderFnMap = {
|
|
2396
|
+
plain: renderNothing,
|
|
2397
|
+
"menu-icon": renderMenuIcon,
|
|
2398
|
+
"check-mark": renderCheckmark,
|
|
2399
|
+
toggle: renderNothing,
|
|
2400
|
+
"trailing-icon": renderNothing,
|
|
2401
|
+
"custom-leading-element": renderCustomLeadingElement
|
|
2402
|
+
};
|
|
2403
|
+
return !!type && renderFnMap[type]();
|
|
2404
|
+
};
|
|
2405
|
+
var track = cva(
|
|
2406
|
+
"flex h-[20px] w-9 items-center rounded-full border border-transparent transition-colors",
|
|
2407
|
+
{
|
|
2408
|
+
variants: {
|
|
2409
|
+
checked: {
|
|
2410
|
+
true: "bg-status-positive",
|
|
2411
|
+
false: "bg-functional-disable-text"
|
|
2412
|
+
},
|
|
2413
|
+
disabled: {
|
|
2414
|
+
false: "cursor-pointer",
|
|
2415
|
+
true: "cursor-default"
|
|
2416
|
+
}
|
|
2417
|
+
},
|
|
2418
|
+
compoundVariants: [
|
|
2419
|
+
// Not disabled
|
|
2420
|
+
{
|
|
2421
|
+
checked: true,
|
|
2422
|
+
disabled: false,
|
|
2423
|
+
className: "hover:bg-green-400"
|
|
2424
|
+
},
|
|
2425
|
+
{
|
|
2426
|
+
checked: false,
|
|
2427
|
+
disabled: false,
|
|
2428
|
+
className: "hover:bg-grey-400"
|
|
2429
|
+
},
|
|
2430
|
+
// Disabled
|
|
2431
|
+
{
|
|
2432
|
+
checked: true,
|
|
2433
|
+
disabled: true,
|
|
2434
|
+
className: "border-green-200 bg-green-100"
|
|
2435
|
+
},
|
|
2436
|
+
{
|
|
2437
|
+
checked: false,
|
|
2438
|
+
disabled: true,
|
|
2439
|
+
className: "border-functional-disable bg-grey-150"
|
|
2440
|
+
}
|
|
2441
|
+
]
|
|
2442
|
+
}
|
|
2443
|
+
);
|
|
2444
|
+
var thumb = cva(
|
|
2445
|
+
"size-[17px] rounded-full bg-grey-0 shadow-md transition-transform",
|
|
2446
|
+
{
|
|
2447
|
+
variants: {
|
|
2448
|
+
checked: {
|
|
2449
|
+
true: "translate-x-4",
|
|
2450
|
+
false: "translate-x-px"
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
);
|
|
2455
|
+
var label3 = cva("primary-body4 text-functional-text", {
|
|
2456
|
+
variants: {
|
|
2457
|
+
disabled: {
|
|
2458
|
+
false: "cursor-pointer",
|
|
2459
|
+
true: "cursor-default"
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
});
|
|
2463
|
+
var CubeToggle = (props) => {
|
|
2464
|
+
const {
|
|
2465
|
+
className,
|
|
2466
|
+
checked,
|
|
2467
|
+
onCheckedChange,
|
|
2468
|
+
label: label6,
|
|
2469
|
+
disabled = false,
|
|
2470
|
+
"aria-label": ariaLabel
|
|
2471
|
+
} = props;
|
|
2472
|
+
const toggleId = useId();
|
|
2473
|
+
const labelId = useId();
|
|
2474
|
+
const toggleChecked = () => {
|
|
2475
|
+
if (disabled) return;
|
|
2476
|
+
onCheckedChange(!checked);
|
|
2477
|
+
};
|
|
2478
|
+
return /* @__PURE__ */ jsxs("div", { className: twMerge("flex items-center gap-x-[6px]", className), children: [
|
|
2479
|
+
/* @__PURE__ */ jsx(
|
|
2480
|
+
"button",
|
|
2481
|
+
{
|
|
2482
|
+
id: toggleId,
|
|
2483
|
+
type: "button",
|
|
2484
|
+
role: "switch",
|
|
2485
|
+
"aria-checked": checked,
|
|
2486
|
+
"aria-labelledby": label6 ? labelId : void 0,
|
|
2487
|
+
"aria-label": label6 ? void 0 : ariaLabel,
|
|
2488
|
+
className: twMerge(track({ checked, disabled })),
|
|
2489
|
+
disabled,
|
|
2490
|
+
onClick: toggleChecked,
|
|
2491
|
+
children: /* @__PURE__ */ jsx("span", { className: thumb({ checked }), "aria-hidden": true })
|
|
2492
|
+
}
|
|
2493
|
+
),
|
|
2494
|
+
label6 && /* @__PURE__ */ jsx(
|
|
2495
|
+
"label",
|
|
2496
|
+
{
|
|
2497
|
+
id: labelId,
|
|
2498
|
+
htmlFor: toggleId,
|
|
2499
|
+
className: label3({ disabled }),
|
|
2500
|
+
children: label6
|
|
2501
|
+
}
|
|
2502
|
+
)
|
|
2503
|
+
] });
|
|
2504
|
+
};
|
|
2505
|
+
var CubeOverflowMenuItemTrailingContent = (props) => {
|
|
2506
|
+
const { type, title } = props;
|
|
2507
|
+
const renderToggle = () => {
|
|
2508
|
+
const { disabled, checked, onCheckedChange } = props;
|
|
2509
|
+
return /* @__PURE__ */ jsx(
|
|
2510
|
+
CubeToggle,
|
|
2511
|
+
{
|
|
2512
|
+
className: "ml-8 shrink-0",
|
|
2513
|
+
checked,
|
|
2514
|
+
disabled,
|
|
2515
|
+
"aria-label": title,
|
|
2516
|
+
onCheckedChange: (next) => onCheckedChange?.(next)
|
|
2517
|
+
}
|
|
2518
|
+
);
|
|
2519
|
+
};
|
|
2520
|
+
const renderTrailingIcon = () => {
|
|
2521
|
+
const { TrailingIcon } = props;
|
|
2522
|
+
return /* @__PURE__ */ jsx("div", { className: "shrink-0 px-2.5", children: /* @__PURE__ */ jsx(TrailingIcon, { className: "icon-md text-functional-text group-[.group]:text-functional-disable-text" }) });
|
|
2523
|
+
};
|
|
2524
|
+
const renderFnMap = {
|
|
2525
|
+
plain: renderNothing,
|
|
2526
|
+
"menu-icon": renderNothing,
|
|
2527
|
+
"check-mark": renderNothing,
|
|
2528
|
+
toggle: renderToggle,
|
|
2529
|
+
"trailing-icon": renderTrailingIcon,
|
|
2530
|
+
"custom-leading-element": renderNothing
|
|
2531
|
+
};
|
|
2532
|
+
return !!type && renderFnMap[type]();
|
|
2533
|
+
};
|
|
2534
|
+
var menu2 = cva([
|
|
2535
|
+
"z-10",
|
|
2536
|
+
"rounded-[5px] border border-functional-border-divider bg-grey-0 py-2",
|
|
2537
|
+
"shadow-[0px_0px_2px_0px_rgba(0,_0,_0,_0.20)]"
|
|
2538
|
+
]);
|
|
2539
|
+
var itemContainer = cva(
|
|
2540
|
+
[
|
|
2541
|
+
"flex items-center gap-x-1",
|
|
2542
|
+
"min-w-40 max-w-[360px] px-[22px] py-2",
|
|
2543
|
+
"bg-transparent transition-colors"
|
|
2544
|
+
],
|
|
2545
|
+
{
|
|
2546
|
+
variants: {
|
|
2547
|
+
hasOnClickProp: {
|
|
2548
|
+
true: "cursor-pointer",
|
|
2549
|
+
false: "cursor-default"
|
|
2550
|
+
},
|
|
2551
|
+
withSubtext: {
|
|
2552
|
+
true: "h-[53px]",
|
|
2553
|
+
false: "h-[36ox]"
|
|
2554
|
+
},
|
|
2555
|
+
disabled: {
|
|
2556
|
+
true: "group cursor-default",
|
|
2557
|
+
false: "hover:bg-functional-hover-grey"
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
);
|
|
2562
|
+
var CubeOverflowMenuItem = (props) => {
|
|
2563
|
+
const { type, title, boldTitle, subText } = props;
|
|
2564
|
+
const closeMenu = useContext(CubeOverflowMenuContext);
|
|
2565
|
+
const getIsDisabled = () => {
|
|
2566
|
+
return "disabled" in props && !!props.disabled;
|
|
2567
|
+
};
|
|
2568
|
+
const onClick = () => {
|
|
2569
|
+
if (getIsDisabled()) {
|
|
2570
|
+
return;
|
|
2571
|
+
}
|
|
2572
|
+
if ("onClick" in props) {
|
|
2573
|
+
props.onClick?.();
|
|
2574
|
+
if (type !== "check-mark" && type !== "toggle") {
|
|
2575
|
+
closeMenu();
|
|
2576
|
+
}
|
|
2577
|
+
}
|
|
2578
|
+
};
|
|
2579
|
+
return /* @__PURE__ */ jsxs(
|
|
2580
|
+
"div",
|
|
2581
|
+
{
|
|
2582
|
+
className: twMerge(
|
|
2583
|
+
itemContainer({
|
|
2584
|
+
hasOnClickProp: "onClick" in props,
|
|
2585
|
+
withSubtext: !!subText,
|
|
2586
|
+
disabled: getIsDisabled()
|
|
2587
|
+
})
|
|
2588
|
+
),
|
|
2589
|
+
onClick,
|
|
2590
|
+
children: [
|
|
2591
|
+
/* @__PURE__ */ jsx(CubeOverflowMenuItemLeadingContent, { ...props }),
|
|
2592
|
+
/* @__PURE__ */ jsxs("div", { className: "flex grow flex-col gap-y-0.5 overflow-hidden", children: [
|
|
2593
|
+
/* @__PURE__ */ jsx(
|
|
2594
|
+
"div",
|
|
2595
|
+
{
|
|
2596
|
+
className: twMerge(
|
|
2597
|
+
"primary-body2 truncate text-functional-title group-[.group]:text-functional-disable-text",
|
|
2598
|
+
boldTitle && "font-semibold"
|
|
2599
|
+
),
|
|
2600
|
+
children: title
|
|
2601
|
+
}
|
|
2602
|
+
),
|
|
2603
|
+
subText && /* @__PURE__ */ jsx("div", { className: "primary-body5 truncate text-functional-text-light group-[.group]:text-functional-disable-text", children: subText })
|
|
2604
|
+
] }),
|
|
2605
|
+
/* @__PURE__ */ jsx(CubeOverflowMenuItemTrailingContent, { ...props })
|
|
2606
|
+
]
|
|
2607
|
+
}
|
|
2608
|
+
);
|
|
2609
|
+
};
|
|
2610
|
+
var CubeOverflowMenuTitle = (props) => {
|
|
2611
|
+
const { children } = props;
|
|
2612
|
+
return /* @__PURE__ */ jsx("div", { className: "primary-body4 truncate px-[22px] pb-1 pt-2 text-functional-text-light", children });
|
|
2613
|
+
};
|
|
2614
|
+
var CubeOverflowMenu = (props) => {
|
|
2615
|
+
const { triggerElement, children } = props;
|
|
2616
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
2617
|
+
const { anchorRef, elementRef, resolvedStyles } = useFloating({
|
|
2618
|
+
isOpen,
|
|
2619
|
+
placement: "bottom-left",
|
|
2620
|
+
offsets: {
|
|
2621
|
+
y: 8
|
|
2622
|
+
}
|
|
2623
|
+
});
|
|
2624
|
+
const closeMenu = useCallback(() => {
|
|
2625
|
+
setIsOpen(false);
|
|
2626
|
+
}, []);
|
|
2627
|
+
useEffect(() => {
|
|
2628
|
+
const onOutsideClick = (e) => {
|
|
2629
|
+
const target = e.target;
|
|
2630
|
+
const isAnchor = anchorRef.current?.contains(target);
|
|
2631
|
+
const isMenu = elementRef.current?.contains(target);
|
|
2632
|
+
if (!isAnchor && !isMenu) {
|
|
2633
|
+
setIsOpen(false);
|
|
2634
|
+
}
|
|
2635
|
+
};
|
|
2636
|
+
window.addEventListener("click", onOutsideClick);
|
|
2637
|
+
return () => {
|
|
2638
|
+
window.removeEventListener("click", onOutsideClick);
|
|
2639
|
+
};
|
|
2640
|
+
}, [anchorRef, elementRef]);
|
|
2641
|
+
const clonedAnchor = cloneElement(triggerElement, {
|
|
2642
|
+
ref: (element) => {
|
|
2643
|
+
assignRefValue(triggerElement.props.ref, element);
|
|
2644
|
+
assignRefValue(anchorRef, element);
|
|
2645
|
+
},
|
|
2646
|
+
onClick: (e) => {
|
|
2647
|
+
setIsOpen((prev) => !prev);
|
|
2648
|
+
triggerElement.props.onClick?.(e);
|
|
2649
|
+
}
|
|
2650
|
+
});
|
|
2651
|
+
return /* @__PURE__ */ jsxs(CubeOverflowMenuContext.Provider, { value: closeMenu, children: [
|
|
2652
|
+
clonedAnchor,
|
|
2653
|
+
createPortal(
|
|
2654
|
+
/* @__PURE__ */ jsx(
|
|
2655
|
+
"div",
|
|
2656
|
+
{
|
|
2657
|
+
ref: elementRef,
|
|
2658
|
+
className: menu2(),
|
|
2659
|
+
style: resolvedStyles?.floatingStyle,
|
|
2660
|
+
children
|
|
2661
|
+
}
|
|
2662
|
+
),
|
|
2663
|
+
document.body
|
|
2664
|
+
)
|
|
2665
|
+
] });
|
|
2666
|
+
};
|
|
2667
|
+
CubeOverflowMenu.Item = CubeOverflowMenuItem;
|
|
2668
|
+
CubeOverflowMenu.Divider = CubeOverflowMenuDivider;
|
|
2669
|
+
CubeOverflowMenu.Title = CubeOverflowMenuTitle;
|
|
1125
2670
|
var CubePasswordInput = (props) => {
|
|
1126
2671
|
const { initialShowPassword = false, disabled, ...restProps } = props;
|
|
1127
2672
|
const [showPassword, setShowPassword] = useState(initialShowPassword);
|
|
@@ -1165,7 +2710,7 @@ var iconWrap2 = cva(
|
|
|
1165
2710
|
}
|
|
1166
2711
|
}
|
|
1167
2712
|
);
|
|
1168
|
-
var
|
|
2713
|
+
var label4 = cva("max-w-[152px] break-words text-functional-text", {
|
|
1169
2714
|
variants: {
|
|
1170
2715
|
disabled: {
|
|
1171
2716
|
true: "text-functional-disable-text"
|
|
@@ -1188,7 +2733,7 @@ var CubeRadioButtonGrid = (props) => {
|
|
|
1188
2733
|
};
|
|
1189
2734
|
var CubeRadioButton = (props) => {
|
|
1190
2735
|
const {
|
|
1191
|
-
label:
|
|
2736
|
+
label: label6,
|
|
1192
2737
|
id,
|
|
1193
2738
|
ref,
|
|
1194
2739
|
defaultChecked = false,
|
|
@@ -1235,11 +2780,245 @@ var CubeRadioButton = (props) => {
|
|
|
1235
2780
|
}
|
|
1236
2781
|
),
|
|
1237
2782
|
renderIcon(),
|
|
1238
|
-
/* @__PURE__ */ jsx("span", { className: twMerge(
|
|
2783
|
+
/* @__PURE__ */ jsx("span", { className: twMerge(label4({ disabled })), children: label6 })
|
|
1239
2784
|
] });
|
|
1240
2785
|
};
|
|
1241
2786
|
CubeRadioButton.Skeleton = CubeRadioButtonSkeleton;
|
|
1242
2787
|
CubeRadioButton.Grid = CubeRadioButtonGrid;
|
|
2788
|
+
|
|
2789
|
+
// src/components/CubeStatus/cubeStatusTypes.ts
|
|
2790
|
+
var cubeStatusNeutralValues = [
|
|
2791
|
+
"neutral",
|
|
2792
|
+
"in-use",
|
|
2793
|
+
"finished"
|
|
2794
|
+
];
|
|
2795
|
+
var cubeStatusSuccessValues = [
|
|
2796
|
+
"ok",
|
|
2797
|
+
"success",
|
|
2798
|
+
"active",
|
|
2799
|
+
"available",
|
|
2800
|
+
"powering on"
|
|
2801
|
+
];
|
|
2802
|
+
var cubeStatusWarningValues = [
|
|
2803
|
+
"warning",
|
|
2804
|
+
"error",
|
|
2805
|
+
"fail",
|
|
2806
|
+
"failed",
|
|
2807
|
+
"stopped",
|
|
2808
|
+
"powering off"
|
|
2809
|
+
];
|
|
2810
|
+
|
|
2811
|
+
// src/components/CubeStatus/cubeStatusUtils.ts
|
|
2812
|
+
var neutralStatusSet = new Set(cubeStatusNeutralValues);
|
|
2813
|
+
var successStatusSet = new Set(cubeStatusSuccessValues);
|
|
2814
|
+
var warningStatusSet = new Set(cubeStatusWarningValues);
|
|
2815
|
+
var computeStatusType = (status2) => {
|
|
2816
|
+
if (neutralStatusSet.has(status2)) {
|
|
2817
|
+
return "neutral";
|
|
2818
|
+
} else if (successStatusSet.has(status2)) {
|
|
2819
|
+
return "success";
|
|
2820
|
+
} else if (warningStatusSet.has(status2)) {
|
|
2821
|
+
return "warning";
|
|
2822
|
+
}
|
|
2823
|
+
return "others";
|
|
2824
|
+
};
|
|
2825
|
+
var formatOtherStatusText = (status2) => {
|
|
2826
|
+
const substrings = status2.split("-").filter((text) => !!text);
|
|
2827
|
+
if (!substrings.length) {
|
|
2828
|
+
return status2;
|
|
2829
|
+
}
|
|
2830
|
+
const [firstSubstring = "", ...otherSubstrings] = substrings;
|
|
2831
|
+
const capitalizedFirstSubstring = firstSubstring.charAt(0).toUpperCase() + firstSubstring.substring(1);
|
|
2832
|
+
return [capitalizedFirstSubstring, ...otherSubstrings].join("-");
|
|
2833
|
+
};
|
|
2834
|
+
var status = cva(
|
|
2835
|
+
[
|
|
2836
|
+
"flex h-[19px] w-fit cursor-default items-center rounded-[20px] border px-2.5",
|
|
2837
|
+
"secondary-body6 whitespace-nowrap font-semibold"
|
|
2838
|
+
],
|
|
2839
|
+
{
|
|
2840
|
+
variants: {
|
|
2841
|
+
type: {
|
|
2842
|
+
neutral: "border-cosmos-primary text-cosmos-primary",
|
|
2843
|
+
success: "border-status-positive text-status-positive",
|
|
2844
|
+
warning: "border-status-negative text-status-negative",
|
|
2845
|
+
others: "border-functional-text-light text-functional-text-light"
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
);
|
|
2850
|
+
|
|
2851
|
+
// src/components/CubeStatus/useCubeStatusTranslation.ts
|
|
2852
|
+
var useCubeStatusTranslation = () => {
|
|
2853
|
+
const { t } = useCubeUiTranslation();
|
|
2854
|
+
return {
|
|
2855
|
+
neutral: t("component.status.host.neutral"),
|
|
2856
|
+
"in-use": t("component.status.host.inUse"),
|
|
2857
|
+
finished: t("component.status.host.finished"),
|
|
2858
|
+
ok: t("component.status.host.ok"),
|
|
2859
|
+
success: t("component.status.host.success"),
|
|
2860
|
+
active: t("component.status.host.active"),
|
|
2861
|
+
available: t("component.status.host.available"),
|
|
2862
|
+
"powering on": t("component.status.host.poweringOn"),
|
|
2863
|
+
warning: t("component.status.host.warning"),
|
|
2864
|
+
error: t("component.status.host.error"),
|
|
2865
|
+
fail: t("component.status.host.fail"),
|
|
2866
|
+
failed: t("component.status.host.failed"),
|
|
2867
|
+
stopped: t("component.status.host.stopped"),
|
|
2868
|
+
"powering off": t("component.status.host.poweringOff")
|
|
2869
|
+
};
|
|
2870
|
+
};
|
|
2871
|
+
var CubeStatusSkeleton = () => {
|
|
2872
|
+
return /* @__PURE__ */ jsx(CubeSkeleton, { className: "h-[17px] w-[49px] rounded-[20px]" });
|
|
2873
|
+
};
|
|
2874
|
+
var CubeStatus = (props) => {
|
|
2875
|
+
const { status: status2, message } = props;
|
|
2876
|
+
const type = computeStatusType(status2);
|
|
2877
|
+
const translationMap = useCubeStatusTranslation();
|
|
2878
|
+
const getMessage = () => {
|
|
2879
|
+
if (message) {
|
|
2880
|
+
return message;
|
|
2881
|
+
}
|
|
2882
|
+
if (status2 in translationMap) {
|
|
2883
|
+
return translationMap[status2];
|
|
2884
|
+
}
|
|
2885
|
+
return formatOtherStatusText(status2);
|
|
2886
|
+
};
|
|
2887
|
+
return /* @__PURE__ */ jsx("span", { className: twMerge(status({ type })), children: getMessage() });
|
|
2888
|
+
};
|
|
2889
|
+
CubeStatus.Skeleton = CubeStatusSkeleton;
|
|
2890
|
+
|
|
2891
|
+
// src/components/CubeStatusReaction/cubeStatusReactionTypes.ts
|
|
2892
|
+
var cubeStatusReactionNeutralStatuses = ["neutral"];
|
|
2893
|
+
var cubeStatusReactionSuccessStatuses = [
|
|
2894
|
+
"success",
|
|
2895
|
+
"available",
|
|
2896
|
+
"done"
|
|
2897
|
+
];
|
|
2898
|
+
var cubeStatusReactionWarningStatuses = [
|
|
2899
|
+
"error",
|
|
2900
|
+
"duplicate",
|
|
2901
|
+
"failed"
|
|
2902
|
+
];
|
|
2903
|
+
|
|
2904
|
+
// src/components/CubeStatusReaction/cubeStatusReactionUtils.ts
|
|
2905
|
+
var neutralStatusSet2 = new Set(cubeStatusReactionNeutralStatuses);
|
|
2906
|
+
var successStatusSet2 = new Set(cubeStatusReactionSuccessStatuses);
|
|
2907
|
+
var warningStatusSet2 = new Set(cubeStatusReactionWarningStatuses);
|
|
2908
|
+
var computeStatusType2 = (status2) => {
|
|
2909
|
+
if (neutralStatusSet2.has(status2)) {
|
|
2910
|
+
return "neutral";
|
|
2911
|
+
} else if (successStatusSet2.has(status2)) {
|
|
2912
|
+
return "success";
|
|
2913
|
+
} else if (warningStatusSet2.has(status2)) {
|
|
2914
|
+
return "warning";
|
|
2915
|
+
}
|
|
2916
|
+
throw new Error(`Status ${status2} is not defined in CubeStatusReaction`);
|
|
2917
|
+
};
|
|
2918
|
+
var baseClass = "inline-flex w-fit items-center gap-x-2 px-2 py-[5px]";
|
|
2919
|
+
var statusReaction = cva(
|
|
2920
|
+
[baseClass, "secondary-body3 whitespace-nowrap font-semibold"],
|
|
2921
|
+
{
|
|
2922
|
+
variants: {
|
|
2923
|
+
type: {
|
|
2924
|
+
neutral: "text-status-neutral",
|
|
2925
|
+
success: "text-status-positive",
|
|
2926
|
+
warning: "text-status-negative"
|
|
2927
|
+
}
|
|
2928
|
+
}
|
|
2929
|
+
}
|
|
2930
|
+
);
|
|
2931
|
+
|
|
2932
|
+
// src/components/CubeStatusReaction/useCubeStatusReactionTranslation.ts
|
|
2933
|
+
var useCubeStatusReactionTranslation = () => {
|
|
2934
|
+
const { t } = useCubeUiTranslation();
|
|
2935
|
+
return {
|
|
2936
|
+
neutral: t("component.status.reaction.neutral"),
|
|
2937
|
+
success: t("component.status.reaction.success"),
|
|
2938
|
+
available: t("component.status.reaction.available"),
|
|
2939
|
+
done: t("component.status.reaction.done"),
|
|
2940
|
+
error: t("component.status.reaction.error"),
|
|
2941
|
+
duplicate: t("component.status.reaction.duplicate"),
|
|
2942
|
+
failed: t("component.status.reaction.failed")
|
|
2943
|
+
};
|
|
2944
|
+
};
|
|
2945
|
+
var CubeStatusReactionSkeleton = () => {
|
|
2946
|
+
return /* @__PURE__ */ jsxs("div", { className: baseClass, children: [
|
|
2947
|
+
/* @__PURE__ */ jsx(CubeSkeleton, { className: "size-4" }),
|
|
2948
|
+
/* @__PURE__ */ jsx(CubeSkeleton, { className: "h-4 w-11" })
|
|
2949
|
+
] });
|
|
2950
|
+
};
|
|
2951
|
+
var iconMap = {
|
|
2952
|
+
neutral: CheckmarkBold_default,
|
|
2953
|
+
success: CheckmarkCircleFill_default,
|
|
2954
|
+
warning: CrossFill_default
|
|
2955
|
+
};
|
|
2956
|
+
var CubeStatusReaction = (props) => {
|
|
2957
|
+
const { status: status2, message } = props;
|
|
2958
|
+
const type = computeStatusType2(status2);
|
|
2959
|
+
const Icon = iconMap[type];
|
|
2960
|
+
const translationMap = useCubeStatusReactionTranslation();
|
|
2961
|
+
const getMessage = () => {
|
|
2962
|
+
if (message) {
|
|
2963
|
+
return message;
|
|
2964
|
+
}
|
|
2965
|
+
if (status2 in translationMap) {
|
|
2966
|
+
return translationMap[status2];
|
|
2967
|
+
}
|
|
2968
|
+
return upperFirst(status2);
|
|
2969
|
+
};
|
|
2970
|
+
return /* @__PURE__ */ jsxs("div", { className: twMerge(statusReaction({ type })), children: [
|
|
2971
|
+
/* @__PURE__ */ jsx(Icon, { className: "icon-md-sm shrink-0" }),
|
|
2972
|
+
/* @__PURE__ */ jsx("span", { children: getMessage() })
|
|
2973
|
+
] });
|
|
2974
|
+
};
|
|
2975
|
+
CubeStatusReaction.Skeleton = CubeStatusReactionSkeleton;
|
|
2976
|
+
var number = cva(
|
|
2977
|
+
"secondary-body7 flex size-4 shrink-0 items-center justify-center rounded-full font-extrabold text-white",
|
|
2978
|
+
{
|
|
2979
|
+
variants: {
|
|
2980
|
+
isActive: {
|
|
2981
|
+
true: "bg-functional-text",
|
|
2982
|
+
false: "bg-functional-disable-text"
|
|
2983
|
+
}
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
);
|
|
2987
|
+
var label5 = cva("primary-body3", {
|
|
2988
|
+
variants: {
|
|
2989
|
+
isActive: {
|
|
2990
|
+
true: "font-semibold text-functional-text",
|
|
2991
|
+
false: "text-functional-disable-text"
|
|
2992
|
+
}
|
|
2993
|
+
}
|
|
2994
|
+
});
|
|
2995
|
+
var CubeStepProcessItem = (props) => {
|
|
2996
|
+
const { stepNumber, label: label6, isActive } = props;
|
|
2997
|
+
return /* @__PURE__ */ jsxs("div", { className: "group flex items-center gap-3", children: [
|
|
2998
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
2999
|
+
/* @__PURE__ */ jsx("div", { className: twMerge(number({ isActive })), children: stepNumber.toString() }),
|
|
3000
|
+
/* @__PURE__ */ jsx("p", { className: twMerge(label5({ isActive })), children: label6 })
|
|
3001
|
+
] }),
|
|
3002
|
+
/* @__PURE__ */ jsx(ChevronRight_default, { className: "icon-lg text-functional-text-light group-last:hidden" })
|
|
3003
|
+
] });
|
|
3004
|
+
};
|
|
3005
|
+
var CubeStepProcessSkeleton = (props) => {
|
|
3006
|
+
const { length = 5 } = props;
|
|
3007
|
+
return /* @__PURE__ */ jsx("div", { className: "flex gap-3", children: range(0, length).map((_, index) => /* @__PURE__ */ jsxs("div", { className: "group flex", children: [
|
|
3008
|
+
/* @__PURE__ */ jsx(CubeSkeleton, { className: "mr-2 size-[18px]" }),
|
|
3009
|
+
/* @__PURE__ */ jsx(CubeSkeleton, { className: "mr-3 h-[18px] w-[58px]" }),
|
|
3010
|
+
/* @__PURE__ */ jsx(CubeSkeleton, { className: "size-[18px] group-last:hidden" })
|
|
3011
|
+
] }, index)) });
|
|
3012
|
+
};
|
|
3013
|
+
var CubeStepProcess = (props) => {
|
|
3014
|
+
const { className, children, isLoading } = props;
|
|
3015
|
+
if (isLoading) {
|
|
3016
|
+
return /* @__PURE__ */ jsx(CubeStepProcessSkeleton, {});
|
|
3017
|
+
}
|
|
3018
|
+
return /* @__PURE__ */ jsx("div", { className: twMerge("flex items-center gap-3", className), children });
|
|
3019
|
+
};
|
|
3020
|
+
CubeStepProcess.Item = CubeStepProcessItem;
|
|
3021
|
+
CubeStepProcess.Skeleton = CubeStepProcessSkeleton;
|
|
1243
3022
|
var stroke = cva("", {
|
|
1244
3023
|
variants: {
|
|
1245
3024
|
type: {
|
|
@@ -1320,8 +3099,8 @@ var numberSpan = cva(
|
|
|
1320
3099
|
}
|
|
1321
3100
|
);
|
|
1322
3101
|
var NumberSpan = (props) => {
|
|
1323
|
-
const { number, disabled } = props;
|
|
1324
|
-
const text =
|
|
3102
|
+
const { number: number2, disabled } = props;
|
|
3103
|
+
const text = number2 > 99 ? "N" : number2;
|
|
1325
3104
|
return /* @__PURE__ */ jsx(
|
|
1326
3105
|
"span",
|
|
1327
3106
|
{
|
|
@@ -1360,7 +3139,7 @@ var CubeTab = (props) => {
|
|
|
1360
3139
|
href,
|
|
1361
3140
|
isActive,
|
|
1362
3141
|
disabled = false,
|
|
1363
|
-
number,
|
|
3142
|
+
number: number2,
|
|
1364
3143
|
dot,
|
|
1365
3144
|
onClick: onClickProp
|
|
1366
3145
|
} = props;
|
|
@@ -1382,8 +3161,8 @@ var CubeTab = (props) => {
|
|
|
1382
3161
|
}
|
|
1383
3162
|
);
|
|
1384
3163
|
const renderDecoration = () => {
|
|
1385
|
-
if (
|
|
1386
|
-
return /* @__PURE__ */ jsx(NumberSpan, { number, disabled });
|
|
3164
|
+
if (number2 !== void 0) {
|
|
3165
|
+
return /* @__PURE__ */ jsx(NumberSpan, { number: number2, disabled });
|
|
1387
3166
|
} else if (dot) {
|
|
1388
3167
|
return /* @__PURE__ */ jsx(DotSpan, { disabled });
|
|
1389
3168
|
} else {
|
|
@@ -1950,26 +3729,6 @@ var CubeTextareaSkeleton = () => /* @__PURE__ */ jsxs("div", { className: "flex
|
|
|
1950
3729
|
/* @__PURE__ */ jsx(CubeSkeleton, { className: "h-[20px] min-w-[280px] max-w-[380px]" }),
|
|
1951
3730
|
/* @__PURE__ */ jsx(CubeSkeleton, { className: "h-[140px] min-w-[280px] max-w-[380px]" })
|
|
1952
3731
|
] });
|
|
1953
|
-
|
|
1954
|
-
// src/components/CubeTextarea/cubeTextareaUtils.ts
|
|
1955
|
-
var normalizeValue = (value) => {
|
|
1956
|
-
if (typeof value === "string") return value;
|
|
1957
|
-
if (typeof value === "number") return value.toString();
|
|
1958
|
-
if (Array.isArray(value)) return value.join("");
|
|
1959
|
-
return "";
|
|
1960
|
-
};
|
|
1961
|
-
var calculateValueLength = (value) => {
|
|
1962
|
-
const normalizedValue = normalizeValue(value);
|
|
1963
|
-
return normalizedValue.length;
|
|
1964
|
-
};
|
|
1965
|
-
var assignRefValue = (ref, element) => {
|
|
1966
|
-
if (!ref) return;
|
|
1967
|
-
if (typeof ref === "function") {
|
|
1968
|
-
ref(element);
|
|
1969
|
-
} else {
|
|
1970
|
-
ref.current = element;
|
|
1971
|
-
}
|
|
1972
|
-
};
|
|
1973
3732
|
var useVisibleRowsCount = () => {
|
|
1974
3733
|
const textareaRef = useRef(null);
|
|
1975
3734
|
const [visibleRowsCount, setVisibleRowsCount] = useState(0);
|
|
@@ -2026,7 +3785,7 @@ var CubeTextarea = (props) => {
|
|
|
2026
3785
|
disabled,
|
|
2027
3786
|
value: valueProps,
|
|
2028
3787
|
onChange,
|
|
2029
|
-
label:
|
|
3788
|
+
label: label6,
|
|
2030
3789
|
maxLength,
|
|
2031
3790
|
isLoading,
|
|
2032
3791
|
errorMessage,
|
|
@@ -2057,7 +3816,7 @@ var CubeTextarea = (props) => {
|
|
|
2057
3816
|
{
|
|
2058
3817
|
htmlFor: textareaId,
|
|
2059
3818
|
className: "primary-body2 font-semibold text-functional-text",
|
|
2060
|
-
children:
|
|
3819
|
+
children: label6
|
|
2061
3820
|
}
|
|
2062
3821
|
),
|
|
2063
3822
|
/* @__PURE__ */ jsxs("div", { className: "secondary-body4 text-functional-text-light", children: [
|
|
@@ -2096,134 +3855,224 @@ var CubeTextarea = (props) => {
|
|
|
2096
3855
|
] });
|
|
2097
3856
|
};
|
|
2098
3857
|
CubeTextarea.Skeleton = CubeTextareaSkeleton;
|
|
2099
|
-
var
|
|
2100
|
-
"
|
|
3858
|
+
var caret = cva(
|
|
3859
|
+
"inline-block size-0 border-[6px] border-t-0 border-solid border-transparent border-b-dark-700",
|
|
2101
3860
|
{
|
|
2102
3861
|
variants: {
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
false: "cursor-pointer",
|
|
2109
|
-
true: "cursor-default"
|
|
2110
|
-
}
|
|
2111
|
-
},
|
|
2112
|
-
compoundVariants: [
|
|
2113
|
-
// Not disabled
|
|
2114
|
-
{
|
|
2115
|
-
checked: true,
|
|
2116
|
-
disabled: false,
|
|
2117
|
-
className: "hover:bg-green-400"
|
|
2118
|
-
},
|
|
2119
|
-
{
|
|
2120
|
-
checked: false,
|
|
2121
|
-
disabled: false,
|
|
2122
|
-
className: "hover:bg-grey-400"
|
|
2123
|
-
},
|
|
2124
|
-
// Disabled
|
|
2125
|
-
{
|
|
2126
|
-
checked: true,
|
|
2127
|
-
disabled: true,
|
|
2128
|
-
className: "border-green-200 bg-green-100"
|
|
2129
|
-
},
|
|
2130
|
-
{
|
|
2131
|
-
checked: false,
|
|
2132
|
-
disabled: true,
|
|
2133
|
-
className: "border-functional-disable bg-grey-150"
|
|
3862
|
+
horizontalPlacement: {
|
|
3863
|
+
left: "ml-4 self-start",
|
|
3864
|
+
center: "self-center",
|
|
3865
|
+
right: "mr-4 self-end",
|
|
3866
|
+
"follow-cursor": "self-center"
|
|
2134
3867
|
}
|
|
2135
|
-
|
|
3868
|
+
}
|
|
2136
3869
|
}
|
|
2137
3870
|
);
|
|
2138
|
-
var
|
|
2139
|
-
"
|
|
3871
|
+
var infoBoxContainer = cva(
|
|
3872
|
+
"pointer-events-none flex min-w-[50px] max-w-[480px]",
|
|
2140
3873
|
{
|
|
2141
3874
|
variants: {
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
3875
|
+
verticalPlacement: {
|
|
3876
|
+
top: "flex-col",
|
|
3877
|
+
bottom: "flex-col-reverse"
|
|
3878
|
+
},
|
|
3879
|
+
/**
|
|
3880
|
+
* Hidden and pinned to the viewport's top-left corner: `fixed` keeps it
|
|
3881
|
+
* out of the document flow (no extra scroll height), and the left edge
|
|
3882
|
+
* gives it the full viewport width so it's measured without wrapping.
|
|
3883
|
+
*/
|
|
3884
|
+
isMeasuring: {
|
|
3885
|
+
true: "invisible fixed left-0 top-0",
|
|
3886
|
+
false: "absolute"
|
|
2145
3887
|
}
|
|
2146
3888
|
}
|
|
2147
3889
|
}
|
|
2148
3890
|
);
|
|
2149
|
-
var
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
3891
|
+
var Caret = (props) => {
|
|
3892
|
+
const { placement, translateX: translateXProp } = props;
|
|
3893
|
+
const [verticalPlacement, horizontalPlacement] = splitPlacements(placement);
|
|
3894
|
+
const style = useMemo(() => {
|
|
3895
|
+
const rotateAngle = verticalPlacement === "top" ? 180 : 0;
|
|
3896
|
+
let translateX = translateXProp;
|
|
3897
|
+
if (verticalPlacement === "bottom" && horizontalPlacement === "follow-cursor" && translateXProp < 0) {
|
|
3898
|
+
translateX = translateXProp * -1;
|
|
2154
3899
|
}
|
|
2155
|
-
|
|
2156
|
-
})
|
|
2157
|
-
|
|
3900
|
+
return {
|
|
3901
|
+
transform: `rotate(${rotateAngle}deg) translateX(${translateX}px)`
|
|
3902
|
+
};
|
|
3903
|
+
}, [verticalPlacement, horizontalPlacement, translateXProp]);
|
|
3904
|
+
return /* @__PURE__ */ jsx(
|
|
3905
|
+
"span",
|
|
3906
|
+
{
|
|
3907
|
+
className: twMerge(
|
|
3908
|
+
caret({
|
|
3909
|
+
horizontalPlacement
|
|
3910
|
+
})
|
|
3911
|
+
),
|
|
3912
|
+
style
|
|
3913
|
+
}
|
|
3914
|
+
);
|
|
3915
|
+
};
|
|
3916
|
+
var InfoBox = (props) => {
|
|
2158
3917
|
const {
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
"aria-label": ariaLabel
|
|
3918
|
+
id,
|
|
3919
|
+
information: { title, subtext, message },
|
|
3920
|
+
placement,
|
|
3921
|
+
mouseX,
|
|
3922
|
+
anchorRef
|
|
2165
3923
|
} = props;
|
|
2166
|
-
const
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
3924
|
+
const { elementRef, resolvedStyles } = useFloating({
|
|
3925
|
+
isOpen: true,
|
|
3926
|
+
anchorRef,
|
|
3927
|
+
placement,
|
|
3928
|
+
offsets: {
|
|
3929
|
+
x: 14,
|
|
3930
|
+
y: 2
|
|
3931
|
+
},
|
|
3932
|
+
mouseX
|
|
3933
|
+
});
|
|
3934
|
+
const {
|
|
3935
|
+
idealPlacement = placement,
|
|
3936
|
+
floatingStyle,
|
|
3937
|
+
translateX = 0
|
|
3938
|
+
} = resolvedStyles ?? {};
|
|
3939
|
+
const [verticalPlacement] = splitPlacements(idealPlacement);
|
|
3940
|
+
const renderContent = () => {
|
|
3941
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-y-0.5 rounded-[5px] bg-dark-700 px-3 pb-2.5 pt-2", children: [
|
|
3942
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-x-6 text-primary-200", children: [
|
|
3943
|
+
/* @__PURE__ */ jsx("div", { className: "primary-body2 shrink-0 font-semibold", children: title }),
|
|
3944
|
+
/* @__PURE__ */ jsx("div", { className: "primary-body4 shrink-0", children: subtext })
|
|
3945
|
+
] }),
|
|
3946
|
+
/* @__PURE__ */ jsx("p", { className: "primary-body3 text-grey-0", children: message })
|
|
3947
|
+
] });
|
|
2171
3948
|
};
|
|
2172
|
-
return /* @__PURE__ */ jsxs(
|
|
3949
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2173
3950
|
/* @__PURE__ */ jsx(
|
|
2174
|
-
"
|
|
3951
|
+
"div",
|
|
2175
3952
|
{
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
disabled,
|
|
2184
|
-
onClick: toggleChecked,
|
|
2185
|
-
children: /* @__PURE__ */ jsx("span", { className: thumb({ checked }), "aria-hidden": true })
|
|
3953
|
+
ref: elementRef,
|
|
3954
|
+
"aria-hidden": true,
|
|
3955
|
+
className: infoBoxContainer({
|
|
3956
|
+
verticalPlacement,
|
|
3957
|
+
isMeasuring: true
|
|
3958
|
+
}),
|
|
3959
|
+
children: renderContent()
|
|
2186
3960
|
}
|
|
2187
3961
|
),
|
|
2188
|
-
|
|
2189
|
-
"
|
|
3962
|
+
/* @__PURE__ */ jsxs(
|
|
3963
|
+
"div",
|
|
2190
3964
|
{
|
|
2191
|
-
id
|
|
2192
|
-
|
|
2193
|
-
className:
|
|
2194
|
-
|
|
3965
|
+
id,
|
|
3966
|
+
role: "tooltip",
|
|
3967
|
+
className: infoBoxContainer({
|
|
3968
|
+
verticalPlacement,
|
|
3969
|
+
isMeasuring: !floatingStyle
|
|
3970
|
+
}),
|
|
3971
|
+
style: floatingStyle,
|
|
3972
|
+
children: [
|
|
3973
|
+
renderContent(),
|
|
3974
|
+
/* @__PURE__ */ jsx(Caret, { placement: idealPlacement, translateX })
|
|
3975
|
+
]
|
|
2195
3976
|
}
|
|
2196
3977
|
)
|
|
2197
3978
|
] });
|
|
2198
3979
|
};
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
3980
|
+
var CubeTooltip = (props) => {
|
|
3981
|
+
const {
|
|
3982
|
+
placement = "top-center",
|
|
3983
|
+
hoverContent,
|
|
3984
|
+
clickContent,
|
|
3985
|
+
children: anchorElement
|
|
3986
|
+
} = props;
|
|
3987
|
+
const [visibilityState, setVisibilityState] = useState(void 0);
|
|
3988
|
+
const [mouseX, setMouseX] = useState(0);
|
|
3989
|
+
const anchorRef = useRef(null);
|
|
3990
|
+
const tooltipId = useId();
|
|
3991
|
+
const infoMap = {
|
|
3992
|
+
hover: hoverContent,
|
|
3993
|
+
click: clickContent
|
|
3994
|
+
};
|
|
3995
|
+
const isVisible = visibilityState !== void 0 && infoMap[visibilityState] !== void 0;
|
|
3996
|
+
useEffect(() => {
|
|
3997
|
+
if (!isVisible) return;
|
|
3998
|
+
const onKeyDown = (e) => {
|
|
3999
|
+
if (e.key === "Escape") {
|
|
4000
|
+
setVisibilityState(void 0);
|
|
4001
|
+
}
|
|
4002
|
+
};
|
|
4003
|
+
document.addEventListener("keydown", onKeyDown);
|
|
4004
|
+
return () => {
|
|
4005
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
4006
|
+
};
|
|
4007
|
+
}, [isVisible]);
|
|
4008
|
+
const onMouseEnter = (e) => {
|
|
4009
|
+
if (hoverContent) {
|
|
4010
|
+
setVisibilityState("hover");
|
|
4011
|
+
}
|
|
4012
|
+
anchorElement.props.onMouseEnter?.(e);
|
|
4013
|
+
};
|
|
4014
|
+
const onMouseMove = (e) => {
|
|
4015
|
+
setMouseX(e.clientX);
|
|
4016
|
+
anchorElement.props.onMouseMove?.(e);
|
|
4017
|
+
};
|
|
4018
|
+
const onMouseLeave = (e) => {
|
|
4019
|
+
setVisibilityState(void 0);
|
|
4020
|
+
anchorElement.props.onMouseLeave?.(e);
|
|
4021
|
+
};
|
|
4022
|
+
const onClick = (e) => {
|
|
4023
|
+
if (clickContent) {
|
|
4024
|
+
setVisibilityState("click");
|
|
4025
|
+
}
|
|
4026
|
+
anchorElement.props.onClick?.(e);
|
|
4027
|
+
};
|
|
4028
|
+
const onFocus = (e) => {
|
|
4029
|
+
if (hoverContent) {
|
|
4030
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
4031
|
+
setMouseX(rect.left + rect.width / 2);
|
|
4032
|
+
setVisibilityState("hover");
|
|
4033
|
+
}
|
|
4034
|
+
anchorElement.props.onFocus?.(e);
|
|
4035
|
+
};
|
|
4036
|
+
const onBlur = (e) => {
|
|
4037
|
+
setVisibilityState(void 0);
|
|
4038
|
+
anchorElement.props.onBlur?.(e);
|
|
4039
|
+
};
|
|
4040
|
+
if (anchorElement.type === Fragment) {
|
|
4041
|
+
throw new Error("Fragment children is not supported in CubeTooltip");
|
|
2224
4042
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
4043
|
+
const ariaDescribedBy = [anchorElement.props["aria-describedby"], isVisible ? tooltipId : null].filter(Boolean).join(" ") || void 0;
|
|
4044
|
+
const clonedAnchor = cloneElement(anchorElement, {
|
|
4045
|
+
ref: (element) => {
|
|
4046
|
+
const { ref: anchorRefProp } = anchorElement.props;
|
|
4047
|
+
assignRefValue(anchorRefProp, element);
|
|
4048
|
+
assignRefValue(anchorRef, element);
|
|
4049
|
+
},
|
|
4050
|
+
onMouseEnter,
|
|
4051
|
+
onMouseMove,
|
|
4052
|
+
onMouseLeave,
|
|
4053
|
+
onClick,
|
|
4054
|
+
onFocus,
|
|
4055
|
+
onBlur,
|
|
4056
|
+
"aria-describedby": ariaDescribedBy
|
|
4057
|
+
});
|
|
4058
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
4059
|
+
clonedAnchor,
|
|
4060
|
+
visibilityState !== void 0 && infoMap[visibilityState] && createPortal(
|
|
4061
|
+
/* @__PURE__ */ jsx(
|
|
4062
|
+
InfoBox,
|
|
4063
|
+
{
|
|
4064
|
+
id: tooltipId,
|
|
4065
|
+
information: infoMap[visibilityState],
|
|
4066
|
+
placement,
|
|
4067
|
+
mouseX,
|
|
4068
|
+
anchorRef
|
|
4069
|
+
},
|
|
4070
|
+
visibilityState
|
|
4071
|
+
),
|
|
4072
|
+
document.body
|
|
4073
|
+
)
|
|
4074
|
+
] });
|
|
4075
|
+
};
|
|
2227
4076
|
|
|
2228
4077
|
// src/i18n/addCubeUiTranslations.ts
|
|
2229
4078
|
function addCubeUiTranslations(locale, resources) {
|
|
@@ -2239,9 +4088,6 @@ var CubeUiLocaleProvider = (props) => {
|
|
|
2239
4088
|
}, [locale]);
|
|
2240
4089
|
return children;
|
|
2241
4090
|
};
|
|
2242
|
-
var useCubeUiTranslation = (ns, options) => {
|
|
2243
|
-
return useTranslation(ns, { ...options, i18n: i18n_default });
|
|
2244
|
-
};
|
|
2245
4091
|
var CubeThemeProvider = (props) => {
|
|
2246
4092
|
const { theme, children } = props;
|
|
2247
4093
|
useEffect(() => {
|
|
@@ -2909,6 +4755,6 @@ var cubePreset = {
|
|
|
2909
4755
|
]
|
|
2910
4756
|
};
|
|
2911
4757
|
|
|
2912
|
-
export { CubeButton, CubeCheckbox, CubeHyperlink, CubeIconFrame, CubeInput, CubeLoadingSpinner, CubePasswordInput, CubeRadioButton, CubeSkeleton, CubeStroke, CubeTabs, CubeTag, CubeTextarea, CubeThemeProvider, CubeToggle, CubeUiLocaleProvider, addCubeUiTranslations, cubePreset, cubeTheme, getTypography, useCubeUiTranslation };
|
|
4758
|
+
export { CubeButton, CubeCheckbox, CubeDropdown, CubeHyperlink, CubeIconFrame, CubeInput, CubeLoadingSpinner, CubeOverflowMenu, CubePasswordInput, CubeRadioButton, CubeSkeleton, CubeStatus, CubeStatusReaction, CubeStepProcess, CubeStroke, CubeTabs, CubeTag, CubeTextarea, CubeThemeProvider, CubeToggle, CubeTooltip, CubeUiLocaleProvider, addCubeUiTranslations, cubePreset, cubeTheme, getTypography, useCubeUiTranslation };
|
|
2913
4759
|
//# sourceMappingURL=index.mjs.map
|
|
2914
4760
|
//# sourceMappingURL=index.mjs.map
|