@sentio/ui-core 0.1.2 → 0.1.4
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 +18 -42
- 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 +215 -208
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -42
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
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,45 +128,48 @@ 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 =
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
),
|
|
153
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "absolute left-[50%] top-[50%] z-[1] -translate-y-6", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
154
|
-
import_react_spinners2.ClipLoader,
|
|
155
|
-
{
|
|
156
|
-
loading,
|
|
157
|
-
color: "#3B82F6",
|
|
158
|
-
size,
|
|
159
|
-
cssOverride: {
|
|
160
|
-
borderWidth: 3
|
|
135
|
+
var SpinLoading = import_react2.default.forwardRef(
|
|
136
|
+
function Spinner(args, ref) {
|
|
137
|
+
const {
|
|
138
|
+
loading = false,
|
|
139
|
+
children,
|
|
140
|
+
className,
|
|
141
|
+
size = 48,
|
|
142
|
+
showMask,
|
|
143
|
+
maskOpacity = 80
|
|
144
|
+
} = args;
|
|
145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref, className: (0, import_class_variance_authority2.cx)("relative", className), children: [
|
|
146
|
+
showMask && loading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
147
|
+
"div",
|
|
148
|
+
{
|
|
149
|
+
className: (0, import_class_variance_authority2.cx)(
|
|
150
|
+
"absolute bottom-0 left-0 right-0 top-0 z-[1]",
|
|
151
|
+
maskOpacity ? `bg-white dark:bg-sentio-gray-100/${maskOpacity}` : "dark:bg-sentio-gray-100 bg-white"
|
|
152
|
+
)
|
|
161
153
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
154
|
+
),
|
|
155
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "absolute left-[50%] top-[50%] z-[1] -translate-y-6", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
156
|
+
import_react_spinners2.ClipLoader,
|
|
157
|
+
{
|
|
158
|
+
loading,
|
|
159
|
+
color: "#3B82F6",
|
|
160
|
+
size,
|
|
161
|
+
cssOverride: {
|
|
162
|
+
borderWidth: 3
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
) }),
|
|
166
|
+
children
|
|
167
|
+
] });
|
|
168
|
+
}
|
|
169
|
+
);
|
|
167
170
|
|
|
168
171
|
// src/common/CopyButton.tsx
|
|
169
|
-
var
|
|
172
|
+
var import_react3 = require("react");
|
|
170
173
|
var import_copy_to_clipboard = __toESM(require("copy-to-clipboard"));
|
|
171
174
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
172
175
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
@@ -216,12 +219,12 @@ var CopyButton = ({
|
|
|
216
219
|
children,
|
|
217
220
|
className
|
|
218
221
|
}) => {
|
|
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,
|
|
222
|
+
const [copied, setCopied] = (0, import_react3.useState)(false);
|
|
223
|
+
const [isHovered, setIsHovered] = (0, import_react3.useState)(false);
|
|
224
|
+
const [isMobile, setIsMobile] = (0, import_react3.useState)(false);
|
|
225
|
+
const timeoutRef = (0, import_react3.useRef)(null);
|
|
226
|
+
const iconContainerRef = (0, import_react3.useRef)(null);
|
|
227
|
+
(0, import_react3.useEffect)(() => {
|
|
225
228
|
const checkMobile = () => {
|
|
226
229
|
setIsMobile(window.innerWidth < 640);
|
|
227
230
|
};
|
|
@@ -229,7 +232,7 @@ var CopyButton = ({
|
|
|
229
232
|
window.addEventListener("resize", checkMobile);
|
|
230
233
|
return () => window.removeEventListener("resize", checkMobile);
|
|
231
234
|
}, []);
|
|
232
|
-
const copyToClipboard = (0,
|
|
235
|
+
const copyToClipboard = (0, import_react3.useCallback)((val) => {
|
|
233
236
|
(0, import_copy_to_clipboard.default)(val);
|
|
234
237
|
setCopied(true);
|
|
235
238
|
if (timeoutRef.current) {
|
|
@@ -240,7 +243,7 @@ var CopyButton = ({
|
|
|
240
243
|
timeoutRef.current = null;
|
|
241
244
|
}, 2e3);
|
|
242
245
|
}, []);
|
|
243
|
-
const onCopy = (0,
|
|
246
|
+
const onCopy = (0, import_react3.useCallback)(
|
|
244
247
|
(e) => {
|
|
245
248
|
const target = e.target;
|
|
246
249
|
if (target.nodeName.toLowerCase() === "a" && target.getAttribute("href")) {
|
|
@@ -266,7 +269,7 @@ var CopyButton = ({
|
|
|
266
269
|
},
|
|
267
270
|
[copied, text, copyToClipboard]
|
|
268
271
|
);
|
|
269
|
-
const handleEventProxy = (0,
|
|
272
|
+
const handleEventProxy = (0, import_react3.useCallback)(
|
|
270
273
|
(e) => {
|
|
271
274
|
if (children) {
|
|
272
275
|
onCopy(e);
|
|
@@ -350,11 +353,11 @@ var CopyButton = ({
|
|
|
350
353
|
};
|
|
351
354
|
|
|
352
355
|
// src/common/NewButton.tsx
|
|
353
|
-
var
|
|
356
|
+
var import_react6 = require("react");
|
|
354
357
|
|
|
355
358
|
// src/common/DivTooltip.tsx
|
|
356
|
-
var
|
|
357
|
-
var
|
|
359
|
+
var import_react4 = __toESM(require("react"));
|
|
360
|
+
var import_react5 = require("@floating-ui/react");
|
|
358
361
|
var import_class_variance_authority4 = require("class-variance-authority");
|
|
359
362
|
var import_lodash = require("lodash");
|
|
360
363
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
@@ -374,10 +377,10 @@ var PopoverTooltip = ({
|
|
|
374
377
|
enableFadeAnimation = false,
|
|
375
378
|
animationDuration = 150
|
|
376
379
|
}) => {
|
|
377
|
-
const arrowRef = (0,
|
|
378
|
-
const [open, setOpen] = (0,
|
|
379
|
-
const [isVisible, setIsVisible] = (0,
|
|
380
|
-
const timeoutRef = (0,
|
|
380
|
+
const arrowRef = (0, import_react4.useRef)(null);
|
|
381
|
+
const [open, setOpen] = (0, import_react4.useState)(false);
|
|
382
|
+
const [isVisible, setIsVisible] = (0, import_react4.useState)(false);
|
|
383
|
+
const timeoutRef = (0, import_react4.useRef)();
|
|
381
384
|
const {
|
|
382
385
|
x,
|
|
383
386
|
y,
|
|
@@ -386,7 +389,7 @@ var PopoverTooltip = ({
|
|
|
386
389
|
middlewareData: { arrow: { x: arrowX, y: arrowY } = {} },
|
|
387
390
|
context,
|
|
388
391
|
placement
|
|
389
|
-
} = (0,
|
|
392
|
+
} = (0, import_react5.useFloating)({
|
|
390
393
|
open,
|
|
391
394
|
onOpenChange: (newOpen) => {
|
|
392
395
|
setOpen(newOpen);
|
|
@@ -406,30 +409,30 @@ var PopoverTooltip = ({
|
|
|
406
409
|
}
|
|
407
410
|
},
|
|
408
411
|
middleware: [
|
|
409
|
-
(0,
|
|
410
|
-
(0,
|
|
411
|
-
(0,
|
|
412
|
-
(0,
|
|
412
|
+
(0, import_react5.offset)(offsetOptions),
|
|
413
|
+
(0, import_react5.flip)(),
|
|
414
|
+
(0, import_react5.shift)(),
|
|
415
|
+
(0, import_react5.arrow)({ element: arrowRef, padding: 8 })
|
|
413
416
|
],
|
|
414
417
|
strategy: propStrategy,
|
|
415
418
|
placement: placementOption,
|
|
416
|
-
whileElementsMounted:
|
|
419
|
+
whileElementsMounted: import_react5.autoUpdate
|
|
417
420
|
});
|
|
418
421
|
const {
|
|
419
422
|
delay = {
|
|
420
423
|
open: 500,
|
|
421
424
|
close: 0
|
|
422
425
|
}
|
|
423
|
-
} = (0,
|
|
424
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
425
|
-
(0,
|
|
426
|
-
handleClose: (0,
|
|
426
|
+
} = (0, import_react5.useDelayGroup)(context);
|
|
427
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react5.useInteractions)([
|
|
428
|
+
(0, import_react5.useHover)(context, {
|
|
429
|
+
handleClose: (0, import_react5.safePolygon)({
|
|
427
430
|
buffer: -Infinity
|
|
428
431
|
}),
|
|
429
432
|
delay
|
|
430
433
|
})
|
|
431
434
|
]);
|
|
432
|
-
(0,
|
|
435
|
+
(0, import_react4.useEffect)(() => {
|
|
433
436
|
return () => {
|
|
434
437
|
if (timeoutRef.current) {
|
|
435
438
|
clearTimeout(timeoutRef.current);
|
|
@@ -441,7 +444,7 @@ var PopoverTooltip = ({
|
|
|
441
444
|
icon,
|
|
442
445
|
children
|
|
443
446
|
] });
|
|
444
|
-
const Portal = usePortal ?
|
|
447
|
+
const Portal = usePortal ? import_react5.FloatingPortal : import_react4.default.Fragment;
|
|
445
448
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: (0, import_class_variance_authority4.cx)("relative flex items-center", className), children: [
|
|
446
449
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
447
450
|
"div",
|
|
@@ -474,7 +477,7 @@ var PopoverTooltip = ({
|
|
|
474
477
|
!hideArrow && placement === "bottom" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
475
478
|
"div",
|
|
476
479
|
{
|
|
477
|
-
className: "arrow dark:
|
|
480
|
+
className: "arrow dark:bg-sentio-gray-100 before:border-border-color -translate-y-[7px] bg-white before:visible before:border before:border-b-0 before:border-r-0",
|
|
478
481
|
ref: arrowRef,
|
|
479
482
|
style: {
|
|
480
483
|
left: arrowX ?? 0,
|
|
@@ -613,18 +616,22 @@ function Proccessing({ className, light }) {
|
|
|
613
616
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
614
617
|
"circle",
|
|
615
618
|
{
|
|
616
|
-
className: light ? "opacity-5" : "opacity-10",
|
|
617
619
|
cx: "12",
|
|
618
620
|
cy: "12",
|
|
619
621
|
r: "10",
|
|
620
622
|
stroke: "currentColor",
|
|
621
|
-
strokeWidth: "4"
|
|
623
|
+
strokeWidth: "4",
|
|
624
|
+
style: {
|
|
625
|
+
opacity: light ? 0.05 : 0.1
|
|
626
|
+
}
|
|
622
627
|
}
|
|
623
628
|
),
|
|
624
629
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
625
630
|
"path",
|
|
626
631
|
{
|
|
627
|
-
|
|
632
|
+
style: {
|
|
633
|
+
opacity: light ? 0.5 : 0.75
|
|
634
|
+
},
|
|
628
635
|
fill: "currentColor",
|
|
629
636
|
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
630
637
|
}
|
|
@@ -681,7 +688,7 @@ function Button({
|
|
|
681
688
|
id
|
|
682
689
|
}, ref) {
|
|
683
690
|
const iconClasses = iconClass({ size, disabled });
|
|
684
|
-
const iconEl = (0,
|
|
691
|
+
const iconEl = (0, import_react6.useMemo)(() => {
|
|
685
692
|
let iconEl2 = null;
|
|
686
693
|
if (processing) {
|
|
687
694
|
iconEl2 = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
@@ -692,7 +699,7 @@ function Button({
|
|
|
692
699
|
}
|
|
693
700
|
);
|
|
694
701
|
} else if (icon) {
|
|
695
|
-
iconEl2 = (0,
|
|
702
|
+
iconEl2 = (0, import_react6.cloneElement)(icon, { className: (0, import_class_variance_authority5.cx)(icon.props.className, iconClasses) });
|
|
696
703
|
}
|
|
697
704
|
return iconEl2;
|
|
698
705
|
}, [icon, iconClasses, processing, role]);
|
|
@@ -739,15 +746,15 @@ function Button({
|
|
|
739
746
|
}
|
|
740
747
|
return btn;
|
|
741
748
|
}
|
|
742
|
-
var NewButton = (0,
|
|
749
|
+
var NewButton = (0, import_react6.forwardRef)(Button);
|
|
743
750
|
var NewButton_default = NewButton;
|
|
744
751
|
|
|
745
752
|
// src/common/dialog/BaseDialog.tsx
|
|
746
|
-
var
|
|
747
|
-
var
|
|
753
|
+
var import_react7 = require("react");
|
|
754
|
+
var import_react8 = require("@headlessui/react");
|
|
748
755
|
var import_class_variance_authority6 = require("class-variance-authority");
|
|
749
756
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
750
|
-
var BaseZIndexContext = (0,
|
|
757
|
+
var BaseZIndexContext = (0, import_react7.createContext)(10);
|
|
751
758
|
var _BaseDialog = ({
|
|
752
759
|
title,
|
|
753
760
|
open,
|
|
@@ -770,8 +777,8 @@ var _BaseDialog = ({
|
|
|
770
777
|
zIndex = 10,
|
|
771
778
|
mask = "normal"
|
|
772
779
|
}) => {
|
|
773
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
774
|
-
|
|
780
|
+
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)(
|
|
781
|
+
import_react8.Dialog,
|
|
775
782
|
{
|
|
776
783
|
className: (0, import_class_variance_authority6.cx)("relative", "_sentio_"),
|
|
777
784
|
as: "div",
|
|
@@ -782,9 +789,9 @@ var _BaseDialog = ({
|
|
|
782
789
|
},
|
|
783
790
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(BaseZIndexContext.Provider, { value: zIndex, children: [
|
|
784
791
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
785
|
-
|
|
792
|
+
import_react8.Transition.Child,
|
|
786
793
|
{
|
|
787
|
-
as:
|
|
794
|
+
as: import_react7.Fragment,
|
|
788
795
|
enter: "ease-out duration-300",
|
|
789
796
|
enterFrom: "opacity-0",
|
|
790
797
|
enterTo: "opacity-100",
|
|
@@ -803,9 +810,9 @@ var _BaseDialog = ({
|
|
|
803
810
|
}
|
|
804
811
|
),
|
|
805
812
|
/* @__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
|
-
|
|
813
|
+
import_react8.Transition.Child,
|
|
807
814
|
{
|
|
808
|
-
as:
|
|
815
|
+
as: import_react7.Fragment,
|
|
809
816
|
enter: "ease-out duration-300",
|
|
810
817
|
enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
811
818
|
enterTo: "opacity-100 translate-y-0 sm:scale-100",
|
|
@@ -813,7 +820,7 @@ var _BaseDialog = ({
|
|
|
813
820
|
leaveFrom: "opacity-100 translate-y-0 sm:scale-100",
|
|
814
821
|
leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
815
822
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
816
|
-
|
|
823
|
+
import_react8.Dialog.Panel,
|
|
817
824
|
{
|
|
818
825
|
"data-testid": "create-dashboard",
|
|
819
826
|
className: (0, import_class_variance_authority6.cx)(
|
|
@@ -822,7 +829,7 @@ var _BaseDialog = ({
|
|
|
822
829
|
),
|
|
823
830
|
children: [
|
|
824
831
|
title ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
825
|
-
|
|
832
|
+
import_react8.Dialog.Title,
|
|
826
833
|
{
|
|
827
834
|
as: "h3",
|
|
828
835
|
className: (0, import_class_variance_authority6.cx)(
|
|
@@ -875,10 +882,10 @@ var _BaseDialog = ({
|
|
|
875
882
|
}
|
|
876
883
|
) });
|
|
877
884
|
};
|
|
878
|
-
var BaseDialog = (0,
|
|
885
|
+
var BaseDialog = (0, import_react7.memo)(_BaseDialog);
|
|
879
886
|
|
|
880
887
|
// src/common/DisclosurePanel.tsx
|
|
881
|
-
var
|
|
888
|
+
var import_react9 = require("react");
|
|
882
889
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
883
890
|
var import_isFunction = __toESM(require("lodash/isFunction"));
|
|
884
891
|
var import_lu = require("react-icons/lu");
|
|
@@ -892,8 +899,8 @@ var DisclosurePanel = ({
|
|
|
892
899
|
iconClassName = "h-5 w-5",
|
|
893
900
|
titleClassName
|
|
894
901
|
}) => {
|
|
895
|
-
const [open, setOpen] = (0,
|
|
896
|
-
const toggle = (0,
|
|
902
|
+
const [open, setOpen] = (0, import_react9.useState)(defaultOpen || false);
|
|
903
|
+
const toggle = (0, import_react9.useCallback)(() => {
|
|
897
904
|
setOpen((prev) => !prev);
|
|
898
905
|
}, []);
|
|
899
906
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
@@ -937,12 +944,12 @@ var import_solid = require("@heroicons/react/20/solid");
|
|
|
937
944
|
var import_class_variance_authority8 = require("class-variance-authority");
|
|
938
945
|
|
|
939
946
|
// src/utils/use-boolean.ts
|
|
940
|
-
var
|
|
947
|
+
var import_react10 = require("react");
|
|
941
948
|
function useBoolean(defaultValue = false) {
|
|
942
|
-
const [value, setValue] = (0,
|
|
943
|
-
const setTrue = (0,
|
|
944
|
-
const setFalse = (0,
|
|
945
|
-
const toggle = (0,
|
|
949
|
+
const [value, setValue] = (0, import_react10.useState)(defaultValue);
|
|
950
|
+
const setTrue = (0, import_react10.useCallback)(() => setValue(true), []);
|
|
951
|
+
const setFalse = (0, import_react10.useCallback)(() => setValue(false), []);
|
|
952
|
+
const toggle = (0, import_react10.useCallback)(() => setValue((v) => !v), []);
|
|
946
953
|
return {
|
|
947
954
|
value,
|
|
948
955
|
setValue,
|
|
@@ -953,7 +960,7 @@ function useBoolean(defaultValue = false) {
|
|
|
953
960
|
}
|
|
954
961
|
|
|
955
962
|
// src/common/Collapse.tsx
|
|
956
|
-
var
|
|
963
|
+
var import_react11 = require("react");
|
|
957
964
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
958
965
|
var Collapse = ({
|
|
959
966
|
title,
|
|
@@ -964,7 +971,7 @@ var Collapse = ({
|
|
|
964
971
|
iconClassName = "h-5 w-5"
|
|
965
972
|
}) => {
|
|
966
973
|
const { toggle, value: visible, setTrue, setFalse } = useBoolean(defaultOpen);
|
|
967
|
-
(0,
|
|
974
|
+
(0, import_react11.useEffect)(() => {
|
|
968
975
|
if (defaultOpen) {
|
|
969
976
|
setTrue();
|
|
970
977
|
} else {
|
|
@@ -1014,7 +1021,7 @@ var Collapse = ({
|
|
|
1014
1021
|
// src/common/Input.tsx
|
|
1015
1022
|
var import_class_variance_authority9 = require("class-variance-authority");
|
|
1016
1023
|
var import_solid2 = require("@heroicons/react/20/solid");
|
|
1017
|
-
var
|
|
1024
|
+
var import_react12 = require("react");
|
|
1018
1025
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1019
1026
|
var inputContainerStyles = (0, import_class_variance_authority9.cva)(
|
|
1020
1027
|
"flex relative rounded-md border focus-within:ring-1 w-full font-normal overflow-hidden",
|
|
@@ -1080,7 +1087,7 @@ var iconStyles = (0, import_class_variance_authority9.cva)("text-red-500", {
|
|
|
1080
1087
|
size: "md"
|
|
1081
1088
|
}
|
|
1082
1089
|
});
|
|
1083
|
-
var Input = (0,
|
|
1090
|
+
var Input = (0, import_react12.forwardRef)(
|
|
1084
1091
|
function Input2(props, inputRef) {
|
|
1085
1092
|
const { className, error, errorClassName, size, ...rest } = props;
|
|
1086
1093
|
const containerClassName = inputContainerStyles({
|
|
@@ -1100,7 +1107,7 @@ var Input = (0, import_react11.forwardRef)(
|
|
|
1100
1107
|
);
|
|
1101
1108
|
|
|
1102
1109
|
// src/common/select/Radio.tsx
|
|
1103
|
-
var
|
|
1110
|
+
var import_react13 = require("@headlessui/react");
|
|
1104
1111
|
|
|
1105
1112
|
// src/utils/classnames.ts
|
|
1106
1113
|
var import_class_variance_authority10 = require("class-variance-authority");
|
|
@@ -1116,8 +1123,8 @@ function RadioSelect({
|
|
|
1116
1123
|
vertical,
|
|
1117
1124
|
containerClassName
|
|
1118
1125
|
}) {
|
|
1119
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1120
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
1126
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react13.RadioGroup, { value, onChange, children: [
|
|
1127
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react13.RadioGroup.Label, { className: "text-ilabel text-text-foreground mr-4 font-medium", children: [
|
|
1121
1128
|
label,
|
|
1122
1129
|
":"
|
|
1123
1130
|
] }),
|
|
@@ -1129,7 +1136,7 @@ function RadioSelect({
|
|
|
1129
1136
|
vertical ? "flex flex-col gap-2" : "inline-flex gap-4",
|
|
1130
1137
|
containerClassName
|
|
1131
1138
|
),
|
|
1132
|
-
children: options.map(({ name, value: value2 }, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1139
|
+
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
1140
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1134
1141
|
"input",
|
|
1135
1142
|
{
|
|
@@ -1157,8 +1164,8 @@ function RadioSelect({
|
|
|
1157
1164
|
}
|
|
1158
1165
|
|
|
1159
1166
|
// src/common/select/Switch.tsx
|
|
1160
|
-
var
|
|
1161
|
-
var
|
|
1167
|
+
var import_react14 = require("react");
|
|
1168
|
+
var import_react15 = require("@headlessui/react");
|
|
1162
1169
|
var import_class_variance_authority11 = require("class-variance-authority");
|
|
1163
1170
|
var import_lodash2 = require("lodash");
|
|
1164
1171
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
@@ -1259,8 +1266,8 @@ function Switch({
|
|
|
1259
1266
|
disabled,
|
|
1260
1267
|
label
|
|
1261
1268
|
}) {
|
|
1262
|
-
const [enabled, setState] = (0,
|
|
1263
|
-
const onChange = (0,
|
|
1269
|
+
const [enabled, setState] = (0, import_react14.useState)(checked);
|
|
1270
|
+
const onChange = (0, import_react14.useCallback)(() => {
|
|
1264
1271
|
setState((enabled2) => {
|
|
1265
1272
|
if ((0, import_lodash2.isFunction)(_onChange)) {
|
|
1266
1273
|
setTimeout(() => {
|
|
@@ -1270,12 +1277,12 @@ function Switch({
|
|
|
1270
1277
|
return !enabled2;
|
|
1271
1278
|
});
|
|
1272
1279
|
}, [_onChange]);
|
|
1273
|
-
(0,
|
|
1280
|
+
(0, import_react14.useEffect)(() => {
|
|
1274
1281
|
setState(checked);
|
|
1275
1282
|
}, [checked]);
|
|
1276
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react15.Switch.Group, { children: [
|
|
1277
1284
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1278
|
-
|
|
1285
|
+
import_react15.Switch,
|
|
1279
1286
|
{
|
|
1280
1287
|
checked: enabled,
|
|
1281
1288
|
onChange: onChange || setState,
|
|
@@ -1301,7 +1308,7 @@ function Switch({
|
|
|
1301
1308
|
}
|
|
1302
1309
|
),
|
|
1303
1310
|
label && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1304
|
-
|
|
1311
|
+
import_react15.Switch.Label,
|
|
1305
1312
|
{
|
|
1306
1313
|
className: labelClass({
|
|
1307
1314
|
size,
|
|
@@ -1314,11 +1321,11 @@ function Switch({
|
|
|
1314
1321
|
}
|
|
1315
1322
|
|
|
1316
1323
|
// src/common/select/Select.tsx
|
|
1317
|
-
var
|
|
1324
|
+
var import_react16 = require("@headlessui/react");
|
|
1318
1325
|
var import_solid3 = require("@heroicons/react/20/solid");
|
|
1319
1326
|
var import_lodash3 = require("lodash");
|
|
1320
1327
|
var import_class_variance_authority12 = require("class-variance-authority");
|
|
1321
|
-
var
|
|
1328
|
+
var import_react17 = require("react");
|
|
1322
1329
|
var import_isFunction2 = __toESM(require("lodash/isFunction"));
|
|
1323
1330
|
var import_react_spinners3 = require("react-spinners");
|
|
1324
1331
|
var import_react_laag = require("react-laag");
|
|
@@ -1434,14 +1441,14 @@ function Select({
|
|
|
1434
1441
|
asLayer
|
|
1435
1442
|
}) {
|
|
1436
1443
|
const selectedIndex = options.findIndex((o) => (0, import_lodash3.isEqual)(o.value, value));
|
|
1437
|
-
const listRef = (0,
|
|
1438
|
-
const [open, setOpen] = (0,
|
|
1444
|
+
const listRef = (0, import_react17.useRef)(null);
|
|
1445
|
+
const [open, setOpen] = (0, import_react17.useState)(false);
|
|
1439
1446
|
const { width, ref } = (0, import_react_resize_detector.useResizeDetector)({
|
|
1440
1447
|
refreshMode: "debounce",
|
|
1441
1448
|
refreshRate: 100,
|
|
1442
1449
|
handleHeight: false
|
|
1443
1450
|
});
|
|
1444
|
-
const baseZIndex = (0,
|
|
1451
|
+
const baseZIndex = (0, import_react17.useContext)(BaseZIndexContext);
|
|
1445
1452
|
const { renderLayer, triggerProps, layerProps } = (0, import_react_laag.useLayer)({
|
|
1446
1453
|
isOpen: open,
|
|
1447
1454
|
auto: true,
|
|
@@ -1451,7 +1458,7 @@ function Select({
|
|
|
1451
1458
|
triggerOffset: 4,
|
|
1452
1459
|
onOutsideClick: () => setOpen(false)
|
|
1453
1460
|
});
|
|
1454
|
-
const grouped = (0,
|
|
1461
|
+
const grouped = (0, import_react17.useMemo)(() => {
|
|
1455
1462
|
if (!groupedOptions || !options || options.length === 0) {
|
|
1456
1463
|
return options;
|
|
1457
1464
|
}
|
|
@@ -1471,7 +1478,7 @@ function Select({
|
|
|
1471
1478
|
}, []);
|
|
1472
1479
|
}, [groupedOptions, groupedOrder, options]);
|
|
1473
1480
|
const optionsElement = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1474
|
-
|
|
1481
|
+
import_react16.Listbox.Options,
|
|
1475
1482
|
{
|
|
1476
1483
|
ref: listRef,
|
|
1477
1484
|
onScroll: () => {
|
|
@@ -1490,7 +1497,7 @@ function Select({
|
|
|
1490
1497
|
),
|
|
1491
1498
|
children: [
|
|
1492
1499
|
!options || options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1493
|
-
|
|
1500
|
+
import_react16.Listbox.Option,
|
|
1494
1501
|
{
|
|
1495
1502
|
value: null,
|
|
1496
1503
|
disabled: true,
|
|
@@ -1506,7 +1513,7 @@ function Select({
|
|
|
1506
1513
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "text-gray px-3.5 py-1 text-xs font-medium", children: label }),
|
|
1507
1514
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { children: options2.map(
|
|
1508
1515
|
(option, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1509
|
-
|
|
1516
|
+
import_react16.Listbox.Option,
|
|
1510
1517
|
{
|
|
1511
1518
|
value: option.value,
|
|
1512
1519
|
disabled: option.disabled,
|
|
@@ -1558,7 +1565,7 @@ function Select({
|
|
|
1558
1565
|
) })
|
|
1559
1566
|
] }, label);
|
|
1560
1567
|
}) : options.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1561
|
-
|
|
1568
|
+
import_react16.Listbox.Option,
|
|
1562
1569
|
{
|
|
1563
1570
|
value: option.value,
|
|
1564
1571
|
disabled: option.disabled,
|
|
@@ -1605,7 +1612,7 @@ function Select({
|
|
|
1605
1612
|
i
|
|
1606
1613
|
)),
|
|
1607
1614
|
isFetchingMore && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1608
|
-
|
|
1615
|
+
import_react16.Listbox.Option,
|
|
1609
1616
|
{
|
|
1610
1617
|
value: null,
|
|
1611
1618
|
disabled: true,
|
|
@@ -1619,13 +1626,13 @@ function Select({
|
|
|
1619
1626
|
]
|
|
1620
1627
|
}
|
|
1621
1628
|
);
|
|
1622
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react16.Listbox, { value, onChange, disabled, children: ({ open: headlessOpen }) => {
|
|
1623
1630
|
if (headlessOpen !== open && asLayer) {
|
|
1624
1631
|
setOpen(headlessOpen);
|
|
1625
1632
|
}
|
|
1626
1633
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: (0, import_class_variance_authority10.cx)(className, "relative"), ref, children: [
|
|
1627
1634
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
1628
|
-
|
|
1635
|
+
import_react16.Listbox.Button,
|
|
1629
1636
|
{
|
|
1630
1637
|
as: "div",
|
|
1631
1638
|
className: (0, import_class_variance_authority10.cx)(
|
|
@@ -1688,22 +1695,22 @@ function Select({
|
|
|
1688
1695
|
}
|
|
1689
1696
|
|
|
1690
1697
|
// src/common/tree/FlatTree.tsx
|
|
1691
|
-
var
|
|
1698
|
+
var import_react20 = require("react");
|
|
1692
1699
|
|
|
1693
1700
|
// src/common/tree/Tree.tsx
|
|
1694
|
-
var
|
|
1701
|
+
var import_react18 = require("react");
|
|
1695
1702
|
|
|
1696
1703
|
// src/common/tree/TreeIcons.tsx
|
|
1697
1704
|
var import_lu2 = require("react-icons/lu");
|
|
1698
1705
|
|
|
1699
1706
|
// src/common/tree/Tree.tsx
|
|
1700
1707
|
var import_class_variance_authority13 = require("class-variance-authority");
|
|
1701
|
-
var
|
|
1708
|
+
var import_react19 = require("react");
|
|
1702
1709
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1703
1710
|
var Line = () => {
|
|
1704
1711
|
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
1712
|
};
|
|
1706
|
-
var Tree_default = (0,
|
|
1713
|
+
var Tree_default = (0, import_react18.forwardRef)(function Tree({
|
|
1707
1714
|
open: defaultOpen,
|
|
1708
1715
|
content,
|
|
1709
1716
|
children,
|
|
@@ -1719,11 +1726,11 @@ var Tree_default = (0, import_react17.forwardRef)(function Tree({
|
|
|
1719
1726
|
expandIcon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lu2.LuSquarePlus, { className: "h-4 w-4 align-middle" }),
|
|
1720
1727
|
collapseIcon = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lu2.LuSquareMinus, { className: "h-4 w-4 align-middle" })
|
|
1721
1728
|
}, ref) {
|
|
1722
|
-
const [open, setOpen] = (0,
|
|
1723
|
-
(0,
|
|
1729
|
+
const [open, setOpen] = (0, import_react18.useState)(defaultOpen);
|
|
1730
|
+
(0, import_react19.useEffect)(() => {
|
|
1724
1731
|
setOpen(defaultOpen);
|
|
1725
1732
|
}, [defaultOpen]);
|
|
1726
|
-
const toggle = (0,
|
|
1733
|
+
const toggle = (0, import_react18.useCallback)(
|
|
1727
1734
|
(evt) => {
|
|
1728
1735
|
evt.stopPropagation();
|
|
1729
1736
|
if (onOpenClick) {
|
|
@@ -1736,7 +1743,7 @@ var Tree_default = (0, import_react17.forwardRef)(function Tree({
|
|
|
1736
1743
|
},
|
|
1737
1744
|
[open, onOpenClick]
|
|
1738
1745
|
);
|
|
1739
|
-
const lineNodes = (0,
|
|
1746
|
+
const lineNodes = (0, import_react18.useMemo)(() => {
|
|
1740
1747
|
const lines = [];
|
|
1741
1748
|
for (let i = 0; i < depth; i++) {
|
|
1742
1749
|
lines.push(/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Line, {}, i));
|
|
@@ -1791,7 +1798,7 @@ var import_lodash4 = require("lodash");
|
|
|
1791
1798
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1792
1799
|
var SUFFIX_NODE_KEY = "selectedKey_after";
|
|
1793
1800
|
var ROOT_KEY = "root";
|
|
1794
|
-
var TreeContext = (0,
|
|
1801
|
+
var TreeContext = (0, import_react20.createContext)({
|
|
1795
1802
|
expandKeys: [],
|
|
1796
1803
|
onExpand: (key) => {
|
|
1797
1804
|
console.log(key);
|
|
@@ -1804,17 +1811,17 @@ var ControledTree = ({
|
|
|
1804
1811
|
expandIcon,
|
|
1805
1812
|
collapseIcon
|
|
1806
1813
|
}) => {
|
|
1807
|
-
const { expandKeys, onExpand, onClick } = (0,
|
|
1814
|
+
const { expandKeys, onExpand, onClick } = (0, import_react20.useContext)(TreeContext);
|
|
1808
1815
|
let titleNode;
|
|
1809
1816
|
if (typeof item.title === "function") {
|
|
1810
1817
|
titleNode = item.title(item);
|
|
1811
1818
|
} else {
|
|
1812
1819
|
titleNode = item.title;
|
|
1813
1820
|
}
|
|
1814
|
-
const onOpenClick = (0,
|
|
1821
|
+
const onOpenClick = (0, import_react20.useCallback)(() => {
|
|
1815
1822
|
onExpand(item.key);
|
|
1816
1823
|
}, [onExpand, item.key]);
|
|
1817
|
-
const onNodeClick = (0,
|
|
1824
|
+
const onNodeClick = (0, import_react20.useCallback)(() => {
|
|
1818
1825
|
onClick?.(item);
|
|
1819
1826
|
}, [item]);
|
|
1820
1827
|
const isLeaf = item.children === void 0 || item.children?.length === 0;
|
|
@@ -1860,12 +1867,12 @@ var FlatTree = (props) => {
|
|
|
1860
1867
|
scrollIntoView,
|
|
1861
1868
|
isRootKey = checkRootKeyDefault
|
|
1862
1869
|
} = 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,
|
|
1870
|
+
const dataRef = (0, import_react20.useRef)(null);
|
|
1871
|
+
const selectedKeyRef = (0, import_react20.useRef)();
|
|
1872
|
+
const [expandKeys, setExpandKeys] = (0, import_react20.useState)([]);
|
|
1873
|
+
const [selectedKey, setSelectedKey] = (0, import_react20.useState)();
|
|
1874
|
+
const parentRef = (0, import_react20.useRef)(null);
|
|
1875
|
+
(0, import_react20.useEffect)(() => {
|
|
1869
1876
|
if (defaultExpandAll) {
|
|
1870
1877
|
const flatten = (data2) => {
|
|
1871
1878
|
return data2.reduce((acc, cur) => {
|
|
@@ -1882,7 +1889,7 @@ var FlatTree = (props) => {
|
|
|
1882
1889
|
setExpandKeys([]);
|
|
1883
1890
|
}
|
|
1884
1891
|
}, [data, defaultExpandAll]);
|
|
1885
|
-
const flattenData = (0,
|
|
1892
|
+
const flattenData = (0, import_react20.useMemo)(() => {
|
|
1886
1893
|
const expandKeysSet = new Set(expandKeys);
|
|
1887
1894
|
const flatten = (data2, depth = 0) => {
|
|
1888
1895
|
return data2.reduce((acc, cur) => {
|
|
@@ -1895,7 +1902,7 @@ var FlatTree = (props) => {
|
|
|
1895
1902
|
}, []);
|
|
1896
1903
|
};
|
|
1897
1904
|
const list = flatten(data || []);
|
|
1898
|
-
if (selectedKey && (0,
|
|
1905
|
+
if (selectedKey && (0, import_react20.isValidElement)(suffixNode)) {
|
|
1899
1906
|
const index = list.findIndex((item) => item.key === selectedKey);
|
|
1900
1907
|
if (index > -1) {
|
|
1901
1908
|
list.splice(index + 1, 0, {
|
|
@@ -1908,7 +1915,7 @@ var FlatTree = (props) => {
|
|
|
1908
1915
|
return list;
|
|
1909
1916
|
}, [data, expandKeys, selectedKey, suffixNode]);
|
|
1910
1917
|
dataRef.current = flattenData;
|
|
1911
|
-
const estimateSize = (0,
|
|
1918
|
+
const estimateSize = (0, import_react20.useCallback)(
|
|
1912
1919
|
(index) => {
|
|
1913
1920
|
if ((0, import_isNumber.default)(rowHeight)) {
|
|
1914
1921
|
return rowHeight;
|
|
@@ -1923,7 +1930,7 @@ var FlatTree = (props) => {
|
|
|
1923
1930
|
estimateSize,
|
|
1924
1931
|
overscan: 10
|
|
1925
1932
|
});
|
|
1926
|
-
const contextValue = (0,
|
|
1933
|
+
const contextValue = (0, import_react20.useMemo)(() => {
|
|
1927
1934
|
return {
|
|
1928
1935
|
expandKeys,
|
|
1929
1936
|
onExpand: (key) => {
|
|
@@ -1954,7 +1961,7 @@ var FlatTree = (props) => {
|
|
|
1954
1961
|
}
|
|
1955
1962
|
};
|
|
1956
1963
|
}, [expandKeys, onClick]);
|
|
1957
|
-
(0,
|
|
1964
|
+
(0, import_react20.useEffect)(() => {
|
|
1958
1965
|
if (!(0, import_isNumber.default)(expandDepth)) {
|
|
1959
1966
|
return;
|
|
1960
1967
|
}
|
|
@@ -1970,10 +1977,10 @@ var FlatTree = (props) => {
|
|
|
1970
1977
|
};
|
|
1971
1978
|
setExpandKeys(flatten(data || []));
|
|
1972
1979
|
}, [data, expandDepth]);
|
|
1973
|
-
(0,
|
|
1980
|
+
(0, import_react20.useEffect)(() => {
|
|
1974
1981
|
setSelectedKey(void 0);
|
|
1975
1982
|
}, [expandDepth]);
|
|
1976
|
-
(0,
|
|
1983
|
+
(0, import_react20.useEffect)(() => {
|
|
1977
1984
|
if (dataRef.current && scrollToKey) {
|
|
1978
1985
|
const index = dataRef.current.findIndex(
|
|
1979
1986
|
(item) => item.key === scrollToKey
|
|
@@ -1987,8 +1994,8 @@ var FlatTree = (props) => {
|
|
|
1987
1994
|
}
|
|
1988
1995
|
}, [scrollToKey]);
|
|
1989
1996
|
const visibleItems = rowVirtualizer.getVirtualItems();
|
|
1990
|
-
const [isPending, startTransition] = (0,
|
|
1991
|
-
const onScroll = (0,
|
|
1997
|
+
const [isPending, startTransition] = (0, import_react20.useTransition)();
|
|
1998
|
+
const onScroll = (0, import_react20.useMemo)(() => {
|
|
1992
1999
|
if (!scrollIntoView) {
|
|
1993
2000
|
return () => {
|
|
1994
2001
|
};
|
|
@@ -2075,12 +2082,12 @@ var FlatTree = (props) => {
|
|
|
2075
2082
|
item.key || index
|
|
2076
2083
|
)) }) });
|
|
2077
2084
|
};
|
|
2078
|
-
var FlatTree_default = (0,
|
|
2085
|
+
var FlatTree_default = (0, import_react20.memo)(FlatTree);
|
|
2079
2086
|
|
|
2080
2087
|
// src/common/text/LinkifyText.tsx
|
|
2081
2088
|
var import_linkify_urls = require("linkify-urls");
|
|
2082
2089
|
var import_dompurify = __toESM(require("dompurify"));
|
|
2083
|
-
var
|
|
2090
|
+
var import_react21 = require("react");
|
|
2084
2091
|
var import_lodash5 = require("lodash");
|
|
2085
2092
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2086
2093
|
if (import_dompurify.default?.addHook) {
|
|
@@ -2094,7 +2101,7 @@ if (import_dompurify.default?.addHook) {
|
|
|
2094
2101
|
});
|
|
2095
2102
|
}
|
|
2096
2103
|
var renderTextWithColoredNumbers = (text) => {
|
|
2097
|
-
const numberRegex = /\b(\d+(?:\.\d+)?)\b/g;
|
|
2104
|
+
const numberRegex = /\b(\d+(?:\.\d+)?(?:[eE][+-]?\d+)?)\b/g;
|
|
2098
2105
|
return text.replace(numberRegex, (match, number, offset2) => {
|
|
2099
2106
|
const before = text.charAt(offset2 - 1);
|
|
2100
2107
|
const after = text.charAt(offset2 + match.length);
|
|
@@ -2104,7 +2111,7 @@ var renderTextWithColoredNumbers = (text) => {
|
|
|
2104
2111
|
return `<span class="font-mono text-primary-500 dark:text-primary-700">${match}</span>`;
|
|
2105
2112
|
});
|
|
2106
2113
|
};
|
|
2107
|
-
var LinkifyText = (0,
|
|
2114
|
+
var LinkifyText = (0, import_react21.memo)(function LinkifyText2({
|
|
2108
2115
|
text,
|
|
2109
2116
|
className,
|
|
2110
2117
|
isHighlightNumbers
|
|
@@ -2138,24 +2145,24 @@ var LinkifyText = (0, import_react20.memo)(function LinkifyText2({
|
|
|
2138
2145
|
});
|
|
2139
2146
|
|
|
2140
2147
|
// src/common/Empty.tsx
|
|
2141
|
-
var
|
|
2148
|
+
var import_react23 = require("react");
|
|
2142
2149
|
|
|
2143
2150
|
// src/utils/extension-context.ts
|
|
2144
|
-
var
|
|
2145
|
-
var SvgFolderContext = (0,
|
|
2151
|
+
var import_react22 = require("react");
|
|
2152
|
+
var SvgFolderContext = (0, import_react22.createContext)("");
|
|
2146
2153
|
var useDetectExtenstion = () => {
|
|
2147
|
-
const folderPath = (0,
|
|
2154
|
+
const folderPath = (0, import_react22.useContext)(SvgFolderContext);
|
|
2148
2155
|
return Boolean(folderPath);
|
|
2149
2156
|
};
|
|
2150
|
-
var DarkModeContext = (0,
|
|
2157
|
+
var DarkModeContext = (0, import_react22.createContext)(false);
|
|
2151
2158
|
var useDarkMode = () => {
|
|
2152
|
-
return (0,
|
|
2159
|
+
return (0, import_react22.useContext)(DarkModeContext);
|
|
2153
2160
|
};
|
|
2154
2161
|
|
|
2155
2162
|
// src/common/Empty.tsx
|
|
2156
2163
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2157
2164
|
var Empty = (props) => {
|
|
2158
|
-
const parentFolder = (0,
|
|
2165
|
+
const parentFolder = (0, import_react23.useContext)(SvgFolderContext);
|
|
2159
2166
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "mx-auto w-fit", children: [
|
|
2160
2167
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2161
2168
|
"img",
|
|
@@ -2252,21 +2259,21 @@ var HeaderToolsContent = ({
|
|
|
2252
2259
|
};
|
|
2253
2260
|
|
|
2254
2261
|
// src/common/table/ResizeTable.tsx
|
|
2255
|
-
var
|
|
2262
|
+
var import_react31 = require("react");
|
|
2256
2263
|
var import_react_table = require("@tanstack/react-table");
|
|
2257
2264
|
var import_react_virtual2 = require("@tanstack/react-virtual");
|
|
2258
2265
|
var import_hi2 = require("react-icons/hi");
|
|
2259
2266
|
var import_lodash6 = require("lodash");
|
|
2260
2267
|
|
|
2261
2268
|
// src/common/menu/PopupMenuButton.tsx
|
|
2262
|
-
var
|
|
2263
|
-
var
|
|
2264
|
-
var
|
|
2269
|
+
var import_react28 = require("react");
|
|
2270
|
+
var import_react29 = require("@headlessui/react");
|
|
2271
|
+
var import_react30 = require("@floating-ui/react");
|
|
2265
2272
|
|
|
2266
2273
|
// src/common/menu/SubMenu.tsx
|
|
2267
|
-
var
|
|
2268
|
-
var
|
|
2269
|
-
var
|
|
2274
|
+
var import_react24 = require("react");
|
|
2275
|
+
var import_react25 = require("@floating-ui/react");
|
|
2276
|
+
var import_react26 = require("@headlessui/react");
|
|
2270
2277
|
var import_hi = require("react-icons/hi");
|
|
2271
2278
|
var import_solid4 = require("@heroicons/react/20/solid");
|
|
2272
2279
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
@@ -2282,10 +2289,10 @@ var COLOR_MAP = {
|
|
|
2282
2289
|
disabled: "text-red-200 dark:text-red-600/40 cursor-not-allowed"
|
|
2283
2290
|
}
|
|
2284
2291
|
};
|
|
2285
|
-
var MenuContext = (0,
|
|
2292
|
+
var MenuContext = (0, import_react24.createContext)({});
|
|
2286
2293
|
var MenuItem = ({ item, onSelect, labelClassName }) => {
|
|
2287
|
-
const { selectedKey } = (0,
|
|
2288
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2294
|
+
const { selectedKey } = (0, import_react24.useContext)(MenuContext);
|
|
2295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react26.Menu.Item, { disabled: item.disabled, children: ({ active }) => {
|
|
2289
2296
|
if (item.items) {
|
|
2290
2297
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2291
2298
|
SubMenuButton,
|
|
@@ -2349,21 +2356,21 @@ var SubMenuButton = (props) => {
|
|
|
2349
2356
|
placement = "right-start",
|
|
2350
2357
|
buttonClass: buttonClass3
|
|
2351
2358
|
} = props;
|
|
2352
|
-
const [open, setOpen] = (0,
|
|
2353
|
-
const { refs, floatingStyles, context } = (0,
|
|
2359
|
+
const [open, setOpen] = (0, import_react24.useState)(false);
|
|
2360
|
+
const { refs, floatingStyles, context } = (0, import_react25.useFloating)({
|
|
2354
2361
|
open,
|
|
2355
2362
|
onOpenChange: setOpen,
|
|
2356
2363
|
placement,
|
|
2357
|
-
whileElementsMounted:
|
|
2358
|
-
middleware: [(0,
|
|
2364
|
+
whileElementsMounted: import_react25.autoUpdate,
|
|
2365
|
+
middleware: [(0, import_react25.flip)(), (0, import_react25.shift)()]
|
|
2359
2366
|
});
|
|
2360
|
-
const { getReferenceProps, getFloatingProps } = (0,
|
|
2361
|
-
(0,
|
|
2362
|
-
handleClose: (0,
|
|
2367
|
+
const { getReferenceProps, getFloatingProps } = (0, import_react25.useInteractions)([
|
|
2368
|
+
(0, import_react25.useHover)(context, {
|
|
2369
|
+
handleClose: (0, import_react25.safePolygon)()
|
|
2363
2370
|
})
|
|
2364
2371
|
]);
|
|
2365
2372
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2366
|
-
|
|
2373
|
+
import_react26.Menu,
|
|
2367
2374
|
{
|
|
2368
2375
|
as: "div",
|
|
2369
2376
|
className: (0, import_class_variance_authority10.cx)(
|
|
@@ -2373,7 +2380,7 @@ var SubMenuButton = (props) => {
|
|
|
2373
2380
|
),
|
|
2374
2381
|
children: [
|
|
2375
2382
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2376
|
-
|
|
2383
|
+
import_react26.Menu.Button,
|
|
2377
2384
|
{
|
|
2378
2385
|
className: (0, import_class_variance_authority10.cx)(
|
|
2379
2386
|
active || open ? COLOR_MAP[status || "default"].active : COLOR_MAP[status || "default"].default,
|
|
@@ -2404,7 +2411,7 @@ var SubMenuButton = (props) => {
|
|
|
2404
2411
|
}
|
|
2405
2412
|
),
|
|
2406
2413
|
open && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2407
|
-
|
|
2414
|
+
import_react26.Menu.Items,
|
|
2408
2415
|
{
|
|
2409
2416
|
static: true,
|
|
2410
2417
|
ref: refs.setFloating,
|
|
@@ -2430,8 +2437,8 @@ var SubMenuButton = (props) => {
|
|
|
2430
2437
|
};
|
|
2431
2438
|
|
|
2432
2439
|
// src/utils/nav-size-context.ts
|
|
2433
|
-
var
|
|
2434
|
-
var NavSizeContext = (0,
|
|
2440
|
+
var import_react27 = require("react");
|
|
2441
|
+
var NavSizeContext = (0, import_react27.createContext)({
|
|
2435
2442
|
small: true,
|
|
2436
2443
|
showLabel: true,
|
|
2437
2444
|
setSmall: (small) => {
|
|
@@ -2461,33 +2468,33 @@ function PopupMenuButton({
|
|
|
2461
2468
|
selectedKey,
|
|
2462
2469
|
onOpenCallback
|
|
2463
2470
|
}) {
|
|
2464
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
2465
|
-
const { small } = (0,
|
|
2466
|
-
const { refs, floatingStyles, context } = (0,
|
|
2471
|
+
const [menuOpen, setMenuOpen] = (0, import_react28.useState)(false);
|
|
2472
|
+
const { small } = (0, import_react28.useContext)(NavSizeContext);
|
|
2473
|
+
const { refs, floatingStyles, context } = (0, import_react30.useFloating)({
|
|
2467
2474
|
open: menuOpen,
|
|
2468
2475
|
onOpenChange: setMenuOpen,
|
|
2469
|
-
middleware: [(0,
|
|
2476
|
+
middleware: [(0, import_react30.offset)(offset2), (0, import_react30.flip)(), (0, import_react30.shift)()],
|
|
2470
2477
|
placement,
|
|
2471
|
-
whileElementsMounted:
|
|
2478
|
+
whileElementsMounted: import_react30.autoUpdate
|
|
2472
2479
|
});
|
|
2473
|
-
const itemStyle = (0,
|
|
2480
|
+
const itemStyle = (0, import_react28.useMemo)(() => {
|
|
2474
2481
|
return {
|
|
2475
2482
|
width
|
|
2476
2483
|
};
|
|
2477
2484
|
}, [width]);
|
|
2478
|
-
const onOpenCallbackRef = (0,
|
|
2485
|
+
const onOpenCallbackRef = (0, import_react28.useRef)(onOpenCallback);
|
|
2479
2486
|
onOpenCallbackRef.current = onOpenCallback;
|
|
2480
|
-
(0,
|
|
2487
|
+
(0, import_react28.useEffect)(() => {
|
|
2481
2488
|
if (menuOpen) {
|
|
2482
2489
|
onOpenCallbackRef.current?.();
|
|
2483
2490
|
}
|
|
2484
2491
|
}, [menuOpen]);
|
|
2485
2492
|
let menuItems = null;
|
|
2486
2493
|
if (menuOpen && items.length > 0) {
|
|
2487
|
-
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
|
-
|
|
2494
|
+
menuItems = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MenuContext.Provider, { value: { selectedKey }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ref: refs.setFloating, style: floatingStyles, className: small ? "z-10" : "z-[100]", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2495
|
+
import_react29.Transition,
|
|
2489
2496
|
{
|
|
2490
|
-
as:
|
|
2497
|
+
as: import_react28.Fragment,
|
|
2491
2498
|
enter: "transition ease-out duration-100",
|
|
2492
2499
|
enterFrom: "transform opacity-0 scale-95",
|
|
2493
2500
|
enterTo: "transform opacity-100 scale-100",
|
|
@@ -2495,7 +2502,7 @@ function PopupMenuButton({
|
|
|
2495
2502
|
leaveFrom: "transform opacity-100 scale-100",
|
|
2496
2503
|
leaveTo: "transform opacity-0 scale-95",
|
|
2497
2504
|
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2498
|
-
|
|
2505
|
+
import_react29.Menu.Items,
|
|
2499
2506
|
{
|
|
2500
2507
|
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
2508
|
style: itemStyle,
|
|
@@ -2522,13 +2529,13 @@ function PopupMenuButton({
|
|
|
2522
2529
|
}
|
|
2523
2530
|
) }) });
|
|
2524
2531
|
}
|
|
2525
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react29.Menu, { children: ({ open }) => {
|
|
2526
2533
|
setTimeout(() => {
|
|
2527
2534
|
setMenuOpen(open);
|
|
2528
2535
|
}, 0);
|
|
2529
2536
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2530
2537
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2531
|
-
|
|
2538
|
+
import_react29.Menu.Button,
|
|
2532
2539
|
{
|
|
2533
2540
|
className: (0, import_class_variance_authority10.cx)(
|
|
2534
2541
|
"text-gray w-fit px-1 hover:text-gray-500 active:text-gray-700",
|
|
@@ -2540,7 +2547,7 @@ function PopupMenuButton({
|
|
|
2540
2547
|
children: typeof buttonIcon === "function" ? buttonIcon(menuOpen) : buttonIcon
|
|
2541
2548
|
}
|
|
2542
2549
|
),
|
|
2543
|
-
portal ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2550
|
+
portal ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react30.FloatingPortal, { children: menuItems }) : menuItems
|
|
2544
2551
|
] });
|
|
2545
2552
|
} });
|
|
2546
2553
|
}
|
|
@@ -2771,7 +2778,7 @@ var reorder = (list, startIndex, endIndex) => {
|
|
|
2771
2778
|
function onPreventClick(e) {
|
|
2772
2779
|
e.stopPropagation();
|
|
2773
2780
|
}
|
|
2774
|
-
var _ResizeTable = (0,
|
|
2781
|
+
var _ResizeTable = (0, import_react31.forwardRef)(function _ResizeTable2({
|
|
2775
2782
|
data,
|
|
2776
2783
|
columns,
|
|
2777
2784
|
columnResizeMode,
|
|
@@ -2795,7 +2802,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2795
2802
|
estimatedRowHeight = 35,
|
|
2796
2803
|
overscan = 5
|
|
2797
2804
|
}, tableContainerRef) {
|
|
2798
|
-
const adjustedColumns = (0,
|
|
2805
|
+
const adjustedColumns = (0, import_react31.useMemo)(() => {
|
|
2799
2806
|
let totalWidth = 0;
|
|
2800
2807
|
const newColumns = columns.map((c) => {
|
|
2801
2808
|
const item = Object.assign({ minSize }, c);
|
|
@@ -2814,7 +2821,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2814
2821
|
}
|
|
2815
2822
|
return newColumns;
|
|
2816
2823
|
}, [columns, minSize, minWidth]);
|
|
2817
|
-
const [tableState, setTableState] = (0,
|
|
2824
|
+
const [tableState, setTableState] = (0, import_react31.useState)(() => {
|
|
2818
2825
|
const initialState = {
|
|
2819
2826
|
pagination: {
|
|
2820
2827
|
pageIndex: 0,
|
|
@@ -2834,7 +2841,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2834
2841
|
onStateChange: setTableState,
|
|
2835
2842
|
manualSorting
|
|
2836
2843
|
});
|
|
2837
|
-
(0,
|
|
2844
|
+
(0, import_react31.useEffect)(() => {
|
|
2838
2845
|
if (state && Object.keys(state).length > 0) {
|
|
2839
2846
|
setTableState((prev) => {
|
|
2840
2847
|
const newState = {
|
|
@@ -2846,14 +2853,14 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2846
2853
|
});
|
|
2847
2854
|
}
|
|
2848
2855
|
}, [state]);
|
|
2849
|
-
const debounceStateChange = (0,
|
|
2856
|
+
const debounceStateChange = (0, import_react31.useMemo)(() => {
|
|
2850
2857
|
if (!onStateChange) return void 0;
|
|
2851
2858
|
return (0, import_lodash6.debounce)(onStateChange, 500, {});
|
|
2852
2859
|
}, [onStateChange]);
|
|
2853
|
-
(0,
|
|
2860
|
+
(0, import_react31.useEffect)(() => {
|
|
2854
2861
|
debounceStateChange?.(tableState);
|
|
2855
2862
|
}, [debounceStateChange, tableState]);
|
|
2856
|
-
const fetchMoreOnBottomReached = (0,
|
|
2863
|
+
const fetchMoreOnBottomReached = (0, import_react31.useMemo)(() => {
|
|
2857
2864
|
return (0, import_lodash6.debounce)((containerRefElement) => {
|
|
2858
2865
|
if (containerRefElement) {
|
|
2859
2866
|
const { scrollHeight, scrollTop, clientHeight } = containerRefElement;
|
|
@@ -2863,8 +2870,8 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2863
2870
|
}
|
|
2864
2871
|
}, 500);
|
|
2865
2872
|
}, [onFetchMore, isFetching, hasMore]);
|
|
2866
|
-
const tableContainerElementRef = (0,
|
|
2867
|
-
(0,
|
|
2873
|
+
const tableContainerElementRef = (0, import_react31.useRef)(null);
|
|
2874
|
+
(0, import_react31.useEffect)(() => {
|
|
2868
2875
|
if (tableContainerRef) {
|
|
2869
2876
|
if (typeof tableContainerRef === "function") {
|
|
2870
2877
|
tableContainerRef(tableContainerElementRef.current);
|
|
@@ -2876,7 +2883,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
2876
2883
|
const rowVirtualizer = (0, import_react_virtual2.useVirtualizer)({
|
|
2877
2884
|
count: enableVirtualization ? table.getRowModel().rows.length : 0,
|
|
2878
2885
|
getScrollElement: () => tableContainerElementRef.current,
|
|
2879
|
-
estimateSize: (0,
|
|
2886
|
+
estimateSize: (0, import_react31.useCallback)(() => estimatedRowHeight, [estimatedRowHeight]),
|
|
2880
2887
|
overscan,
|
|
2881
2888
|
enabled: enableVirtualization
|
|
2882
2889
|
});
|
|
@@ -3118,7 +3125,7 @@ var _ResizeTable = (0, import_react30.forwardRef)(function _ResizeTable2({
|
|
|
3118
3125
|
}
|
|
3119
3126
|
);
|
|
3120
3127
|
});
|
|
3121
|
-
var ResizeTable = (0,
|
|
3128
|
+
var ResizeTable = (0, import_react31.memo)(_ResizeTable);
|
|
3122
3129
|
|
|
3123
3130
|
// src/utils/number-format.ts
|
|
3124
3131
|
var import_bigdecimal = __toESM(require("@sentio/bigdecimal"));
|
|
@@ -3145,10 +3152,10 @@ function getNumberWithDecimal(hex, decimal, asNumber) {
|
|
|
3145
3152
|
}
|
|
3146
3153
|
|
|
3147
3154
|
// src/utils/use-mobile.ts
|
|
3148
|
-
var
|
|
3155
|
+
var import_react32 = require("react");
|
|
3149
3156
|
function useMobile(breakpoint = 768, defaultValue = false) {
|
|
3150
|
-
const [isMobile, setIsMobile] = (0,
|
|
3151
|
-
(0,
|
|
3157
|
+
const [isMobile, setIsMobile] = (0, import_react32.useState)(defaultValue);
|
|
3158
|
+
(0, import_react32.useEffect)(() => {
|
|
3152
3159
|
const checkUserAgent = () => {
|
|
3153
3160
|
if (typeof window === "undefined") return false;
|
|
3154
3161
|
const userAgent = window.navigator.userAgent.toLowerCase();
|