@elementor/editor-controls 3.35.0-469 → 3.35.0-470

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
@@ -1265,8 +1265,21 @@ var RepeaterContextProvider = ({
1265
1265
  persistWhen: () => true
1266
1266
  });
1267
1267
  const [uniqueKeys, setUniqueKeys] = useState5(() => {
1268
- return items2?.map((_, index) => index) ?? [];
1268
+ return items2?.map(() => generateUniqueKey()) ?? [];
1269
1269
  });
1270
+ React25.useEffect(() => {
1271
+ const nextLength = items2?.length ?? 0;
1272
+ setUniqueKeys((prev) => {
1273
+ const prevLength = prev.length;
1274
+ if (prevLength === nextLength) {
1275
+ return prev;
1276
+ }
1277
+ if (prevLength > nextLength) {
1278
+ return prev.slice(0, nextLength);
1279
+ }
1280
+ return [...prev, ...Array.from({ length: nextLength - prevLength }, generateUniqueKey)];
1281
+ });
1282
+ }, [items2?.length]);
1270
1283
  const itemsWithKeys = useMemo3(
1271
1284
  () => uniqueKeys.map((key, index) => ({
1272
1285
  key,
@@ -2161,7 +2174,7 @@ function ensureFilterConfig(name) {
2161
2174
 
2162
2175
  // src/controls/select-control-wrapper.tsx
2163
2176
  import * as React50 from "react";
2164
- import { useEffect as useEffect4, useState as useState6 } from "react";
2177
+ import { useEffect as useEffect5, useState as useState6 } from "react";
2165
2178
  var getOffCanvasElements = () => {
2166
2179
  const extendedWindow = window;
2167
2180
  const documentId = extendedWindow.elementor.config.document.id;
@@ -2180,7 +2193,7 @@ var collectionMethods = {
2180
2193
  };
2181
2194
  var useDynamicOptions = (collectionId, initialOptions) => {
2182
2195
  const [options, setOptions] = useState6(initialOptions ?? []);
2183
- useEffect4(() => {
2196
+ useEffect5(() => {
2184
2197
  if (!collectionId || !collectionMethods[collectionId]) {
2185
2198
  setOptions(initialOptions ?? []);
2186
2199
  return;
@@ -2202,7 +2215,7 @@ import { stringPropTypeUtil as stringPropTypeUtil4 } from "@elementor/editor-pro
2202
2215
 
2203
2216
  // src/components/control-toggle-button-group.tsx
2204
2217
  import * as React52 from "react";
2205
- import { useEffect as useEffect5, useMemo as useMemo5, useRef as useRef7, useState as useState7 } from "react";
2218
+ import { useEffect as useEffect6, useMemo as useMemo5, useRef as useRef7, useState as useState7 } from "react";
2206
2219
  import { ChevronDownIcon } from "@elementor/icons";
2207
2220
  import {
2208
2221
  ListItemText,
@@ -2433,7 +2446,7 @@ var usePreviewButton = (items2, value) => {
2433
2446
  const [previewButton, setPreviewButton] = useState7(
2434
2447
  items2.find((item) => item.value === value) ?? items2[0]
2435
2448
  );
2436
- useEffect5(() => {
2449
+ useEffect6(() => {
2437
2450
  const selectedButton = items2.find((item) => item.value === value);
2438
2451
  if (selectedButton) {
2439
2452
  setPreviewButton(selectedButton);
@@ -2859,7 +2872,7 @@ import { __ as __20 } from "@wordpress/i18n";
2859
2872
 
2860
2873
  // src/components/item-selector.tsx
2861
2874
  import * as React58 from "react";
2862
- import { useCallback as useCallback2, useEffect as useEffect6, useState as useState9 } from "react";
2875
+ import { useCallback as useCallback2, useEffect as useEffect7, useState as useState9 } from "react";
2863
2876
  import { PopoverBody, PopoverHeader as PopoverHeader2, PopoverMenuList, SearchField } from "@elementor/editor-ui";
2864
2877
  import { Box as Box8, Divider as Divider2, Link, Stack as Stack9, Typography as Typography4 } from "@elementor/ui";
2865
2878
  import { debounce } from "@elementor/utils";
@@ -3008,7 +3021,7 @@ var ItemList = ({
3008
3021
  };
3009
3022
  var useDebounce = (fn, delay) => {
3010
3023
  const [debouncedFn] = useState9(() => debounce(fn, delay));
3011
- useEffect6(() => () => debouncedFn.cancel(), [debouncedFn]);
3024
+ useEffect7(() => () => debouncedFn.cancel(), [debouncedFn]);
3012
3025
  return debouncedFn;
3013
3026
  };
3014
3027
 
@@ -3109,7 +3122,7 @@ var UrlControl = createControl(
3109
3122
 
3110
3123
  // src/controls/link-control.tsx
3111
3124
  import * as React65 from "react";
3112
- import { useEffect as useEffect7, useMemo as useMemo8, useState as useState11 } from "react";
3125
+ import { useEffect as useEffect8, useMemo as useMemo8, useState as useState11 } from "react";
3113
3126
  import { getLinkInLinkRestriction } from "@elementor/editor-elements";
3114
3127
  import { linkPropTypeUtil } from "@elementor/editor-props";
3115
3128
  import { MinusIcon, PlusIcon as PlusIcon2 } from "@elementor/icons";
@@ -3476,7 +3489,7 @@ var LinkControl = createControl((props) => {
3476
3489
  }, 300),
3477
3490
  [elementId, isActive]
3478
3491
  );
3479
- useEffect7(() => {
3492
+ useEffect8(() => {
3480
3493
  debouncedCheckRestriction();
3481
3494
  const handleInlineLinkChanged = (event) => {
3482
3495
  const customEvent = event;
@@ -3759,7 +3772,7 @@ var Control4 = ({
3759
3772
 
3760
3773
  // src/controls/aspect-ratio-control.tsx
3761
3774
  import * as React69 from "react";
3762
- import { useEffect as useEffect8, useState as useState13 } from "react";
3775
+ import { useEffect as useEffect9, useState as useState13 } from "react";
3763
3776
  import { stringPropTypeUtil as stringPropTypeUtil8 } from "@elementor/editor-props";
3764
3777
  import { MenuListItem as MenuListItem4 } from "@elementor/editor-ui";
3765
3778
  import { ArrowsMoveHorizontalIcon, ArrowsMoveVerticalIcon } from "@elementor/icons";
@@ -3786,7 +3799,7 @@ var AspectRatioControl = createControl(({ label }) => {
3786
3799
  const [selectedValue, setSelectedValue] = useState13(
3787
3800
  isCustomSelected ? CUSTOM_RATIO : aspectRatioValue || ""
3788
3801
  );
3789
- useEffect8(() => {
3802
+ useEffect9(() => {
3790
3803
  const isCustomValue = aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue);
3791
3804
  if (isCustomValue) {
3792
3805
  const [width, height] = aspectRatioValue.split("/");
@@ -5553,7 +5566,7 @@ var TransformBasePopoverTrigger = ({
5553
5566
 
5554
5567
  // src/controls/transition-control/transition-repeater-control.tsx
5555
5568
  import * as React97 from "react";
5556
- import { useEffect as useEffect9, useMemo as useMemo13, useState as useState17 } from "react";
5569
+ import { useEffect as useEffect10, useMemo as useMemo13, useState as useState17 } from "react";
5557
5570
  import {
5558
5571
  createArrayPropUtils as createArrayPropUtils2,
5559
5572
  selectionSizePropTypeUtil as selectionSizePropTypeUtil2
@@ -5889,7 +5902,7 @@ var TransitionRepeaterControl = createControl(
5889
5902
  });
5890
5903
  return set;
5891
5904
  }, []);
5892
- useEffect9(() => {
5905
+ useEffect10(() => {
5893
5906
  if (!value || value.length === 0) {
5894
5907
  return;
5895
5908
  }
@@ -5901,7 +5914,7 @@ var TransitionRepeaterControl = createControl(
5901
5914
  setValue(sanitized);
5902
5915
  }
5903
5916
  }, [allowedTransitionSet]);
5904
- useEffect9(() => {
5917
+ useEffect10(() => {
5905
5918
  recentlyUsedListGetter().then(setRecentlyUsedList);
5906
5919
  }, [recentlyUsedListGetter]);
5907
5920
  const allPropertiesUsed = useMemo13(() => areAllPropertiesUsed(value), [value]);
@@ -6013,7 +6026,7 @@ import { Box as Box24 } from "@elementor/ui";
6013
6026
  import * as React101 from "react";
6014
6027
  import {
6015
6028
  forwardRef as forwardRef10,
6016
- useEffect as useEffect12,
6029
+ useEffect as useEffect13,
6017
6030
  useRef as useRef26,
6018
6031
  useState as useState19
6019
6032
  } from "react";
@@ -6070,7 +6083,7 @@ import { __ as __51 } from "@wordpress/i18n";
6070
6083
 
6071
6084
  // src/components/url-popover.tsx
6072
6085
  import * as React99 from "react";
6073
- import { useEffect as useEffect10, useRef as useRef24 } from "react";
6086
+ import { useEffect as useEffect11, useRef as useRef24 } from "react";
6074
6087
  import { ExternalLinkIcon } from "@elementor/icons";
6075
6088
  import { bindPopover as bindPopover7, Popover as Popover7, Stack as Stack16, TextField as TextField8, ToggleButton as ToggleButton2, Tooltip as Tooltip9 } from "@elementor/ui";
6076
6089
  import { __ as __50 } from "@wordpress/i18n";
@@ -6084,7 +6097,7 @@ var UrlPopover = ({
6084
6097
  onToggleNewTab
6085
6098
  }) => {
6086
6099
  const inputRef = useRef24(null);
6087
- useEffect10(() => {
6100
+ useEffect11(() => {
6088
6101
  if (popupState.isOpen) {
6089
6102
  requestAnimationFrame(() => inputRef.current?.focus());
6090
6103
  }
@@ -6329,7 +6342,7 @@ var UNDERLINE_KEYBOARD_SHORTCUT = "u";
6329
6342
  var INLINE_EDITOR_RESET_CLASS = "elementor-inline-editor-reset";
6330
6343
  var useOnUpdate = (callback, dependencies) => {
6331
6344
  const hasMounted = useRef26(false);
6332
- useEffect12(() => {
6345
+ useEffect13(() => {
6333
6346
  if (hasMounted.current) {
6334
6347
  callback();
6335
6348
  } else {
@@ -6575,7 +6588,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
6575
6588
 
6576
6589
  // src/components/repeater/repeater.tsx
6577
6590
  import * as React104 from "react";
6578
- import { useEffect as useEffect13, useState as useState20 } from "react";
6591
+ import { useEffect as useEffect14, useState as useState20 } from "react";
6579
6592
  import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon3, XIcon as XIcon4 } from "@elementor/icons";
6580
6593
  import {
6581
6594
  bindPopover as bindPopover9,
@@ -6763,7 +6776,7 @@ var usePopover = (openOnMount, onOpen) => {
6763
6776
  const [ref, setRef] = useState20(null);
6764
6777
  const popoverState = usePopupState10({ variant: "popover" });
6765
6778
  const popoverProps = bindPopover9(popoverState);
6766
- useEffect13(() => {
6779
+ useEffect14(() => {
6767
6780
  if (openOnMount && ref) {
6768
6781
  popoverState.open(ref);
6769
6782
  onOpen?.();