@elementor/editor-controls 3.33.0-243 → 3.33.0-245

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.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, useState as useState5 } from "react";
526
+ import { useEffect as useEffect3 } 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,13 +946,12 @@ 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));
950
949
  const activeBreakpoint = useActiveBreakpoint();
951
950
  const actualUnits = resolveUnits(propType, enablePropTypeUnits, variant, units2);
952
951
  const actualExtendedOptions = useSizeExtendedOptions(extendedOptions || [], disableCustom ?? false);
953
952
  const popupState = usePopupState2({ variant: "popover" });
954
953
  const [state, setState] = useSyncExternalState({
955
- external: internalState,
954
+ external: createStateFromSizeProp(sizeValue, actualDefaultUnit),
956
955
  setExternal: (newState, options, meta) => setSizeValue(extractValueFromState(newState), options, meta),
957
956
  persistWhen: (newState) => !!extractValueFromState(newState),
958
957
  fallback: (newState) => ({
@@ -1007,7 +1006,7 @@ var SizeControl = createControl(
1007
1006
  return;
1008
1007
  }
1009
1008
  if (state.unit === newState.unit) {
1010
- setInternalState(mergedStates);
1009
+ setState(mergedStates);
1011
1010
  return;
1012
1011
  }
1013
1012
  setState(newState);
@@ -1189,7 +1188,7 @@ import { __ as __5, sprintf } from "@wordpress/i18n";
1189
1188
 
1190
1189
  // src/components/control-repeater/context/repeater-context.tsx
1191
1190
  import * as React22 from "react";
1192
- import { createContext as createContext7, useMemo as useMemo2, useState as useState6 } from "react";
1191
+ import { createContext as createContext7, useMemo as useMemo2, useState as useState5 } from "react";
1193
1192
  import { usePopupState as usePopupState3 } from "@elementor/ui";
1194
1193
 
1195
1194
  // src/services/event-bus.ts
@@ -1256,7 +1255,7 @@ var RepeaterContextProvider = ({
1256
1255
  setExternal: setRepeaterValues,
1257
1256
  persistWhen: () => true
1258
1257
  });
1259
- const [uniqueKeys, setUniqueKeys] = useState6(() => {
1258
+ const [uniqueKeys, setUniqueKeys] = useState5(() => {
1260
1259
  return items2?.map((_, index) => index) ?? [];
1261
1260
  });
1262
1261
  const itemsWithKeys = useMemo2(
@@ -1269,8 +1268,8 @@ var RepeaterContextProvider = ({
1269
1268
  const handleSetItems = (newItemsWithKeys) => {
1270
1269
  setItems(newItemsWithKeys.map(({ item }) => item));
1271
1270
  };
1272
- const [openItemIndex, setOpenItemIndex] = useState6(EMPTY_OPEN_ITEM);
1273
- const [rowRef, setRowRef] = useState6(null);
1271
+ const [openItemIndex, setOpenItemIndex] = useState5(EMPTY_OPEN_ITEM);
1272
+ const [rowRef, setRowRef] = useState5(null);
1274
1273
  const isOpen = openItemIndex !== EMPTY_OPEN_ITEM;
1275
1274
  const popoverState = usePopupState3({ variant: "popover" });
1276
1275
  const addItem = (ev, config) => {
@@ -2107,7 +2106,7 @@ function ensureFilterConfig(name) {
2107
2106
 
2108
2107
  // src/controls/select-control-wrapper.tsx
2109
2108
  import * as React47 from "react";
2110
- import { useEffect as useEffect4, useState as useState7 } from "react";
2109
+ import { useEffect as useEffect4, useState as useState6 } from "react";
2111
2110
  var getOffCanvasElements = () => {
2112
2111
  const extendedWindow = window;
2113
2112
  const documentId = extendedWindow.elementor.config.document.id;
@@ -2125,7 +2124,7 @@ var collectionMethods = {
2125
2124
  "off-canvas": getOffCanvasElements
2126
2125
  };
2127
2126
  var useDynamicOptions = (collectionId, initialOptions) => {
2128
- const [options, setOptions] = useState7(initialOptions ?? []);
2127
+ const [options, setOptions] = useState6(initialOptions ?? []);
2129
2128
  useEffect4(() => {
2130
2129
  if (!collectionId || !collectionMethods[collectionId]) {
2131
2130
  setOptions(initialOptions ?? []);
@@ -2148,7 +2147,7 @@ import { stringPropTypeUtil as stringPropTypeUtil4 } from "@elementor/editor-pro
2148
2147
 
2149
2148
  // src/components/control-toggle-button-group.tsx
2150
2149
  import * as React49 from "react";
2151
- import { useEffect as useEffect5, useMemo as useMemo4, useRef as useRef7, useState as useState8 } from "react";
2150
+ import { useEffect as useEffect5, useMemo as useMemo4, useRef as useRef7, useState as useState7 } from "react";
2152
2151
  import { ChevronDownIcon } from "@elementor/icons";
2153
2152
  import {
2154
2153
  ListItemText,
@@ -2301,7 +2300,7 @@ var SplitButtonGroup = ({
2301
2300
  value
2302
2301
  }) => {
2303
2302
  const previewButton = usePreviewButton(items2, value);
2304
- const [isMenuOpen, setIsMenuOpen] = useState8(false);
2303
+ const [isMenuOpen, setIsMenuOpen] = useState7(false);
2305
2304
  const menuButtonRef = useRef7(null);
2306
2305
  const onMenuToggle = (ev) => {
2307
2306
  setIsMenuOpen((prev) => !prev);
@@ -2371,7 +2370,7 @@ var SplitButtonGroup = ({
2371
2370
  ));
2372
2371
  };
2373
2372
  var usePreviewButton = (items2, value) => {
2374
- const [previewButton, setPreviewButton] = useState8(
2373
+ const [previewButton, setPreviewButton] = useState7(
2375
2374
  items2.find((item) => item.value === value) ?? items2[0]
2376
2375
  );
2377
2376
  useEffect5(() => {
@@ -2780,7 +2779,7 @@ import { __ as __20 } from "@wordpress/i18n";
2780
2779
 
2781
2780
  // src/components/item-selector.tsx
2782
2781
  import * as React56 from "react";
2783
- import { useCallback, useEffect as useEffect6, useState as useState9 } from "react";
2782
+ import { useCallback, useEffect as useEffect6, useState as useState8 } from "react";
2784
2783
  import { PopoverBody, PopoverHeader as PopoverHeader2, PopoverMenuList, SearchField } from "@elementor/editor-ui";
2785
2784
  import { Box as Box7, Divider as Divider2, Link, Stack as Stack9, Typography as Typography4 } from "@elementor/ui";
2786
2785
  import { debounce } from "@elementor/utils";
@@ -2817,7 +2816,7 @@ var ItemSelector = ({
2817
2816
  disabledItems,
2818
2817
  id = "item-selector"
2819
2818
  }) => {
2820
- const [searchValue, setSearchValue] = useState9("");
2819
+ const [searchValue, setSearchValue] = useState8("");
2821
2820
  const filteredItemsList = useFilteredItemsList(itemsList, searchValue, disabledItems);
2822
2821
  const IconComponent = icon;
2823
2822
  const handleSearch = (value) => {
@@ -2929,7 +2928,7 @@ var ItemList = ({
2929
2928
  );
2930
2929
  };
2931
2930
  var useDebounce = (fn, delay) => {
2932
- const [debouncedFn] = useState9(() => debounce(fn, delay));
2931
+ const [debouncedFn] = useState8(() => debounce(fn, delay));
2933
2932
  useEffect6(() => () => debouncedFn.cancel(), [debouncedFn]);
2934
2933
  return debouncedFn;
2935
2934
  };
@@ -3031,7 +3030,7 @@ var UrlControl = createControl(
3031
3030
 
3032
3031
  // src/controls/link-control.tsx
3033
3032
  import * as React63 from "react";
3034
- import { useState as useState11 } from "react";
3033
+ import { useState as useState10 } from "react";
3035
3034
  import { getLinkInLinkRestriction } from "@elementor/editor-elements";
3036
3035
  import { linkPropTypeUtil } from "@elementor/editor-props";
3037
3036
  import { MinusIcon, PlusIcon as PlusIcon2 } from "@elementor/icons";
@@ -3100,7 +3099,7 @@ var RestrictedLinkInfotip = ({
3100
3099
 
3101
3100
  // src/controls/query-control.tsx
3102
3101
  import * as React61 from "react";
3103
- import { useMemo as useMemo6, useState as useState10 } from "react";
3102
+ import { useMemo as useMemo6, useState as useState9 } from "react";
3104
3103
  import { numberPropTypeUtil as numberPropTypeUtil2, stringPropTypeUtil as stringPropTypeUtil6, urlPropTypeUtil as urlPropTypeUtil2 } from "@elementor/editor-props";
3105
3104
  import { httpService as httpService2 } from "@elementor/http-client";
3106
3105
  import { SearchIcon } from "@elementor/icons";
@@ -3249,7 +3248,7 @@ var QueryControl = createControl((props) => {
3249
3248
  ariaLabel
3250
3249
  } = props || {};
3251
3250
  const normalizedPlaceholder = placeholder || __22("Search", "elementor");
3252
- const [options, setOptions] = useState10(
3251
+ const [options, setOptions] = useState9(
3253
3252
  generateFirstLoadedOption(value?.value)
3254
3253
  );
3255
3254
  const onOptionChange = (newValue) => {
@@ -3371,7 +3370,7 @@ var SIZE6 = "tiny";
3371
3370
  var LinkControl = createControl((props) => {
3372
3371
  const { value, path, setValue, ...propContext } = useBoundProp(linkPropTypeUtil);
3373
3372
  const [linkSessionValue, setLinkSessionValue] = useSessionStorage(path.join("/"));
3374
- const [isActive, setIsActive] = useState11(!!value);
3373
+ const [isActive, setIsActive] = useState10(!!value);
3375
3374
  const {
3376
3375
  allowCustomValues = true,
3377
3376
  queryOptions,
@@ -3381,7 +3380,7 @@ var LinkControl = createControl((props) => {
3381
3380
  label = __23("Link", "elementor"),
3382
3381
  ariaLabel
3383
3382
  } = props || {};
3384
- const [linkInLinkRestriction, setLinkInLinkRestriction] = useState11(getLinkInLinkRestriction(elementId));
3383
+ const [linkInLinkRestriction, setLinkInLinkRestriction] = useState10(getLinkInLinkRestriction(elementId));
3385
3384
  const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
3386
3385
  const onEnabledChange = () => {
3387
3386
  setLinkInLinkRestriction(getLinkInLinkRestriction(elementId));
@@ -3603,7 +3602,7 @@ var Control4 = ({
3603
3602
 
3604
3603
  // src/controls/aspect-ratio-control.tsx
3605
3604
  import * as React67 from "react";
3606
- import { useEffect as useEffect7, useState as useState12 } from "react";
3605
+ import { useEffect as useEffect7, useState as useState11 } from "react";
3607
3606
  import { stringPropTypeUtil as stringPropTypeUtil8 } from "@elementor/editor-props";
3608
3607
  import { MenuListItem as MenuListItem4 } from "@elementor/editor-ui";
3609
3608
  import { ArrowsMoveHorizontalIcon, ArrowsMoveVerticalIcon } from "@elementor/icons";
@@ -3624,10 +3623,10 @@ var AspectRatioControl = createControl(({ label }) => {
3624
3623
  const { value: aspectRatioValue, setValue: setAspectRatioValue, disabled } = useBoundProp(stringPropTypeUtil8);
3625
3624
  const isCustomSelected = aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue);
3626
3625
  const [initialWidth, initialHeight] = isCustomSelected ? aspectRatioValue.split("/") : ["", ""];
3627
- const [isCustom, setIsCustom] = useState12(isCustomSelected);
3628
- const [customWidth, setCustomWidth] = useState12(initialWidth);
3629
- const [customHeight, setCustomHeight] = useState12(initialHeight);
3630
- const [selectedValue, setSelectedValue] = useState12(
3626
+ const [isCustom, setIsCustom] = useState11(isCustomSelected);
3627
+ const [customWidth, setCustomWidth] = useState11(initialWidth);
3628
+ const [customHeight, setCustomHeight] = useState11(initialHeight);
3629
+ const [selectedValue, setSelectedValue] = useState11(
3631
3630
  isCustomSelected ? CUSTOM_RATIO : aspectRatioValue || ""
3632
3631
  );
3633
3632
  useEffect7(() => {
@@ -3714,7 +3713,7 @@ var AspectRatioControl = createControl(({ label }) => {
3714
3713
 
3715
3714
  // src/controls/svg-media-control.tsx
3716
3715
  import * as React69 from "react";
3717
- import { useState as useState14 } from "react";
3716
+ import { useState as useState13 } from "react";
3718
3717
  import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
3719
3718
  import { imageSrcPropTypeUtil as imageSrcPropTypeUtil2 } from "@elementor/editor-props";
3720
3719
  import { UploadIcon as UploadIcon2 } from "@elementor/icons";
@@ -3724,7 +3723,7 @@ import { __ as __28 } from "@wordpress/i18n";
3724
3723
 
3725
3724
  // src/components/enable-unfiltered-modal.tsx
3726
3725
  import * as React68 from "react";
3727
- import { useState as useState13 } from "react";
3726
+ import { useState as useState12 } from "react";
3728
3727
  import {
3729
3728
  Button as Button3,
3730
3729
  CircularProgress as CircularProgress2,
@@ -3750,7 +3749,7 @@ var ADMIN_FAILED_CONTENT_TEXT_PT2 = __27(
3750
3749
  var WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
3751
3750
  var EnableUnfilteredModal = (props) => {
3752
3751
  const { mutateAsync, isPending } = useUpdateUnfilteredFilesUpload();
3753
- const [isError, setIsError] = useState13(false);
3752
+ const [isError, setIsError] = useState12(false);
3754
3753
  const onClose = (enabled) => {
3755
3754
  props.onClose(enabled);
3756
3755
  setTimeout(() => setIsError(false), WAIT_FOR_CLOSE_TIMEOUT_MS);
@@ -3813,7 +3812,7 @@ var SvgMediaControl = createControl(() => {
3813
3812
  const { data: attachment, isFetching } = useWpMediaAttachment2(id?.value || null);
3814
3813
  const src = attachment?.url ?? url?.value ?? null;
3815
3814
  const { data: allowSvgUpload } = useUnfilteredFilesUpload();
3816
- const [unfilteredModalOpenState, setUnfilteredModalOpenState] = useState14(false);
3815
+ const [unfilteredModalOpenState, setUnfilteredModalOpenState] = useState13(false);
3817
3816
  const { canUser } = useCurrentUserCapabilities();
3818
3817
  const canManageOptions = canUser("manage_options");
3819
3818
  const { open } = useWpMediaFrame2({
@@ -4610,7 +4609,7 @@ var getAllProperties = (pattern) => {
4610
4609
 
4611
4610
  // src/controls/key-value-control.tsx
4612
4611
  import * as React78 from "react";
4613
- import { useMemo as useMemo8, useState as useState15 } from "react";
4612
+ import { useMemo as useMemo8, useState as useState14 } from "react";
4614
4613
  import {
4615
4614
  isTransformable,
4616
4615
  keyValuePropTypeUtil,
@@ -4634,9 +4633,9 @@ var escapeHtmlAttr = (value) => {
4634
4633
  // src/controls/key-value-control.tsx
4635
4634
  var KeyValueControl = createControl((props = {}) => {
4636
4635
  const { value, setValue, ...propContext } = useBoundProp(keyValuePropTypeUtil);
4637
- const [keyError, setKeyError] = useState15("");
4638
- const [valueError, setValueError] = useState15("");
4639
- const [sessionState, setSessionState] = useState15({
4636
+ const [keyError, setKeyError] = useState14("");
4637
+ const [valueError, setValueError] = useState14("");
4638
+ const [sessionState, setSessionState] = useState14({
4640
4639
  key: value?.key?.value || "",
4641
4640
  value: value?.value?.value || ""
4642
4641
  });
@@ -5369,7 +5368,7 @@ var TransformBasePopoverTrigger = ({
5369
5368
 
5370
5369
  // src/controls/transition-control/transition-repeater-control.tsx
5371
5370
  import * as React95 from "react";
5372
- import { useEffect as useEffect8, useMemo as useMemo10, useState as useState16 } from "react";
5371
+ import { useEffect as useEffect8, useMemo as useMemo10, useState as useState15 } from "react";
5373
5372
  import { createArrayPropUtils as createArrayPropUtils2, selectionSizePropTypeUtil as selectionSizePropTypeUtil2 } from "@elementor/editor-props";
5374
5373
  import { InfoCircleFilledIcon as InfoCircleFilledIcon3 } from "@elementor/icons";
5375
5374
  import { Alert as Alert2, AlertTitle as AlertTitle3, Box as Box19, Typography as Typography7 } from "@elementor/ui";
@@ -5639,7 +5638,7 @@ var TransitionRepeaterControl = createControl(
5639
5638
  currentStyleState
5640
5639
  }) => {
5641
5640
  const currentStyleIsNormal = currentStyleState === null;
5642
- const [recentlyUsedList, setRecentlyUsedList] = useState16([]);
5641
+ const [recentlyUsedList, setRecentlyUsedList] = useState15([]);
5643
5642
  const childArrayPropTypeUtil = useMemo10(
5644
5643
  () => createArrayPropUtils2(selectionSizePropTypeUtil2.key, selectionSizePropTypeUtil2.schema, "transition"),
5645
5644
  []
@@ -5858,7 +5857,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
5858
5857
 
5859
5858
  // src/components/repeater.tsx
5860
5859
  import * as React100 from "react";
5861
- import { useEffect as useEffect9, useState as useState17 } from "react";
5860
+ import { useEffect as useEffect9, useState as useState16 } from "react";
5862
5861
  import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon3, XIcon as XIcon4 } from "@elementor/icons";
5863
5862
  import {
5864
5863
  bindPopover as bindPopover7,
@@ -5888,14 +5887,14 @@ var Repeater3 = ({
5888
5887
  isSortable = true,
5889
5888
  collectionPropUtil
5890
5889
  }) => {
5891
- const [openItem, setOpenItem] = useState17(EMPTY_OPEN_ITEM2);
5890
+ const [openItem, setOpenItem] = useState16(EMPTY_OPEN_ITEM2);
5892
5891
  const [items2, setItems] = useSyncExternalState({
5893
5892
  external: repeaterValues,
5894
5893
  // @ts-expect-error - as long as persistWhen => true, value will never be null
5895
5894
  setExternal: setRepeaterValues,
5896
5895
  persistWhen: () => true
5897
5896
  });
5898
- const [uniqueKeys, setUniqueKeys] = useState17(items2.map((_, index) => index));
5897
+ const [uniqueKeys, setUniqueKeys] = useState16(items2.map((_, index) => index));
5899
5898
  const generateNextKey = (source) => {
5900
5899
  return 1 + Math.max(0, ...source);
5901
5900
  };
@@ -6037,7 +6036,7 @@ var RepeaterItem = ({
6037
6036
  disabled,
6038
6037
  collectionPropUtil
6039
6038
  }) => {
6040
- const [anchorEl, setAnchorEl] = useState17(null);
6039
+ const [anchorEl, setAnchorEl] = useState16(null);
6041
6040
  const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, onOpen);
6042
6041
  const duplicateLabel = __50("Duplicate", "elementor");
6043
6042
  const toggleLabel = propDisabled ? __50("Show", "elementor") : __50("Hide", "elementor");
@@ -6074,7 +6073,7 @@ var RepeaterItem = ({
6074
6073
  ));
6075
6074
  };
6076
6075
  var usePopover = (openOnMount, onOpen) => {
6077
- const [ref, setRef] = useState17(null);
6076
+ const [ref, setRef] = useState16(null);
6078
6077
  const popoverState = usePopupState8({ variant: "popover" });
6079
6078
  const popoverProps = bindPopover7(popoverState);
6080
6079
  useEffect9(() => {