@elementor/editor-controls 4.1.0-800 → 4.1.0-802
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +242 -196
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +169 -124
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/control-repeater/context/repeater-context.tsx +13 -0
- package/src/components/repeater/repeater.tsx +6 -10
- package/src/hooks/use-repeater-popover-dismiss.ts +53 -0
package/dist/index.mjs
CHANGED
|
@@ -1390,7 +1390,7 @@ var Control = forwardRef3(({ bind, label, children }, ref) => /* @__PURE__ */ Re
|
|
|
1390
1390
|
|
|
1391
1391
|
// src/controls/box-shadow-repeater-control.tsx
|
|
1392
1392
|
import * as React40 from "react";
|
|
1393
|
-
import { useRef as
|
|
1393
|
+
import { useRef as useRef5 } from "react";
|
|
1394
1394
|
import { boxShadowPropTypeUtil, shadowPropTypeUtil } from "@elementor/editor-props";
|
|
1395
1395
|
import { FormLabel as FormLabel2, Grid as Grid4, styled as styled4, UnstableColorIndicator } from "@elementor/ui";
|
|
1396
1396
|
import { __ as __11 } from "@wordpress/i18n";
|
|
@@ -1403,9 +1403,53 @@ import { __ as __5, sprintf } from "@wordpress/i18n";
|
|
|
1403
1403
|
|
|
1404
1404
|
// src/components/control-repeater/context/repeater-context.tsx
|
|
1405
1405
|
import * as React25 from "react";
|
|
1406
|
-
import { createContext as createContext7, useContext as useContext6, useEffect as
|
|
1406
|
+
import { createContext as createContext7, useContext as useContext6, useEffect as useEffect6, useMemo as useMemo4, useState as useState5 } from "react";
|
|
1407
1407
|
import { usePopupState as usePopupState3 } from "@elementor/ui";
|
|
1408
1408
|
|
|
1409
|
+
// src/hooks/use-repeater-popover-dismiss.ts
|
|
1410
|
+
import { useEffect as useEffect5, useMemo as useMemo3, useRef as useRef4 } from "react";
|
|
1411
|
+
import { useActiveBreakpoint as useActiveBreakpoint2, useBreakpoints } from "@elementor/editor-responsive";
|
|
1412
|
+
var serializeBreakpoints = (breakpoints) => breakpoints.map((b) => [b.id, b.width ?? "", b.type ?? ""].join(":")).join("|");
|
|
1413
|
+
var usePopoverDismiss = ({ isOpen, onClose }) => {
|
|
1414
|
+
const onCloseRef = useRef4(onClose);
|
|
1415
|
+
onCloseRef.current = onClose;
|
|
1416
|
+
const activeBreakpoint = useActiveBreakpoint2();
|
|
1417
|
+
const breakpoints = useBreakpoints();
|
|
1418
|
+
const breakpointsSignature = useMemo3(() => serializeBreakpoints(breakpoints), [breakpoints]);
|
|
1419
|
+
const prevActiveBreakpointRef = useRef4(void 0);
|
|
1420
|
+
const prevBreakpointsSignatureRef = useRef4(null);
|
|
1421
|
+
useEffect5(() => {
|
|
1422
|
+
if (!isOpen) {
|
|
1423
|
+
prevActiveBreakpointRef.current = activeBreakpoint;
|
|
1424
|
+
prevBreakpointsSignatureRef.current = breakpointsSignature;
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1427
|
+
const previousBreakpoint = prevActiveBreakpointRef.current;
|
|
1428
|
+
const previousSignature = prevBreakpointsSignatureRef.current;
|
|
1429
|
+
const breakpointChanged = previousBreakpoint !== void 0 && previousBreakpoint !== activeBreakpoint;
|
|
1430
|
+
const breakpointsChanged = previousSignature !== null && previousSignature !== breakpointsSignature;
|
|
1431
|
+
if (breakpointChanged || breakpointsChanged) {
|
|
1432
|
+
onCloseRef.current();
|
|
1433
|
+
}
|
|
1434
|
+
prevActiveBreakpointRef.current = activeBreakpoint;
|
|
1435
|
+
prevBreakpointsSignatureRef.current = breakpointsSignature;
|
|
1436
|
+
}, [activeBreakpoint, breakpointsSignature, isOpen]);
|
|
1437
|
+
useEffect5(() => {
|
|
1438
|
+
if (!isOpen) {
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
const onKeyDown = (event) => {
|
|
1442
|
+
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
1443
|
+
onCloseRef.current();
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
document.addEventListener("keydown", onKeyDown);
|
|
1447
|
+
return () => {
|
|
1448
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
1449
|
+
};
|
|
1450
|
+
}, [isOpen]);
|
|
1451
|
+
};
|
|
1452
|
+
|
|
1409
1453
|
// src/services/event-bus.ts
|
|
1410
1454
|
var EventBus = class {
|
|
1411
1455
|
listeners = /* @__PURE__ */ new Map();
|
|
@@ -1474,7 +1518,7 @@ var RepeaterContextProvider = ({
|
|
|
1474
1518
|
const [uniqueKeys, setUniqueKeys] = useState5(() => {
|
|
1475
1519
|
return items2?.map(() => generateUniqueKey()) ?? [];
|
|
1476
1520
|
});
|
|
1477
|
-
|
|
1521
|
+
useEffect6(() => {
|
|
1478
1522
|
const nextLength = items2?.length ?? 0;
|
|
1479
1523
|
setUniqueKeys((prev) => {
|
|
1480
1524
|
const prevLength = prev.length;
|
|
@@ -1487,7 +1531,7 @@ var RepeaterContextProvider = ({
|
|
|
1487
1531
|
return [...prev, ...Array.from({ length: nextLength - prevLength }, generateUniqueKey)];
|
|
1488
1532
|
});
|
|
1489
1533
|
}, [items2?.length]);
|
|
1490
|
-
const itemsWithKeys =
|
|
1534
|
+
const itemsWithKeys = useMemo4(
|
|
1491
1535
|
() => uniqueKeys.map((key, index) => ({
|
|
1492
1536
|
key,
|
|
1493
1537
|
item: items2[index]
|
|
@@ -1527,6 +1571,15 @@ var RepeaterContextProvider = ({
|
|
|
1527
1571
|
const newItems = [...items2.slice(0, index), updatedItem, ...items2.slice(index + 1)];
|
|
1528
1572
|
setItems(newItems);
|
|
1529
1573
|
};
|
|
1574
|
+
const closePopover = () => {
|
|
1575
|
+
if (!isOpen) {
|
|
1576
|
+
return;
|
|
1577
|
+
}
|
|
1578
|
+
setOpenItemIndex(EMPTY_OPEN_ITEM);
|
|
1579
|
+
setRowRef(null);
|
|
1580
|
+
popoverState.close();
|
|
1581
|
+
};
|
|
1582
|
+
usePopoverDismiss({ isOpen, onClose: closePopover });
|
|
1530
1583
|
return /* @__PURE__ */ React25.createElement(
|
|
1531
1584
|
RepeaterContext.Provider,
|
|
1532
1585
|
{
|
|
@@ -1976,7 +2029,7 @@ var StyledUnstableColorIndicator = styled4(UnstableColorIndicator)(({ theme }) =
|
|
|
1976
2029
|
var ItemIcon = ({ value }) => /* @__PURE__ */ React40.createElement(StyledUnstableColorIndicator, { size: "inherit", component: "span", value: value.value.color?.value });
|
|
1977
2030
|
var Content = () => {
|
|
1978
2031
|
const context = useBoundProp(shadowPropTypeUtil);
|
|
1979
|
-
const rowRef = [
|
|
2032
|
+
const rowRef = [useRef5(null), useRef5(null)];
|
|
1980
2033
|
const { rowRef: anchorEl } = useRepeaterContext();
|
|
1981
2034
|
return /* @__PURE__ */ React40.createElement(PropProvider, { ...context }, /* @__PURE__ */ React40.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React40.createElement(PopoverGridContainer, null, /* @__PURE__ */ React40.createElement(Control2, { bind: "color", label: __11("Color", "elementor") }, /* @__PURE__ */ React40.createElement(ColorControl, { anchorEl })), /* @__PURE__ */ React40.createElement(Control2, { bind: "position", label: __11("Position", "elementor"), sx: { overflow: "hidden" } }, /* @__PURE__ */ React40.createElement(
|
|
1982
2035
|
SelectControl,
|
|
@@ -2051,7 +2104,7 @@ import { __ as __17 } from "@wordpress/i18n";
|
|
|
2051
2104
|
|
|
2052
2105
|
// src/controls/filter-control/context/filter-config-context.tsx
|
|
2053
2106
|
import * as React41 from "react";
|
|
2054
|
-
import { createContext as createContext9, useContext as useContext9, useMemo as
|
|
2107
|
+
import { createContext as createContext9, useContext as useContext9, useMemo as useMemo5 } from "react";
|
|
2055
2108
|
import { cssFilterFunctionPropUtil } from "@elementor/editor-props";
|
|
2056
2109
|
|
|
2057
2110
|
// src/controls/filter-control/utils.ts
|
|
@@ -2153,7 +2206,7 @@ function extractPropType(propType, filterFunctionGroup) {
|
|
|
2153
2206
|
var FilterConfigContext = createContext9(null);
|
|
2154
2207
|
function FilterConfigProvider({ children }) {
|
|
2155
2208
|
const propContext = useBoundProp(cssFilterFunctionPropUtil);
|
|
2156
|
-
const contextValue =
|
|
2209
|
+
const contextValue = useMemo5(() => {
|
|
2157
2210
|
const config = buildFilterConfig(propContext.propType.item_prop_type);
|
|
2158
2211
|
const filterOptions = Object.entries(config).map(([key, conf]) => ({
|
|
2159
2212
|
value: key,
|
|
@@ -2186,7 +2239,7 @@ import { __ as __15 } from "@wordpress/i18n";
|
|
|
2186
2239
|
|
|
2187
2240
|
// src/controls/filter-control/drop-shadow/drop-shadow-item-content.tsx
|
|
2188
2241
|
import * as React42 from "react";
|
|
2189
|
-
import { useRef as
|
|
2242
|
+
import { useRef as useRef6 } from "react";
|
|
2190
2243
|
import { dropShadowFilterPropTypeUtil } from "@elementor/editor-props";
|
|
2191
2244
|
import { Grid as Grid5 } from "@elementor/ui";
|
|
2192
2245
|
import { __ as __14 } from "@wordpress/i18n";
|
|
@@ -2214,7 +2267,7 @@ var items = [
|
|
|
2214
2267
|
];
|
|
2215
2268
|
var DropShadowItemContent = ({ anchorEl }) => {
|
|
2216
2269
|
const context = useBoundProp(dropShadowFilterPropTypeUtil);
|
|
2217
|
-
const rowRefs = [
|
|
2270
|
+
const rowRefs = [useRef6(null), useRef6(null)];
|
|
2218
2271
|
return /* @__PURE__ */ React42.createElement(PropProvider, { ...context }, items.map((item) => /* @__PURE__ */ React42.createElement(PopoverGridContainer, { key: item.bind, ref: rowRefs[item.rowIndex] ?? null }, /* @__PURE__ */ React42.createElement(PropKeyProvider, { bind: item.bind }, /* @__PURE__ */ React42.createElement(Grid5, { item: true, xs: 6 }, /* @__PURE__ */ React42.createElement(ControlFormLabel, null, item.label)), /* @__PURE__ */ React42.createElement(Grid5, { item: true, xs: 6 }, item.bind === "color" ? /* @__PURE__ */ React42.createElement(ColorControl, { anchorEl }) : /* @__PURE__ */ React42.createElement(
|
|
2219
2272
|
SizeControl,
|
|
2220
2273
|
{
|
|
@@ -2227,7 +2280,7 @@ var DropShadowItemContent = ({ anchorEl }) => {
|
|
|
2227
2280
|
};
|
|
2228
2281
|
|
|
2229
2282
|
// src/controls/filter-control/single-size/single-size-item-content.tsx
|
|
2230
|
-
import { useRef as
|
|
2283
|
+
import { useRef as useRef7 } from "react";
|
|
2231
2284
|
import * as React43 from "react";
|
|
2232
2285
|
import {
|
|
2233
2286
|
blurFilterPropTypeUtil,
|
|
@@ -2243,7 +2296,7 @@ var propTypeMap = {
|
|
|
2243
2296
|
"color-tone": colorToneFilterPropTypeUtil
|
|
2244
2297
|
};
|
|
2245
2298
|
var SingleSizeItemContent = ({ filterFunc }) => {
|
|
2246
|
-
const rowRef =
|
|
2299
|
+
const rowRef = useRef7(null);
|
|
2247
2300
|
const { getFilterFunctionConfig } = useFilterConfig();
|
|
2248
2301
|
const { valueName, filterFunctionGroup } = getFilterFunctionConfig(filterFunc);
|
|
2249
2302
|
const context = useBoundProp(propTypeMap[filterFunctionGroup]);
|
|
@@ -2384,7 +2437,7 @@ function ensureFilterConfig(name) {
|
|
|
2384
2437
|
|
|
2385
2438
|
// src/controls/select-control-wrapper.tsx
|
|
2386
2439
|
import * as React50 from "react";
|
|
2387
|
-
import { useEffect as
|
|
2440
|
+
import { useEffect as useEffect7, useState as useState6 } from "react";
|
|
2388
2441
|
var getOffCanvasElements = () => {
|
|
2389
2442
|
const extendedWindow = window;
|
|
2390
2443
|
const documentId = extendedWindow.elementor.config.document.id;
|
|
@@ -2421,7 +2474,7 @@ var collectionMethods = {
|
|
|
2421
2474
|
};
|
|
2422
2475
|
var useDynamicOptions = (collectionId, initialOptions) => {
|
|
2423
2476
|
const [options, setOptions] = useState6(initialOptions ?? []);
|
|
2424
|
-
|
|
2477
|
+
useEffect7(() => {
|
|
2425
2478
|
if (!collectionId || !collectionMethods[collectionId]) {
|
|
2426
2479
|
setOptions(initialOptions ?? []);
|
|
2427
2480
|
return;
|
|
@@ -2477,7 +2530,7 @@ import { stringPropTypeUtil as stringPropTypeUtil6 } from "@elementor/editor-pro
|
|
|
2477
2530
|
|
|
2478
2531
|
// src/components/control-toggle-button-group.tsx
|
|
2479
2532
|
import * as React53 from "react";
|
|
2480
|
-
import { useEffect as
|
|
2533
|
+
import { useEffect as useEffect8, useMemo as useMemo6, useRef as useRef8, useState as useState7 } from "react";
|
|
2481
2534
|
import { ChevronDownIcon } from "@elementor/icons";
|
|
2482
2535
|
import {
|
|
2483
2536
|
ListItemText,
|
|
@@ -2550,7 +2603,7 @@ var ToggleButtonGroupUi = React53.forwardRef(
|
|
|
2550
2603
|
const handleChange = (_, newValue) => {
|
|
2551
2604
|
onChange(newValue);
|
|
2552
2605
|
};
|
|
2553
|
-
const getGridTemplateColumns =
|
|
2606
|
+
const getGridTemplateColumns = useMemo6(() => {
|
|
2554
2607
|
const isOffLimits = menuItems?.length;
|
|
2555
2608
|
const itemsCount = isOffLimits ? fixedItems.length + 1 : fixedItems.length;
|
|
2556
2609
|
const templateColumnsSuffix = isOffLimits ? "auto" : "";
|
|
@@ -2649,7 +2702,7 @@ var SplitButtonGroup = ({
|
|
|
2649
2702
|
}) => {
|
|
2650
2703
|
const previewButton = usePreviewButton(items2, value);
|
|
2651
2704
|
const [isMenuOpen, setIsMenuOpen] = useState7(false);
|
|
2652
|
-
const menuButtonRef =
|
|
2705
|
+
const menuButtonRef = useRef8(null);
|
|
2653
2706
|
const onMenuToggle = (ev) => {
|
|
2654
2707
|
setIsMenuOpen((prev) => !prev);
|
|
2655
2708
|
ev.preventDefault();
|
|
@@ -2720,7 +2773,7 @@ var usePreviewButton = (items2, value) => {
|
|
|
2720
2773
|
const [previewButton, setPreviewButton] = useState7(
|
|
2721
2774
|
items2.find((item) => item.value === value) ?? items2[0]
|
|
2722
2775
|
);
|
|
2723
|
-
|
|
2776
|
+
useEffect8(() => {
|
|
2724
2777
|
const selectedButton = items2.find((item) => item.value === value);
|
|
2725
2778
|
if (selectedButton) {
|
|
2726
2779
|
setPreviewButton(selectedButton);
|
|
@@ -2860,7 +2913,7 @@ var NumberControl = createControl(
|
|
|
2860
2913
|
|
|
2861
2914
|
// src/controls/equal-unequal-sizes-control.tsx
|
|
2862
2915
|
import * as React57 from "react";
|
|
2863
|
-
import { useId as useId2, useRef as
|
|
2916
|
+
import { useId as useId2, useRef as useRef9 } from "react";
|
|
2864
2917
|
import { bindPopover as bindPopover3, bindToggle, Box as Box7, Grid as Grid8, Popover as Popover3, Stack as Stack7, Tooltip as Tooltip5, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
2865
2918
|
import { __ as __18 } from "@wordpress/i18n";
|
|
2866
2919
|
function EqualUnequalSizesControl({
|
|
@@ -2872,7 +2925,7 @@ function EqualUnequalSizesControl({
|
|
|
2872
2925
|
}) {
|
|
2873
2926
|
const popupId = useId2();
|
|
2874
2927
|
const popupState = usePopupState4({ variant: "popover", popupId });
|
|
2875
|
-
const rowRefs = [
|
|
2928
|
+
const rowRefs = [useRef9(null), useRef9(null)];
|
|
2876
2929
|
const { propType: multiSizePropType, disabled: multiSizeDisabled } = useBoundProp(multiSizePropTypeUtil);
|
|
2877
2930
|
const { value: masterValue, setValue: setMasterValue, placeholder: masterPlaceholder } = useBoundProp();
|
|
2878
2931
|
const getMultiSizeValues = (sourceValue) => {
|
|
@@ -2967,25 +3020,25 @@ var MultiSizeValueControl = ({ item, rowRef }) => {
|
|
|
2967
3020
|
|
|
2968
3021
|
// src/controls/linked-dimensions-control.tsx
|
|
2969
3022
|
import * as React64 from "react";
|
|
2970
|
-
import { useLayoutEffect, useRef as
|
|
3023
|
+
import { useLayoutEffect, useRef as useRef12, useState as useState9 } from "react";
|
|
2971
3024
|
import {
|
|
2972
3025
|
dimensionsPropTypeUtil,
|
|
2973
3026
|
sizePropTypeUtil as sizePropTypeUtil5
|
|
2974
3027
|
} from "@elementor/editor-props";
|
|
2975
|
-
import { useActiveBreakpoint as
|
|
3028
|
+
import { useActiveBreakpoint as useActiveBreakpoint4 } from "@elementor/editor-responsive";
|
|
2976
3029
|
import { DetachIcon, LinkIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from "@elementor/icons";
|
|
2977
3030
|
import { Grid as Grid9, Stack as Stack8, Tooltip as Tooltip6 } from "@elementor/ui";
|
|
2978
3031
|
import { __ as __20, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
2979
3032
|
|
|
2980
3033
|
// src/controls/size-control/unstable-size-control.tsx
|
|
2981
3034
|
import * as React63 from "react";
|
|
2982
|
-
import { useRef as
|
|
3035
|
+
import { useRef as useRef11 } from "react";
|
|
2983
3036
|
import { sizePropTypeUtil as sizePropTypeUtil4 } from "@elementor/editor-props";
|
|
2984
3037
|
|
|
2985
3038
|
// src/controls/size-control/size-component.tsx
|
|
2986
3039
|
import * as React62 from "react";
|
|
2987
|
-
import { useEffect as
|
|
2988
|
-
import { useActiveBreakpoint as
|
|
3040
|
+
import { useEffect as useEffect11 } from "react";
|
|
3041
|
+
import { useActiveBreakpoint as useActiveBreakpoint3 } from "@elementor/editor-responsive";
|
|
2989
3042
|
import { Box as Box8, usePopupState as usePopupState6 } from "@elementor/ui";
|
|
2990
3043
|
|
|
2991
3044
|
// src/controls/size-control/size-field.tsx
|
|
@@ -3054,7 +3107,7 @@ var isNumericValue = (value) => {
|
|
|
3054
3107
|
};
|
|
3055
3108
|
|
|
3056
3109
|
// src/controls/size-control/hooks/use-size-value.ts
|
|
3057
|
-
import { useMemo as
|
|
3110
|
+
import { useMemo as useMemo7 } from "react";
|
|
3058
3111
|
|
|
3059
3112
|
// src/controls/size-control/utils/resolve-size-value.ts
|
|
3060
3113
|
var DEFAULT_SIZE2 = "";
|
|
@@ -3106,10 +3159,10 @@ var sanitizeSize = (size) => {
|
|
|
3106
3159
|
};
|
|
3107
3160
|
|
|
3108
3161
|
// src/controls/size-control/hooks/use-unit-sync.ts
|
|
3109
|
-
import { useEffect as
|
|
3162
|
+
import { useEffect as useEffect9, useState as useState8 } from "react";
|
|
3110
3163
|
var useUnitSync = ({ sizeValue, setUnit, persistWhen }) => {
|
|
3111
3164
|
const [state, setState] = useState8(sizeValue.unit);
|
|
3112
|
-
|
|
3165
|
+
useEffect9(() => {
|
|
3113
3166
|
if (sizeValue.unit !== state) {
|
|
3114
3167
|
setState(sizeValue.unit);
|
|
3115
3168
|
}
|
|
@@ -3130,7 +3183,7 @@ var useSizeValue = ({
|
|
|
3130
3183
|
units: units2,
|
|
3131
3184
|
defaultUnit
|
|
3132
3185
|
}) => {
|
|
3133
|
-
const resolvedValue =
|
|
3186
|
+
const resolvedValue = useMemo7(
|
|
3134
3187
|
() => resolveSizeValue(value, { units: units2, defaultUnit }),
|
|
3135
3188
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3136
3189
|
[value?.size, value?.unit, defaultUnit]
|
|
@@ -3371,15 +3424,15 @@ var shouldHighlightUnit = (value) => {
|
|
|
3371
3424
|
|
|
3372
3425
|
// src/controls/size-control/ui/text-field-popover.tsx
|
|
3373
3426
|
import * as React61 from "react";
|
|
3374
|
-
import { useEffect as
|
|
3427
|
+
import { useEffect as useEffect10, useRef as useRef10 } from "react";
|
|
3375
3428
|
import { PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
|
|
3376
3429
|
import { MathFunctionIcon as MathFunctionIcon4 } from "@elementor/icons";
|
|
3377
3430
|
import { bindPopover as bindPopover4, Popover as Popover4, TextField as TextField6 } from "@elementor/ui";
|
|
3378
3431
|
import { __ as __19 } from "@wordpress/i18n";
|
|
3379
3432
|
var SIZE7 = "tiny";
|
|
3380
3433
|
var TextFieldPopover2 = ({ popupState, anchorRef, value, onChange, onClose }) => {
|
|
3381
|
-
const inputRef =
|
|
3382
|
-
|
|
3434
|
+
const inputRef = useRef10(null);
|
|
3435
|
+
useEffect10(() => {
|
|
3383
3436
|
if (popupState.isOpen) {
|
|
3384
3437
|
requestAnimationFrame(() => {
|
|
3385
3438
|
if (inputRef.current) {
|
|
@@ -3443,10 +3496,10 @@ var TextFieldPopover2 = ({ popupState, anchorRef, value, onChange, onClose }) =>
|
|
|
3443
3496
|
// src/controls/size-control/size-component.tsx
|
|
3444
3497
|
var SizeComponent = ({ anchorRef, SizeFieldWrapper = React62.Fragment, ...sizeFieldProps }) => {
|
|
3445
3498
|
const popupState = usePopupState6({ variant: "popover" });
|
|
3446
|
-
const activeBreakpoint =
|
|
3499
|
+
const activeBreakpoint = useActiveBreakpoint3();
|
|
3447
3500
|
const isCustomUnit = sizeFieldProps?.value?.unit === EXTENDED_UNITS.custom;
|
|
3448
3501
|
const hasCustomUnitOption = sizeFieldProps.units.includes(EXTENDED_UNITS.custom);
|
|
3449
|
-
|
|
3502
|
+
useEffect11(() => {
|
|
3450
3503
|
if (popupState && popupState.isOpen) {
|
|
3451
3504
|
popupState.close();
|
|
3452
3505
|
}
|
|
@@ -3583,7 +3636,7 @@ var UnstableSizeControl = createControl(
|
|
|
3583
3636
|
placeholder: boundPropPlaceholder,
|
|
3584
3637
|
restoreValue
|
|
3585
3638
|
} = useBoundProp(sizePropTypeUtil4);
|
|
3586
|
-
const lastNonAutoValue =
|
|
3639
|
+
const lastNonAutoValue = useRef11(null);
|
|
3587
3640
|
const { sizeValue, placeholder } = resolveBoundPropValue(
|
|
3588
3641
|
value ?? lastNonAutoValue.current,
|
|
3589
3642
|
boundPropPlaceholder,
|
|
@@ -3640,7 +3693,7 @@ var isTransitioningFromExtendedUnit = (nextValue, previousValue) => {
|
|
|
3640
3693
|
|
|
3641
3694
|
// src/controls/linked-dimensions-control.tsx
|
|
3642
3695
|
var LinkedDimensionsControl = ({ label, isSiteRtl = false, min }) => {
|
|
3643
|
-
const gridRowRefs = [
|
|
3696
|
+
const gridRowRefs = [useRef12(null), useRef12(null)];
|
|
3644
3697
|
const { disabled: sizeDisabled } = useBoundProp(sizePropTypeUtil5);
|
|
3645
3698
|
const {
|
|
3646
3699
|
value: dimensionsValue,
|
|
@@ -3660,7 +3713,7 @@ var LinkedDimensionsControl = ({ label, isSiteRtl = false, min }) => {
|
|
|
3660
3713
|
return true;
|
|
3661
3714
|
};
|
|
3662
3715
|
const [isLinked, setIsLinked] = useState9(() => inferIsLinked());
|
|
3663
|
-
const activeBreakpoint =
|
|
3716
|
+
const activeBreakpoint = useActiveBreakpoint4();
|
|
3664
3717
|
const isCurrentlyDimensions = dimensionsPropTypeUtil.isValid(masterValue ?? masterPlaceholder);
|
|
3665
3718
|
useLayoutEffect(() => {
|
|
3666
3719
|
setIsLinked(inferIsLinked);
|
|
@@ -3833,7 +3886,7 @@ function getCssDimensionProps(label, isSiteRtl) {
|
|
|
3833
3886
|
|
|
3834
3887
|
// src/controls/font-family-control/font-family-control.tsx
|
|
3835
3888
|
import * as React66 from "react";
|
|
3836
|
-
import { useMemo as
|
|
3889
|
+
import { useMemo as useMemo8 } from "react";
|
|
3837
3890
|
import { stringPropTypeUtil as stringPropTypeUtil7 } from "@elementor/editor-props";
|
|
3838
3891
|
import { ChevronDownIcon as ChevronDownIcon2, TextIcon } from "@elementor/icons";
|
|
3839
3892
|
import { bindPopover as bindPopover5, bindTrigger as bindTrigger4, Popover as Popover5, UnstableTag as UnstableTag2, usePopupState as usePopupState7 } from "@elementor/ui";
|
|
@@ -3841,7 +3894,7 @@ import { __ as __22 } from "@wordpress/i18n";
|
|
|
3841
3894
|
|
|
3842
3895
|
// src/components/item-selector.tsx
|
|
3843
3896
|
import * as React65 from "react";
|
|
3844
|
-
import { useCallback as useCallback3, useEffect as
|
|
3897
|
+
import { useCallback as useCallback3, useEffect as useEffect12, useState as useState10 } from "react";
|
|
3845
3898
|
import { PopoverBody, PopoverHeader as PopoverHeader3, PopoverMenuList, SearchField } from "@elementor/editor-ui";
|
|
3846
3899
|
import { Box as Box9, Divider as Divider2, Link, Stack as Stack9, Typography as Typography5 } from "@elementor/ui";
|
|
3847
3900
|
import { debounce } from "@elementor/utils";
|
|
@@ -3995,7 +4048,7 @@ var ItemList = ({
|
|
|
3995
4048
|
};
|
|
3996
4049
|
var useDebounce = (fn, delay) => {
|
|
3997
4050
|
const [debouncedFn] = useState10(() => debounce(fn, delay));
|
|
3998
|
-
|
|
4051
|
+
useEffect12(() => () => debouncedFn.cancel(), [debouncedFn]);
|
|
3999
4052
|
return debouncedFn;
|
|
4000
4053
|
};
|
|
4001
4054
|
|
|
@@ -4016,7 +4069,7 @@ var FontFamilyControl = createControl(
|
|
|
4016
4069
|
} = useBoundProp(stringPropTypeUtil7);
|
|
4017
4070
|
const popoverState = usePopupState7({ variant: "popover" });
|
|
4018
4071
|
const isShowingPlaceholder = !fontFamily && placeholder;
|
|
4019
|
-
const mapFontSubs =
|
|
4072
|
+
const mapFontSubs = useMemo8(() => {
|
|
4020
4073
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
4021
4074
|
label,
|
|
4022
4075
|
items: fonts
|
|
@@ -4097,7 +4150,7 @@ var UrlControl = createControl(
|
|
|
4097
4150
|
|
|
4098
4151
|
// src/controls/link-control.tsx
|
|
4099
4152
|
import * as React72 from "react";
|
|
4100
|
-
import { useEffect as
|
|
4153
|
+
import { useEffect as useEffect13, useMemo as useMemo10, useState as useState12 } from "react";
|
|
4101
4154
|
import { getLinkInLinkRestriction } from "@elementor/editor-elements";
|
|
4102
4155
|
import { linkPropTypeUtil } from "@elementor/editor-props";
|
|
4103
4156
|
import { MinusIcon, PlusIcon as PlusIcon2 } from "@elementor/icons";
|
|
@@ -4171,7 +4224,7 @@ var RestrictedLinkInfotip = ({
|
|
|
4171
4224
|
|
|
4172
4225
|
// src/controls/query-control.tsx
|
|
4173
4226
|
import * as React70 from "react";
|
|
4174
|
-
import { useMemo as
|
|
4227
|
+
import { useMemo as useMemo9, useState as useState11 } from "react";
|
|
4175
4228
|
import {
|
|
4176
4229
|
numberPropTypeUtil as numberPropTypeUtil2,
|
|
4177
4230
|
queryPropTypeUtil,
|
|
@@ -4360,7 +4413,7 @@ var QueryControl = createControl((props) => {
|
|
|
4360
4413
|
}
|
|
4361
4414
|
debounceFetch({ ...params, term: newValue });
|
|
4362
4415
|
};
|
|
4363
|
-
const debounceFetch =
|
|
4416
|
+
const debounceFetch = useMemo9(
|
|
4364
4417
|
() => debounce2(
|
|
4365
4418
|
(queryParams) => fetchOptions(url, queryParams).then((newOptions) => {
|
|
4366
4419
|
setOptions(formatOptions(newOptions));
|
|
@@ -4458,7 +4511,7 @@ var LinkControl = createControl((props) => {
|
|
|
4458
4511
|
getLinkInLinkRestriction(elementId, value ?? linkPlaceholder)
|
|
4459
4512
|
);
|
|
4460
4513
|
const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
|
|
4461
|
-
const debouncedCheckRestriction =
|
|
4514
|
+
const debouncedCheckRestriction = useMemo10(
|
|
4462
4515
|
() => debounce3(() => {
|
|
4463
4516
|
const newRestriction = getLinkInLinkRestriction(elementId, value ?? linkPlaceholder);
|
|
4464
4517
|
if (newRestriction.shouldRestrict && isActive && !linkPlaceholder) {
|
|
@@ -4468,7 +4521,7 @@ var LinkControl = createControl((props) => {
|
|
|
4468
4521
|
}, 300),
|
|
4469
4522
|
[elementId, isActive, value, linkPlaceholder]
|
|
4470
4523
|
);
|
|
4471
|
-
|
|
4524
|
+
useEffect13(() => {
|
|
4472
4525
|
debouncedCheckRestriction();
|
|
4473
4526
|
const handleInlineLinkChanged = (event) => {
|
|
4474
4527
|
const customEvent = event;
|
|
@@ -4648,17 +4701,17 @@ var HtmlTagControl = createControl((props) => {
|
|
|
4648
4701
|
|
|
4649
4702
|
// src/controls/gap-control.tsx
|
|
4650
4703
|
import * as React75 from "react";
|
|
4651
|
-
import { useLayoutEffect as useLayoutEffect2, useRef as
|
|
4704
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef13, useState as useState13 } from "react";
|
|
4652
4705
|
import {
|
|
4653
4706
|
layoutDirectionPropTypeUtil,
|
|
4654
4707
|
sizePropTypeUtil as sizePropTypeUtil6
|
|
4655
4708
|
} from "@elementor/editor-props";
|
|
4656
|
-
import { useActiveBreakpoint as
|
|
4709
|
+
import { useActiveBreakpoint as useActiveBreakpoint5 } from "@elementor/editor-responsive";
|
|
4657
4710
|
import { DetachIcon as DetachIcon2, LinkIcon as LinkIcon2 } from "@elementor/icons";
|
|
4658
4711
|
import { Grid as Grid11, Stack as Stack11, Tooltip as Tooltip7 } from "@elementor/ui";
|
|
4659
4712
|
import { __ as __27 } from "@wordpress/i18n";
|
|
4660
4713
|
var GapControl = ({ label }) => {
|
|
4661
|
-
const stackRef =
|
|
4714
|
+
const stackRef = useRef13(null);
|
|
4662
4715
|
const { disabled: sizeDisabled } = useBoundProp(sizePropTypeUtil6);
|
|
4663
4716
|
const {
|
|
4664
4717
|
value: directionValue,
|
|
@@ -4679,7 +4732,7 @@ var GapControl = ({ label }) => {
|
|
|
4679
4732
|
};
|
|
4680
4733
|
const [isLinked, setIsLinked] = useState13(() => inferIsLinked());
|
|
4681
4734
|
const isCurrentlyDirection = layoutDirectionPropTypeUtil.isValid(masterValue ?? masterPlaceholder);
|
|
4682
|
-
const activeBreakpoint =
|
|
4735
|
+
const activeBreakpoint = useActiveBreakpoint5();
|
|
4683
4736
|
useLayoutEffect2(() => {
|
|
4684
4737
|
setIsLinked(inferIsLinked());
|
|
4685
4738
|
}, [activeBreakpoint, isCurrentlyDirection]);
|
|
@@ -4773,7 +4826,7 @@ var Control4 = ({
|
|
|
4773
4826
|
|
|
4774
4827
|
// src/controls/aspect-ratio-control.tsx
|
|
4775
4828
|
import * as React76 from "react";
|
|
4776
|
-
import { useEffect as
|
|
4829
|
+
import { useEffect as useEffect14, useState as useState14 } from "react";
|
|
4777
4830
|
import { stringPropTypeUtil as stringPropTypeUtil10 } from "@elementor/editor-props";
|
|
4778
4831
|
import { MenuListItem as MenuListItem5 } from "@elementor/editor-ui";
|
|
4779
4832
|
import { ArrowsMoveHorizontalIcon, ArrowsMoveVerticalIcon } from "@elementor/icons";
|
|
@@ -4806,7 +4859,7 @@ var AspectRatioControl = createControl(({ label }) => {
|
|
|
4806
4859
|
const [selectedValue, setSelectedValue] = useState14(
|
|
4807
4860
|
isCustomSelected ? CUSTOM_RATIO : aspectRatioValue || ""
|
|
4808
4861
|
);
|
|
4809
|
-
|
|
4862
|
+
useEffect14(() => {
|
|
4810
4863
|
const isCustomValue = aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue);
|
|
4811
4864
|
if (isCustomValue) {
|
|
4812
4865
|
const [width, height] = aspectRatioValue.split("/");
|
|
@@ -5276,7 +5329,7 @@ var BackgroundImageOverlayAttachment = () => {
|
|
|
5276
5329
|
|
|
5277
5330
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
|
|
5278
5331
|
import * as React82 from "react";
|
|
5279
|
-
import { useRef as
|
|
5332
|
+
import { useRef as useRef14 } from "react";
|
|
5280
5333
|
import { backgroundImagePositionOffsetPropTypeUtil, stringPropTypeUtil as stringPropTypeUtil12 } from "@elementor/editor-props";
|
|
5281
5334
|
import { MenuListItem as MenuListItem6 } from "@elementor/editor-ui";
|
|
5282
5335
|
import { LetterXIcon, LetterYIcon } from "@elementor/icons";
|
|
@@ -5298,7 +5351,7 @@ var BackgroundImageOverlayPosition = () => {
|
|
|
5298
5351
|
const backgroundImageOffsetContext = useBoundProp(backgroundImagePositionOffsetPropTypeUtil);
|
|
5299
5352
|
const stringPropContext = useBoundProp(stringPropTypeUtil12);
|
|
5300
5353
|
const isCustom = !!backgroundImageOffsetContext.value;
|
|
5301
|
-
const rowRef =
|
|
5354
|
+
const rowRef = useRef14(null);
|
|
5302
5355
|
const handlePositionChange = (event) => {
|
|
5303
5356
|
const value = event.target.value || null;
|
|
5304
5357
|
if (value === "custom") {
|
|
@@ -5371,7 +5424,7 @@ var BackgroundImageOverlayRepeat = () => {
|
|
|
5371
5424
|
|
|
5372
5425
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx
|
|
5373
5426
|
import * as React84 from "react";
|
|
5374
|
-
import { useRef as
|
|
5427
|
+
import { useRef as useRef15 } from "react";
|
|
5375
5428
|
import { backgroundImageSizeScalePropTypeUtil, stringPropTypeUtil as stringPropTypeUtil13 } from "@elementor/editor-props";
|
|
5376
5429
|
import {
|
|
5377
5430
|
ArrowBarBothIcon,
|
|
@@ -5413,7 +5466,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
5413
5466
|
const backgroundImageScaleContext = useBoundProp(backgroundImageSizeScalePropTypeUtil);
|
|
5414
5467
|
const stringPropContext = useBoundProp(stringPropTypeUtil13);
|
|
5415
5468
|
const isCustom = !!backgroundImageScaleContext.value;
|
|
5416
|
-
const rowRef =
|
|
5469
|
+
const rowRef = useRef15(null);
|
|
5417
5470
|
const handleSizeChange = (size) => {
|
|
5418
5471
|
if (size === "custom") {
|
|
5419
5472
|
backgroundImageScaleContext.setValue({ width: null, height: null });
|
|
@@ -5448,7 +5501,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
5448
5501
|
};
|
|
5449
5502
|
|
|
5450
5503
|
// src/controls/background-control/background-overlay/use-background-tabs-history.ts
|
|
5451
|
-
import { useRef as
|
|
5504
|
+
import { useRef as useRef16 } from "react";
|
|
5452
5505
|
import {
|
|
5453
5506
|
backgroundColorOverlayPropTypeUtil,
|
|
5454
5507
|
backgroundGradientOverlayPropTypeUtil as backgroundGradientOverlayPropTypeUtil2,
|
|
@@ -5473,7 +5526,7 @@ var useBackgroundTabsHistory = ({
|
|
|
5473
5526
|
return "image";
|
|
5474
5527
|
};
|
|
5475
5528
|
const { getTabsProps, getTabProps, getTabPanelProps } = useTabs(getCurrentOverlayType());
|
|
5476
|
-
const valuesHistory =
|
|
5529
|
+
const valuesHistory = useRef16({
|
|
5477
5530
|
image: initialBackgroundImageOverlay,
|
|
5478
5531
|
color: initialBackgroundColorOverlay2,
|
|
5479
5532
|
gradient: initialBackgroundGradientOverlay2
|
|
@@ -5718,7 +5771,7 @@ var BackgroundClipField = () => {
|
|
|
5718
5771
|
|
|
5719
5772
|
// src/controls/repeatable-control.tsx
|
|
5720
5773
|
import * as React87 from "react";
|
|
5721
|
-
import { useMemo as
|
|
5774
|
+
import { useMemo as useMemo11 } from "react";
|
|
5722
5775
|
import { createArrayPropUtils } from "@elementor/editor-props";
|
|
5723
5776
|
import { Box as Box15 } from "@elementor/ui";
|
|
5724
5777
|
var PLACEHOLDER_REGEX = /\$\{([^}]+)\}/g;
|
|
@@ -5739,11 +5792,11 @@ var RepeatableControl = createControl(
|
|
|
5739
5792
|
if (!childPropTypeUtil) {
|
|
5740
5793
|
return null;
|
|
5741
5794
|
}
|
|
5742
|
-
const childArrayPropTypeUtil2 =
|
|
5795
|
+
const childArrayPropTypeUtil2 = useMemo11(
|
|
5743
5796
|
() => createArrayPropUtils(childPropTypeUtil.key, childPropTypeUtil.schema, propKey),
|
|
5744
5797
|
[childPropTypeUtil.key, childPropTypeUtil.schema, propKey]
|
|
5745
5798
|
);
|
|
5746
|
-
const contextValue =
|
|
5799
|
+
const contextValue = useMemo11(
|
|
5747
5800
|
() => ({
|
|
5748
5801
|
...childControlConfig,
|
|
5749
5802
|
placeholder: placeholder || "",
|
|
@@ -5875,7 +5928,7 @@ var getAllProperties = (pattern) => {
|
|
|
5875
5928
|
|
|
5876
5929
|
// src/controls/key-value-control.tsx
|
|
5877
5930
|
import * as React88 from "react";
|
|
5878
|
-
import { useMemo as
|
|
5931
|
+
import { useMemo as useMemo12, useState as useState17 } from "react";
|
|
5879
5932
|
import {
|
|
5880
5933
|
isTransformable,
|
|
5881
5934
|
keyValuePropTypeUtil,
|
|
@@ -5918,7 +5971,7 @@ var KeyValueControl = createControl((props = {}) => {
|
|
|
5918
5971
|
keyHelper: void 0,
|
|
5919
5972
|
valueHelper: void 0
|
|
5920
5973
|
};
|
|
5921
|
-
const [keyRegex, valueRegex, errMsg] =
|
|
5974
|
+
const [keyRegex, valueRegex, errMsg] = useMemo12(
|
|
5922
5975
|
() => [
|
|
5923
5976
|
props.regexKey ? new RegExp(props.regexKey) : void 0,
|
|
5924
5977
|
props.regexValue ? new RegExp(props.regexValue) : void 0,
|
|
@@ -6047,7 +6100,7 @@ var PositionControl = () => {
|
|
|
6047
6100
|
|
|
6048
6101
|
// src/controls/transform-control/transform-repeater-control.tsx
|
|
6049
6102
|
import * as React102 from "react";
|
|
6050
|
-
import { useRef as
|
|
6103
|
+
import { useRef as useRef24 } from "react";
|
|
6051
6104
|
import { transformFunctionsPropTypeUtil, transformPropTypeUtil } from "@elementor/editor-props";
|
|
6052
6105
|
import { AdjustmentsIcon as AdjustmentsIcon2, InfoCircleFilledIcon as InfoCircleFilledIcon2 } from "@elementor/icons";
|
|
6053
6106
|
import { bindTrigger as bindTrigger5, Box as Box19, IconButton as IconButton7, Tooltip as Tooltip8, Typography as Typography7, usePopupState as usePopupState8 } from "@elementor/ui";
|
|
@@ -6111,7 +6164,7 @@ import { __ as __44 } from "@wordpress/i18n";
|
|
|
6111
6164
|
|
|
6112
6165
|
// src/controls/transform-control/functions/move.tsx
|
|
6113
6166
|
import * as React91 from "react";
|
|
6114
|
-
import { useRef as
|
|
6167
|
+
import { useRef as useRef17 } from "react";
|
|
6115
6168
|
import { moveTransformPropTypeUtil } from "@elementor/editor-props";
|
|
6116
6169
|
import { ArrowDownLeftIcon, ArrowDownSmallIcon, ArrowRightIcon } from "@elementor/icons";
|
|
6117
6170
|
import { Grid as Grid21 } from "@elementor/ui";
|
|
@@ -6158,7 +6211,7 @@ var moveAxisControls = [
|
|
|
6158
6211
|
];
|
|
6159
6212
|
var Move = () => {
|
|
6160
6213
|
const context = useBoundProp(moveTransformPropTypeUtil);
|
|
6161
|
-
const rowRefs = [
|
|
6214
|
+
const rowRefs = [useRef17(null), useRef17(null), useRef17(null)];
|
|
6162
6215
|
return /* @__PURE__ */ React91.createElement(Grid21, { container: true, spacing: 1.5 }, /* @__PURE__ */ React91.createElement(PropProvider, { ...context }, /* @__PURE__ */ React91.createElement(PropKeyProvider, { bind: TransformFunctionKeys.move }, moveAxisControls.map((control, index) => /* @__PURE__ */ React91.createElement(
|
|
6163
6216
|
AxisRow,
|
|
6164
6217
|
{
|
|
@@ -6173,7 +6226,7 @@ var Move = () => {
|
|
|
6173
6226
|
|
|
6174
6227
|
// src/controls/transform-control/functions/rotate.tsx
|
|
6175
6228
|
import * as React92 from "react";
|
|
6176
|
-
import { useRef as
|
|
6229
|
+
import { useRef as useRef18 } from "react";
|
|
6177
6230
|
import { rotateTransformPropTypeUtil as rotateTransformPropTypeUtil2 } from "@elementor/editor-props";
|
|
6178
6231
|
import { Arrow360Icon, RotateClockwiseIcon } from "@elementor/icons";
|
|
6179
6232
|
import { Grid as Grid22 } from "@elementor/ui";
|
|
@@ -6198,7 +6251,7 @@ var rotateAxisControls = [
|
|
|
6198
6251
|
var rotateUnits = ["deg", "rad", "grad", "turn"];
|
|
6199
6252
|
var Rotate = () => {
|
|
6200
6253
|
const context = useBoundProp(rotateTransformPropTypeUtil2);
|
|
6201
|
-
const rowRefs = [
|
|
6254
|
+
const rowRefs = [useRef18(null), useRef18(null), useRef18(null)];
|
|
6202
6255
|
return /* @__PURE__ */ React92.createElement(Grid22, { container: true, spacing: 1.5 }, /* @__PURE__ */ React92.createElement(PropProvider, { ...context }, /* @__PURE__ */ React92.createElement(PropKeyProvider, { bind: TransformFunctionKeys.rotate }, rotateAxisControls.map((control, index) => /* @__PURE__ */ React92.createElement(
|
|
6203
6256
|
AxisRow,
|
|
6204
6257
|
{
|
|
@@ -6212,7 +6265,7 @@ var Rotate = () => {
|
|
|
6212
6265
|
|
|
6213
6266
|
// src/controls/transform-control/functions/scale.tsx
|
|
6214
6267
|
import * as React94 from "react";
|
|
6215
|
-
import { useRef as
|
|
6268
|
+
import { useRef as useRef19 } from "react";
|
|
6216
6269
|
import { scaleTransformPropTypeUtil as scaleTransformPropTypeUtil2 } from "@elementor/editor-props";
|
|
6217
6270
|
import { ArrowDownLeftIcon as ArrowDownLeftIcon2, ArrowDownSmallIcon as ArrowDownSmallIcon2, ArrowRightIcon as ArrowRightIcon2 } from "@elementor/icons";
|
|
6218
6271
|
import { Grid as Grid24 } from "@elementor/ui";
|
|
@@ -6245,13 +6298,13 @@ var scaleAxisControls = [
|
|
|
6245
6298
|
];
|
|
6246
6299
|
var Scale = () => {
|
|
6247
6300
|
const context = useBoundProp(scaleTransformPropTypeUtil2);
|
|
6248
|
-
const rowRefs = [
|
|
6301
|
+
const rowRefs = [useRef19(null), useRef19(null), useRef19(null)];
|
|
6249
6302
|
return /* @__PURE__ */ React94.createElement(Grid24, { container: true, spacing: 1.5 }, /* @__PURE__ */ React94.createElement(PropProvider, { ...context }, /* @__PURE__ */ React94.createElement(PropKeyProvider, { bind: TransformFunctionKeys.scale }, scaleAxisControls.map((control, index) => /* @__PURE__ */ React94.createElement(ScaleAxisRow, { key: control.bind, ...control, anchorRef: rowRefs[index] })))));
|
|
6250
6303
|
};
|
|
6251
6304
|
|
|
6252
6305
|
// src/controls/transform-control/functions/skew.tsx
|
|
6253
6306
|
import * as React95 from "react";
|
|
6254
|
-
import { useRef as
|
|
6307
|
+
import { useRef as useRef20 } from "react";
|
|
6255
6308
|
import { skewTransformPropTypeUtil as skewTransformPropTypeUtil2 } from "@elementor/editor-props";
|
|
6256
6309
|
import { ArrowLeftIcon, ArrowRightIcon as ArrowRightIcon3 } from "@elementor/icons";
|
|
6257
6310
|
import { Grid as Grid25 } from "@elementor/ui";
|
|
@@ -6271,7 +6324,7 @@ var skewAxisControls = [
|
|
|
6271
6324
|
var skewUnits = ["deg", "rad", "grad", "turn"];
|
|
6272
6325
|
var Skew = () => {
|
|
6273
6326
|
const context = useBoundProp(skewTransformPropTypeUtil2);
|
|
6274
|
-
const rowRefs = [
|
|
6327
|
+
const rowRefs = [useRef20(null), useRef20(null), useRef20(null)];
|
|
6275
6328
|
return /* @__PURE__ */ React95.createElement(Grid25, { container: true, spacing: 1.5 }, /* @__PURE__ */ React95.createElement(PropProvider, { ...context }, /* @__PURE__ */ React95.createElement(PropKeyProvider, { bind: TransformFunctionKeys.skew }, skewAxisControls.map((control, index) => /* @__PURE__ */ React95.createElement(
|
|
6276
6329
|
AxisRow,
|
|
6277
6330
|
{
|
|
@@ -6284,7 +6337,7 @@ var Skew = () => {
|
|
|
6284
6337
|
};
|
|
6285
6338
|
|
|
6286
6339
|
// src/controls/transform-control/use-transform-tabs-history.tsx
|
|
6287
|
-
import { useRef as
|
|
6340
|
+
import { useRef as useRef21 } from "react";
|
|
6288
6341
|
import {
|
|
6289
6342
|
moveTransformPropTypeUtil as moveTransformPropTypeUtil2,
|
|
6290
6343
|
rotateTransformPropTypeUtil as rotateTransformPropTypeUtil3,
|
|
@@ -6316,7 +6369,7 @@ var useTransformTabsHistory = ({
|
|
|
6316
6369
|
}
|
|
6317
6370
|
};
|
|
6318
6371
|
const { getTabsProps, getTabProps, getTabPanelProps } = useTabs2(getCurrentTransformType());
|
|
6319
|
-
const valuesHistory =
|
|
6372
|
+
const valuesHistory = useRef21({
|
|
6320
6373
|
move: initialMove,
|
|
6321
6374
|
scale: initialScale,
|
|
6322
6375
|
rotate: initialRotate,
|
|
@@ -6460,7 +6513,7 @@ import { __ as __48 } from "@wordpress/i18n";
|
|
|
6460
6513
|
|
|
6461
6514
|
// src/controls/transform-control/transform-base-controls/children-perspective-control.tsx
|
|
6462
6515
|
import * as React99 from "react";
|
|
6463
|
-
import { useRef as
|
|
6516
|
+
import { useRef as useRef22 } from "react";
|
|
6464
6517
|
import { perspectiveOriginPropTypeUtil } from "@elementor/editor-props";
|
|
6465
6518
|
import { Grid as Grid26, Stack as Stack15 } from "@elementor/ui";
|
|
6466
6519
|
import { __ as __46 } from "@wordpress/i18n";
|
|
@@ -6492,13 +6545,13 @@ var PerspectiveOriginControlProvider = () => {
|
|
|
6492
6545
|
return /* @__PURE__ */ React99.createElement(PropProvider, { ...context }, CHILDREN_PERSPECTIVE_FIELDS.map((control) => /* @__PURE__ */ React99.createElement(PropKeyProvider, { bind: control.bind, key: control.bind }, /* @__PURE__ */ React99.createElement(ControlFields, { control }))));
|
|
6493
6546
|
};
|
|
6494
6547
|
var ControlFields = ({ control }) => {
|
|
6495
|
-
const rowRef =
|
|
6548
|
+
const rowRef = useRef22(null);
|
|
6496
6549
|
return /* @__PURE__ */ React99.createElement(PopoverGridContainer, { ref: rowRef }, /* @__PURE__ */ React99.createElement(Grid26, { item: true, xs: 6 }, /* @__PURE__ */ React99.createElement(ControlFormLabel, null, control.label)), /* @__PURE__ */ React99.createElement(Grid26, { item: true, xs: 6 }, /* @__PURE__ */ React99.createElement(SizeControl, { variant: "length", units: control.units, anchorRef: rowRef, disableCustom: true })));
|
|
6497
6550
|
};
|
|
6498
6551
|
|
|
6499
6552
|
// src/controls/transform-control/transform-base-controls/transform-origin-control.tsx
|
|
6500
6553
|
import * as React100 from "react";
|
|
6501
|
-
import { useRef as
|
|
6554
|
+
import { useRef as useRef23 } from "react";
|
|
6502
6555
|
import { transformOriginPropTypeUtil } from "@elementor/editor-props";
|
|
6503
6556
|
import { Grid as Grid27, Stack as Stack16 } from "@elementor/ui";
|
|
6504
6557
|
import { __ as __47 } from "@wordpress/i18n";
|
|
@@ -6526,7 +6579,7 @@ var TransformOriginControl = () => {
|
|
|
6526
6579
|
};
|
|
6527
6580
|
var ControlFields2 = ({ control }) => {
|
|
6528
6581
|
const context = useBoundProp(transformOriginPropTypeUtil);
|
|
6529
|
-
const rowRef =
|
|
6582
|
+
const rowRef = useRef23(null);
|
|
6530
6583
|
return /* @__PURE__ */ React100.createElement(PropProvider, { ...context }, /* @__PURE__ */ React100.createElement(PropKeyProvider, { bind: control.bind }, /* @__PURE__ */ React100.createElement(PopoverGridContainer, { ref: rowRef }, /* @__PURE__ */ React100.createElement(Grid27, { item: true, xs: 6 }, /* @__PURE__ */ React100.createElement(ControlFormLabel, null, control.label)), /* @__PURE__ */ React100.createElement(Grid27, { item: true, xs: 6 }, /* @__PURE__ */ React100.createElement(SizeControl, { variant: "length", units: control.units, anchorRef: rowRef })))));
|
|
6531
6584
|
};
|
|
6532
6585
|
|
|
@@ -6574,7 +6627,7 @@ var SIZE10 = "tiny";
|
|
|
6574
6627
|
var TransformRepeaterControl = createControl(
|
|
6575
6628
|
({ showChildrenPerspective }) => {
|
|
6576
6629
|
const context = useBoundProp(transformPropTypeUtil);
|
|
6577
|
-
const headerRef =
|
|
6630
|
+
const headerRef = useRef24(null);
|
|
6578
6631
|
const popupState = usePopupState8({ variant: "popover" });
|
|
6579
6632
|
return /* @__PURE__ */ React102.createElement(PropProvider, { ...context }, /* @__PURE__ */ React102.createElement(
|
|
6580
6633
|
TransformSettingsControl,
|
|
@@ -6654,7 +6707,7 @@ var TransformBasePopoverTrigger = ({
|
|
|
6654
6707
|
|
|
6655
6708
|
// src/controls/transition-control/transition-repeater-control.tsx
|
|
6656
6709
|
import * as React105 from "react";
|
|
6657
|
-
import { useEffect as
|
|
6710
|
+
import { useEffect as useEffect15, useMemo as useMemo15, useState as useState18 } from "react";
|
|
6658
6711
|
import {
|
|
6659
6712
|
createArrayPropUtils as createArrayPropUtils2,
|
|
6660
6713
|
selectionSizePropTypeUtil as selectionSizePropTypeUtil2
|
|
@@ -6666,15 +6719,15 @@ import { __ as __52 } from "@wordpress/i18n";
|
|
|
6666
6719
|
|
|
6667
6720
|
// src/controls/selection-size-control.tsx
|
|
6668
6721
|
import * as React103 from "react";
|
|
6669
|
-
import { useMemo as
|
|
6722
|
+
import { useMemo as useMemo13, useRef as useRef25 } from "react";
|
|
6670
6723
|
import { selectionSizePropTypeUtil } from "@elementor/editor-props";
|
|
6671
6724
|
import { Grid as Grid28 } from "@elementor/ui";
|
|
6672
6725
|
var SelectionSizeControl = createControl(
|
|
6673
6726
|
({ selectionLabel, sizeLabel, selectionConfig, sizeConfigMap }) => {
|
|
6674
6727
|
const { value, setValue, propType } = useBoundProp(selectionSizePropTypeUtil);
|
|
6675
|
-
const rowRef =
|
|
6728
|
+
const rowRef = useRef25(null);
|
|
6676
6729
|
const sizeFieldId = sizeLabel.replace(/\s+/g, "-").toLowerCase();
|
|
6677
|
-
const currentSizeConfig =
|
|
6730
|
+
const currentSizeConfig = useMemo13(() => {
|
|
6678
6731
|
switch (value.selection.$$type) {
|
|
6679
6732
|
case "key-value":
|
|
6680
6733
|
return sizeConfigMap[value?.selection?.value.value.value || ""];
|
|
@@ -6887,7 +6940,7 @@ function subscribeToTransitionEvent() {
|
|
|
6887
6940
|
|
|
6888
6941
|
// src/controls/transition-control/transition-selector.tsx
|
|
6889
6942
|
import * as React104 from "react";
|
|
6890
|
-
import { useMemo as
|
|
6943
|
+
import { useMemo as useMemo14, useRef as useRef26 } from "react";
|
|
6891
6944
|
import { keyValuePropTypeUtil as keyValuePropTypeUtil2 } from "@elementor/editor-props";
|
|
6892
6945
|
import { PromotionAlert, PromotionChip } from "@elementor/editor-ui";
|
|
6893
6946
|
import { ChevronDownIcon as ChevronDownIcon3, VariationsIcon } from "@elementor/icons";
|
|
@@ -6974,9 +7027,9 @@ var TransitionSelector = ({
|
|
|
6974
7027
|
const {
|
|
6975
7028
|
key: { value: transitionLabel }
|
|
6976
7029
|
} = value;
|
|
6977
|
-
const defaultRef =
|
|
7030
|
+
const defaultRef = useRef26(null);
|
|
6978
7031
|
const popoverState = usePopupState9({ variant: "popover" });
|
|
6979
|
-
const disabledCategories =
|
|
7032
|
+
const disabledCategories = useMemo14(() => {
|
|
6980
7033
|
return new Set(
|
|
6981
7034
|
transitionProperties.filter((cat) => cat.properties.some((prop) => prop.isDisabled)).map((cat) => cat.label)
|
|
6982
7035
|
);
|
|
@@ -7205,11 +7258,11 @@ var TransitionRepeaterControl = createControl(
|
|
|
7205
7258
|
const [recentlyUsedList, setRecentlyUsedList] = useState18([]);
|
|
7206
7259
|
const proInstalled = hasProInstalled2();
|
|
7207
7260
|
const { value, setValue } = useBoundProp(childArrayPropTypeUtil);
|
|
7208
|
-
const { allDisabled: disabledItems, proDisabled: proDisabledItems } =
|
|
7261
|
+
const { allDisabled: disabledItems, proDisabled: proDisabledItems } = useMemo15(
|
|
7209
7262
|
() => getDisabledItemLabels(value),
|
|
7210
7263
|
[value]
|
|
7211
7264
|
);
|
|
7212
|
-
const allowedTransitionSet =
|
|
7265
|
+
const allowedTransitionSet = useMemo15(() => {
|
|
7213
7266
|
const set = /* @__PURE__ */ new Set();
|
|
7214
7267
|
transitionProperties.forEach((category) => {
|
|
7215
7268
|
category.properties.forEach((prop) => {
|
|
@@ -7220,7 +7273,7 @@ var TransitionRepeaterControl = createControl(
|
|
|
7220
7273
|
});
|
|
7221
7274
|
return set;
|
|
7222
7275
|
}, [proInstalled]);
|
|
7223
|
-
|
|
7276
|
+
useEffect15(() => {
|
|
7224
7277
|
if (!value || value.length === 0) {
|
|
7225
7278
|
return;
|
|
7226
7279
|
}
|
|
@@ -7232,10 +7285,10 @@ var TransitionRepeaterControl = createControl(
|
|
|
7232
7285
|
setValue(sanitized);
|
|
7233
7286
|
}
|
|
7234
7287
|
}, [allowedTransitionSet]);
|
|
7235
|
-
|
|
7288
|
+
useEffect15(() => {
|
|
7236
7289
|
recentlyUsedListGetter().then(setRecentlyUsedList);
|
|
7237
7290
|
}, [recentlyUsedListGetter]);
|
|
7238
|
-
const allPropertiesUsed =
|
|
7291
|
+
const allPropertiesUsed = useMemo15(() => areAllPropertiesUsed(value), [value]);
|
|
7239
7292
|
const isAddItemDisabled = !currentStyleIsNormal || allPropertiesUsed;
|
|
7240
7293
|
return /* @__PURE__ */ React105.createElement(
|
|
7241
7294
|
RepeatableControl,
|
|
@@ -7341,14 +7394,14 @@ var DateTimeControl = createControl(({ inputDisabled }) => {
|
|
|
7341
7394
|
|
|
7342
7395
|
// src/controls/inline-editing-control.tsx
|
|
7343
7396
|
import * as React108 from "react";
|
|
7344
|
-
import { useCallback as useCallback4, useEffect as
|
|
7397
|
+
import { useCallback as useCallback4, useEffect as useEffect17, useMemo as useMemo16 } from "react";
|
|
7345
7398
|
import { htmlV3PropTypeUtil, parseHtmlChildren, stringPropTypeUtil as stringPropTypeUtil17 } from "@elementor/editor-props";
|
|
7346
7399
|
import { Box as Box24 } from "@elementor/ui";
|
|
7347
7400
|
import { debounce as debounce4 } from "@elementor/utils";
|
|
7348
7401
|
|
|
7349
7402
|
// src/components/inline-editor.tsx
|
|
7350
7403
|
import * as React107 from "react";
|
|
7351
|
-
import { useEffect as
|
|
7404
|
+
import { useEffect as useEffect16, useRef as useRef27 } from "react";
|
|
7352
7405
|
import { Box as Box23 } from "@elementor/ui";
|
|
7353
7406
|
import Bold from "@tiptap/extension-bold";
|
|
7354
7407
|
import Document from "@tiptap/extension-document";
|
|
@@ -7402,8 +7455,8 @@ var InlineEditor = React107.forwardRef((props, ref) => {
|
|
|
7402
7455
|
onSelectionEnd,
|
|
7403
7456
|
mountElement = null
|
|
7404
7457
|
} = props;
|
|
7405
|
-
const containerRef =
|
|
7406
|
-
const onBlurRef =
|
|
7458
|
+
const containerRef = useRef27(null);
|
|
7459
|
+
const onBlurRef = useRef27(onBlur);
|
|
7407
7460
|
onBlurRef.current = onBlur;
|
|
7408
7461
|
const documentContentSettings = !!expectedTag ? "block+" : "inline*";
|
|
7409
7462
|
const onUpdate = ({ editor: updatedEditor }) => {
|
|
@@ -7500,8 +7553,8 @@ var InlineEditor = React107.forwardRef((props, ref) => {
|
|
|
7500
7553
|
return /* @__PURE__ */ React107.createElement(Box23, { ref: containerRef, sx, className: wrapperClassName }, /* @__PURE__ */ React107.createElement(EditorContent, { ref, editor }));
|
|
7501
7554
|
});
|
|
7502
7555
|
var useOnUpdate = (callback, dependencies) => {
|
|
7503
|
-
const hasMounted =
|
|
7504
|
-
|
|
7556
|
+
const hasMounted = useRef27(false);
|
|
7557
|
+
useEffect16(() => {
|
|
7505
7558
|
if (hasMounted.current) {
|
|
7506
7559
|
callback();
|
|
7507
7560
|
} else {
|
|
@@ -7520,7 +7573,7 @@ var InlineEditingControl = createControl(
|
|
|
7520
7573
|
}) => {
|
|
7521
7574
|
const { value, setValue, placeholder } = useBoundProp(htmlV3PropTypeUtil);
|
|
7522
7575
|
const content = stringPropTypeUtil17.extract(value?.content ?? null) ?? "";
|
|
7523
|
-
const debouncedParse =
|
|
7576
|
+
const debouncedParse = useMemo16(
|
|
7524
7577
|
() => debounce4((html) => {
|
|
7525
7578
|
const parsed = parseHtmlChildren(html);
|
|
7526
7579
|
setValue({
|
|
@@ -7541,7 +7594,7 @@ var InlineEditingControl = createControl(
|
|
|
7541
7594
|
},
|
|
7542
7595
|
[setValue, value?.children, debouncedParse]
|
|
7543
7596
|
);
|
|
7544
|
-
|
|
7597
|
+
useEffect17(() => () => debouncedParse.cancel(), [debouncedParse]);
|
|
7545
7598
|
return /* @__PURE__ */ React108.createElement(ControlActions, null, /* @__PURE__ */ React108.createElement(
|
|
7546
7599
|
Box24,
|
|
7547
7600
|
{
|
|
@@ -7743,7 +7796,7 @@ var EmailFormActionControl = createControl(({ toPlaceholder }) => {
|
|
|
7743
7796
|
|
|
7744
7797
|
// src/components/promotions/display-conditions-control.tsx
|
|
7745
7798
|
import * as React111 from "react";
|
|
7746
|
-
import { useRef as
|
|
7799
|
+
import { useRef as useRef28 } from "react";
|
|
7747
7800
|
import { SitemapIcon } from "@elementor/icons";
|
|
7748
7801
|
import { IconButton as IconButton8, Stack as Stack18, Tooltip as Tooltip9 } from "@elementor/ui";
|
|
7749
7802
|
import { __ as __54 } from "@wordpress/i18n";
|
|
@@ -7802,7 +7855,7 @@ var PromotionTrigger = forwardRef12(
|
|
|
7802
7855
|
var ARIA_LABEL = __54("Display Conditions", "elementor");
|
|
7803
7856
|
var TRACKING_DATA = { target_name: "display_conditions", location_l2: "general" };
|
|
7804
7857
|
var DisplayConditionsControl = createControl(() => {
|
|
7805
|
-
const triggerRef =
|
|
7858
|
+
const triggerRef = useRef28(null);
|
|
7806
7859
|
return /* @__PURE__ */ React111.createElement(
|
|
7807
7860
|
Stack18,
|
|
7808
7861
|
{
|
|
@@ -7834,14 +7887,14 @@ var DisplayConditionsControl = createControl(() => {
|
|
|
7834
7887
|
|
|
7835
7888
|
// src/components/promotions/attributes-control.tsx
|
|
7836
7889
|
import * as React112 from "react";
|
|
7837
|
-
import { useRef as
|
|
7890
|
+
import { useRef as useRef29 } from "react";
|
|
7838
7891
|
import { PlusIcon as PlusIcon3 } from "@elementor/icons";
|
|
7839
7892
|
import { Stack as Stack19, Tooltip as Tooltip10 } from "@elementor/ui";
|
|
7840
7893
|
import { __ as __55 } from "@wordpress/i18n";
|
|
7841
7894
|
var ARIA_LABEL2 = __55("Attributes", "elementor");
|
|
7842
7895
|
var TRACKING_DATA2 = { target_name: "attributes", location_l2: "general" };
|
|
7843
7896
|
var AttributesControl = createControl(() => {
|
|
7844
|
-
const triggerRef =
|
|
7897
|
+
const triggerRef = useRef29(null);
|
|
7845
7898
|
return /* @__PURE__ */ React112.createElement(
|
|
7846
7899
|
Stack19,
|
|
7847
7900
|
{
|
|
@@ -7878,13 +7931,12 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
|
|
|
7878
7931
|
|
|
7879
7932
|
// src/components/repeater/repeater.tsx
|
|
7880
7933
|
import * as React114 from "react";
|
|
7881
|
-
import { useEffect as
|
|
7934
|
+
import { useEffect as useEffect18, useState as useState20 } from "react";
|
|
7882
7935
|
import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon4, XIcon as XIcon4 } from "@elementor/icons";
|
|
7883
7936
|
import {
|
|
7884
7937
|
bindPopover as bindPopover8,
|
|
7885
7938
|
bindTrigger as bindTrigger7,
|
|
7886
7939
|
Box as Box27,
|
|
7887
|
-
ClickAwayListener,
|
|
7888
7940
|
IconButton as IconButton10,
|
|
7889
7941
|
Infotip as Infotip4,
|
|
7890
7942
|
Tooltip as Tooltip12,
|
|
@@ -8060,10 +8112,11 @@ var RepeaterItem = ({
|
|
|
8060
8112
|
wrappedOnPopoverClose
|
|
8061
8113
|
);
|
|
8062
8114
|
const triggerProps = bindTrigger7(popoverState);
|
|
8115
|
+
usePopoverDismiss({ isOpen: popoverState.isOpen, onClose: popoverProps.onClose });
|
|
8063
8116
|
const duplicateLabel = __56("Duplicate", "elementor");
|
|
8064
8117
|
const toggleLabel = propDisabled ? __56("Show", "elementor") : __56("Hide", "elementor");
|
|
8065
8118
|
const removeLabel = __56("Remove", "elementor");
|
|
8066
|
-
return /* @__PURE__ */ React114.createElement(
|
|
8119
|
+
return /* @__PURE__ */ React114.createElement(Box27, { sx: { display: "contents" } }, /* @__PURE__ */ React114.createElement(
|
|
8067
8120
|
RepeaterTag,
|
|
8068
8121
|
{
|
|
8069
8122
|
disabled,
|
|
@@ -8080,21 +8133,13 @@ var RepeaterItem = ({
|
|
|
8080
8133
|
startIcon,
|
|
8081
8134
|
actions: /* @__PURE__ */ React114.createElement(React114.Fragment, null, showDuplicate && /* @__PURE__ */ React114.createElement(Tooltip12, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React114.createElement(IconButton10, { size: SIZE11, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React114.createElement(CopyIcon2, { fontSize: SIZE11 }))), showToggle && /* @__PURE__ */ React114.createElement(Tooltip12, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React114.createElement(IconButton10, { size: SIZE11, onClick: toggleDisableItem, "aria-label": toggleLabel }, propDisabled ? /* @__PURE__ */ React114.createElement(EyeOffIcon2, { fontSize: SIZE11 }) : /* @__PURE__ */ React114.createElement(EyeIcon2, { fontSize: SIZE11 }))), actions?.(value), showRemove && /* @__PURE__ */ React114.createElement(Tooltip12, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React114.createElement(IconButton10, { size: SIZE11, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React114.createElement(XIcon4, { fontSize: SIZE11 }))))
|
|
8082
8135
|
}
|
|
8083
|
-
), /* @__PURE__ */ React114.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React114.createElement(
|
|
8084
|
-
ClickAwayListener,
|
|
8085
|
-
{
|
|
8086
|
-
mouseEvent: "onMouseDown",
|
|
8087
|
-
touchEvent: "onTouchStart",
|
|
8088
|
-
onClickAway: popoverProps.onClose
|
|
8089
|
-
},
|
|
8090
|
-
/* @__PURE__ */ React114.createElement(Box27, null, children({ anchorEl: ref }))
|
|
8091
|
-
)));
|
|
8136
|
+
), /* @__PURE__ */ React114.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React114.createElement(Box27, null, children({ anchorEl: ref }))));
|
|
8092
8137
|
};
|
|
8093
8138
|
var usePopover = (openOnMount, onOpen, onPopoverClose) => {
|
|
8094
8139
|
const [ref, setRef] = useState20(null);
|
|
8095
8140
|
const popoverState = usePopupState10({ variant: "popover" });
|
|
8096
8141
|
const popoverProps = bindPopover8(popoverState);
|
|
8097
|
-
|
|
8142
|
+
useEffect18(() => {
|
|
8098
8143
|
if (openOnMount && ref) {
|
|
8099
8144
|
popoverState.open(ref);
|
|
8100
8145
|
onOpen?.();
|
|
@@ -8114,7 +8159,7 @@ var usePopover = (openOnMount, onOpen, onPopoverClose) => {
|
|
|
8114
8159
|
|
|
8115
8160
|
// src/components/inline-editor-toolbar.tsx
|
|
8116
8161
|
import * as React116 from "react";
|
|
8117
|
-
import { useEffect as
|
|
8162
|
+
import { useEffect as useEffect20, useMemo as useMemo17, useRef as useRef31, useState as useState21 } from "react";
|
|
8118
8163
|
import { getContainer as getContainer2, getElementSetting } from "@elementor/editor-elements";
|
|
8119
8164
|
import {
|
|
8120
8165
|
BoldIcon,
|
|
@@ -8140,7 +8185,7 @@ import { __ as __58 } from "@wordpress/i18n";
|
|
|
8140
8185
|
|
|
8141
8186
|
// src/components/url-popover.tsx
|
|
8142
8187
|
import * as React115 from "react";
|
|
8143
|
-
import { useEffect as
|
|
8188
|
+
import { useEffect as useEffect19, useRef as useRef30 } from "react";
|
|
8144
8189
|
import { ExternalLinkIcon } from "@elementor/icons";
|
|
8145
8190
|
import { bindPopover as bindPopover9, Popover as Popover8, Stack as Stack20, TextField as TextField10, ToggleButton as ToggleButton2, Tooltip as Tooltip13 } from "@elementor/ui";
|
|
8146
8191
|
import { __ as __57 } from "@wordpress/i18n";
|
|
@@ -8153,8 +8198,8 @@ var UrlPopover = ({
|
|
|
8153
8198
|
openInNewTab,
|
|
8154
8199
|
onToggleNewTab
|
|
8155
8200
|
}) => {
|
|
8156
|
-
const inputRef =
|
|
8157
|
-
|
|
8201
|
+
const inputRef = useRef30(null);
|
|
8202
|
+
useEffect19(() => {
|
|
8158
8203
|
if (popupState.isOpen) {
|
|
8159
8204
|
requestAnimationFrame(() => inputRef.current?.focus());
|
|
8160
8205
|
}
|
|
@@ -8206,14 +8251,14 @@ var UrlPopover = ({
|
|
|
8206
8251
|
var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
8207
8252
|
const [urlValue, setUrlValue] = useState21("");
|
|
8208
8253
|
const [openInNewTab, setOpenInNewTab] = useState21(false);
|
|
8209
|
-
const toolbarRef =
|
|
8254
|
+
const toolbarRef = useRef31(null);
|
|
8210
8255
|
const linkPopupState = usePopupState11({ variant: "popover" });
|
|
8211
8256
|
const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
|
|
8212
8257
|
const editorState = useEditorState({
|
|
8213
8258
|
editor,
|
|
8214
8259
|
selector: (ctx) => possibleFormats.filter((format) => ctx.editor.isActive(format))
|
|
8215
8260
|
});
|
|
8216
|
-
const formatButtonsList =
|
|
8261
|
+
const formatButtonsList = useMemo17(() => {
|
|
8217
8262
|
const buttons = Object.values(formatButtons);
|
|
8218
8263
|
if (isElementClickable) {
|
|
8219
8264
|
return buttons.filter((button) => button.action !== "link");
|
|
@@ -8250,7 +8295,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
8250
8295
|
}
|
|
8251
8296
|
linkPopupState.close();
|
|
8252
8297
|
};
|
|
8253
|
-
|
|
8298
|
+
useEffect20(() => {
|
|
8254
8299
|
editor?.commands?.focus();
|
|
8255
8300
|
}, [editor]);
|
|
8256
8301
|
return /* @__PURE__ */ React116.createElement(
|
|
@@ -8560,7 +8605,7 @@ var hasValue = (value) => {
|
|
|
8560
8605
|
};
|
|
8561
8606
|
|
|
8562
8607
|
// src/hooks/use-font-families.ts
|
|
8563
|
-
import { useMemo as
|
|
8608
|
+
import { useMemo as useMemo18 } from "react";
|
|
8564
8609
|
import { getElementorConfig } from "@elementor/editor-v1-adapters";
|
|
8565
8610
|
var getFontControlConfig = () => {
|
|
8566
8611
|
const { controls } = getElementorConfig();
|
|
@@ -8568,7 +8613,7 @@ var getFontControlConfig = () => {
|
|
|
8568
8613
|
};
|
|
8569
8614
|
var useFontFamilies = () => {
|
|
8570
8615
|
const { groups, options } = getFontControlConfig();
|
|
8571
|
-
return
|
|
8616
|
+
return useMemo18(() => {
|
|
8572
8617
|
if (!groups || !options) {
|
|
8573
8618
|
return [];
|
|
8574
8619
|
}
|