@elementor/editor-controls 3.33.0-254 → 3.33.0-255
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 +89 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/control-repeater/items/item.tsx +6 -0
- package/src/controls/repeatable-control.tsx +10 -2
package/dist/index.js
CHANGED
|
@@ -1261,7 +1261,7 @@ var Control = (0, import_react14.forwardRef)(({ bind, label, children }, ref) =>
|
|
|
1261
1261
|
|
|
1262
1262
|
// src/controls/box-shadow-repeater-control.tsx
|
|
1263
1263
|
var React39 = __toESM(require("react"));
|
|
1264
|
-
var
|
|
1264
|
+
var import_react22 = require("react");
|
|
1265
1265
|
var import_editor_props10 = require("@elementor/editor-props");
|
|
1266
1266
|
var import_ui30 = require("@elementor/ui");
|
|
1267
1267
|
var import_i18n11 = require("@wordpress/i18n");
|
|
@@ -1554,11 +1554,22 @@ var React27 = __toESM(require("react"));
|
|
|
1554
1554
|
var import_ui21 = require("@elementor/ui");
|
|
1555
1555
|
var import_i18n7 = require("@wordpress/i18n");
|
|
1556
1556
|
|
|
1557
|
+
// src/hooks/use-repeatable-control-context.ts
|
|
1558
|
+
var import_react17 = require("react");
|
|
1559
|
+
var RepeatableControlContext = (0, import_react17.createContext)(void 0);
|
|
1560
|
+
var useRepeatableControlContext = () => {
|
|
1561
|
+
const context = (0, import_react17.useContext)(RepeatableControlContext);
|
|
1562
|
+
if (!context) {
|
|
1563
|
+
throw new Error("useRepeatableControlContext must be used within RepeatableControl");
|
|
1564
|
+
}
|
|
1565
|
+
return context;
|
|
1566
|
+
};
|
|
1567
|
+
|
|
1557
1568
|
// src/components/repeater/repeater-tag.tsx
|
|
1558
1569
|
var React26 = __toESM(require("react"));
|
|
1559
|
-
var
|
|
1570
|
+
var import_react18 = require("react");
|
|
1560
1571
|
var import_ui20 = require("@elementor/ui");
|
|
1561
|
-
var RepeaterTag = (0,
|
|
1572
|
+
var RepeaterTag = (0, import_react18.forwardRef)((props, ref) => {
|
|
1562
1573
|
return /* @__PURE__ */ React26.createElement(
|
|
1563
1574
|
import_ui20.UnstableTag,
|
|
1564
1575
|
{
|
|
@@ -1581,8 +1592,13 @@ var { Slot: RepeaterItemActionsSlot, inject: injectIntoRepeaterItemActions } = (
|
|
|
1581
1592
|
// src/components/control-repeater/items/item.tsx
|
|
1582
1593
|
var Item = ({ Label: Label3, Icon, actions }) => {
|
|
1583
1594
|
const { popoverState, setRowRef, openItemIndex, setOpenItemIndex, index = -1, value } = useRepeaterContext();
|
|
1595
|
+
const repeatableContext = React27.useContext(RepeatableControlContext);
|
|
1596
|
+
const disableOpen = !!repeatableContext?.props?.readOnly;
|
|
1584
1597
|
const triggerProps = (0, import_ui21.bindTrigger)(popoverState);
|
|
1585
1598
|
const onClick = (ev) => {
|
|
1599
|
+
if (disableOpen) {
|
|
1600
|
+
return;
|
|
1601
|
+
}
|
|
1586
1602
|
triggerProps.onClick(ev);
|
|
1587
1603
|
setOpenItemIndex(index);
|
|
1588
1604
|
};
|
|
@@ -1720,16 +1736,16 @@ var import_ui27 = require("@elementor/ui");
|
|
|
1720
1736
|
var PopoverContent = ({ gap = 1.5, children, ...props }) => /* @__PURE__ */ React34.createElement(import_ui27.Stack, { ...props, gap }, children);
|
|
1721
1737
|
|
|
1722
1738
|
// src/components/popover-grid-container.tsx
|
|
1723
|
-
var
|
|
1739
|
+
var import_react19 = require("react");
|
|
1724
1740
|
var React35 = __toESM(require("react"));
|
|
1725
1741
|
var import_ui28 = require("@elementor/ui");
|
|
1726
|
-
var PopoverGridContainer = (0,
|
|
1742
|
+
var PopoverGridContainer = (0, import_react19.forwardRef)(
|
|
1727
1743
|
({ gap = 1.5, alignItems = "center", flexWrap = "nowrap", children }, ref) => /* @__PURE__ */ React35.createElement(import_ui28.Grid, { container: true, gap, alignItems, flexWrap, ref }, children)
|
|
1728
1744
|
);
|
|
1729
1745
|
|
|
1730
1746
|
// src/components/repeater/repeater-header.tsx
|
|
1731
1747
|
var React38 = __toESM(require("react"));
|
|
1732
|
-
var
|
|
1748
|
+
var import_react21 = require("react");
|
|
1733
1749
|
var import_ui29 = require("@elementor/ui");
|
|
1734
1750
|
|
|
1735
1751
|
// src/control-adornments/control-adornments.tsx
|
|
@@ -1737,11 +1753,11 @@ var React37 = __toESM(require("react"));
|
|
|
1737
1753
|
|
|
1738
1754
|
// src/control-adornments/control-adornments-context.tsx
|
|
1739
1755
|
var React36 = __toESM(require("react"));
|
|
1740
|
-
var
|
|
1741
|
-
var Context2 = (0,
|
|
1756
|
+
var import_react20 = require("react");
|
|
1757
|
+
var Context2 = (0, import_react20.createContext)(null);
|
|
1742
1758
|
var ControlAdornmentsProvider = ({ children, items: items2 }) => /* @__PURE__ */ React36.createElement(Context2.Provider, { value: { items: items2 } }, children);
|
|
1743
1759
|
var useControlAdornments = () => {
|
|
1744
|
-
const context = (0,
|
|
1760
|
+
const context = (0, import_react20.useContext)(Context2);
|
|
1745
1761
|
return context?.items ?? [];
|
|
1746
1762
|
};
|
|
1747
1763
|
|
|
@@ -1757,7 +1773,7 @@ function ControlAdornments({
|
|
|
1757
1773
|
}
|
|
1758
1774
|
|
|
1759
1775
|
// src/components/repeater/repeater-header.tsx
|
|
1760
|
-
var RepeaterHeader = (0,
|
|
1776
|
+
var RepeaterHeader = (0, import_react21.forwardRef)(
|
|
1761
1777
|
({
|
|
1762
1778
|
label,
|
|
1763
1779
|
children,
|
|
@@ -1798,7 +1814,7 @@ var StyledUnstableColorIndicator = (0, import_ui30.styled)(import_ui30.UnstableC
|
|
|
1798
1814
|
var ItemIcon = ({ value }) => /* @__PURE__ */ React39.createElement(StyledUnstableColorIndicator, { size: "inherit", component: "span", value: value.value.color?.value });
|
|
1799
1815
|
var Content = () => {
|
|
1800
1816
|
const context = useBoundProp(import_editor_props10.shadowPropTypeUtil);
|
|
1801
|
-
const rowRef = [(0,
|
|
1817
|
+
const rowRef = [(0, import_react22.useRef)(null), (0, import_react22.useRef)(null)];
|
|
1802
1818
|
const { rowRef: anchorEl } = useRepeaterContext();
|
|
1803
1819
|
return /* @__PURE__ */ React39.createElement(PropProvider, { ...context }, /* @__PURE__ */ React39.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React39.createElement(PopoverGridContainer, null, /* @__PURE__ */ React39.createElement(Control2, { bind: "color", label: (0, import_i18n11.__)("Color", "elementor") }, /* @__PURE__ */ React39.createElement(ColorControl, { anchorEl })), /* @__PURE__ */ React39.createElement(Control2, { bind: "position", label: (0, import_i18n11.__)("Position", "elementor"), sx: { overflow: "hidden" } }, /* @__PURE__ */ React39.createElement(
|
|
1804
1820
|
SelectControl,
|
|
@@ -1870,7 +1886,7 @@ var import_i18n16 = require("@wordpress/i18n");
|
|
|
1870
1886
|
|
|
1871
1887
|
// src/controls/filter-control/context/filter-config-context.tsx
|
|
1872
1888
|
var React40 = __toESM(require("react"));
|
|
1873
|
-
var
|
|
1889
|
+
var import_react23 = require("react");
|
|
1874
1890
|
var import_editor_props11 = require("@elementor/editor-props");
|
|
1875
1891
|
|
|
1876
1892
|
// src/controls/filter-control/utils.ts
|
|
@@ -1969,10 +1985,10 @@ function extractPropType(propType, filterFunctionGroup) {
|
|
|
1969
1985
|
}
|
|
1970
1986
|
|
|
1971
1987
|
// src/controls/filter-control/context/filter-config-context.tsx
|
|
1972
|
-
var FilterConfigContext = (0,
|
|
1988
|
+
var FilterConfigContext = (0, import_react23.createContext)(null);
|
|
1973
1989
|
function FilterConfigProvider({ children }) {
|
|
1974
1990
|
const propContext = useBoundProp(import_editor_props11.cssFilterFunctionPropUtil);
|
|
1975
|
-
const contextValue = (0,
|
|
1991
|
+
const contextValue = (0, import_react23.useMemo)(() => {
|
|
1976
1992
|
const config = buildFilterConfig(propContext.propType.item_prop_type);
|
|
1977
1993
|
const filterOptions = Object.entries(config).map(([key, conf]) => ({
|
|
1978
1994
|
value: key,
|
|
@@ -1988,7 +2004,7 @@ function FilterConfigProvider({ children }) {
|
|
|
1988
2004
|
return /* @__PURE__ */ React40.createElement(FilterConfigContext.Provider, { value: contextValue }, children);
|
|
1989
2005
|
}
|
|
1990
2006
|
function useFilterConfig() {
|
|
1991
|
-
const context = (0,
|
|
2007
|
+
const context = (0, import_react23.useContext)(FilterConfigContext);
|
|
1992
2008
|
if (!context) {
|
|
1993
2009
|
throw new Error("useFilterConfig must be used within FilterConfigProvider");
|
|
1994
2010
|
}
|
|
@@ -2003,7 +2019,7 @@ var import_i18n15 = require("@wordpress/i18n");
|
|
|
2003
2019
|
|
|
2004
2020
|
// src/controls/filter-control/drop-shadow/drop-shadow-item-content.tsx
|
|
2005
2021
|
var React41 = __toESM(require("react"));
|
|
2006
|
-
var
|
|
2022
|
+
var import_react24 = require("react");
|
|
2007
2023
|
var import_editor_props12 = require("@elementor/editor-props");
|
|
2008
2024
|
var import_ui31 = require("@elementor/ui");
|
|
2009
2025
|
var import_i18n14 = require("@wordpress/i18n");
|
|
@@ -2031,7 +2047,7 @@ var items = [
|
|
|
2031
2047
|
];
|
|
2032
2048
|
var DropShadowItemContent = ({ anchorEl }) => {
|
|
2033
2049
|
const context = useBoundProp(import_editor_props12.dropShadowFilterPropTypeUtil);
|
|
2034
|
-
const rowRefs = [(0,
|
|
2050
|
+
const rowRefs = [(0, import_react24.useRef)(null), (0, import_react24.useRef)(null)];
|
|
2035
2051
|
return /* @__PURE__ */ React41.createElement(PropProvider, { ...context }, items.map((item) => /* @__PURE__ */ React41.createElement(PopoverGridContainer, { key: item.bind, ref: rowRefs[item.rowIndex] ?? null }, /* @__PURE__ */ React41.createElement(PropKeyProvider, { bind: item.bind }, /* @__PURE__ */ React41.createElement(import_ui31.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React41.createElement(ControlFormLabel, null, item.label)), /* @__PURE__ */ React41.createElement(import_ui31.Grid, { item: true, xs: 6 }, item.bind === "color" ? /* @__PURE__ */ React41.createElement(ColorControl, { anchorEl }) : /* @__PURE__ */ React41.createElement(
|
|
2036
2052
|
SizeControl,
|
|
2037
2053
|
{
|
|
@@ -2044,7 +2060,7 @@ var DropShadowItemContent = ({ anchorEl }) => {
|
|
|
2044
2060
|
};
|
|
2045
2061
|
|
|
2046
2062
|
// src/controls/filter-control/single-size/single-size-item-content.tsx
|
|
2047
|
-
var
|
|
2063
|
+
var import_react25 = require("react");
|
|
2048
2064
|
var React42 = __toESM(require("react"));
|
|
2049
2065
|
var import_editor_props13 = require("@elementor/editor-props");
|
|
2050
2066
|
var import_ui32 = require("@elementor/ui");
|
|
@@ -2055,7 +2071,7 @@ var propTypeMap = {
|
|
|
2055
2071
|
"color-tone": import_editor_props13.colorToneFilterPropTypeUtil
|
|
2056
2072
|
};
|
|
2057
2073
|
var SingleSizeItemContent = ({ filterFunc }) => {
|
|
2058
|
-
const rowRef = (0,
|
|
2074
|
+
const rowRef = (0, import_react25.useRef)(null);
|
|
2059
2075
|
const { getFilterFunctionConfig } = useFilterConfig();
|
|
2060
2076
|
const { valueName, filterFunctionGroup } = getFilterFunctionConfig(filterFunc);
|
|
2061
2077
|
const context = useBoundProp(propTypeMap[filterFunctionGroup]);
|
|
@@ -2195,7 +2211,7 @@ function ensureFilterConfig(name) {
|
|
|
2195
2211
|
|
|
2196
2212
|
// src/controls/select-control-wrapper.tsx
|
|
2197
2213
|
var React49 = __toESM(require("react"));
|
|
2198
|
-
var
|
|
2214
|
+
var import_react26 = require("react");
|
|
2199
2215
|
var getOffCanvasElements = () => {
|
|
2200
2216
|
const extendedWindow = window;
|
|
2201
2217
|
const documentId = extendedWindow.elementor.config.document.id;
|
|
@@ -2213,8 +2229,8 @@ var collectionMethods = {
|
|
|
2213
2229
|
"off-canvas": getOffCanvasElements
|
|
2214
2230
|
};
|
|
2215
2231
|
var useDynamicOptions = (collectionId, initialOptions) => {
|
|
2216
|
-
const [options, setOptions] = (0,
|
|
2217
|
-
(0,
|
|
2232
|
+
const [options, setOptions] = (0, import_react26.useState)(initialOptions ?? []);
|
|
2233
|
+
(0, import_react26.useEffect)(() => {
|
|
2218
2234
|
if (!collectionId || !collectionMethods[collectionId]) {
|
|
2219
2235
|
setOptions(initialOptions ?? []);
|
|
2220
2236
|
return;
|
|
@@ -2236,7 +2252,7 @@ var import_editor_props16 = require("@elementor/editor-props");
|
|
|
2236
2252
|
|
|
2237
2253
|
// src/components/control-toggle-button-group.tsx
|
|
2238
2254
|
var React51 = __toESM(require("react"));
|
|
2239
|
-
var
|
|
2255
|
+
var import_react27 = require("react");
|
|
2240
2256
|
var import_icons9 = require("@elementor/icons");
|
|
2241
2257
|
var import_ui38 = require("@elementor/ui");
|
|
2242
2258
|
|
|
@@ -2299,7 +2315,7 @@ var ControlToggleButtonGroup = ({
|
|
|
2299
2315
|
const handleChange = (_, newValue) => {
|
|
2300
2316
|
onChange(newValue);
|
|
2301
2317
|
};
|
|
2302
|
-
const getGridTemplateColumns = (0,
|
|
2318
|
+
const getGridTemplateColumns = (0, import_react27.useMemo)(() => {
|
|
2303
2319
|
const isOffLimits = menuItems?.length;
|
|
2304
2320
|
const itemsCount = isOffLimits ? fixedItems.length + 1 : fixedItems.length;
|
|
2305
2321
|
const templateColumnsSuffix = isOffLimits ? "auto" : "";
|
|
@@ -2380,8 +2396,8 @@ var SplitButtonGroup = ({
|
|
|
2380
2396
|
value
|
|
2381
2397
|
}) => {
|
|
2382
2398
|
const previewButton = usePreviewButton(items2, value);
|
|
2383
|
-
const [isMenuOpen, setIsMenuOpen] = (0,
|
|
2384
|
-
const menuButtonRef = (0,
|
|
2399
|
+
const [isMenuOpen, setIsMenuOpen] = (0, import_react27.useState)(false);
|
|
2400
|
+
const menuButtonRef = (0, import_react27.useRef)(null);
|
|
2385
2401
|
const onMenuToggle = (ev) => {
|
|
2386
2402
|
setIsMenuOpen((prev) => !prev);
|
|
2387
2403
|
ev.preventDefault();
|
|
@@ -2450,10 +2466,10 @@ var SplitButtonGroup = ({
|
|
|
2450
2466
|
));
|
|
2451
2467
|
};
|
|
2452
2468
|
var usePreviewButton = (items2, value) => {
|
|
2453
|
-
const [previewButton, setPreviewButton] = (0,
|
|
2469
|
+
const [previewButton, setPreviewButton] = (0, import_react27.useState)(
|
|
2454
2470
|
items2.find((item) => item.value === value) ?? items2[0]
|
|
2455
2471
|
);
|
|
2456
|
-
(0,
|
|
2472
|
+
(0, import_react27.useEffect)(() => {
|
|
2457
2473
|
const selectedButton = items2.find((item) => item.value === value);
|
|
2458
2474
|
if (selectedButton) {
|
|
2459
2475
|
setPreviewButton(selectedButton);
|
|
@@ -2586,7 +2602,7 @@ var NumberControl = createControl(
|
|
|
2586
2602
|
|
|
2587
2603
|
// src/controls/equal-unequal-sizes-control.tsx
|
|
2588
2604
|
var React56 = __toESM(require("react"));
|
|
2589
|
-
var
|
|
2605
|
+
var import_react28 = require("react");
|
|
2590
2606
|
var import_editor_props18 = require("@elementor/editor-props");
|
|
2591
2607
|
var import_ui41 = require("@elementor/ui");
|
|
2592
2608
|
var import_i18n17 = require("@wordpress/i18n");
|
|
@@ -2616,7 +2632,7 @@ function EqualUnequalSizesControl({
|
|
|
2616
2632
|
items: items2,
|
|
2617
2633
|
multiSizePropTypeUtil
|
|
2618
2634
|
}) {
|
|
2619
|
-
const popupId = (0,
|
|
2635
|
+
const popupId = (0, import_react28.useId)();
|
|
2620
2636
|
const popupState = (0, import_ui41.usePopupState)({ variant: "popover", popupId });
|
|
2621
2637
|
const {
|
|
2622
2638
|
propType: multiSizePropType,
|
|
@@ -2625,7 +2641,7 @@ function EqualUnequalSizesControl({
|
|
|
2625
2641
|
disabled: multiSizeDisabled
|
|
2626
2642
|
} = useBoundProp(multiSizePropTypeUtil);
|
|
2627
2643
|
const { value: sizeValue, setValue: setSizeValue } = useBoundProp(import_editor_props18.sizePropTypeUtil);
|
|
2628
|
-
const rowRefs = [(0,
|
|
2644
|
+
const rowRefs = [(0, import_react28.useRef)(null), (0, import_react28.useRef)(null)];
|
|
2629
2645
|
const splitEqualValue = () => {
|
|
2630
2646
|
if (!sizeValue) {
|
|
2631
2647
|
return null;
|
|
@@ -2707,7 +2723,7 @@ var MultiSizeValueControl = ({ item, rowRef }) => {
|
|
|
2707
2723
|
|
|
2708
2724
|
// src/controls/linked-dimensions-control.tsx
|
|
2709
2725
|
var React57 = __toESM(require("react"));
|
|
2710
|
-
var
|
|
2726
|
+
var import_react29 = require("react");
|
|
2711
2727
|
var import_editor_props19 = require("@elementor/editor-props");
|
|
2712
2728
|
var import_icons10 = require("@elementor/icons");
|
|
2713
2729
|
var import_ui42 = require("@elementor/ui");
|
|
@@ -2724,7 +2740,7 @@ var LinkedDimensionsControl = ({
|
|
|
2724
2740
|
disabled: sizeDisabled,
|
|
2725
2741
|
placeholder: sizePlaceholder
|
|
2726
2742
|
} = useBoundProp(import_editor_props19.sizePropTypeUtil);
|
|
2727
|
-
const gridRowRefs = [(0,
|
|
2743
|
+
const gridRowRefs = [(0, import_react29.useRef)(null), (0, import_react29.useRef)(null)];
|
|
2728
2744
|
const {
|
|
2729
2745
|
value: dimensionsValue,
|
|
2730
2746
|
setValue: setDimensionsValue,
|
|
@@ -2859,7 +2875,7 @@ var import_i18n20 = require("@wordpress/i18n");
|
|
|
2859
2875
|
|
|
2860
2876
|
// src/components/item-selector.tsx
|
|
2861
2877
|
var React58 = __toESM(require("react"));
|
|
2862
|
-
var
|
|
2878
|
+
var import_react30 = require("react");
|
|
2863
2879
|
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
2864
2880
|
var import_ui43 = require("@elementor/ui");
|
|
2865
2881
|
var import_utils3 = require("@elementor/utils");
|
|
@@ -2896,7 +2912,7 @@ var ItemSelector = ({
|
|
|
2896
2912
|
disabledItems,
|
|
2897
2913
|
id = "item-selector"
|
|
2898
2914
|
}) => {
|
|
2899
|
-
const [searchValue, setSearchValue] = (0,
|
|
2915
|
+
const [searchValue, setSearchValue] = (0, import_react30.useState)("");
|
|
2900
2916
|
const filteredItemsList = useFilteredItemsList(itemsList, searchValue, disabledItems);
|
|
2901
2917
|
const IconComponent = icon;
|
|
2902
2918
|
const handleSearch = (value) => {
|
|
@@ -2993,7 +3009,7 @@ var ItemList = ({
|
|
|
2993
3009
|
}
|
|
2994
3010
|
});
|
|
2995
3011
|
}, 100);
|
|
2996
|
-
const memoizedItemStyle = (0,
|
|
3012
|
+
const memoizedItemStyle = (0, import_react30.useCallback)((item) => itemStyle(item), [itemStyle]);
|
|
2997
3013
|
return /* @__PURE__ */ React58.createElement(
|
|
2998
3014
|
import_editor_ui4.PopoverMenuList,
|
|
2999
3015
|
{
|
|
@@ -3008,8 +3024,8 @@ var ItemList = ({
|
|
|
3008
3024
|
);
|
|
3009
3025
|
};
|
|
3010
3026
|
var useDebounce = (fn, delay) => {
|
|
3011
|
-
const [debouncedFn] = (0,
|
|
3012
|
-
(0,
|
|
3027
|
+
const [debouncedFn] = (0, import_react30.useState)(() => (0, import_utils3.debounce)(fn, delay));
|
|
3028
|
+
(0, import_react30.useEffect)(() => () => debouncedFn.cancel(), [debouncedFn]);
|
|
3013
3029
|
return debouncedFn;
|
|
3014
3030
|
};
|
|
3015
3031
|
|
|
@@ -3110,7 +3126,7 @@ var UrlControl = createControl(
|
|
|
3110
3126
|
|
|
3111
3127
|
// src/controls/link-control.tsx
|
|
3112
3128
|
var React65 = __toESM(require("react"));
|
|
3113
|
-
var
|
|
3129
|
+
var import_react33 = require("react");
|
|
3114
3130
|
var import_editor_elements2 = require("@elementor/editor-elements");
|
|
3115
3131
|
var import_editor_props24 = require("@elementor/editor-props");
|
|
3116
3132
|
var import_icons15 = require("@elementor/icons");
|
|
@@ -3179,7 +3195,7 @@ var RestrictedLinkInfotip = ({
|
|
|
3179
3195
|
|
|
3180
3196
|
// src/controls/query-control.tsx
|
|
3181
3197
|
var React63 = __toESM(require("react"));
|
|
3182
|
-
var
|
|
3198
|
+
var import_react32 = require("react");
|
|
3183
3199
|
var import_editor_props22 = require("@elementor/editor-props");
|
|
3184
3200
|
var import_http_client2 = require("@elementor/http-client");
|
|
3185
3201
|
var import_icons14 = require("@elementor/icons");
|
|
@@ -3188,10 +3204,10 @@ var import_i18n22 = require("@wordpress/i18n");
|
|
|
3188
3204
|
|
|
3189
3205
|
// src/components/autocomplete.tsx
|
|
3190
3206
|
var React62 = __toESM(require("react"));
|
|
3191
|
-
var
|
|
3207
|
+
var import_react31 = require("react");
|
|
3192
3208
|
var import_icons13 = require("@elementor/icons");
|
|
3193
3209
|
var import_ui47 = require("@elementor/ui");
|
|
3194
|
-
var Autocomplete = (0,
|
|
3210
|
+
var Autocomplete = (0, import_react31.forwardRef)((props, ref) => {
|
|
3195
3211
|
const {
|
|
3196
3212
|
options,
|
|
3197
3213
|
onOptionChange,
|
|
@@ -3322,7 +3338,7 @@ var QueryControl = createControl((props) => {
|
|
|
3322
3338
|
ariaLabel
|
|
3323
3339
|
} = props || {};
|
|
3324
3340
|
const normalizedPlaceholder = placeholder || (0, import_i18n22.__)("Search", "elementor");
|
|
3325
|
-
const [options, setOptions] = (0,
|
|
3341
|
+
const [options, setOptions] = (0, import_react32.useState)(
|
|
3326
3342
|
generateFirstLoadedOption(value?.value)
|
|
3327
3343
|
);
|
|
3328
3344
|
const onOptionChange = (newValue) => {
|
|
@@ -3360,7 +3376,7 @@ var QueryControl = createControl((props) => {
|
|
|
3360
3376
|
}
|
|
3361
3377
|
debounceFetch({ ...params, term: newValue });
|
|
3362
3378
|
};
|
|
3363
|
-
const debounceFetch = (0,
|
|
3379
|
+
const debounceFetch = (0, import_react32.useMemo)(
|
|
3364
3380
|
() => (0, import_utils4.debounce)(
|
|
3365
3381
|
(queryParams) => fetchOptions(url, queryParams).then((newOptions) => {
|
|
3366
3382
|
setOptions(formatOptions(newOptions));
|
|
@@ -3444,7 +3460,7 @@ var SIZE6 = "tiny";
|
|
|
3444
3460
|
var LinkControl = createControl((props) => {
|
|
3445
3461
|
const { value, path, setValue, ...propContext } = useBoundProp(import_editor_props24.linkPropTypeUtil);
|
|
3446
3462
|
const [linkSessionValue, setLinkSessionValue] = (0, import_session.useSessionStorage)(path.join("/"));
|
|
3447
|
-
const [isActive, setIsActive] = (0,
|
|
3463
|
+
const [isActive, setIsActive] = (0, import_react33.useState)(!!value);
|
|
3448
3464
|
const {
|
|
3449
3465
|
allowCustomValues = true,
|
|
3450
3466
|
queryOptions,
|
|
@@ -3454,7 +3470,7 @@ var LinkControl = createControl((props) => {
|
|
|
3454
3470
|
label = (0, import_i18n23.__)("Link", "elementor"),
|
|
3455
3471
|
ariaLabel
|
|
3456
3472
|
} = props || {};
|
|
3457
|
-
const [linkInLinkRestriction, setLinkInLinkRestriction] = (0,
|
|
3473
|
+
const [linkInLinkRestriction, setLinkInLinkRestriction] = (0, import_react33.useState)((0, import_editor_elements2.getLinkInLinkRestriction)(elementId));
|
|
3458
3474
|
const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
|
|
3459
3475
|
const onEnabledChange = () => {
|
|
3460
3476
|
setLinkInLinkRestriction((0, import_editor_elements2.getLinkInLinkRestriction)(elementId));
|
|
@@ -3618,7 +3634,7 @@ var HtmlTagControl = createControl(({ options, onChange, fallbackLabels = {} })
|
|
|
3618
3634
|
|
|
3619
3635
|
// src/controls/gap-control.tsx
|
|
3620
3636
|
var React68 = __toESM(require("react"));
|
|
3621
|
-
var
|
|
3637
|
+
var import_react34 = require("react");
|
|
3622
3638
|
var import_editor_props26 = require("@elementor/editor-props");
|
|
3623
3639
|
var import_icons16 = require("@elementor/icons");
|
|
3624
3640
|
var import_ui53 = require("@elementor/ui");
|
|
@@ -3630,7 +3646,7 @@ var GapControl = ({ label }) => {
|
|
|
3630
3646
|
propType,
|
|
3631
3647
|
disabled: directionDisabled
|
|
3632
3648
|
} = useBoundProp(import_editor_props26.layoutDirectionPropTypeUtil);
|
|
3633
|
-
const stackRef = (0,
|
|
3649
|
+
const stackRef = (0, import_react34.useRef)(null);
|
|
3634
3650
|
const { value: sizeValue, setValue: setSizeValue, disabled: sizeDisabled } = useBoundProp(import_editor_props26.sizePropTypeUtil);
|
|
3635
3651
|
const isLinked = !directionValue && !sizeValue ? true : !!sizeValue;
|
|
3636
3652
|
const onLinkToggle = () => {
|
|
@@ -3676,7 +3692,7 @@ var Control4 = ({
|
|
|
3676
3692
|
|
|
3677
3693
|
// src/controls/aspect-ratio-control.tsx
|
|
3678
3694
|
var React69 = __toESM(require("react"));
|
|
3679
|
-
var
|
|
3695
|
+
var import_react35 = require("react");
|
|
3680
3696
|
var import_editor_props27 = require("@elementor/editor-props");
|
|
3681
3697
|
var import_editor_ui7 = require("@elementor/editor-ui");
|
|
3682
3698
|
var import_icons17 = require("@elementor/icons");
|
|
@@ -3697,13 +3713,13 @@ var AspectRatioControl = createControl(({ label }) => {
|
|
|
3697
3713
|
const { value: aspectRatioValue, setValue: setAspectRatioValue, disabled } = useBoundProp(import_editor_props27.stringPropTypeUtil);
|
|
3698
3714
|
const isCustomSelected = aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue);
|
|
3699
3715
|
const [initialWidth, initialHeight] = isCustomSelected ? aspectRatioValue.split("/") : ["", ""];
|
|
3700
|
-
const [isCustom, setIsCustom] = (0,
|
|
3701
|
-
const [customWidth, setCustomWidth] = (0,
|
|
3702
|
-
const [customHeight, setCustomHeight] = (0,
|
|
3703
|
-
const [selectedValue, setSelectedValue] = (0,
|
|
3716
|
+
const [isCustom, setIsCustom] = (0, import_react35.useState)(isCustomSelected);
|
|
3717
|
+
const [customWidth, setCustomWidth] = (0, import_react35.useState)(initialWidth);
|
|
3718
|
+
const [customHeight, setCustomHeight] = (0, import_react35.useState)(initialHeight);
|
|
3719
|
+
const [selectedValue, setSelectedValue] = (0, import_react35.useState)(
|
|
3704
3720
|
isCustomSelected ? CUSTOM_RATIO : aspectRatioValue || ""
|
|
3705
3721
|
);
|
|
3706
|
-
(0,
|
|
3722
|
+
(0, import_react35.useEffect)(() => {
|
|
3707
3723
|
const isCustomValue = aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue);
|
|
3708
3724
|
if (isCustomValue) {
|
|
3709
3725
|
const [width, height] = aspectRatioValue.split("/");
|
|
@@ -3787,7 +3803,7 @@ var AspectRatioControl = createControl(({ label }) => {
|
|
|
3787
3803
|
|
|
3788
3804
|
// src/controls/svg-media-control.tsx
|
|
3789
3805
|
var React71 = __toESM(require("react"));
|
|
3790
|
-
var
|
|
3806
|
+
var import_react37 = require("react");
|
|
3791
3807
|
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
3792
3808
|
var import_editor_props28 = require("@elementor/editor-props");
|
|
3793
3809
|
var import_icons18 = require("@elementor/icons");
|
|
@@ -3797,7 +3813,7 @@ var import_i18n28 = require("@wordpress/i18n");
|
|
|
3797
3813
|
|
|
3798
3814
|
// src/components/enable-unfiltered-modal.tsx
|
|
3799
3815
|
var React70 = __toESM(require("react"));
|
|
3800
|
-
var
|
|
3816
|
+
var import_react36 = require("react");
|
|
3801
3817
|
var import_ui55 = require("@elementor/ui");
|
|
3802
3818
|
var import_i18n27 = require("@wordpress/i18n");
|
|
3803
3819
|
var ADMIN_TITLE_TEXT = (0, import_i18n27.__)("Enable Unfiltered Uploads", "elementor");
|
|
@@ -3813,7 +3829,7 @@ var ADMIN_FAILED_CONTENT_TEXT_PT2 = (0, import_i18n27.__)(
|
|
|
3813
3829
|
var WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
|
|
3814
3830
|
var EnableUnfilteredModal = (props) => {
|
|
3815
3831
|
const { mutateAsync, isPending } = useUpdateUnfilteredFilesUpload();
|
|
3816
|
-
const [isError, setIsError] = (0,
|
|
3832
|
+
const [isError, setIsError] = (0, import_react36.useState)(false);
|
|
3817
3833
|
const onClose = (enabled) => {
|
|
3818
3834
|
props.onClose(enabled);
|
|
3819
3835
|
setTimeout(() => setIsError(false), WAIT_FOR_CLOSE_TIMEOUT_MS);
|
|
@@ -3876,7 +3892,7 @@ var SvgMediaControl = createControl(() => {
|
|
|
3876
3892
|
const { data: attachment, isFetching } = (0, import_wp_media2.useWpMediaAttachment)(id?.value || null);
|
|
3877
3893
|
const src = attachment?.url ?? url?.value ?? null;
|
|
3878
3894
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
3879
|
-
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = (0,
|
|
3895
|
+
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = (0, import_react37.useState)(false);
|
|
3880
3896
|
const { canUser } = (0, import_editor_current_user.useCurrentUserCapabilities)();
|
|
3881
3897
|
const canManageOptions = canUser("manage_options");
|
|
3882
3898
|
const { open } = (0, import_wp_media2.useWpMediaFrame)({
|
|
@@ -4059,7 +4075,7 @@ var BackgroundImageOverlayAttachment = () => {
|
|
|
4059
4075
|
|
|
4060
4076
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
|
|
4061
4077
|
var React74 = __toESM(require("react"));
|
|
4062
|
-
var
|
|
4078
|
+
var import_react38 = require("react");
|
|
4063
4079
|
var import_editor_props30 = require("@elementor/editor-props");
|
|
4064
4080
|
var import_editor_ui8 = require("@elementor/editor-ui");
|
|
4065
4081
|
var import_icons20 = require("@elementor/icons");
|
|
@@ -4081,7 +4097,7 @@ var BackgroundImageOverlayPosition = () => {
|
|
|
4081
4097
|
const backgroundImageOffsetContext = useBoundProp(import_editor_props30.backgroundImagePositionOffsetPropTypeUtil);
|
|
4082
4098
|
const stringPropContext = useBoundProp(import_editor_props30.stringPropTypeUtil);
|
|
4083
4099
|
const isCustom = !!backgroundImageOffsetContext.value;
|
|
4084
|
-
const rowRef = (0,
|
|
4100
|
+
const rowRef = (0, import_react38.useRef)(null);
|
|
4085
4101
|
const handlePositionChange = (event) => {
|
|
4086
4102
|
const value = event.target.value || null;
|
|
4087
4103
|
if (value === "custom") {
|
|
@@ -4154,7 +4170,7 @@ var BackgroundImageOverlayRepeat = () => {
|
|
|
4154
4170
|
|
|
4155
4171
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx
|
|
4156
4172
|
var React76 = __toESM(require("react"));
|
|
4157
|
-
var
|
|
4173
|
+
var import_react39 = require("react");
|
|
4158
4174
|
var import_editor_props31 = require("@elementor/editor-props");
|
|
4159
4175
|
var import_icons22 = require("@elementor/icons");
|
|
4160
4176
|
var import_ui61 = require("@elementor/ui");
|
|
@@ -4189,7 +4205,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
4189
4205
|
const backgroundImageScaleContext = useBoundProp(import_editor_props31.backgroundImageSizeScalePropTypeUtil);
|
|
4190
4206
|
const stringPropContext = useBoundProp(import_editor_props31.stringPropTypeUtil);
|
|
4191
4207
|
const isCustom = !!backgroundImageScaleContext.value;
|
|
4192
|
-
const rowRef = (0,
|
|
4208
|
+
const rowRef = (0, import_react39.useRef)(null);
|
|
4193
4209
|
const handleSizeChange = (size) => {
|
|
4194
4210
|
if (size === "custom") {
|
|
4195
4211
|
backgroundImageScaleContext.setValue({ width: null, height: null });
|
|
@@ -4224,7 +4240,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
4224
4240
|
};
|
|
4225
4241
|
|
|
4226
4242
|
// src/controls/background-control/background-overlay/use-background-tabs-history.ts
|
|
4227
|
-
var
|
|
4243
|
+
var import_react40 = require("react");
|
|
4228
4244
|
var import_editor_props32 = require("@elementor/editor-props");
|
|
4229
4245
|
var import_ui62 = require("@elementor/ui");
|
|
4230
4246
|
var useBackgroundTabsHistory = ({
|
|
@@ -4245,7 +4261,7 @@ var useBackgroundTabsHistory = ({
|
|
|
4245
4261
|
return "image";
|
|
4246
4262
|
};
|
|
4247
4263
|
const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui62.useTabs)(getCurrentOverlayType());
|
|
4248
|
-
const valuesHistory = (0,
|
|
4264
|
+
const valuesHistory = (0, import_react40.useRef)({
|
|
4249
4265
|
image: initialBackgroundImageOverlay,
|
|
4250
4266
|
color: initialBackgroundColorOverlay2,
|
|
4251
4267
|
gradient: initialBackgroundGradientOverlay2
|
|
@@ -4493,19 +4509,6 @@ var React79 = __toESM(require("react"));
|
|
|
4493
4509
|
var import_react41 = require("react");
|
|
4494
4510
|
var import_editor_props35 = require("@elementor/editor-props");
|
|
4495
4511
|
var import_ui65 = require("@elementor/ui");
|
|
4496
|
-
|
|
4497
|
-
// src/hooks/use-repeatable-control-context.ts
|
|
4498
|
-
var import_react40 = require("react");
|
|
4499
|
-
var RepeatableControlContext = (0, import_react40.createContext)(void 0);
|
|
4500
|
-
var useRepeatableControlContext = () => {
|
|
4501
|
-
const context = (0, import_react40.useContext)(RepeatableControlContext);
|
|
4502
|
-
if (!context) {
|
|
4503
|
-
throw new Error("useRepeatableControlContext must be used within RepeatableControl");
|
|
4504
|
-
}
|
|
4505
|
-
return context;
|
|
4506
|
-
};
|
|
4507
|
-
|
|
4508
|
-
// src/controls/repeatable-control.tsx
|
|
4509
4512
|
var PLACEHOLDER_REGEX = /\$\{([^}]+)\}/g;
|
|
4510
4513
|
var RepeatableControl = createControl(
|
|
4511
4514
|
({
|
|
@@ -4636,11 +4639,18 @@ var shouldShowPlaceholder = (pattern, data) => {
|
|
|
4636
4639
|
}
|
|
4637
4640
|
return false;
|
|
4638
4641
|
};
|
|
4642
|
+
var getTextColor = (isReadOnly, showPlaceholder) => {
|
|
4643
|
+
if (isReadOnly) {
|
|
4644
|
+
return "text.disabled";
|
|
4645
|
+
}
|
|
4646
|
+
return showPlaceholder ? "text.tertiary" : "text.primary";
|
|
4647
|
+
};
|
|
4639
4648
|
var ItemLabel3 = ({ value }) => {
|
|
4640
|
-
const { placeholder, patternLabel } = useRepeatableControlContext();
|
|
4649
|
+
const { placeholder, patternLabel, props: childProps } = useRepeatableControlContext();
|
|
4641
4650
|
const showPlaceholder = shouldShowPlaceholder(patternLabel, value);
|
|
4642
4651
|
const label = showPlaceholder ? placeholder : interpolate(patternLabel, value);
|
|
4643
|
-
const
|
|
4652
|
+
const isReadOnly = !!childProps?.readOnly;
|
|
4653
|
+
const color = getTextColor(isReadOnly, showPlaceholder);
|
|
4644
4654
|
return /* @__PURE__ */ React79.createElement(import_ui65.Box, { component: "span", color }, label);
|
|
4645
4655
|
};
|
|
4646
4656
|
var getAllProperties = (pattern) => {
|