@sentio/ui-core 0.1.1 → 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/README.md +51 -10
- 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 +175 -173
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -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)(
|
|
@@ -910,6 +911,7 @@ var DisclosurePanel = ({
|
|
|
910
911
|
titleClassName
|
|
911
912
|
),
|
|
912
913
|
onClick: toggle,
|
|
914
|
+
type: "button",
|
|
913
915
|
children: [
|
|
914
916
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
915
917
|
import_lu.LuChevronRight,
|
|
@@ -936,12 +938,12 @@ var import_solid = require("@heroicons/react/20/solid");
|
|
|
936
938
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
937
939
|
|
|
938
940
|
// src/utils/use-boolean.ts
|
|
939
|
-
var
|
|
941
|
+
var import_react10 = require("react");
|
|
940
942
|
function useBoolean(defaultValue = false) {
|
|
941
|
-
const [value, setValue] = (0,
|
|
942
|
-
const setTrue = (0,
|
|
943
|
-
const setFalse = (0,
|
|
944
|
-
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), []);
|
|
945
947
|
return {
|
|
946
948
|
value,
|
|
947
949
|
setValue,
|
|
@@ -952,7 +954,7 @@ function useBoolean(defaultValue = false) {
|
|
|
952
954
|
}
|
|
953
955
|
|
|
954
956
|
// src/common/Collapse.tsx
|
|
955
|
-
var
|
|
957
|
+
var import_react11 = require("react");
|
|
956
958
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
957
959
|
var Collapse = ({
|
|
958
960
|
title,
|
|
@@ -963,7 +965,7 @@ var Collapse = ({
|
|
|
963
965
|
iconClassName = "h-5 w-5"
|
|
964
966
|
}) => {
|
|
965
967
|
const { toggle, value: visible, setTrue, setFalse } = useBoolean(defaultOpen);
|
|
966
|
-
(0,
|
|
968
|
+
(0, import_react11.useEffect)(() => {
|
|
967
969
|
if (defaultOpen) {
|
|
968
970
|
setTrue();
|
|
969
971
|
} else {
|
|
@@ -1013,7 +1015,7 @@ var Collapse = ({
|
|
|
1013
1015
|
// src/common/Input.tsx
|
|
1014
1016
|
var import_class_variance_authority9 = require("class-variance-authority");
|
|
1015
1017
|
var import_solid2 = require("@heroicons/react/20/solid");
|
|
1016
|
-
var
|
|
1018
|
+
var import_react12 = require("react");
|
|
1017
1019
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1018
1020
|
var inputContainerStyles = (0, import_class_variance_authority9.cva)(
|
|
1019
1021
|
"flex relative rounded-md border focus-within:ring-1 w-full font-normal overflow-hidden",
|
|
@@ -1079,7 +1081,7 @@ var iconStyles = (0, import_class_variance_authority9.cva)("text-red-500", {
|
|
|
1079
1081
|
size: "md"
|
|
1080
1082
|
}
|
|
1081
1083
|
});
|
|
1082
|
-
var Input = (0,
|
|
1084
|
+
var Input = (0, import_react12.forwardRef)(
|
|
1083
1085
|
function Input2(props, inputRef) {
|
|
1084
1086
|
const { className, error, errorClassName, size, ...rest } = props;
|
|
1085
1087
|
const containerClassName = inputContainerStyles({
|
|
@@ -1099,7 +1101,7 @@ var Input = (0, import_react11.forwardRef)(
|
|
|
1099
1101
|
);
|
|
1100
1102
|
|
|
1101
1103
|
// src/common/select/Radio.tsx
|
|
1102
|
-
var
|
|
1104
|
+
var import_react13 = require("@headlessui/react");
|
|
1103
1105
|
|
|
1104
1106
|
// src/utils/classnames.ts
|
|
1105
1107
|
var import_class_variance_authority10 = require("class-variance-authority");
|
|
@@ -1115,8 +1117,8 @@ function RadioSelect({
|
|
|
1115
1117
|
vertical,
|
|
1116
1118
|
containerClassName
|
|
1117
1119
|
}) {
|
|
1118
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1119
|
-
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: [
|
|
1120
1122
|
label,
|
|
1121
1123
|
":"
|
|
1122
1124
|
] }),
|
|
@@ -1128,7 +1130,7 @@ function RadioSelect({
|
|
|
1128
1130
|
vertical ? "flex flex-col gap-2" : "inline-flex gap-4",
|
|
1129
1131
|
containerClassName
|
|
1130
1132
|
),
|
|
1131
|
-
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: [
|
|
1132
1134
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1133
1135
|
"input",
|
|
1134
1136
|
{
|
|
@@ -1156,8 +1158,8 @@ function RadioSelect({
|
|
|
1156
1158
|
}
|
|
1157
1159
|
|
|
1158
1160
|
// src/common/select/Switch.tsx
|
|
1159
|
-
var
|
|
1160
|
-
var
|
|
1161
|
+
var import_react14 = require("react");
|
|
1162
|
+
var import_react15 = require("@headlessui/react");
|
|
1161
1163
|
var import_class_variance_authority11 = require("class-variance-authority");
|
|
1162
1164
|
var import_lodash2 = require("lodash");
|
|
1163
1165
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
@@ -1258,8 +1260,8 @@ function Switch({
|
|
|
1258
1260
|
disabled,
|
|
1259
1261
|
label
|
|
1260
1262
|
}) {
|
|
1261
|
-
const [enabled, setState] = (0,
|
|
1262
|
-
const onChange = (0,
|
|
1263
|
+
const [enabled, setState] = (0, import_react14.useState)(checked);
|
|
1264
|
+
const onChange = (0, import_react14.useCallback)(() => {
|
|
1263
1265
|
setState((enabled2) => {
|
|
1264
1266
|
if ((0, import_lodash2.isFunction)(_onChange)) {
|
|
1265
1267
|
setTimeout(() => {
|
|
@@ -1269,12 +1271,12 @@ function Switch({
|
|
|
1269
1271
|
return !enabled2;
|
|
1270
1272
|
});
|
|
1271
1273
|
}, [_onChange]);
|
|
1272
|
-
(0,
|
|
1274
|
+
(0, import_react14.useEffect)(() => {
|
|
1273
1275
|
setState(checked);
|
|
1274
1276
|
}, [checked]);
|
|
1275
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react15.Switch.Group, { children: [
|
|
1276
1278
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1277
|
-
|
|
1279
|
+
import_react15.Switch,
|
|
1278
1280
|
{
|
|
1279
1281
|
checked: enabled,
|
|
1280
1282
|
onChange: onChange || setState,
|
|
@@ -1300,7 +1302,7 @@ function Switch({
|
|
|
1300
1302
|
}
|
|
1301
1303
|
),
|
|
1302
1304
|
label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1303
|
-
|
|
1305
|
+
import_react15.Switch.Label,
|
|
1304
1306
|
{
|
|
1305
1307
|
className: labelClass({
|
|
1306
1308
|
size,
|
|
@@ -1313,11 +1315,11 @@ function Switch({
|
|
|
1313
1315
|
}
|
|
1314
1316
|
|
|
1315
1317
|
// src/common/select/Select.tsx
|
|
1316
|
-
var
|
|
1318
|
+
var import_react16 = require("@headlessui/react");
|
|
1317
1319
|
var import_solid3 = require("@heroicons/react/20/solid");
|
|
1318
1320
|
var import_lodash3 = require("lodash");
|
|
1319
1321
|
var import_class_variance_authority12 = require("class-variance-authority");
|
|
1320
|
-
var
|
|
1322
|
+
var import_react17 = require("react");
|
|
1321
1323
|
var import_isFunction2 = __toESM(require("lodash/isFunction"));
|
|
1322
1324
|
var import_react_spinners3 = require("react-spinners");
|
|
1323
1325
|
var import_react_laag = require("react-laag");
|
|
@@ -1433,14 +1435,14 @@ function Select({
|
|
|
1433
1435
|
asLayer
|
|
1434
1436
|
}) {
|
|
1435
1437
|
const selectedIndex = options.findIndex((o) => (0, import_lodash3.isEqual)(o.value, value));
|
|
1436
|
-
const listRef = (0,
|
|
1437
|
-
const [open, setOpen] = (0,
|
|
1438
|
+
const listRef = (0, import_react17.useRef)(null);
|
|
1439
|
+
const [open, setOpen] = (0, import_react17.useState)(false);
|
|
1438
1440
|
const { width, ref } = (0, import_react_resize_detector.useResizeDetector)({
|
|
1439
1441
|
refreshMode: "debounce",
|
|
1440
1442
|
refreshRate: 100,
|
|
1441
1443
|
handleHeight: false
|
|
1442
1444
|
});
|
|
1443
|
-
const baseZIndex = (0,
|
|
1445
|
+
const baseZIndex = (0, import_react17.useContext)(BaseZIndexContext);
|
|
1444
1446
|
const { renderLayer, triggerProps, layerProps } = (0, import_react_laag.useLayer)({
|
|
1445
1447
|
isOpen: open,
|
|
1446
1448
|
auto: true,
|
|
@@ -1450,7 +1452,7 @@ function Select({
|
|
|
1450
1452
|
triggerOffset: 4,
|
|
1451
1453
|
onOutsideClick: () => setOpen(false)
|
|
1452
1454
|
});
|
|
1453
|
-
const grouped = (0,
|
|
1455
|
+
const grouped = (0, import_react17.useMemo)(() => {
|
|
1454
1456
|
if (!groupedOptions || !options || options.length === 0) {
|
|
1455
1457
|
return options;
|
|
1456
1458
|
}
|
|
@@ -1470,7 +1472,7 @@ function Select({
|
|
|
1470
1472
|
}, []);
|
|
1471
1473
|
}, [groupedOptions, groupedOrder, options]);
|
|
1472
1474
|
const optionsElement = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1473
|
-
|
|
1475
|
+
import_react16.Listbox.Options,
|
|
1474
1476
|
{
|
|
1475
1477
|
ref: listRef,
|
|
1476
1478
|
onScroll: () => {
|
|
@@ -1489,7 +1491,7 @@ function Select({
|
|
|
1489
1491
|
),
|
|
1490
1492
|
children: [
|
|
1491
1493
|
!options || options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1492
|
-
|
|
1494
|
+
import_react16.Listbox.Option,
|
|
1493
1495
|
{
|
|
1494
1496
|
value: null,
|
|
1495
1497
|
disabled: true,
|
|
@@ -1505,7 +1507,7 @@ function Select({
|
|
|
1505
1507
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-gray px-3.5 py-1 text-xs font-medium", children: label }),
|
|
1506
1508
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: options2.map(
|
|
1507
1509
|
(option, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1508
|
-
|
|
1510
|
+
import_react16.Listbox.Option,
|
|
1509
1511
|
{
|
|
1510
1512
|
value: option.value,
|
|
1511
1513
|
disabled: option.disabled,
|
|
@@ -1557,7 +1559,7 @@ function Select({
|
|
|
1557
1559
|
) })
|
|
1558
1560
|
] }, label);
|
|
1559
1561
|
}) : options.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1560
|
-
|
|
1562
|
+
import_react16.Listbox.Option,
|
|
1561
1563
|
{
|
|
1562
1564
|
value: option.value,
|
|
1563
1565
|
disabled: option.disabled,
|
|
@@ -1604,7 +1606,7 @@ function Select({
|
|
|
1604
1606
|
i
|
|
1605
1607
|
)),
|
|
1606
1608
|
isFetchingMore && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1607
|
-
|
|
1609
|
+
import_react16.Listbox.Option,
|
|
1608
1610
|
{
|
|
1609
1611
|
value: null,
|
|
1610
1612
|
disabled: true,
|
|
@@ -1618,13 +1620,13 @@ function Select({
|
|
|
1618
1620
|
]
|
|
1619
1621
|
}
|
|
1620
1622
|
);
|
|
1621
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react16.Listbox, { value, onChange, disabled, children: ({ open: headlessOpen }) => {
|
|
1622
1624
|
if (headlessOpen !== open && asLayer) {
|
|
1623
1625
|
setOpen(headlessOpen);
|
|
1624
1626
|
}
|
|
1625
1627
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_class_variance_authority10.cx)(className, "relative"), ref, children: [
|
|
1626
1628
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1627
|
-
|
|
1629
|
+
import_react16.Listbox.Button,
|
|
1628
1630
|
{
|
|
1629
1631
|
as: "div",
|
|
1630
1632
|
className: (0, import_class_variance_authority10.cx)(
|
|
@@ -1687,22 +1689,22 @@ function Select({
|
|
|
1687
1689
|
}
|
|
1688
1690
|
|
|
1689
1691
|
// src/common/tree/FlatTree.tsx
|
|
1690
|
-
var
|
|
1692
|
+
var import_react20 = require("react");
|
|
1691
1693
|
|
|
1692
1694
|
// src/common/tree/Tree.tsx
|
|
1693
|
-
var
|
|
1695
|
+
var import_react18 = require("react");
|
|
1694
1696
|
|
|
1695
1697
|
// src/common/tree/TreeIcons.tsx
|
|
1696
1698
|
var import_lu2 = require("react-icons/lu");
|
|
1697
1699
|
|
|
1698
1700
|
// src/common/tree/Tree.tsx
|
|
1699
1701
|
var import_class_variance_authority13 = require("class-variance-authority");
|
|
1700
|
-
var
|
|
1702
|
+
var import_react19 = require("react");
|
|
1701
1703
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1702
1704
|
var Line = () => {
|
|
1703
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" });
|
|
1704
1706
|
};
|
|
1705
|
-
var Tree_default = (0,
|
|
1707
|
+
var Tree_default = (0, import_react18.forwardRef)(function Tree({
|
|
1706
1708
|
open: defaultOpen,
|
|
1707
1709
|
content,
|
|
1708
1710
|
children,
|
|
@@ -1718,11 +1720,11 @@ var Tree_default = (0, import_react17.forwardRef)(function Tree({
|
|
|
1718
1720
|
expandIcon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lu2.LuSquarePlus, { className: "h-4 w-4 align-middle" }),
|
|
1719
1721
|
collapseIcon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lu2.LuSquareMinus, { className: "h-4 w-4 align-middle" })
|
|
1720
1722
|
}, ref) {
|
|
1721
|
-
const [open, setOpen] = (0,
|
|
1722
|
-
(0,
|
|
1723
|
+
const [open, setOpen] = (0, import_react18.useState)(defaultOpen);
|
|
1724
|
+
(0, import_react19.useEffect)(() => {
|
|
1723
1725
|
setOpen(defaultOpen);
|
|
1724
1726
|
}, [defaultOpen]);
|
|
1725
|
-
const toggle = (0,
|
|
1727
|
+
const toggle = (0, import_react18.useCallback)(
|
|
1726
1728
|
(evt) => {
|
|
1727
1729
|
evt.stopPropagation();
|
|
1728
1730
|
if (onOpenClick) {
|
|
@@ -1735,7 +1737,7 @@ var Tree_default = (0, import_react17.forwardRef)(function Tree({
|
|
|
1735
1737
|
},
|
|
1736
1738
|
[open, onOpenClick]
|
|
1737
1739
|
);
|
|
1738
|
-
const lineNodes = (0,
|
|
1740
|
+
const lineNodes = (0, import_react18.useMemo)(() => {
|
|
1739
1741
|
const lines = [];
|
|
1740
1742
|
for (let i = 0; i < depth; i++) {
|
|
1741
1743
|
lines.push(/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Line, {}, i));
|
|
@@ -1790,7 +1792,7 @@ var import_lodash4 = require("lodash");
|
|
|
1790
1792
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1791
1793
|
var SUFFIX_NODE_KEY = "selectedKey_after";
|
|
1792
1794
|
var ROOT_KEY = "root";
|
|
1793
|
-
var TreeContext = (0,
|
|
1795
|
+
var TreeContext = (0, import_react20.createContext)({
|
|
1794
1796
|
expandKeys: [],
|
|
1795
1797
|
onExpand: (key) => {
|
|
1796
1798
|
console.log(key);
|
|
@@ -1803,17 +1805,17 @@ var ControledTree = ({
|
|
|
1803
1805
|
expandIcon,
|
|
1804
1806
|
collapseIcon
|
|
1805
1807
|
}) => {
|
|
1806
|
-
const { expandKeys, onExpand, onClick } = (0,
|
|
1808
|
+
const { expandKeys, onExpand, onClick } = (0, import_react20.useContext)(TreeContext);
|
|
1807
1809
|
let titleNode;
|
|
1808
1810
|
if (typeof item.title === "function") {
|
|
1809
1811
|
titleNode = item.title(item);
|
|
1810
1812
|
} else {
|
|
1811
1813
|
titleNode = item.title;
|
|
1812
1814
|
}
|
|
1813
|
-
const onOpenClick = (0,
|
|
1815
|
+
const onOpenClick = (0, import_react20.useCallback)(() => {
|
|
1814
1816
|
onExpand(item.key);
|
|
1815
1817
|
}, [onExpand, item.key]);
|
|
1816
|
-
const onNodeClick = (0,
|
|
1818
|
+
const onNodeClick = (0, import_react20.useCallback)(() => {
|
|
1817
1819
|
onClick?.(item);
|
|
1818
1820
|
}, [item]);
|
|
1819
1821
|
const isLeaf = item.children === void 0 || item.children?.length === 0;
|
|
@@ -1859,12 +1861,12 @@ var FlatTree = (props) => {
|
|
|
1859
1861
|
scrollIntoView,
|
|
1860
1862
|
isRootKey = checkRootKeyDefault
|
|
1861
1863
|
} = props;
|
|
1862
|
-
const dataRef = (0,
|
|
1863
|
-
const selectedKeyRef = (0,
|
|
1864
|
-
const [expandKeys, setExpandKeys] = (0,
|
|
1865
|
-
const [selectedKey, setSelectedKey] = (0,
|
|
1866
|
-
const parentRef = (0,
|
|
1867
|
-
(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)(() => {
|
|
1868
1870
|
if (defaultExpandAll) {
|
|
1869
1871
|
const flatten = (data2) => {
|
|
1870
1872
|
return data2.reduce((acc, cur) => {
|
|
@@ -1881,7 +1883,7 @@ var FlatTree = (props) => {
|
|
|
1881
1883
|
setExpandKeys([]);
|
|
1882
1884
|
}
|
|
1883
1885
|
}, [data, defaultExpandAll]);
|
|
1884
|
-
const flattenData = (0,
|
|
1886
|
+
const flattenData = (0, import_react20.useMemo)(() => {
|
|
1885
1887
|
const expandKeysSet = new Set(expandKeys);
|
|
1886
1888
|
const flatten = (data2, depth = 0) => {
|
|
1887
1889
|
return data2.reduce((acc, cur) => {
|
|
@@ -1894,7 +1896,7 @@ var FlatTree = (props) => {
|
|
|
1894
1896
|
}, []);
|
|
1895
1897
|
};
|
|
1896
1898
|
const list = flatten(data || []);
|
|
1897
|
-
if (selectedKey && (0,
|
|
1899
|
+
if (selectedKey && (0, import_react20.isValidElement)(suffixNode)) {
|
|
1898
1900
|
const index = list.findIndex((item) => item.key === selectedKey);
|
|
1899
1901
|
if (index > -1) {
|
|
1900
1902
|
list.splice(index + 1, 0, {
|
|
@@ -1907,7 +1909,7 @@ var FlatTree = (props) => {
|
|
|
1907
1909
|
return list;
|
|
1908
1910
|
}, [data, expandKeys, selectedKey, suffixNode]);
|
|
1909
1911
|
dataRef.current = flattenData;
|
|
1910
|
-
const estimateSize = (0,
|
|
1912
|
+
const estimateSize = (0, import_react20.useCallback)(
|
|
1911
1913
|
(index) => {
|
|
1912
1914
|
if ((0, import_isNumber.default)(rowHeight)) {
|
|
1913
1915
|
return rowHeight;
|
|
@@ -1922,7 +1924,7 @@ var FlatTree = (props) => {
|
|
|
1922
1924
|
estimateSize,
|
|
1923
1925
|
overscan: 10
|
|
1924
1926
|
});
|
|
1925
|
-
const contextValue = (0,
|
|
1927
|
+
const contextValue = (0, import_react20.useMemo)(() => {
|
|
1926
1928
|
return {
|
|
1927
1929
|
expandKeys,
|
|
1928
1930
|
onExpand: (key) => {
|
|
@@ -1953,7 +1955,7 @@ var FlatTree = (props) => {
|
|
|
1953
1955
|
}
|
|
1954
1956
|
};
|
|
1955
1957
|
}, [expandKeys, onClick]);
|
|
1956
|
-
(0,
|
|
1958
|
+
(0, import_react20.useEffect)(() => {
|
|
1957
1959
|
if (!(0, import_isNumber.default)(expandDepth)) {
|
|
1958
1960
|
return;
|
|
1959
1961
|
}
|
|
@@ -1969,10 +1971,10 @@ var FlatTree = (props) => {
|
|
|
1969
1971
|
};
|
|
1970
1972
|
setExpandKeys(flatten(data || []));
|
|
1971
1973
|
}, [data, expandDepth]);
|
|
1972
|
-
(0,
|
|
1974
|
+
(0, import_react20.useEffect)(() => {
|
|
1973
1975
|
setSelectedKey(void 0);
|
|
1974
1976
|
}, [expandDepth]);
|
|
1975
|
-
(0,
|
|
1977
|
+
(0, import_react20.useEffect)(() => {
|
|
1976
1978
|
if (dataRef.current && scrollToKey) {
|
|
1977
1979
|
const index = dataRef.current.findIndex(
|
|
1978
1980
|
(item) => item.key === scrollToKey
|
|
@@ -1986,8 +1988,8 @@ var FlatTree = (props) => {
|
|
|
1986
1988
|
}
|
|
1987
1989
|
}, [scrollToKey]);
|
|
1988
1990
|
const visibleItems = rowVirtualizer.getVirtualItems();
|
|
1989
|
-
const [isPending, startTransition] = (0,
|
|
1990
|
-
const onScroll = (0,
|
|
1991
|
+
const [isPending, startTransition] = (0, import_react20.useTransition)();
|
|
1992
|
+
const onScroll = (0, import_react20.useMemo)(() => {
|
|
1991
1993
|
if (!scrollIntoView) {
|
|
1992
1994
|
return () => {
|
|
1993
1995
|
};
|
|
@@ -2074,12 +2076,12 @@ var FlatTree = (props) => {
|
|
|
2074
2076
|
item.key || index
|
|
2075
2077
|
)) }) });
|
|
2076
2078
|
};
|
|
2077
|
-
var FlatTree_default = (0,
|
|
2079
|
+
var FlatTree_default = (0, import_react20.memo)(FlatTree);
|
|
2078
2080
|
|
|
2079
2081
|
// src/common/text/LinkifyText.tsx
|
|
2080
2082
|
var import_linkify_urls = require("linkify-urls");
|
|
2081
2083
|
var import_dompurify = __toESM(require("dompurify"));
|
|
2082
|
-
var
|
|
2084
|
+
var import_react21 = require("react");
|
|
2083
2085
|
var import_lodash5 = require("lodash");
|
|
2084
2086
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2085
2087
|
if (import_dompurify.default?.addHook) {
|
|
@@ -2103,7 +2105,7 @@ var renderTextWithColoredNumbers = (text) => {
|
|
|
2103
2105
|
return `<span class="font-mono text-primary-500 dark:text-primary-700">${match}</span>`;
|
|
2104
2106
|
});
|
|
2105
2107
|
};
|
|
2106
|
-
var LinkifyText = (0,
|
|
2108
|
+
var LinkifyText = (0, import_react21.memo)(function LinkifyText2({
|
|
2107
2109
|
text,
|
|
2108
2110
|
className,
|
|
2109
2111
|
isHighlightNumbers
|
|
@@ -2137,24 +2139,24 @@ var LinkifyText = (0, import_react20.memo)(function LinkifyText2({
|
|
|
2137
2139
|
});
|
|
2138
2140
|
|
|
2139
2141
|
// src/common/Empty.tsx
|
|
2140
|
-
var
|
|
2142
|
+
var import_react23 = require("react");
|
|
2141
2143
|
|
|
2142
2144
|
// src/utils/extension-context.ts
|
|
2143
|
-
var
|
|
2144
|
-
var SvgFolderContext = (0,
|
|
2145
|
+
var import_react22 = require("react");
|
|
2146
|
+
var SvgFolderContext = (0, import_react22.createContext)("");
|
|
2145
2147
|
var useDetectExtenstion = () => {
|
|
2146
|
-
const folderPath = (0,
|
|
2148
|
+
const folderPath = (0, import_react22.useContext)(SvgFolderContext);
|
|
2147
2149
|
return Boolean(folderPath);
|
|
2148
2150
|
};
|
|
2149
|
-
var DarkModeContext = (0,
|
|
2151
|
+
var DarkModeContext = (0, import_react22.createContext)(false);
|
|
2150
2152
|
var useDarkMode = () => {
|
|
2151
|
-
return (0,
|
|
2153
|
+
return (0, import_react22.useContext)(DarkModeContext);
|
|
2152
2154
|
};
|
|
2153
2155
|
|
|
2154
2156
|
// src/common/Empty.tsx
|
|
2155
2157
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2156
2158
|
var Empty = (props) => {
|
|
2157
|
-
const parentFolder = (0,
|
|
2159
|
+
const parentFolder = (0, import_react23.useContext)(SvgFolderContext);
|
|
2158
2160
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "mx-auto w-fit", children: [
|
|
2159
2161
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2160
2162
|
"img",
|
|
@@ -2251,21 +2253,21 @@ var HeaderToolsContent = ({
|
|
|
2251
2253
|
};
|
|
2252
2254
|
|
|
2253
2255
|
// src/common/table/ResizeTable.tsx
|
|
2254
|
-
var
|
|
2256
|
+
var import_react31 = require("react");
|
|
2255
2257
|
var import_react_table = require("@tanstack/react-table");
|
|
2256
2258
|
var import_react_virtual2 = require("@tanstack/react-virtual");
|
|
2257
2259
|
var import_hi2 = require("react-icons/hi");
|
|
2258
2260
|
var import_lodash6 = require("lodash");
|
|
2259
2261
|
|
|
2260
2262
|
// src/common/menu/PopupMenuButton.tsx
|
|
2261
|
-
var
|
|
2262
|
-
var
|
|
2263
|
-
var
|
|
2263
|
+
var import_react28 = require("react");
|
|
2264
|
+
var import_react29 = require("@headlessui/react");
|
|
2265
|
+
var import_react30 = require("@floating-ui/react");
|
|
2264
2266
|
|
|
2265
2267
|
// src/common/menu/SubMenu.tsx
|
|
2266
|
-
var
|
|
2267
|
-
var
|
|
2268
|
-
var
|
|
2268
|
+
var import_react24 = require("react");
|
|
2269
|
+
var import_react25 = require("@floating-ui/react");
|
|
2270
|
+
var import_react26 = require("@headlessui/react");
|
|
2269
2271
|
var import_hi = require("react-icons/hi");
|
|
2270
2272
|
var import_solid4 = require("@heroicons/react/20/solid");
|
|
2271
2273
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
@@ -2281,10 +2283,10 @@ var COLOR_MAP = {
|
|
|
2281
2283
|
disabled: "text-red-200 dark:text-red-600/40 cursor-not-allowed"
|
|
2282
2284
|
}
|
|
2283
2285
|
};
|
|
2284
|
-
var MenuContext = (0,
|
|
2286
|
+
var MenuContext = (0, import_react24.createContext)({});
|
|
2285
2287
|
var MenuItem = ({ item, onSelect, labelClassName }) => {
|
|
2286
|
-
const { selectedKey } = (0,
|
|
2287
|
-
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 }) => {
|
|
2288
2290
|
if (item.items) {
|
|
2289
2291
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2290
2292
|
SubMenuButton,
|
|
@@ -2348,21 +2350,21 @@ var SubMenuButton = (props) => {
|
|
|
2348
2350
|
placement = "right-start",
|
|
2349
2351
|
buttonClass: buttonClass3
|
|
2350
2352
|
} = props;
|
|
2351
|
-
const [open, setOpen] = (0,
|
|
2352
|
-
const { refs, floatingStyles, context } = (0,
|
|
2353
|
+
const [open, setOpen] = (0, import_react24.useState)(false);
|
|
2354
|
+
const { refs, floatingStyles, context } = (0, import_react25.useFloating)({
|
|
2353
2355
|
open,
|
|
2354
2356
|
onOpenChange: setOpen,
|
|
2355
2357
|
placement,
|
|
2356
|
-
whileElementsMounted:
|
|
2357
|
-
middleware: [(0,
|
|
2358
|
+
whileElementsMounted: import_react25.autoUpdate,
|
|
2359
|
+
middleware: [(0, import_react25.flip)(), (0, import_react25.shift)()]
|
|
2358
2360
|
});
|
|
2359
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
2360
|
-
(0,
|
|
2361
|
-
handleClose: (0,
|
|
2361
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react25.useInteractions)([
|
|
2362
|
+
(0, import_react25.useHover)(context, {
|
|
2363
|
+
handleClose: (0, import_react25.safePolygon)()
|
|
2362
2364
|
})
|
|
2363
2365
|
]);
|
|
2364
2366
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2365
|
-
|
|
2367
|
+
import_react26.Menu,
|
|
2366
2368
|
{
|
|
2367
2369
|
as: "div",
|
|
2368
2370
|
className: (0, import_class_variance_authority10.cx)(
|
|
@@ -2372,7 +2374,7 @@ var SubMenuButton = (props) => {
|
|
|
2372
2374
|
),
|
|
2373
2375
|
children: [
|
|
2374
2376
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2375
|
-
|
|
2377
|
+
import_react26.Menu.Button,
|
|
2376
2378
|
{
|
|
2377
2379
|
className: (0, import_class_variance_authority10.cx)(
|
|
2378
2380
|
active || open ? COLOR_MAP[status || "default"].active : COLOR_MAP[status || "default"].default,
|
|
@@ -2403,7 +2405,7 @@ var SubMenuButton = (props) => {
|
|
|
2403
2405
|
}
|
|
2404
2406
|
),
|
|
2405
2407
|
open && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2406
|
-
|
|
2408
|
+
import_react26.Menu.Items,
|
|
2407
2409
|
{
|
|
2408
2410
|
static: true,
|
|
2409
2411
|
ref: refs.setFloating,
|
|
@@ -2429,8 +2431,8 @@ var SubMenuButton = (props) => {
|
|
|
2429
2431
|
};
|
|
2430
2432
|
|
|
2431
2433
|
// src/utils/nav-size-context.ts
|
|
2432
|
-
var
|
|
2433
|
-
var NavSizeContext = (0,
|
|
2434
|
+
var import_react27 = require("react");
|
|
2435
|
+
var NavSizeContext = (0, import_react27.createContext)({
|
|
2434
2436
|
small: true,
|
|
2435
2437
|
showLabel: true,
|
|
2436
2438
|
setSmall: (small) => {
|
|
@@ -2460,23 +2462,23 @@ function PopupMenuButton({
|
|
|
2460
2462
|
selectedKey,
|
|
2461
2463
|
onOpenCallback
|
|
2462
2464
|
}) {
|
|
2463
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
2464
|
-
const { small } = (0,
|
|
2465
|
-
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)({
|
|
2466
2468
|
open: menuOpen,
|
|
2467
2469
|
onOpenChange: setMenuOpen,
|
|
2468
|
-
middleware: [(0,
|
|
2470
|
+
middleware: [(0, import_react30.offset)(offset2), (0, import_react30.flip)(), (0, import_react30.shift)()],
|
|
2469
2471
|
placement,
|
|
2470
|
-
whileElementsMounted:
|
|
2472
|
+
whileElementsMounted: import_react30.autoUpdate
|
|
2471
2473
|
});
|
|
2472
|
-
const itemStyle = (0,
|
|
2474
|
+
const itemStyle = (0, import_react28.useMemo)(() => {
|
|
2473
2475
|
return {
|
|
2474
2476
|
width
|
|
2475
2477
|
};
|
|
2476
2478
|
}, [width]);
|
|
2477
|
-
const onOpenCallbackRef = (0,
|
|
2479
|
+
const onOpenCallbackRef = (0, import_react28.useRef)(onOpenCallback);
|
|
2478
2480
|
onOpenCallbackRef.current = onOpenCallback;
|
|
2479
|
-
(0,
|
|
2481
|
+
(0, import_react28.useEffect)(() => {
|
|
2480
2482
|
if (menuOpen) {
|
|
2481
2483
|
onOpenCallbackRef.current?.();
|
|
2482
2484
|
}
|
|
@@ -2484,9 +2486,9 @@ function PopupMenuButton({
|
|
|
2484
2486
|
let menuItems = null;
|
|
2485
2487
|
if (menuOpen && items.length > 0) {
|
|
2486
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)(
|
|
2487
|
-
|
|
2489
|
+
import_react29.Transition,
|
|
2488
2490
|
{
|
|
2489
|
-
as:
|
|
2491
|
+
as: import_react28.Fragment,
|
|
2490
2492
|
enter: "transition ease-out duration-100",
|
|
2491
2493
|
enterFrom: "transform opacity-0 scale-95",
|
|
2492
2494
|
enterTo: "transform opacity-100 scale-100",
|
|
@@ -2494,7 +2496,7 @@ function PopupMenuButton({
|
|
|
2494
2496
|
leaveFrom: "transform opacity-100 scale-100",
|
|
2495
2497
|
leaveTo: "transform opacity-0 scale-95",
|
|
2496
2498
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2497
|
-
|
|
2499
|
+
import_react29.Menu.Items,
|
|
2498
2500
|
{
|
|
2499
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",
|
|
2500
2502
|
style: itemStyle,
|
|
@@ -2521,13 +2523,13 @@ function PopupMenuButton({
|
|
|
2521
2523
|
}
|
|
2522
2524
|
) }) });
|
|
2523
2525
|
}
|
|
2524
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react29.Menu, { children: ({ open }) => {
|
|
2525
2527
|
setTimeout(() => {
|
|
2526
2528
|
setMenuOpen(open);
|
|
2527
2529
|
}, 0);
|
|
2528
2530
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2529
2531
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2530
|
-
|
|
2532
|
+
import_react29.Menu.Button,
|
|
2531
2533
|
{
|
|
2532
2534
|
className: (0, import_class_variance_authority10.cx)(
|
|
2533
2535
|
"text-gray w-fit px-1 hover:text-gray-500 active:text-gray-700",
|
|
@@ -2539,7 +2541,7 @@ function PopupMenuButton({
|
|
|
2539
2541
|
children: typeof buttonIcon === "function" ? buttonIcon(menuOpen) : buttonIcon
|
|
2540
2542
|
}
|
|
2541
2543
|
),
|
|
2542
|
-
portal ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2544
|
+
portal ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react30.FloatingPortal, { children: menuItems }) : menuItems
|
|
2543
2545
|
] });
|
|
2544
2546
|
} });
|
|
2545
2547
|
}
|
|
@@ -2770,7 +2772,7 @@ var reorder = (list, startIndex, endIndex) => {
|
|
|
2770
2772
|
function onPreventClick(e) {
|
|
2771
2773
|
e.stopPropagation();
|
|
2772
2774
|
}
|
|
2773
|
-
var _ResizeTable = (0,
|
|
2775
|
+
var _ResizeTable = (0, import_react31.forwardRef)(function _ResizeTable2({
|
|
2774
2776
|
data,
|
|
2775
2777
|
columns,
|
|
2776
2778
|
columnResizeMode,
|
|
@@ -2794,7 +2796,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2794
2796
|
estimatedRowHeight = 35,
|
|
2795
2797
|
overscan = 5
|
|
2796
2798
|
}, tableContainerRef) {
|
|
2797
|
-
const adjustedColumns = (0,
|
|
2799
|
+
const adjustedColumns = (0, import_react31.useMemo)(() => {
|
|
2798
2800
|
let totalWidth = 0;
|
|
2799
2801
|
const newColumns = columns.map((c) => {
|
|
2800
2802
|
const item = Object.assign({ minSize }, c);
|
|
@@ -2813,7 +2815,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2813
2815
|
}
|
|
2814
2816
|
return newColumns;
|
|
2815
2817
|
}, [columns, minSize, minWidth]);
|
|
2816
|
-
const [tableState, setTableState] = (0,
|
|
2818
|
+
const [tableState, setTableState] = (0, import_react31.useState)(() => {
|
|
2817
2819
|
const initialState = {
|
|
2818
2820
|
pagination: {
|
|
2819
2821
|
pageIndex: 0,
|
|
@@ -2833,7 +2835,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2833
2835
|
onStateChange: setTableState,
|
|
2834
2836
|
manualSorting
|
|
2835
2837
|
});
|
|
2836
|
-
(0,
|
|
2838
|
+
(0, import_react31.useEffect)(() => {
|
|
2837
2839
|
if (state && Object.keys(state).length > 0) {
|
|
2838
2840
|
setTableState((prev) => {
|
|
2839
2841
|
const newState = {
|
|
@@ -2845,14 +2847,14 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2845
2847
|
});
|
|
2846
2848
|
}
|
|
2847
2849
|
}, [state]);
|
|
2848
|
-
const debounceStateChange = (0,
|
|
2850
|
+
const debounceStateChange = (0, import_react31.useMemo)(() => {
|
|
2849
2851
|
if (!onStateChange) return void 0;
|
|
2850
2852
|
return (0, import_lodash6.debounce)(onStateChange, 500, {});
|
|
2851
2853
|
}, [onStateChange]);
|
|
2852
|
-
(0,
|
|
2854
|
+
(0, import_react31.useEffect)(() => {
|
|
2853
2855
|
debounceStateChange?.(tableState);
|
|
2854
2856
|
}, [debounceStateChange, tableState]);
|
|
2855
|
-
const fetchMoreOnBottomReached = (0,
|
|
2857
|
+
const fetchMoreOnBottomReached = (0, import_react31.useMemo)(() => {
|
|
2856
2858
|
return (0, import_lodash6.debounce)((containerRefElement) => {
|
|
2857
2859
|
if (containerRefElement) {
|
|
2858
2860
|
const { scrollHeight, scrollTop, clientHeight } = containerRefElement;
|
|
@@ -2862,8 +2864,8 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2862
2864
|
}
|
|
2863
2865
|
}, 500);
|
|
2864
2866
|
}, [onFetchMore, isFetching, hasMore]);
|
|
2865
|
-
const tableContainerElementRef = (0,
|
|
2866
|
-
(0,
|
|
2867
|
+
const tableContainerElementRef = (0, import_react31.useRef)(null);
|
|
2868
|
+
(0, import_react31.useEffect)(() => {
|
|
2867
2869
|
if (tableContainerRef) {
|
|
2868
2870
|
if (typeof tableContainerRef === "function") {
|
|
2869
2871
|
tableContainerRef(tableContainerElementRef.current);
|
|
@@ -2875,7 +2877,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2875
2877
|
const rowVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
2876
2878
|
count: enableVirtualization ? table.getRowModel().rows.length : 0,
|
|
2877
2879
|
getScrollElement: () => tableContainerElementRef.current,
|
|
2878
|
-
estimateSize: (0,
|
|
2880
|
+
estimateSize: (0, import_react31.useCallback)(() => estimatedRowHeight, [estimatedRowHeight]),
|
|
2879
2881
|
overscan,
|
|
2880
2882
|
enabled: enableVirtualization
|
|
2881
2883
|
});
|
|
@@ -3117,7 +3119,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
3117
3119
|
}
|
|
3118
3120
|
);
|
|
3119
3121
|
});
|
|
3120
|
-
var ResizeTable = (0,
|
|
3122
|
+
var ResizeTable = (0, import_react31.memo)(_ResizeTable);
|
|
3121
3123
|
|
|
3122
3124
|
// src/utils/number-format.ts
|
|
3123
3125
|
var import_bigdecimal = __toESM(require("@sentio/bigdecimal"));
|
|
@@ -3144,10 +3146,10 @@ function getNumberWithDecimal(hex, decimal, asNumber) {
|
|
|
3144
3146
|
}
|
|
3145
3147
|
|
|
3146
3148
|
// src/utils/use-mobile.ts
|
|
3147
|
-
var
|
|
3149
|
+
var import_react32 = require("react");
|
|
3148
3150
|
function useMobile(breakpoint = 768, defaultValue = false) {
|
|
3149
|
-
const [isMobile, setIsMobile] = (0,
|
|
3150
|
-
(0,
|
|
3151
|
+
const [isMobile, setIsMobile] = (0, import_react32.useState)(defaultValue);
|
|
3152
|
+
(0, import_react32.useEffect)(() => {
|
|
3151
3153
|
const checkUserAgent = () => {
|
|
3152
3154
|
if (typeof window === "undefined") return false;
|
|
3153
3155
|
const userAgent = window.navigator.userAgent.toLowerCase();
|