@1urso/generic-editor 0.1.1 → 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/README.md +14 -1
- package/dist/editor/context.d.ts +2 -0
- package/dist/editor/index.d.ts +1 -0
- package/dist/generic-editor.css +1 -1
- package/dist/generic-editor.js +986 -1253
- package/dist/generic-editor.umd.cjs +15 -15
- package/package.json +1 -3
package/dist/generic-editor.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
2
|
import React, { Component, Fragment, PureComponent, createContext, createElement, forwardRef, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import * as ReactDOM$1 from "react-dom";
|
|
4
|
-
import ReactDOM, { flushSync } from "react-dom";
|
|
4
|
+
import ReactDOM, { createPortal, flushSync } from "react-dom";
|
|
5
5
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __esmMin = (s, d) => () => (s && (d = s(s = 0)), d), __commonJSMin = (s, d) => () => (d || s((d = { exports: {} }).exports, d), d.exports), __export = (s) => {
|
|
7
7
|
let d = {};
|
|
@@ -253,7 +253,7 @@ function createCollection(s) {
|
|
|
253
253
|
});
|
|
254
254
|
});
|
|
255
255
|
q.displayName = U;
|
|
256
|
-
let J = s + "CollectionItemSlot", X = "data-radix-collection-item", $ = /* @__PURE__ */ createSlot(J),
|
|
256
|
+
let J = s + "CollectionItemSlot", X = "data-radix-collection-item", $ = /* @__PURE__ */ createSlot(J), PD = React.forwardRef((s, C) => {
|
|
257
257
|
let { scope: w, children: k, ...F } = s, V = React.useRef(null), U = useComposedRefs(C, V), K = L(J, w);
|
|
258
258
|
return React.useEffect(() => (K.itemMap.set(V, {
|
|
259
259
|
ref: V,
|
|
@@ -264,8 +264,8 @@ function createCollection(s) {
|
|
|
264
264
|
children: k
|
|
265
265
|
});
|
|
266
266
|
});
|
|
267
|
-
|
|
268
|
-
function
|
|
267
|
+
PD.displayName = J;
|
|
268
|
+
function FD(C) {
|
|
269
269
|
let w = L(s + "CollectionConsumer", C);
|
|
270
270
|
return React.useCallback(() => {
|
|
271
271
|
let s = w.collectionRef.current;
|
|
@@ -278,9 +278,9 @@ function createCollection(s) {
|
|
|
278
278
|
{
|
|
279
279
|
Provider: V,
|
|
280
280
|
Slot: q,
|
|
281
|
-
ItemSlot:
|
|
281
|
+
ItemSlot: PD
|
|
282
282
|
},
|
|
283
|
-
|
|
283
|
+
FD,
|
|
284
284
|
k
|
|
285
285
|
];
|
|
286
286
|
}
|
|
@@ -433,15 +433,15 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
433
433
|
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
434
434
|
branches: /* @__PURE__ */ new Set()
|
|
435
435
|
}), DismissableLayer = React$1.forwardRef((d, C) => {
|
|
436
|
-
let { disableOutsidePointerEvents: w = !1, onEscapeKeyDown: k, onPointerDownOutside: F, onFocusOutside: L, onInteractOutside: V, onDismiss: U, ...K } = d, q = React$1.useContext(DismissableLayerContext), [J, X] = React$1.useState(null), $ = J?.ownerDocument ?? globalThis?.document, [,
|
|
436
|
+
let { disableOutsidePointerEvents: w = !1, onEscapeKeyDown: k, onPointerDownOutside: F, onFocusOutside: L, onInteractOutside: V, onDismiss: U, ...K } = d, q = React$1.useContext(DismissableLayerContext), [J, X] = React$1.useState(null), $ = J?.ownerDocument ?? globalThis?.document, [, PD] = React$1.useState({}), FD = useComposedRefs(C, (s) => X(s)), ID = Array.from(q.layers), [LD] = [...q.layersWithOutsidePointerEventsDisabled].slice(-1), RD = ID.indexOf(LD), zD = J ? ID.indexOf(J) : -1, BD = q.layersWithOutsidePointerEventsDisabled.size > 0, VD = zD >= RD, HD = usePointerDownOutside((s) => {
|
|
437
437
|
let d = s.target, C = [...q.branches].some((s) => s.contains(d));
|
|
438
|
-
!
|
|
439
|
-
}, $),
|
|
438
|
+
!VD || C || (F?.(s), V?.(s), s.defaultPrevented || U?.());
|
|
439
|
+
}, $), UD = useFocusOutside((s) => {
|
|
440
440
|
let d = s.target;
|
|
441
441
|
[...q.branches].some((s) => s.contains(d)) || (L?.(s), V?.(s), s.defaultPrevented || U?.());
|
|
442
442
|
}, $);
|
|
443
443
|
return useEscapeKeydown((s) => {
|
|
444
|
-
|
|
444
|
+
zD === q.layers.size - 1 && (k?.(s), !s.defaultPrevented && U && (s.preventDefault(), U()));
|
|
445
445
|
}, $), React$1.useEffect(() => {
|
|
446
446
|
if (J) return w && (q.layersWithOutsidePointerEventsDisabled.size === 0 && (originalBodyPointerEvents = $.body.style.pointerEvents, $.body.style.pointerEvents = "none"), q.layersWithOutsidePointerEventsDisabled.add(J)), q.layers.add(J), dispatchUpdate(), () => {
|
|
447
447
|
w && q.layersWithOutsidePointerEventsDisabled.size === 1 && ($.body.style.pointerEvents = originalBodyPointerEvents);
|
|
@@ -454,18 +454,18 @@ var DISMISSABLE_LAYER_NAME = "DismissableLayer", CONTEXT_UPDATE = "dismissableLa
|
|
|
454
454
|
]), React$1.useEffect(() => () => {
|
|
455
455
|
J && (q.layers.delete(J), q.layersWithOutsidePointerEventsDisabled.delete(J), dispatchUpdate());
|
|
456
456
|
}, [J, q]), React$1.useEffect(() => {
|
|
457
|
-
let s = () =>
|
|
457
|
+
let s = () => PD({});
|
|
458
458
|
return document.addEventListener(CONTEXT_UPDATE, s), () => document.removeEventListener(CONTEXT_UPDATE, s);
|
|
459
459
|
}, []), /* @__PURE__ */ jsx(Primitive.div, {
|
|
460
460
|
...K,
|
|
461
|
-
ref:
|
|
461
|
+
ref: FD,
|
|
462
462
|
style: {
|
|
463
|
-
pointerEvents:
|
|
463
|
+
pointerEvents: BD ? VD ? "auto" : "none" : void 0,
|
|
464
464
|
...d.style
|
|
465
465
|
},
|
|
466
|
-
onFocusCapture: composeEventHandlers(d.onFocusCapture,
|
|
467
|
-
onBlurCapture: composeEventHandlers(d.onBlurCapture,
|
|
468
|
-
onPointerDownCapture: composeEventHandlers(d.onPointerDownCapture,
|
|
466
|
+
onFocusCapture: composeEventHandlers(d.onFocusCapture, UD.onFocusCapture),
|
|
467
|
+
onBlurCapture: composeEventHandlers(d.onBlurCapture, UD.onBlurCapture),
|
|
468
|
+
onPointerDownCapture: composeEventHandlers(d.onPointerDownCapture, HD.onPointerDownCapture)
|
|
469
469
|
});
|
|
470
470
|
});
|
|
471
471
|
DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
|
|
@@ -529,7 +529,7 @@ var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount", AUTOFOCUS_ON_UNMOUNT = "
|
|
|
529
529
|
bubbles: !1,
|
|
530
530
|
cancelable: !0
|
|
531
531
|
}, FOCUS_SCOPE_NAME = "FocusScope", FocusScope = React$1.forwardRef((d, C) => {
|
|
532
|
-
let { loop: w = !1, trapped: k = !1, onMountAutoFocus: F, onUnmountAutoFocus: L, ...V } = d, [U, K] = React$1.useState(null), q = useCallbackRef(F), J = useCallbackRef(L), X = React$1.useRef(null), $ = useComposedRefs(C, (s) => K(s)),
|
|
532
|
+
let { loop: w = !1, trapped: k = !1, onMountAutoFocus: F, onUnmountAutoFocus: L, ...V } = d, [U, K] = React$1.useState(null), q = useCallbackRef(F), J = useCallbackRef(L), X = React$1.useRef(null), $ = useComposedRefs(C, (s) => K(s)), PD = React$1.useRef({
|
|
533
533
|
paused: !1,
|
|
534
534
|
pause() {
|
|
535
535
|
this.paused = !0;
|
|
@@ -541,11 +541,11 @@ var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount", AUTOFOCUS_ON_UNMOUNT = "
|
|
|
541
541
|
React$1.useEffect(() => {
|
|
542
542
|
if (k) {
|
|
543
543
|
let s = function(s) {
|
|
544
|
-
if (
|
|
544
|
+
if (PD.paused || !U) return;
|
|
545
545
|
let d = s.target;
|
|
546
546
|
U.contains(d) ? X.current = d : focus(X.current, { select: !0 });
|
|
547
547
|
}, d = function(s) {
|
|
548
|
-
if (
|
|
548
|
+
if (PD.paused || !U) return;
|
|
549
549
|
let d = s.relatedTarget;
|
|
550
550
|
d !== null && (U.contains(d) || focus(X.current, { select: !0 }));
|
|
551
551
|
}, C = function(s) {
|
|
@@ -563,10 +563,10 @@ var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount", AUTOFOCUS_ON_UNMOUNT = "
|
|
|
563
563
|
}, [
|
|
564
564
|
k,
|
|
565
565
|
U,
|
|
566
|
-
|
|
566
|
+
PD.paused
|
|
567
567
|
]), React$1.useEffect(() => {
|
|
568
568
|
if (U) {
|
|
569
|
-
focusScopesStack.add(
|
|
569
|
+
focusScopesStack.add(PD);
|
|
570
570
|
let s = document.activeElement;
|
|
571
571
|
if (!U.contains(s)) {
|
|
572
572
|
let d = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS$1);
|
|
@@ -575,7 +575,7 @@ var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount", AUTOFOCUS_ON_UNMOUNT = "
|
|
|
575
575
|
return () => {
|
|
576
576
|
U.removeEventListener(AUTOFOCUS_ON_MOUNT, q), setTimeout(() => {
|
|
577
577
|
let d = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS$1);
|
|
578
|
-
U.addEventListener(AUTOFOCUS_ON_UNMOUNT, J), U.dispatchEvent(d), d.defaultPrevented || focus(s ?? document.body, { select: !0 }), U.removeEventListener(AUTOFOCUS_ON_UNMOUNT, J), focusScopesStack.remove(
|
|
578
|
+
U.addEventListener(AUTOFOCUS_ON_UNMOUNT, J), U.dispatchEvent(d), d.defaultPrevented || focus(s ?? document.body, { select: !0 }), U.removeEventListener(AUTOFOCUS_ON_UNMOUNT, J), focusScopesStack.remove(PD);
|
|
579
579
|
}, 0);
|
|
580
580
|
};
|
|
581
581
|
}
|
|
@@ -583,10 +583,10 @@ var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount", AUTOFOCUS_ON_UNMOUNT = "
|
|
|
583
583
|
U,
|
|
584
584
|
q,
|
|
585
585
|
J,
|
|
586
|
-
|
|
586
|
+
PD
|
|
587
587
|
]);
|
|
588
|
-
let
|
|
589
|
-
if (!w && !k ||
|
|
588
|
+
let FD = React$1.useCallback((s) => {
|
|
589
|
+
if (!w && !k || PD.paused) return;
|
|
590
590
|
let d = s.key === "Tab" && !s.altKey && !s.ctrlKey && !s.metaKey, C = document.activeElement;
|
|
591
591
|
if (d && C) {
|
|
592
592
|
let d = s.currentTarget, [k, F] = getTabbableEdges(d);
|
|
@@ -595,13 +595,13 @@ var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount", AUTOFOCUS_ON_UNMOUNT = "
|
|
|
595
595
|
}, [
|
|
596
596
|
w,
|
|
597
597
|
k,
|
|
598
|
-
|
|
598
|
+
PD.paused
|
|
599
599
|
]);
|
|
600
600
|
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
601
601
|
tabIndex: -1,
|
|
602
602
|
...V,
|
|
603
603
|
ref: $,
|
|
604
|
-
onKeyDown:
|
|
604
|
+
onKeyDown: FD
|
|
605
605
|
});
|
|
606
606
|
});
|
|
607
607
|
FocusScope.displayName = FOCUS_SCOPE_NAME;
|
|
@@ -662,7 +662,7 @@ function arrayRemove(s, d) {
|
|
|
662
662
|
function removeLinks(s) {
|
|
663
663
|
return s.filter((s) => s.tagName !== "A");
|
|
664
664
|
}
|
|
665
|
-
var PORTAL_NAME$
|
|
665
|
+
var PORTAL_NAME$4 = "Portal", Portal = React$1.forwardRef((d, C) => {
|
|
666
666
|
let { container: w, ...k } = d, [F, L] = React$1.useState(!1);
|
|
667
667
|
useLayoutEffect2(() => L(!0), []);
|
|
668
668
|
let V = w || F && globalThis?.document?.body;
|
|
@@ -671,7 +671,7 @@ var PORTAL_NAME$5 = "Portal", Portal = React$1.forwardRef((d, C) => {
|
|
|
671
671
|
ref: C
|
|
672
672
|
}), V) : null;
|
|
673
673
|
});
|
|
674
|
-
Portal.displayName = PORTAL_NAME$
|
|
674
|
+
Portal.displayName = PORTAL_NAME$4;
|
|
675
675
|
var count = 0;
|
|
676
676
|
function useFocusGuards() {
|
|
677
677
|
React$1.useEffect(() => {
|
|
@@ -824,7 +824,7 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
824
824
|
onScrollCapture: nothing,
|
|
825
825
|
onWheelCapture: nothing,
|
|
826
826
|
onTouchMoveCapture: nothing
|
|
827
|
-
}), F = k[0], L = k[1], V = d.forwardProps, U = d.children, K = d.className, q = d.removeScrollBar, J = d.enabled, X = d.shards, $ = d.sideCar,
|
|
827
|
+
}), F = k[0], L = k[1], V = d.forwardProps, U = d.children, K = d.className, q = d.removeScrollBar, J = d.enabled, X = d.shards, $ = d.sideCar, PD = d.noRelative, FD = d.noIsolation, ID = d.inert, LD = d.allowPinchZoom, RD = d.as, zD = RD === void 0 ? "div" : RD, BD = d.gapMode, VD = __rest(d, [
|
|
828
828
|
"forwardProps",
|
|
829
829
|
"children",
|
|
830
830
|
"className",
|
|
@@ -838,21 +838,21 @@ var effectCar = createSidecarMedium(), nothing = function() {}, RemoveScroll = R
|
|
|
838
838
|
"allowPinchZoom",
|
|
839
839
|
"as",
|
|
840
840
|
"gapMode"
|
|
841
|
-
]),
|
|
842
|
-
return React$1.createElement(React$1.Fragment, null, J && React$1.createElement(
|
|
841
|
+
]), HD = $, UD = useMergeRefs([w, C]), WD = __assign$2(__assign$2({}, VD), F);
|
|
842
|
+
return React$1.createElement(React$1.Fragment, null, J && React$1.createElement(HD, {
|
|
843
843
|
sideCar: effectCar,
|
|
844
844
|
removeScrollBar: q,
|
|
845
845
|
shards: X,
|
|
846
|
-
noRelative:
|
|
847
|
-
noIsolation:
|
|
848
|
-
inert:
|
|
846
|
+
noRelative: PD,
|
|
847
|
+
noIsolation: FD,
|
|
848
|
+
inert: ID,
|
|
849
849
|
setCallbacks: L,
|
|
850
|
-
allowPinchZoom: !!
|
|
850
|
+
allowPinchZoom: !!LD,
|
|
851
851
|
lockRef: w,
|
|
852
|
-
gapMode:
|
|
853
|
-
}), V ? React$1.cloneElement(React$1.Children.only(U), __assign$2(__assign$2({},
|
|
852
|
+
gapMode: BD
|
|
853
|
+
}), V ? React$1.cloneElement(React$1.Children.only(U), __assign$2(__assign$2({}, WD), { ref: UD })) : React$1.createElement(zD, __assign$2({}, WD, {
|
|
854
854
|
className: K,
|
|
855
|
-
ref:
|
|
855
|
+
ref: UD
|
|
856
856
|
}), U));
|
|
857
857
|
});
|
|
858
858
|
RemoveScroll.defaultProps = {
|
|
@@ -1040,10 +1040,10 @@ var nonPassive = passiveSupported ? { passive: !1 } : !1, alwaysContainsScroll =
|
|
|
1040
1040
|
var F = getDirectionFactor(s, window.getComputedStyle(d).direction), L = F * w, V = C.target, U = d.contains(V), K = !1, q = L > 0, J = 0, X = 0;
|
|
1041
1041
|
do {
|
|
1042
1042
|
if (!V) break;
|
|
1043
|
-
var $ = getScrollVariables(s, V),
|
|
1044
|
-
(
|
|
1045
|
-
var
|
|
1046
|
-
V =
|
|
1043
|
+
var $ = getScrollVariables(s, V), PD = $[0], FD = $[1] - $[2] - F * PD;
|
|
1044
|
+
(PD || FD) && elementCouldBeScrolled(s, V) && (J += FD, X += PD);
|
|
1045
|
+
var ID = V.parentNode;
|
|
1046
|
+
V = ID && ID.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? ID.host : ID;
|
|
1047
1047
|
} while (!U && V !== document.body || U && (d.contains(V) || d === V));
|
|
1048
1048
|
return (q && (k && Math.abs(J) < 1 || !k && L > J) || !q && (k && Math.abs(X) < 1 || !k && -L > X)) && (K = !0), K;
|
|
1049
1049
|
}, getTouchXY = function(s) {
|
|
@@ -1087,12 +1087,12 @@ function RemoveScrollSideCar(d) {
|
|
|
1087
1087
|
if ("touches" in s && J === "h" && q.type === "range") return !1;
|
|
1088
1088
|
var X = window.getSelection(), $ = X && X.anchorNode;
|
|
1089
1089
|
if ($ && ($ === q || $.contains(q))) return !1;
|
|
1090
|
-
var
|
|
1091
|
-
if (!
|
|
1092
|
-
if (
|
|
1090
|
+
var PD = locationCouldBeScrolled(J, q);
|
|
1091
|
+
if (!PD) return !0;
|
|
1092
|
+
if (PD ? K = J : (K = J === "v" ? "h" : "v", PD = locationCouldBeScrolled(J, q)), !PD) return !1;
|
|
1093
1093
|
if (!k.current && "changedTouches" in s && (L || U) && (k.current = K), !K) return !0;
|
|
1094
|
-
var
|
|
1095
|
-
return handleScroll(
|
|
1094
|
+
var FD = k.current || K;
|
|
1095
|
+
return handleScroll(FD, d, s, FD === "h" ? L : U, !0);
|
|
1096
1096
|
}, []), K = React$1.useCallback(function(s) {
|
|
1097
1097
|
var d = s;
|
|
1098
1098
|
if (!(!lockStack.length || lockStack[lockStack.length - 1] !== L)) {
|
|
@@ -1141,8 +1141,8 @@ function RemoveScrollSideCar(d) {
|
|
|
1141
1141
|
}), document.removeEventListener("wheel", K, nonPassive), document.removeEventListener("touchmove", K, nonPassive), document.removeEventListener("touchstart", J, nonPassive);
|
|
1142
1142
|
};
|
|
1143
1143
|
}, []);
|
|
1144
|
-
var
|
|
1145
|
-
return React$1.createElement(React$1.Fragment, null,
|
|
1144
|
+
var PD = d.removeScrollBar, FD = d.inert;
|
|
1145
|
+
return React$1.createElement(React$1.Fragment, null, FD ? React$1.createElement(L, { styles: generateStyle(F) }) : null, PD ? React$1.createElement(RemoveScrollBar, {
|
|
1146
1146
|
noRelative: d.noRelative,
|
|
1147
1147
|
gapMode: d.gapMode
|
|
1148
1148
|
}) : null);
|
|
@@ -1222,8 +1222,8 @@ var Combination_default = ReactRemoveScroll, getDefaultParent = function(s) {
|
|
|
1222
1222
|
});
|
|
1223
1223
|
};
|
|
1224
1224
|
Dialog.displayName = DIALOG_NAME;
|
|
1225
|
-
var TRIGGER_NAME$
|
|
1226
|
-
let { __scopeDialog: C, ...w } = s, k = useDialogContext(TRIGGER_NAME$
|
|
1225
|
+
var TRIGGER_NAME$2 = "DialogTrigger", DialogTrigger = React$1.forwardRef((s, d) => {
|
|
1226
|
+
let { __scopeDialog: C, ...w } = s, k = useDialogContext(TRIGGER_NAME$2, C), F = useComposedRefs(d, k.triggerRef);
|
|
1227
1227
|
return /* @__PURE__ */ jsx(Primitive.button, {
|
|
1228
1228
|
type: "button",
|
|
1229
1229
|
"aria-haspopup": "dialog",
|
|
@@ -1235,9 +1235,9 @@ var TRIGGER_NAME$3 = "DialogTrigger", DialogTrigger = React$1.forwardRef((s, d)
|
|
|
1235
1235
|
onClick: composeEventHandlers(s.onClick, k.onOpenToggle)
|
|
1236
1236
|
});
|
|
1237
1237
|
});
|
|
1238
|
-
DialogTrigger.displayName = TRIGGER_NAME$
|
|
1239
|
-
var PORTAL_NAME$
|
|
1240
|
-
let { __scopeDialog: C, forceMount: w, children: k, container: F } = d, L = useDialogContext(PORTAL_NAME$
|
|
1238
|
+
DialogTrigger.displayName = TRIGGER_NAME$2;
|
|
1239
|
+
var PORTAL_NAME$3 = "DialogPortal", [PortalProvider$2, usePortalContext$2] = createDialogContext(PORTAL_NAME$3, { forceMount: void 0 }), DialogPortal = (d) => {
|
|
1240
|
+
let { __scopeDialog: C, forceMount: w, children: k, container: F } = d, L = useDialogContext(PORTAL_NAME$3, C);
|
|
1241
1241
|
return /* @__PURE__ */ jsx(PortalProvider$2, {
|
|
1242
1242
|
scope: C,
|
|
1243
1243
|
forceMount: w,
|
|
@@ -1251,7 +1251,7 @@ var PORTAL_NAME$4 = "DialogPortal", [PortalProvider$2, usePortalContext$2] = cre
|
|
|
1251
1251
|
}))
|
|
1252
1252
|
});
|
|
1253
1253
|
};
|
|
1254
|
-
DialogPortal.displayName = PORTAL_NAME$
|
|
1254
|
+
DialogPortal.displayName = PORTAL_NAME$3;
|
|
1255
1255
|
var OVERLAY_NAME = "DialogOverlay", DialogOverlay = React$1.forwardRef((s, d) => {
|
|
1256
1256
|
let C = usePortalContext$2(OVERLAY_NAME, s.__scopeDialog), { forceMount: w = C.forceMount, ...k } = s, F = useDialogContext(OVERLAY_NAME, s.__scopeDialog);
|
|
1257
1257
|
return F.modal ? /* @__PURE__ */ jsx(Presence, {
|
|
@@ -1279,8 +1279,8 @@ var Slot$1 = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll"), DialogOve
|
|
|
1279
1279
|
}
|
|
1280
1280
|
})
|
|
1281
1281
|
});
|
|
1282
|
-
}), CONTENT_NAME$
|
|
1283
|
-
let C = usePortalContext$2(CONTENT_NAME$
|
|
1282
|
+
}), CONTENT_NAME$4 = "DialogContent", DialogContent = React$1.forwardRef((s, d) => {
|
|
1283
|
+
let C = usePortalContext$2(CONTENT_NAME$4, s.__scopeDialog), { forceMount: w = C.forceMount, ...k } = s, F = useDialogContext(CONTENT_NAME$4, s.__scopeDialog);
|
|
1284
1284
|
return /* @__PURE__ */ jsx(Presence, {
|
|
1285
1285
|
present: w || F.open,
|
|
1286
1286
|
children: F.modal ? /* @__PURE__ */ jsx(DialogContentModal, {
|
|
@@ -1292,9 +1292,9 @@ var Slot$1 = /* @__PURE__ */ createSlot("DialogOverlay.RemoveScroll"), DialogOve
|
|
|
1292
1292
|
})
|
|
1293
1293
|
});
|
|
1294
1294
|
});
|
|
1295
|
-
DialogContent.displayName = CONTENT_NAME$
|
|
1295
|
+
DialogContent.displayName = CONTENT_NAME$4;
|
|
1296
1296
|
var DialogContentModal = React$1.forwardRef((d, C) => {
|
|
1297
|
-
let w = useDialogContext(CONTENT_NAME$
|
|
1297
|
+
let w = useDialogContext(CONTENT_NAME$4, d.__scopeDialog), k = React$1.useRef(null), F = useComposedRefs(C, w.contentRef, k);
|
|
1298
1298
|
return React$1.useEffect(() => {
|
|
1299
1299
|
let s = k.current;
|
|
1300
1300
|
if (s) return hideOthers(s);
|
|
@@ -1313,7 +1313,7 @@ var DialogContentModal = React$1.forwardRef((d, C) => {
|
|
|
1313
1313
|
onFocusOutside: composeEventHandlers(d.onFocusOutside, (s) => s.preventDefault())
|
|
1314
1314
|
});
|
|
1315
1315
|
}), DialogContentNonModal = React$1.forwardRef((d, C) => {
|
|
1316
|
-
let w = useDialogContext(CONTENT_NAME$
|
|
1316
|
+
let w = useDialogContext(CONTENT_NAME$4, d.__scopeDialog), k = React$1.useRef(!1), F = React$1.useRef(!1);
|
|
1317
1317
|
return /* @__PURE__ */ jsx(DialogContentImpl, {
|
|
1318
1318
|
...d,
|
|
1319
1319
|
ref: C,
|
|
@@ -1329,7 +1329,7 @@ var DialogContentModal = React$1.forwardRef((d, C) => {
|
|
|
1329
1329
|
}
|
|
1330
1330
|
});
|
|
1331
1331
|
}), DialogContentImpl = React$1.forwardRef((d, C) => {
|
|
1332
|
-
let { __scopeDialog: w, trapFocus: k, onOpenAutoFocus: F, onCloseAutoFocus: L, ...V } = d, U = useDialogContext(CONTENT_NAME$
|
|
1332
|
+
let { __scopeDialog: w, trapFocus: k, onOpenAutoFocus: F, onCloseAutoFocus: L, ...V } = d, U = useDialogContext(CONTENT_NAME$4, w), K = React$1.useRef(null), q = useComposedRefs(C, K);
|
|
1333
1333
|
return useFocusGuards(), /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(FocusScope, {
|
|
1334
1334
|
asChild: !0,
|
|
1335
1335
|
loop: !0,
|
|
@@ -1382,7 +1382,7 @@ function getState(s) {
|
|
|
1382
1382
|
return s ? "open" : "closed";
|
|
1383
1383
|
}
|
|
1384
1384
|
var TITLE_WARNING_NAME = "DialogTitleWarning", [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
|
|
1385
|
-
contentName: CONTENT_NAME$
|
|
1385
|
+
contentName: CONTENT_NAME$4,
|
|
1386
1386
|
titleName: TITLE_NAME,
|
|
1387
1387
|
docsSlug: "dialog"
|
|
1388
1388
|
}), TitleWarning = ({ titleId: d }) => {
|
|
@@ -1404,7 +1404,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${C.do
|
|
|
1404
1404
|
d,
|
|
1405
1405
|
C
|
|
1406
1406
|
]), null;
|
|
1407
|
-
}, Root$3 = Dialog, Trigger$
|
|
1407
|
+
}, Root$3 = Dialog, Trigger$1 = DialogTrigger, Portal$2 = DialogPortal, Overlay = DialogOverlay, Content$1 = DialogContent, Title = DialogTitle, Description = DialogDescription, Close = DialogClose;
|
|
1408
1408
|
function useSize(d) {
|
|
1409
1409
|
let [C, w] = React$1.useState(void 0);
|
|
1410
1410
|
return useLayoutEffect2(() => {
|
|
@@ -1581,9 +1581,9 @@ var computePosition$1 = async (s, d, C) => {
|
|
|
1581
1581
|
reference: s,
|
|
1582
1582
|
floating: d,
|
|
1583
1583
|
strategy: k
|
|
1584
|
-
}), { x: q, y: J } = computeCoordsFromPlacement(K, w, U), X = w, $ = {},
|
|
1584
|
+
}), { x: q, y: J } = computeCoordsFromPlacement(K, w, U), X = w, $ = {}, PD = 0;
|
|
1585
1585
|
for (let C = 0; C < V.length; C++) {
|
|
1586
|
-
let { name: F, fn:
|
|
1586
|
+
let { name: F, fn: FD } = V[C], { x: ID, y: LD, data: RD, reset: zD } = await FD({
|
|
1587
1587
|
x: q,
|
|
1588
1588
|
y: J,
|
|
1589
1589
|
initialPlacement: w,
|
|
@@ -1597,17 +1597,17 @@ var computePosition$1 = async (s, d, C) => {
|
|
|
1597
1597
|
floating: d
|
|
1598
1598
|
}
|
|
1599
1599
|
});
|
|
1600
|
-
q =
|
|
1600
|
+
q = ID ?? q, J = LD ?? J, $ = {
|
|
1601
1601
|
...$,
|
|
1602
1602
|
[F]: {
|
|
1603
1603
|
...$[F],
|
|
1604
|
-
...
|
|
1604
|
+
...RD
|
|
1605
1605
|
}
|
|
1606
|
-
},
|
|
1606
|
+
}, zD && PD <= 50 && (PD++, typeof zD == "object" && (zD.placement && (X = zD.placement), zD.rects && (K = zD.rects === !0 ? await L.getElementRects({
|
|
1607
1607
|
reference: s,
|
|
1608
1608
|
floating: d,
|
|
1609
1609
|
strategy: k
|
|
1610
|
-
}) :
|
|
1610
|
+
}) : zD.rects), {x: q, y: J} = computeCoordsFromPlacement(K, X, U)), C = -1);
|
|
1611
1611
|
}
|
|
1612
1612
|
return {
|
|
1613
1613
|
x: q,
|
|
@@ -1619,30 +1619,30 @@ var computePosition$1 = async (s, d, C) => {
|
|
|
1619
1619
|
};
|
|
1620
1620
|
async function detectOverflow$1(s, d) {
|
|
1621
1621
|
d === void 0 && (d = {});
|
|
1622
|
-
let { x: C, y: w, platform: k, rects: F, elements: L, strategy: V } = s, { boundary: U = "clippingAncestors", rootBoundary: K = "viewport", elementContext: q = "floating", altBoundary: J = !1, padding: X = 0 } = evaluate(d, s), $ = getPaddingObject(X),
|
|
1623
|
-
element: await (k.isElement == null ? void 0 : k.isElement(
|
|
1622
|
+
let { x: C, y: w, platform: k, rects: F, elements: L, strategy: V } = s, { boundary: U = "clippingAncestors", rootBoundary: K = "viewport", elementContext: q = "floating", altBoundary: J = !1, padding: X = 0 } = evaluate(d, s), $ = getPaddingObject(X), PD = L[J ? q === "floating" ? "reference" : "floating" : q], FD = rectToClientRect(await k.getClippingRect({
|
|
1623
|
+
element: await (k.isElement == null ? void 0 : k.isElement(PD)) ?? !0 ? PD : PD.contextElement || await (k.getDocumentElement == null ? void 0 : k.getDocumentElement(L.floating)),
|
|
1624
1624
|
boundary: U,
|
|
1625
1625
|
rootBoundary: K,
|
|
1626
1626
|
strategy: V
|
|
1627
|
-
})),
|
|
1627
|
+
})), ID = q === "floating" ? {
|
|
1628
1628
|
x: C,
|
|
1629
1629
|
y: w,
|
|
1630
1630
|
width: F.floating.width,
|
|
1631
1631
|
height: F.floating.height
|
|
1632
|
-
} : F.reference,
|
|
1632
|
+
} : F.reference, LD = await (k.getOffsetParent == null ? void 0 : k.getOffsetParent(L.floating)), RD = await (k.isElement == null ? void 0 : k.isElement(LD)) && await (k.getScale == null ? void 0 : k.getScale(LD)) || {
|
|
1633
1633
|
x: 1,
|
|
1634
1634
|
y: 1
|
|
1635
|
-
},
|
|
1635
|
+
}, zD = rectToClientRect(k.convertOffsetParentRelativeRectToViewportRelativeRect ? await k.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
1636
1636
|
elements: L,
|
|
1637
|
-
rect:
|
|
1638
|
-
offsetParent:
|
|
1637
|
+
rect: ID,
|
|
1638
|
+
offsetParent: LD,
|
|
1639
1639
|
strategy: V
|
|
1640
|
-
}) :
|
|
1640
|
+
}) : ID);
|
|
1641
1641
|
return {
|
|
1642
|
-
top: (
|
|
1643
|
-
bottom: (
|
|
1644
|
-
left: (
|
|
1645
|
-
right: (
|
|
1642
|
+
top: (FD.top - zD.top + $.top) / RD.y,
|
|
1643
|
+
bottom: (zD.bottom - FD.bottom + $.bottom) / RD.y,
|
|
1644
|
+
left: (FD.left - zD.left + $.left) / RD.x,
|
|
1645
|
+
right: (zD.right - FD.right + $.right) / RD.x
|
|
1646
1646
|
};
|
|
1647
1647
|
}
|
|
1648
1648
|
var arrow$2 = (s) => ({
|
|
@@ -1654,17 +1654,17 @@ var arrow$2 = (s) => ({
|
|
|
1654
1654
|
let J = getPaddingObject(q), X = {
|
|
1655
1655
|
x: C,
|
|
1656
1656
|
y: w
|
|
1657
|
-
}, $ = getAlignmentAxis(k),
|
|
1658
|
-
(!
|
|
1659
|
-
let
|
|
1657
|
+
}, $ = getAlignmentAxis(k), PD = getAxisLength($), FD = await L.getDimensions(K), ID = $ === "y", LD = ID ? "top" : "left", RD = ID ? "bottom" : "right", zD = ID ? "clientHeight" : "clientWidth", BD = F.reference[PD] + F.reference[$] - X[$] - F.floating[PD], VD = X[$] - F.reference[$], HD = await (L.getOffsetParent == null ? void 0 : L.getOffsetParent(K)), UD = HD ? HD[zD] : 0;
|
|
1658
|
+
(!UD || !await (L.isElement == null ? void 0 : L.isElement(HD))) && (UD = V.floating[zD] || F.floating[PD]);
|
|
1659
|
+
let WD = BD / 2 - VD / 2, GD = UD / 2 - FD[PD] / 2 - 1, KD = min(J[LD], GD), qD = min(J[RD], GD), JD = KD, YD = UD - FD[PD] - qD, XD = UD / 2 - FD[PD] / 2 + WD, ZD = clamp$3(JD, XD, YD), QD = !U.arrow && getAlignment(k) != null && XD !== ZD && F.reference[PD] / 2 - (XD < JD ? KD : qD) - FD[PD] / 2 < 0, $D = QD ? XD < JD ? XD - JD : XD - YD : 0;
|
|
1660
1660
|
return {
|
|
1661
|
-
[$]: X[$] +
|
|
1661
|
+
[$]: X[$] + $D,
|
|
1662
1662
|
data: {
|
|
1663
|
-
[$]:
|
|
1664
|
-
centerOffset:
|
|
1665
|
-
...
|
|
1663
|
+
[$]: ZD,
|
|
1664
|
+
centerOffset: XD - ZD - $D,
|
|
1665
|
+
...QD && { alignmentOffset: $D }
|
|
1666
1666
|
},
|
|
1667
|
-
reset:
|
|
1667
|
+
reset: QD
|
|
1668
1668
|
};
|
|
1669
1669
|
}
|
|
1670
1670
|
}), flip$2 = function(s) {
|
|
@@ -1673,34 +1673,34 @@ var arrow$2 = (s) => ({
|
|
|
1673
1673
|
options: s,
|
|
1674
1674
|
async fn(d) {
|
|
1675
1675
|
var C;
|
|
1676
|
-
let { placement: w, middlewareData: k, rects: F, initialPlacement: L, platform: V, elements: U } = d, { mainAxis: K = !0, crossAxis: q = !0, fallbackPlacements: J, fallbackStrategy: X = "bestFit", fallbackAxisSideDirection: $ = "none", flipAlignment:
|
|
1676
|
+
let { placement: w, middlewareData: k, rects: F, initialPlacement: L, platform: V, elements: U } = d, { mainAxis: K = !0, crossAxis: q = !0, fallbackPlacements: J, fallbackStrategy: X = "bestFit", fallbackAxisSideDirection: $ = "none", flipAlignment: PD = !0, ...FD } = evaluate(s, d);
|
|
1677
1677
|
if ((C = k.arrow) != null && C.alignmentOffset) return {};
|
|
1678
|
-
let
|
|
1679
|
-
!J &&
|
|
1680
|
-
let
|
|
1681
|
-
if (K &&
|
|
1682
|
-
let s = getAlignmentSides(w, F,
|
|
1683
|
-
|
|
1678
|
+
let ID = getSide(w), LD = getSideAxis(L), RD = getSide(L) === L, zD = await (V.isRTL == null ? void 0 : V.isRTL(U.floating)), BD = J || (RD || !PD ? [getOppositePlacement(L)] : getExpandedPlacements(L)), VD = $ !== "none";
|
|
1679
|
+
!J && VD && BD.push(...getOppositeAxisPlacements(L, PD, $, zD));
|
|
1680
|
+
let HD = [L, ...BD], UD = await detectOverflow$1(d, FD), WD = [], GD = k.flip?.overflows || [];
|
|
1681
|
+
if (K && WD.push(UD[ID]), q) {
|
|
1682
|
+
let s = getAlignmentSides(w, F, zD);
|
|
1683
|
+
WD.push(UD[s[0]], UD[s[1]]);
|
|
1684
1684
|
}
|
|
1685
|
-
if (
|
|
1685
|
+
if (GD = [...GD, {
|
|
1686
1686
|
placement: w,
|
|
1687
|
-
overflows:
|
|
1688
|
-
}], !
|
|
1689
|
-
let s = (k.flip?.index || 0) + 1, d =
|
|
1690
|
-
if (d && (!(q === "alignment" &&
|
|
1687
|
+
overflows: WD
|
|
1688
|
+
}], !WD.every((s) => s <= 0)) {
|
|
1689
|
+
let s = (k.flip?.index || 0) + 1, d = HD[s];
|
|
1690
|
+
if (d && (!(q === "alignment" && LD !== getSideAxis(d)) || GD.every((s) => getSideAxis(s.placement) === LD ? s.overflows[0] > 0 : !0))) return {
|
|
1691
1691
|
data: {
|
|
1692
1692
|
index: s,
|
|
1693
|
-
overflows:
|
|
1693
|
+
overflows: GD
|
|
1694
1694
|
},
|
|
1695
1695
|
reset: { placement: d }
|
|
1696
1696
|
};
|
|
1697
|
-
let C =
|
|
1697
|
+
let C = GD.filter((s) => s.overflows[0] <= 0).sort((s, d) => s.overflows[1] - d.overflows[1])[0]?.placement;
|
|
1698
1698
|
if (!C) switch (X) {
|
|
1699
1699
|
case "bestFit": {
|
|
1700
|
-
let s =
|
|
1701
|
-
if (
|
|
1700
|
+
let s = GD.filter((s) => {
|
|
1701
|
+
if (VD) {
|
|
1702
1702
|
let d = getSideAxis(s.placement);
|
|
1703
|
-
return d ===
|
|
1703
|
+
return d === LD || d === "y";
|
|
1704
1704
|
}
|
|
1705
1705
|
return !0;
|
|
1706
1706
|
}).map((s) => [s.placement, s.overflows.filter((s) => s > 0).reduce((s, d) => s + d, 0)]).sort((s, d) => s[1] - d[1])[0]?.[0];
|
|
@@ -1761,7 +1761,7 @@ var hide$2 = function(s) {
|
|
|
1761
1761
|
};
|
|
1762
1762
|
}, originSides = /* @__PURE__ */ new Set(["left", "top"]);
|
|
1763
1763
|
async function convertValueToCoords(s, d) {
|
|
1764
|
-
let { placement: C, platform: w, elements: k } = s, F = await (w.isRTL == null ? void 0 : w.isRTL(k.floating)), L = getSide(C), V = getAlignment(C), U = getSideAxis(C) === "y", K = originSides.has(L) ? -1 : 1, q = F && U ? -1 : 1, J = evaluate(d, s), { mainAxis: X, crossAxis: $, alignmentAxis:
|
|
1764
|
+
let { placement: C, platform: w, elements: k } = s, F = await (w.isRTL == null ? void 0 : w.isRTL(k.floating)), L = getSide(C), V = getAlignment(C), U = getSideAxis(C) === "y", K = originSides.has(L) ? -1 : 1, q = F && U ? -1 : 1, J = evaluate(d, s), { mainAxis: X, crossAxis: $, alignmentAxis: PD } = typeof J == "number" ? {
|
|
1765
1765
|
mainAxis: J,
|
|
1766
1766
|
crossAxis: 0,
|
|
1767
1767
|
alignmentAxis: null
|
|
@@ -1770,7 +1770,7 @@ async function convertValueToCoords(s, d) {
|
|
|
1770
1770
|
crossAxis: J.crossAxis || 0,
|
|
1771
1771
|
alignmentAxis: J.alignmentAxis
|
|
1772
1772
|
};
|
|
1773
|
-
return V && typeof
|
|
1773
|
+
return V && typeof PD == "number" && ($ = V === "end" ? PD * -1 : PD), U ? {
|
|
1774
1774
|
x: $ * q,
|
|
1775
1775
|
y: X * K
|
|
1776
1776
|
} : {
|
|
@@ -1809,25 +1809,25 @@ var offset$2 = function(s) {
|
|
|
1809
1809
|
} }, ...U } = evaluate(s, d), K = {
|
|
1810
1810
|
x: C,
|
|
1811
1811
|
y: w
|
|
1812
|
-
}, q = await detectOverflow$1(d, U), J = getSideAxis(getSide(k)), X = getOppositeAxis(J), $ = K[X],
|
|
1812
|
+
}, q = await detectOverflow$1(d, U), J = getSideAxis(getSide(k)), X = getOppositeAxis(J), $ = K[X], PD = K[J];
|
|
1813
1813
|
if (F) {
|
|
1814
1814
|
let s = X === "y" ? "top" : "left", d = X === "y" ? "bottom" : "right", C = $ + q[s], w = $ - q[d];
|
|
1815
1815
|
$ = clamp$3(C, $, w);
|
|
1816
1816
|
}
|
|
1817
1817
|
if (L) {
|
|
1818
|
-
let s = J === "y" ? "top" : "left", d = J === "y" ? "bottom" : "right", C =
|
|
1819
|
-
|
|
1818
|
+
let s = J === "y" ? "top" : "left", d = J === "y" ? "bottom" : "right", C = PD + q[s], w = PD - q[d];
|
|
1819
|
+
PD = clamp$3(C, PD, w);
|
|
1820
1820
|
}
|
|
1821
|
-
let
|
|
1821
|
+
let FD = V.fn({
|
|
1822
1822
|
...d,
|
|
1823
1823
|
[X]: $,
|
|
1824
|
-
[J]:
|
|
1824
|
+
[J]: PD
|
|
1825
1825
|
});
|
|
1826
1826
|
return {
|
|
1827
|
-
...
|
|
1827
|
+
...FD,
|
|
1828
1828
|
data: {
|
|
1829
|
-
x:
|
|
1830
|
-
y:
|
|
1829
|
+
x: FD.x - C,
|
|
1830
|
+
y: FD.y - w,
|
|
1831
1831
|
enabled: {
|
|
1832
1832
|
[X]: F,
|
|
1833
1833
|
[J]: L
|
|
@@ -1843,25 +1843,25 @@ var offset$2 = function(s) {
|
|
|
1843
1843
|
let { x: C, y: w, placement: k, rects: F, middlewareData: L } = d, { offset: V = 0, mainAxis: U = !0, crossAxis: K = !0 } = evaluate(s, d), q = {
|
|
1844
1844
|
x: C,
|
|
1845
1845
|
y: w
|
|
1846
|
-
}, J = getSideAxis(k), X = getOppositeAxis(J), $ = q[X],
|
|
1847
|
-
mainAxis:
|
|
1846
|
+
}, J = getSideAxis(k), X = getOppositeAxis(J), $ = q[X], PD = q[J], FD = evaluate(V, d), ID = typeof FD == "number" ? {
|
|
1847
|
+
mainAxis: FD,
|
|
1848
1848
|
crossAxis: 0
|
|
1849
1849
|
} : {
|
|
1850
1850
|
mainAxis: 0,
|
|
1851
1851
|
crossAxis: 0,
|
|
1852
|
-
...
|
|
1852
|
+
...FD
|
|
1853
1853
|
};
|
|
1854
1854
|
if (U) {
|
|
1855
|
-
let s = X === "y" ? "height" : "width", d = F.reference[X] - F.floating[s] +
|
|
1855
|
+
let s = X === "y" ? "height" : "width", d = F.reference[X] - F.floating[s] + ID.mainAxis, C = F.reference[X] + F.reference[s] - ID.mainAxis;
|
|
1856
1856
|
$ < d ? $ = d : $ > C && ($ = C);
|
|
1857
1857
|
}
|
|
1858
1858
|
if (K) {
|
|
1859
|
-
let s = X === "y" ? "width" : "height", d = originSides.has(getSide(k)), C = F.reference[J] - F.floating[s] + (d && L.offset?.[J] || 0) + (d ? 0 :
|
|
1860
|
-
|
|
1859
|
+
let s = X === "y" ? "width" : "height", d = originSides.has(getSide(k)), C = F.reference[J] - F.floating[s] + (d && L.offset?.[J] || 0) + (d ? 0 : ID.crossAxis), w = F.reference[J] + F.reference[s] + (d ? 0 : L.offset?.[J] || 0) - (d ? ID.crossAxis : 0);
|
|
1860
|
+
PD < C ? PD = C : PD > w && (PD = w);
|
|
1861
1861
|
}
|
|
1862
1862
|
return {
|
|
1863
1863
|
[X]: $,
|
|
1864
|
-
[J]:
|
|
1864
|
+
[J]: PD
|
|
1865
1865
|
};
|
|
1866
1866
|
}
|
|
1867
1867
|
};
|
|
@@ -1871,20 +1871,20 @@ var offset$2 = function(s) {
|
|
|
1871
1871
|
options: s,
|
|
1872
1872
|
async fn(d) {
|
|
1873
1873
|
var C, w;
|
|
1874
|
-
let { placement: k, rects: F, platform: L, elements: V } = d, { apply: U = () => {}, ...K } = evaluate(s, d), q = await detectOverflow$1(d, K), J = getSide(k), X = getAlignment(k), $ = getSideAxis(k) === "y", { width:
|
|
1875
|
-
J === "top" || J === "bottom" ? (
|
|
1876
|
-
let
|
|
1877
|
-
if ((C = d.middlewareData.shift) != null && C.enabled.x && (
|
|
1874
|
+
let { placement: k, rects: F, platform: L, elements: V } = d, { apply: U = () => {}, ...K } = evaluate(s, d), q = await detectOverflow$1(d, K), J = getSide(k), X = getAlignment(k), $ = getSideAxis(k) === "y", { width: PD, height: FD } = F.floating, ID, LD;
|
|
1875
|
+
J === "top" || J === "bottom" ? (ID = J, LD = X === (await (L.isRTL == null ? void 0 : L.isRTL(V.floating)) ? "start" : "end") ? "left" : "right") : (LD = J, ID = X === "end" ? "top" : "bottom");
|
|
1876
|
+
let RD = FD - q.top - q.bottom, zD = PD - q.left - q.right, BD = min(FD - q[ID], RD), VD = min(PD - q[LD], zD), HD = !d.middlewareData.shift, UD = BD, WD = VD;
|
|
1877
|
+
if ((C = d.middlewareData.shift) != null && C.enabled.x && (WD = zD), (w = d.middlewareData.shift) != null && w.enabled.y && (UD = RD), HD && !X) {
|
|
1878
1878
|
let s = max(q.left, 0), d = max(q.right, 0), C = max(q.top, 0), w = max(q.bottom, 0);
|
|
1879
|
-
$ ?
|
|
1879
|
+
$ ? WD = PD - 2 * (s !== 0 || d !== 0 ? s + d : max(q.left, q.right)) : UD = FD - 2 * (C !== 0 || w !== 0 ? C + w : max(q.top, q.bottom));
|
|
1880
1880
|
}
|
|
1881
1881
|
await U({
|
|
1882
1882
|
...d,
|
|
1883
|
-
availableWidth:
|
|
1884
|
-
availableHeight:
|
|
1883
|
+
availableWidth: WD,
|
|
1884
|
+
availableHeight: UD
|
|
1885
1885
|
});
|
|
1886
|
-
let
|
|
1887
|
-
return
|
|
1886
|
+
let GD = await L.getDimensions(V.floating);
|
|
1887
|
+
return PD !== GD.width || FD !== GD.height ? { reset: { rects: !0 } } : {};
|
|
1888
1888
|
}
|
|
1889
1889
|
};
|
|
1890
1890
|
};
|
|
@@ -2268,27 +2268,27 @@ function observeMove(s, d) {
|
|
|
2268
2268
|
V === void 0 && (V = !1), U === void 0 && (U = 1), F();
|
|
2269
2269
|
let K = s.getBoundingClientRect(), { left: q, top: J, width: X, height: $ } = K;
|
|
2270
2270
|
if (V || d(), !X || !$) return;
|
|
2271
|
-
let
|
|
2272
|
-
rootMargin: -
|
|
2271
|
+
let PD = floor(J), FD = floor(k.clientWidth - (q + X)), ID = floor(k.clientHeight - (J + $)), LD = floor(q), RD = {
|
|
2272
|
+
rootMargin: -PD + "px " + -FD + "px " + -ID + "px " + -LD + "px",
|
|
2273
2273
|
threshold: max(0, min(1, U)) || 1
|
|
2274
|
-
},
|
|
2275
|
-
function
|
|
2274
|
+
}, zD = !0;
|
|
2275
|
+
function BD(d) {
|
|
2276
2276
|
let C = d[0].intersectionRatio;
|
|
2277
2277
|
if (C !== U) {
|
|
2278
|
-
if (!
|
|
2278
|
+
if (!zD) return L();
|
|
2279
2279
|
C ? L(!1, C) : w = setTimeout(() => {
|
|
2280
2280
|
L(!1, 1e-7);
|
|
2281
2281
|
}, 1e3);
|
|
2282
2282
|
}
|
|
2283
|
-
C === 1 && !rectsAreEqual(K, s.getBoundingClientRect()) && L(),
|
|
2283
|
+
C === 1 && !rectsAreEqual(K, s.getBoundingClientRect()) && L(), zD = !1;
|
|
2284
2284
|
}
|
|
2285
2285
|
try {
|
|
2286
|
-
C = new IntersectionObserver(
|
|
2287
|
-
...
|
|
2286
|
+
C = new IntersectionObserver(BD, {
|
|
2287
|
+
...RD,
|
|
2288
2288
|
root: k.ownerDocument
|
|
2289
2289
|
});
|
|
2290
2290
|
} catch {
|
|
2291
|
-
C = new IntersectionObserver(
|
|
2291
|
+
C = new IntersectionObserver(BD, RD);
|
|
2292
2292
|
}
|
|
2293
2293
|
C.observe(s);
|
|
2294
2294
|
}
|
|
@@ -2308,17 +2308,17 @@ function autoUpdate(s, d, C, w) {
|
|
|
2308
2308
|
(s = $) == null || s.observe(d);
|
|
2309
2309
|
})), C();
|
|
2310
2310
|
}), K && !U && $.observe(K), $.observe(d));
|
|
2311
|
-
let
|
|
2312
|
-
U &&
|
|
2313
|
-
function
|
|
2311
|
+
let PD, FD = U ? getBoundingClientRect(s) : null;
|
|
2312
|
+
U && ID();
|
|
2313
|
+
function ID() {
|
|
2314
2314
|
let d = getBoundingClientRect(s);
|
|
2315
|
-
|
|
2315
|
+
FD && !rectsAreEqual(FD, d) && C(), FD = d, PD = requestAnimationFrame(ID);
|
|
2316
2316
|
}
|
|
2317
2317
|
return C(), () => {
|
|
2318
2318
|
var s;
|
|
2319
2319
|
q.forEach((s) => {
|
|
2320
2320
|
k && s.removeEventListener("scroll", C), F && s.removeEventListener("resize", C);
|
|
2321
|
-
}), J?.(), (s = $) == null || s.disconnect(), $ = null, U && cancelAnimationFrame(
|
|
2321
|
+
}), J?.(), (s = $) == null || s.disconnect(), $ = null, U && cancelAnimationFrame(PD);
|
|
2322
2322
|
};
|
|
2323
2323
|
}
|
|
2324
2324
|
var offset$1 = offset$2, shift$1 = shift$2, flip$1 = flip$2, size$1 = size$2, hide$1 = hide$2, arrow$1 = arrow$2, limitShift$1 = limitShift$2, computePosition = (s, d, C) => {
|
|
@@ -2377,25 +2377,25 @@ function useFloating(d) {
|
|
|
2377
2377
|
placement: C,
|
|
2378
2378
|
middlewareData: {},
|
|
2379
2379
|
isPositioned: !1
|
|
2380
|
-
}), [$,
|
|
2381
|
-
deepEqual($, k) ||
|
|
2382
|
-
let [
|
|
2383
|
-
s !==
|
|
2384
|
-
}, []),
|
|
2385
|
-
s !==
|
|
2386
|
-
}, []),
|
|
2387
|
-
if (!
|
|
2380
|
+
}), [$, PD] = React$1.useState(k);
|
|
2381
|
+
deepEqual($, k) || PD(k);
|
|
2382
|
+
let [FD, ID] = React$1.useState(null), [LD, RD] = React$1.useState(null), BD = React$1.useCallback((s) => {
|
|
2383
|
+
s !== WD.current && (WD.current = s, ID(s));
|
|
2384
|
+
}, []), VD = React$1.useCallback((s) => {
|
|
2385
|
+
s !== GD.current && (GD.current = s, RD(s));
|
|
2386
|
+
}, []), HD = L || FD, UD = V || LD, WD = React$1.useRef(null), GD = React$1.useRef(null), KD = React$1.useRef(J), qD = K != null, JD = useLatestRef(K), YD = useLatestRef(F), XD = useLatestRef(q), ZD = React$1.useCallback(() => {
|
|
2387
|
+
if (!WD.current || !GD.current) return;
|
|
2388
2388
|
let s = {
|
|
2389
2389
|
placement: C,
|
|
2390
2390
|
strategy: w,
|
|
2391
2391
|
middleware: $
|
|
2392
2392
|
};
|
|
2393
|
-
|
|
2393
|
+
YD.current && (s.platform = YD.current), computePosition(WD.current, GD.current, s).then((s) => {
|
|
2394
2394
|
let d = {
|
|
2395
2395
|
...s,
|
|
2396
|
-
isPositioned:
|
|
2396
|
+
isPositioned: XD.current !== !1
|
|
2397
2397
|
};
|
|
2398
|
-
|
|
2398
|
+
QD.current && !deepEqual(KD.current, d) && (KD.current = d, ReactDOM$1.flushSync(() => {
|
|
2399
2399
|
X(d);
|
|
2400
2400
|
}));
|
|
2401
2401
|
});
|
|
@@ -2403,50 +2403,50 @@ function useFloating(d) {
|
|
|
2403
2403
|
$,
|
|
2404
2404
|
C,
|
|
2405
2405
|
w,
|
|
2406
|
-
|
|
2407
|
-
|
|
2406
|
+
YD,
|
|
2407
|
+
XD
|
|
2408
2408
|
]);
|
|
2409
2409
|
index(() => {
|
|
2410
|
-
q === !1 &&
|
|
2410
|
+
q === !1 && KD.current.isPositioned && (KD.current.isPositioned = !1, X((s) => ({
|
|
2411
2411
|
...s,
|
|
2412
2412
|
isPositioned: !1
|
|
2413
2413
|
})));
|
|
2414
2414
|
}, [q]);
|
|
2415
|
-
let
|
|
2416
|
-
index(() => (
|
|
2417
|
-
|
|
2415
|
+
let QD = React$1.useRef(!1);
|
|
2416
|
+
index(() => (QD.current = !0, () => {
|
|
2417
|
+
QD.current = !1;
|
|
2418
2418
|
}), []), index(() => {
|
|
2419
|
-
if (
|
|
2420
|
-
if (
|
|
2421
|
-
|
|
2419
|
+
if (HD && (WD.current = HD), UD && (GD.current = UD), HD && UD) {
|
|
2420
|
+
if (JD.current) return JD.current(HD, UD, ZD);
|
|
2421
|
+
ZD();
|
|
2422
2422
|
}
|
|
2423
2423
|
}, [
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2424
|
+
HD,
|
|
2425
|
+
UD,
|
|
2426
|
+
ZD,
|
|
2427
|
+
JD,
|
|
2428
|
+
qD
|
|
2429
2429
|
]);
|
|
2430
|
-
let
|
|
2431
|
-
reference:
|
|
2432
|
-
floating:
|
|
2433
|
-
setReference:
|
|
2434
|
-
setFloating:
|
|
2435
|
-
}), [
|
|
2436
|
-
reference:
|
|
2437
|
-
floating:
|
|
2438
|
-
}), [
|
|
2430
|
+
let $D = React$1.useMemo(() => ({
|
|
2431
|
+
reference: WD,
|
|
2432
|
+
floating: GD,
|
|
2433
|
+
setReference: BD,
|
|
2434
|
+
setFloating: VD
|
|
2435
|
+
}), [BD, VD]), eO = React$1.useMemo(() => ({
|
|
2436
|
+
reference: HD,
|
|
2437
|
+
floating: UD
|
|
2438
|
+
}), [HD, UD]), tO = React$1.useMemo(() => {
|
|
2439
2439
|
let s = {
|
|
2440
2440
|
position: w,
|
|
2441
2441
|
left: 0,
|
|
2442
2442
|
top: 0
|
|
2443
2443
|
};
|
|
2444
|
-
if (!
|
|
2445
|
-
let d = roundByDPR(
|
|
2444
|
+
if (!eO.floating) return s;
|
|
2445
|
+
let d = roundByDPR(eO.floating, J.x), C = roundByDPR(eO.floating, J.y);
|
|
2446
2446
|
return U ? {
|
|
2447
2447
|
...s,
|
|
2448
2448
|
transform: "translate(" + d + "px, " + C + "px)",
|
|
2449
|
-
...getDPR(
|
|
2449
|
+
...getDPR(eO.floating) >= 1.5 && { willChange: "transform" }
|
|
2450
2450
|
} : {
|
|
2451
2451
|
position: w,
|
|
2452
2452
|
left: d,
|
|
@@ -2455,22 +2455,22 @@ function useFloating(d) {
|
|
|
2455
2455
|
}, [
|
|
2456
2456
|
w,
|
|
2457
2457
|
U,
|
|
2458
|
-
|
|
2458
|
+
eO.floating,
|
|
2459
2459
|
J.x,
|
|
2460
2460
|
J.y
|
|
2461
2461
|
]);
|
|
2462
2462
|
return React$1.useMemo(() => ({
|
|
2463
2463
|
...J,
|
|
2464
|
-
update:
|
|
2465
|
-
refs:
|
|
2466
|
-
elements:
|
|
2467
|
-
floatingStyles:
|
|
2464
|
+
update: ZD,
|
|
2465
|
+
refs: $D,
|
|
2466
|
+
elements: eO,
|
|
2467
|
+
floatingStyles: tO
|
|
2468
2468
|
}), [
|
|
2469
2469
|
J,
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2470
|
+
ZD,
|
|
2471
|
+
$D,
|
|
2472
|
+
eO,
|
|
2473
|
+
tO
|
|
2474
2474
|
]);
|
|
2475
2475
|
}
|
|
2476
2476
|
var arrow$1$1 = (s) => {
|
|
@@ -2546,71 +2546,71 @@ var ANCHOR_NAME$1 = "PopperAnchor", PopperAnchor = React$1.forwardRef((d, C) =>
|
|
|
2546
2546
|
});
|
|
2547
2547
|
});
|
|
2548
2548
|
PopperAnchor.displayName = ANCHOR_NAME$1;
|
|
2549
|
-
var CONTENT_NAME$
|
|
2550
|
-
let { __scopePopper: w, side: k = "bottom", sideOffset: F = 0, align: L = "center", alignOffset: V = 0, arrowPadding: U = 0, avoidCollisions: K = !0, collisionBoundary: q = [], collisionPadding: J = 0, sticky: X = "partial", hideWhenDetached: $ = !1, updatePositionStrategy:
|
|
2549
|
+
var CONTENT_NAME$3 = "PopperContent", [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$3), PopperContent = React$1.forwardRef((d, C) => {
|
|
2550
|
+
let { __scopePopper: w, side: k = "bottom", sideOffset: F = 0, align: L = "center", alignOffset: V = 0, arrowPadding: U = 0, avoidCollisions: K = !0, collisionBoundary: q = [], collisionPadding: J = 0, sticky: X = "partial", hideWhenDetached: $ = !1, updatePositionStrategy: PD = "optimized", onPlaced: FD, ...ID } = d, LD = usePopperContext(CONTENT_NAME$3, w), [RD, zD] = React$1.useState(null), BD = useComposedRefs(C, (s) => zD(s)), [VD, HD] = React$1.useState(null), UD = useSize(VD), GD = UD?.width ?? 0, KD = UD?.height ?? 0, qD = k + (L === "center" ? "" : "-" + L), JD = typeof J == "number" ? J : {
|
|
2551
2551
|
top: 0,
|
|
2552
2552
|
right: 0,
|
|
2553
2553
|
bottom: 0,
|
|
2554
2554
|
left: 0,
|
|
2555
2555
|
...J
|
|
2556
|
-
},
|
|
2557
|
-
padding:
|
|
2558
|
-
boundary:
|
|
2559
|
-
altBoundary:
|
|
2560
|
-
}, { refs:
|
|
2556
|
+
}, YD = Array.isArray(q) ? q : [q], XD = YD.length > 0, ZD = {
|
|
2557
|
+
padding: JD,
|
|
2558
|
+
boundary: YD.filter(isNotNull$2),
|
|
2559
|
+
altBoundary: XD
|
|
2560
|
+
}, { refs: QD, floatingStyles: $D, placement: eO, isPositioned: tO, middlewareData: nO } = useFloating({
|
|
2561
2561
|
strategy: "fixed",
|
|
2562
|
-
placement:
|
|
2563
|
-
whileElementsMounted: (...s) => autoUpdate(...s, { animationFrame:
|
|
2564
|
-
elements: { reference:
|
|
2562
|
+
placement: qD,
|
|
2563
|
+
whileElementsMounted: (...s) => autoUpdate(...s, { animationFrame: PD === "always" }),
|
|
2564
|
+
elements: { reference: LD.anchor },
|
|
2565
2565
|
middleware: [
|
|
2566
2566
|
offset({
|
|
2567
|
-
mainAxis: F +
|
|
2567
|
+
mainAxis: F + KD,
|
|
2568
2568
|
alignmentAxis: V
|
|
2569
2569
|
}),
|
|
2570
2570
|
K && shift({
|
|
2571
2571
|
mainAxis: !0,
|
|
2572
2572
|
crossAxis: !1,
|
|
2573
2573
|
limiter: X === "partial" ? limitShift() : void 0,
|
|
2574
|
-
...
|
|
2574
|
+
...ZD
|
|
2575
2575
|
}),
|
|
2576
|
-
K && flip({ ...
|
|
2576
|
+
K && flip({ ...ZD }),
|
|
2577
2577
|
size({
|
|
2578
|
-
...
|
|
2578
|
+
...ZD,
|
|
2579
2579
|
apply: ({ elements: s, rects: d, availableWidth: C, availableHeight: w }) => {
|
|
2580
2580
|
let { width: k, height: F } = d.reference, L = s.floating.style;
|
|
2581
2581
|
L.setProperty("--radix-popper-available-width", `${C}px`), L.setProperty("--radix-popper-available-height", `${w}px`), L.setProperty("--radix-popper-anchor-width", `${k}px`), L.setProperty("--radix-popper-anchor-height", `${F}px`);
|
|
2582
2582
|
}
|
|
2583
2583
|
}),
|
|
2584
|
-
|
|
2585
|
-
element:
|
|
2584
|
+
VD && arrow({
|
|
2585
|
+
element: VD,
|
|
2586
2586
|
padding: U
|
|
2587
2587
|
}),
|
|
2588
2588
|
transformOrigin({
|
|
2589
|
-
arrowWidth:
|
|
2590
|
-
arrowHeight:
|
|
2589
|
+
arrowWidth: GD,
|
|
2590
|
+
arrowHeight: KD
|
|
2591
2591
|
}),
|
|
2592
2592
|
$ && hide({
|
|
2593
2593
|
strategy: "referenceHidden",
|
|
2594
|
-
...
|
|
2594
|
+
...ZD
|
|
2595
2595
|
})
|
|
2596
2596
|
]
|
|
2597
|
-
}), [
|
|
2597
|
+
}), [rO, iO] = getSideAndAlignFromPlacement(eO), aO = useCallbackRef(FD);
|
|
2598
2598
|
useLayoutEffect2(() => {
|
|
2599
|
-
|
|
2600
|
-
}, [
|
|
2601
|
-
let
|
|
2599
|
+
tO && aO?.();
|
|
2600
|
+
}, [tO, aO]);
|
|
2601
|
+
let oO = nO.arrow?.x, sO = nO.arrow?.y, cO = nO.arrow?.centerOffset !== 0, [lO, uO] = React$1.useState();
|
|
2602
2602
|
return useLayoutEffect2(() => {
|
|
2603
|
-
|
|
2604
|
-
}, [
|
|
2605
|
-
ref:
|
|
2603
|
+
RD && uO(window.getComputedStyle(RD).zIndex);
|
|
2604
|
+
}, [RD]), /* @__PURE__ */ jsx("div", {
|
|
2605
|
+
ref: QD.setFloating,
|
|
2606
2606
|
"data-radix-popper-content-wrapper": "",
|
|
2607
2607
|
style: {
|
|
2608
|
-
|
|
2609
|
-
transform:
|
|
2608
|
+
...$D,
|
|
2609
|
+
transform: tO ? $D.transform : "translate(0, -200%)",
|
|
2610
2610
|
minWidth: "max-content",
|
|
2611
|
-
zIndex:
|
|
2612
|
-
"--radix-popper-transform-origin": [
|
|
2613
|
-
...
|
|
2611
|
+
zIndex: lO,
|
|
2612
|
+
"--radix-popper-transform-origin": [nO.transformOrigin?.x, nO.transformOrigin?.y].join(" "),
|
|
2613
|
+
...nO.hide?.referenceHidden && {
|
|
2614
2614
|
visibility: "hidden",
|
|
2615
2615
|
pointerEvents: "none"
|
|
2616
2616
|
}
|
|
@@ -2618,32 +2618,32 @@ var CONTENT_NAME$4 = "PopperContent", [PopperContentProvider, useContentContext]
|
|
|
2618
2618
|
dir: d.dir,
|
|
2619
2619
|
children: /* @__PURE__ */ jsx(PopperContentProvider, {
|
|
2620
2620
|
scope: w,
|
|
2621
|
-
placedSide:
|
|
2622
|
-
onArrowChange:
|
|
2623
|
-
arrowX:
|
|
2624
|
-
arrowY:
|
|
2625
|
-
shouldHideArrow:
|
|
2621
|
+
placedSide: rO,
|
|
2622
|
+
onArrowChange: HD,
|
|
2623
|
+
arrowX: oO,
|
|
2624
|
+
arrowY: sO,
|
|
2625
|
+
shouldHideArrow: cO,
|
|
2626
2626
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
2627
|
-
"data-side":
|
|
2628
|
-
"data-align":
|
|
2629
|
-
...
|
|
2630
|
-
ref:
|
|
2627
|
+
"data-side": rO,
|
|
2628
|
+
"data-align": iO,
|
|
2629
|
+
...ID,
|
|
2630
|
+
ref: BD,
|
|
2631
2631
|
style: {
|
|
2632
|
-
...
|
|
2633
|
-
animation:
|
|
2632
|
+
...ID.style,
|
|
2633
|
+
animation: tO ? void 0 : "none"
|
|
2634
2634
|
}
|
|
2635
2635
|
})
|
|
2636
2636
|
})
|
|
2637
2637
|
});
|
|
2638
2638
|
});
|
|
2639
|
-
PopperContent.displayName = CONTENT_NAME$
|
|
2640
|
-
var ARROW_NAME$
|
|
2639
|
+
PopperContent.displayName = CONTENT_NAME$3;
|
|
2640
|
+
var ARROW_NAME$3 = "PopperArrow", OPPOSITE_SIDE = {
|
|
2641
2641
|
top: "bottom",
|
|
2642
2642
|
right: "left",
|
|
2643
2643
|
bottom: "top",
|
|
2644
2644
|
left: "right"
|
|
2645
2645
|
}, PopperArrow = React$1.forwardRef(function(s, d) {
|
|
2646
|
-
let { __scopePopper: C, ...w } = s, k = useContentContext(ARROW_NAME$
|
|
2646
|
+
let { __scopePopper: C, ...w } = s, k = useContentContext(ARROW_NAME$3, C), F = OPPOSITE_SIDE[k.placedSide];
|
|
2647
2647
|
return /* @__PURE__ */ jsx("span", {
|
|
2648
2648
|
ref: k.onArrowChange,
|
|
2649
2649
|
style: {
|
|
@@ -2675,7 +2675,7 @@ var ARROW_NAME$4 = "PopperArrow", OPPOSITE_SIDE = {
|
|
|
2675
2675
|
})
|
|
2676
2676
|
});
|
|
2677
2677
|
});
|
|
2678
|
-
PopperArrow.displayName = ARROW_NAME$
|
|
2678
|
+
PopperArrow.displayName = ARROW_NAME$3;
|
|
2679
2679
|
function isNotNull$2(s) {
|
|
2680
2680
|
return s !== null;
|
|
2681
2681
|
}
|
|
@@ -2687,10 +2687,10 @@ var transformOrigin = (s) => ({
|
|
|
2687
2687
|
start: "0%",
|
|
2688
2688
|
center: "50%",
|
|
2689
2689
|
end: "100%"
|
|
2690
|
-
}[K], J = (k.arrow?.x ?? 0) + L / 2, X = (k.arrow?.y ?? 0) + V / 2, $ = "",
|
|
2691
|
-
return U === "bottom" ? ($ = F ? q : `${J}px`,
|
|
2690
|
+
}[K], J = (k.arrow?.x ?? 0) + L / 2, X = (k.arrow?.y ?? 0) + V / 2, $ = "", PD = "";
|
|
2691
|
+
return U === "bottom" ? ($ = F ? q : `${J}px`, PD = `${-V}px`) : U === "top" ? ($ = F ? q : `${J}px`, PD = `${w.floating.height + V}px`) : U === "right" ? ($ = `${-V}px`, PD = F ? q : `${X}px`) : U === "left" && ($ = `${w.floating.width + V}px`, PD = F ? q : `${X}px`), { data: {
|
|
2692
2692
|
x: $,
|
|
2693
|
-
y:
|
|
2693
|
+
y: PD
|
|
2694
2694
|
} };
|
|
2695
2695
|
}
|
|
2696
2696
|
});
|
|
@@ -2698,10 +2698,10 @@ function getSideAndAlignFromPlacement(s) {
|
|
|
2698
2698
|
let [d, C = "center"] = s.split("-");
|
|
2699
2699
|
return [d, C];
|
|
2700
2700
|
}
|
|
2701
|
-
var Root2$
|
|
2701
|
+
var Root2$1 = Popper, Anchor = PopperAnchor, Content = PopperContent, Arrow = PopperArrow, ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus", EVENT_OPTIONS = {
|
|
2702
2702
|
bubbles: !1,
|
|
2703
2703
|
cancelable: !0
|
|
2704
|
-
}, GROUP_NAME$
|
|
2704
|
+
}, GROUP_NAME$2 = "RovingFocusGroup", [Collection$1, useCollection$1, createCollectionScope$1] = createCollection(GROUP_NAME$2), [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(GROUP_NAME$2, [createCollectionScope$1]), [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME$2), RovingFocusGroup = React$1.forwardRef((s, d) => /* @__PURE__ */ jsx(Collection$1.Provider, {
|
|
2705
2705
|
scope: s.__scopeRovingFocusGroup,
|
|
2706
2706
|
children: /* @__PURE__ */ jsx(Collection$1.Slot, {
|
|
2707
2707
|
scope: s.__scopeRovingFocusGroup,
|
|
@@ -2711,65 +2711,65 @@ var Root2$2 = Popper, Anchor = PopperAnchor, Content = PopperContent, Arrow = Po
|
|
|
2711
2711
|
})
|
|
2712
2712
|
})
|
|
2713
2713
|
}));
|
|
2714
|
-
RovingFocusGroup.displayName = GROUP_NAME$
|
|
2714
|
+
RovingFocusGroup.displayName = GROUP_NAME$2;
|
|
2715
2715
|
var RovingFocusGroupImpl = React$1.forwardRef((d, C) => {
|
|
2716
|
-
let { __scopeRovingFocusGroup: w, orientation: k, loop: F = !1, dir: L, currentTabStopId: V, defaultCurrentTabStopId: U, onCurrentTabStopIdChange: K, onEntryFocus: q, preventScrollOnEntryFocus: J = !1, ...X } = d, $ = React$1.useRef(null),
|
|
2716
|
+
let { __scopeRovingFocusGroup: w, orientation: k, loop: F = !1, dir: L, currentTabStopId: V, defaultCurrentTabStopId: U, onCurrentTabStopIdChange: K, onEntryFocus: q, preventScrollOnEntryFocus: J = !1, ...X } = d, $ = React$1.useRef(null), PD = useComposedRefs(C, $), FD = useDirection(L), [ID, LD] = useControllableState({
|
|
2717
2717
|
prop: V,
|
|
2718
2718
|
defaultProp: U ?? null,
|
|
2719
2719
|
onChange: K,
|
|
2720
|
-
caller: GROUP_NAME$
|
|
2721
|
-
}), [
|
|
2720
|
+
caller: GROUP_NAME$2
|
|
2721
|
+
}), [RD, zD] = React$1.useState(!1), BD = useCallbackRef(q), VD = useCollection$1(w), HD = React$1.useRef(!1), [UD, GD] = React$1.useState(0);
|
|
2722
2722
|
return React$1.useEffect(() => {
|
|
2723
2723
|
let s = $.current;
|
|
2724
|
-
if (s) return s.addEventListener(ENTRY_FOCUS,
|
|
2725
|
-
}, [
|
|
2724
|
+
if (s) return s.addEventListener(ENTRY_FOCUS, BD), () => s.removeEventListener(ENTRY_FOCUS, BD);
|
|
2725
|
+
}, [BD]), /* @__PURE__ */ jsx(RovingFocusProvider, {
|
|
2726
2726
|
scope: w,
|
|
2727
2727
|
orientation: k,
|
|
2728
|
-
dir:
|
|
2728
|
+
dir: FD,
|
|
2729
2729
|
loop: F,
|
|
2730
|
-
currentTabStopId:
|
|
2731
|
-
onItemFocus: React$1.useCallback((s) =>
|
|
2732
|
-
onItemShiftTab: React$1.useCallback(() =>
|
|
2733
|
-
onFocusableItemAdd: React$1.useCallback(() =>
|
|
2734
|
-
onFocusableItemRemove: React$1.useCallback(() =>
|
|
2730
|
+
currentTabStopId: ID,
|
|
2731
|
+
onItemFocus: React$1.useCallback((s) => LD(s), [LD]),
|
|
2732
|
+
onItemShiftTab: React$1.useCallback(() => zD(!0), []),
|
|
2733
|
+
onFocusableItemAdd: React$1.useCallback(() => GD((s) => s + 1), []),
|
|
2734
|
+
onFocusableItemRemove: React$1.useCallback(() => GD((s) => s - 1), []),
|
|
2735
2735
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
2736
|
-
tabIndex:
|
|
2736
|
+
tabIndex: RD || UD === 0 ? -1 : 0,
|
|
2737
2737
|
"data-orientation": k,
|
|
2738
2738
|
...X,
|
|
2739
|
-
ref:
|
|
2739
|
+
ref: PD,
|
|
2740
2740
|
style: {
|
|
2741
2741
|
outline: "none",
|
|
2742
2742
|
...d.style
|
|
2743
2743
|
},
|
|
2744
2744
|
onMouseDown: composeEventHandlers(d.onMouseDown, () => {
|
|
2745
|
-
|
|
2745
|
+
HD.current = !0;
|
|
2746
2746
|
}),
|
|
2747
2747
|
onFocus: composeEventHandlers(d.onFocus, (s) => {
|
|
2748
|
-
let d = !
|
|
2749
|
-
if (s.target === s.currentTarget && d && !
|
|
2748
|
+
let d = !HD.current;
|
|
2749
|
+
if (s.target === s.currentTarget && d && !RD) {
|
|
2750
2750
|
let d = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS);
|
|
2751
2751
|
if (s.currentTarget.dispatchEvent(d), !d.defaultPrevented) {
|
|
2752
|
-
let s =
|
|
2752
|
+
let s = VD().filter((s) => s.focusable);
|
|
2753
2753
|
focusFirst$1([
|
|
2754
2754
|
s.find((s) => s.active),
|
|
2755
|
-
s.find((s) => s.id ===
|
|
2755
|
+
s.find((s) => s.id === ID),
|
|
2756
2756
|
...s
|
|
2757
2757
|
].filter(Boolean).map((s) => s.ref.current), J);
|
|
2758
2758
|
}
|
|
2759
2759
|
}
|
|
2760
|
-
|
|
2760
|
+
HD.current = !1;
|
|
2761
2761
|
}),
|
|
2762
|
-
onBlur: composeEventHandlers(d.onBlur, () =>
|
|
2762
|
+
onBlur: composeEventHandlers(d.onBlur, () => zD(!1))
|
|
2763
2763
|
})
|
|
2764
2764
|
});
|
|
2765
|
-
}), ITEM_NAME$
|
|
2766
|
-
let { __scopeRovingFocusGroup: w, focusable: k = !0, active: F = !1, tabStopId: L, children: V, ...U } = d, K = useId$1(), q = L || K, J = useRovingFocusContext(ITEM_NAME$
|
|
2765
|
+
}), ITEM_NAME$2 = "RovingFocusGroupItem", RovingFocusGroupItem = React$1.forwardRef((d, C) => {
|
|
2766
|
+
let { __scopeRovingFocusGroup: w, focusable: k = !0, active: F = !1, tabStopId: L, children: V, ...U } = d, K = useId$1(), q = L || K, J = useRovingFocusContext(ITEM_NAME$2, w), X = J.currentTabStopId === q, $ = useCollection$1(w), { onFocusableItemAdd: PD, onFocusableItemRemove: FD, currentTabStopId: ID } = J;
|
|
2767
2767
|
return React$1.useEffect(() => {
|
|
2768
|
-
if (k) return
|
|
2768
|
+
if (k) return PD(), () => FD();
|
|
2769
2769
|
}, [
|
|
2770
2770
|
k,
|
|
2771
|
-
|
|
2772
|
-
|
|
2771
|
+
PD,
|
|
2772
|
+
FD
|
|
2773
2773
|
]), /* @__PURE__ */ jsx(Collection$1.ItemSlot, {
|
|
2774
2774
|
scope: w,
|
|
2775
2775
|
id: q,
|
|
@@ -2806,12 +2806,12 @@ var RovingFocusGroupImpl = React$1.forwardRef((d, C) => {
|
|
|
2806
2806
|
}),
|
|
2807
2807
|
children: typeof V == "function" ? V({
|
|
2808
2808
|
isCurrentTabStop: X,
|
|
2809
|
-
hasTabStop:
|
|
2809
|
+
hasTabStop: ID != null
|
|
2810
2810
|
}) : V
|
|
2811
2811
|
})
|
|
2812
2812
|
});
|
|
2813
2813
|
});
|
|
2814
|
-
RovingFocusGroupItem.displayName = ITEM_NAME$
|
|
2814
|
+
RovingFocusGroupItem.displayName = ITEM_NAME$2;
|
|
2815
2815
|
var MAP_KEY_TO_FOCUS_INTENT = {
|
|
2816
2816
|
ArrowLeft: "prev",
|
|
2817
2817
|
ArrowUp: "prev",
|
|
@@ -2869,7 +2869,7 @@ var Root$1 = RovingFocusGroup, Item = RovingFocusGroupItem, SELECTION_KEYS = ["E
|
|
|
2869
2869
|
return document.addEventListener("keydown", s, { capture: !0 }), () => {
|
|
2870
2870
|
document.removeEventListener("keydown", s, { capture: !0 }), document.removeEventListener("pointerdown", d, { capture: !0 }), document.removeEventListener("pointermove", d, { capture: !0 });
|
|
2871
2871
|
};
|
|
2872
|
-
}, []), /* @__PURE__ */ jsx(Root2$
|
|
2872
|
+
}, []), /* @__PURE__ */ jsx(Root2$1, {
|
|
2873
2873
|
...U,
|
|
2874
2874
|
children: /* @__PURE__ */ jsx(MenuProvider, {
|
|
2875
2875
|
scope: C,
|
|
@@ -2898,8 +2898,8 @@ var ANCHOR_NAME = "MenuAnchor", MenuAnchor = React$1.forwardRef((s, d) => {
|
|
|
2898
2898
|
});
|
|
2899
2899
|
});
|
|
2900
2900
|
MenuAnchor.displayName = ANCHOR_NAME;
|
|
2901
|
-
var PORTAL_NAME$
|
|
2902
|
-
let { __scopeMenu: d, forceMount: C, children: w, container: k } = s, F = useMenuContext(PORTAL_NAME$
|
|
2901
|
+
var PORTAL_NAME$2 = "MenuPortal", [PortalProvider$1, usePortalContext$1] = createMenuContext(PORTAL_NAME$2, { forceMount: void 0 }), MenuPortal = (s) => {
|
|
2902
|
+
let { __scopeMenu: d, forceMount: C, children: w, container: k } = s, F = useMenuContext(PORTAL_NAME$2, d);
|
|
2903
2903
|
return /* @__PURE__ */ jsx(PortalProvider$1, {
|
|
2904
2904
|
scope: d,
|
|
2905
2905
|
forceMount: C,
|
|
@@ -2913,9 +2913,9 @@ var PORTAL_NAME$3 = "MenuPortal", [PortalProvider$1, usePortalContext$1] = creat
|
|
|
2913
2913
|
})
|
|
2914
2914
|
});
|
|
2915
2915
|
};
|
|
2916
|
-
MenuPortal.displayName = PORTAL_NAME$
|
|
2917
|
-
var CONTENT_NAME$
|
|
2918
|
-
let C = usePortalContext$1(CONTENT_NAME$
|
|
2916
|
+
MenuPortal.displayName = PORTAL_NAME$2;
|
|
2917
|
+
var CONTENT_NAME$2 = "MenuContent", [MenuContentProvider, useMenuContentContext] = createMenuContext(CONTENT_NAME$2), MenuContent = React$1.forwardRef((s, d) => {
|
|
2918
|
+
let C = usePortalContext$1(CONTENT_NAME$2, s.__scopeMenu), { forceMount: w = C.forceMount, ...k } = s, F = useMenuContext(CONTENT_NAME$2, s.__scopeMenu), L = useMenuRootContext(CONTENT_NAME$2, s.__scopeMenu);
|
|
2919
2919
|
return /* @__PURE__ */ jsx(Collection.Provider, {
|
|
2920
2920
|
scope: s.__scopeMenu,
|
|
2921
2921
|
children: /* @__PURE__ */ jsx(Presence, {
|
|
@@ -2933,7 +2933,7 @@ var CONTENT_NAME$3 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
2933
2933
|
})
|
|
2934
2934
|
});
|
|
2935
2935
|
}), MenuRootContentModal = React$1.forwardRef((d, C) => {
|
|
2936
|
-
let w = useMenuContext(CONTENT_NAME$
|
|
2936
|
+
let w = useMenuContext(CONTENT_NAME$2, d.__scopeMenu), k = React$1.useRef(null), F = useComposedRefs(C, k);
|
|
2937
2937
|
return React$1.useEffect(() => {
|
|
2938
2938
|
let s = k.current;
|
|
2939
2939
|
if (s) return hideOthers(s);
|
|
@@ -2947,7 +2947,7 @@ var CONTENT_NAME$3 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
2947
2947
|
onDismiss: () => w.onOpenChange(!1)
|
|
2948
2948
|
});
|
|
2949
2949
|
}), MenuRootContentNonModal = React$1.forwardRef((s, d) => {
|
|
2950
|
-
let C = useMenuContext(CONTENT_NAME$
|
|
2950
|
+
let C = useMenuContext(CONTENT_NAME$2, s.__scopeMenu);
|
|
2951
2951
|
return /* @__PURE__ */ jsx(MenuContentImpl, {
|
|
2952
2952
|
...s,
|
|
2953
2953
|
ref: d,
|
|
@@ -2957,40 +2957,40 @@ var CONTENT_NAME$3 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
2957
2957
|
onDismiss: () => C.onOpenChange(!1)
|
|
2958
2958
|
});
|
|
2959
2959
|
}), Slot = /* @__PURE__ */ createSlot("MenuContent.ScrollLock"), MenuContentImpl = React$1.forwardRef((d, C) => {
|
|
2960
|
-
let { __scopeMenu: w, loop: k = !1, trapFocus: F, onOpenAutoFocus: L, onCloseAutoFocus: V, disableOutsidePointerEvents: U, onEntryFocus: K, onEscapeKeyDown: q, onPointerDownOutside: J, onFocusOutside: X, onInteractOutside: $, onDismiss:
|
|
2960
|
+
let { __scopeMenu: w, loop: k = !1, trapFocus: F, onOpenAutoFocus: L, onCloseAutoFocus: V, disableOutsidePointerEvents: U, onEntryFocus: K, onEscapeKeyDown: q, onPointerDownOutside: J, onFocusOutside: X, onInteractOutside: $, onDismiss: PD, disableOutsideScroll: FD, ...ID } = d, LD = useMenuContext(CONTENT_NAME$2, w), RD = useMenuRootContext(CONTENT_NAME$2, w), zD = usePopperScope$1(w), BD = useRovingFocusGroupScope(w), VD = useCollection(w), [HD, UD] = React$1.useState(null), GD = React$1.useRef(null), KD = useComposedRefs(C, GD, LD.onContentChange), qD = React$1.useRef(0), JD = React$1.useRef(""), YD = React$1.useRef(0), XD = React$1.useRef(null), ZD = React$1.useRef("right"), QD = React$1.useRef(0), $D = FD ? Combination_default : React$1.Fragment, eO = FD ? {
|
|
2961
2961
|
as: Slot,
|
|
2962
2962
|
allowPinchZoom: !0
|
|
2963
|
-
} : void 0,
|
|
2964
|
-
let d =
|
|
2963
|
+
} : void 0, tO = (s) => {
|
|
2964
|
+
let d = JD.current + s, C = VD().filter((s) => !s.disabled), w = document.activeElement, k = C.find((s) => s.ref.current === w)?.textValue, F = getNextMatch(C.map((s) => s.textValue), d, k), L = C.find((s) => s.textValue === F)?.ref.current;
|
|
2965
2965
|
(function s(d) {
|
|
2966
|
-
|
|
2966
|
+
JD.current = d, window.clearTimeout(qD.current), d !== "" && (qD.current = window.setTimeout(() => s(""), 1e3));
|
|
2967
2967
|
})(d), L && setTimeout(() => L.focus());
|
|
2968
2968
|
};
|
|
2969
|
-
React$1.useEffect(() => () => window.clearTimeout(
|
|
2970
|
-
let
|
|
2969
|
+
React$1.useEffect(() => () => window.clearTimeout(qD.current), []), useFocusGuards();
|
|
2970
|
+
let nO = React$1.useCallback((s) => ZD.current === XD.current?.side && isPointerInGraceArea(s, XD.current?.area), []);
|
|
2971
2971
|
return /* @__PURE__ */ jsx(MenuContentProvider, {
|
|
2972
2972
|
scope: w,
|
|
2973
|
-
searchRef:
|
|
2973
|
+
searchRef: JD,
|
|
2974
2974
|
onItemEnter: React$1.useCallback((s) => {
|
|
2975
|
-
|
|
2976
|
-
}, [
|
|
2975
|
+
nO(s) && s.preventDefault();
|
|
2976
|
+
}, [nO]),
|
|
2977
2977
|
onItemLeave: React$1.useCallback((s) => {
|
|
2978
|
-
|
|
2979
|
-
}, [
|
|
2978
|
+
nO(s) || (GD.current?.focus(), UD(null));
|
|
2979
|
+
}, [nO]),
|
|
2980
2980
|
onTriggerLeave: React$1.useCallback((s) => {
|
|
2981
|
-
|
|
2982
|
-
}, [
|
|
2983
|
-
pointerGraceTimerRef:
|
|
2981
|
+
nO(s) && s.preventDefault();
|
|
2982
|
+
}, [nO]),
|
|
2983
|
+
pointerGraceTimerRef: YD,
|
|
2984
2984
|
onPointerGraceIntentChange: React$1.useCallback((s) => {
|
|
2985
|
-
|
|
2985
|
+
XD.current = s;
|
|
2986
2986
|
}, []),
|
|
2987
|
-
children: /* @__PURE__ */ jsx(
|
|
2988
|
-
...
|
|
2987
|
+
children: /* @__PURE__ */ jsx($D, {
|
|
2988
|
+
...eO,
|
|
2989
2989
|
children: /* @__PURE__ */ jsx(FocusScope, {
|
|
2990
2990
|
asChild: !0,
|
|
2991
2991
|
trapped: F,
|
|
2992
2992
|
onMountAutoFocus: composeEventHandlers(L, (s) => {
|
|
2993
|
-
s.preventDefault(),
|
|
2993
|
+
s.preventDefault(), GD.current?.focus({ preventScroll: !0 });
|
|
2994
2994
|
}),
|
|
2995
2995
|
onUnmountAutoFocus: V,
|
|
2996
2996
|
children: /* @__PURE__ */ jsx(DismissableLayer, {
|
|
@@ -3000,47 +3000,47 @@ var CONTENT_NAME$3 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3000
3000
|
onPointerDownOutside: J,
|
|
3001
3001
|
onFocusOutside: X,
|
|
3002
3002
|
onInteractOutside: $,
|
|
3003
|
-
onDismiss:
|
|
3003
|
+
onDismiss: PD,
|
|
3004
3004
|
children: /* @__PURE__ */ jsx(Root$1, {
|
|
3005
3005
|
asChild: !0,
|
|
3006
|
-
...
|
|
3007
|
-
dir:
|
|
3006
|
+
...BD,
|
|
3007
|
+
dir: RD.dir,
|
|
3008
3008
|
orientation: "vertical",
|
|
3009
3009
|
loop: k,
|
|
3010
|
-
currentTabStopId:
|
|
3011
|
-
onCurrentTabStopIdChange:
|
|
3010
|
+
currentTabStopId: HD,
|
|
3011
|
+
onCurrentTabStopIdChange: UD,
|
|
3012
3012
|
onEntryFocus: composeEventHandlers(K, (s) => {
|
|
3013
|
-
|
|
3013
|
+
RD.isUsingKeyboardRef.current || s.preventDefault();
|
|
3014
3014
|
}),
|
|
3015
3015
|
preventScrollOnEntryFocus: !0,
|
|
3016
3016
|
children: /* @__PURE__ */ jsx(Content, {
|
|
3017
3017
|
role: "menu",
|
|
3018
3018
|
"aria-orientation": "vertical",
|
|
3019
|
-
"data-state": getOpenState(
|
|
3019
|
+
"data-state": getOpenState(LD.open),
|
|
3020
3020
|
"data-radix-menu-content": "",
|
|
3021
|
-
dir:
|
|
3022
|
-
...
|
|
3023
|
-
...
|
|
3024
|
-
ref:
|
|
3021
|
+
dir: RD.dir,
|
|
3022
|
+
...zD,
|
|
3023
|
+
...ID,
|
|
3024
|
+
ref: KD,
|
|
3025
3025
|
style: {
|
|
3026
3026
|
outline: "none",
|
|
3027
|
-
...
|
|
3027
|
+
...ID.style
|
|
3028
3028
|
},
|
|
3029
|
-
onKeyDown: composeEventHandlers(
|
|
3029
|
+
onKeyDown: composeEventHandlers(ID.onKeyDown, (s) => {
|
|
3030
3030
|
let d = s.target.closest("[data-radix-menu-content]") === s.currentTarget, C = s.ctrlKey || s.altKey || s.metaKey, w = s.key.length === 1;
|
|
3031
|
-
d && (s.key === "Tab" && s.preventDefault(), !C && w &&
|
|
3032
|
-
let k =
|
|
3031
|
+
d && (s.key === "Tab" && s.preventDefault(), !C && w && tO(s.key));
|
|
3032
|
+
let k = GD.current;
|
|
3033
3033
|
if (s.target !== k || !FIRST_LAST_KEYS.includes(s.key)) return;
|
|
3034
3034
|
s.preventDefault();
|
|
3035
|
-
let F =
|
|
3035
|
+
let F = VD().filter((s) => !s.disabled).map((s) => s.ref.current);
|
|
3036
3036
|
LAST_KEYS.includes(s.key) && F.reverse(), focusFirst(F);
|
|
3037
3037
|
}),
|
|
3038
3038
|
onBlur: composeEventHandlers(d.onBlur, (s) => {
|
|
3039
|
-
s.currentTarget.contains(s.target) || (window.clearTimeout(
|
|
3039
|
+
s.currentTarget.contains(s.target) || (window.clearTimeout(qD.current), JD.current = "");
|
|
3040
3040
|
}),
|
|
3041
3041
|
onPointerMove: composeEventHandlers(d.onPointerMove, whenMouse((s) => {
|
|
3042
|
-
let d = s.target, C =
|
|
3043
|
-
s.currentTarget.contains(d) && C && (
|
|
3042
|
+
let d = s.target, C = QD.current !== s.clientX;
|
|
3043
|
+
s.currentTarget.contains(d) && C && (ZD.current = s.clientX > QD.current ? "right" : "left", QD.current = s.clientX);
|
|
3044
3044
|
}))
|
|
3045
3045
|
})
|
|
3046
3046
|
})
|
|
@@ -3049,8 +3049,8 @@ var CONTENT_NAME$3 = "MenuContent", [MenuContentProvider, useMenuContentContext]
|
|
|
3049
3049
|
})
|
|
3050
3050
|
});
|
|
3051
3051
|
});
|
|
3052
|
-
MenuContent.displayName = CONTENT_NAME$
|
|
3053
|
-
var GROUP_NAME$
|
|
3052
|
+
MenuContent.displayName = CONTENT_NAME$2;
|
|
3053
|
+
var GROUP_NAME$1 = "MenuGroup", MenuGroup = React$1.forwardRef((s, d) => {
|
|
3054
3054
|
let { __scopeMenu: C, ...w } = s;
|
|
3055
3055
|
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
3056
3056
|
role: "group",
|
|
@@ -3058,17 +3058,17 @@ var GROUP_NAME$2 = "MenuGroup", MenuGroup = React$1.forwardRef((s, d) => {
|
|
|
3058
3058
|
ref: d
|
|
3059
3059
|
});
|
|
3060
3060
|
});
|
|
3061
|
-
MenuGroup.displayName = GROUP_NAME$
|
|
3062
|
-
var LABEL_NAME$
|
|
3061
|
+
MenuGroup.displayName = GROUP_NAME$1;
|
|
3062
|
+
var LABEL_NAME$1 = "MenuLabel", MenuLabel = React$1.forwardRef((s, d) => {
|
|
3063
3063
|
let { __scopeMenu: C, ...w } = s;
|
|
3064
3064
|
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
3065
3065
|
...w,
|
|
3066
3066
|
ref: d
|
|
3067
3067
|
});
|
|
3068
3068
|
});
|
|
3069
|
-
MenuLabel.displayName = LABEL_NAME$
|
|
3070
|
-
var ITEM_NAME$
|
|
3071
|
-
let { disabled: w = !1, onSelect: k, ...F } = d, L = React$1.useRef(null), V = useMenuRootContext(ITEM_NAME$
|
|
3069
|
+
MenuLabel.displayName = LABEL_NAME$1;
|
|
3070
|
+
var ITEM_NAME$1 = "MenuItem", ITEM_SELECT = "menu.itemSelect", MenuItem$1 = React$1.forwardRef((d, C) => {
|
|
3071
|
+
let { disabled: w = !1, onSelect: k, ...F } = d, L = React$1.useRef(null), V = useMenuRootContext(ITEM_NAME$1, d.__scopeMenu), U = useMenuContentContext(ITEM_NAME$1, d.__scopeMenu), K = useComposedRefs(C, L), q = React$1.useRef(!1), J = () => {
|
|
3072
3072
|
let s = L.current;
|
|
3073
3073
|
if (!w && s) {
|
|
3074
3074
|
let d = new CustomEvent(ITEM_SELECT, {
|
|
@@ -3095,12 +3095,12 @@ var ITEM_NAME$2 = "MenuItem", ITEM_SELECT = "menu.itemSelect", MenuItem = React$
|
|
|
3095
3095
|
})
|
|
3096
3096
|
});
|
|
3097
3097
|
});
|
|
3098
|
-
MenuItem.displayName = ITEM_NAME$
|
|
3098
|
+
MenuItem$1.displayName = ITEM_NAME$1;
|
|
3099
3099
|
var MenuItemImpl = React$1.forwardRef((d, C) => {
|
|
3100
|
-
let { __scopeMenu: w, disabled: k = !1, textValue: F, ...L } = d, V = useMenuContentContext(ITEM_NAME$
|
|
3100
|
+
let { __scopeMenu: w, disabled: k = !1, textValue: F, ...L } = d, V = useMenuContentContext(ITEM_NAME$1, w), U = useRovingFocusGroupScope(w), K = React$1.useRef(null), q = useComposedRefs(C, K), [J, X] = React$1.useState(!1), [$, PD] = React$1.useState("");
|
|
3101
3101
|
return React$1.useEffect(() => {
|
|
3102
3102
|
let s = K.current;
|
|
3103
|
-
s &&
|
|
3103
|
+
s && PD((s.textContent ?? "").trim());
|
|
3104
3104
|
}, [L.children]), /* @__PURE__ */ jsx(Collection.ItemSlot, {
|
|
3105
3105
|
scope: w,
|
|
3106
3106
|
disabled: k,
|
|
@@ -3125,12 +3125,12 @@ var MenuItemImpl = React$1.forwardRef((d, C) => {
|
|
|
3125
3125
|
})
|
|
3126
3126
|
})
|
|
3127
3127
|
});
|
|
3128
|
-
}), CHECKBOX_ITEM_NAME$
|
|
3128
|
+
}), CHECKBOX_ITEM_NAME$1 = "MenuCheckboxItem", MenuCheckboxItem = React$1.forwardRef((s, d) => {
|
|
3129
3129
|
let { checked: C = !1, onCheckedChange: w, ...k } = s;
|
|
3130
3130
|
return /* @__PURE__ */ jsx(ItemIndicatorProvider, {
|
|
3131
3131
|
scope: s.__scopeMenu,
|
|
3132
3132
|
checked: C,
|
|
3133
|
-
children: /* @__PURE__ */ jsx(MenuItem, {
|
|
3133
|
+
children: /* @__PURE__ */ jsx(MenuItem$1, {
|
|
3134
3134
|
role: "menuitemcheckbox",
|
|
3135
3135
|
"aria-checked": isIndeterminate(C) ? "mixed" : C,
|
|
3136
3136
|
...k,
|
|
@@ -3140,8 +3140,8 @@ var MenuItemImpl = React$1.forwardRef((d, C) => {
|
|
|
3140
3140
|
})
|
|
3141
3141
|
});
|
|
3142
3142
|
});
|
|
3143
|
-
MenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME$
|
|
3144
|
-
var RADIO_GROUP_NAME$
|
|
3143
|
+
MenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME$1;
|
|
3144
|
+
var RADIO_GROUP_NAME$1 = "MenuRadioGroup", [RadioGroupProvider, useRadioGroupContext] = createMenuContext(RADIO_GROUP_NAME$1, {
|
|
3145
3145
|
value: void 0,
|
|
3146
3146
|
onValueChange: () => {}
|
|
3147
3147
|
}), MenuRadioGroup = React$1.forwardRef((s, d) => {
|
|
@@ -3156,13 +3156,13 @@ var RADIO_GROUP_NAME$2 = "MenuRadioGroup", [RadioGroupProvider, useRadioGroupCon
|
|
|
3156
3156
|
})
|
|
3157
3157
|
});
|
|
3158
3158
|
});
|
|
3159
|
-
MenuRadioGroup.displayName = RADIO_GROUP_NAME$
|
|
3160
|
-
var RADIO_ITEM_NAME$
|
|
3161
|
-
let { value: C, ...w } = s, k = useRadioGroupContext(RADIO_ITEM_NAME$
|
|
3159
|
+
MenuRadioGroup.displayName = RADIO_GROUP_NAME$1;
|
|
3160
|
+
var RADIO_ITEM_NAME$1 = "MenuRadioItem", MenuRadioItem = React$1.forwardRef((s, d) => {
|
|
3161
|
+
let { value: C, ...w } = s, k = useRadioGroupContext(RADIO_ITEM_NAME$1, s.__scopeMenu), F = C === k.value;
|
|
3162
3162
|
return /* @__PURE__ */ jsx(ItemIndicatorProvider, {
|
|
3163
3163
|
scope: s.__scopeMenu,
|
|
3164
3164
|
checked: F,
|
|
3165
|
-
children: /* @__PURE__ */ jsx(MenuItem, {
|
|
3165
|
+
children: /* @__PURE__ */ jsx(MenuItem$1, {
|
|
3166
3166
|
role: "menuitemradio",
|
|
3167
3167
|
"aria-checked": F,
|
|
3168
3168
|
...w,
|
|
@@ -3172,7 +3172,7 @@ var RADIO_ITEM_NAME$2 = "MenuRadioItem", MenuRadioItem = React$1.forwardRef((s,
|
|
|
3172
3172
|
})
|
|
3173
3173
|
});
|
|
3174
3174
|
});
|
|
3175
|
-
MenuRadioItem.displayName = RADIO_ITEM_NAME$
|
|
3175
|
+
MenuRadioItem.displayName = RADIO_ITEM_NAME$1;
|
|
3176
3176
|
var ITEM_INDICATOR_NAME = "MenuItemIndicator", [ItemIndicatorProvider, useItemIndicatorContext] = createMenuContext(ITEM_INDICATOR_NAME, { checked: !1 }), MenuItemIndicator = React$1.forwardRef((s, d) => {
|
|
3177
3177
|
let { __scopeMenu: C, forceMount: w, ...k } = s, F = useItemIndicatorContext(ITEM_INDICATOR_NAME, C);
|
|
3178
3178
|
return /* @__PURE__ */ jsx(Presence, {
|
|
@@ -3185,7 +3185,7 @@ var ITEM_INDICATOR_NAME = "MenuItemIndicator", [ItemIndicatorProvider, useItemIn
|
|
|
3185
3185
|
});
|
|
3186
3186
|
});
|
|
3187
3187
|
MenuItemIndicator.displayName = ITEM_INDICATOR_NAME;
|
|
3188
|
-
var SEPARATOR_NAME$
|
|
3188
|
+
var SEPARATOR_NAME$1 = "MenuSeparator", MenuSeparator$1 = React$1.forwardRef((s, d) => {
|
|
3189
3189
|
let { __scopeMenu: C, ...w } = s;
|
|
3190
3190
|
return /* @__PURE__ */ jsx(Primitive.div, {
|
|
3191
3191
|
role: "separator",
|
|
@@ -3194,8 +3194,8 @@ var SEPARATOR_NAME$2 = "MenuSeparator", MenuSeparator = React$1.forwardRef((s, d
|
|
|
3194
3194
|
ref: d
|
|
3195
3195
|
});
|
|
3196
3196
|
});
|
|
3197
|
-
MenuSeparator.displayName = SEPARATOR_NAME$
|
|
3198
|
-
var ARROW_NAME$
|
|
3197
|
+
MenuSeparator$1.displayName = SEPARATOR_NAME$1;
|
|
3198
|
+
var ARROW_NAME$2 = "MenuArrow", MenuArrow = React$1.forwardRef((s, d) => {
|
|
3199
3199
|
let { __scopeMenu: C, ...w } = s;
|
|
3200
3200
|
return /* @__PURE__ */ jsx(Arrow, {
|
|
3201
3201
|
...usePopperScope$1(C),
|
|
@@ -3203,10 +3203,10 @@ var ARROW_NAME$3 = "MenuArrow", MenuArrow = React$1.forwardRef((s, d) => {
|
|
|
3203
3203
|
ref: d
|
|
3204
3204
|
});
|
|
3205
3205
|
});
|
|
3206
|
-
MenuArrow.displayName = ARROW_NAME$
|
|
3207
|
-
var SUB_NAME
|
|
3208
|
-
let { __scopeMenu: C, children: w, open: k = !1, onOpenChange: F } = d, L = useMenuContext(SUB_NAME
|
|
3209
|
-
return React$1.useEffect(() => (L.open === !1 && X(!1), () => X(!1)), [L.open, X]), /* @__PURE__ */ jsx(Root2$
|
|
3206
|
+
MenuArrow.displayName = ARROW_NAME$2;
|
|
3207
|
+
var SUB_NAME = "MenuSub", [MenuSubProvider, useMenuSubContext] = createMenuContext(SUB_NAME), MenuSub = (d) => {
|
|
3208
|
+
let { __scopeMenu: C, children: w, open: k = !1, onOpenChange: F } = d, L = useMenuContext(SUB_NAME, C), V = usePopperScope$1(C), [U, K] = React$1.useState(null), [q, J] = React$1.useState(null), X = useCallbackRef(F);
|
|
3209
|
+
return React$1.useEffect(() => (L.open === !1 && X(!1), () => X(!1)), [L.open, X]), /* @__PURE__ */ jsx(Root2$1, {
|
|
3210
3210
|
...V,
|
|
3211
3211
|
children: /* @__PURE__ */ jsx(MenuProvider, {
|
|
3212
3212
|
scope: C,
|
|
@@ -3225,9 +3225,9 @@ var SUB_NAME$1 = "MenuSub", [MenuSubProvider, useMenuSubContext] = createMenuCon
|
|
|
3225
3225
|
})
|
|
3226
3226
|
});
|
|
3227
3227
|
};
|
|
3228
|
-
MenuSub.displayName = SUB_NAME
|
|
3229
|
-
var SUB_TRIGGER_NAME$
|
|
3230
|
-
let w = useMenuContext(SUB_TRIGGER_NAME$
|
|
3228
|
+
MenuSub.displayName = SUB_NAME;
|
|
3229
|
+
var SUB_TRIGGER_NAME$1 = "MenuSubTrigger", MenuSubTrigger = React$1.forwardRef((d, C) => {
|
|
3230
|
+
let w = useMenuContext(SUB_TRIGGER_NAME$1, d.__scopeMenu), k = useMenuRootContext(SUB_TRIGGER_NAME$1, d.__scopeMenu), F = useMenuSubContext(SUB_TRIGGER_NAME$1, d.__scopeMenu), L = useMenuContentContext(SUB_TRIGGER_NAME$1, d.__scopeMenu), V = React$1.useRef(null), { pointerGraceTimerRef: U, onPointerGraceIntentChange: K } = L, q = { __scopeMenu: d.__scopeMenu }, J = React$1.useCallback(() => {
|
|
3231
3231
|
V.current && window.clearTimeout(V.current), V.current = null;
|
|
3232
3232
|
}, []);
|
|
3233
3233
|
return React$1.useEffect(() => J, [J]), React$1.useEffect(() => {
|
|
@@ -3296,9 +3296,9 @@ var SUB_TRIGGER_NAME$2 = "MenuSubTrigger", MenuSubTrigger = React$1.forwardRef((
|
|
|
3296
3296
|
})
|
|
3297
3297
|
});
|
|
3298
3298
|
});
|
|
3299
|
-
MenuSubTrigger.displayName = SUB_TRIGGER_NAME$
|
|
3300
|
-
var SUB_CONTENT_NAME$
|
|
3301
|
-
let w = usePortalContext$1(CONTENT_NAME$
|
|
3299
|
+
MenuSubTrigger.displayName = SUB_TRIGGER_NAME$1;
|
|
3300
|
+
var SUB_CONTENT_NAME$1 = "MenuSubContent", MenuSubContent = React$1.forwardRef((d, C) => {
|
|
3301
|
+
let w = usePortalContext$1(CONTENT_NAME$2, d.__scopeMenu), { forceMount: k = w.forceMount, ...F } = d, L = useMenuContext(CONTENT_NAME$2, d.__scopeMenu), V = useMenuRootContext(CONTENT_NAME$2, d.__scopeMenu), U = useMenuSubContext(SUB_CONTENT_NAME$1, d.__scopeMenu), K = React$1.useRef(null), q = useComposedRefs(C, K);
|
|
3302
3302
|
return /* @__PURE__ */ jsx(Collection.Provider, {
|
|
3303
3303
|
scope: d.__scopeMenu,
|
|
3304
3304
|
children: /* @__PURE__ */ jsx(Presence, {
|
|
@@ -3334,7 +3334,7 @@ var SUB_CONTENT_NAME$2 = "MenuSubContent", MenuSubContent = React$1.forwardRef((
|
|
|
3334
3334
|
})
|
|
3335
3335
|
});
|
|
3336
3336
|
});
|
|
3337
|
-
MenuSubContent.displayName = SUB_CONTENT_NAME$
|
|
3337
|
+
MenuSubContent.displayName = SUB_CONTENT_NAME$1;
|
|
3338
3338
|
function getOpenState(s) {
|
|
3339
3339
|
return s ? "open" : "closed";
|
|
3340
3340
|
}
|
|
@@ -3374,224 +3374,7 @@ function isPointerInGraceArea(s, d) {
|
|
|
3374
3374
|
function whenMouse(s) {
|
|
3375
3375
|
return (d) => d.pointerType === "mouse" ? s(d) : void 0;
|
|
3376
3376
|
}
|
|
3377
|
-
var Root3 = Menu, Anchor2 = MenuAnchor, Portal$1 = MenuPortal, Content2$
|
|
3378
|
-
let { __scopeContextMenu: C, children: w, onOpenChange: k, dir: F, modal: L = !0 } = d, [V, U] = React$1.useState(!1), K = useMenuScope$1(C), q = useCallbackRef(k), J = React$1.useCallback((s) => {
|
|
3379
|
-
U(s), q(s);
|
|
3380
|
-
}, [q]);
|
|
3381
|
-
return /* @__PURE__ */ jsx(ContextMenuProvider, {
|
|
3382
|
-
scope: C,
|
|
3383
|
-
open: V,
|
|
3384
|
-
onOpenChange: J,
|
|
3385
|
-
modal: L,
|
|
3386
|
-
children: /* @__PURE__ */ jsx(Root3, {
|
|
3387
|
-
...K,
|
|
3388
|
-
dir: F,
|
|
3389
|
-
open: V,
|
|
3390
|
-
onOpenChange: J,
|
|
3391
|
-
modal: L,
|
|
3392
|
-
children: w
|
|
3393
|
-
})
|
|
3394
|
-
});
|
|
3395
|
-
};
|
|
3396
|
-
ContextMenu.displayName = CONTEXT_MENU_NAME;
|
|
3397
|
-
var TRIGGER_NAME$2 = "ContextMenuTrigger", ContextMenuTrigger = React$1.forwardRef((d, C) => {
|
|
3398
|
-
let { __scopeContextMenu: w, disabled: k = !1, ...F } = d, L = useContextMenuContext(TRIGGER_NAME$2, w), V = useMenuScope$1(w), U = React$1.useRef({
|
|
3399
|
-
x: 0,
|
|
3400
|
-
y: 0
|
|
3401
|
-
}), K = React$1.useRef({ getBoundingClientRect: () => DOMRect.fromRect({
|
|
3402
|
-
width: 0,
|
|
3403
|
-
height: 0,
|
|
3404
|
-
...U.current
|
|
3405
|
-
}) }), q = React$1.useRef(0), J = React$1.useCallback(() => window.clearTimeout(q.current), []), X = (s) => {
|
|
3406
|
-
U.current = {
|
|
3407
|
-
x: s.clientX,
|
|
3408
|
-
y: s.clientY
|
|
3409
|
-
}, L.onOpenChange(!0);
|
|
3410
|
-
};
|
|
3411
|
-
return React$1.useEffect(() => J, [J]), React$1.useEffect(() => void (k && J()), [k, J]), /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Anchor2, {
|
|
3412
|
-
...V,
|
|
3413
|
-
virtualRef: K
|
|
3414
|
-
}), /* @__PURE__ */ jsx(Primitive.span, {
|
|
3415
|
-
"data-state": L.open ? "open" : "closed",
|
|
3416
|
-
"data-disabled": k ? "" : void 0,
|
|
3417
|
-
...F,
|
|
3418
|
-
ref: C,
|
|
3419
|
-
style: {
|
|
3420
|
-
WebkitTouchCallout: "none",
|
|
3421
|
-
...d.style
|
|
3422
|
-
},
|
|
3423
|
-
onContextMenu: k ? d.onContextMenu : composeEventHandlers(d.onContextMenu, (s) => {
|
|
3424
|
-
J(), X(s), s.preventDefault();
|
|
3425
|
-
}),
|
|
3426
|
-
onPointerDown: k ? d.onPointerDown : composeEventHandlers(d.onPointerDown, whenTouchOrPen((s) => {
|
|
3427
|
-
J(), q.current = window.setTimeout(() => X(s), 700);
|
|
3428
|
-
})),
|
|
3429
|
-
onPointerMove: k ? d.onPointerMove : composeEventHandlers(d.onPointerMove, whenTouchOrPen(J)),
|
|
3430
|
-
onPointerCancel: k ? d.onPointerCancel : composeEventHandlers(d.onPointerCancel, whenTouchOrPen(J)),
|
|
3431
|
-
onPointerUp: k ? d.onPointerUp : composeEventHandlers(d.onPointerUp, whenTouchOrPen(J))
|
|
3432
|
-
})] });
|
|
3433
|
-
});
|
|
3434
|
-
ContextMenuTrigger.displayName = TRIGGER_NAME$2;
|
|
3435
|
-
var PORTAL_NAME$2 = "ContextMenuPortal", ContextMenuPortal = (s) => {
|
|
3436
|
-
let { __scopeContextMenu: d, ...C } = s;
|
|
3437
|
-
return /* @__PURE__ */ jsx(Portal$1, {
|
|
3438
|
-
...useMenuScope$1(d),
|
|
3439
|
-
...C
|
|
3440
|
-
});
|
|
3441
|
-
};
|
|
3442
|
-
ContextMenuPortal.displayName = PORTAL_NAME$2;
|
|
3443
|
-
var CONTENT_NAME$2 = "ContextMenuContent", ContextMenuContent = React$1.forwardRef((d, C) => {
|
|
3444
|
-
let { __scopeContextMenu: w, ...k } = d, F = useContextMenuContext(CONTENT_NAME$2, w), L = useMenuScope$1(w), V = React$1.useRef(!1);
|
|
3445
|
-
return /* @__PURE__ */ jsx(Content2$2, {
|
|
3446
|
-
...L,
|
|
3447
|
-
...k,
|
|
3448
|
-
ref: C,
|
|
3449
|
-
side: "right",
|
|
3450
|
-
sideOffset: 2,
|
|
3451
|
-
align: "start",
|
|
3452
|
-
onCloseAutoFocus: (s) => {
|
|
3453
|
-
d.onCloseAutoFocus?.(s), !s.defaultPrevented && V.current && s.preventDefault(), V.current = !1;
|
|
3454
|
-
},
|
|
3455
|
-
onInteractOutside: (s) => {
|
|
3456
|
-
d.onInteractOutside?.(s), !s.defaultPrevented && !F.modal && (V.current = !0);
|
|
3457
|
-
},
|
|
3458
|
-
style: {
|
|
3459
|
-
...d.style,
|
|
3460
|
-
"--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
3461
|
-
"--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
3462
|
-
"--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
3463
|
-
"--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
3464
|
-
"--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
3465
|
-
}
|
|
3466
|
-
});
|
|
3467
|
-
});
|
|
3468
|
-
ContextMenuContent.displayName = CONTENT_NAME$2;
|
|
3469
|
-
var GROUP_NAME$1 = "ContextMenuGroup", ContextMenuGroup = React$1.forwardRef((s, d) => {
|
|
3470
|
-
let { __scopeContextMenu: C, ...w } = s;
|
|
3471
|
-
return /* @__PURE__ */ jsx(Group, {
|
|
3472
|
-
...useMenuScope$1(C),
|
|
3473
|
-
...w,
|
|
3474
|
-
ref: d
|
|
3475
|
-
});
|
|
3476
|
-
});
|
|
3477
|
-
ContextMenuGroup.displayName = GROUP_NAME$1;
|
|
3478
|
-
var LABEL_NAME$1 = "ContextMenuLabel", ContextMenuLabel = React$1.forwardRef((s, d) => {
|
|
3479
|
-
let { __scopeContextMenu: C, ...w } = s;
|
|
3480
|
-
return /* @__PURE__ */ jsx(Label, {
|
|
3481
|
-
...useMenuScope$1(C),
|
|
3482
|
-
...w,
|
|
3483
|
-
ref: d
|
|
3484
|
-
});
|
|
3485
|
-
});
|
|
3486
|
-
ContextMenuLabel.displayName = LABEL_NAME$1;
|
|
3487
|
-
var ITEM_NAME$1 = "ContextMenuItem", ContextMenuItem = React$1.forwardRef((s, d) => {
|
|
3488
|
-
let { __scopeContextMenu: C, ...w } = s;
|
|
3489
|
-
return /* @__PURE__ */ jsx(Item2$2, {
|
|
3490
|
-
...useMenuScope$1(C),
|
|
3491
|
-
...w,
|
|
3492
|
-
ref: d
|
|
3493
|
-
});
|
|
3494
|
-
});
|
|
3495
|
-
ContextMenuItem.displayName = ITEM_NAME$1;
|
|
3496
|
-
var CHECKBOX_ITEM_NAME$1 = "ContextMenuCheckboxItem", ContextMenuCheckboxItem = React$1.forwardRef((s, d) => {
|
|
3497
|
-
let { __scopeContextMenu: C, ...w } = s;
|
|
3498
|
-
return /* @__PURE__ */ jsx(CheckboxItem, {
|
|
3499
|
-
...useMenuScope$1(C),
|
|
3500
|
-
...w,
|
|
3501
|
-
ref: d
|
|
3502
|
-
});
|
|
3503
|
-
});
|
|
3504
|
-
ContextMenuCheckboxItem.displayName = CHECKBOX_ITEM_NAME$1;
|
|
3505
|
-
var RADIO_GROUP_NAME$1 = "ContextMenuRadioGroup", ContextMenuRadioGroup = React$1.forwardRef((s, d) => {
|
|
3506
|
-
let { __scopeContextMenu: C, ...w } = s;
|
|
3507
|
-
return /* @__PURE__ */ jsx(RadioGroup, {
|
|
3508
|
-
...useMenuScope$1(C),
|
|
3509
|
-
...w,
|
|
3510
|
-
ref: d
|
|
3511
|
-
});
|
|
3512
|
-
});
|
|
3513
|
-
ContextMenuRadioGroup.displayName = RADIO_GROUP_NAME$1;
|
|
3514
|
-
var RADIO_ITEM_NAME$1 = "ContextMenuRadioItem", ContextMenuRadioItem = React$1.forwardRef((s, d) => {
|
|
3515
|
-
let { __scopeContextMenu: C, ...w } = s;
|
|
3516
|
-
return /* @__PURE__ */ jsx(RadioItem, {
|
|
3517
|
-
...useMenuScope$1(C),
|
|
3518
|
-
...w,
|
|
3519
|
-
ref: d
|
|
3520
|
-
});
|
|
3521
|
-
});
|
|
3522
|
-
ContextMenuRadioItem.displayName = RADIO_ITEM_NAME$1;
|
|
3523
|
-
var INDICATOR_NAME$1 = "ContextMenuItemIndicator", ContextMenuItemIndicator = React$1.forwardRef((s, d) => {
|
|
3524
|
-
let { __scopeContextMenu: C, ...w } = s;
|
|
3525
|
-
return /* @__PURE__ */ jsx(ItemIndicator, {
|
|
3526
|
-
...useMenuScope$1(C),
|
|
3527
|
-
...w,
|
|
3528
|
-
ref: d
|
|
3529
|
-
});
|
|
3530
|
-
});
|
|
3531
|
-
ContextMenuItemIndicator.displayName = INDICATOR_NAME$1;
|
|
3532
|
-
var SEPARATOR_NAME$1 = "ContextMenuSeparator", ContextMenuSeparator = React$1.forwardRef((s, d) => {
|
|
3533
|
-
let { __scopeContextMenu: C, ...w } = s;
|
|
3534
|
-
return /* @__PURE__ */ jsx(Separator, {
|
|
3535
|
-
...useMenuScope$1(C),
|
|
3536
|
-
...w,
|
|
3537
|
-
ref: d
|
|
3538
|
-
});
|
|
3539
|
-
});
|
|
3540
|
-
ContextMenuSeparator.displayName = SEPARATOR_NAME$1;
|
|
3541
|
-
var ARROW_NAME$2 = "ContextMenuArrow", ContextMenuArrow = React$1.forwardRef((s, d) => {
|
|
3542
|
-
let { __scopeContextMenu: C, ...w } = s;
|
|
3543
|
-
return /* @__PURE__ */ jsx(Arrow2, {
|
|
3544
|
-
...useMenuScope$1(C),
|
|
3545
|
-
...w,
|
|
3546
|
-
ref: d
|
|
3547
|
-
});
|
|
3548
|
-
});
|
|
3549
|
-
ContextMenuArrow.displayName = ARROW_NAME$2;
|
|
3550
|
-
var SUB_NAME = "ContextMenuSub", ContextMenuSub = (s) => {
|
|
3551
|
-
let { __scopeContextMenu: d, children: C, onOpenChange: w, open: k, defaultOpen: F } = s, L = useMenuScope$1(d), [V, U] = useControllableState({
|
|
3552
|
-
prop: k,
|
|
3553
|
-
defaultProp: F ?? !1,
|
|
3554
|
-
onChange: w,
|
|
3555
|
-
caller: SUB_NAME
|
|
3556
|
-
});
|
|
3557
|
-
return /* @__PURE__ */ jsx(Sub, {
|
|
3558
|
-
...L,
|
|
3559
|
-
open: V,
|
|
3560
|
-
onOpenChange: U,
|
|
3561
|
-
children: C
|
|
3562
|
-
});
|
|
3563
|
-
};
|
|
3564
|
-
ContextMenuSub.displayName = SUB_NAME;
|
|
3565
|
-
var SUB_TRIGGER_NAME$1 = "ContextMenuSubTrigger", ContextMenuSubTrigger = React$1.forwardRef((s, d) => {
|
|
3566
|
-
let { __scopeContextMenu: C, ...w } = s;
|
|
3567
|
-
return /* @__PURE__ */ jsx(SubTrigger, {
|
|
3568
|
-
...useMenuScope$1(C),
|
|
3569
|
-
...w,
|
|
3570
|
-
ref: d
|
|
3571
|
-
});
|
|
3572
|
-
});
|
|
3573
|
-
ContextMenuSubTrigger.displayName = SUB_TRIGGER_NAME$1;
|
|
3574
|
-
var SUB_CONTENT_NAME$1 = "ContextMenuSubContent", ContextMenuSubContent = React$1.forwardRef((s, d) => {
|
|
3575
|
-
let { __scopeContextMenu: C, ...w } = s;
|
|
3576
|
-
return /* @__PURE__ */ jsx(SubContent, {
|
|
3577
|
-
...useMenuScope$1(C),
|
|
3578
|
-
...w,
|
|
3579
|
-
ref: d,
|
|
3580
|
-
style: {
|
|
3581
|
-
...s.style,
|
|
3582
|
-
"--radix-context-menu-content-transform-origin": "var(--radix-popper-transform-origin)",
|
|
3583
|
-
"--radix-context-menu-content-available-width": "var(--radix-popper-available-width)",
|
|
3584
|
-
"--radix-context-menu-content-available-height": "var(--radix-popper-available-height)",
|
|
3585
|
-
"--radix-context-menu-trigger-width": "var(--radix-popper-anchor-width)",
|
|
3586
|
-
"--radix-context-menu-trigger-height": "var(--radix-popper-anchor-height)"
|
|
3587
|
-
}
|
|
3588
|
-
});
|
|
3589
|
-
});
|
|
3590
|
-
ContextMenuSubContent.displayName = SUB_CONTENT_NAME$1;
|
|
3591
|
-
function whenTouchOrPen(s) {
|
|
3592
|
-
return (d) => d.pointerType === "mouse" ? void 0 : s(d);
|
|
3593
|
-
}
|
|
3594
|
-
var Root2$1 = ContextMenu, Trigger$1 = ContextMenuTrigger, Portal2$1 = ContextMenuPortal, Content2$1 = ContextMenuContent, Item2$1 = ContextMenuItem, Separator2$1 = ContextMenuSeparator, Sub2$1 = ContextMenuSub, SubTrigger2$1 = ContextMenuSubTrigger, SubContent2$1 = ContextMenuSubContent, DROPDOWN_MENU_NAME = "DropdownMenu", [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [createMenuScope]), useMenuScope = createMenuScope(), [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME), DropdownMenu = (d) => {
|
|
3377
|
+
var Root3 = Menu, Anchor2 = MenuAnchor, Portal$1 = MenuPortal, Content2$1 = MenuContent, Group = MenuGroup, Label = MenuLabel, Item2$1 = MenuItem$1, CheckboxItem = MenuCheckboxItem, RadioGroup = MenuRadioGroup, RadioItem = MenuRadioItem, ItemIndicator = MenuItemIndicator, Separator = MenuSeparator$1, Arrow2 = MenuArrow, Sub = MenuSub, SubTrigger = MenuSubTrigger, SubContent = MenuSubContent, DROPDOWN_MENU_NAME = "DropdownMenu", [createDropdownMenuContext, createDropdownMenuScope] = createContextScope(DROPDOWN_MENU_NAME, [createMenuScope]), useMenuScope = createMenuScope(), [DropdownMenuProvider, useDropdownMenuContext] = createDropdownMenuContext(DROPDOWN_MENU_NAME), DropdownMenu = (d) => {
|
|
3595
3378
|
let { __scopeDropdownMenu: C, children: w, dir: k, open: F, defaultOpen: L, onOpenChange: V, modal: U = !0 } = d, K = useMenuScope(C), q = React$1.useRef(null), [J, X] = useControllableState({
|
|
3596
3379
|
prop: F,
|
|
3597
3380
|
defaultProp: L ?? !1,
|
|
@@ -3658,7 +3441,7 @@ var PORTAL_NAME$1 = "DropdownMenuPortal", DropdownMenuPortal = (s) => {
|
|
|
3658
3441
|
DropdownMenuPortal.displayName = PORTAL_NAME$1;
|
|
3659
3442
|
var CONTENT_NAME$1 = "DropdownMenuContent", DropdownMenuContent = React$1.forwardRef((d, C) => {
|
|
3660
3443
|
let { __scopeDropdownMenu: w, ...k } = d, F = useDropdownMenuContext(CONTENT_NAME$1, w), L = useMenuScope(w), V = React$1.useRef(!1);
|
|
3661
|
-
return /* @__PURE__ */ jsx(Content2$
|
|
3444
|
+
return /* @__PURE__ */ jsx(Content2$1, {
|
|
3662
3445
|
id: F.contentId,
|
|
3663
3446
|
"aria-labelledby": F.triggerId,
|
|
3664
3447
|
...L,
|
|
@@ -3702,7 +3485,7 @@ var LABEL_NAME = "DropdownMenuLabel", DropdownMenuLabel = React$1.forwardRef((s,
|
|
|
3702
3485
|
DropdownMenuLabel.displayName = LABEL_NAME;
|
|
3703
3486
|
var ITEM_NAME = "DropdownMenuItem", DropdownMenuItem = React$1.forwardRef((s, d) => {
|
|
3704
3487
|
let { __scopeDropdownMenu: C, ...w } = s;
|
|
3705
|
-
return /* @__PURE__ */ jsx(Item2$
|
|
3488
|
+
return /* @__PURE__ */ jsx(Item2$1, {
|
|
3706
3489
|
...useMenuScope(C),
|
|
3707
3490
|
...w,
|
|
3708
3491
|
ref: d
|
|
@@ -3810,35 +3593,35 @@ function useStateMachine(d, C) {
|
|
|
3810
3593
|
return React$1.useReducer((s, d) => C[s][d] ?? s, d);
|
|
3811
3594
|
}
|
|
3812
3595
|
var SCROLL_AREA_NAME = "ScrollArea", [createScrollAreaContext, createScrollAreaScope] = createContextScope(SCROLL_AREA_NAME), [ScrollAreaProvider, useScrollAreaContext] = createScrollAreaContext(SCROLL_AREA_NAME), ScrollArea = React$1.forwardRef((d, C) => {
|
|
3813
|
-
let { __scopeScrollArea: w, type: k = "hover", dir: F, scrollHideDelay: L = 600, ...V } = d, [U, K] = React$1.useState(null), [q, J] = React$1.useState(null), [X, $] = React$1.useState(null), [
|
|
3596
|
+
let { __scopeScrollArea: w, type: k = "hover", dir: F, scrollHideDelay: L = 600, ...V } = d, [U, K] = React$1.useState(null), [q, J] = React$1.useState(null), [X, $] = React$1.useState(null), [PD, FD] = React$1.useState(null), [ID, LD] = React$1.useState(null), [RD, zD] = React$1.useState(0), [BD, VD] = React$1.useState(0), [HD, UD] = React$1.useState(!1), [GD, KD] = React$1.useState(!1), qD = useComposedRefs(C, (s) => K(s)), JD = useDirection(F);
|
|
3814
3597
|
return /* @__PURE__ */ jsx(ScrollAreaProvider, {
|
|
3815
3598
|
scope: w,
|
|
3816
3599
|
type: k,
|
|
3817
|
-
dir:
|
|
3600
|
+
dir: JD,
|
|
3818
3601
|
scrollHideDelay: L,
|
|
3819
3602
|
scrollArea: U,
|
|
3820
3603
|
viewport: q,
|
|
3821
3604
|
onViewportChange: J,
|
|
3822
3605
|
content: X,
|
|
3823
3606
|
onContentChange: $,
|
|
3824
|
-
scrollbarX:
|
|
3825
|
-
onScrollbarXChange:
|
|
3826
|
-
scrollbarXEnabled:
|
|
3827
|
-
onScrollbarXEnabledChange:
|
|
3828
|
-
scrollbarY:
|
|
3829
|
-
onScrollbarYChange:
|
|
3830
|
-
scrollbarYEnabled:
|
|
3831
|
-
onScrollbarYEnabledChange:
|
|
3832
|
-
onCornerWidthChange:
|
|
3833
|
-
onCornerHeightChange:
|
|
3607
|
+
scrollbarX: PD,
|
|
3608
|
+
onScrollbarXChange: FD,
|
|
3609
|
+
scrollbarXEnabled: HD,
|
|
3610
|
+
onScrollbarXEnabledChange: UD,
|
|
3611
|
+
scrollbarY: ID,
|
|
3612
|
+
onScrollbarYChange: LD,
|
|
3613
|
+
scrollbarYEnabled: GD,
|
|
3614
|
+
onScrollbarYEnabledChange: KD,
|
|
3615
|
+
onCornerWidthChange: zD,
|
|
3616
|
+
onCornerHeightChange: VD,
|
|
3834
3617
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
3835
|
-
dir:
|
|
3618
|
+
dir: JD,
|
|
3836
3619
|
...V,
|
|
3837
|
-
ref:
|
|
3620
|
+
ref: qD,
|
|
3838
3621
|
style: {
|
|
3839
3622
|
position: "relative",
|
|
3840
|
-
"--radix-scroll-area-corner-width":
|
|
3841
|
-
"--radix-scroll-area-corner-height":
|
|
3623
|
+
"--radix-scroll-area-corner-width": RD + "px",
|
|
3624
|
+
"--radix-scroll-area-corner-height": BD + "px",
|
|
3842
3625
|
...d.style
|
|
3843
3626
|
}
|
|
3844
3627
|
})
|
|
@@ -4109,46 +3892,46 @@ var ScrollAreaScrollbarHover = React$1.forwardRef((d, C) => {
|
|
|
4109
3892
|
}
|
|
4110
3893
|
});
|
|
4111
3894
|
}), [ScrollbarProvider, useScrollbarContext] = createScrollAreaContext(SCROLLBAR_NAME), ScrollAreaScrollbarImpl = React$1.forwardRef((d, C) => {
|
|
4112
|
-
let { __scopeScrollArea: w, sizes: k, hasThumb: F, onThumbChange: L, onThumbPointerUp: V, onThumbPointerDown: U, onThumbPositionChange: K, onDragScroll: q, onWheelScroll: J, onResize: X, ...$ } = d,
|
|
4113
|
-
function
|
|
4114
|
-
|
|
4115
|
-
x: s.clientX -
|
|
4116
|
-
y: s.clientY -
|
|
3895
|
+
let { __scopeScrollArea: w, sizes: k, hasThumb: F, onThumbChange: L, onThumbPointerUp: V, onThumbPointerDown: U, onThumbPositionChange: K, onDragScroll: q, onWheelScroll: J, onResize: X, ...$ } = d, PD = useScrollAreaContext(SCROLLBAR_NAME, w), [FD, ID] = React$1.useState(null), LD = useComposedRefs(C, (s) => ID(s)), RD = React$1.useRef(null), zD = React$1.useRef(""), BD = PD.viewport, VD = k.content - k.viewport, HD = useCallbackRef(J), UD = useCallbackRef(K), GD = useDebounceCallback(X, 10);
|
|
3896
|
+
function KD(s) {
|
|
3897
|
+
RD.current && q({
|
|
3898
|
+
x: s.clientX - RD.current.left,
|
|
3899
|
+
y: s.clientY - RD.current.top
|
|
4117
3900
|
});
|
|
4118
3901
|
}
|
|
4119
3902
|
return React$1.useEffect(() => {
|
|
4120
3903
|
let s = (s) => {
|
|
4121
3904
|
let d = s.target;
|
|
4122
|
-
|
|
3905
|
+
FD?.contains(d) && HD(s, VD);
|
|
4123
3906
|
};
|
|
4124
3907
|
return document.addEventListener("wheel", s, { passive: !1 }), () => document.removeEventListener("wheel", s, { passive: !1 });
|
|
4125
3908
|
}, [
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
]), React$1.useEffect(
|
|
3909
|
+
BD,
|
|
3910
|
+
FD,
|
|
3911
|
+
VD,
|
|
3912
|
+
HD
|
|
3913
|
+
]), React$1.useEffect(UD, [k, UD]), useResizeObserver(FD, GD), useResizeObserver(PD.content, GD), /* @__PURE__ */ jsx(ScrollbarProvider, {
|
|
4131
3914
|
scope: w,
|
|
4132
|
-
scrollbar:
|
|
3915
|
+
scrollbar: FD,
|
|
4133
3916
|
hasThumb: F,
|
|
4134
3917
|
onThumbChange: useCallbackRef(L),
|
|
4135
3918
|
onThumbPointerUp: useCallbackRef(V),
|
|
4136
|
-
onThumbPositionChange:
|
|
3919
|
+
onThumbPositionChange: UD,
|
|
4137
3920
|
onThumbPointerDown: useCallbackRef(U),
|
|
4138
3921
|
children: /* @__PURE__ */ jsx(Primitive.div, {
|
|
4139
3922
|
...$,
|
|
4140
|
-
ref:
|
|
3923
|
+
ref: LD,
|
|
4141
3924
|
style: {
|
|
4142
3925
|
position: "absolute",
|
|
4143
3926
|
...$.style
|
|
4144
3927
|
},
|
|
4145
3928
|
onPointerDown: composeEventHandlers(d.onPointerDown, (s) => {
|
|
4146
|
-
s.button === 0 && (s.target.setPointerCapture(s.pointerId),
|
|
3929
|
+
s.button === 0 && (s.target.setPointerCapture(s.pointerId), RD.current = FD.getBoundingClientRect(), zD.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", PD.viewport && (PD.viewport.style.scrollBehavior = "auto"), KD(s));
|
|
4147
3930
|
}),
|
|
4148
|
-
onPointerMove: composeEventHandlers(d.onPointerMove,
|
|
3931
|
+
onPointerMove: composeEventHandlers(d.onPointerMove, KD),
|
|
4149
3932
|
onPointerUp: composeEventHandlers(d.onPointerUp, (s) => {
|
|
4150
3933
|
let d = s.target;
|
|
4151
|
-
d.hasPointerCapture(s.pointerId) && d.releasePointerCapture(s.pointerId), document.body.style.webkitUserSelect =
|
|
3934
|
+
d.hasPointerCapture(s.pointerId) && d.releasePointerCapture(s.pointerId), document.body.style.webkitUserSelect = zD.current, PD.viewport && (PD.viewport.style.scrollBehavior = ""), RD.current = null;
|
|
4152
3935
|
})
|
|
4153
3936
|
})
|
|
4154
3937
|
});
|
|
@@ -4314,46 +4097,46 @@ var Root = ScrollArea, Viewport = ScrollAreaViewport, Scrollbar = ScrollAreaScro
|
|
|
4314
4097
|
};
|
|
4315
4098
|
TooltipProvider.displayName = PROVIDER_NAME;
|
|
4316
4099
|
var TOOLTIP_NAME = "Tooltip", [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME), Tooltip = (d) => {
|
|
4317
|
-
let { __scopeTooltip: C, children: w, open: k, defaultOpen: F, onOpenChange: L, disableHoverableContent: V, delayDuration: U } = d, K = useTooltipProviderContext(TOOLTIP_NAME, d.__scopeTooltip), q = usePopperScope(C), [J, X] = React$1.useState(null), $ = useId$1(),
|
|
4100
|
+
let { __scopeTooltip: C, children: w, open: k, defaultOpen: F, onOpenChange: L, disableHoverableContent: V, delayDuration: U } = d, K = useTooltipProviderContext(TOOLTIP_NAME, d.__scopeTooltip), q = usePopperScope(C), [J, X] = React$1.useState(null), $ = useId$1(), PD = React$1.useRef(0), FD = V ?? K.disableHoverableContent, ID = U ?? K.delayDuration, LD = React$1.useRef(!1), [RD, zD] = useControllableState({
|
|
4318
4101
|
prop: k,
|
|
4319
4102
|
defaultProp: F ?? !1,
|
|
4320
4103
|
onChange: (s) => {
|
|
4321
4104
|
s ? (K.onOpen(), document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN))) : K.onClose(), L?.(s);
|
|
4322
4105
|
},
|
|
4323
4106
|
caller: TOOLTIP_NAME
|
|
4324
|
-
}),
|
|
4325
|
-
window.clearTimeout(
|
|
4326
|
-
}, [
|
|
4327
|
-
window.clearTimeout(
|
|
4328
|
-
}, [
|
|
4329
|
-
window.clearTimeout(
|
|
4330
|
-
|
|
4331
|
-
},
|
|
4332
|
-
}, [
|
|
4107
|
+
}), BD = React$1.useMemo(() => RD ? LD.current ? "delayed-open" : "instant-open" : "closed", [RD]), VD = React$1.useCallback(() => {
|
|
4108
|
+
window.clearTimeout(PD.current), PD.current = 0, LD.current = !1, zD(!0);
|
|
4109
|
+
}, [zD]), HD = React$1.useCallback(() => {
|
|
4110
|
+
window.clearTimeout(PD.current), PD.current = 0, zD(!1);
|
|
4111
|
+
}, [zD]), UD = React$1.useCallback(() => {
|
|
4112
|
+
window.clearTimeout(PD.current), PD.current = window.setTimeout(() => {
|
|
4113
|
+
LD.current = !0, zD(!0), PD.current = 0;
|
|
4114
|
+
}, ID);
|
|
4115
|
+
}, [ID, zD]);
|
|
4333
4116
|
return React$1.useEffect(() => () => {
|
|
4334
|
-
|
|
4335
|
-
}, []), /* @__PURE__ */ jsx(Root2$
|
|
4117
|
+
PD.current &&= (window.clearTimeout(PD.current), 0);
|
|
4118
|
+
}, []), /* @__PURE__ */ jsx(Root2$1, {
|
|
4336
4119
|
...q,
|
|
4337
4120
|
children: /* @__PURE__ */ jsx(TooltipContextProvider, {
|
|
4338
4121
|
scope: C,
|
|
4339
4122
|
contentId: $,
|
|
4340
|
-
open:
|
|
4341
|
-
stateAttribute:
|
|
4123
|
+
open: RD,
|
|
4124
|
+
stateAttribute: BD,
|
|
4342
4125
|
trigger: J,
|
|
4343
4126
|
onTriggerChange: X,
|
|
4344
4127
|
onTriggerEnter: React$1.useCallback(() => {
|
|
4345
|
-
K.isOpenDelayedRef.current ?
|
|
4128
|
+
K.isOpenDelayedRef.current ? UD() : VD();
|
|
4346
4129
|
}, [
|
|
4347
4130
|
K.isOpenDelayedRef,
|
|
4348
|
-
|
|
4349
|
-
|
|
4131
|
+
UD,
|
|
4132
|
+
VD
|
|
4350
4133
|
]),
|
|
4351
4134
|
onTriggerLeave: React$1.useCallback(() => {
|
|
4352
|
-
|
|
4353
|
-
}, [
|
|
4354
|
-
onOpen:
|
|
4355
|
-
onClose:
|
|
4356
|
-
disableHoverableContent:
|
|
4135
|
+
FD ? HD() : (window.clearTimeout(PD.current), PD.current = 0);
|
|
4136
|
+
}, [HD, FD]),
|
|
4137
|
+
onOpen: VD,
|
|
4138
|
+
onClose: HD,
|
|
4139
|
+
disableHoverableContent: FD,
|
|
4357
4140
|
children: w
|
|
4358
4141
|
})
|
|
4359
4142
|
});
|
|
@@ -4420,7 +4203,7 @@ var CONTENT_NAME = "TooltipContent", TooltipContent = React$1.forwardRef((s, d)
|
|
|
4420
4203
|
}), TooltipContentHoverable = React$1.forwardRef((d, C) => {
|
|
4421
4204
|
let w = useTooltipContext(CONTENT_NAME, d.__scopeTooltip), k = useTooltipProviderContext(CONTENT_NAME, d.__scopeTooltip), F = React$1.useRef(null), L = useComposedRefs(C, F), [V, U] = React$1.useState(null), { trigger: K, onClose: q } = w, J = F.current, { onPointerInTransitChange: X } = k, $ = React$1.useCallback(() => {
|
|
4422
4205
|
U(null), X(!1);
|
|
4423
|
-
}, [X]),
|
|
4206
|
+
}, [X]), PD = React$1.useCallback((s, d) => {
|
|
4424
4207
|
let C = s.currentTarget, w = {
|
|
4425
4208
|
x: s.clientX,
|
|
4426
4209
|
y: s.clientY
|
|
@@ -4429,7 +4212,7 @@ var CONTENT_NAME = "TooltipContent", TooltipContent = React$1.forwardRef((s, d)
|
|
|
4429
4212
|
}, [X]);
|
|
4430
4213
|
return React$1.useEffect(() => () => $(), [$]), React$1.useEffect(() => {
|
|
4431
4214
|
if (K && J) {
|
|
4432
|
-
let s = (s) =>
|
|
4215
|
+
let s = (s) => PD(s, J), d = (s) => PD(s, K);
|
|
4433
4216
|
return K.addEventListener("pointerleave", s), J.addEventListener("pointerleave", d), () => {
|
|
4434
4217
|
K.removeEventListener("pointerleave", s), J.removeEventListener("pointerleave", d);
|
|
4435
4218
|
};
|
|
@@ -4437,7 +4220,7 @@ var CONTENT_NAME = "TooltipContent", TooltipContent = React$1.forwardRef((s, d)
|
|
|
4437
4220
|
}, [
|
|
4438
4221
|
K,
|
|
4439
4222
|
J,
|
|
4440
|
-
|
|
4223
|
+
PD,
|
|
4441
4224
|
$
|
|
4442
4225
|
]), React$1.useEffect(() => {
|
|
4443
4226
|
if (V) {
|
|
@@ -5163,79 +4946,79 @@ R.displayName = "Theme";
|
|
|
5163
4946
|
var I$2 = React$1.forwardRef((d, C) => {
|
|
5164
4947
|
let { appearance: w = s$10.appearance.default, accentColor: k = s$10.accentColor.default, grayColor: F = s$10.grayColor.default, panelBackground: L = s$10.panelBackground.default, radius: V = s$10.radius.default, scaling: U = s$10.scaling.default, hasBackground: K = s$10.hasBackground.default, ...q } = d, [J, X] = React$1.useState(w);
|
|
5165
4948
|
React$1.useEffect(() => X(w), [w]);
|
|
5166
|
-
let [$,
|
|
5167
|
-
React$1.useEffect(() =>
|
|
5168
|
-
let [
|
|
5169
|
-
React$1.useEffect(() =>
|
|
5170
|
-
let [
|
|
5171
|
-
React$1.useEffect(() =>
|
|
5172
|
-
let [
|
|
5173
|
-
React$1.useEffect(() =>
|
|
5174
|
-
let [
|
|
5175
|
-
return React$1.useEffect(() =>
|
|
4949
|
+
let [$, PD] = React$1.useState(k);
|
|
4950
|
+
React$1.useEffect(() => PD(k), [k]);
|
|
4951
|
+
let [FD, ID] = React$1.useState(F);
|
|
4952
|
+
React$1.useEffect(() => ID(F), [F]);
|
|
4953
|
+
let [LD, RD] = React$1.useState(L);
|
|
4954
|
+
React$1.useEffect(() => RD(L), [L]);
|
|
4955
|
+
let [zD, BD] = React$1.useState(V);
|
|
4956
|
+
React$1.useEffect(() => BD(V), [V]);
|
|
4957
|
+
let [VD, HD] = React$1.useState(U);
|
|
4958
|
+
return React$1.useEffect(() => HD(U), [U]), React$1.createElement(A$1, {
|
|
5176
4959
|
...q,
|
|
5177
4960
|
ref: C,
|
|
5178
4961
|
isRoot: !0,
|
|
5179
4962
|
hasBackground: K,
|
|
5180
4963
|
appearance: J,
|
|
5181
4964
|
accentColor: $,
|
|
5182
|
-
grayColor:
|
|
5183
|
-
panelBackground:
|
|
5184
|
-
radius:
|
|
5185
|
-
scaling:
|
|
4965
|
+
grayColor: FD,
|
|
4966
|
+
panelBackground: LD,
|
|
4967
|
+
radius: zD,
|
|
4968
|
+
scaling: VD,
|
|
5186
4969
|
onAppearanceChange: X,
|
|
5187
|
-
onAccentColorChange:
|
|
5188
|
-
onGrayColorChange:
|
|
5189
|
-
onPanelBackgroundChange:
|
|
5190
|
-
onRadiusChange:
|
|
5191
|
-
onScalingChange:
|
|
4970
|
+
onAccentColorChange: PD,
|
|
4971
|
+
onGrayColorChange: ID,
|
|
4972
|
+
onPanelBackgroundChange: RD,
|
|
4973
|
+
onRadiusChange: BD,
|
|
4974
|
+
onScalingChange: HD
|
|
5192
4975
|
});
|
|
5193
4976
|
});
|
|
5194
4977
|
I$2.displayName = "ThemeRoot";
|
|
5195
4978
|
var A$1 = React$1.forwardRef((d, C) => {
|
|
5196
|
-
let w = React$1.useContext(P), { asChild: k, isRoot: F, hasBackground: L, appearance: V = w?.appearance ?? s$10.appearance.default, accentColor: U = w?.accentColor ?? s$10.accentColor.default, grayColor: K = w?.resolvedGrayColor ?? s$10.grayColor.default, panelBackground: q = w?.panelBackground ?? s$10.panelBackground.default, radius: J = w?.radius ?? s$10.radius.default, scaling: X = w?.scaling ?? s$10.scaling.default, onAppearanceChange: $ = d$4, onAccentColorChange:
|
|
4979
|
+
let w = React$1.useContext(P), { asChild: k, isRoot: F, hasBackground: L, appearance: V = w?.appearance ?? s$10.appearance.default, accentColor: U = w?.accentColor ?? s$10.accentColor.default, grayColor: K = w?.resolvedGrayColor ?? s$10.grayColor.default, panelBackground: q = w?.panelBackground ?? s$10.panelBackground.default, radius: J = w?.radius ?? s$10.radius.default, scaling: X = w?.scaling ?? s$10.scaling.default, onAppearanceChange: $ = d$4, onAccentColorChange: PD = d$4, onGrayColorChange: FD = d$4, onPanelBackgroundChange: ID = d$4, onRadiusChange: LD = d$4, onScalingChange: RD = d$4, ...zD } = d, BD = k ? Slot$2 : "div", VD = K === "auto" ? a$8(U) : K, HD = d.appearance === "light" || d.appearance === "dark", UD = L === void 0 ? F || HD : L;
|
|
5197
4980
|
return React$1.createElement(P.Provider, { value: React$1.useMemo(() => ({
|
|
5198
4981
|
appearance: V,
|
|
5199
4982
|
accentColor: U,
|
|
5200
4983
|
grayColor: K,
|
|
5201
|
-
resolvedGrayColor:
|
|
4984
|
+
resolvedGrayColor: VD,
|
|
5202
4985
|
panelBackground: q,
|
|
5203
4986
|
radius: J,
|
|
5204
4987
|
scaling: X,
|
|
5205
4988
|
onAppearanceChange: $,
|
|
5206
|
-
onAccentColorChange:
|
|
5207
|
-
onGrayColorChange:
|
|
5208
|
-
onPanelBackgroundChange:
|
|
5209
|
-
onRadiusChange:
|
|
5210
|
-
onScalingChange:
|
|
4989
|
+
onAccentColorChange: PD,
|
|
4990
|
+
onGrayColorChange: FD,
|
|
4991
|
+
onPanelBackgroundChange: ID,
|
|
4992
|
+
onRadiusChange: LD,
|
|
4993
|
+
onScalingChange: RD
|
|
5211
4994
|
}), [
|
|
5212
4995
|
V,
|
|
5213
4996
|
U,
|
|
5214
4997
|
K,
|
|
5215
|
-
|
|
4998
|
+
VD,
|
|
5216
4999
|
q,
|
|
5217
5000
|
J,
|
|
5218
5001
|
X,
|
|
5219
5002
|
$,
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
]) }, React$1.createElement(
|
|
5003
|
+
PD,
|
|
5004
|
+
FD,
|
|
5005
|
+
ID,
|
|
5006
|
+
LD,
|
|
5007
|
+
RD
|
|
5008
|
+
]) }, React$1.createElement(BD, {
|
|
5226
5009
|
"data-is-root-theme": F ? "true" : "false",
|
|
5227
5010
|
"data-accent-color": U,
|
|
5228
|
-
"data-gray-color":
|
|
5229
|
-
"data-has-background":
|
|
5011
|
+
"data-gray-color": VD,
|
|
5012
|
+
"data-has-background": UD ? "true" : "false",
|
|
5230
5013
|
"data-panel-background": q,
|
|
5231
5014
|
"data-radius": J,
|
|
5232
5015
|
"data-scaling": X,
|
|
5233
5016
|
ref: C,
|
|
5234
|
-
...
|
|
5017
|
+
...zD,
|
|
5235
5018
|
className: (0, import_classnames$13.default)("radix-themes", {
|
|
5236
5019
|
light: V === "light",
|
|
5237
5020
|
dark: V === "dark"
|
|
5238
|
-
},
|
|
5021
|
+
}, zD.className)
|
|
5239
5022
|
}));
|
|
5240
5023
|
});
|
|
5241
5024
|
A$1.displayName = "ThemeImpl";
|
|
@@ -5886,16 +5669,16 @@ function S$1(s) {
|
|
|
5886
5669
|
customProperties: ["--margin-bottom"],
|
|
5887
5670
|
propValues: r$5,
|
|
5888
5671
|
value: s.mb
|
|
5889
|
-
}), [$,
|
|
5672
|
+
}), [$, PD] = R$3({
|
|
5890
5673
|
className: "rt-r-ml",
|
|
5891
5674
|
customProperties: ["--margin-left"],
|
|
5892
5675
|
propValues: r$5,
|
|
5893
5676
|
value: s.ml
|
|
5894
5677
|
});
|
|
5895
|
-
return [(0, import_classnames$6.default)(d, w, F, V, K, J, $), l$1(C, k, L, U, q, X,
|
|
5678
|
+
return [(0, import_classnames$6.default)(d, w, F, V, K, J, $), l$1(C, k, L, U, q, X, PD)];
|
|
5896
5679
|
}
|
|
5897
5680
|
var import_classnames$5 = /* @__PURE__ */ __toESM(require_classnames()), c = React$1.forwardRef((d, C) => {
|
|
5898
|
-
let { rest: w, ...k } = a$3(d), [F, L] = S$1(k), { asChild: V, children: U, className: K, style: q, type: J, scrollHideDelay: X = J === "scroll" ? void 0 : 0, dir: $, size:
|
|
5681
|
+
let { rest: w, ...k } = a$3(d), [F, L] = S$1(k), { asChild: V, children: U, className: K, style: q, type: J, scrollHideDelay: X = J === "scroll" ? void 0 : 0, dir: $, size: PD = t$1.size.default, radius: FD = t$1.radius.default, scrollbars: ID = t$1.scrollbars.default, ...LD } = w;
|
|
5899
5682
|
return React$1.createElement(Root, {
|
|
5900
5683
|
type: J,
|
|
5901
5684
|
scrollHideDelay: X,
|
|
@@ -5906,26 +5689,26 @@ var import_classnames$5 = /* @__PURE__ */ __toESM(require_classnames()), c = Rea
|
|
|
5906
5689
|
asChild: V,
|
|
5907
5690
|
children: U
|
|
5908
5691
|
}, (d) => React$1.createElement(React$1.Fragment, null, React$1.createElement(Viewport, {
|
|
5909
|
-
...
|
|
5692
|
+
...LD,
|
|
5910
5693
|
ref: C,
|
|
5911
5694
|
className: "rt-ScrollAreaViewport"
|
|
5912
|
-
}, d), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }),
|
|
5913
|
-
"data-radius":
|
|
5695
|
+
}, d), React$1.createElement("div", { className: "rt-ScrollAreaViewportFocusRing" }), ID === "vertical" ? null : React$1.createElement(Scrollbar, {
|
|
5696
|
+
"data-radius": FD,
|
|
5914
5697
|
orientation: "horizontal",
|
|
5915
5698
|
className: (0, import_classnames$5.default)("rt-ScrollAreaScrollbar", g$2({
|
|
5916
5699
|
className: "rt-r-size",
|
|
5917
|
-
value:
|
|
5700
|
+
value: PD,
|
|
5918
5701
|
propValues: t$1.size.values
|
|
5919
5702
|
}))
|
|
5920
|
-
}, React$1.createElement(Thumb, { className: "rt-ScrollAreaThumb" })),
|
|
5921
|
-
"data-radius":
|
|
5703
|
+
}, React$1.createElement(Thumb, { className: "rt-ScrollAreaThumb" })), ID === "horizontal" ? null : React$1.createElement(Scrollbar, {
|
|
5704
|
+
"data-radius": FD,
|
|
5922
5705
|
orientation: "vertical",
|
|
5923
5706
|
className: (0, import_classnames$5.default)("rt-ScrollAreaScrollbar", g$2({
|
|
5924
5707
|
className: "rt-r-size",
|
|
5925
|
-
value:
|
|
5708
|
+
value: PD,
|
|
5926
5709
|
propValues: t$1.size.values
|
|
5927
5710
|
}))
|
|
5928
|
-
}, React$1.createElement(Thumb, { className: "rt-ScrollAreaThumb" })),
|
|
5711
|
+
}, React$1.createElement(Thumb, { className: "rt-ScrollAreaThumb" })), ID === "both" ? React$1.createElement(Corner, { className: "rt-ScrollAreaCorner" }) : null)));
|
|
5929
5712
|
});
|
|
5930
5713
|
c.displayName = "ScrollArea";
|
|
5931
5714
|
var n$1 = {
|
|
@@ -5956,7 +5739,7 @@ var n$1 = {
|
|
|
5956
5739
|
modal: !0
|
|
5957
5740
|
});
|
|
5958
5741
|
s$2.displayName = "Dialog.Root";
|
|
5959
|
-
var n$2 = React$1.forwardRef(({ children: d, ...C }, w) => React$1.createElement(Trigger$
|
|
5742
|
+
var n$2 = React$1.forwardRef(({ children: d, ...C }, w) => React$1.createElement(Trigger$1, {
|
|
5960
5743
|
...C,
|
|
5961
5744
|
ref: w,
|
|
5962
5745
|
asChild: !0
|
|
@@ -6928,17 +6711,17 @@ function $e({ document: s, event: d, hitRegions: C, initialLayoutMap: w, mounted
|
|
|
6928
6711
|
C.forEach((s) => {
|
|
6929
6712
|
let { group: C, groupSize: U } = s, { disableCursor: K, orientation: q, panels: J } = C, X = 0;
|
|
6930
6713
|
X = F ? q === "horizontal" ? (d.clientX - F.x) / U * 100 : (d.clientY - F.y) / U * 100 : q === "horizontal" ? d.clientX < 0 ? -100 : 100 : d.clientY < 0 ? -100 : 100;
|
|
6931
|
-
let $ = w.get(C), { defaultLayoutDeferred:
|
|
6932
|
-
if (
|
|
6714
|
+
let $ = w.get(C), { defaultLayoutDeferred: PD, derivedPanelConstraints: FD, layout: ID, separatorToPanels: LD } = k.get(C) ?? { defaultLayoutDeferred: !1 };
|
|
6715
|
+
if (FD && $ && ID && LD) {
|
|
6933
6716
|
let d = Z({
|
|
6934
6717
|
delta: X,
|
|
6935
6718
|
initialLayout: $,
|
|
6936
|
-
panelConstraints:
|
|
6719
|
+
panelConstraints: FD,
|
|
6937
6720
|
pivotIndices: s.panels.map((s) => J.indexOf(s)),
|
|
6938
|
-
prevLayout:
|
|
6721
|
+
prevLayout: ID,
|
|
6939
6722
|
trigger: "mouse-or-touch"
|
|
6940
6723
|
});
|
|
6941
|
-
if (B(d,
|
|
6724
|
+
if (B(d, ID)) {
|
|
6942
6725
|
if (X !== 0 && !K) switch (q) {
|
|
6943
6726
|
case "horizontal":
|
|
6944
6727
|
L |= X < 0 ? De : Oe;
|
|
@@ -6949,10 +6732,10 @@ function $e({ document: s, event: d, hitRegions: C, initialLayoutMap: w, mounted
|
|
|
6949
6732
|
}
|
|
6950
6733
|
} else {
|
|
6951
6734
|
V.set(s.group, {
|
|
6952
|
-
defaultLayoutDeferred:
|
|
6953
|
-
derivedPanelConstraints:
|
|
6735
|
+
defaultLayoutDeferred: PD,
|
|
6736
|
+
derivedPanelConstraints: FD,
|
|
6954
6737
|
layout: d,
|
|
6955
|
-
separatorToPanels:
|
|
6738
|
+
separatorToPanels: LD
|
|
6956
6739
|
});
|
|
6957
6740
|
let C = s.group.panels.map(({ id: s }) => s).join(",");
|
|
6958
6741
|
s.group.inMemoryLayouts[C] = d;
|
|
@@ -7162,66 +6945,66 @@ function Pt(s, d) {
|
|
|
7162
6945
|
});
|
|
7163
6946
|
}
|
|
7164
6947
|
function Rt({ children: s, className: d, defaultLayout: C, disableCursor: w, disabled: k, elementRef: F, groupRef: L, id: V, onLayoutChange: U, orientation: K = "horizontal", style: q, ...X }) {
|
|
7165
|
-
let $ = useRef({}),
|
|
6948
|
+
let $ = useRef({}), PD = le((s) => {
|
|
7166
6949
|
B($.current, s) || ($.current = s, U?.(s));
|
|
7167
|
-
}),
|
|
6950
|
+
}), FD = ae(V), zD = useRef(null), [BD, VD] = useState(!1), [HD, UD] = useState(C ?? {}), [GD, KD] = wt(), qD = useRef({
|
|
7168
6951
|
lastExpandedPanelSizes: {},
|
|
7169
6952
|
layouts: {},
|
|
7170
6953
|
panels: [],
|
|
7171
6954
|
separators: []
|
|
7172
|
-
}),
|
|
7173
|
-
Pt(
|
|
7174
|
-
let
|
|
7175
|
-
id:
|
|
6955
|
+
}), JD = ue(zD, F);
|
|
6956
|
+
Pt(FD, L);
|
|
6957
|
+
let YD = useMemo(() => ({
|
|
6958
|
+
id: FD,
|
|
7176
6959
|
orientation: K,
|
|
7177
6960
|
registerPanel: (s) => {
|
|
7178
|
-
let d =
|
|
7179
|
-
return d.panels = ie(K, [...d.panels, s]),
|
|
7180
|
-
d.panels = d.panels.filter((d) => d !== s),
|
|
6961
|
+
let d = qD.current;
|
|
6962
|
+
return d.panels = ie(K, [...d.panels, s]), KD(), () => {
|
|
6963
|
+
d.panels = d.panels.filter((d) => d !== s), KD();
|
|
7181
6964
|
};
|
|
7182
6965
|
},
|
|
7183
6966
|
registerSeparator: (s) => {
|
|
7184
|
-
let d =
|
|
7185
|
-
return d.separators = ie(K, [...d.separators, s]),
|
|
7186
|
-
d.separators = d.separators.filter((d) => d !== s),
|
|
6967
|
+
let d = qD.current;
|
|
6968
|
+
return d.separators = ie(K, [...d.separators, s]), KD(), () => {
|
|
6969
|
+
d.separators = d.separators.filter((d) => d !== s), KD();
|
|
7187
6970
|
};
|
|
7188
6971
|
}
|
|
7189
6972
|
}), [
|
|
7190
|
-
|
|
7191
|
-
|
|
6973
|
+
FD,
|
|
6974
|
+
KD,
|
|
7192
6975
|
K
|
|
7193
|
-
]),
|
|
6976
|
+
]), XD = Lt({
|
|
7194
6977
|
defaultLayout: C,
|
|
7195
6978
|
disableCursor: w
|
|
7196
|
-
}),
|
|
6979
|
+
}), ZD = useRef(null);
|
|
7197
6980
|
A(() => {
|
|
7198
|
-
let s =
|
|
6981
|
+
let s = zD.current;
|
|
7199
6982
|
if (s === null) return;
|
|
7200
|
-
let d =
|
|
7201
|
-
defaultLayout:
|
|
7202
|
-
disableCursor: !!
|
|
6983
|
+
let d = qD.current, C = {
|
|
6984
|
+
defaultLayout: XD.defaultLayout,
|
|
6985
|
+
disableCursor: !!XD.disableCursor,
|
|
7203
6986
|
disabled: !!k,
|
|
7204
6987
|
element: s,
|
|
7205
|
-
id:
|
|
7206
|
-
inMemoryLastExpandedPanelSizes:
|
|
7207
|
-
inMemoryLayouts:
|
|
6988
|
+
id: FD,
|
|
6989
|
+
inMemoryLastExpandedPanelSizes: qD.current.lastExpandedPanelSizes,
|
|
6990
|
+
inMemoryLayouts: qD.current.layouts,
|
|
7208
6991
|
orientation: K,
|
|
7209
6992
|
panels: d.panels,
|
|
7210
6993
|
separators: d.separators
|
|
7211
6994
|
};
|
|
7212
|
-
|
|
6995
|
+
ZD.current = C;
|
|
7213
6996
|
let w = bt(C), F = D().mountedGroups.get(C);
|
|
7214
6997
|
if (F) {
|
|
7215
6998
|
let { defaultLayoutDeferred: s, derivedPanelConstraints: d, layout: C } = F;
|
|
7216
|
-
!s && d.length > 0 && (
|
|
6999
|
+
!s && d.length > 0 && (UD(C), PD?.(C));
|
|
7217
7000
|
}
|
|
7218
7001
|
let L = T.addListener("interactionStateChange", (s) => {
|
|
7219
7002
|
switch (s.state) {
|
|
7220
7003
|
case "active":
|
|
7221
|
-
|
|
7004
|
+
VD(s.hitRegions.some((s) => s.group === C));
|
|
7222
7005
|
break;
|
|
7223
7006
|
default:
|
|
7224
|
-
|
|
7007
|
+
VD(!1);
|
|
7225
7008
|
break;
|
|
7226
7009
|
}
|
|
7227
7010
|
}), V = T.addListener("mountedGroupsChange", (s) => {
|
|
@@ -7229,44 +7012,44 @@ function Rt({ children: s, className: d, defaultLayout: C, disableCursor: w, dis
|
|
|
7229
7012
|
if (d) {
|
|
7230
7013
|
let { defaultLayoutDeferred: s, derivedPanelConstraints: C, layout: w } = d;
|
|
7231
7014
|
if (s || C.length === 0) return;
|
|
7232
|
-
|
|
7015
|
+
UD(w), PD?.(w);
|
|
7233
7016
|
}
|
|
7234
7017
|
});
|
|
7235
7018
|
return () => {
|
|
7236
|
-
|
|
7019
|
+
ZD.current = null, w(), L(), V();
|
|
7237
7020
|
};
|
|
7238
7021
|
}, [
|
|
7239
7022
|
k,
|
|
7240
|
-
|
|
7241
|
-
|
|
7023
|
+
FD,
|
|
7024
|
+
PD,
|
|
7242
7025
|
K,
|
|
7243
|
-
|
|
7244
|
-
|
|
7026
|
+
GD,
|
|
7027
|
+
XD
|
|
7245
7028
|
]), useEffect(() => {
|
|
7246
|
-
let s =
|
|
7029
|
+
let s = ZD.current;
|
|
7247
7030
|
s && (s.defaultLayout = C, s.disableCursor = !!w);
|
|
7248
7031
|
});
|
|
7249
|
-
let
|
|
7250
|
-
for (let s in
|
|
7251
|
-
let d = Ve(
|
|
7252
|
-
|
|
7032
|
+
let QD = { [Fe]: BD ? "none" : void 0 };
|
|
7033
|
+
for (let s in HD) {
|
|
7034
|
+
let d = Ve(FD, s);
|
|
7035
|
+
QD[d] = HD[s];
|
|
7253
7036
|
}
|
|
7254
7037
|
return /* @__PURE__ */ jsx(je.Provider, {
|
|
7255
|
-
value:
|
|
7038
|
+
value: YD,
|
|
7256
7039
|
children: /* @__PURE__ */ jsx("div", {
|
|
7257
7040
|
...X,
|
|
7258
7041
|
"aria-orientation": K,
|
|
7259
7042
|
className: d,
|
|
7260
7043
|
"data-group": !0,
|
|
7261
|
-
"data-testid":
|
|
7262
|
-
id:
|
|
7263
|
-
ref:
|
|
7044
|
+
"data-testid": FD,
|
|
7045
|
+
id: FD,
|
|
7046
|
+
ref: JD,
|
|
7264
7047
|
style: {
|
|
7265
7048
|
height: "100%",
|
|
7266
7049
|
width: "100%",
|
|
7267
7050
|
overflow: "hidden",
|
|
7268
7051
|
...q,
|
|
7269
|
-
...
|
|
7052
|
+
...QD,
|
|
7270
7053
|
display: "flex",
|
|
7271
7054
|
flexDirection: K === "horizontal" ? "row" : "column",
|
|
7272
7055
|
flexWrap: "nowrap"
|
|
@@ -7384,20 +7167,20 @@ function It(s, d) {
|
|
|
7384
7167
|
});
|
|
7385
7168
|
}
|
|
7386
7169
|
function kt({ children: s, className: d, collapsedSize: C = "0%", collapsible: w = !1, defaultSize: k, elementRef: F, id: L, maxSize: V = "100%", minSize: U = "0%", onResize: K, panelRef: q, style: J, ...X }) {
|
|
7387
|
-
let $ = !!L,
|
|
7170
|
+
let $ = !!L, PD = ae(L), FD = useRef(null), ID = ue(FD, F), { id: RD, registerPanel: zD } = ce(), BD = K !== null, VD = le((s, d, C) => {
|
|
7388
7171
|
K?.(s, L, C);
|
|
7389
7172
|
});
|
|
7390
7173
|
A(() => {
|
|
7391
|
-
let s =
|
|
7392
|
-
if (s !== null) return
|
|
7174
|
+
let s = FD.current;
|
|
7175
|
+
if (s !== null) return zD({
|
|
7393
7176
|
element: s,
|
|
7394
|
-
id:
|
|
7177
|
+
id: PD,
|
|
7395
7178
|
idIsStable: $,
|
|
7396
7179
|
mutableValues: {
|
|
7397
7180
|
expandToSize: void 0,
|
|
7398
7181
|
prevSize: void 0
|
|
7399
7182
|
},
|
|
7400
|
-
onResize:
|
|
7183
|
+
onResize: BD ? VD : void 0,
|
|
7401
7184
|
panelConstraints: {
|
|
7402
7185
|
collapsedSize: C,
|
|
7403
7186
|
collapsible: w,
|
|
@@ -7410,25 +7193,25 @@ function kt({ children: s, className: d, collapsedSize: C = "0%", collapsible: w
|
|
|
7410
7193
|
C,
|
|
7411
7194
|
w,
|
|
7412
7195
|
k,
|
|
7413
|
-
|
|
7414
|
-
|
|
7196
|
+
BD,
|
|
7197
|
+
PD,
|
|
7415
7198
|
$,
|
|
7416
7199
|
V,
|
|
7417
7200
|
U,
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
]), It(
|
|
7421
|
-
let
|
|
7201
|
+
VD,
|
|
7202
|
+
zD
|
|
7203
|
+
]), It(PD, q);
|
|
7204
|
+
let HD = Ve(RD, PD);
|
|
7422
7205
|
return /* @__PURE__ */ jsx("div", {
|
|
7423
7206
|
...X,
|
|
7424
7207
|
"data-panel": !0,
|
|
7425
|
-
"data-testid":
|
|
7426
|
-
id:
|
|
7427
|
-
ref:
|
|
7208
|
+
"data-testid": PD,
|
|
7209
|
+
id: PD,
|
|
7210
|
+
ref: ID,
|
|
7428
7211
|
style: {
|
|
7429
7212
|
...Gt,
|
|
7430
7213
|
flexBasis: 0,
|
|
7431
|
-
flexGrow: `var(${
|
|
7214
|
+
flexGrow: `var(${HD}, 1)`,
|
|
7432
7215
|
flexShrink: 1,
|
|
7433
7216
|
overflow: "hidden",
|
|
7434
7217
|
pointerEvents: `var(${Fe})`
|
|
@@ -7491,14 +7274,14 @@ function Dt({ layout: s, panelConstraints: d, panelId: C, panelIndex: w }) {
|
|
|
7491
7274
|
};
|
|
7492
7275
|
}
|
|
7493
7276
|
function Ot({ children: s, className: d, elementRef: C, id: w, style: k, ...F }) {
|
|
7494
|
-
let L = ae(w), [V, U] = useState({}), [K, q] = useState("inactive"), J = useRef(null), X = ue(J, C), { id: $, orientation:
|
|
7277
|
+
let L = ae(w), [V, U] = useState({}), [K, q] = useState("inactive"), J = useRef(null), X = ue(J, C), { id: $, orientation: PD, registerSeparator: FD } = ce(), ID = PD === "horizontal" ? "vertical" : "horizontal";
|
|
7495
7278
|
return A(() => {
|
|
7496
7279
|
let s = J.current;
|
|
7497
7280
|
if (s !== null) {
|
|
7498
7281
|
let d = {
|
|
7499
7282
|
element: s,
|
|
7500
7283
|
id: L
|
|
7501
|
-
}, C =
|
|
7284
|
+
}, C = FD(d), w = T.addListener("interactionStateChange", (s) => {
|
|
7502
7285
|
q(s.state !== "inactive" && s.hitRegions.some((s) => s.separator === d) ? s.state : "inactive");
|
|
7503
7286
|
}), k = T.addListener("mountedGroupsChange", (s) => {
|
|
7504
7287
|
s.forEach(({ derivedPanelConstraints: s, layout: C, separatorToPanels: w }, k) => {
|
|
@@ -7523,11 +7306,11 @@ function Ot({ children: s, className: d, elementRef: C, id: w, style: k, ...F })
|
|
|
7523
7306
|
}, [
|
|
7524
7307
|
$,
|
|
7525
7308
|
L,
|
|
7526
|
-
|
|
7309
|
+
FD
|
|
7527
7310
|
]), /* @__PURE__ */ jsx("div", {
|
|
7528
7311
|
...F,
|
|
7529
7312
|
"aria-controls": V.valueControls,
|
|
7530
|
-
"aria-orientation":
|
|
7313
|
+
"aria-orientation": ID,
|
|
7531
7314
|
"aria-valuemax": V.valueMax,
|
|
7532
7315
|
"aria-valuemin": V.valueMin,
|
|
7533
7316
|
"aria-valuenow": V.valueNow,
|
|
@@ -7653,8 +7436,8 @@ var _excluded$Y = ["color"], ChevronRightIcon = /* @__PURE__ */ forwardRef(funct
|
|
|
7653
7436
|
"Arial Black",
|
|
7654
7437
|
"Impact"
|
|
7655
7438
|
];
|
|
7656
|
-
const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [] }) => {
|
|
7657
|
-
let [
|
|
7439
|
+
const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [], theme: k = "light" }) => {
|
|
7440
|
+
let [F, L] = useState({
|
|
7658
7441
|
elements: [],
|
|
7659
7442
|
selectedElementId: null,
|
|
7660
7443
|
isList: C,
|
|
@@ -7668,10 +7451,11 @@ const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [] })
|
|
|
7668
7451
|
"Open Sans",
|
|
7669
7452
|
"Lato",
|
|
7670
7453
|
"Montserrat"
|
|
7671
|
-
]
|
|
7454
|
+
],
|
|
7455
|
+
theme: k
|
|
7672
7456
|
});
|
|
7673
7457
|
React.useEffect(() => {
|
|
7674
|
-
|
|
7458
|
+
F.availableFonts.forEach((s) => {
|
|
7675
7459
|
if (SAFE_FONTS.includes(s)) return;
|
|
7676
7460
|
let d = `font-${s.replace(/\s+/g, "-").toLowerCase()}`;
|
|
7677
7461
|
if (!document.getElementById(d)) {
|
|
@@ -7679,15 +7463,20 @@ const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [] })
|
|
|
7679
7463
|
C.id = d, C.href = `https://fonts.googleapis.com/css2?family=${s.replace(/ /g, "+")}&display=swap`, C.rel = "stylesheet", document.head.appendChild(C);
|
|
7680
7464
|
}
|
|
7681
7465
|
});
|
|
7682
|
-
}, [
|
|
7683
|
-
|
|
7466
|
+
}, [F.availableFonts]), React.useEffect(() => {
|
|
7467
|
+
L((s) => ({
|
|
7684
7468
|
...s,
|
|
7685
7469
|
isList: C,
|
|
7686
|
-
availableProps: w
|
|
7470
|
+
availableProps: w,
|
|
7471
|
+
theme: k
|
|
7687
7472
|
}));
|
|
7688
|
-
}, [
|
|
7689
|
-
|
|
7690
|
-
|
|
7473
|
+
}, [
|
|
7474
|
+
C,
|
|
7475
|
+
w,
|
|
7476
|
+
k
|
|
7477
|
+
]);
|
|
7478
|
+
let V = React.useCallback((s) => {
|
|
7479
|
+
L((d) => ({
|
|
7691
7480
|
...d,
|
|
7692
7481
|
...s,
|
|
7693
7482
|
isList: s.isList ?? d.isList,
|
|
@@ -7695,7 +7484,7 @@ const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [] })
|
|
|
7695
7484
|
availableFonts: s.availableFonts ?? d.availableFonts,
|
|
7696
7485
|
selectedElementId: null
|
|
7697
7486
|
}));
|
|
7698
|
-
}, []),
|
|
7487
|
+
}, []), U = React.useCallback((s) => {
|
|
7699
7488
|
let d = {};
|
|
7700
7489
|
s.type === "box" && (d.backgroundColor = "var(--gray-4)");
|
|
7701
7490
|
let C = {
|
|
@@ -7710,74 +7499,74 @@ const EditorProvider = ({ children: s, isList: C = !1, availableProps: w = [] })
|
|
|
7710
7499
|
...s.style || {}
|
|
7711
7500
|
}
|
|
7712
7501
|
};
|
|
7713
|
-
|
|
7502
|
+
L((s) => ({
|
|
7714
7503
|
...s,
|
|
7715
7504
|
elements: [...s.elements, C]
|
|
7716
7505
|
}));
|
|
7717
|
-
}, []),
|
|
7718
|
-
|
|
7506
|
+
}, []), K = React.useCallback((s) => {
|
|
7507
|
+
L((d) => ({
|
|
7719
7508
|
...d,
|
|
7720
7509
|
elements: d.elements.filter((d) => d.id !== s),
|
|
7721
7510
|
selectedElementId: d.selectedElementId === s ? null : d.selectedElementId
|
|
7722
7511
|
}));
|
|
7723
|
-
}, []),
|
|
7724
|
-
|
|
7512
|
+
}, []), q = React.useCallback((s) => {
|
|
7513
|
+
L((d) => ({
|
|
7725
7514
|
...d,
|
|
7726
7515
|
selectedElementId: s
|
|
7727
7516
|
}));
|
|
7728
|
-
}, []),
|
|
7729
|
-
|
|
7517
|
+
}, []), J = React.useCallback((s, d) => {
|
|
7518
|
+
L((C) => {
|
|
7730
7519
|
let w = [...C.elements], k = w[s];
|
|
7731
7520
|
return w.splice(s, 1), w.splice(d, 0, k), {
|
|
7732
7521
|
...C,
|
|
7733
7522
|
elements: w
|
|
7734
7523
|
};
|
|
7735
7524
|
});
|
|
7736
|
-
}, []),
|
|
7737
|
-
|
|
7525
|
+
}, []), X = React.useCallback((s, d) => {
|
|
7526
|
+
L((C) => ({
|
|
7738
7527
|
...C,
|
|
7739
7528
|
elements: C.elements.map((C) => C.id === s ? {
|
|
7740
7529
|
...C,
|
|
7741
7530
|
...d
|
|
7742
7531
|
} : C)
|
|
7743
7532
|
}));
|
|
7744
|
-
}, []),
|
|
7745
|
-
|
|
7533
|
+
}, []), $ = React.useCallback((s, d) => {
|
|
7534
|
+
L((C) => ({
|
|
7746
7535
|
...C,
|
|
7747
7536
|
mockData: s,
|
|
7748
7537
|
singleMockData: d
|
|
7749
7538
|
}));
|
|
7750
|
-
}, []),
|
|
7751
|
-
|
|
7539
|
+
}, []), PD = React.useCallback((s) => {
|
|
7540
|
+
L((d) => ({
|
|
7752
7541
|
...d,
|
|
7753
7542
|
listSettings: {
|
|
7754
7543
|
...d.listSettings,
|
|
7755
7544
|
...s
|
|
7756
7545
|
}
|
|
7757
7546
|
}));
|
|
7758
|
-
}, []),
|
|
7759
|
-
state:
|
|
7760
|
-
addElement:
|
|
7761
|
-
removeElement:
|
|
7762
|
-
selectElement:
|
|
7763
|
-
moveElement:
|
|
7764
|
-
updateElement:
|
|
7765
|
-
setMockData:
|
|
7766
|
-
updateListSettings:
|
|
7767
|
-
loadState:
|
|
7547
|
+
}, []), FD = React.useMemo(() => ({
|
|
7548
|
+
state: F,
|
|
7549
|
+
addElement: U,
|
|
7550
|
+
removeElement: K,
|
|
7551
|
+
selectElement: q,
|
|
7552
|
+
moveElement: J,
|
|
7553
|
+
updateElement: X,
|
|
7554
|
+
setMockData: $,
|
|
7555
|
+
updateListSettings: PD,
|
|
7556
|
+
loadState: V
|
|
7768
7557
|
}), [
|
|
7769
|
-
|
|
7770
|
-
V,
|
|
7558
|
+
F,
|
|
7771
7559
|
U,
|
|
7772
7560
|
K,
|
|
7773
7561
|
q,
|
|
7774
7562
|
J,
|
|
7775
7563
|
X,
|
|
7776
7564
|
$,
|
|
7777
|
-
|
|
7565
|
+
PD,
|
|
7566
|
+
V
|
|
7778
7567
|
]);
|
|
7779
7568
|
return /* @__PURE__ */ jsx(EditorContext.Provider, {
|
|
7780
|
-
value:
|
|
7569
|
+
value: FD,
|
|
7781
7570
|
children: s
|
|
7782
7571
|
});
|
|
7783
7572
|
}, useEditor = () => {
|
|
@@ -8070,16 +7859,16 @@ var __assign$1 = function() {
|
|
|
8070
7859
|
maxHeight: d
|
|
8071
7860
|
};
|
|
8072
7861
|
}, d.prototype.calculateNewSizeFromDirection = function(s, d) {
|
|
8073
|
-
var C = this.props.scale || 1, w = normalizeToPair(this.props.resizeRatio || 1), k = w[0], F = w[1], L = this.state, V = L.direction, U = L.original, K = this.props, q = K.lockAspectRatio, J = K.lockAspectRatioExtraHeight, X = K.lockAspectRatioExtraWidth, $ = U.width,
|
|
8074
|
-
return hasDirection("right", V) && ($ = U.width + (s - U.x) * k / C, q && (
|
|
7862
|
+
var C = this.props.scale || 1, w = normalizeToPair(this.props.resizeRatio || 1), k = w[0], F = w[1], L = this.state, V = L.direction, U = L.original, K = this.props, q = K.lockAspectRatio, J = K.lockAspectRatioExtraHeight, X = K.lockAspectRatioExtraWidth, $ = U.width, PD = U.height, FD = J || 0, ID = X || 0;
|
|
7863
|
+
return hasDirection("right", V) && ($ = U.width + (s - U.x) * k / C, q && (PD = ($ - ID) / this.ratio + FD)), hasDirection("left", V) && ($ = U.width - (s - U.x) * k / C, q && (PD = ($ - ID) / this.ratio + FD)), hasDirection("bottom", V) && (PD = U.height + (d - U.y) * F / C, q && ($ = (PD - FD) * this.ratio + ID)), hasDirection("top", V) && (PD = U.height - (d - U.y) * F / C, q && ($ = (PD - FD) * this.ratio + ID)), {
|
|
8075
7864
|
newWidth: $,
|
|
8076
|
-
newHeight:
|
|
7865
|
+
newHeight: PD
|
|
8077
7866
|
};
|
|
8078
7867
|
}, d.prototype.calculateNewSizeFromAspectRatio = function(s, d, C, w) {
|
|
8079
7868
|
var k = this.props, F = k.lockAspectRatio, L = k.lockAspectRatioExtraHeight, V = k.lockAspectRatioExtraWidth, U = w.width === void 0 ? 10 : w.width, K = C.width === void 0 || C.width < 0 ? s : C.width, q = w.height === void 0 ? 10 : w.height, J = C.height === void 0 || C.height < 0 ? d : C.height, X = L || 0, $ = V || 0;
|
|
8080
7869
|
if (F) {
|
|
8081
|
-
var
|
|
8082
|
-
s = clamp$1(s,
|
|
7870
|
+
var PD = (q - X) * this.ratio + $, FD = (J - X) * this.ratio + $, ID = (U - $) / this.ratio + X, LD = (K - $) / this.ratio + X, RD = Math.max(U, PD), zD = Math.min(K, FD), BD = Math.max(q, ID), VD = Math.min(J, LD);
|
|
7871
|
+
s = clamp$1(s, RD, zD), d = clamp$1(d, BD, VD);
|
|
8083
7872
|
} else s = clamp$1(s, U, K), d = clamp$1(d, q, J);
|
|
8084
7873
|
return {
|
|
8085
7874
|
newWidth: s,
|
|
@@ -8134,58 +7923,58 @@ var __assign$1 = function() {
|
|
|
8134
7923
|
if (this.window.TouchEvent && isTouchEvent(s)) try {
|
|
8135
7924
|
s.preventDefault(), s.stopPropagation();
|
|
8136
7925
|
} catch {}
|
|
8137
|
-
var C = this.props, w = C.maxWidth, k = C.maxHeight, F = C.minWidth, L = C.minHeight, V = isTouchEvent(s) ? s.touches[0].clientX : s.clientX, U = isTouchEvent(s) ? s.touches[0].clientY : s.clientY, K = this.state, q = K.direction, J = K.original, X = K.width, $ = K.height,
|
|
8138
|
-
w =
|
|
8139
|
-
var
|
|
8140
|
-
this.props.snap && this.props.snap.x && (
|
|
8141
|
-
var
|
|
8142
|
-
width:
|
|
8143
|
-
height:
|
|
7926
|
+
var C = this.props, w = C.maxWidth, k = C.maxHeight, F = C.minWidth, L = C.minHeight, V = isTouchEvent(s) ? s.touches[0].clientX : s.clientX, U = isTouchEvent(s) ? s.touches[0].clientY : s.clientY, K = this.state, q = K.direction, J = K.original, X = K.width, $ = K.height, PD = this.getParentSize(), FD = calculateNewMax(PD, this.window.innerWidth, this.window.innerHeight, w, k, F, L);
|
|
7927
|
+
w = FD.maxWidth, k = FD.maxHeight, F = FD.minWidth, L = FD.minHeight;
|
|
7928
|
+
var ID = this.calculateNewSizeFromDirection(V, U), LD = ID.newHeight, RD = ID.newWidth, zD = this.calculateNewMaxFromBoundary(w, k);
|
|
7929
|
+
this.props.snap && this.props.snap.x && (RD = findClosestSnap(RD, this.props.snap.x, this.props.snapGap)), this.props.snap && this.props.snap.y && (LD = findClosestSnap(LD, this.props.snap.y, this.props.snapGap));
|
|
7930
|
+
var BD = this.calculateNewSizeFromAspectRatio(RD, LD, {
|
|
7931
|
+
width: zD.maxWidth,
|
|
7932
|
+
height: zD.maxHeight
|
|
8144
7933
|
}, {
|
|
8145
7934
|
width: F,
|
|
8146
7935
|
height: L
|
|
8147
7936
|
});
|
|
8148
|
-
if (
|
|
8149
|
-
var
|
|
8150
|
-
|
|
7937
|
+
if (RD = BD.newWidth, LD = BD.newHeight, this.props.grid) {
|
|
7938
|
+
var VD = snap(RD, this.props.grid[0], this.props.gridGap ? this.props.gridGap[0] : 0), UD = snap(LD, this.props.grid[1], this.props.gridGap ? this.props.gridGap[1] : 0), WD = this.props.snapGap || 0, GD = WD === 0 || Math.abs(VD - RD) <= WD ? VD : RD, KD = WD === 0 || Math.abs(UD - LD) <= WD ? UD : LD;
|
|
7939
|
+
RD = GD, LD = KD;
|
|
8151
7940
|
}
|
|
8152
|
-
var
|
|
8153
|
-
width:
|
|
8154
|
-
height:
|
|
7941
|
+
var qD = {
|
|
7942
|
+
width: RD - J.width,
|
|
7943
|
+
height: LD - J.height
|
|
8155
7944
|
};
|
|
8156
|
-
if (this.delta =
|
|
7945
|
+
if (this.delta = qD, X && typeof X == "string") {
|
|
8157
7946
|
if (X.endsWith("%")) {
|
|
8158
|
-
var
|
|
8159
|
-
|
|
7947
|
+
var JD = RD / PD.width * 100;
|
|
7948
|
+
RD = `${JD}%`;
|
|
8160
7949
|
} else if (X.endsWith("vw")) {
|
|
8161
|
-
var
|
|
8162
|
-
|
|
7950
|
+
var YD = RD / this.window.innerWidth * 100;
|
|
7951
|
+
RD = `${YD}vw`;
|
|
8163
7952
|
} else if (X.endsWith("vh")) {
|
|
8164
|
-
var
|
|
8165
|
-
|
|
7953
|
+
var XD = RD / this.window.innerHeight * 100;
|
|
7954
|
+
RD = `${XD}vh`;
|
|
8166
7955
|
}
|
|
8167
7956
|
}
|
|
8168
7957
|
if ($ && typeof $ == "string") {
|
|
8169
7958
|
if ($.endsWith("%")) {
|
|
8170
|
-
var
|
|
8171
|
-
|
|
7959
|
+
var JD = LD / PD.height * 100;
|
|
7960
|
+
LD = `${JD}%`;
|
|
8172
7961
|
} else if ($.endsWith("vw")) {
|
|
8173
|
-
var
|
|
8174
|
-
|
|
7962
|
+
var YD = LD / this.window.innerWidth * 100;
|
|
7963
|
+
LD = `${YD}vw`;
|
|
8175
7964
|
} else if ($.endsWith("vh")) {
|
|
8176
|
-
var
|
|
8177
|
-
|
|
7965
|
+
var XD = LD / this.window.innerHeight * 100;
|
|
7966
|
+
LD = `${XD}vh`;
|
|
8178
7967
|
}
|
|
8179
7968
|
}
|
|
8180
|
-
var
|
|
8181
|
-
width: this.createSizeForCssProperty(
|
|
8182
|
-
height: this.createSizeForCssProperty(
|
|
7969
|
+
var ZD = {
|
|
7970
|
+
width: this.createSizeForCssProperty(RD, "width"),
|
|
7971
|
+
height: this.createSizeForCssProperty(LD, "height")
|
|
8183
7972
|
};
|
|
8184
|
-
this.flexDir === "row" ?
|
|
8185
|
-
var
|
|
8186
|
-
|
|
8187
|
-
d.setState(
|
|
8188
|
-
}), this.props.onResize &&
|
|
7973
|
+
this.flexDir === "row" ? ZD.flexBasis = ZD.width : this.flexDir === "column" && (ZD.flexBasis = ZD.height);
|
|
7974
|
+
var QD = this.state.width !== ZD.width, $D = this.state.height !== ZD.height, eO = this.state.flexBasis !== ZD.flexBasis, tO = QD || $D || eO;
|
|
7975
|
+
tO && flushSync(function() {
|
|
7976
|
+
d.setState(ZD);
|
|
7977
|
+
}), this.props.onResize && tO && this.props.onResize(s, q, this.resizable, qD);
|
|
8189
7978
|
}
|
|
8190
7979
|
}, d.prototype.onMouseUp = function(s) {
|
|
8191
7980
|
var d = this.state, C = d.isResizing, w = d.direction;
|
|
@@ -8268,40 +8057,75 @@ var __assign$1 = function() {
|
|
|
8268
8057
|
resizeRatio: 1,
|
|
8269
8058
|
snapGap: 0
|
|
8270
8059
|
}, d;
|
|
8271
|
-
}(PureComponent)
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8060
|
+
}(PureComponent), MenuItem = ({ children: s, onClick: d, rightSlot: C, style: w, className: k }) => /* @__PURE__ */ jsxs("div", {
|
|
8061
|
+
className: `custom-menu-item ${k || ""}`,
|
|
8062
|
+
onClick: (s) => {
|
|
8063
|
+
s.stopPropagation(), d && d();
|
|
8064
|
+
},
|
|
8065
|
+
style: w,
|
|
8066
|
+
children: [s, C && /* @__PURE__ */ jsx("div", {
|
|
8067
|
+
className: "custom-menu-right-slot",
|
|
8068
|
+
children: C
|
|
8069
|
+
})]
|
|
8070
|
+
}), MenuSeparator = () => /* @__PURE__ */ jsx("div", { className: "custom-menu-separator" }), SubMenu = ({ label: s, children: d, scrollable: C }) => /* @__PURE__ */ jsxs("div", {
|
|
8071
|
+
className: "custom-menu-item",
|
|
8072
|
+
children: [
|
|
8073
|
+
s,
|
|
8074
|
+
/* @__PURE__ */ jsx("div", {
|
|
8075
|
+
className: "custom-menu-right-slot",
|
|
8076
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8077
|
+
}),
|
|
8078
|
+
/* @__PURE__ */ jsx("div", {
|
|
8079
|
+
className: `custom-submenu ${C ? "scrollable" : ""}`,
|
|
8080
|
+
children: d
|
|
8081
|
+
})
|
|
8082
|
+
]
|
|
8083
|
+
});
|
|
8084
|
+
const ElementContextMenu = ({ children: s, element: d }) => {
|
|
8085
|
+
let { updateElement: C, removeElement: w, addElement: k, moveElement: F, state: L } = useEditor(), [V, U] = useState(null), [K, q] = useState(!1), [X, $] = useState(!1), [PD, FD] = useState(d.content), [ID, zD] = useState(d.dataBinding || ""), BD = useRef(null), HD = useRef(null);
|
|
8086
|
+
useEffect(() => {
|
|
8087
|
+
let s = () => U(null);
|
|
8088
|
+
return window.addEventListener("scroll", s, !0), window.addEventListener("resize", s), () => {
|
|
8089
|
+
window.removeEventListener("scroll", s, !0), window.removeEventListener("resize", s);
|
|
8090
|
+
};
|
|
8091
|
+
}, []);
|
|
8092
|
+
let KD = (s) => {
|
|
8093
|
+
s.preventDefault(), s.stopPropagation(), U({
|
|
8094
|
+
x: s.clientX,
|
|
8095
|
+
y: s.clientY
|
|
8096
|
+
});
|
|
8097
|
+
}, qD = () => U(null), JD = (s) => {
|
|
8098
|
+
let d = BD.current;
|
|
8275
8099
|
if (d) {
|
|
8276
|
-
let C = d.selectionStart, w = d.selectionEnd, k =
|
|
8277
|
-
|
|
8100
|
+
let C = d.selectionStart, w = d.selectionEnd, k = PD;
|
|
8101
|
+
FD(k.substring(0, C) + `{{${s}}}` + k.substring(w)), setTimeout(() => {
|
|
8278
8102
|
d.focus();
|
|
8279
8103
|
let w = C + s.length + 4;
|
|
8280
8104
|
d.setSelectionRange(w, w);
|
|
8281
8105
|
}, 0);
|
|
8282
|
-
} else
|
|
8283
|
-
},
|
|
8284
|
-
|
|
8285
|
-
...
|
|
8106
|
+
} else FD((d) => d + `{{${s}}}`);
|
|
8107
|
+
}, YD = (s) => {
|
|
8108
|
+
C(d.id, { style: {
|
|
8109
|
+
...d.style,
|
|
8286
8110
|
...s
|
|
8287
|
-
} });
|
|
8288
|
-
},
|
|
8289
|
-
let s =
|
|
8290
|
-
s <
|
|
8291
|
-
},
|
|
8292
|
-
let s =
|
|
8293
|
-
s > 0 &&
|
|
8294
|
-
},
|
|
8295
|
-
|
|
8296
|
-
type:
|
|
8297
|
-
content:
|
|
8298
|
-
x:
|
|
8299
|
-
y:
|
|
8300
|
-
width:
|
|
8301
|
-
height:
|
|
8302
|
-
style:
|
|
8303
|
-
});
|
|
8304
|
-
},
|
|
8111
|
+
} }), qD();
|
|
8112
|
+
}, XD = () => {
|
|
8113
|
+
let s = L.elements.findIndex((s) => s.id === d.id);
|
|
8114
|
+
s < L.elements.length - 1 && F(s, L.elements.length - 1), qD();
|
|
8115
|
+
}, ZD = () => {
|
|
8116
|
+
let s = L.elements.findIndex((s) => s.id === d.id);
|
|
8117
|
+
s > 0 && F(s, 0), qD();
|
|
8118
|
+
}, QD = () => {
|
|
8119
|
+
k({
|
|
8120
|
+
type: d.type,
|
|
8121
|
+
content: d.content,
|
|
8122
|
+
x: d.x + 20,
|
|
8123
|
+
y: d.y + 20,
|
|
8124
|
+
width: d.width,
|
|
8125
|
+
height: d.height,
|
|
8126
|
+
style: d.style
|
|
8127
|
+
}), qD();
|
|
8128
|
+
}, $D = [
|
|
8305
8129
|
"#000000",
|
|
8306
8130
|
"#FFFFFF",
|
|
8307
8131
|
"#FF0000",
|
|
@@ -8311,11 +8135,16 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8311
8135
|
"#808080",
|
|
8312
8136
|
"#800080",
|
|
8313
8137
|
"transparent"
|
|
8314
|
-
]
|
|
8138
|
+
];
|
|
8315
8139
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
8140
|
+
/* @__PURE__ */ jsx("div", {
|
|
8141
|
+
onContextMenu: KD,
|
|
8142
|
+
style: { display: "contents" },
|
|
8143
|
+
children: s
|
|
8144
|
+
}),
|
|
8316
8145
|
/* @__PURE__ */ jsx(s$2, {
|
|
8317
|
-
open:
|
|
8318
|
-
onOpenChange:
|
|
8146
|
+
open: K,
|
|
8147
|
+
onOpenChange: q,
|
|
8319
8148
|
children: /* @__PURE__ */ jsxs(p$5, {
|
|
8320
8149
|
style: { maxWidth: 450 },
|
|
8321
8150
|
children: [/* @__PURE__ */ jsx(g$1, { children: "Editar Texto" }), /* @__PURE__ */ jsxs(p, {
|
|
@@ -8323,13 +8152,13 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8323
8152
|
gap: "3",
|
|
8324
8153
|
children: [
|
|
8325
8154
|
/* @__PURE__ */ jsx(r, {
|
|
8326
|
-
ref:
|
|
8327
|
-
value:
|
|
8328
|
-
onChange: (s) =>
|
|
8155
|
+
ref: BD,
|
|
8156
|
+
value: PD,
|
|
8157
|
+
onChange: (s) => FD(s.target.value),
|
|
8329
8158
|
placeholder: "Digite o novo texto...",
|
|
8330
8159
|
style: { height: 100 }
|
|
8331
8160
|
}),
|
|
8332
|
-
|
|
8161
|
+
L.availableProps && L.availableProps.length > 0 && /* @__PURE__ */ jsxs(p, {
|
|
8333
8162
|
direction: "column",
|
|
8334
8163
|
gap: "2",
|
|
8335
8164
|
children: [/* @__PURE__ */ jsx(p$2, {
|
|
@@ -8339,11 +8168,11 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8339
8168
|
}), /* @__PURE__ */ jsx(p, {
|
|
8340
8169
|
gap: "2",
|
|
8341
8170
|
wrap: "wrap",
|
|
8342
|
-
children:
|
|
8171
|
+
children: L.availableProps.map((s) => /* @__PURE__ */ jsx(e, {
|
|
8343
8172
|
color: "blue",
|
|
8344
8173
|
variant: "surface",
|
|
8345
8174
|
style: { cursor: "pointer" },
|
|
8346
|
-
onClick: () =>
|
|
8175
|
+
onClick: () => JD(s.dataName),
|
|
8347
8176
|
children: s.name
|
|
8348
8177
|
}, s.dataName))
|
|
8349
8178
|
})]
|
|
@@ -8357,7 +8186,7 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8357
8186
|
children: "Cancelar"
|
|
8358
8187
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
8359
8188
|
onClick: () => {
|
|
8360
|
-
|
|
8189
|
+
C(d.id, { content: PD }), q(!1);
|
|
8361
8190
|
},
|
|
8362
8191
|
children: "Salvar"
|
|
8363
8192
|
})]
|
|
@@ -8367,8 +8196,8 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8367
8196
|
})
|
|
8368
8197
|
}),
|
|
8369
8198
|
/* @__PURE__ */ jsx(s$2, {
|
|
8370
|
-
open:
|
|
8371
|
-
onOpenChange:
|
|
8199
|
+
open: X,
|
|
8200
|
+
onOpenChange: $,
|
|
8372
8201
|
children: /* @__PURE__ */ jsxs(p$5, {
|
|
8373
8202
|
style: { maxWidth: 450 },
|
|
8374
8203
|
children: [/* @__PURE__ */ jsx(g$1, { children: "Vincular Dados Manualmente" }), /* @__PURE__ */ jsxs(p, {
|
|
@@ -8380,8 +8209,8 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8380
8209
|
children: "Nome da propriedade (ex: titulo, preco, imagem):"
|
|
8381
8210
|
}),
|
|
8382
8211
|
/* @__PURE__ */ jsx(u, {
|
|
8383
|
-
value:
|
|
8384
|
-
onChange: (s) =>
|
|
8212
|
+
value: ID,
|
|
8213
|
+
onChange: (s) => zD(s.target.value),
|
|
8385
8214
|
placeholder: "propriedade"
|
|
8386
8215
|
}),
|
|
8387
8216
|
/* @__PURE__ */ jsxs(p, {
|
|
@@ -8393,8 +8222,8 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8393
8222
|
children: "Cancelar"
|
|
8394
8223
|
}) }), /* @__PURE__ */ jsx(o, {
|
|
8395
8224
|
onClick: () => {
|
|
8396
|
-
let s =
|
|
8397
|
-
|
|
8225
|
+
let s = ID, w = { dataBinding: s };
|
|
8226
|
+
d.type === "text" && (w.content = `{{${s}}}`), C(d.id, w), $(!1);
|
|
8398
8227
|
},
|
|
8399
8228
|
children: "Vincular"
|
|
8400
8229
|
})]
|
|
@@ -8405,187 +8234,152 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8405
8234
|
}),
|
|
8406
8235
|
/* @__PURE__ */ jsx("input", {
|
|
8407
8236
|
type: "file",
|
|
8408
|
-
ref:
|
|
8237
|
+
ref: HD,
|
|
8409
8238
|
style: { display: "none" },
|
|
8410
8239
|
accept: "image/*",
|
|
8411
8240
|
onChange: (s) => {
|
|
8412
|
-
let
|
|
8413
|
-
if (
|
|
8241
|
+
let w = s.target.files?.[0];
|
|
8242
|
+
if (w) {
|
|
8414
8243
|
let s = new FileReader();
|
|
8415
8244
|
s.onload = (s) => {
|
|
8416
|
-
s.target?.result &&
|
|
8417
|
-
}, s.readAsDataURL(
|
|
8245
|
+
s.target?.result && C(d.id, { content: s.target.result });
|
|
8246
|
+
}, s.readAsDataURL(w);
|
|
8418
8247
|
}
|
|
8248
|
+
qD();
|
|
8419
8249
|
}
|
|
8420
8250
|
}),
|
|
8421
|
-
/* @__PURE__ */ jsxs(
|
|
8422
|
-
|
|
8423
|
-
|
|
8424
|
-
|
|
8425
|
-
|
|
8251
|
+
V && createPortal(/* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
8252
|
+
className: "custom-context-menu-overlay",
|
|
8253
|
+
onClick: qD,
|
|
8254
|
+
onContextMenu: (s) => {
|
|
8255
|
+
s.preventDefault(), qD();
|
|
8256
|
+
}
|
|
8257
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
8258
|
+
className: "custom-context-menu",
|
|
8259
|
+
style: {
|
|
8260
|
+
top: Math.min(V.y, window.innerHeight - 300),
|
|
8261
|
+
left: Math.min(V.x, window.innerWidth - 250)
|
|
8262
|
+
},
|
|
8426
8263
|
children: [
|
|
8427
|
-
/* @__PURE__ */ jsxs(
|
|
8428
|
-
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
|
|
8435
|
-
|
|
8436
|
-
|
|
8437
|
-
|
|
8438
|
-
|
|
8264
|
+
/* @__PURE__ */ jsxs(SubMenu, {
|
|
8265
|
+
label: /* @__PURE__ */ jsxs(Fragment$1, { children: ["Vincular Dados ", d.dataBinding && /* @__PURE__ */ jsxs("span", {
|
|
8266
|
+
style: {
|
|
8267
|
+
fontSize: 10,
|
|
8268
|
+
marginLeft: 4,
|
|
8269
|
+
opacity: .7
|
|
8270
|
+
},
|
|
8271
|
+
children: [
|
|
8272
|
+
"(",
|
|
8273
|
+
d.dataBinding,
|
|
8274
|
+
")"
|
|
8275
|
+
]
|
|
8276
|
+
})] }),
|
|
8439
8277
|
children: [
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
8443
|
-
|
|
8444
|
-
C.type === "text" && (d.content = `{{${s.dataName}}}`), w(C.id, d);
|
|
8278
|
+
L.availableProps && L.availableProps.length > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [L.availableProps.map((s) => /* @__PURE__ */ jsx(MenuItem, {
|
|
8279
|
+
onClick: () => {
|
|
8280
|
+
let w = { dataBinding: s.dataName };
|
|
8281
|
+
d.type === "text" && (w.content = `{{${s.dataName}}}`), C(d.id, w), qD();
|
|
8445
8282
|
},
|
|
8446
|
-
|
|
8447
|
-
|
|
8448
|
-
style: {
|
|
8449
|
-
color: "var(--gray-10)",
|
|
8450
|
-
fontSize: 10
|
|
8451
|
-
},
|
|
8283
|
+
rightSlot: /* @__PURE__ */ jsx("span", {
|
|
8284
|
+
style: { fontSize: 10 },
|
|
8452
8285
|
children: s.dataName
|
|
8453
|
-
})
|
|
8454
|
-
|
|
8455
|
-
/* @__PURE__ */ jsx(
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
|
|
8286
|
+
}),
|
|
8287
|
+
children: s.name
|
|
8288
|
+
}, s.dataName)), /* @__PURE__ */ jsx(MenuSeparator, {})] }),
|
|
8289
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
8290
|
+
onClick: () => {
|
|
8291
|
+
zD(d.dataBinding || ""), $(!0), qD();
|
|
8459
8292
|
},
|
|
8460
8293
|
children: "Outro / Manual..."
|
|
8461
8294
|
}),
|
|
8462
|
-
|
|
8463
|
-
|
|
8295
|
+
d.dataBinding && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(MenuSeparator, {}), /* @__PURE__ */ jsx(MenuItem, {
|
|
8296
|
+
onClick: () => {
|
|
8297
|
+
C(d.id, { dataBinding: void 0 }), qD();
|
|
8298
|
+
},
|
|
8464
8299
|
style: { color: "var(--red-9)" },
|
|
8465
|
-
onSelect: () => w(C.id, { dataBinding: void 0 }),
|
|
8466
8300
|
children: "Remover Vínculo"
|
|
8467
8301
|
})] })
|
|
8468
8302
|
]
|
|
8469
|
-
})
|
|
8470
|
-
/* @__PURE__ */ jsx(
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
$(C.content), K(!0);
|
|
8303
|
+
}),
|
|
8304
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
8305
|
+
d.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(MenuItem, {
|
|
8306
|
+
onClick: () => {
|
|
8307
|
+
FD(d.content), q(!0), qD();
|
|
8475
8308
|
},
|
|
8476
8309
|
children: "Editar Texto..."
|
|
8477
|
-
}), /* @__PURE__ */ jsx(
|
|
8478
|
-
/* @__PURE__ */ jsx(
|
|
8479
|
-
|
|
8480
|
-
onSelect: FO,
|
|
8310
|
+
}), /* @__PURE__ */ jsx(MenuSeparator, {})] }),
|
|
8311
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
8312
|
+
onClick: QD,
|
|
8481
8313
|
children: "Duplicar"
|
|
8482
8314
|
}),
|
|
8483
|
-
/* @__PURE__ */ jsx(
|
|
8484
|
-
|
|
8485
|
-
|
|
8315
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
8316
|
+
onClick: () => {
|
|
8317
|
+
w(d.id), qD();
|
|
8318
|
+
},
|
|
8486
8319
|
children: "Excluir"
|
|
8487
8320
|
}),
|
|
8488
|
-
/* @__PURE__ */ jsx(
|
|
8489
|
-
|
|
8490
|
-
/* @__PURE__ */ jsxs(
|
|
8491
|
-
|
|
8492
|
-
children: [
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
|
|
8497
|
-
className: "ContextMenuSubContent",
|
|
8498
|
-
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
8499
|
-
className: "ContextMenuItem",
|
|
8500
|
-
onSelect: () => LO.current?.click(),
|
|
8321
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
8322
|
+
d.type === "image" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
8323
|
+
/* @__PURE__ */ jsxs(SubMenu, {
|
|
8324
|
+
label: "Alterar Imagem",
|
|
8325
|
+
children: [/* @__PURE__ */ jsx(MenuItem, {
|
|
8326
|
+
onClick: () => {
|
|
8327
|
+
HD.current?.click(), qD();
|
|
8328
|
+
},
|
|
8501
8329
|
children: "Carregar do Computador"
|
|
8502
|
-
}), /* @__PURE__ */ jsx(
|
|
8503
|
-
|
|
8504
|
-
|
|
8505
|
-
|
|
8506
|
-
|
|
8330
|
+
}), /* @__PURE__ */ jsx(MenuItem, {
|
|
8331
|
+
onClick: () => {
|
|
8332
|
+
qD(), setTimeout(() => {
|
|
8333
|
+
let s = window.prompt("Insira a URL da imagem:", d.content);
|
|
8334
|
+
s !== null && C(d.id, { content: s });
|
|
8335
|
+
}, 10);
|
|
8507
8336
|
},
|
|
8508
8337
|
children: "Inserir URL"
|
|
8509
8338
|
})]
|
|
8510
|
-
})
|
|
8511
|
-
/* @__PURE__ */ jsxs(
|
|
8512
|
-
|
|
8513
|
-
children: ["Ajuste da Imagem", /* @__PURE__ */ jsx("div", {
|
|
8514
|
-
className: "RightSlot",
|
|
8515
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8516
|
-
})]
|
|
8517
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
|
|
8518
|
-
className: "ContextMenuSubContent",
|
|
8339
|
+
}),
|
|
8340
|
+
/* @__PURE__ */ jsxs(SubMenu, {
|
|
8341
|
+
label: "Ajuste da Imagem",
|
|
8519
8342
|
children: [
|
|
8520
|
-
/* @__PURE__ */ jsx(
|
|
8521
|
-
|
|
8522
|
-
onSelect: () => kO({ objectFit: "cover" }),
|
|
8343
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
8344
|
+
onClick: () => YD({ objectFit: "cover" }),
|
|
8523
8345
|
children: "Preencher (Cover)"
|
|
8524
8346
|
}),
|
|
8525
|
-
/* @__PURE__ */ jsx(
|
|
8526
|
-
|
|
8527
|
-
onSelect: () => kO({ objectFit: "contain" }),
|
|
8347
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
8348
|
+
onClick: () => YD({ objectFit: "contain" }),
|
|
8528
8349
|
children: "Ajustar (Contain)"
|
|
8529
8350
|
}),
|
|
8530
|
-
/* @__PURE__ */ jsx(
|
|
8531
|
-
|
|
8532
|
-
onSelect: () => kO({ objectFit: "fill" }),
|
|
8351
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
8352
|
+
onClick: () => YD({ objectFit: "fill" }),
|
|
8533
8353
|
children: "Esticar (Fill)"
|
|
8534
8354
|
})
|
|
8535
8355
|
]
|
|
8536
|
-
})
|
|
8537
|
-
/* @__PURE__ */ jsx(
|
|
8356
|
+
}),
|
|
8357
|
+
/* @__PURE__ */ jsx(MenuSeparator, {})
|
|
8538
8358
|
] }),
|
|
8539
|
-
/* @__PURE__ */ jsxs(
|
|
8540
|
-
|
|
8541
|
-
children: [
|
|
8542
|
-
|
|
8543
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8544
|
-
})]
|
|
8545
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
|
|
8546
|
-
className: "ContextMenuSubContent",
|
|
8547
|
-
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
8548
|
-
className: "ContextMenuItem",
|
|
8549
|
-
onSelect: AO,
|
|
8359
|
+
/* @__PURE__ */ jsxs(SubMenu, {
|
|
8360
|
+
label: "Camadas",
|
|
8361
|
+
children: [/* @__PURE__ */ jsx(MenuItem, {
|
|
8362
|
+
onClick: XD,
|
|
8550
8363
|
children: "Trazer para frente"
|
|
8551
|
-
}), /* @__PURE__ */ jsx(
|
|
8552
|
-
|
|
8553
|
-
onSelect: PO,
|
|
8364
|
+
}), /* @__PURE__ */ jsx(MenuItem, {
|
|
8365
|
+
onClick: ZD,
|
|
8554
8366
|
children: "Enviar para trás"
|
|
8555
8367
|
})]
|
|
8556
|
-
})
|
|
8557
|
-
/* @__PURE__ */ jsx(
|
|
8558
|
-
|
|
8559
|
-
/* @__PURE__ */
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
})]
|
|
8565
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
|
|
8566
|
-
className: "ContextMenuSubContent",
|
|
8567
|
-
style: {
|
|
8568
|
-
maxHeight: "300px",
|
|
8569
|
-
overflowY: "auto"
|
|
8570
|
-
},
|
|
8571
|
-
children: V.availableFonts && V.availableFonts.map((s) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
8572
|
-
className: "ContextMenuItem",
|
|
8573
|
-
onSelect: () => kO({ fontFamily: s }),
|
|
8368
|
+
}),
|
|
8369
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
8370
|
+
d.type === "text" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
8371
|
+
/* @__PURE__ */ jsx(SubMenu, {
|
|
8372
|
+
label: "Fonte",
|
|
8373
|
+
scrollable: !0,
|
|
8374
|
+
children: L.availableFonts && L.availableFonts.map((s) => /* @__PURE__ */ jsx(MenuItem, {
|
|
8375
|
+
onClick: () => YD({ fontFamily: s }),
|
|
8574
8376
|
style: { fontFamily: s },
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
children: "✓"
|
|
8578
|
-
})]
|
|
8377
|
+
rightSlot: d.style?.fontFamily === s ? "✓" : void 0,
|
|
8378
|
+
children: s
|
|
8579
8379
|
}, s))
|
|
8580
|
-
})
|
|
8581
|
-
/* @__PURE__ */
|
|
8582
|
-
|
|
8583
|
-
children: ["Tamanho da Fonte", /* @__PURE__ */ jsx("div", {
|
|
8584
|
-
className: "RightSlot",
|
|
8585
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8586
|
-
})]
|
|
8587
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
|
|
8588
|
-
className: "ContextMenuSubContent",
|
|
8380
|
+
}),
|
|
8381
|
+
/* @__PURE__ */ jsx(SubMenu, {
|
|
8382
|
+
label: "Tamanho da Fonte",
|
|
8589
8383
|
children: [
|
|
8590
8384
|
12,
|
|
8591
8385
|
14,
|
|
@@ -8595,23 +8389,15 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8595
8389
|
32,
|
|
8596
8390
|
48,
|
|
8597
8391
|
64
|
|
8598
|
-
].map((s) => /* @__PURE__ */ jsxs(
|
|
8599
|
-
|
|
8600
|
-
onSelect: () => kO({ fontSize: `${s}px` }),
|
|
8392
|
+
].map((s) => /* @__PURE__ */ jsxs(MenuItem, {
|
|
8393
|
+
onClick: () => YD({ fontSize: `${s}px` }),
|
|
8601
8394
|
children: [s, "px"]
|
|
8602
8395
|
}, s))
|
|
8603
|
-
})
|
|
8604
|
-
/* @__PURE__ */
|
|
8605
|
-
|
|
8606
|
-
children:
|
|
8607
|
-
|
|
8608
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8609
|
-
})]
|
|
8610
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
|
|
8611
|
-
className: "ContextMenuSubContent",
|
|
8612
|
-
children: IO.filter((s) => s !== "transparent").map((s) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
8613
|
-
className: "ContextMenuItem",
|
|
8614
|
-
onSelect: () => kO({ color: s }),
|
|
8396
|
+
}),
|
|
8397
|
+
/* @__PURE__ */ jsx(SubMenu, {
|
|
8398
|
+
label: "Cor do Texto",
|
|
8399
|
+
children: $D.filter((s) => s !== "transparent").map((s) => /* @__PURE__ */ jsxs(MenuItem, {
|
|
8400
|
+
onClick: () => YD({ color: s }),
|
|
8615
8401
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
8616
8402
|
width: 12,
|
|
8617
8403
|
height: 12,
|
|
@@ -8620,63 +8406,39 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8620
8406
|
border: "1px solid #ccc"
|
|
8621
8407
|
} }), s]
|
|
8622
8408
|
}, s))
|
|
8623
|
-
})
|
|
8624
|
-
/* @__PURE__ */ jsxs(
|
|
8625
|
-
|
|
8626
|
-
children: [
|
|
8627
|
-
|
|
8628
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8629
|
-
})]
|
|
8630
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
|
|
8631
|
-
className: "ContextMenuSubContent",
|
|
8632
|
-
children: [/* @__PURE__ */ jsx(Item2$1, {
|
|
8633
|
-
className: "ContextMenuItem",
|
|
8634
|
-
onSelect: () => kO({ fontWeight: "normal" }),
|
|
8409
|
+
}),
|
|
8410
|
+
/* @__PURE__ */ jsxs(SubMenu, {
|
|
8411
|
+
label: "Peso da Fonte",
|
|
8412
|
+
children: [/* @__PURE__ */ jsx(MenuItem, {
|
|
8413
|
+
onClick: () => YD({ fontWeight: "normal" }),
|
|
8635
8414
|
children: "Normal"
|
|
8636
|
-
}), /* @__PURE__ */ jsx(
|
|
8637
|
-
|
|
8638
|
-
onSelect: () => kO({ fontWeight: "bold" }),
|
|
8415
|
+
}), /* @__PURE__ */ jsx(MenuItem, {
|
|
8416
|
+
onClick: () => YD({ fontWeight: "bold" }),
|
|
8639
8417
|
children: "Negrito"
|
|
8640
8418
|
})]
|
|
8641
|
-
})
|
|
8642
|
-
/* @__PURE__ */ jsxs(
|
|
8643
|
-
|
|
8644
|
-
children: ["Alinhamento", /* @__PURE__ */ jsx("div", {
|
|
8645
|
-
className: "RightSlot",
|
|
8646
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8647
|
-
})]
|
|
8648
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
|
|
8649
|
-
className: "ContextMenuSubContent",
|
|
8419
|
+
}),
|
|
8420
|
+
/* @__PURE__ */ jsxs(SubMenu, {
|
|
8421
|
+
label: "Alinhamento",
|
|
8650
8422
|
children: [
|
|
8651
|
-
/* @__PURE__ */ jsx(
|
|
8652
|
-
|
|
8653
|
-
onSelect: () => kO({ textAlign: "left" }),
|
|
8423
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
8424
|
+
onClick: () => YD({ textAlign: "left" }),
|
|
8654
8425
|
children: "Esquerda"
|
|
8655
8426
|
}),
|
|
8656
|
-
/* @__PURE__ */ jsx(
|
|
8657
|
-
|
|
8658
|
-
onSelect: () => kO({ textAlign: "center" }),
|
|
8427
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
8428
|
+
onClick: () => YD({ textAlign: "center" }),
|
|
8659
8429
|
children: "Centro"
|
|
8660
8430
|
}),
|
|
8661
|
-
/* @__PURE__ */ jsx(
|
|
8662
|
-
|
|
8663
|
-
onSelect: () => kO({ textAlign: "right" }),
|
|
8431
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
8432
|
+
onClick: () => YD({ textAlign: "right" }),
|
|
8664
8433
|
children: "Direita"
|
|
8665
8434
|
})
|
|
8666
8435
|
]
|
|
8667
|
-
})
|
|
8436
|
+
})
|
|
8668
8437
|
] }),
|
|
8669
|
-
/* @__PURE__ */
|
|
8670
|
-
|
|
8671
|
-
children:
|
|
8672
|
-
|
|
8673
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8674
|
-
})]
|
|
8675
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
|
|
8676
|
-
className: "ContextMenuSubContent",
|
|
8677
|
-
children: IO.map((s) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
8678
|
-
className: "ContextMenuItem",
|
|
8679
|
-
onSelect: () => kO({ backgroundColor: s }),
|
|
8438
|
+
/* @__PURE__ */ jsx(SubMenu, {
|
|
8439
|
+
label: "Cor de Fundo",
|
|
8440
|
+
children: $D.map((s) => /* @__PURE__ */ jsxs(MenuItem, {
|
|
8441
|
+
onClick: () => YD({ backgroundColor: s }),
|
|
8680
8442
|
children: [/* @__PURE__ */ jsx("div", { style: {
|
|
8681
8443
|
width: 12,
|
|
8682
8444
|
height: 12,
|
|
@@ -8685,15 +8447,9 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8685
8447
|
border: "1px solid #ccc"
|
|
8686
8448
|
} }), s === "transparent" ? "Transparente" : s]
|
|
8687
8449
|
}, s))
|
|
8688
|
-
})
|
|
8689
|
-
/* @__PURE__ */
|
|
8690
|
-
|
|
8691
|
-
children: ["Arredondamento", /* @__PURE__ */ jsx("div", {
|
|
8692
|
-
className: "RightSlot",
|
|
8693
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8694
|
-
})]
|
|
8695
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
|
|
8696
|
-
className: "ContextMenuSubContent",
|
|
8450
|
+
}),
|
|
8451
|
+
/* @__PURE__ */ jsx(SubMenu, {
|
|
8452
|
+
label: "Arredondamento",
|
|
8697
8453
|
children: [
|
|
8698
8454
|
0,
|
|
8699
8455
|
4,
|
|
@@ -8702,20 +8458,13 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8702
8458
|
16,
|
|
8703
8459
|
24,
|
|
8704
8460
|
"50%"
|
|
8705
|
-
].map((s) => /* @__PURE__ */ jsx(
|
|
8706
|
-
|
|
8707
|
-
onSelect: () => kO({ borderRadius: typeof s == "number" ? `${s}px` : s }),
|
|
8461
|
+
].map((s) => /* @__PURE__ */ jsx(MenuItem, {
|
|
8462
|
+
onClick: () => YD({ borderRadius: typeof s == "number" ? `${s}px` : s }),
|
|
8708
8463
|
children: s === "50%" ? "Círculo" : `${s}px`
|
|
8709
8464
|
}, s))
|
|
8710
|
-
})
|
|
8711
|
-
/* @__PURE__ */
|
|
8712
|
-
|
|
8713
|
-
children: ["Espaçamento", /* @__PURE__ */ jsx("div", {
|
|
8714
|
-
className: "RightSlot",
|
|
8715
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8716
|
-
})]
|
|
8717
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
|
|
8718
|
-
className: "ContextMenuSubContent",
|
|
8465
|
+
}),
|
|
8466
|
+
/* @__PURE__ */ jsx(SubMenu, {
|
|
8467
|
+
label: "Espaçamento",
|
|
8719
8468
|
children: [
|
|
8720
8469
|
0,
|
|
8721
8470
|
4,
|
|
@@ -8724,31 +8473,17 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8724
8473
|
16,
|
|
8725
8474
|
24,
|
|
8726
8475
|
32
|
|
8727
|
-
].map((s) => /* @__PURE__ */ jsxs(
|
|
8728
|
-
|
|
8729
|
-
onSelect: () => kO({ padding: `${s}px` }),
|
|
8476
|
+
].map((s) => /* @__PURE__ */ jsxs(MenuItem, {
|
|
8477
|
+
onClick: () => YD({ padding: `${s}px` }),
|
|
8730
8478
|
children: [s, "px"]
|
|
8731
8479
|
}, s))
|
|
8732
|
-
})
|
|
8733
|
-
/* @__PURE__ */ jsxs(
|
|
8734
|
-
|
|
8735
|
-
children: [
|
|
8736
|
-
|
|
8737
|
-
children: /* @__PURE__ */
|
|
8738
|
-
|
|
8739
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
|
|
8740
|
-
className: "ContextMenuSubContent",
|
|
8741
|
-
children: [/* @__PURE__ */ jsxs(Sub2$1, { children: [/* @__PURE__ */ jsxs(SubTrigger2$1, {
|
|
8742
|
-
className: "ContextMenuSubTrigger",
|
|
8743
|
-
children: ["Cor da Borda", /* @__PURE__ */ jsx("div", {
|
|
8744
|
-
className: "RightSlot",
|
|
8745
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8746
|
-
})]
|
|
8747
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsxs(SubContent2$1, {
|
|
8748
|
-
className: "ContextMenuSubContent",
|
|
8749
|
-
children: [IO.filter((s) => s !== "transparent").map((s) => /* @__PURE__ */ jsxs(Item2$1, {
|
|
8750
|
-
className: "ContextMenuItem",
|
|
8751
|
-
onSelect: () => kO({
|
|
8480
|
+
}),
|
|
8481
|
+
/* @__PURE__ */ jsxs(SubMenu, {
|
|
8482
|
+
label: "Borda",
|
|
8483
|
+
children: [/* @__PURE__ */ jsxs(SubMenu, {
|
|
8484
|
+
label: "Cor da Borda",
|
|
8485
|
+
children: [$D.filter((s) => s !== "transparent").map((s) => /* @__PURE__ */ jsxs(MenuItem, {
|
|
8486
|
+
onClick: () => YD({
|
|
8752
8487
|
borderColor: s,
|
|
8753
8488
|
borderStyle: "solid"
|
|
8754
8489
|
}),
|
|
@@ -8759,36 +8494,28 @@ const ElementContextMenu = ({ children: s, element: C }) => {
|
|
|
8759
8494
|
marginRight: 8,
|
|
8760
8495
|
border: "1px solid #ccc"
|
|
8761
8496
|
} }), s]
|
|
8762
|
-
}, s)), /* @__PURE__ */ jsx(
|
|
8763
|
-
|
|
8764
|
-
onSelect: () => kO({ borderStyle: "none" }),
|
|
8497
|
+
}, s)), /* @__PURE__ */ jsx(MenuItem, {
|
|
8498
|
+
onClick: () => YD({ borderStyle: "none" }),
|
|
8765
8499
|
children: "Sem Borda"
|
|
8766
8500
|
})]
|
|
8767
|
-
})
|
|
8768
|
-
|
|
8769
|
-
children: ["Espessura", /* @__PURE__ */ jsx("div", {
|
|
8770
|
-
className: "RightSlot",
|
|
8771
|
-
children: /* @__PURE__ */ jsx(ChevronRightIcon, {})
|
|
8772
|
-
})]
|
|
8773
|
-
}), /* @__PURE__ */ jsx(Portal2$1, { children: /* @__PURE__ */ jsx(SubContent2$1, {
|
|
8774
|
-
className: "ContextMenuSubContent",
|
|
8501
|
+
}), /* @__PURE__ */ jsx(SubMenu, {
|
|
8502
|
+
label: "Espessura",
|
|
8775
8503
|
children: [
|
|
8776
8504
|
1,
|
|
8777
8505
|
2,
|
|
8778
8506
|
4,
|
|
8779
8507
|
8
|
|
8780
|
-
].map((s) => /* @__PURE__ */ jsxs(
|
|
8781
|
-
|
|
8782
|
-
onSelect: () => kO({
|
|
8508
|
+
].map((s) => /* @__PURE__ */ jsxs(MenuItem, {
|
|
8509
|
+
onClick: () => YD({
|
|
8783
8510
|
borderWidth: `${s}px`,
|
|
8784
8511
|
borderStyle: "solid"
|
|
8785
8512
|
}),
|
|
8786
8513
|
children: [s, "px"]
|
|
8787
8514
|
}, s))
|
|
8788
|
-
})
|
|
8789
|
-
})
|
|
8515
|
+
})]
|
|
8516
|
+
})
|
|
8790
8517
|
]
|
|
8791
|
-
}) })
|
|
8518
|
+
})] }), document.body)
|
|
8792
8519
|
] });
|
|
8793
8520
|
};
|
|
8794
8521
|
var DraggableResizableElement = ({ element: s, isSelected: d }) => {
|
|
@@ -8798,26 +8525,26 @@ var DraggableResizableElement = ({ element: s, isSelected: d }) => {
|
|
|
8798
8525
|
}), q = useRef({
|
|
8799
8526
|
x: 0,
|
|
8800
8527
|
y: 0
|
|
8801
|
-
}), X = useRef(0), $ = useRef(0),
|
|
8528
|
+
}), X = useRef(0), $ = useRef(0), PD = useRef({
|
|
8802
8529
|
x: 0,
|
|
8803
8530
|
y: 0
|
|
8804
|
-
}),
|
|
8805
|
-
if (
|
|
8806
|
-
if (s.type === "text")
|
|
8807
|
-
let C =
|
|
8531
|
+
}), FD = k.isList ? k.mockData.length > 0 ? k.mockData[0] : null : k.singleMockData, ID = s.content;
|
|
8532
|
+
if (FD) {
|
|
8533
|
+
if (s.type === "text") ID = ID.replace(/\{\{(.*?)\}\}/g, (s, d) => {
|
|
8534
|
+
let C = FD[d.trim()];
|
|
8808
8535
|
return C == null ? s : String(C);
|
|
8809
8536
|
});
|
|
8810
8537
|
else if (s.type === "image") if (s.dataBinding) {
|
|
8811
|
-
let d =
|
|
8812
|
-
d != null && (
|
|
8813
|
-
} else
|
|
8814
|
-
let C =
|
|
8538
|
+
let d = FD[s.dataBinding];
|
|
8539
|
+
d != null && (ID = String(d));
|
|
8540
|
+
} else ID = ID.replace(/\{\{(.*?)\}\}/g, (s, d) => {
|
|
8541
|
+
let C = FD[d.trim()];
|
|
8815
8542
|
return C == null ? s : String(C);
|
|
8816
8543
|
});
|
|
8817
8544
|
}
|
|
8818
|
-
let
|
|
8545
|
+
let zD = (d) => {
|
|
8819
8546
|
d.stopPropagation(), C(s.id);
|
|
8820
|
-
},
|
|
8547
|
+
}, BD = (d) => {
|
|
8821
8548
|
d.button === 0 && (d.stopPropagation(), C(s.id), L(!0), K.current = {
|
|
8822
8549
|
x: d.clientX,
|
|
8823
8550
|
y: d.clientY
|
|
@@ -8825,16 +8552,16 @@ var DraggableResizableElement = ({ element: s, isSelected: d }) => {
|
|
|
8825
8552
|
x: s.x,
|
|
8826
8553
|
y: s.y
|
|
8827
8554
|
});
|
|
8828
|
-
},
|
|
8555
|
+
}, VD = (d) => {
|
|
8829
8556
|
d.stopPropagation(), d.preventDefault(), U(!0);
|
|
8830
8557
|
let C = d.target.closest(".resizable-element");
|
|
8831
8558
|
if (C) {
|
|
8832
8559
|
let w = C.getBoundingClientRect();
|
|
8833
|
-
|
|
8560
|
+
PD.current = {
|
|
8834
8561
|
x: w.left + w.width / 2,
|
|
8835
8562
|
y: w.top + w.height / 2
|
|
8836
8563
|
};
|
|
8837
|
-
let k = d.clientX -
|
|
8564
|
+
let k = d.clientX - PD.current.x, F = d.clientY - PD.current.y;
|
|
8838
8565
|
X.current = Math.atan2(F, k) * (180 / Math.PI), $.current = s.rotation || 0;
|
|
8839
8566
|
}
|
|
8840
8567
|
};
|
|
@@ -8848,7 +8575,7 @@ var DraggableResizableElement = ({ element: s, isSelected: d }) => {
|
|
|
8848
8575
|
});
|
|
8849
8576
|
}
|
|
8850
8577
|
if (V) {
|
|
8851
|
-
let C = d.clientX -
|
|
8578
|
+
let C = d.clientX - PD.current.x, k = d.clientY - PD.current.y, F = Math.atan2(k, C) * (180 / Math.PI) - X.current;
|
|
8852
8579
|
w(s.id, { rotation: ($.current + F) % 360 });
|
|
8853
8580
|
}
|
|
8854
8581
|
}, C = () => {
|
|
@@ -8863,7 +8590,7 @@ var DraggableResizableElement = ({ element: s, isSelected: d }) => {
|
|
|
8863
8590
|
s.id,
|
|
8864
8591
|
w
|
|
8865
8592
|
]);
|
|
8866
|
-
let
|
|
8593
|
+
let HD = {
|
|
8867
8594
|
position: "absolute",
|
|
8868
8595
|
left: 0,
|
|
8869
8596
|
top: 0,
|
|
@@ -8904,9 +8631,9 @@ var DraggableResizableElement = ({ element: s, isSelected: d }) => {
|
|
|
8904
8631
|
position: "relative"
|
|
8905
8632
|
},
|
|
8906
8633
|
children: [/* @__PURE__ */ jsxs(p$1, {
|
|
8907
|
-
style:
|
|
8908
|
-
onMouseDown:
|
|
8909
|
-
onClick:
|
|
8634
|
+
style: HD,
|
|
8635
|
+
onMouseDown: BD,
|
|
8636
|
+
onClick: zD,
|
|
8910
8637
|
onMouseEnter: (s) => {
|
|
8911
8638
|
d || (s.currentTarget.style.borderColor = "var(--gray-6)");
|
|
8912
8639
|
},
|
|
@@ -8919,10 +8646,10 @@ var DraggableResizableElement = ({ element: s, isSelected: d }) => {
|
|
|
8919
8646
|
width: "100%",
|
|
8920
8647
|
height: "100%"
|
|
8921
8648
|
},
|
|
8922
|
-
children:
|
|
8649
|
+
children: ID
|
|
8923
8650
|
}),
|
|
8924
|
-
s.type === "image" && (
|
|
8925
|
-
src:
|
|
8651
|
+
s.type === "image" && (ID ? /* @__PURE__ */ jsx("img", {
|
|
8652
|
+
src: ID,
|
|
8926
8653
|
alt: "Element",
|
|
8927
8654
|
style: {
|
|
8928
8655
|
width: "100%",
|
|
@@ -8964,7 +8691,7 @@ var DraggableResizableElement = ({ element: s, isSelected: d }) => {
|
|
|
8964
8691
|
zIndex: 50,
|
|
8965
8692
|
boxShadow: "0 0 0 2px white"
|
|
8966
8693
|
},
|
|
8967
|
-
onMouseDown:
|
|
8694
|
+
onMouseDown: VD,
|
|
8968
8695
|
children: /* @__PURE__ */ jsx(p$1, { style: {
|
|
8969
8696
|
position: "absolute",
|
|
8970
8697
|
top: 12,
|
|
@@ -9152,16 +8879,16 @@ function createRenderBatcher(s, d) {
|
|
|
9152
8879
|
delta: 0,
|
|
9153
8880
|
timestamp: 0,
|
|
9154
8881
|
isProcessing: !1
|
|
9155
|
-
}, F = () => C = !0, L = stepsOrder.reduce((s, C) => (s[C] = createRenderStep(F, d ? C : void 0), s), {}), { setup: V, read: U, resolveKeyframes: K, preUpdate: q, update: J, preRender: X, render: $, postRender:
|
|
8882
|
+
}, F = () => C = !0, L = stepsOrder.reduce((s, C) => (s[C] = createRenderStep(F, d ? C : void 0), s), {}), { setup: V, read: U, resolveKeyframes: K, preUpdate: q, update: J, preRender: X, render: $, postRender: PD } = L, FD = () => {
|
|
9156
8883
|
let F = MotionGlobalConfig.useManualTiming ? k.timestamp : performance.now();
|
|
9157
|
-
C = !1, MotionGlobalConfig.useManualTiming || (k.delta = w ? 1e3 / 60 : Math.max(Math.min(F - k.timestamp, maxElapsed), 1)), k.timestamp = F, k.isProcessing = !0, V.process(k), U.process(k), K.process(k), q.process(k), J.process(k), X.process(k), $.process(k),
|
|
9158
|
-
},
|
|
9159
|
-
C = !0, w = !0, k.isProcessing || s(
|
|
8884
|
+
C = !1, MotionGlobalConfig.useManualTiming || (k.delta = w ? 1e3 / 60 : Math.max(Math.min(F - k.timestamp, maxElapsed), 1)), k.timestamp = F, k.isProcessing = !0, V.process(k), U.process(k), K.process(k), q.process(k), J.process(k), X.process(k), $.process(k), PD.process(k), k.isProcessing = !1, C && d && (w = !1, s(FD));
|
|
8885
|
+
}, ID = () => {
|
|
8886
|
+
C = !0, w = !0, k.isProcessing || s(FD);
|
|
9160
8887
|
};
|
|
9161
8888
|
return {
|
|
9162
8889
|
schedule: stepsOrder.reduce((s, d) => {
|
|
9163
8890
|
let w = L[d];
|
|
9164
|
-
return s[d] = (s, d = !1, k = !1) => (C ||
|
|
8891
|
+
return s[d] = (s, d = !1, k = !1) => (C || ID(), w.schedule(s, d, k)), s;
|
|
9165
8892
|
}, {}),
|
|
9166
8893
|
cancel: (s) => {
|
|
9167
8894
|
for (let d = 0; d < stepsOrder.length; d++) L[stepsOrder[d]].cancel(s);
|
|
@@ -9519,40 +9246,40 @@ function spring(s = springDefaults.visualDuration, d = springDefaults.bounce) {
|
|
|
9519
9246
|
}, { stiffness: U, damping: K, mass: q, duration: J, velocity: X, isResolvedFromDuration: $ } = getSpringOptions({
|
|
9520
9247
|
...C,
|
|
9521
9248
|
velocity: -/* @__PURE__ */ millisecondsToSeconds(C.velocity || 0)
|
|
9522
|
-
}),
|
|
9523
|
-
w ||=
|
|
9524
|
-
let
|
|
9525
|
-
if (
|
|
9526
|
-
let s = calcAngularFreq(
|
|
9527
|
-
|
|
9528
|
-
} else if (
|
|
9249
|
+
}), PD = X || 0, FD = K / (2 * Math.sqrt(U * q)), ID = L - F, LD = /* @__PURE__ */ millisecondsToSeconds(Math.sqrt(U / q)), RD = Math.abs(ID) < 5;
|
|
9250
|
+
w ||= RD ? springDefaults.restSpeed.granular : springDefaults.restSpeed.default, k ||= RD ? springDefaults.restDelta.granular : springDefaults.restDelta.default;
|
|
9251
|
+
let zD;
|
|
9252
|
+
if (FD < 1) {
|
|
9253
|
+
let s = calcAngularFreq(LD, FD);
|
|
9254
|
+
zD = (d) => L - Math.exp(-FD * LD * d) * ((PD + FD * LD * ID) / s * Math.sin(s * d) + ID * Math.cos(s * d));
|
|
9255
|
+
} else if (FD === 1) zD = (s) => L - Math.exp(-LD * s) * (ID + (PD + LD * ID) * s);
|
|
9529
9256
|
else {
|
|
9530
|
-
let s =
|
|
9531
|
-
|
|
9532
|
-
let C = Math.exp(-
|
|
9533
|
-
return L - C * ((
|
|
9257
|
+
let s = LD * Math.sqrt(FD * FD - 1);
|
|
9258
|
+
zD = (d) => {
|
|
9259
|
+
let C = Math.exp(-FD * LD * d), w = Math.min(s * d, 300);
|
|
9260
|
+
return L - C * ((PD + FD * LD * ID) * Math.sinh(w) + s * ID * Math.cosh(w)) / s;
|
|
9534
9261
|
};
|
|
9535
9262
|
}
|
|
9536
|
-
let
|
|
9263
|
+
let BD = {
|
|
9537
9264
|
calculatedDuration: $ && J || null,
|
|
9538
9265
|
next: (s) => {
|
|
9539
|
-
let d =
|
|
9266
|
+
let d = zD(s);
|
|
9540
9267
|
if ($) V.done = s >= J;
|
|
9541
9268
|
else {
|
|
9542
|
-
let C = s === 0 ?
|
|
9543
|
-
|
|
9269
|
+
let C = s === 0 ? PD : 0;
|
|
9270
|
+
FD < 1 && (C = s === 0 ? /* @__PURE__ */ secondsToMilliseconds(PD) : calcGeneratorVelocity(zD, s, d));
|
|
9544
9271
|
let F = Math.abs(C) <= w, U = Math.abs(L - d) <= k;
|
|
9545
9272
|
V.done = F && U;
|
|
9546
9273
|
}
|
|
9547
9274
|
return V.value = V.done ? L : d, V;
|
|
9548
9275
|
},
|
|
9549
9276
|
toString: () => {
|
|
9550
|
-
let s = Math.min(calcGeneratorDuration(
|
|
9277
|
+
let s = Math.min(calcGeneratorDuration(BD), maxGeneratorDuration), d = generateLinearEasing((d) => BD.next(s * d).value, s, 30);
|
|
9551
9278
|
return s + "ms " + d;
|
|
9552
9279
|
},
|
|
9553
9280
|
toTransition: () => {}
|
|
9554
9281
|
};
|
|
9555
|
-
return
|
|
9282
|
+
return BD;
|
|
9556
9283
|
}
|
|
9557
9284
|
spring.applyToOptions = (s) => {
|
|
9558
9285
|
let d = createGeneratorEasing(s, 100, spring);
|
|
@@ -9562,26 +9289,26 @@ function inertia({ keyframes: s, velocity: d = 0, power: C = .8, timeConstant: w
|
|
|
9562
9289
|
let J = s[0], X = {
|
|
9563
9290
|
done: !1,
|
|
9564
9291
|
value: J
|
|
9565
|
-
}, $ = (s) => V !== void 0 && s < V || U !== void 0 && s > U,
|
|
9566
|
-
|
|
9567
|
-
let
|
|
9568
|
-
let d =
|
|
9569
|
-
X.done = Math.abs(d) <= K, X.value = X.done ?
|
|
9570
|
-
},
|
|
9571
|
-
$(X.value) && (
|
|
9572
|
-
keyframes: [X.value,
|
|
9573
|
-
velocity: calcGeneratorVelocity(
|
|
9292
|
+
}, $ = (s) => V !== void 0 && s < V || U !== void 0 && s > U, PD = (s) => V === void 0 ? U : U === void 0 || Math.abs(V - s) < Math.abs(U - s) ? V : U, FD = C * d, ID = J + FD, LD = L === void 0 ? ID : L(ID);
|
|
9293
|
+
LD !== ID && (FD = LD - J);
|
|
9294
|
+
let RD = (s) => -FD * Math.exp(-s / w), zD = (s) => LD + RD(s), BD = (s) => {
|
|
9295
|
+
let d = RD(s), C = zD(s);
|
|
9296
|
+
X.done = Math.abs(d) <= K, X.value = X.done ? LD : C;
|
|
9297
|
+
}, VD, HD, UD = (s) => {
|
|
9298
|
+
$(X.value) && (VD = s, HD = spring({
|
|
9299
|
+
keyframes: [X.value, PD(X.value)],
|
|
9300
|
+
velocity: calcGeneratorVelocity(zD, s, X.value),
|
|
9574
9301
|
damping: k,
|
|
9575
9302
|
stiffness: F,
|
|
9576
9303
|
restDelta: K,
|
|
9577
9304
|
restSpeed: q
|
|
9578
9305
|
}));
|
|
9579
9306
|
};
|
|
9580
|
-
return
|
|
9307
|
+
return UD(0), {
|
|
9581
9308
|
calculatedDuration: null,
|
|
9582
9309
|
next: (s) => {
|
|
9583
9310
|
let d = !1;
|
|
9584
|
-
return !
|
|
9311
|
+
return !HD && VD === void 0 && (d = !0, BD(s), UD(s)), VD !== void 0 && s >= VD ? HD.next(s - VD) : (!d && BD(s), X);
|
|
9585
9312
|
}
|
|
9586
9313
|
};
|
|
9587
9314
|
}
|
|
@@ -9699,24 +9426,24 @@ var WithPromise = class {
|
|
|
9699
9426
|
tick(s, d = !1) {
|
|
9700
9427
|
let { generator: C, totalDuration: w, mixKeyframes: k, mirroredGenerator: F, resolvedDuration: L, calculatedDuration: V } = this;
|
|
9701
9428
|
if (this.startTime === null) return C.next(0);
|
|
9702
|
-
let { delay: U = 0, keyframes: K, repeat: q, repeatType: J, repeatDelay: X, type: $, onUpdate:
|
|
9429
|
+
let { delay: U = 0, keyframes: K, repeat: q, repeatType: J, repeatDelay: X, type: $, onUpdate: PD, finalKeyframe: FD } = this.options;
|
|
9703
9430
|
this.speed > 0 ? this.startTime = Math.min(this.startTime, s) : this.speed < 0 && (this.startTime = Math.min(s - w / this.speed, this.startTime)), d ? this.currentTime = s : this.updateTime(s);
|
|
9704
|
-
let
|
|
9705
|
-
this.currentTime = Math.max(
|
|
9706
|
-
let
|
|
9431
|
+
let ID = this.currentTime - U * (this.playbackSpeed >= 0 ? 1 : -1), LD = this.playbackSpeed >= 0 ? ID < 0 : ID > w;
|
|
9432
|
+
this.currentTime = Math.max(ID, 0), this.state === "finished" && this.holdTime === null && (this.currentTime = w);
|
|
9433
|
+
let RD = this.currentTime, zD = C;
|
|
9707
9434
|
if (q) {
|
|
9708
9435
|
let s = Math.min(this.currentTime, w) / L, d = Math.floor(s), C = s % 1;
|
|
9709
|
-
!C && s >= 1 && (C = 1), C === 1 && d--, d = Math.min(d, q + 1), d % 2 && (J === "reverse" ? (C = 1 - C, X && (C -= X / L)) : J === "mirror" && (
|
|
9436
|
+
!C && s >= 1 && (C = 1), C === 1 && d--, d = Math.min(d, q + 1), d % 2 && (J === "reverse" ? (C = 1 - C, X && (C -= X / L)) : J === "mirror" && (zD = F)), RD = clamp(0, 1, C) * L;
|
|
9710
9437
|
}
|
|
9711
|
-
let
|
|
9438
|
+
let BD = LD ? {
|
|
9712
9439
|
done: !1,
|
|
9713
9440
|
value: K[0]
|
|
9714
|
-
} :
|
|
9715
|
-
k && (
|
|
9716
|
-
let { done:
|
|
9717
|
-
!
|
|
9718
|
-
let
|
|
9719
|
-
return
|
|
9441
|
+
} : zD.next(RD);
|
|
9442
|
+
k && (BD.value = k(BD.value));
|
|
9443
|
+
let { done: VD } = BD;
|
|
9444
|
+
!LD && V !== null && (VD = this.playbackSpeed >= 0 ? this.currentTime >= w : this.currentTime <= 0);
|
|
9445
|
+
let HD = this.holdTime === null && (this.state === "finished" || this.state === "running" && VD);
|
|
9446
|
+
return HD && $ !== inertia && (BD.value = getFinalKeyframe$1(K, this.options, FD, this.speed)), PD && PD(BD.value), HD && this.finish(), BD;
|
|
9720
9447
|
}
|
|
9721
9448
|
then(s, d) {
|
|
9722
9449
|
return this.finished.then(s, d);
|
|
@@ -11085,18 +10812,18 @@ function useVisualElement(s, d, C, w, k, F) {
|
|
|
11085
10812
|
reducedMotionConfig: K,
|
|
11086
10813
|
isSVG: F
|
|
11087
10814
|
}));
|
|
11088
|
-
let $ = X.current,
|
|
11089
|
-
$ && !$.projection && k && ($.type === "html" || $.type === "svg") && createProjectionNode$1(X.current, C, k,
|
|
11090
|
-
let
|
|
10815
|
+
let $ = X.current, FD = useContext(SwitchLayoutGroupContext);
|
|
10816
|
+
$ && !$.projection && k && ($.type === "html" || $.type === "svg") && createProjectionNode$1(X.current, C, k, FD);
|
|
10817
|
+
let ID = useRef(!1);
|
|
11091
10818
|
useInsertionEffect(() => {
|
|
11092
|
-
$ &&
|
|
10819
|
+
$ && ID.current && $.update(C, U);
|
|
11093
10820
|
});
|
|
11094
|
-
let
|
|
10821
|
+
let RD = C[optimizedAppearDataAttribute], zD = useRef(!!RD && !window.MotionHandoffIsComplete?.(RD) && window.MotionHasOptimisedAnimation?.(RD));
|
|
11095
10822
|
return useIsomorphicLayoutEffect(() => {
|
|
11096
|
-
$ && (
|
|
10823
|
+
$ && (ID.current = !0, window.MotionIsMounted = !0, $.updateFeatures(), $.scheduleRenderMicrotask(), zD.current && $.animationState && $.animationState.animateChanges());
|
|
11097
10824
|
}), useEffect(() => {
|
|
11098
|
-
$ && (!
|
|
11099
|
-
window.MotionHandoffMarkAsComplete?.(
|
|
10825
|
+
$ && (!zD.current && $.animationState && $.animationState.animateChanges(), zD.current &&= (queueMicrotask(() => {
|
|
10826
|
+
window.MotionHandoffMarkAsComplete?.(RD);
|
|
11100
10827
|
}), !1), $.enteringChildren = void 0);
|
|
11101
10828
|
}), $;
|
|
11102
10829
|
}
|
|
@@ -11774,34 +11501,34 @@ function createAnimationState(s) {
|
|
|
11774
11501
|
function L(F) {
|
|
11775
11502
|
let { props: L } = s, V = getVariantContext(s.parent) || {}, U = [], K = /* @__PURE__ */ new Set(), q = {}, J = Infinity;
|
|
11776
11503
|
for (let d = 0; d < numAnimationTypes; d++) {
|
|
11777
|
-
let X = reversePriorityOrder[d], $ = C[X],
|
|
11778
|
-
|
|
11779
|
-
let
|
|
11780
|
-
if (
|
|
11781
|
-
let
|
|
11782
|
-
|
|
11783
|
-
let { prevResolvedValues:
|
|
11784
|
-
...
|
|
11785
|
-
...
|
|
11786
|
-
},
|
|
11787
|
-
|
|
11504
|
+
let X = reversePriorityOrder[d], $ = C[X], PD = L[X] === void 0 ? V[X] : L[X], FD = isVariantLabel(PD), ID = X === F ? $.isActive : null;
|
|
11505
|
+
ID === !1 && (J = d);
|
|
11506
|
+
let LD = PD === V[X] && PD !== L[X] && FD;
|
|
11507
|
+
if (LD && w && s.manuallyAnimateOnMount && (LD = !1), $.protectedKeys = { ...q }, !$.isActive && ID === null || !PD && !$.prevProp || isAnimationControls(PD) || typeof PD == "boolean") continue;
|
|
11508
|
+
let RD = checkVariantsDidChange($.prevProp, PD), zD = RD || X === F && $.isActive && !LD && FD || d > J && FD, BD = !1, VD = Array.isArray(PD) ? PD : [PD], HD = VD.reduce(k(X), {});
|
|
11509
|
+
ID === !1 && (HD = {});
|
|
11510
|
+
let { prevResolvedValues: UD = {} } = $, WD = {
|
|
11511
|
+
...UD,
|
|
11512
|
+
...HD
|
|
11513
|
+
}, GD = (d) => {
|
|
11514
|
+
zD = !0, K.has(d) && (BD = !0, K.delete(d)), $.needsAnimating[d] = !0;
|
|
11788
11515
|
let C = s.getValue(d);
|
|
11789
11516
|
C && (C.liveStyle = !1);
|
|
11790
11517
|
};
|
|
11791
|
-
for (let s in
|
|
11792
|
-
let d =
|
|
11518
|
+
for (let s in WD) {
|
|
11519
|
+
let d = HD[s], C = UD[s];
|
|
11793
11520
|
if (q.hasOwnProperty(s)) continue;
|
|
11794
11521
|
let w = !1;
|
|
11795
|
-
w = isKeyframesTarget(d) && isKeyframesTarget(C) ? !shallowCompare(d, C) : d !== C, w ? d == null ? K.add(s) :
|
|
11522
|
+
w = isKeyframesTarget(d) && isKeyframesTarget(C) ? !shallowCompare(d, C) : d !== C, w ? d == null ? K.add(s) : GD(s) : d !== void 0 && K.has(s) ? GD(s) : $.protectedKeys[s] = !0;
|
|
11796
11523
|
}
|
|
11797
|
-
$.prevProp =
|
|
11524
|
+
$.prevProp = PD, $.prevResolvedValues = HD, $.isActive && (q = {
|
|
11798
11525
|
...q,
|
|
11799
|
-
...
|
|
11800
|
-
}), w && s.blockInitialAnimation && (
|
|
11801
|
-
let
|
|
11802
|
-
|
|
11526
|
+
...HD
|
|
11527
|
+
}), w && s.blockInitialAnimation && (zD = !1);
|
|
11528
|
+
let KD = LD && RD;
|
|
11529
|
+
zD && (!KD || BD) && U.push(...VD.map((d) => {
|
|
11803
11530
|
let C = { type: X };
|
|
11804
|
-
if (typeof d == "string" && w && !
|
|
11531
|
+
if (typeof d == "string" && w && !KD && s.manuallyAnimateOnMount && s.parent) {
|
|
11805
11532
|
let { parent: w } = s, k = resolveVariant(w, d);
|
|
11806
11533
|
if (w.enteringChildren && k) {
|
|
11807
11534
|
let { delayChildren: d } = k.transition || {};
|
|
@@ -13394,7 +13121,7 @@ const Preview = () => {
|
|
|
13394
13121
|
height: "100%",
|
|
13395
13122
|
position: "relative",
|
|
13396
13123
|
overflow: "hidden",
|
|
13397
|
-
backgroundColor: "
|
|
13124
|
+
backgroundColor: "var(--color-panel-solid)"
|
|
13398
13125
|
},
|
|
13399
13126
|
children: /* @__PURE__ */ jsx(c, {
|
|
13400
13127
|
type: "auto",
|
|
@@ -13456,35 +13183,37 @@ const Preview = () => {
|
|
|
13456
13183
|
})
|
|
13457
13184
|
});
|
|
13458
13185
|
};
|
|
13459
|
-
var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
|
|
13460
|
-
let [
|
|
13186
|
+
var EditorContent = ({ layout: s, initialState: C, onSave: w, theme: k = "light" }) => {
|
|
13187
|
+
let [F, L] = useState(!0), [V, U] = useState(!0), { addElement: K, loadState: q, state: J } = useEditor();
|
|
13461
13188
|
React.useEffect(() => {
|
|
13462
13189
|
if (C) try {
|
|
13463
13190
|
let s = typeof C == "string" ? JSON.parse(C) : C;
|
|
13464
|
-
Array.isArray(s) ?
|
|
13191
|
+
Array.isArray(s) ? q({ elements: s }) : s.elements && q(s);
|
|
13465
13192
|
} catch (s) {
|
|
13466
13193
|
console.error("Failed to load initial state", s);
|
|
13467
13194
|
}
|
|
13468
|
-
}, [C,
|
|
13469
|
-
let
|
|
13470
|
-
console.log(`Adding element of type: ${s}`),
|
|
13195
|
+
}, [C, q]);
|
|
13196
|
+
let X = (s) => {
|
|
13197
|
+
console.log(`Adding element of type: ${s}`), K({
|
|
13471
13198
|
type: s,
|
|
13472
13199
|
content: `New ${s}`
|
|
13473
13200
|
});
|
|
13474
13201
|
};
|
|
13475
13202
|
return /* @__PURE__ */ jsx(R, {
|
|
13476
|
-
appearance:
|
|
13203
|
+
appearance: k,
|
|
13477
13204
|
accentColor: "blue",
|
|
13478
13205
|
grayColor: "slate",
|
|
13479
13206
|
radius: "medium",
|
|
13480
13207
|
scaling: "100%",
|
|
13481
13208
|
children: /* @__PURE__ */ jsxs(p, {
|
|
13209
|
+
direction: "row",
|
|
13482
13210
|
style: {
|
|
13483
|
-
height: "
|
|
13211
|
+
height: "100vh",
|
|
13484
13212
|
width: "100%",
|
|
13485
|
-
overflow: "hidden"
|
|
13213
|
+
overflow: "hidden",
|
|
13214
|
+
backgroundColor: "var(--color-background)"
|
|
13486
13215
|
},
|
|
13487
|
-
children: [
|
|
13216
|
+
children: [V && /* @__PURE__ */ jsxs(p, {
|
|
13488
13217
|
direction: "column",
|
|
13489
13218
|
width: "280px",
|
|
13490
13219
|
style: {
|
|
@@ -13521,15 +13250,15 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
|
|
|
13521
13250
|
style: { width: "240px" },
|
|
13522
13251
|
children: [
|
|
13523
13252
|
/* @__PURE__ */ jsx(v$1, {
|
|
13524
|
-
onSelect: () =>
|
|
13253
|
+
onSelect: () => X("text"),
|
|
13525
13254
|
children: "Texto"
|
|
13526
13255
|
}),
|
|
13527
13256
|
/* @__PURE__ */ jsx(v$1, {
|
|
13528
|
-
onSelect: () =>
|
|
13257
|
+
onSelect: () => X("image"),
|
|
13529
13258
|
children: "Imagem"
|
|
13530
13259
|
}),
|
|
13531
13260
|
/* @__PURE__ */ jsx(v$1, {
|
|
13532
|
-
onSelect: () =>
|
|
13261
|
+
onSelect: () => X("box"),
|
|
13533
13262
|
children: "Caixa (Container)"
|
|
13534
13263
|
})
|
|
13535
13264
|
]
|
|
@@ -13606,13 +13335,16 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
|
|
|
13606
13335
|
marginBottom: "12px"
|
|
13607
13336
|
},
|
|
13608
13337
|
onClick: () => {
|
|
13609
|
-
w
|
|
13610
|
-
|
|
13611
|
-
|
|
13612
|
-
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13338
|
+
if (w) {
|
|
13339
|
+
let s = {
|
|
13340
|
+
elements: J.elements,
|
|
13341
|
+
isList: J.isList,
|
|
13342
|
+
mockData: J.mockData,
|
|
13343
|
+
singleMockData: J.singleMockData,
|
|
13344
|
+
listSettings: J.listSettings
|
|
13345
|
+
};
|
|
13346
|
+
w(JSON.stringify(s, null, 2));
|
|
13347
|
+
}
|
|
13616
13348
|
},
|
|
13617
13349
|
children: [/* @__PURE__ */ jsx(Share1Icon, {}), " Salvar Alterações"]
|
|
13618
13350
|
})
|
|
@@ -13637,9 +13369,9 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
|
|
|
13637
13369
|
size: "2",
|
|
13638
13370
|
variant: "soft",
|
|
13639
13371
|
color: "gray",
|
|
13640
|
-
onClick: () =>
|
|
13641
|
-
title:
|
|
13642
|
-
children: jsx(
|
|
13372
|
+
onClick: () => U(!V),
|
|
13373
|
+
title: V ? "Ocultar Barra Lateral" : "Mostrar Barra Lateral",
|
|
13374
|
+
children: jsx(V ? DoubleArrowLeftIcon : DoubleArrowRightIcon, {})
|
|
13643
13375
|
})
|
|
13644
13376
|
}),
|
|
13645
13377
|
/* @__PURE__ */ jsx(p, {
|
|
@@ -13653,10 +13385,10 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
|
|
|
13653
13385
|
children: /* @__PURE__ */ jsx(o$1, {
|
|
13654
13386
|
size: "2",
|
|
13655
13387
|
variant: "soft",
|
|
13656
|
-
color:
|
|
13657
|
-
onClick: () =>
|
|
13658
|
-
title:
|
|
13659
|
-
children: jsx(
|
|
13388
|
+
color: F ? "blue" : "gray",
|
|
13389
|
+
onClick: () => L(!F),
|
|
13390
|
+
title: F ? "Ocultar Preview" : "Mostrar Preview",
|
|
13391
|
+
children: jsx(F ? EyeOpenIcon : EyeNoneIcon, {})
|
|
13660
13392
|
})
|
|
13661
13393
|
}),
|
|
13662
13394
|
/* @__PURE__ */ jsxs(Rt, {
|
|
@@ -13678,13 +13410,13 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
|
|
|
13678
13410
|
children: /* @__PURE__ */ jsx(Canvas, {})
|
|
13679
13411
|
})
|
|
13680
13412
|
}),
|
|
13681
|
-
|
|
13413
|
+
F && /* @__PURE__ */ jsx(Ot, { style: {
|
|
13682
13414
|
width: "4px",
|
|
13683
13415
|
backgroundColor: "var(--gray-6)",
|
|
13684
13416
|
cursor: "col-resize",
|
|
13685
13417
|
transition: "background-color 0.2s"
|
|
13686
13418
|
} }),
|
|
13687
|
-
|
|
13419
|
+
F && /* @__PURE__ */ jsx(kt, {
|
|
13688
13420
|
defaultSize: 50,
|
|
13689
13421
|
minSize: 20,
|
|
13690
13422
|
children: /* @__PURE__ */ jsx(p$1, {
|
|
@@ -13707,6 +13439,7 @@ var EditorContent = ({ layout: s, initialState: C, onSave: w }) => {
|
|
|
13707
13439
|
const GenericEditor = (s) => /* @__PURE__ */ jsx(EditorProvider, {
|
|
13708
13440
|
isList: s.layout.isList,
|
|
13709
13441
|
availableProps: s.layout.props,
|
|
13442
|
+
theme: s.theme,
|
|
13710
13443
|
children: /* @__PURE__ */ jsx(EditorContent, { ...s })
|
|
13711
13444
|
}), generateHTML = (s, d, C = {}) => Function("elements", "data", "options", getRendererCode() + "\nreturn renderTemplate(elements, data, options);")(s, d, C), getRendererCode = () => "\n/**\n * Render Template\n * @param {Array} elements - The JSON configuration of elements\n * @param {Object|Array} data - The data object to inject (Object for single, Array for list)\n * @param {Object} options - { isList: boolean, listSettings: { sortProp: string, sortOrder: 'asc'|'desc' } }\n * @returns {string} - The generated HTML string\n */\nfunction renderTemplate(elements, data, options = {}) {\n const { isList, listSettings } = options;\n\n const camelToKebab = (string) => {\n return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();\n };\n\n const styleObjectToString = (style) => {\n if (!style) return '';\n const pxProps = ['width', 'height', 'top', 'left', 'right', 'bottom', 'fontSize', 'borderRadius', 'padding', 'margin', 'borderWidth'];\n \n return Object.entries(style)\n .map(([key, value]) => {\n if (value === undefined || value === null) return '';\n const cssKey = camelToKebab(key);\n const cssValue = (typeof value === 'number' && pxProps.includes(key)) ? value + 'px' : value;\n return `${cssKey}: ${cssValue}`;\n })\n .filter(Boolean)\n .join('; ');\n };\n\n const renderItem = (itemData, index = 0, offsetY = 0) => {\n return elements.map(element => {\n let content = element.content;\n let imgSrc = '';\n\n if (element.type === 'text') {\n content = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n } else if (element.type === 'image') {\n if (element.dataBinding) {\n const val = itemData[element.dataBinding];\n if (val !== undefined && val !== null) {\n imgSrc = String(val);\n } else {\n imgSrc = content;\n }\n } else {\n imgSrc = content.replace(/\\{\\{(.*?)\\}\\}/g, (match, key) => {\n const val = itemData[key.trim()];\n return val !== undefined && val !== null ? String(val) : match;\n });\n }\n }\n\n const baseStyle = {\n position: 'absolute',\n left: element.x,\n top: element.y + offsetY,\n width: element.width,\n height: element.height,\n transform: element.rotation ? `rotate(${element.rotation}deg)` : undefined,\n overflow: 'hidden',\n ...element.style\n };\n \n const styleString = styleObjectToString(baseStyle);\n\n if (element.type === 'text') {\n return `<div style=\"${styleString}\">${content}</div>`;\n } else if (element.type === 'image') {\n const imgStyle = styleObjectToString({\n width: '100%',\n height: '100%',\n objectFit: element.style?.objectFit || 'cover',\n display: 'block'\n });\n return `<div style=\"${styleString}\"><img src=\"${imgSrc}\" alt=\"Element\" style=\"${imgStyle}\" /></div>`;\n } else if (element.type === 'box') {\n return `<div style=\"${styleString}\"></div>`;\n }\n return '';\n }).join('\\n');\n };\n\n if (isList && Array.isArray(data)) {\n // Calculate item height\n const maxY = Math.max(...elements.map(el => el.y + el.height));\n const itemHeight = maxY; // Add some padding if needed, or rely on element positioning\n\n // Sort data\n let listData = [...data];\n if (listSettings && listSettings.sortProp) {\n const prop = listSettings.sortProp;\n const order = listSettings.sortOrder === 'asc' ? 1 : -1;\n listData.sort((a, b) => {\n const valA = a[prop];\n const valB = b[prop];\n if (valA < valB) return -1 * order;\n if (valA > valB) return 1 * order;\n return 0;\n });\n }\n\n // Generate HTML for all items\n const itemsHtml = listData.map((item, index) => {\n // We render each item inside a relative container to maintain local positioning\n // But for the scroll animation, we usually stack them.\n // Let's stack them vertically.\n \n const itemHtml = renderItem(item, index, 0); // Internal offset is 0, we move the container\n const itemContainerStyle = styleObjectToString({\n position: 'relative',\n height: itemHeight,\n width: '100%',\n marginBottom: 20 // Spacing between items\n });\n \n return `<div class=\"list-item\" style=\"${itemContainerStyle}\">${itemHtml}</div>`;\n }).join('\\n');\n\n // Animation Styles\n // Bottom-anchored list (chat style)\n const animationCss = `\n @keyframes slideIn {\n from { opacity: 0; transform: translateY(50px); }\n to { opacity: 1; transform: translateY(0); }\n }\n .list-wrapper {\n display: flex;\n flex-direction: column;\n justify-content: flex-end;\n height: 100%;\n width: 100%;\n overflow: hidden;\n padding-bottom: 20px;\n box-sizing: border-box;\n }\n .list-item {\n flex-shrink: 0;\n animation: slideIn 0.5s ease-out;\n margin-top: 20px;\n width: 100%;\n position: relative;\n }\n `;\n\n return `\n <style>${animationCss}</style>\n <div class=\"list-wrapper\">\n ${itemsHtml}\n </div>\n `;\n }\n\n // Single Item\n const contentHtml = renderItem(data);\n return `<div style=\"position: relative; width: 100%; height: 100%; overflow: hidden;\">${contentHtml}</div>`;\n}\n";
|
|
13712
13445
|
export { GenericEditor as EditorContent, generateHTML };
|