@elementor/editor-controls 3.33.0-250 → 3.33.0-252
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 +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/controls/size-control.tsx +4 -3
package/dist/index.mjs
CHANGED
|
@@ -523,7 +523,7 @@ var TextAreaControl = createControl(({ placeholder, ariaLabel }) => {
|
|
|
523
523
|
|
|
524
524
|
// src/controls/size-control.tsx
|
|
525
525
|
import * as React18 from "react";
|
|
526
|
-
import { useEffect as useEffect3 } from "react";
|
|
526
|
+
import { useEffect as useEffect3, useState as useState5 } from "react";
|
|
527
527
|
import { sizePropTypeUtil as sizePropTypeUtil2 } from "@elementor/editor-props";
|
|
528
528
|
import { useActiveBreakpoint } from "@elementor/editor-responsive";
|
|
529
529
|
import { usePopupState as usePopupState2 } from "@elementor/ui";
|
|
@@ -946,12 +946,13 @@ var SizeControl = createControl(
|
|
|
946
946
|
propType
|
|
947
947
|
} = useBoundProp(sizePropTypeUtil2);
|
|
948
948
|
const actualDefaultUnit = defaultUnit ?? externalPlaceholder?.unit ?? defaultSelectedUnit[variant];
|
|
949
|
+
const [internalState, setInternalState] = useState5(createStateFromSizeProp(sizeValue, actualDefaultUnit));
|
|
949
950
|
const activeBreakpoint = useActiveBreakpoint();
|
|
950
951
|
const actualUnits = resolveUnits(propType, enablePropTypeUnits, variant, units2);
|
|
951
952
|
const actualExtendedOptions = useSizeExtendedOptions(extendedOptions || [], disableCustom ?? false);
|
|
952
953
|
const popupState = usePopupState2({ variant: "popover" });
|
|
953
954
|
const [state, setState] = useSyncExternalState({
|
|
954
|
-
external:
|
|
955
|
+
external: internalState,
|
|
955
956
|
setExternal: (newState, options, meta) => setSizeValue(extractValueFromState(newState), options, meta),
|
|
956
957
|
persistWhen: (newState) => !!extractValueFromState(newState),
|
|
957
958
|
fallback: (newState) => ({
|
|
@@ -1006,7 +1007,7 @@ var SizeControl = createControl(
|
|
|
1006
1007
|
return;
|
|
1007
1008
|
}
|
|
1008
1009
|
if (state.unit === newState.unit) {
|
|
1009
|
-
|
|
1010
|
+
setInternalState(mergedStates);
|
|
1010
1011
|
return;
|
|
1011
1012
|
}
|
|
1012
1013
|
setState(newState);
|
|
@@ -1188,7 +1189,7 @@ import { __ as __5, sprintf } from "@wordpress/i18n";
|
|
|
1188
1189
|
|
|
1189
1190
|
// src/components/control-repeater/context/repeater-context.tsx
|
|
1190
1191
|
import * as React22 from "react";
|
|
1191
|
-
import { createContext as createContext7, useMemo as useMemo2, useState as
|
|
1192
|
+
import { createContext as createContext7, useMemo as useMemo2, useState as useState6 } from "react";
|
|
1192
1193
|
import { usePopupState as usePopupState3 } from "@elementor/ui";
|
|
1193
1194
|
|
|
1194
1195
|
// src/services/event-bus.ts
|
|
@@ -1255,7 +1256,7 @@ var RepeaterContextProvider = ({
|
|
|
1255
1256
|
setExternal: setRepeaterValues,
|
|
1256
1257
|
persistWhen: () => true
|
|
1257
1258
|
});
|
|
1258
|
-
const [uniqueKeys, setUniqueKeys] =
|
|
1259
|
+
const [uniqueKeys, setUniqueKeys] = useState6(() => {
|
|
1259
1260
|
return items2?.map((_, index) => index) ?? [];
|
|
1260
1261
|
});
|
|
1261
1262
|
const itemsWithKeys = useMemo2(
|
|
@@ -1268,8 +1269,8 @@ var RepeaterContextProvider = ({
|
|
|
1268
1269
|
const handleSetItems = (newItemsWithKeys) => {
|
|
1269
1270
|
setItems(newItemsWithKeys.map(({ item }) => item));
|
|
1270
1271
|
};
|
|
1271
|
-
const [openItemIndex, setOpenItemIndex] =
|
|
1272
|
-
const [rowRef, setRowRef] =
|
|
1272
|
+
const [openItemIndex, setOpenItemIndex] = useState6(EMPTY_OPEN_ITEM);
|
|
1273
|
+
const [rowRef, setRowRef] = useState6(null);
|
|
1273
1274
|
const isOpen = openItemIndex !== EMPTY_OPEN_ITEM;
|
|
1274
1275
|
const popoverState = usePopupState3({ variant: "popover" });
|
|
1275
1276
|
const addItem = (ev, config) => {
|
|
@@ -2126,7 +2127,7 @@ function ensureFilterConfig(name) {
|
|
|
2126
2127
|
|
|
2127
2128
|
// src/controls/select-control-wrapper.tsx
|
|
2128
2129
|
import * as React49 from "react";
|
|
2129
|
-
import { useEffect as useEffect4, useState as
|
|
2130
|
+
import { useEffect as useEffect4, useState as useState7 } from "react";
|
|
2130
2131
|
var getOffCanvasElements = () => {
|
|
2131
2132
|
const extendedWindow = window;
|
|
2132
2133
|
const documentId = extendedWindow.elementor.config.document.id;
|
|
@@ -2144,7 +2145,7 @@ var collectionMethods = {
|
|
|
2144
2145
|
"off-canvas": getOffCanvasElements
|
|
2145
2146
|
};
|
|
2146
2147
|
var useDynamicOptions = (collectionId, initialOptions) => {
|
|
2147
|
-
const [options, setOptions] =
|
|
2148
|
+
const [options, setOptions] = useState7(initialOptions ?? []);
|
|
2148
2149
|
useEffect4(() => {
|
|
2149
2150
|
if (!collectionId || !collectionMethods[collectionId]) {
|
|
2150
2151
|
setOptions(initialOptions ?? []);
|
|
@@ -2167,7 +2168,7 @@ import { stringPropTypeUtil as stringPropTypeUtil4 } from "@elementor/editor-pro
|
|
|
2167
2168
|
|
|
2168
2169
|
// src/components/control-toggle-button-group.tsx
|
|
2169
2170
|
import * as React51 from "react";
|
|
2170
|
-
import { useEffect as useEffect5, useMemo as useMemo4, useRef as useRef7, useState as
|
|
2171
|
+
import { useEffect as useEffect5, useMemo as useMemo4, useRef as useRef7, useState as useState8 } from "react";
|
|
2171
2172
|
import { ChevronDownIcon } from "@elementor/icons";
|
|
2172
2173
|
import {
|
|
2173
2174
|
ListItemText,
|
|
@@ -2320,7 +2321,7 @@ var SplitButtonGroup = ({
|
|
|
2320
2321
|
value
|
|
2321
2322
|
}) => {
|
|
2322
2323
|
const previewButton = usePreviewButton(items2, value);
|
|
2323
|
-
const [isMenuOpen, setIsMenuOpen] =
|
|
2324
|
+
const [isMenuOpen, setIsMenuOpen] = useState8(false);
|
|
2324
2325
|
const menuButtonRef = useRef7(null);
|
|
2325
2326
|
const onMenuToggle = (ev) => {
|
|
2326
2327
|
setIsMenuOpen((prev) => !prev);
|
|
@@ -2390,7 +2391,7 @@ var SplitButtonGroup = ({
|
|
|
2390
2391
|
));
|
|
2391
2392
|
};
|
|
2392
2393
|
var usePreviewButton = (items2, value) => {
|
|
2393
|
-
const [previewButton, setPreviewButton] =
|
|
2394
|
+
const [previewButton, setPreviewButton] = useState8(
|
|
2394
2395
|
items2.find((item) => item.value === value) ?? items2[0]
|
|
2395
2396
|
);
|
|
2396
2397
|
useEffect5(() => {
|
|
@@ -2799,7 +2800,7 @@ import { __ as __20 } from "@wordpress/i18n";
|
|
|
2799
2800
|
|
|
2800
2801
|
// src/components/item-selector.tsx
|
|
2801
2802
|
import * as React58 from "react";
|
|
2802
|
-
import { useCallback, useEffect as useEffect6, useState as
|
|
2803
|
+
import { useCallback, useEffect as useEffect6, useState as useState9 } from "react";
|
|
2803
2804
|
import { PopoverBody, PopoverHeader as PopoverHeader2, PopoverMenuList, SearchField } from "@elementor/editor-ui";
|
|
2804
2805
|
import { Box as Box7, Divider as Divider2, Link, Stack as Stack9, Typography as Typography4 } from "@elementor/ui";
|
|
2805
2806
|
import { debounce } from "@elementor/utils";
|
|
@@ -2836,7 +2837,7 @@ var ItemSelector = ({
|
|
|
2836
2837
|
disabledItems,
|
|
2837
2838
|
id = "item-selector"
|
|
2838
2839
|
}) => {
|
|
2839
|
-
const [searchValue, setSearchValue] =
|
|
2840
|
+
const [searchValue, setSearchValue] = useState9("");
|
|
2840
2841
|
const filteredItemsList = useFilteredItemsList(itemsList, searchValue, disabledItems);
|
|
2841
2842
|
const IconComponent = icon;
|
|
2842
2843
|
const handleSearch = (value) => {
|
|
@@ -2948,7 +2949,7 @@ var ItemList = ({
|
|
|
2948
2949
|
);
|
|
2949
2950
|
};
|
|
2950
2951
|
var useDebounce = (fn, delay) => {
|
|
2951
|
-
const [debouncedFn] =
|
|
2952
|
+
const [debouncedFn] = useState9(() => debounce(fn, delay));
|
|
2952
2953
|
useEffect6(() => () => debouncedFn.cancel(), [debouncedFn]);
|
|
2953
2954
|
return debouncedFn;
|
|
2954
2955
|
};
|
|
@@ -3050,7 +3051,7 @@ var UrlControl = createControl(
|
|
|
3050
3051
|
|
|
3051
3052
|
// src/controls/link-control.tsx
|
|
3052
3053
|
import * as React65 from "react";
|
|
3053
|
-
import { useState as
|
|
3054
|
+
import { useState as useState11 } from "react";
|
|
3054
3055
|
import { getLinkInLinkRestriction } from "@elementor/editor-elements";
|
|
3055
3056
|
import { linkPropTypeUtil } from "@elementor/editor-props";
|
|
3056
3057
|
import { MinusIcon, PlusIcon as PlusIcon2 } from "@elementor/icons";
|
|
@@ -3119,7 +3120,7 @@ var RestrictedLinkInfotip = ({
|
|
|
3119
3120
|
|
|
3120
3121
|
// src/controls/query-control.tsx
|
|
3121
3122
|
import * as React63 from "react";
|
|
3122
|
-
import { useMemo as useMemo6, useState as
|
|
3123
|
+
import { useMemo as useMemo6, useState as useState10 } from "react";
|
|
3123
3124
|
import { numberPropTypeUtil as numberPropTypeUtil2, stringPropTypeUtil as stringPropTypeUtil6, urlPropTypeUtil as urlPropTypeUtil2 } from "@elementor/editor-props";
|
|
3124
3125
|
import { httpService as httpService2 } from "@elementor/http-client";
|
|
3125
3126
|
import { SearchIcon } from "@elementor/icons";
|
|
@@ -3268,7 +3269,7 @@ var QueryControl = createControl((props) => {
|
|
|
3268
3269
|
ariaLabel
|
|
3269
3270
|
} = props || {};
|
|
3270
3271
|
const normalizedPlaceholder = placeholder || __22("Search", "elementor");
|
|
3271
|
-
const [options, setOptions] =
|
|
3272
|
+
const [options, setOptions] = useState10(
|
|
3272
3273
|
generateFirstLoadedOption(value?.value)
|
|
3273
3274
|
);
|
|
3274
3275
|
const onOptionChange = (newValue) => {
|
|
@@ -3390,7 +3391,7 @@ var SIZE6 = "tiny";
|
|
|
3390
3391
|
var LinkControl = createControl((props) => {
|
|
3391
3392
|
const { value, path, setValue, ...propContext } = useBoundProp(linkPropTypeUtil);
|
|
3392
3393
|
const [linkSessionValue, setLinkSessionValue] = useSessionStorage(path.join("/"));
|
|
3393
|
-
const [isActive, setIsActive] =
|
|
3394
|
+
const [isActive, setIsActive] = useState11(!!value);
|
|
3394
3395
|
const {
|
|
3395
3396
|
allowCustomValues = true,
|
|
3396
3397
|
queryOptions,
|
|
@@ -3400,7 +3401,7 @@ var LinkControl = createControl((props) => {
|
|
|
3400
3401
|
label = __23("Link", "elementor"),
|
|
3401
3402
|
ariaLabel
|
|
3402
3403
|
} = props || {};
|
|
3403
|
-
const [linkInLinkRestriction, setLinkInLinkRestriction] =
|
|
3404
|
+
const [linkInLinkRestriction, setLinkInLinkRestriction] = useState11(getLinkInLinkRestriction(elementId));
|
|
3404
3405
|
const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
|
|
3405
3406
|
const onEnabledChange = () => {
|
|
3406
3407
|
setLinkInLinkRestriction(getLinkInLinkRestriction(elementId));
|
|
@@ -3622,7 +3623,7 @@ var Control4 = ({
|
|
|
3622
3623
|
|
|
3623
3624
|
// src/controls/aspect-ratio-control.tsx
|
|
3624
3625
|
import * as React69 from "react";
|
|
3625
|
-
import { useEffect as useEffect7, useState as
|
|
3626
|
+
import { useEffect as useEffect7, useState as useState12 } from "react";
|
|
3626
3627
|
import { stringPropTypeUtil as stringPropTypeUtil8 } from "@elementor/editor-props";
|
|
3627
3628
|
import { MenuListItem as MenuListItem4 } from "@elementor/editor-ui";
|
|
3628
3629
|
import { ArrowsMoveHorizontalIcon, ArrowsMoveVerticalIcon } from "@elementor/icons";
|
|
@@ -3643,10 +3644,10 @@ var AspectRatioControl = createControl(({ label }) => {
|
|
|
3643
3644
|
const { value: aspectRatioValue, setValue: setAspectRatioValue, disabled } = useBoundProp(stringPropTypeUtil8);
|
|
3644
3645
|
const isCustomSelected = aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue);
|
|
3645
3646
|
const [initialWidth, initialHeight] = isCustomSelected ? aspectRatioValue.split("/") : ["", ""];
|
|
3646
|
-
const [isCustom, setIsCustom] =
|
|
3647
|
-
const [customWidth, setCustomWidth] =
|
|
3648
|
-
const [customHeight, setCustomHeight] =
|
|
3649
|
-
const [selectedValue, setSelectedValue] =
|
|
3647
|
+
const [isCustom, setIsCustom] = useState12(isCustomSelected);
|
|
3648
|
+
const [customWidth, setCustomWidth] = useState12(initialWidth);
|
|
3649
|
+
const [customHeight, setCustomHeight] = useState12(initialHeight);
|
|
3650
|
+
const [selectedValue, setSelectedValue] = useState12(
|
|
3650
3651
|
isCustomSelected ? CUSTOM_RATIO : aspectRatioValue || ""
|
|
3651
3652
|
);
|
|
3652
3653
|
useEffect7(() => {
|
|
@@ -3733,7 +3734,7 @@ var AspectRatioControl = createControl(({ label }) => {
|
|
|
3733
3734
|
|
|
3734
3735
|
// src/controls/svg-media-control.tsx
|
|
3735
3736
|
import * as React71 from "react";
|
|
3736
|
-
import { useState as
|
|
3737
|
+
import { useState as useState14 } from "react";
|
|
3737
3738
|
import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
|
|
3738
3739
|
import { imageSrcPropTypeUtil as imageSrcPropTypeUtil2 } from "@elementor/editor-props";
|
|
3739
3740
|
import { UploadIcon as UploadIcon2 } from "@elementor/icons";
|
|
@@ -3743,7 +3744,7 @@ import { __ as __28 } from "@wordpress/i18n";
|
|
|
3743
3744
|
|
|
3744
3745
|
// src/components/enable-unfiltered-modal.tsx
|
|
3745
3746
|
import * as React70 from "react";
|
|
3746
|
-
import { useState as
|
|
3747
|
+
import { useState as useState13 } from "react";
|
|
3747
3748
|
import {
|
|
3748
3749
|
Button as Button3,
|
|
3749
3750
|
CircularProgress as CircularProgress2,
|
|
@@ -3769,7 +3770,7 @@ var ADMIN_FAILED_CONTENT_TEXT_PT2 = __27(
|
|
|
3769
3770
|
var WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
|
|
3770
3771
|
var EnableUnfilteredModal = (props) => {
|
|
3771
3772
|
const { mutateAsync, isPending } = useUpdateUnfilteredFilesUpload();
|
|
3772
|
-
const [isError, setIsError] =
|
|
3773
|
+
const [isError, setIsError] = useState13(false);
|
|
3773
3774
|
const onClose = (enabled) => {
|
|
3774
3775
|
props.onClose(enabled);
|
|
3775
3776
|
setTimeout(() => setIsError(false), WAIT_FOR_CLOSE_TIMEOUT_MS);
|
|
@@ -3832,7 +3833,7 @@ var SvgMediaControl = createControl(() => {
|
|
|
3832
3833
|
const { data: attachment, isFetching } = useWpMediaAttachment2(id?.value || null);
|
|
3833
3834
|
const src = attachment?.url ?? url?.value ?? null;
|
|
3834
3835
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
3835
|
-
const [unfilteredModalOpenState, setUnfilteredModalOpenState] =
|
|
3836
|
+
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = useState14(false);
|
|
3836
3837
|
const { canUser } = useCurrentUserCapabilities();
|
|
3837
3838
|
const canManageOptions = canUser("manage_options");
|
|
3838
3839
|
const { open } = useWpMediaFrame2({
|
|
@@ -4629,7 +4630,7 @@ var getAllProperties = (pattern) => {
|
|
|
4629
4630
|
|
|
4630
4631
|
// src/controls/key-value-control.tsx
|
|
4631
4632
|
import * as React80 from "react";
|
|
4632
|
-
import { useMemo as useMemo8, useState as
|
|
4633
|
+
import { useMemo as useMemo8, useState as useState15 } from "react";
|
|
4633
4634
|
import {
|
|
4634
4635
|
isTransformable,
|
|
4635
4636
|
keyValuePropTypeUtil,
|
|
@@ -4653,9 +4654,9 @@ var escapeHtmlAttr = (value) => {
|
|
|
4653
4654
|
// src/controls/key-value-control.tsx
|
|
4654
4655
|
var KeyValueControl = createControl((props = {}) => {
|
|
4655
4656
|
const { value, setValue, ...propContext } = useBoundProp(keyValuePropTypeUtil);
|
|
4656
|
-
const [keyError, setKeyError] =
|
|
4657
|
-
const [valueError, setValueError] =
|
|
4658
|
-
const [sessionState, setSessionState] =
|
|
4657
|
+
const [keyError, setKeyError] = useState15("");
|
|
4658
|
+
const [valueError, setValueError] = useState15("");
|
|
4659
|
+
const [sessionState, setSessionState] = useState15({
|
|
4659
4660
|
key: value?.key?.value || "",
|
|
4660
4661
|
value: value?.value?.value || ""
|
|
4661
4662
|
});
|
|
@@ -5388,7 +5389,7 @@ var TransformBasePopoverTrigger = ({
|
|
|
5388
5389
|
|
|
5389
5390
|
// src/controls/transition-control/transition-repeater-control.tsx
|
|
5390
5391
|
import * as React97 from "react";
|
|
5391
|
-
import { useEffect as useEffect8, useMemo as useMemo10, useState as
|
|
5392
|
+
import { useEffect as useEffect8, useMemo as useMemo10, useState as useState16 } from "react";
|
|
5392
5393
|
import { createArrayPropUtils as createArrayPropUtils2, selectionSizePropTypeUtil as selectionSizePropTypeUtil2 } from "@elementor/editor-props";
|
|
5393
5394
|
import { InfoCircleFilledIcon as InfoCircleFilledIcon3 } from "@elementor/icons";
|
|
5394
5395
|
import { Alert as Alert2, AlertTitle as AlertTitle3, Box as Box19, Typography as Typography7 } from "@elementor/ui";
|
|
@@ -5658,7 +5659,7 @@ var TransitionRepeaterControl = createControl(
|
|
|
5658
5659
|
currentStyleState
|
|
5659
5660
|
}) => {
|
|
5660
5661
|
const currentStyleIsNormal = currentStyleState === null;
|
|
5661
|
-
const [recentlyUsedList, setRecentlyUsedList] =
|
|
5662
|
+
const [recentlyUsedList, setRecentlyUsedList] = useState16([]);
|
|
5662
5663
|
const childArrayPropTypeUtil = useMemo10(
|
|
5663
5664
|
() => createArrayPropUtils2(selectionSizePropTypeUtil2.key, selectionSizePropTypeUtil2.schema, "transition"),
|
|
5664
5665
|
[]
|
|
@@ -5877,7 +5878,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
|
|
|
5877
5878
|
|
|
5878
5879
|
// src/components/repeater/repeater.tsx
|
|
5879
5880
|
import * as React102 from "react";
|
|
5880
|
-
import { useEffect as useEffect9, useState as
|
|
5881
|
+
import { useEffect as useEffect9, useState as useState17 } from "react";
|
|
5881
5882
|
import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon3, XIcon as XIcon4 } from "@elementor/icons";
|
|
5882
5883
|
import {
|
|
5883
5884
|
bindPopover as bindPopover7,
|
|
@@ -5902,14 +5903,14 @@ var Repeater3 = ({
|
|
|
5902
5903
|
showToggle = true,
|
|
5903
5904
|
isSortable = true
|
|
5904
5905
|
}) => {
|
|
5905
|
-
const [openItem, setOpenItem] =
|
|
5906
|
+
const [openItem, setOpenItem] = useState17(EMPTY_OPEN_ITEM2);
|
|
5906
5907
|
const [items2, setItems] = useSyncExternalState({
|
|
5907
5908
|
external: repeaterValues,
|
|
5908
5909
|
// @ts-expect-error - as long as persistWhen => true, value will never be null
|
|
5909
5910
|
setExternal: setRepeaterValues,
|
|
5910
5911
|
persistWhen: () => true
|
|
5911
5912
|
});
|
|
5912
|
-
const [uniqueKeys, setUniqueKeys] =
|
|
5913
|
+
const [uniqueKeys, setUniqueKeys] = useState17(items2.map((_, index) => index));
|
|
5913
5914
|
const generateNextKey = (source) => {
|
|
5914
5915
|
return 1 + Math.max(0, ...source);
|
|
5915
5916
|
};
|
|
@@ -6055,7 +6056,7 @@ var RepeaterItem = ({
|
|
|
6055
6056
|
), /* @__PURE__ */ React102.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React102.createElement(Box22, null, children({ anchorEl: ref }))));
|
|
6056
6057
|
};
|
|
6057
6058
|
var usePopover = (openOnMount, onOpen) => {
|
|
6058
|
-
const [ref, setRef] =
|
|
6059
|
+
const [ref, setRef] = useState17(null);
|
|
6059
6060
|
const popoverState = usePopupState8({ variant: "popover" });
|
|
6060
6061
|
const popoverProps = bindPopover7(popoverState);
|
|
6061
6062
|
useEffect9(() => {
|