@sentio/ui-core 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +174 -173
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -93,9 +93,8 @@ function _BarLoading({
|
|
|
93
93
|
hint = "Loading Sentio",
|
|
94
94
|
loading = true,
|
|
95
95
|
className,
|
|
96
|
-
iconClassName,
|
|
97
96
|
width = 150,
|
|
98
|
-
|
|
97
|
+
logo
|
|
99
98
|
}) {
|
|
100
99
|
if (loading) {
|
|
101
100
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -106,6 +105,7 @@ function _BarLoading({
|
|
|
106
105
|
className
|
|
107
106
|
),
|
|
108
107
|
children: [
|
|
108
|
+
logo,
|
|
109
109
|
hint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "loading-text text-icontent text-gray my-2 text-center font-medium", children: hint }),
|
|
110
110
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex justify-center pt-1", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
111
111
|
import_react_spinners.BarLoader,
|
|
@@ -128,10 +128,11 @@ function _BarLoading({
|
|
|
128
128
|
var BarLoading = (0, import_react.memo)(_BarLoading);
|
|
129
129
|
|
|
130
130
|
// src/common/SpinLoading.tsx
|
|
131
|
+
var import_react2 = __toESM(require("react"));
|
|
131
132
|
var import_react_spinners2 = require("react-spinners");
|
|
132
133
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
133
134
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
134
|
-
var SpinLoading = function Spinner(args) {
|
|
135
|
+
var SpinLoading = import_react2.default.forwardRef(function Spinner(args, ref) {
|
|
135
136
|
const {
|
|
136
137
|
loading = false,
|
|
137
138
|
children,
|
|
@@ -140,7 +141,7 @@ var SpinLoading = function Spinner(args) {
|
|
|
140
141
|
showMask,
|
|
141
142
|
maskOpacity = 80
|
|
142
143
|
} = args;
|
|
143
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: (0, import_class_variance_authority2.cx)("relative", className), children: [
|
|
144
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref, className: (0, import_class_variance_authority2.cx)("relative", className), children: [
|
|
144
145
|
showMask && loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
145
146
|
"div",
|
|
146
147
|
{
|
|
@@ -163,10 +164,10 @@ var SpinLoading = function Spinner(args) {
|
|
|
163
164
|
) }),
|
|
164
165
|
children
|
|
165
166
|
] });
|
|
166
|
-
};
|
|
167
|
+
});
|
|
167
168
|
|
|
168
169
|
// src/common/CopyButton.tsx
|
|
169
|
-
var
|
|
170
|
+
var import_react3 = require("react");
|
|
170
171
|
var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
|
|
171
172
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
172
173
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -216,12 +217,12 @@ var CopyButton = ({
|
|
|
216
217
|
children,
|
|
217
218
|
className
|
|
218
219
|
}) => {
|
|
219
|
-
const [copied, setCopied] = (0,
|
|
220
|
-
const [isHovered, setIsHovered] = (0,
|
|
221
|
-
const [isMobile, setIsMobile] = (0,
|
|
222
|
-
const timeoutRef = (0,
|
|
223
|
-
const iconContainerRef = (0,
|
|
224
|
-
(0,
|
|
220
|
+
const [copied, setCopied] = (0, import_react3.useState)(false);
|
|
221
|
+
const [isHovered, setIsHovered] = (0, import_react3.useState)(false);
|
|
222
|
+
const [isMobile, setIsMobile] = (0, import_react3.useState)(false);
|
|
223
|
+
const timeoutRef = (0, import_react3.useRef)(null);
|
|
224
|
+
const iconContainerRef = (0, import_react3.useRef)(null);
|
|
225
|
+
(0, import_react3.useEffect)(() => {
|
|
225
226
|
const checkMobile = () => {
|
|
226
227
|
setIsMobile(window.innerWidth < 640);
|
|
227
228
|
};
|
|
@@ -229,7 +230,7 @@ var CopyButton = ({
|
|
|
229
230
|
window.addEventListener("resize", checkMobile);
|
|
230
231
|
return () => window.removeEventListener("resize", checkMobile);
|
|
231
232
|
}, []);
|
|
232
|
-
const copyToClipboard = (0,
|
|
233
|
+
const copyToClipboard = (0, import_react3.useCallback)((val) => {
|
|
233
234
|
(0, import_copy_to_clipboard.default)(val);
|
|
234
235
|
setCopied(true);
|
|
235
236
|
if (timeoutRef.current) {
|
|
@@ -240,7 +241,7 @@ var CopyButton = ({
|
|
|
240
241
|
timeoutRef.current = null;
|
|
241
242
|
}, 2e3);
|
|
242
243
|
}, []);
|
|
243
|
-
const onCopy = (0,
|
|
244
|
+
const onCopy = (0, import_react3.useCallback)(
|
|
244
245
|
(e) => {
|
|
245
246
|
const target = e.target;
|
|
246
247
|
if (target.nodeName.toLowerCase() === "a" && target.getAttribute("href")) {
|
|
@@ -266,7 +267,7 @@ var CopyButton = ({
|
|
|
266
267
|
},
|
|
267
268
|
[copied, text, copyToClipboard]
|
|
268
269
|
);
|
|
269
|
-
const handleEventProxy = (0,
|
|
270
|
+
const handleEventProxy = (0, import_react3.useCallback)(
|
|
270
271
|
(e) => {
|
|
271
272
|
if (children) {
|
|
272
273
|
onCopy(e);
|
|
@@ -350,11 +351,11 @@ var CopyButton = ({
|
|
|
350
351
|
};
|
|
351
352
|
|
|
352
353
|
// src/common/NewButton.tsx
|
|
353
|
-
var
|
|
354
|
+
var import_react6 = require("react");
|
|
354
355
|
|
|
355
356
|
// src/common/DivTooltip.tsx
|
|
356
|
-
var
|
|
357
|
-
var
|
|
357
|
+
var import_react4 = __toESM(require("react"));
|
|
358
|
+
var import_react5 = require("@floating-ui/react");
|
|
358
359
|
var import_class_variance_authority4 = require("class-variance-authority");
|
|
359
360
|
var import_lodash = require("lodash");
|
|
360
361
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -374,10 +375,10 @@ var PopoverTooltip = ({
|
|
|
374
375
|
enableFadeAnimation = false,
|
|
375
376
|
animationDuration = 150
|
|
376
377
|
}) => {
|
|
377
|
-
const arrowRef = (0,
|
|
378
|
-
const [open, setOpen] = (0,
|
|
379
|
-
const [isVisible, setIsVisible] = (0,
|
|
380
|
-
const timeoutRef = (0,
|
|
378
|
+
const arrowRef = (0, import_react4.useRef)(null);
|
|
379
|
+
const [open, setOpen] = (0, import_react4.useState)(false);
|
|
380
|
+
const [isVisible, setIsVisible] = (0, import_react4.useState)(false);
|
|
381
|
+
const timeoutRef = (0, import_react4.useRef)();
|
|
381
382
|
const {
|
|
382
383
|
x,
|
|
383
384
|
y,
|
|
@@ -386,7 +387,7 @@ var PopoverTooltip = ({
|
|
|
386
387
|
middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },
|
|
387
388
|
context,
|
|
388
389
|
placement
|
|
389
|
-
} = (0,
|
|
390
|
+
} = (0, import_react5.useFloating)({
|
|
390
391
|
open,
|
|
391
392
|
onOpenChange: (newOpen) => {
|
|
392
393
|
setOpen(newOpen);
|
|
@@ -406,30 +407,30 @@ var PopoverTooltip = ({
|
|
|
406
407
|
}
|
|
407
408
|
},
|
|
408
409
|
middleware: [
|
|
409
|
-
(0,
|
|
410
|
-
(0,
|
|
411
|
-
(0,
|
|
412
|
-
(0,
|
|
410
|
+
(0, import_react5.offset)(offsetOptions),
|
|
411
|
+
(0, import_react5.flip)(),
|
|
412
|
+
(0, import_react5.shift)(),
|
|
413
|
+
(0, import_react5.arrow)({ element: arrowRef, padding: 8 })
|
|
413
414
|
],
|
|
414
415
|
strategy: propStrategy,
|
|
415
416
|
placement: placementOption,
|
|
416
|
-
whileElementsMounted:
|
|
417
|
+
whileElementsMounted: import_react5.autoUpdate
|
|
417
418
|
});
|
|
418
419
|
const {
|
|
419
420
|
delay = {
|
|
420
421
|
open: 500,
|
|
421
422
|
close: 0
|
|
422
423
|
}
|
|
423
|
-
} = (0,
|
|
424
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
425
|
-
(0,
|
|
426
|
-
handleClose: (0,
|
|
424
|
+
} = (0, import_react5.useDelayGroup)(context);
|
|
425
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react5.useInteractions)([
|
|
426
|
+
(0, import_react5.useHover)(context, {
|
|
427
|
+
handleClose: (0, import_react5.safePolygon)({
|
|
427
428
|
buffer: -Infinity
|
|
428
429
|
}),
|
|
429
430
|
delay
|
|
430
431
|
})
|
|
431
432
|
]);
|
|
432
|
-
(0,
|
|
433
|
+
(0, import_react4.useEffect)(() => {
|
|
433
434
|
return () => {
|
|
434
435
|
if (timeoutRef.current) {
|
|
435
436
|
clearTimeout(timeoutRef.current);
|
|
@@ -441,7 +442,7 @@ var PopoverTooltip = ({
|
|
|
441
442
|
icon,
|
|
442
443
|
children
|
|
443
444
|
] });
|
|
444
|
-
const Portal = usePortal ?
|
|
445
|
+
const Portal = usePortal ? import_react5.FloatingPortal : import_react4.default.Fragment;
|
|
445
446
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_class_variance_authority4.cx)("relative flex items-center", className), children: [
|
|
446
447
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
447
448
|
"div",
|
|
@@ -681,7 +682,7 @@ function Button({
|
|
|
681
682
|
id
|
|
682
683
|
}, ref) {
|
|
683
684
|
const iconClasses = iconClass({ size, disabled });
|
|
684
|
-
const iconEl = (0,
|
|
685
|
+
const iconEl = (0, import_react6.useMemo)(() => {
|
|
685
686
|
let iconEl2 = null;
|
|
686
687
|
if (processing) {
|
|
687
688
|
iconEl2 = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -692,7 +693,7 @@ function Button({
|
|
|
692
693
|
}
|
|
693
694
|
);
|
|
694
695
|
} else if (icon) {
|
|
695
|
-
iconEl2 = (0,
|
|
696
|
+
iconEl2 = (0, import_react6.cloneElement)(icon, { className: (0, import_class_variance_authority5.cx)(icon.props.className, iconClasses) });
|
|
696
697
|
}
|
|
697
698
|
return iconEl2;
|
|
698
699
|
}, [icon, iconClasses, processing, role]);
|
|
@@ -739,15 +740,15 @@ function Button({
|
|
|
739
740
|
}
|
|
740
741
|
return btn;
|
|
741
742
|
}
|
|
742
|
-
var NewButton = (0,
|
|
743
|
+
var NewButton = (0, import_react6.forwardRef)(Button);
|
|
743
744
|
var NewButton_default = NewButton;
|
|
744
745
|
|
|
745
746
|
// src/common/dialog/BaseDialog.tsx
|
|
746
|
-
var
|
|
747
|
-
var
|
|
747
|
+
var import_react7 = require("react");
|
|
748
|
+
var import_react8 = require("@headlessui/react");
|
|
748
749
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
749
750
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
750
|
-
var BaseZIndexContext = (0,
|
|
751
|
+
var BaseZIndexContext = (0, import_react7.createContext)(10);
|
|
751
752
|
var _BaseDialog = ({
|
|
752
753
|
title,
|
|
753
754
|
open,
|
|
@@ -770,8 +771,8 @@ var _BaseDialog = ({
|
|
|
770
771
|
zIndex = 10,
|
|
771
772
|
mask = "normal"
|
|
772
773
|
}) => {
|
|
773
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
774
|
-
|
|
774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react8.Transition, { appear: true, as: import_react7.Fragment, show: open, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
775
|
+
import_react8.Dialog,
|
|
775
776
|
{
|
|
776
777
|
className: (0, import_class_variance_authority6.cx)("relative", "_sentio_"),
|
|
777
778
|
as: "div",
|
|
@@ -782,9 +783,9 @@ var _BaseDialog = ({
|
|
|
782
783
|
},
|
|
783
784
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(BaseZIndexContext.Provider, { value: zIndex, children: [
|
|
784
785
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
785
|
-
|
|
786
|
+
import_react8.Transition.Child,
|
|
786
787
|
{
|
|
787
|
-
as:
|
|
788
|
+
as: import_react7.Fragment,
|
|
788
789
|
enter: "ease-out duration-300",
|
|
789
790
|
enterFrom: "opacity-0",
|
|
790
791
|
enterTo: "opacity-100",
|
|
@@ -803,9 +804,9 @@ var _BaseDialog = ({
|
|
|
803
804
|
}
|
|
804
805
|
),
|
|
805
806
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "fixed inset-0 z-10 overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
806
|
-
|
|
807
|
+
import_react8.Transition.Child,
|
|
807
808
|
{
|
|
808
|
-
as:
|
|
809
|
+
as: import_react7.Fragment,
|
|
809
810
|
enter: "ease-out duration-300",
|
|
810
811
|
enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
811
812
|
enterTo: "opacity-100 translate-y-0 sm:scale-100",
|
|
@@ -813,7 +814,7 @@ var _BaseDialog = ({
|
|
|
813
814
|
leaveFrom: "opacity-100 translate-y-0 sm:scale-100",
|
|
814
815
|
leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
815
816
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
816
|
-
|
|
817
|
+
import_react8.Dialog.Panel,
|
|
817
818
|
{
|
|
818
819
|
"data-testid": "create-dashboard",
|
|
819
820
|
className: (0, import_class_variance_authority6.cx)(
|
|
@@ -822,7 +823,7 @@ var _BaseDialog = ({
|
|
|
822
823
|
),
|
|
823
824
|
children: [
|
|
824
825
|
title ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
825
|
-
|
|
826
|
+
import_react8.Dialog.Title,
|
|
826
827
|
{
|
|
827
828
|
as: "h3",
|
|
828
829
|
className: (0, import_class_variance_authority6.cx)(
|
|
@@ -875,10 +876,10 @@ var _BaseDialog = ({
|
|
|
875
876
|
}
|
|
876
877
|
) });
|
|
877
878
|
};
|
|
878
|
-
var BaseDialog = (0,
|
|
879
|
+
var BaseDialog = (0, import_react7.memo)(_BaseDialog);
|
|
879
880
|
|
|
880
881
|
// src/common/DisclosurePanel.tsx
|
|
881
|
-
var
|
|
882
|
+
var import_react9 = require("react");
|
|
882
883
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
883
884
|
var import_isFunction = __toESM(require("lodash/isFunction"));
|
|
884
885
|
var import_lu = require("react-icons/lu");
|
|
@@ -892,8 +893,8 @@ var DisclosurePanel = ({
|
|
|
892
893
|
iconClassName = "h-5 w-5",
|
|
893
894
|
titleClassName
|
|
894
895
|
}) => {
|
|
895
|
-
const [open, setOpen] = (0,
|
|
896
|
-
const toggle = (0,
|
|
896
|
+
const [open, setOpen] = (0, import_react9.useState)(defaultOpen || false);
|
|
897
|
+
const toggle = (0, import_react9.useCallback)(() => {
|
|
897
898
|
setOpen((prev) => !prev);
|
|
898
899
|
}, []);
|
|
899
900
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
@@ -937,12 +938,12 @@ var import_solid = require("@heroicons/react/20/solid");
|
|
|
937
938
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
938
939
|
|
|
939
940
|
// src/utils/use-boolean.ts
|
|
940
|
-
var
|
|
941
|
+
var import_react10 = require("react");
|
|
941
942
|
function useBoolean(defaultValue = false) {
|
|
942
|
-
const [value, setValue] = (0,
|
|
943
|
-
const setTrue = (0,
|
|
944
|
-
const setFalse = (0,
|
|
945
|
-
const toggle = (0,
|
|
943
|
+
const [value, setValue] = (0, import_react10.useState)(defaultValue);
|
|
944
|
+
const setTrue = (0, import_react10.useCallback)(() => setValue(true), []);
|
|
945
|
+
const setFalse = (0, import_react10.useCallback)(() => setValue(false), []);
|
|
946
|
+
const toggle = (0, import_react10.useCallback)(() => setValue((v) => !v), []);
|
|
946
947
|
return {
|
|
947
948
|
value,
|
|
948
949
|
setValue,
|
|
@@ -953,7 +954,7 @@ function useBoolean(defaultValue = false) {
|
|
|
953
954
|
}
|
|
954
955
|
|
|
955
956
|
// src/common/Collapse.tsx
|
|
956
|
-
var
|
|
957
|
+
var import_react11 = require("react");
|
|
957
958
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
958
959
|
var Collapse = ({
|
|
959
960
|
title,
|
|
@@ -964,7 +965,7 @@ var Collapse = ({
|
|
|
964
965
|
iconClassName = "h-5 w-5"
|
|
965
966
|
}) => {
|
|
966
967
|
const { toggle, value: visible, setTrue, setFalse } = useBoolean(defaultOpen);
|
|
967
|
-
(0,
|
|
968
|
+
(0, import_react11.useEffect)(() => {
|
|
968
969
|
if (defaultOpen) {
|
|
969
970
|
setTrue();
|
|
970
971
|
} else {
|
|
@@ -1014,7 +1015,7 @@ var Collapse = ({
|
|
|
1014
1015
|
// src/common/Input.tsx
|
|
1015
1016
|
var import_class_variance_authority9 = require("class-variance-authority");
|
|
1016
1017
|
var import_solid2 = require("@heroicons/react/20/solid");
|
|
1017
|
-
var
|
|
1018
|
+
var import_react12 = require("react");
|
|
1018
1019
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1019
1020
|
var inputContainerStyles = (0, import_class_variance_authority9.cva)(
|
|
1020
1021
|
"flex relative rounded-md border focus-within:ring-1 w-full font-normal overflow-hidden",
|
|
@@ -1080,7 +1081,7 @@ var iconStyles = (0, import_class_variance_authority9.cva)("text-red-500", {
|
|
|
1080
1081
|
size: "md"
|
|
1081
1082
|
}
|
|
1082
1083
|
});
|
|
1083
|
-
var Input = (0,
|
|
1084
|
+
var Input = (0, import_react12.forwardRef)(
|
|
1084
1085
|
function Input2(props, inputRef) {
|
|
1085
1086
|
const { className, error, errorClassName, size, ...rest } = props;
|
|
1086
1087
|
const containerClassName = inputContainerStyles({
|
|
@@ -1100,7 +1101,7 @@ var Input = (0, import_react11.forwardRef)(
|
|
|
1100
1101
|
);
|
|
1101
1102
|
|
|
1102
1103
|
// src/common/select/Radio.tsx
|
|
1103
|
-
var
|
|
1104
|
+
var import_react13 = require("@headlessui/react");
|
|
1104
1105
|
|
|
1105
1106
|
// src/utils/classnames.ts
|
|
1106
1107
|
var import_class_variance_authority10 = require("class-variance-authority");
|
|
@@ -1116,8 +1117,8 @@ function RadioSelect({
|
|
|
1116
1117
|
vertical,
|
|
1117
1118
|
containerClassName
|
|
1118
1119
|
}) {
|
|
1119
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1120
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react13.RadioGroup, { value, onChange, children: [
|
|
1121
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react13.RadioGroup.Label, { className: "text-ilabel text-text-foreground mr-4 font-medium", children: [
|
|
1121
1122
|
label,
|
|
1122
1123
|
":"
|
|
1123
1124
|
] }),
|
|
@@ -1129,7 +1130,7 @@ function RadioSelect({
|
|
|
1129
1130
|
vertical ? "flex flex-col gap-2" : "inline-flex gap-4",
|
|
1130
1131
|
containerClassName
|
|
1131
1132
|
),
|
|
1132
|
-
children: options.map(({ name, value: value2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1133
|
+
children: options.map(({ name, value: value2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react13.RadioGroup.Option, { value: value2, children: ({ checked }) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "group/radio", children: [
|
|
1133
1134
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1134
1135
|
"input",
|
|
1135
1136
|
{
|
|
@@ -1157,8 +1158,8 @@ function RadioSelect({
|
|
|
1157
1158
|
}
|
|
1158
1159
|
|
|
1159
1160
|
// src/common/select/Switch.tsx
|
|
1160
|
-
var
|
|
1161
|
-
var
|
|
1161
|
+
var import_react14 = require("react");
|
|
1162
|
+
var import_react15 = require("@headlessui/react");
|
|
1162
1163
|
var import_class_variance_authority11 = require("class-variance-authority");
|
|
1163
1164
|
var import_lodash2 = require("lodash");
|
|
1164
1165
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
@@ -1259,8 +1260,8 @@ function Switch({
|
|
|
1259
1260
|
disabled,
|
|
1260
1261
|
label
|
|
1261
1262
|
}) {
|
|
1262
|
-
const [enabled, setState] = (0,
|
|
1263
|
-
const onChange = (0,
|
|
1263
|
+
const [enabled, setState] = (0, import_react14.useState)(checked);
|
|
1264
|
+
const onChange = (0, import_react14.useCallback)(() => {
|
|
1264
1265
|
setState((enabled2) => {
|
|
1265
1266
|
if ((0, import_lodash2.isFunction)(_onChange)) {
|
|
1266
1267
|
setTimeout(() => {
|
|
@@ -1270,12 +1271,12 @@ function Switch({
|
|
|
1270
1271
|
return !enabled2;
|
|
1271
1272
|
});
|
|
1272
1273
|
}, [_onChange]);
|
|
1273
|
-
(0,
|
|
1274
|
+
(0, import_react14.useEffect)(() => {
|
|
1274
1275
|
setState(checked);
|
|
1275
1276
|
}, [checked]);
|
|
1276
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react15.Switch.Group, { children: [
|
|
1277
1278
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1278
|
-
|
|
1279
|
+
import_react15.Switch,
|
|
1279
1280
|
{
|
|
1280
1281
|
checked: enabled,
|
|
1281
1282
|
onChange: onChange || setState,
|
|
@@ -1301,7 +1302,7 @@ function Switch({
|
|
|
1301
1302
|
}
|
|
1302
1303
|
),
|
|
1303
1304
|
label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1304
|
-
|
|
1305
|
+
import_react15.Switch.Label,
|
|
1305
1306
|
{
|
|
1306
1307
|
className: labelClass({
|
|
1307
1308
|
size,
|
|
@@ -1314,11 +1315,11 @@ function Switch({
|
|
|
1314
1315
|
}
|
|
1315
1316
|
|
|
1316
1317
|
// src/common/select/Select.tsx
|
|
1317
|
-
var
|
|
1318
|
+
var import_react16 = require("@headlessui/react");
|
|
1318
1319
|
var import_solid3 = require("@heroicons/react/20/solid");
|
|
1319
1320
|
var import_lodash3 = require("lodash");
|
|
1320
1321
|
var import_class_variance_authority12 = require("class-variance-authority");
|
|
1321
|
-
var
|
|
1322
|
+
var import_react17 = require("react");
|
|
1322
1323
|
var import_isFunction2 = __toESM(require("lodash/isFunction"));
|
|
1323
1324
|
var import_react_spinners3 = require("react-spinners");
|
|
1324
1325
|
var import_react_laag = require("react-laag");
|
|
@@ -1434,14 +1435,14 @@ function Select({
|
|
|
1434
1435
|
asLayer
|
|
1435
1436
|
}) {
|
|
1436
1437
|
const selectedIndex = options.findIndex((o) => (0, import_lodash3.isEqual)(o.value, value));
|
|
1437
|
-
const listRef = (0,
|
|
1438
|
-
const [open, setOpen] = (0,
|
|
1438
|
+
const listRef = (0, import_react17.useRef)(null);
|
|
1439
|
+
const [open, setOpen] = (0, import_react17.useState)(false);
|
|
1439
1440
|
const { width, ref } = (0, import_react_resize_detector.useResizeDetector)({
|
|
1440
1441
|
refreshMode: "debounce",
|
|
1441
1442
|
refreshRate: 100,
|
|
1442
1443
|
handleHeight: false
|
|
1443
1444
|
});
|
|
1444
|
-
const baseZIndex = (0,
|
|
1445
|
+
const baseZIndex = (0, import_react17.useContext)(BaseZIndexContext);
|
|
1445
1446
|
const { renderLayer, triggerProps, layerProps } = (0, import_react_laag.useLayer)({
|
|
1446
1447
|
isOpen: open,
|
|
1447
1448
|
auto: true,
|
|
@@ -1451,7 +1452,7 @@ function Select({
|
|
|
1451
1452
|
triggerOffset: 4,
|
|
1452
1453
|
onOutsideClick: () => setOpen(false)
|
|
1453
1454
|
});
|
|
1454
|
-
const grouped = (0,
|
|
1455
|
+
const grouped = (0, import_react17.useMemo)(() => {
|
|
1455
1456
|
if (!groupedOptions || !options || options.length === 0) {
|
|
1456
1457
|
return options;
|
|
1457
1458
|
}
|
|
@@ -1471,7 +1472,7 @@ function Select({
|
|
|
1471
1472
|
}, []);
|
|
1472
1473
|
}, [groupedOptions, groupedOrder, options]);
|
|
1473
1474
|
const optionsElement = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1474
|
-
|
|
1475
|
+
import_react16.Listbox.Options,
|
|
1475
1476
|
{
|
|
1476
1477
|
ref: listRef,
|
|
1477
1478
|
onScroll: () => {
|
|
@@ -1490,7 +1491,7 @@ function Select({
|
|
|
1490
1491
|
),
|
|
1491
1492
|
children: [
|
|
1492
1493
|
!options || options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1493
|
-
|
|
1494
|
+
import_react16.Listbox.Option,
|
|
1494
1495
|
{
|
|
1495
1496
|
value: null,
|
|
1496
1497
|
disabled: true,
|
|
@@ -1506,7 +1507,7 @@ function Select({
|
|
|
1506
1507
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-gray px-3.5 py-1 text-xs font-medium", children: label }),
|
|
1507
1508
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: options2.map(
|
|
1508
1509
|
(option, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1509
|
-
|
|
1510
|
+
import_react16.Listbox.Option,
|
|
1510
1511
|
{
|
|
1511
1512
|
value: option.value,
|
|
1512
1513
|
disabled: option.disabled,
|
|
@@ -1558,7 +1559,7 @@ function Select({
|
|
|
1558
1559
|
) })
|
|
1559
1560
|
] }, label);
|
|
1560
1561
|
}) : options.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1561
|
-
|
|
1562
|
+
import_react16.Listbox.Option,
|
|
1562
1563
|
{
|
|
1563
1564
|
value: option.value,
|
|
1564
1565
|
disabled: option.disabled,
|
|
@@ -1605,7 +1606,7 @@ function Select({
|
|
|
1605
1606
|
i
|
|
1606
1607
|
)),
|
|
1607
1608
|
isFetchingMore && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1608
|
-
|
|
1609
|
+
import_react16.Listbox.Option,
|
|
1609
1610
|
{
|
|
1610
1611
|
value: null,
|
|
1611
1612
|
disabled: true,
|
|
@@ -1619,13 +1620,13 @@ function Select({
|
|
|
1619
1620
|
]
|
|
1620
1621
|
}
|
|
1621
1622
|
);
|
|
1622
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react16.Listbox, { value, onChange, disabled, children: ({ open: headlessOpen }) => {
|
|
1623
1624
|
if (headlessOpen !== open && asLayer) {
|
|
1624
1625
|
setOpen(headlessOpen);
|
|
1625
1626
|
}
|
|
1626
1627
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_class_variance_authority10.cx)(className, "relative"), ref, children: [
|
|
1627
1628
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1628
|
-
|
|
1629
|
+
import_react16.Listbox.Button,
|
|
1629
1630
|
{
|
|
1630
1631
|
as: "div",
|
|
1631
1632
|
className: (0, import_class_variance_authority10.cx)(
|
|
@@ -1688,22 +1689,22 @@ function Select({
|
|
|
1688
1689
|
}
|
|
1689
1690
|
|
|
1690
1691
|
// src/common/tree/FlatTree.tsx
|
|
1691
|
-
var
|
|
1692
|
+
var import_react20 = require("react");
|
|
1692
1693
|
|
|
1693
1694
|
// src/common/tree/Tree.tsx
|
|
1694
|
-
var
|
|
1695
|
+
var import_react18 = require("react");
|
|
1695
1696
|
|
|
1696
1697
|
// src/common/tree/TreeIcons.tsx
|
|
1697
1698
|
var import_lu2 = require("react-icons/lu");
|
|
1698
1699
|
|
|
1699
1700
|
// src/common/tree/Tree.tsx
|
|
1700
1701
|
var import_class_variance_authority13 = require("class-variance-authority");
|
|
1701
|
-
var
|
|
1702
|
+
var import_react19 = require("react");
|
|
1702
1703
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1703
1704
|
var Line = () => {
|
|
1704
1705
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "-my-1.5 mr-[19px] h-full min-h-[24px] w-[px] translate-x-2 border-l border-dashed border-gray-400" });
|
|
1705
1706
|
};
|
|
1706
|
-
var Tree_default = (0,
|
|
1707
|
+
var Tree_default = (0, import_react18.forwardRef)(function Tree({
|
|
1707
1708
|
open: defaultOpen,
|
|
1708
1709
|
content,
|
|
1709
1710
|
children,
|
|
@@ -1719,11 +1720,11 @@ var Tree_default = (0, import_react17.forwardRef)(function Tree({
|
|
|
1719
1720
|
expandIcon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lu2.LuSquarePlus, { className: "h-4 w-4 align-middle" }),
|
|
1720
1721
|
collapseIcon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lu2.LuSquareMinus, { className: "h-4 w-4 align-middle" })
|
|
1721
1722
|
}, ref) {
|
|
1722
|
-
const [open, setOpen] = (0,
|
|
1723
|
-
(0,
|
|
1723
|
+
const [open, setOpen] = (0, import_react18.useState)(defaultOpen);
|
|
1724
|
+
(0, import_react19.useEffect)(() => {
|
|
1724
1725
|
setOpen(defaultOpen);
|
|
1725
1726
|
}, [defaultOpen]);
|
|
1726
|
-
const toggle = (0,
|
|
1727
|
+
const toggle = (0, import_react18.useCallback)(
|
|
1727
1728
|
(evt) => {
|
|
1728
1729
|
evt.stopPropagation();
|
|
1729
1730
|
if (onOpenClick) {
|
|
@@ -1736,7 +1737,7 @@ var Tree_default = (0, import_react17.forwardRef)(function Tree({
|
|
|
1736
1737
|
},
|
|
1737
1738
|
[open, onOpenClick]
|
|
1738
1739
|
);
|
|
1739
|
-
const lineNodes = (0,
|
|
1740
|
+
const lineNodes = (0, import_react18.useMemo)(() => {
|
|
1740
1741
|
const lines = [];
|
|
1741
1742
|
for (let i = 0; i < depth; i++) {
|
|
1742
1743
|
lines.push(/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Line, {}, i));
|
|
@@ -1791,7 +1792,7 @@ var import_lodash4 = require("lodash");
|
|
|
1791
1792
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1792
1793
|
var SUFFIX_NODE_KEY = "selectedKey_after";
|
|
1793
1794
|
var ROOT_KEY = "root";
|
|
1794
|
-
var TreeContext = (0,
|
|
1795
|
+
var TreeContext = (0, import_react20.createContext)({
|
|
1795
1796
|
expandKeys: [],
|
|
1796
1797
|
onExpand: (key) => {
|
|
1797
1798
|
console.log(key);
|
|
@@ -1804,17 +1805,17 @@ var ControledTree = ({
|
|
|
1804
1805
|
expandIcon,
|
|
1805
1806
|
collapseIcon
|
|
1806
1807
|
}) => {
|
|
1807
|
-
const { expandKeys, onExpand, onClick } = (0,
|
|
1808
|
+
const { expandKeys, onExpand, onClick } = (0, import_react20.useContext)(TreeContext);
|
|
1808
1809
|
let titleNode;
|
|
1809
1810
|
if (typeof item.title === "function") {
|
|
1810
1811
|
titleNode = item.title(item);
|
|
1811
1812
|
} else {
|
|
1812
1813
|
titleNode = item.title;
|
|
1813
1814
|
}
|
|
1814
|
-
const onOpenClick = (0,
|
|
1815
|
+
const onOpenClick = (0, import_react20.useCallback)(() => {
|
|
1815
1816
|
onExpand(item.key);
|
|
1816
1817
|
}, [onExpand, item.key]);
|
|
1817
|
-
const onNodeClick = (0,
|
|
1818
|
+
const onNodeClick = (0, import_react20.useCallback)(() => {
|
|
1818
1819
|
onClick?.(item);
|
|
1819
1820
|
}, [item]);
|
|
1820
1821
|
const isLeaf = item.children === void 0 || item.children?.length === 0;
|
|
@@ -1860,12 +1861,12 @@ var FlatTree = (props) => {
|
|
|
1860
1861
|
scrollIntoView,
|
|
1861
1862
|
isRootKey = checkRootKeyDefault
|
|
1862
1863
|
} = props;
|
|
1863
|
-
const dataRef = (0,
|
|
1864
|
-
const selectedKeyRef = (0,
|
|
1865
|
-
const [expandKeys, setExpandKeys] = (0,
|
|
1866
|
-
const [selectedKey, setSelectedKey] = (0,
|
|
1867
|
-
const parentRef = (0,
|
|
1868
|
-
(0,
|
|
1864
|
+
const dataRef = (0, import_react20.useRef)(null);
|
|
1865
|
+
const selectedKeyRef = (0, import_react20.useRef)();
|
|
1866
|
+
const [expandKeys, setExpandKeys] = (0, import_react20.useState)([]);
|
|
1867
|
+
const [selectedKey, setSelectedKey] = (0, import_react20.useState)();
|
|
1868
|
+
const parentRef = (0, import_react20.useRef)(null);
|
|
1869
|
+
(0, import_react20.useEffect)(() => {
|
|
1869
1870
|
if (defaultExpandAll) {
|
|
1870
1871
|
const flatten = (data2) => {
|
|
1871
1872
|
return data2.reduce((acc, cur) => {
|
|
@@ -1882,7 +1883,7 @@ var FlatTree = (props) => {
|
|
|
1882
1883
|
setExpandKeys([]);
|
|
1883
1884
|
}
|
|
1884
1885
|
}, [data, defaultExpandAll]);
|
|
1885
|
-
const flattenData = (0,
|
|
1886
|
+
const flattenData = (0, import_react20.useMemo)(() => {
|
|
1886
1887
|
const expandKeysSet = new Set(expandKeys);
|
|
1887
1888
|
const flatten = (data2, depth = 0) => {
|
|
1888
1889
|
return data2.reduce((acc, cur) => {
|
|
@@ -1895,7 +1896,7 @@ var FlatTree = (props) => {
|
|
|
1895
1896
|
}, []);
|
|
1896
1897
|
};
|
|
1897
1898
|
const list = flatten(data || []);
|
|
1898
|
-
if (selectedKey && (0,
|
|
1899
|
+
if (selectedKey && (0, import_react20.isValidElement)(suffixNode)) {
|
|
1899
1900
|
const index = list.findIndex((item) => item.key === selectedKey);
|
|
1900
1901
|
if (index > -1) {
|
|
1901
1902
|
list.splice(index + 1, 0, {
|
|
@@ -1908,7 +1909,7 @@ var FlatTree = (props) => {
|
|
|
1908
1909
|
return list;
|
|
1909
1910
|
}, [data, expandKeys, selectedKey, suffixNode]);
|
|
1910
1911
|
dataRef.current = flattenData;
|
|
1911
|
-
const estimateSize = (0,
|
|
1912
|
+
const estimateSize = (0, import_react20.useCallback)(
|
|
1912
1913
|
(index) => {
|
|
1913
1914
|
if ((0, import_isNumber.default)(rowHeight)) {
|
|
1914
1915
|
return rowHeight;
|
|
@@ -1923,7 +1924,7 @@ var FlatTree = (props) => {
|
|
|
1923
1924
|
estimateSize,
|
|
1924
1925
|
overscan: 10
|
|
1925
1926
|
});
|
|
1926
|
-
const contextValue = (0,
|
|
1927
|
+
const contextValue = (0, import_react20.useMemo)(() => {
|
|
1927
1928
|
return {
|
|
1928
1929
|
expandKeys,
|
|
1929
1930
|
onExpand: (key) => {
|
|
@@ -1954,7 +1955,7 @@ var FlatTree = (props) => {
|
|
|
1954
1955
|
}
|
|
1955
1956
|
};
|
|
1956
1957
|
}, [expandKeys, onClick]);
|
|
1957
|
-
(0,
|
|
1958
|
+
(0, import_react20.useEffect)(() => {
|
|
1958
1959
|
if (!(0, import_isNumber.default)(expandDepth)) {
|
|
1959
1960
|
return;
|
|
1960
1961
|
}
|
|
@@ -1970,10 +1971,10 @@ var FlatTree = (props) => {
|
|
|
1970
1971
|
};
|
|
1971
1972
|
setExpandKeys(flatten(data || []));
|
|
1972
1973
|
}, [data, expandDepth]);
|
|
1973
|
-
(0,
|
|
1974
|
+
(0, import_react20.useEffect)(() => {
|
|
1974
1975
|
setSelectedKey(void 0);
|
|
1975
1976
|
}, [expandDepth]);
|
|
1976
|
-
(0,
|
|
1977
|
+
(0, import_react20.useEffect)(() => {
|
|
1977
1978
|
if (dataRef.current && scrollToKey) {
|
|
1978
1979
|
const index = dataRef.current.findIndex(
|
|
1979
1980
|
(item) => item.key === scrollToKey
|
|
@@ -1987,8 +1988,8 @@ var FlatTree = (props) => {
|
|
|
1987
1988
|
}
|
|
1988
1989
|
}, [scrollToKey]);
|
|
1989
1990
|
const visibleItems = rowVirtualizer.getVirtualItems();
|
|
1990
|
-
const [isPending, startTransition] = (0,
|
|
1991
|
-
const onScroll = (0,
|
|
1991
|
+
const [isPending, startTransition] = (0, import_react20.useTransition)();
|
|
1992
|
+
const onScroll = (0, import_react20.useMemo)(() => {
|
|
1992
1993
|
if (!scrollIntoView) {
|
|
1993
1994
|
return () => {
|
|
1994
1995
|
};
|
|
@@ -2075,12 +2076,12 @@ var FlatTree = (props) => {
|
|
|
2075
2076
|
item.key || index
|
|
2076
2077
|
)) }) });
|
|
2077
2078
|
};
|
|
2078
|
-
var FlatTree_default = (0,
|
|
2079
|
+
var FlatTree_default = (0, import_react20.memo)(FlatTree);
|
|
2079
2080
|
|
|
2080
2081
|
// src/common/text/LinkifyText.tsx
|
|
2081
2082
|
var import_linkify_urls = require("linkify-urls");
|
|
2082
2083
|
var import_dompurify = __toESM(require("dompurify"));
|
|
2083
|
-
var
|
|
2084
|
+
var import_react21 = require("react");
|
|
2084
2085
|
var import_lodash5 = require("lodash");
|
|
2085
2086
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2086
2087
|
if (import_dompurify.default?.addHook) {
|
|
@@ -2104,7 +2105,7 @@ var renderTextWithColoredNumbers = (text) => {
|
|
|
2104
2105
|
return `<span class="font-mono text-primary-500 dark:text-primary-700">${match}</span>`;
|
|
2105
2106
|
});
|
|
2106
2107
|
};
|
|
2107
|
-
var LinkifyText = (0,
|
|
2108
|
+
var LinkifyText = (0, import_react21.memo)(function LinkifyText2({
|
|
2108
2109
|
text,
|
|
2109
2110
|
className,
|
|
2110
2111
|
isHighlightNumbers
|
|
@@ -2138,24 +2139,24 @@ var LinkifyText = (0, import_react20.memo)(function LinkifyText2({
|
|
|
2138
2139
|
});
|
|
2139
2140
|
|
|
2140
2141
|
// src/common/Empty.tsx
|
|
2141
|
-
var
|
|
2142
|
+
var import_react23 = require("react");
|
|
2142
2143
|
|
|
2143
2144
|
// src/utils/extension-context.ts
|
|
2144
|
-
var
|
|
2145
|
-
var SvgFolderContext = (0,
|
|
2145
|
+
var import_react22 = require("react");
|
|
2146
|
+
var SvgFolderContext = (0, import_react22.createContext)("");
|
|
2146
2147
|
var useDetectExtenstion = () => {
|
|
2147
|
-
const folderPath = (0,
|
|
2148
|
+
const folderPath = (0, import_react22.useContext)(SvgFolderContext);
|
|
2148
2149
|
return Boolean(folderPath);
|
|
2149
2150
|
};
|
|
2150
|
-
var DarkModeContext = (0,
|
|
2151
|
+
var DarkModeContext = (0, import_react22.createContext)(false);
|
|
2151
2152
|
var useDarkMode = () => {
|
|
2152
|
-
return (0,
|
|
2153
|
+
return (0, import_react22.useContext)(DarkModeContext);
|
|
2153
2154
|
};
|
|
2154
2155
|
|
|
2155
2156
|
// src/common/Empty.tsx
|
|
2156
2157
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2157
2158
|
var Empty = (props) => {
|
|
2158
|
-
const parentFolder = (0,
|
|
2159
|
+
const parentFolder = (0, import_react23.useContext)(SvgFolderContext);
|
|
2159
2160
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "mx-auto w-fit", children: [
|
|
2160
2161
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2161
2162
|
"img",
|
|
@@ -2252,21 +2253,21 @@ var HeaderToolsContent = ({
|
|
|
2252
2253
|
};
|
|
2253
2254
|
|
|
2254
2255
|
// src/common/table/ResizeTable.tsx
|
|
2255
|
-
var
|
|
2256
|
+
var import_react31 = require("react");
|
|
2256
2257
|
var import_react_table = require("@tanstack/react-table");
|
|
2257
2258
|
var import_react_virtual2 = require("@tanstack/react-virtual");
|
|
2258
2259
|
var import_hi2 = require("react-icons/hi");
|
|
2259
2260
|
var import_lodash6 = require("lodash");
|
|
2260
2261
|
|
|
2261
2262
|
// src/common/menu/PopupMenuButton.tsx
|
|
2262
|
-
var
|
|
2263
|
-
var
|
|
2264
|
-
var
|
|
2263
|
+
var import_react28 = require("react");
|
|
2264
|
+
var import_react29 = require("@headlessui/react");
|
|
2265
|
+
var import_react30 = require("@floating-ui/react");
|
|
2265
2266
|
|
|
2266
2267
|
// src/common/menu/SubMenu.tsx
|
|
2267
|
-
var
|
|
2268
|
-
var
|
|
2269
|
-
var
|
|
2268
|
+
var import_react24 = require("react");
|
|
2269
|
+
var import_react25 = require("@floating-ui/react");
|
|
2270
|
+
var import_react26 = require("@headlessui/react");
|
|
2270
2271
|
var import_hi = require("react-icons/hi");
|
|
2271
2272
|
var import_solid4 = require("@heroicons/react/20/solid");
|
|
2272
2273
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
@@ -2282,10 +2283,10 @@ var COLOR_MAP = {
|
|
|
2282
2283
|
disabled: "text-red-200 dark:text-red-600/40 cursor-not-allowed"
|
|
2283
2284
|
}
|
|
2284
2285
|
};
|
|
2285
|
-
var MenuContext = (0,
|
|
2286
|
+
var MenuContext = (0, import_react24.createContext)({});
|
|
2286
2287
|
var MenuItem = ({ item, onSelect, labelClassName }) => {
|
|
2287
|
-
const { selectedKey } = (0,
|
|
2288
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2288
|
+
const { selectedKey } = (0, import_react24.useContext)(MenuContext);
|
|
2289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react26.Menu.Item, { disabled: item.disabled, children: ({ active }) => {
|
|
2289
2290
|
if (item.items) {
|
|
2290
2291
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2291
2292
|
SubMenuButton,
|
|
@@ -2349,21 +2350,21 @@ var SubMenuButton = (props) => {
|
|
|
2349
2350
|
placement = "right-start",
|
|
2350
2351
|
buttonClass: buttonClass3
|
|
2351
2352
|
} = props;
|
|
2352
|
-
const [open, setOpen] = (0,
|
|
2353
|
-
const { refs, floatingStyles, context } = (0,
|
|
2353
|
+
const [open, setOpen] = (0, import_react24.useState)(false);
|
|
2354
|
+
const { refs, floatingStyles, context } = (0, import_react25.useFloating)({
|
|
2354
2355
|
open,
|
|
2355
2356
|
onOpenChange: setOpen,
|
|
2356
2357
|
placement,
|
|
2357
|
-
whileElementsMounted:
|
|
2358
|
-
middleware: [(0,
|
|
2358
|
+
whileElementsMounted: import_react25.autoUpdate,
|
|
2359
|
+
middleware: [(0, import_react25.flip)(), (0, import_react25.shift)()]
|
|
2359
2360
|
});
|
|
2360
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
2361
|
-
(0,
|
|
2362
|
-
handleClose: (0,
|
|
2361
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react25.useInteractions)([
|
|
2362
|
+
(0, import_react25.useHover)(context, {
|
|
2363
|
+
handleClose: (0, import_react25.safePolygon)()
|
|
2363
2364
|
})
|
|
2364
2365
|
]);
|
|
2365
2366
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2366
|
-
|
|
2367
|
+
import_react26.Menu,
|
|
2367
2368
|
{
|
|
2368
2369
|
as: "div",
|
|
2369
2370
|
className: (0, import_class_variance_authority10.cx)(
|
|
@@ -2373,7 +2374,7 @@ var SubMenuButton = (props) => {
|
|
|
2373
2374
|
),
|
|
2374
2375
|
children: [
|
|
2375
2376
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2376
|
-
|
|
2377
|
+
import_react26.Menu.Button,
|
|
2377
2378
|
{
|
|
2378
2379
|
className: (0, import_class_variance_authority10.cx)(
|
|
2379
2380
|
active || open ? COLOR_MAP[status || "default"].active : COLOR_MAP[status || "default"].default,
|
|
@@ -2404,7 +2405,7 @@ var SubMenuButton = (props) => {
|
|
|
2404
2405
|
}
|
|
2405
2406
|
),
|
|
2406
2407
|
open && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2407
|
-
|
|
2408
|
+
import_react26.Menu.Items,
|
|
2408
2409
|
{
|
|
2409
2410
|
static: true,
|
|
2410
2411
|
ref: refs.setFloating,
|
|
@@ -2430,8 +2431,8 @@ var SubMenuButton = (props) => {
|
|
|
2430
2431
|
};
|
|
2431
2432
|
|
|
2432
2433
|
// src/utils/nav-size-context.ts
|
|
2433
|
-
var
|
|
2434
|
-
var NavSizeContext = (0,
|
|
2434
|
+
var import_react27 = require("react");
|
|
2435
|
+
var NavSizeContext = (0, import_react27.createContext)({
|
|
2435
2436
|
small: true,
|
|
2436
2437
|
showLabel: true,
|
|
2437
2438
|
setSmall: (small) => {
|
|
@@ -2461,23 +2462,23 @@ function PopupMenuButton({
|
|
|
2461
2462
|
selectedKey,
|
|
2462
2463
|
onOpenCallback
|
|
2463
2464
|
}) {
|
|
2464
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
2465
|
-
const { small } = (0,
|
|
2466
|
-
const { refs, floatingStyles, context } = (0,
|
|
2465
|
+
const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
|
|
2466
|
+
const { small } = (0, import_react28.useContext)(NavSizeContext);
|
|
2467
|
+
const { refs, floatingStyles, context } = (0, import_react30.useFloating)({
|
|
2467
2468
|
open: menuOpen,
|
|
2468
2469
|
onOpenChange: setMenuOpen,
|
|
2469
|
-
middleware: [(0,
|
|
2470
|
+
middleware: [(0, import_react30.offset)(offset2), (0, import_react30.flip)(), (0, import_react30.shift)()],
|
|
2470
2471
|
placement,
|
|
2471
|
-
whileElementsMounted:
|
|
2472
|
+
whileElementsMounted: import_react30.autoUpdate
|
|
2472
2473
|
});
|
|
2473
|
-
const itemStyle = (0,
|
|
2474
|
+
const itemStyle = (0, import_react28.useMemo)(() => {
|
|
2474
2475
|
return {
|
|
2475
2476
|
width
|
|
2476
2477
|
};
|
|
2477
2478
|
}, [width]);
|
|
2478
|
-
const onOpenCallbackRef = (0,
|
|
2479
|
+
const onOpenCallbackRef = (0, import_react28.useRef)(onOpenCallback);
|
|
2479
2480
|
onOpenCallbackRef.current = onOpenCallback;
|
|
2480
|
-
(0,
|
|
2481
|
+
(0, import_react28.useEffect)(() => {
|
|
2481
2482
|
if (menuOpen) {
|
|
2482
2483
|
onOpenCallbackRef.current?.();
|
|
2483
2484
|
}
|
|
@@ -2485,9 +2486,9 @@ function PopupMenuButton({
|
|
|
2485
2486
|
let menuItems = null;
|
|
2486
2487
|
if (menuOpen && items.length > 0) {
|
|
2487
2488
|
menuItems = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuContext.Provider, { value: { selectedKey }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ref: refs.setFloating, style: floatingStyles, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2488
|
-
|
|
2489
|
+
import_react29.Transition,
|
|
2489
2490
|
{
|
|
2490
|
-
as:
|
|
2491
|
+
as: import_react28.Fragment,
|
|
2491
2492
|
enter: "transition ease-out duration-100",
|
|
2492
2493
|
enterFrom: "transform opacity-0 scale-95",
|
|
2493
2494
|
enterTo: "transform opacity-100 scale-100",
|
|
@@ -2495,7 +2496,7 @@ function PopupMenuButton({
|
|
|
2495
2496
|
leaveFrom: "transform opacity-100 scale-100",
|
|
2496
2497
|
leaveTo: "transform opacity-0 scale-95",
|
|
2497
2498
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2498
|
-
|
|
2499
|
+
import_react29.Menu.Items,
|
|
2499
2500
|
{
|
|
2500
2501
|
className: "dark:bg-sentio-gray-200 dark:divide-sentio-gray-400/50 z-10 mt-1 w-[80vw] origin-top cursor-pointer divide-y divide-gray-200 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:ring-gray-100 sm:w-64",
|
|
2501
2502
|
style: itemStyle,
|
|
@@ -2522,13 +2523,13 @@ function PopupMenuButton({
|
|
|
2522
2523
|
}
|
|
2523
2524
|
) }) });
|
|
2524
2525
|
}
|
|
2525
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react29.Menu, { children: ({ open }) => {
|
|
2526
2527
|
setTimeout(() => {
|
|
2527
2528
|
setMenuOpen(open);
|
|
2528
2529
|
}, 0);
|
|
2529
2530
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2530
2531
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2531
|
-
|
|
2532
|
+
import_react29.Menu.Button,
|
|
2532
2533
|
{
|
|
2533
2534
|
className: (0, import_class_variance_authority10.cx)(
|
|
2534
2535
|
"text-gray w-fit px-1 hover:text-gray-500 active:text-gray-700",
|
|
@@ -2540,7 +2541,7 @@ function PopupMenuButton({
|
|
|
2540
2541
|
children: typeof buttonIcon === "function" ? buttonIcon(menuOpen) : buttonIcon
|
|
2541
2542
|
}
|
|
2542
2543
|
),
|
|
2543
|
-
portal ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2544
|
+
portal ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react30.FloatingPortal, { children: menuItems }) : menuItems
|
|
2544
2545
|
] });
|
|
2545
2546
|
} });
|
|
2546
2547
|
}
|
|
@@ -2771,7 +2772,7 @@ var reorder = (list, startIndex, endIndex) => {
|
|
|
2771
2772
|
function onPreventClick(e) {
|
|
2772
2773
|
e.stopPropagation();
|
|
2773
2774
|
}
|
|
2774
|
-
var _ResizeTable = (0,
|
|
2775
|
+
var _ResizeTable = (0, import_react31.forwardRef)(function _ResizeTable2({
|
|
2775
2776
|
data,
|
|
2776
2777
|
columns,
|
|
2777
2778
|
columnResizeMode,
|
|
@@ -2795,7 +2796,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2795
2796
|
estimatedRowHeight = 35,
|
|
2796
2797
|
overscan = 5
|
|
2797
2798
|
}, tableContainerRef) {
|
|
2798
|
-
const adjustedColumns = (0,
|
|
2799
|
+
const adjustedColumns = (0, import_react31.useMemo)(() => {
|
|
2799
2800
|
let totalWidth = 0;
|
|
2800
2801
|
const newColumns = columns.map((c) => {
|
|
2801
2802
|
const item = Object.assign({ minSize }, c);
|
|
@@ -2814,7 +2815,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2814
2815
|
}
|
|
2815
2816
|
return newColumns;
|
|
2816
2817
|
}, [columns, minSize, minWidth]);
|
|
2817
|
-
const [tableState, setTableState] = (0,
|
|
2818
|
+
const [tableState, setTableState] = (0, import_react31.useState)(() => {
|
|
2818
2819
|
const initialState = {
|
|
2819
2820
|
pagination: {
|
|
2820
2821
|
pageIndex: 0,
|
|
@@ -2834,7 +2835,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2834
2835
|
onStateChange: setTableState,
|
|
2835
2836
|
manualSorting
|
|
2836
2837
|
});
|
|
2837
|
-
(0,
|
|
2838
|
+
(0, import_react31.useEffect)(() => {
|
|
2838
2839
|
if (state && Object.keys(state).length > 0) {
|
|
2839
2840
|
setTableState((prev) => {
|
|
2840
2841
|
const newState = {
|
|
@@ -2846,14 +2847,14 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2846
2847
|
});
|
|
2847
2848
|
}
|
|
2848
2849
|
}, [state]);
|
|
2849
|
-
const debounceStateChange = (0,
|
|
2850
|
+
const debounceStateChange = (0, import_react31.useMemo)(() => {
|
|
2850
2851
|
if (!onStateChange) return void 0;
|
|
2851
2852
|
return (0, import_lodash6.debounce)(onStateChange, 500, {});
|
|
2852
2853
|
}, [onStateChange]);
|
|
2853
|
-
(0,
|
|
2854
|
+
(0, import_react31.useEffect)(() => {
|
|
2854
2855
|
debounceStateChange?.(tableState);
|
|
2855
2856
|
}, [debounceStateChange, tableState]);
|
|
2856
|
-
const fetchMoreOnBottomReached = (0,
|
|
2857
|
+
const fetchMoreOnBottomReached = (0, import_react31.useMemo)(() => {
|
|
2857
2858
|
return (0, import_lodash6.debounce)((containerRefElement) => {
|
|
2858
2859
|
if (containerRefElement) {
|
|
2859
2860
|
const { scrollHeight, scrollTop, clientHeight } = containerRefElement;
|
|
@@ -2863,8 +2864,8 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2863
2864
|
}
|
|
2864
2865
|
}, 500);
|
|
2865
2866
|
}, [onFetchMore, isFetching, hasMore]);
|
|
2866
|
-
const tableContainerElementRef = (0,
|
|
2867
|
-
(0,
|
|
2867
|
+
const tableContainerElementRef = (0, import_react31.useRef)(null);
|
|
2868
|
+
(0, import_react31.useEffect)(() => {
|
|
2868
2869
|
if (tableContainerRef) {
|
|
2869
2870
|
if (typeof tableContainerRef === "function") {
|
|
2870
2871
|
tableContainerRef(tableContainerElementRef.current);
|
|
@@ -2876,7 +2877,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2876
2877
|
const rowVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
2877
2878
|
count: enableVirtualization ? table.getRowModel().rows.length : 0,
|
|
2878
2879
|
getScrollElement: () => tableContainerElementRef.current,
|
|
2879
|
-
estimateSize: (0,
|
|
2880
|
+
estimateSize: (0, import_react31.useCallback)(() => estimatedRowHeight, [estimatedRowHeight]),
|
|
2880
2881
|
overscan,
|
|
2881
2882
|
enabled: enableVirtualization
|
|
2882
2883
|
});
|
|
@@ -3118,7 +3119,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
3118
3119
|
}
|
|
3119
3120
|
);
|
|
3120
3121
|
});
|
|
3121
|
-
var ResizeTable = (0,
|
|
3122
|
+
var ResizeTable = (0, import_react31.memo)(_ResizeTable);
|
|
3122
3123
|
|
|
3123
3124
|
// src/utils/number-format.ts
|
|
3124
3125
|
var import_bigdecimal = __toESM(require("@sentio/bigdecimal"));
|
|
@@ -3145,10 +3146,10 @@ function getNumberWithDecimal(hex, decimal, asNumber) {
|
|
|
3145
3146
|
}
|
|
3146
3147
|
|
|
3147
3148
|
// src/utils/use-mobile.ts
|
|
3148
|
-
var
|
|
3149
|
+
var import_react32 = require("react");
|
|
3149
3150
|
function useMobile(breakpoint = 768, defaultValue = false) {
|
|
3150
|
-
const [isMobile, setIsMobile] = (0,
|
|
3151
|
-
(0,
|
|
3151
|
+
const [isMobile, setIsMobile] = (0, import_react32.useState)(defaultValue);
|
|
3152
|
+
(0, import_react32.useEffect)(() => {
|
|
3152
3153
|
const checkUserAgent = () => {
|
|
3153
3154
|
if (typeof window === "undefined") return false;
|
|
3154
3155
|
const userAgent = window.navigator.userAgent.toLowerCase();
|