@underverse-ui/underverse 2.0.24 → 2.0.25
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/api-reference.json +23 -2
- package/dist/{chunk-ZQWVWDGS.js → chunk-FFVBGTHU.js} +2 -2
- package/dist/{chunk-O7AAN6W6.js → chunk-OJF3XRN7.js} +18 -5
- package/dist/chunk-OJF3XRN7.js.map +1 -0
- package/dist/{chunk-HGOTCQXL.js → chunk-XMAOZQJO.js} +3 -3
- package/dist/index.cjs +160 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -10
- package/dist/index.d.ts +46 -10
- package/dist/index.js +146 -86
- package/dist/index.js.map +1 -1
- package/dist/{menu-bar-E7MNW6UC.js → menu-bar-4FM4Y273.js} +3 -3
- package/dist/ueditor.cjs +5 -2
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.js +2 -2
- package/package.json +2 -1
- package/dist/chunk-O7AAN6W6.js.map +0 -1
- /package/dist/{chunk-ZQWVWDGS.js.map → chunk-FFVBGTHU.js.map} +0 -0
- /package/dist/{chunk-HGOTCQXL.js.map → chunk-XMAOZQJO.js.map} +0 -0
- /package/dist/{menu-bar-E7MNW6UC.js.map → menu-bar-4FM4Y273.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
extractImageSrcsFromHtml,
|
|
5
5
|
normalizeImageUrl,
|
|
6
6
|
prepareUEditorContentForSave
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XMAOZQJO.js";
|
|
8
8
|
import {
|
|
9
9
|
EmojiPicker_default
|
|
10
10
|
} from "./chunk-F7MX3XXK.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
import "./chunk-4TYW5K4J.js";
|
|
17
17
|
import {
|
|
18
18
|
Modal_default
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-FFVBGTHU.js";
|
|
20
20
|
import {
|
|
21
21
|
DropdownMenuItem,
|
|
22
22
|
DropdownMenuSeparator,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
shadcnAnimationStyles,
|
|
32
32
|
useShadCNAnimations,
|
|
33
33
|
useUnderverseUIConfig
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-OJF3XRN7.js";
|
|
35
35
|
import {
|
|
36
36
|
ForceInternalTranslationsProvider,
|
|
37
37
|
NextIntlAdapter,
|
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
getUnderverseDefaultTranslation,
|
|
50
50
|
ja_default,
|
|
51
51
|
ko_default,
|
|
52
|
+
resolveUEditorPortalContainer,
|
|
52
53
|
useGlobalI18n,
|
|
53
54
|
useHydrated,
|
|
54
55
|
useNextIntlBridge,
|
|
@@ -3671,6 +3672,9 @@ import * as React15 from "react";
|
|
|
3671
3672
|
import { createPortal } from "react-dom";
|
|
3672
3673
|
import { X as X6 } from "lucide-react";
|
|
3673
3674
|
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3675
|
+
function setDocumentBodyStyles(ownerDocument, styles) {
|
|
3676
|
+
Object.assign(ownerDocument.body.style, styles);
|
|
3677
|
+
}
|
|
3674
3678
|
var sizeStyles3 = {
|
|
3675
3679
|
sm: {
|
|
3676
3680
|
right: "w-75",
|
|
@@ -3750,7 +3754,8 @@ var Sheet = ({
|
|
|
3750
3754
|
resizable = false,
|
|
3751
3755
|
minSize = 280,
|
|
3752
3756
|
maxSize,
|
|
3753
|
-
onResize
|
|
3757
|
+
onResize,
|
|
3758
|
+
getPortalContainer
|
|
3754
3759
|
}) => {
|
|
3755
3760
|
const gi18n = useGlobalI18n();
|
|
3756
3761
|
const [mounted, setMounted] = React15.useState(false);
|
|
@@ -3760,6 +3765,7 @@ var Sheet = ({
|
|
|
3760
3765
|
const [sheetSize, setSheetSize] = React15.useState(null);
|
|
3761
3766
|
const sheetRef = React15.useRef(null);
|
|
3762
3767
|
const resizeStateRef = React15.useRef(null);
|
|
3768
|
+
const portalContainer = mounted ? resolveUEditorPortalContainer(getPortalContainer) : null;
|
|
3763
3769
|
const isHorizontalSheet = side === "left" || side === "right";
|
|
3764
3770
|
const canResize = resizable && size !== "full";
|
|
3765
3771
|
React15.useEffect(() => {
|
|
@@ -3767,31 +3773,33 @@ var Sheet = ({
|
|
|
3767
3773
|
}, []);
|
|
3768
3774
|
React15.useEffect(() => {
|
|
3769
3775
|
if (!closeOnEscape) return;
|
|
3776
|
+
const portalDocument = portalContainer?.ownerDocument;
|
|
3770
3777
|
const handleEscape = (e) => {
|
|
3771
3778
|
if (e.key === "Escape" && open) {
|
|
3772
3779
|
onOpenChange(false);
|
|
3773
3780
|
}
|
|
3774
3781
|
};
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3782
|
+
if (!portalDocument) return;
|
|
3783
|
+
portalDocument.addEventListener("keydown", handleEscape);
|
|
3784
|
+
return () => portalDocument.removeEventListener("keydown", handleEscape);
|
|
3785
|
+
}, [open, closeOnEscape, onOpenChange, portalContainer]);
|
|
3778
3786
|
React15.useEffect(() => {
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
}
|
|
3787
|
+
const portalDocument = portalContainer?.ownerDocument;
|
|
3788
|
+
if (!portalDocument || !open) return;
|
|
3789
|
+
const body = portalDocument.body;
|
|
3790
|
+
const previousOverflow = body.style.overflow;
|
|
3791
|
+
setDocumentBodyStyles(portalDocument, { overflow: "hidden" });
|
|
3784
3792
|
return () => {
|
|
3785
|
-
|
|
3793
|
+
setDocumentBodyStyles(portalDocument, { overflow: previousOverflow });
|
|
3786
3794
|
};
|
|
3787
|
-
}, [open]);
|
|
3795
|
+
}, [open, portalContainer]);
|
|
3788
3796
|
React15.useEffect(() => {
|
|
3797
|
+
const portalWindow = portalContainer?.ownerDocument.defaultView;
|
|
3789
3798
|
if (open) {
|
|
3790
3799
|
setIsVisible(true);
|
|
3791
3800
|
setIsAnimating(true);
|
|
3792
|
-
requestAnimationFrame(() =>
|
|
3793
|
-
|
|
3794
|
-
});
|
|
3801
|
+
if (portalWindow) portalWindow.requestAnimationFrame(() => setIsAnimating(false));
|
|
3802
|
+
else setIsAnimating(false);
|
|
3795
3803
|
} else if (isVisible) {
|
|
3796
3804
|
setIsAnimating(true);
|
|
3797
3805
|
const hideTimer = setTimeout(() => {
|
|
@@ -3799,7 +3807,7 @@ var Sheet = ({
|
|
|
3799
3807
|
}, 300);
|
|
3800
3808
|
return () => clearTimeout(hideTimer);
|
|
3801
3809
|
}
|
|
3802
|
-
}, [open, isVisible]);
|
|
3810
|
+
}, [open, isVisible, portalContainer]);
|
|
3803
3811
|
const handleOverlayClick = (e) => {
|
|
3804
3812
|
if (closeOnOutsideClick && e.target === e.currentTarget) {
|
|
3805
3813
|
onOpenChange(false);
|
|
@@ -3809,7 +3817,8 @@ var Sheet = ({
|
|
|
3809
3817
|
onOpenChange(false);
|
|
3810
3818
|
};
|
|
3811
3819
|
const clampResizeSize = React15.useCallback((nextSize) => {
|
|
3812
|
-
const
|
|
3820
|
+
const portalWindow = sheetRef.current?.ownerDocument.defaultView;
|
|
3821
|
+
const viewportSize = portalWindow ? isHorizontalSheet ? portalWindow.innerWidth : portalWindow.innerHeight : nextSize;
|
|
3813
3822
|
const resolvedMaxSize = maxSize ?? Math.round(viewportSize * 0.9);
|
|
3814
3823
|
return Math.min(Math.max(nextSize, minSize), resolvedMaxSize);
|
|
3815
3824
|
}, [isHorizontalSheet, maxSize, minSize]);
|
|
@@ -3817,8 +3826,10 @@ var Sheet = ({
|
|
|
3817
3826
|
if (!resizeStateRef.current) return;
|
|
3818
3827
|
resizeStateRef.current = null;
|
|
3819
3828
|
setIsResizing(false);
|
|
3820
|
-
|
|
3821
|
-
|
|
3829
|
+
const portalDocument = sheetRef.current?.ownerDocument;
|
|
3830
|
+
if (portalDocument) {
|
|
3831
|
+
setDocumentBodyStyles(portalDocument, { cursor: "", userSelect: "" });
|
|
3832
|
+
}
|
|
3822
3833
|
}, []);
|
|
3823
3834
|
const handleResizePointerMove = React15.useCallback((event) => {
|
|
3824
3835
|
const resizeState = resizeStateRef.current;
|
|
@@ -3835,13 +3846,15 @@ var Sheet = ({
|
|
|
3835
3846
|
}, [endResize]);
|
|
3836
3847
|
React15.useEffect(() => {
|
|
3837
3848
|
if (!isResizing) return void 0;
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3849
|
+
const portalWindow = sheetRef.current?.ownerDocument.defaultView;
|
|
3850
|
+
if (!portalWindow) return;
|
|
3851
|
+
portalWindow.addEventListener("pointermove", handleResizePointerMove);
|
|
3852
|
+
portalWindow.addEventListener("pointerup", handleResizePointerUp);
|
|
3853
|
+
portalWindow.addEventListener("pointercancel", handleResizePointerUp);
|
|
3841
3854
|
return () => {
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3855
|
+
portalWindow.removeEventListener("pointermove", handleResizePointerMove);
|
|
3856
|
+
portalWindow.removeEventListener("pointerup", handleResizePointerUp);
|
|
3857
|
+
portalWindow.removeEventListener("pointercancel", handleResizePointerUp);
|
|
3845
3858
|
};
|
|
3846
3859
|
}, [handleResizePointerMove, handleResizePointerUp, isResizing]);
|
|
3847
3860
|
React15.useEffect(() => {
|
|
@@ -3860,8 +3873,13 @@ var Sheet = ({
|
|
|
3860
3873
|
};
|
|
3861
3874
|
setIsResizing(true);
|
|
3862
3875
|
event.currentTarget.setPointerCapture(event.pointerId);
|
|
3863
|
-
|
|
3864
|
-
|
|
3876
|
+
const portalDocument = event.currentTarget.ownerDocument;
|
|
3877
|
+
if (portalDocument) {
|
|
3878
|
+
setDocumentBodyStyles(portalDocument, {
|
|
3879
|
+
cursor: isHorizontalSheet ? "col-resize" : "row-resize",
|
|
3880
|
+
userSelect: "none"
|
|
3881
|
+
});
|
|
3882
|
+
}
|
|
3865
3883
|
event.preventDefault();
|
|
3866
3884
|
event.stopPropagation();
|
|
3867
3885
|
};
|
|
@@ -3948,7 +3966,7 @@ var Sheet = ({
|
|
|
3948
3966
|
}
|
|
3949
3967
|
)
|
|
3950
3968
|
] });
|
|
3951
|
-
return
|
|
3969
|
+
return portalContainer ? createPortal(sheetContent, portalContainer) : null;
|
|
3952
3970
|
};
|
|
3953
3971
|
var Drawer = ({ placement = "right", ...props }) => {
|
|
3954
3972
|
return /* @__PURE__ */ jsx17(Sheet, { ...props, side: placement, variant: "overlay" });
|
|
@@ -5985,7 +6003,8 @@ var DatePicker = ({
|
|
|
5985
6003
|
disablePastDates = false,
|
|
5986
6004
|
minDate,
|
|
5987
6005
|
maxDate,
|
|
5988
|
-
borderMode
|
|
6006
|
+
borderMode,
|
|
6007
|
+
getPortalContainer
|
|
5989
6008
|
}) => {
|
|
5990
6009
|
const size = requestedSize === "xs" ? "sm" : requestedSize === "xl" ? "lg" : requestedSize;
|
|
5991
6010
|
const t = useSmartTranslations("DatePicker");
|
|
@@ -6476,6 +6495,7 @@ var DatePicker = ({
|
|
|
6476
6495
|
/* @__PURE__ */ jsx27(
|
|
6477
6496
|
Popover,
|
|
6478
6497
|
{
|
|
6498
|
+
getPortalContainer,
|
|
6479
6499
|
open: isOpen,
|
|
6480
6500
|
onOpenChange: setIsOpen,
|
|
6481
6501
|
contentProps: { id: panelId },
|
|
@@ -6618,7 +6638,8 @@ var DateRangePicker = ({
|
|
|
6618
6638
|
maxDate,
|
|
6619
6639
|
size: requestedSize = "md",
|
|
6620
6640
|
disabled = false,
|
|
6621
|
-
borderMode
|
|
6641
|
+
borderMode,
|
|
6642
|
+
getPortalContainer
|
|
6622
6643
|
}) => {
|
|
6623
6644
|
const size = requestedSize === "xs" ? "sm" : requestedSize === "xl" ? "lg" : requestedSize;
|
|
6624
6645
|
const locale = useSmartLocale();
|
|
@@ -7237,6 +7258,7 @@ var DateRangePicker = ({
|
|
|
7237
7258
|
/* @__PURE__ */ jsx27(
|
|
7238
7259
|
Popover,
|
|
7239
7260
|
{
|
|
7261
|
+
getPortalContainer,
|
|
7240
7262
|
open: isOpen,
|
|
7241
7263
|
onOpenChange: setIsOpen,
|
|
7242
7264
|
contentProps: { id: panelId },
|
|
@@ -7325,7 +7347,7 @@ var DateRangePicker = ({
|
|
|
7325
7347
|
effectiveError && /* @__PURE__ */ jsx27("div", { className: "text-xs text-destructive", children: effectiveError })
|
|
7326
7348
|
] });
|
|
7327
7349
|
};
|
|
7328
|
-
var CompactDatePicker = ({ value, onChange, className }) => {
|
|
7350
|
+
var CompactDatePicker = ({ value, onChange, className, getPortalContainer }) => {
|
|
7329
7351
|
return /* @__PURE__ */ jsx27(
|
|
7330
7352
|
DatePicker,
|
|
7331
7353
|
{
|
|
@@ -7333,7 +7355,8 @@ var CompactDatePicker = ({ value, onChange, className }) => {
|
|
|
7333
7355
|
onChange,
|
|
7334
7356
|
size: "sm",
|
|
7335
7357
|
className: cn("max-w-56", className),
|
|
7336
|
-
placeholder: "Date"
|
|
7358
|
+
placeholder: "Date",
|
|
7359
|
+
getPortalContainer
|
|
7337
7360
|
}
|
|
7338
7361
|
);
|
|
7339
7362
|
};
|
|
@@ -7648,7 +7671,8 @@ var LunarDatePicker = ({
|
|
|
7648
7671
|
disablePastDates = false,
|
|
7649
7672
|
minDate,
|
|
7650
7673
|
maxDate,
|
|
7651
|
-
borderMode
|
|
7674
|
+
borderMode,
|
|
7675
|
+
getPortalContainer
|
|
7652
7676
|
}) => {
|
|
7653
7677
|
const size = requestedSize === "xs" ? "sm" : requestedSize === "xl" ? "lg" : requestedSize;
|
|
7654
7678
|
const globalConfig = useUnderverseUIConfig();
|
|
@@ -8177,6 +8201,7 @@ var LunarDatePicker = ({
|
|
|
8177
8201
|
/* @__PURE__ */ jsx28(
|
|
8178
8202
|
Popover,
|
|
8179
8203
|
{
|
|
8204
|
+
getPortalContainer,
|
|
8180
8205
|
open: isOpen,
|
|
8181
8206
|
onOpenChange: setIsOpen,
|
|
8182
8207
|
contentProps: { id: panelId },
|
|
@@ -8325,7 +8350,8 @@ var LunarDateRangePicker = ({
|
|
|
8325
8350
|
maxDate,
|
|
8326
8351
|
size: requestedSize = "md",
|
|
8327
8352
|
disabled = false,
|
|
8328
|
-
borderMode
|
|
8353
|
+
borderMode,
|
|
8354
|
+
getPortalContainer
|
|
8329
8355
|
}) => {
|
|
8330
8356
|
const size = requestedSize === "xs" ? "sm" : requestedSize === "xl" ? "lg" : requestedSize;
|
|
8331
8357
|
const locale = useSmartLocale();
|
|
@@ -8808,6 +8834,7 @@ var LunarDateRangePicker = ({
|
|
|
8808
8834
|
/* @__PURE__ */ jsxs21(
|
|
8809
8835
|
Popover,
|
|
8810
8836
|
{
|
|
8837
|
+
getPortalContainer,
|
|
8811
8838
|
open: isOpen,
|
|
8812
8839
|
onOpenChange: setIsOpen,
|
|
8813
8840
|
contentProps: { id: panelId },
|
|
@@ -9361,6 +9388,7 @@ function MonthYearPicker({
|
|
|
9361
9388
|
columnLabels = { month: "Month", year: "Year" },
|
|
9362
9389
|
className,
|
|
9363
9390
|
borderMode,
|
|
9391
|
+
getPortalContainer,
|
|
9364
9392
|
...rest
|
|
9365
9393
|
}) {
|
|
9366
9394
|
const size = requestedSize === "xs" ? "sm" : requestedSize === "xl" ? "lg" : requestedSize;
|
|
@@ -9746,6 +9774,7 @@ function MonthYearPicker({
|
|
|
9746
9774
|
/* @__PURE__ */ jsx29(
|
|
9747
9775
|
Popover,
|
|
9748
9776
|
{
|
|
9777
|
+
getPortalContainer,
|
|
9749
9778
|
trigger,
|
|
9750
9779
|
open,
|
|
9751
9780
|
onOpenChange: handleOpenChange,
|
|
@@ -10898,6 +10927,7 @@ function TimePicker({
|
|
|
10898
10927
|
onClose,
|
|
10899
10928
|
className,
|
|
10900
10929
|
borderMode,
|
|
10930
|
+
getPortalContainer,
|
|
10901
10931
|
...rest
|
|
10902
10932
|
}) {
|
|
10903
10933
|
const size = requestedSize === "xs" ? "sm" : requestedSize === "xl" ? "lg" : requestedSize;
|
|
@@ -11678,6 +11708,7 @@ function TimePicker({
|
|
|
11678
11708
|
/* @__PURE__ */ jsx31(
|
|
11679
11709
|
Popover,
|
|
11680
11710
|
{
|
|
11711
|
+
getPortalContainer,
|
|
11681
11712
|
trigger,
|
|
11682
11713
|
open,
|
|
11683
11714
|
onOpenChange: handleOpenChange,
|
|
@@ -11730,7 +11761,8 @@ var DateTimePicker = ({
|
|
|
11730
11761
|
doneLabel,
|
|
11731
11762
|
clearLabel,
|
|
11732
11763
|
size: requestedSize = "md",
|
|
11733
|
-
borderMode
|
|
11764
|
+
borderMode,
|
|
11765
|
+
getPortalContainer
|
|
11734
11766
|
}) => {
|
|
11735
11767
|
const size = requestedSize === "xs" ? "sm" : requestedSize === "xl" ? "lg" : requestedSize;
|
|
11736
11768
|
const globalConfig = useUnderverseUIConfig();
|
|
@@ -11922,6 +11954,7 @@ var DateTimePicker = ({
|
|
|
11922
11954
|
/* @__PURE__ */ jsxs25(
|
|
11923
11955
|
Popover,
|
|
11924
11956
|
{
|
|
11957
|
+
getPortalContainer,
|
|
11925
11958
|
open,
|
|
11926
11959
|
onOpenChange: setOpen,
|
|
11927
11960
|
contentProps: { id: panelId },
|
|
@@ -12637,6 +12670,7 @@ function CalendarTimelineHeader(props) {
|
|
|
12637
12670
|
sizeConfig,
|
|
12638
12671
|
navigate,
|
|
12639
12672
|
now,
|
|
12673
|
+
getPortalContainer,
|
|
12640
12674
|
onApplyDateTime,
|
|
12641
12675
|
setView,
|
|
12642
12676
|
effectiveResourceColumnWidth,
|
|
@@ -12728,6 +12762,7 @@ function CalendarTimelineHeader(props) {
|
|
|
12728
12762
|
/* @__PURE__ */ jsx34(
|
|
12729
12763
|
Popover,
|
|
12730
12764
|
{
|
|
12765
|
+
getPortalContainer,
|
|
12731
12766
|
open: todayOpen,
|
|
12732
12767
|
onOpenChange: setTodayOpen,
|
|
12733
12768
|
placement: "bottom-start",
|
|
@@ -12778,6 +12813,7 @@ function CalendarTimelineHeader(props) {
|
|
|
12778
12813
|
/* @__PURE__ */ jsx34(
|
|
12779
12814
|
TimePicker,
|
|
12780
12815
|
{
|
|
12816
|
+
getPortalContainer,
|
|
12781
12817
|
variant: "inline",
|
|
12782
12818
|
value: getTimeString(tempDate),
|
|
12783
12819
|
onChange: handleTimeChange,
|
|
@@ -13506,6 +13542,7 @@ function CalendarTimeline({
|
|
|
13506
13542
|
workHours,
|
|
13507
13543
|
maxLanesPerRow = 3,
|
|
13508
13544
|
now,
|
|
13545
|
+
getPortalContainer,
|
|
13509
13546
|
renderResource,
|
|
13510
13547
|
renderGroup,
|
|
13511
13548
|
renderEvent,
|
|
@@ -14540,7 +14577,8 @@ function CalendarTimeline({
|
|
|
14540
14577
|
canResizeColumn,
|
|
14541
14578
|
beginResizeColumn,
|
|
14542
14579
|
headerRef,
|
|
14543
|
-
slotHeaderNodes
|
|
14580
|
+
slotHeaderNodes,
|
|
14581
|
+
getPortalContainer
|
|
14544
14582
|
}
|
|
14545
14583
|
);
|
|
14546
14584
|
const layoutsByResource = useLayoutsByResource({
|
|
@@ -14868,6 +14906,7 @@ function CalendarTimeline({
|
|
|
14868
14906
|
onOpenChange: setEventSheetOpen,
|
|
14869
14907
|
side: "right",
|
|
14870
14908
|
size: eventSheetSize,
|
|
14909
|
+
getPortalContainer,
|
|
14871
14910
|
overlayOpacity: eventSheetOverlayOpacity,
|
|
14872
14911
|
title: selectedEvent.title ?? "Event",
|
|
14873
14912
|
description: selectedTimeText || void 0,
|
|
@@ -14897,6 +14936,7 @@ function CalendarTimeline({
|
|
|
14897
14936
|
onOpenChange: setCreateOpen,
|
|
14898
14937
|
side: "right",
|
|
14899
14938
|
size: "md",
|
|
14939
|
+
getPortalContainer,
|
|
14900
14940
|
title: l.createEventTitle,
|
|
14901
14941
|
description: activeView === "day" ? l.day : activeView === "week" ? l.week : l.month,
|
|
14902
14942
|
children: /* @__PURE__ */ jsxs31("div", { className: "space-y-4", children: [
|
|
@@ -14908,18 +14948,19 @@ function CalendarTimeline({
|
|
|
14908
14948
|
options: resourceOptions,
|
|
14909
14949
|
value: createResourceId,
|
|
14910
14950
|
onChange: (v) => setCreateResourceId(v),
|
|
14911
|
-
placeholder: l.resource
|
|
14951
|
+
placeholder: l.resource,
|
|
14952
|
+
getPortalContainer
|
|
14912
14953
|
}
|
|
14913
14954
|
)
|
|
14914
14955
|
] }),
|
|
14915
14956
|
/* @__PURE__ */ jsxs31("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
14916
14957
|
/* @__PURE__ */ jsxs31("div", { className: "space-y-2", children: [
|
|
14917
14958
|
/* @__PURE__ */ jsx38("div", { className: "text-xs text-muted-foreground", children: l.start }),
|
|
14918
|
-
/* @__PURE__ */ jsx38(Combobox, { options: createStartOptions, value: createStartIdx, onChange: (v) => setCreateStartIdx(Number(v)), placeholder: l.start })
|
|
14959
|
+
/* @__PURE__ */ jsx38(Combobox, { options: createStartOptions, value: createStartIdx, onChange: (v) => setCreateStartIdx(Number(v)), placeholder: l.start, getPortalContainer })
|
|
14919
14960
|
] }),
|
|
14920
14961
|
/* @__PURE__ */ jsxs31("div", { className: "space-y-2", children: [
|
|
14921
14962
|
/* @__PURE__ */ jsx38("div", { className: "text-xs text-muted-foreground", children: l.end }),
|
|
14922
|
-
/* @__PURE__ */ jsx38(Combobox, { options: createEndOptions, value: createEndIdx, onChange: (v) => setCreateEndIdx(Number(v)), placeholder: l.end })
|
|
14963
|
+
/* @__PURE__ */ jsx38(Combobox, { options: createEndOptions, value: createEndIdx, onChange: (v) => setCreateEndIdx(Number(v)), placeholder: l.end, getPortalContainer })
|
|
14923
14964
|
] })
|
|
14924
14965
|
] }),
|
|
14925
14966
|
/* @__PURE__ */ jsxs31("div", { className: "flex items-center justify-end gap-2 pt-2", children: [
|
|
@@ -15005,7 +15046,8 @@ var MultiCombobox = ({
|
|
|
15005
15046
|
searchDebounceMs = 0,
|
|
15006
15047
|
minSearchLength = 0,
|
|
15007
15048
|
maxInitialOptions,
|
|
15008
|
-
showSearchPromptWhenEmptyQuery = false
|
|
15049
|
+
showSearchPromptWhenEmptyQuery = false,
|
|
15050
|
+
getPortalContainer
|
|
15009
15051
|
}) => {
|
|
15010
15052
|
const globalConfig = useUnderverseUIConfig();
|
|
15011
15053
|
const resolvedBorderMode = borderMode ?? globalConfig.borderMode ?? "full";
|
|
@@ -15562,6 +15604,7 @@ var MultiCombobox = ({
|
|
|
15562
15604
|
/* @__PURE__ */ jsx39(
|
|
15563
15605
|
Popover,
|
|
15564
15606
|
{
|
|
15607
|
+
getPortalContainer,
|
|
15565
15608
|
open,
|
|
15566
15609
|
onOpenChange: setOpen,
|
|
15567
15610
|
trigger: triggerButton,
|
|
@@ -17055,7 +17098,8 @@ function CategoryTreeSelect(props) {
|
|
|
17055
17098
|
showTreeLines = true,
|
|
17056
17099
|
renderItemActions,
|
|
17057
17100
|
singleSelect = false,
|
|
17058
|
-
borderMode
|
|
17101
|
+
borderMode,
|
|
17102
|
+
getPortalContainer
|
|
17059
17103
|
} = props;
|
|
17060
17104
|
const globalConfig = useUnderverseUIConfig();
|
|
17061
17105
|
const resolvedBorderMode = borderMode ?? globalConfig.input?.borderMode ?? globalConfig.borderMode ?? "full";
|
|
@@ -17745,6 +17789,7 @@ function CategoryTreeSelect(props) {
|
|
|
17745
17789
|
/* @__PURE__ */ jsx43(
|
|
17746
17790
|
Popover,
|
|
17747
17791
|
{
|
|
17792
|
+
getPortalContainer,
|
|
17748
17793
|
open: isOpen,
|
|
17749
17794
|
onOpenChange: handleOpenChange,
|
|
17750
17795
|
disabled,
|
|
@@ -20392,6 +20437,7 @@ function ColorPicker({
|
|
|
20392
20437
|
showHarmony = false,
|
|
20393
20438
|
maxRecent = 8,
|
|
20394
20439
|
borderMode,
|
|
20440
|
+
getPortalContainer,
|
|
20395
20441
|
...rest
|
|
20396
20442
|
}) {
|
|
20397
20443
|
const globalConfig = useUnderverseUIConfig();
|
|
@@ -20529,6 +20575,7 @@ function ColorPicker({
|
|
|
20529
20575
|
return /* @__PURE__ */ jsx51("div", { className: cn("inline-block w-full", className), ...rest, children: /* @__PURE__ */ jsx51(
|
|
20530
20576
|
Popover,
|
|
20531
20577
|
{
|
|
20578
|
+
getPortalContainer,
|
|
20532
20579
|
trigger,
|
|
20533
20580
|
open,
|
|
20534
20581
|
onOpenChange: setOpen,
|
|
@@ -21736,7 +21783,8 @@ function DataTableHeader({
|
|
|
21736
21783
|
getStickyHeaderCellStyle,
|
|
21737
21784
|
sortByLabel,
|
|
21738
21785
|
t,
|
|
21739
|
-
columnColorGroups
|
|
21786
|
+
columnColorGroups,
|
|
21787
|
+
getPortalContainer
|
|
21740
21788
|
}) {
|
|
21741
21789
|
const gi18n = useGlobalI18n();
|
|
21742
21790
|
const renderFilterControl = React50.useCallback(
|
|
@@ -21779,6 +21827,7 @@ function DataTableHeader({
|
|
|
21779
21827
|
return /* @__PURE__ */ jsx58(
|
|
21780
21828
|
DatePicker,
|
|
21781
21829
|
{
|
|
21830
|
+
getPortalContainer,
|
|
21782
21831
|
size,
|
|
21783
21832
|
placeholder: col.filter.placeholder || `Select ${columnLabel}`,
|
|
21784
21833
|
value: filters[key] || null,
|
|
@@ -21791,7 +21840,7 @@ function DataTableHeader({
|
|
|
21791
21840
|
}
|
|
21792
21841
|
return null;
|
|
21793
21842
|
},
|
|
21794
|
-
[filters, setCurPage, setFilters, size]
|
|
21843
|
+
[filters, getPortalContainer, setCurPage, setFilters, size]
|
|
21795
21844
|
);
|
|
21796
21845
|
const renderHeaderContent = React50.useCallback(
|
|
21797
21846
|
(col, isLeaf) => {
|
|
@@ -21896,6 +21945,7 @@ function DataTableHeader({
|
|
|
21896
21945
|
const filterContent = col.filter ? /* @__PURE__ */ jsx58(
|
|
21897
21946
|
Popover,
|
|
21898
21947
|
{
|
|
21948
|
+
getPortalContainer,
|
|
21899
21949
|
placement: "bottom-start",
|
|
21900
21950
|
trigger: /* @__PURE__ */ jsx58("span", { className: "inline-flex", children: /* @__PURE__ */ jsx58(
|
|
21901
21951
|
Tooltip,
|
|
@@ -21959,6 +22009,7 @@ function DataTableHeader({
|
|
|
21959
22009
|
},
|
|
21960
22010
|
[
|
|
21961
22011
|
filters,
|
|
22012
|
+
getPortalContainer,
|
|
21962
22013
|
gi18n,
|
|
21963
22014
|
headerAlign,
|
|
21964
22015
|
headerMinHeightClass,
|
|
@@ -22310,7 +22361,8 @@ function DataTableToolbar({
|
|
|
22310
22361
|
labels,
|
|
22311
22362
|
t,
|
|
22312
22363
|
columnColorGroups,
|
|
22313
|
-
defaultVisibleKeys
|
|
22364
|
+
defaultVisibleKeys,
|
|
22365
|
+
getPortalContainer
|
|
22314
22366
|
}) {
|
|
22315
22367
|
const controlButtonSize = size === "lg" ? "md" : "sm";
|
|
22316
22368
|
const controlButtonClass = size === "sm" ? "h-7 px-2 text-xs" : size === "lg" ? "h-9 px-3 text-sm" : "h-8 px-2";
|
|
@@ -22334,7 +22386,8 @@ function DataTableToolbar({
|
|
|
22334
22386
|
{ label: labels?.compact || t("compact"), onClick: () => setDensity("compact") },
|
|
22335
22387
|
{ label: labels?.normal || t("normal"), onClick: () => setDensity("normal") },
|
|
22336
22388
|
{ label: labels?.comfortable || t("comfortable"), onClick: () => setDensity("comfortable") }
|
|
22337
|
-
]
|
|
22389
|
+
],
|
|
22390
|
+
getPortalContainer
|
|
22338
22391
|
}
|
|
22339
22392
|
),
|
|
22340
22393
|
enableColumnVisibilityToggle && /* @__PURE__ */ jsxs52(
|
|
@@ -22352,6 +22405,7 @@ function DataTableToolbar({
|
|
|
22352
22405
|
) }),
|
|
22353
22406
|
labels?.columns || t("columns")
|
|
22354
22407
|
] }),
|
|
22408
|
+
getPortalContainer,
|
|
22355
22409
|
children: [
|
|
22356
22410
|
/* @__PURE__ */ jsxs52("div", { className: "flex items-center gap-2 px-2 py-1.5 mb-1", children: [
|
|
22357
22411
|
/* @__PURE__ */ jsx60(Button_default, { variant: "outline", size: "sm", className: "h-7 text-xs flex-1", onClick: handleSelectAll, children: labels?.selectAll || t("selectAll") || "Select All" }),
|
|
@@ -22408,7 +22462,8 @@ function DataTableToolbar({
|
|
|
22408
22462
|
{ label: labels?.alignLeft || t("alignLeft"), onClick: () => setHeaderAlign("left") },
|
|
22409
22463
|
{ label: labels?.alignCenter || t("alignCenter"), onClick: () => setHeaderAlign("center") },
|
|
22410
22464
|
{ label: labels?.alignRight || t("alignRight"), onClick: () => setHeaderAlign("right") }
|
|
22411
|
-
]
|
|
22465
|
+
],
|
|
22466
|
+
getPortalContainer
|
|
22412
22467
|
}
|
|
22413
22468
|
),
|
|
22414
22469
|
toolbar
|
|
@@ -22902,6 +22957,7 @@ function DataTable({
|
|
|
22902
22957
|
labels,
|
|
22903
22958
|
columnColorGroups,
|
|
22904
22959
|
borderMode,
|
|
22960
|
+
getPortalContainer,
|
|
22905
22961
|
paginationVariant = "default"
|
|
22906
22962
|
}) {
|
|
22907
22963
|
const t = useSmartTranslations("Common");
|
|
@@ -23057,7 +23113,8 @@ function DataTable({
|
|
|
23057
23113
|
labels,
|
|
23058
23114
|
t,
|
|
23059
23115
|
columnColorGroups,
|
|
23060
|
-
defaultVisibleKeys
|
|
23116
|
+
defaultVisibleKeys,
|
|
23117
|
+
getPortalContainer
|
|
23061
23118
|
}
|
|
23062
23119
|
),
|
|
23063
23120
|
/* @__PURE__ */ jsx61(
|
|
@@ -23109,7 +23166,8 @@ function DataTable({
|
|
|
23109
23166
|
getStickyHeaderCellStyle,
|
|
23110
23167
|
sortByLabel: labels?.sortBy,
|
|
23111
23168
|
t,
|
|
23112
|
-
columnColorGroups
|
|
23169
|
+
columnColorGroups,
|
|
23170
|
+
getPortalContainer
|
|
23113
23171
|
}
|
|
23114
23172
|
) }),
|
|
23115
23173
|
/* @__PURE__ */ jsx61(
|
|
@@ -23664,19 +23722,20 @@ function AccessDenied({
|
|
|
23664
23722
|
|
|
23665
23723
|
// src/components/ThemeToggleHeadless.tsx
|
|
23666
23724
|
import { Moon as Moon2, Sun as Sun2, Monitor } from "lucide-react";
|
|
23667
|
-
import {
|
|
23725
|
+
import { useState as useState37 } from "react";
|
|
23668
23726
|
import { createPortal as createPortal3 } from "react-dom";
|
|
23669
23727
|
import { Fragment as Fragment23, jsx as jsx65, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
23670
23728
|
function ThemeToggleHeadless({
|
|
23671
23729
|
theme,
|
|
23672
23730
|
onChange,
|
|
23673
23731
|
labels,
|
|
23674
|
-
className
|
|
23732
|
+
className,
|
|
23733
|
+
getPortalContainer
|
|
23675
23734
|
}) {
|
|
23676
23735
|
const [isOpen, setIsOpen] = useState37(false);
|
|
23677
23736
|
const isHydrated = useHydrated();
|
|
23678
|
-
const triggerRef = useRef23(null);
|
|
23679
23737
|
const [dropdownPosition, setDropdownPosition] = useState37(null);
|
|
23738
|
+
const [portalContainer, setPortalContainer] = useState37(null);
|
|
23680
23739
|
const themes = [
|
|
23681
23740
|
{ value: "light", label: labels?.light ?? "Light", icon: Sun2 },
|
|
23682
23741
|
{ value: "dark", label: labels?.dark ?? "Dark", icon: Moon2 },
|
|
@@ -23684,15 +23743,19 @@ function ThemeToggleHeadless({
|
|
|
23684
23743
|
];
|
|
23685
23744
|
const current = isHydrated ? themes.find((t) => t.value === theme) || themes[2] : themes[2];
|
|
23686
23745
|
const CurrentIcon = current.icon;
|
|
23687
|
-
const
|
|
23688
|
-
const rect =
|
|
23689
|
-
|
|
23690
|
-
const
|
|
23691
|
-
|
|
23746
|
+
const prepareOpen = (trigger) => {
|
|
23747
|
+
const rect = trigger.getBoundingClientRect();
|
|
23748
|
+
const ownerDocument = trigger.ownerDocument;
|
|
23749
|
+
const ownerWindow = ownerDocument?.defaultView;
|
|
23750
|
+
if (!ownerWindow) return;
|
|
23751
|
+
const scrollTop = ownerWindow.pageYOffset || ownerDocument.documentElement.scrollTop;
|
|
23752
|
+
const scrollLeft = ownerWindow.pageXOffset || ownerDocument.documentElement.scrollLeft;
|
|
23692
23753
|
const width = 192;
|
|
23693
23754
|
const left = rect.right + scrollLeft - width;
|
|
23694
23755
|
const top = rect.bottom + scrollTop + 8;
|
|
23695
|
-
|
|
23756
|
+
const requestedContainer = resolveUEditorPortalContainer(getPortalContainer, void 0, ownerDocument);
|
|
23757
|
+
setDropdownPosition({ top, left, width });
|
|
23758
|
+
setPortalContainer(requestedContainer?.ownerDocument === ownerDocument ? requestedContainer : ownerDocument.body);
|
|
23696
23759
|
};
|
|
23697
23760
|
return /* @__PURE__ */ jsxs57("div", { className: cn("relative", className), children: [
|
|
23698
23761
|
/* @__PURE__ */ jsx65(
|
|
@@ -23700,13 +23763,9 @@ function ThemeToggleHeadless({
|
|
|
23700
23763
|
{
|
|
23701
23764
|
variant: "ghost",
|
|
23702
23765
|
size: "icon",
|
|
23703
|
-
|
|
23704
|
-
onClick: () => {
|
|
23766
|
+
onClick: (event) => {
|
|
23705
23767
|
const next = !isOpen;
|
|
23706
|
-
if (next)
|
|
23707
|
-
const pos = calculatePosition();
|
|
23708
|
-
if (pos) setDropdownPosition(pos);
|
|
23709
|
-
}
|
|
23768
|
+
if (next) prepareOpen(event.currentTarget);
|
|
23710
23769
|
setIsOpen(next);
|
|
23711
23770
|
},
|
|
23712
23771
|
className: "bg-muted hover:bg-accent",
|
|
@@ -23717,8 +23776,8 @@ function ThemeToggleHeadless({
|
|
|
23717
23776
|
}
|
|
23718
23777
|
),
|
|
23719
23778
|
isOpen && /* @__PURE__ */ jsxs57(Fragment23, { children: [
|
|
23720
|
-
|
|
23721
|
-
|
|
23779
|
+
portalContainer && createPortal3(/* @__PURE__ */ jsx65("div", { className: "fixed inset-0 z-[99998]", onClick: () => setIsOpen(false) }), portalContainer),
|
|
23780
|
+
portalContainer && dropdownPosition && createPortal3(
|
|
23722
23781
|
/* @__PURE__ */ jsx65(
|
|
23723
23782
|
"div",
|
|
23724
23783
|
{
|
|
@@ -23758,14 +23817,14 @@ function ThemeToggleHeadless({
|
|
|
23758
23817
|
] })
|
|
23759
23818
|
}
|
|
23760
23819
|
),
|
|
23761
|
-
|
|
23820
|
+
portalContainer
|
|
23762
23821
|
)
|
|
23763
23822
|
] })
|
|
23764
23823
|
] });
|
|
23765
23824
|
}
|
|
23766
23825
|
|
|
23767
23826
|
// src/components/LanguageSwitcherHeadless.tsx
|
|
23768
|
-
import {
|
|
23827
|
+
import { useState as useState38 } from "react";
|
|
23769
23828
|
import { createPortal as createPortal4 } from "react-dom";
|
|
23770
23829
|
import { Globe } from "lucide-react";
|
|
23771
23830
|
import { Fragment as Fragment24, jsx as jsx66, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
@@ -23774,21 +23833,26 @@ function LanguageSwitcherHeadless({
|
|
|
23774
23833
|
currentLocale,
|
|
23775
23834
|
onSwitch,
|
|
23776
23835
|
labels,
|
|
23777
|
-
className
|
|
23836
|
+
className,
|
|
23837
|
+
getPortalContainer
|
|
23778
23838
|
}) {
|
|
23779
23839
|
const [isOpen, setIsOpen] = useState38(false);
|
|
23780
23840
|
const [dropdownPosition, setDropdownPosition] = useState38(null);
|
|
23781
|
-
const
|
|
23841
|
+
const [portalContainer, setPortalContainer] = useState38(null);
|
|
23782
23842
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
23783
|
-
const
|
|
23784
|
-
const rect =
|
|
23785
|
-
|
|
23786
|
-
const
|
|
23787
|
-
|
|
23843
|
+
const prepareOpen = (trigger) => {
|
|
23844
|
+
const rect = trigger.getBoundingClientRect();
|
|
23845
|
+
const ownerDocument = trigger.ownerDocument;
|
|
23846
|
+
const ownerWindow = ownerDocument?.defaultView;
|
|
23847
|
+
if (!ownerWindow) return;
|
|
23848
|
+
const scrollTop = ownerWindow.pageYOffset || ownerDocument.documentElement.scrollTop;
|
|
23849
|
+
const scrollLeft = ownerWindow.pageXOffset || ownerDocument.documentElement.scrollLeft;
|
|
23788
23850
|
const width = 192;
|
|
23789
23851
|
const left = rect.right + scrollLeft - width;
|
|
23790
23852
|
const top = rect.bottom + scrollTop + 8;
|
|
23791
|
-
|
|
23853
|
+
const requestedContainer = resolveUEditorPortalContainer(getPortalContainer, void 0, ownerDocument);
|
|
23854
|
+
setDropdownPosition({ top, left, width });
|
|
23855
|
+
setPortalContainer(requestedContainer?.ownerDocument === ownerDocument ? requestedContainer : ownerDocument.body);
|
|
23792
23856
|
};
|
|
23793
23857
|
return /* @__PURE__ */ jsxs58("div", { className: cn("relative", className), children: [
|
|
23794
23858
|
/* @__PURE__ */ jsx66(
|
|
@@ -23796,13 +23860,9 @@ function LanguageSwitcherHeadless({
|
|
|
23796
23860
|
{
|
|
23797
23861
|
variant: "ghost",
|
|
23798
23862
|
size: "icon",
|
|
23799
|
-
|
|
23800
|
-
onClick: () => {
|
|
23863
|
+
onClick: (event) => {
|
|
23801
23864
|
const next = !isOpen;
|
|
23802
|
-
if (next)
|
|
23803
|
-
const pos = calculatePosition();
|
|
23804
|
-
if (pos) setDropdownPosition(pos);
|
|
23805
|
-
}
|
|
23865
|
+
if (next) prepareOpen(event.currentTarget);
|
|
23806
23866
|
setIsOpen(next);
|
|
23807
23867
|
},
|
|
23808
23868
|
className: "bg-muted hover:bg-accent",
|
|
@@ -23814,8 +23874,8 @@ function LanguageSwitcherHeadless({
|
|
|
23814
23874
|
}
|
|
23815
23875
|
),
|
|
23816
23876
|
isOpen && /* @__PURE__ */ jsxs58(Fragment24, { children: [
|
|
23817
|
-
|
|
23818
|
-
|
|
23877
|
+
portalContainer && createPortal4(/* @__PURE__ */ jsx66("div", { className: "fixed inset-0 z-[99998]", onClick: () => setIsOpen(false) }), portalContainer),
|
|
23878
|
+
portalContainer && dropdownPosition && createPortal4(
|
|
23819
23879
|
/* @__PURE__ */ jsx66(
|
|
23820
23880
|
"div",
|
|
23821
23881
|
{
|
|
@@ -23848,7 +23908,7 @@ function LanguageSwitcherHeadless({
|
|
|
23848
23908
|
] })
|
|
23849
23909
|
}
|
|
23850
23910
|
),
|
|
23851
|
-
|
|
23911
|
+
portalContainer
|
|
23852
23912
|
)
|
|
23853
23913
|
] })
|
|
23854
23914
|
] });
|