@elementor/editor-controls 4.4.0-1078 → 4.4.0-1079

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
@@ -5315,7 +5315,7 @@ var AspectRatioControl = createControl(({ label }) => {
5315
5315
 
5316
5316
  // src/controls/svg-media-control.tsx
5317
5317
  import * as React85 from "react";
5318
- import { useEffect as useEffect16, useRef as useRef15, useState as useState17 } from "react";
5318
+ import { useEffect as useEffect16, useRef as useRef15, useState as useState16 } from "react";
5319
5319
  import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
5320
5320
  import { iconPropTypeUtil, svgSrcPropTypeUtil, urlPropTypeUtil as urlPropTypeUtil4 } from "@elementor/editor-props";
5321
5321
  import { Box as Box18, Card as Card2, CardOverlay as CardOverlay2, Popover as Popover6, Stack as Stack15, styled as styled11, usePopupState as usePopupState8 } from "@elementor/ui";
@@ -5399,7 +5399,7 @@ function measureIconLibraryAnchor(container, buttonGroup) {
5399
5399
 
5400
5400
  // src/controls/icon-library/icon-library-popover.tsx
5401
5401
  import * as React82 from "react";
5402
- import { useMemo as useMemo12, useState as useState16 } from "react";
5402
+ import { useMemo as useMemo12 } from "react";
5403
5403
  import {
5404
5404
  PopoverBody as PopoverBody2,
5405
5405
  PopoverHeader as PopoverHeader4,
@@ -5409,6 +5409,7 @@ import {
5409
5409
  } from "@elementor/editor-ui";
5410
5410
  import { ComponentsIcon } from "@elementor/icons";
5411
5411
  import { Box as Box15, CircularProgress as CircularProgress3, Divider as Divider4, Link as Link3, Stack as Stack13, styled as styled9, Typography as Typography7 } from "@elementor/ui";
5412
+ import { useDebounceState } from "@elementor/utils";
5412
5413
  import { __ as __32 } from "@wordpress/i18n";
5413
5414
 
5414
5415
  // src/controls/icon-library/font-awesome-7-data.ts
@@ -5683,6 +5684,7 @@ function useFontAwesome7Catalog(enabled) {
5683
5684
  // src/controls/icon-library/icon-library-popover.tsx
5684
5685
  var ICON_LIBRARY_POPOVER_WIDTH = 300;
5685
5686
  var ICON_LIBRARY_ROW_HEIGHT = 48;
5687
+ var ICON_LIBRARY_SEARCH_DEBOUNCE_DELAY = 300;
5686
5688
  var ICON_TILE_SIZE = 40;
5687
5689
  var ICON_GLYPH_SIZE = 20;
5688
5690
  var ICON_LIBRARY_INLINE_SPACING = 1;
@@ -5699,7 +5701,12 @@ var IconLibraryPopover = ({
5699
5701
  onClose,
5700
5702
  width = ICON_LIBRARY_POPOVER_WIDTH
5701
5703
  }) => {
5702
- const [searchValue, setSearchValue] = useState16("");
5704
+ const {
5705
+ debouncedValue: searchValue,
5706
+ inputValue: searchInputValue,
5707
+ handleChange: handleSearchChange,
5708
+ setImmediateValue: setSearchValue
5709
+ } = useDebounceState({ delay: ICON_LIBRARY_SEARCH_DEBOUNCE_DELAY });
5703
5710
  const { data: icons = [], isLoading } = useFontAwesome7Catalog(open);
5704
5711
  const items2 = useMemo12(() => createIconLibraryItems(icons, searchValue), [icons, searchValue]);
5705
5712
  const selectedValue = useMemo12(
@@ -5734,8 +5741,8 @@ var IconLibraryPopover = ({
5734
5741
  ), /* @__PURE__ */ React82.createElement(
5735
5742
  SearchField2,
5736
5743
  {
5737
- value: searchValue,
5738
- onSearch: setSearchValue,
5744
+ value: searchInputValue,
5745
+ onSearch: handleSearchChange,
5739
5746
  placeholder: __32("Search", "elementor"),
5740
5747
  id: "icon-library-search",
5741
5748
  sx: { px: ICON_LIBRARY_INLINE_SPACING, pb: 1 }
@@ -6018,11 +6025,11 @@ var SvgMediaControl = createControl(({ showIconLibrary = false }) => {
6018
6025
  const { data: attachment, isFetching } = useWpMediaAttachment2(id?.value || null);
6019
6026
  const src = attachment?.url ?? url?.value ?? null;
6020
6027
  const { data: allowSvgUpload } = useUnfilteredFilesUpload();
6021
- const [unfilteredModalOpenState, setUnfilteredModalOpenState] = useState17(false);
6028
+ const [unfilteredModalOpenState, setUnfilteredModalOpenState] = useState16(false);
6022
6029
  const iconLibraryPopoverState = usePopupState8({ variant: "popover" });
6023
6030
  const controlContainerRef = useRef15(null);
6024
6031
  const buttonGroupRef = useRef15(null);
6025
- const [iconLibraryAnchor, setIconLibraryAnchor] = useState17(null);
6032
+ const [iconLibraryAnchor, setIconLibraryAnchor] = useState16(null);
6026
6033
  const { isAdmin } = useCurrentUserCapabilities();
6027
6034
  const selectedIconClass = showIconLibrary && typeof iconValue?.value?.value === "string" ? iconValue.value.value : null;
6028
6035
  const selectedIconLibrary = showIconLibrary && typeof iconValue?.library?.value === "string" ? iconValue.library.value : null;
@@ -6989,7 +6996,7 @@ var getAllProperties = (pattern) => {
6989
6996
 
6990
6997
  // src/controls/key-value-control.tsx
6991
6998
  import * as React95 from "react";
6992
- import { useMemo as useMemo14, useState as useState18 } from "react";
6999
+ import { useMemo as useMemo14, useState as useState17 } from "react";
6993
7000
  import {
6994
7001
  isTransformable,
6995
7002
  keyValuePropTypeUtil,
@@ -7020,9 +7027,9 @@ var getInitialFieldValue = (fieldValue) => {
7020
7027
  };
7021
7028
  var KeyValueControl = createControl((props = {}) => {
7022
7029
  const { value, setValue, ...propContext } = useBoundProp(keyValuePropTypeUtil);
7023
- const [keyError, setKeyError] = useState18("");
7024
- const [valueError, setValueError] = useState18("");
7025
- const [sessionState, setSessionState] = useState18({
7030
+ const [keyError, setKeyError] = useState17("");
7031
+ const [valueError, setValueError] = useState17("");
7032
+ const [sessionState, setSessionState] = useState17({
7026
7033
  key: getInitialFieldValue(value?.key),
7027
7034
  value: getInitialFieldValue(value?.value)
7028
7035
  });
@@ -7771,7 +7778,7 @@ var TransformBasePopoverTrigger = ({
7771
7778
 
7772
7779
  // src/controls/transition-control/transition-repeater-control.tsx
7773
7780
  import * as React112 from "react";
7774
- import { useEffect as useEffect17, useMemo as useMemo17, useState as useState19 } from "react";
7781
+ import { useEffect as useEffect17, useMemo as useMemo17, useState as useState18 } from "react";
7775
7782
  import {
7776
7783
  createArrayPropUtils as createArrayPropUtils3,
7777
7784
  selectionSizePropTypeUtil as selectionSizePropTypeUtil2
@@ -8318,7 +8325,7 @@ var TransitionRepeaterControl = createControl(
8318
8325
  currentStyleState
8319
8326
  }) => {
8320
8327
  const currentStyleIsNormal = currentStyleState === null;
8321
- const [recentlyUsedList, setRecentlyUsedList] = useState19([]);
8328
+ const [recentlyUsedList, setRecentlyUsedList] = useState18([]);
8322
8329
  const proInstalled = hasProInstalled2();
8323
8330
  const { value, setValue } = useBoundProp(childArrayPropTypeUtil);
8324
8331
  const { allDisabled: disabledItems, proDisabled: proDisabledItems } = useMemo17(
@@ -8634,7 +8641,7 @@ var BoundTimeStringControl = ({ bind, ariaLabel }) => {
8634
8641
 
8635
8642
  // src/controls/inline-editing-control.tsx
8636
8643
  import * as React121 from "react";
8637
- import { useCallback as useCallback4, useState as useState21 } from "react";
8644
+ import { useCallback as useCallback4, useState as useState20 } from "react";
8638
8645
  import { escapedHtmlPropTypeUtil as escapedHtmlPropTypeUtil2 } from "@elementor/editor-props";
8639
8646
  import { Box as Box30 } from "@elementor/ui";
8640
8647
 
@@ -8814,7 +8821,7 @@ var useOnUpdate = (callback, dependencies) => {
8814
8821
 
8815
8822
  // src/components/inline-editor-toolbar.tsx
8816
8823
  import * as React120 from "react";
8817
- import { useEffect as useEffect20, useMemo as useMemo18, useRef as useRef31, useState as useState20 } from "react";
8824
+ import { useEffect as useEffect20, useMemo as useMemo18, useRef as useRef31, useState as useState19 } from "react";
8818
8825
  import { getContainer as getContainer2, getElementSetting } from "@elementor/editor-elements";
8819
8826
  import {
8820
8827
  BoldIcon,
@@ -8909,8 +8916,8 @@ var InlineEditorToolbar = ({
8909
8916
  sx = {},
8910
8917
  inControlPanel = false
8911
8918
  }) => {
8912
- const [urlValue, setUrlValue] = useState20("");
8913
- const [openInNewTab, setOpenInNewTab] = useState20(false);
8919
+ const [urlValue, setUrlValue] = useState19("");
8920
+ const [openInNewTab, setOpenInNewTab] = useState19(false);
8914
8921
  const toolbarRef = useRef31(null);
8915
8922
  const linkPopupState = usePopupState11({ variant: "popover" });
8916
8923
  const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
@@ -9136,7 +9143,7 @@ var InlineEditingControl = createControl(({ sx, attributes, props, context: { el
9136
9143
  const { setValue, placeholder, value } = useBoundProp(escapedHtmlPropTypeUtil2);
9137
9144
  const { value: rawValue } = usePropKeyContext();
9138
9145
  const content = value ?? extractInlineHtmlContent(rawValue);
9139
- const [editor, setEditor] = useState21(null);
9146
+ const [editor, setEditor] = useState20(null);
9140
9147
  const handleChange = useCallback4(
9141
9148
  (newValue) => {
9142
9149
  const html = newValue ?? "";
@@ -9319,7 +9326,7 @@ function useFormFieldSuggestions(options) {
9319
9326
 
9320
9327
  // src/controls/email-form-action-control/email-chips-field.tsx
9321
9328
  import * as React122 from "react";
9322
- import { useMemo as useMemo19, useState as useState22 } from "react";
9329
+ import { useMemo as useMemo19, useState as useState21 } from "react";
9323
9330
  import { stringArrayPropTypeUtil as stringArrayPropTypeUtil3, stringPropTypeUtil as stringPropTypeUtil23 } from "@elementor/editor-props";
9324
9331
  import { Autocomplete as Autocomplete4, Grid as Grid32, TextField as TextField12 } from "@elementor/ui";
9325
9332
 
@@ -9357,7 +9364,7 @@ function resolveMention(raw, suggestions) {
9357
9364
  }
9358
9365
  var EmailChipsControl = createControl(({ placeholder, suggestions = [] }) => {
9359
9366
  const { value, setValue, disabled } = useBoundProp(stringArrayPropTypeUtil3);
9360
- const [inputValue, setInputValue] = useState22("");
9367
+ const [inputValue, setInputValue] = useState21("");
9361
9368
  const items2 = value || [];
9362
9369
  const selectedValues = items2.map((item) => stringPropTypeUtil23.extract(item)).filter((val) => val !== null);
9363
9370
  const suggestionOptions = useMemo19(
@@ -9587,7 +9594,7 @@ import { __ as __65 } from "@wordpress/i18n";
9587
9594
 
9588
9595
  // src/components/promotions/promotion-trigger.tsx
9589
9596
  import * as React128 from "react";
9590
- import { forwardRef as forwardRef12, useCallback as useCallback5, useImperativeHandle, useState as useState23 } from "react";
9597
+ import { forwardRef as forwardRef12, useCallback as useCallback5, useImperativeHandle, useState as useState22 } from "react";
9591
9598
  import { PromotionChip as PromotionChip2, PromotionInfotip } from "@elementor/editor-ui";
9592
9599
  import { Box as Box32 } from "@elementor/ui";
9593
9600
  function getV4Promotion(key) {
@@ -9595,7 +9602,7 @@ function getV4Promotion(key) {
9595
9602
  }
9596
9603
  var PromotionTrigger = forwardRef12(
9597
9604
  ({ promotionKey, children, trackingData }, ref) => {
9598
- const [isOpen, setIsOpen] = useState23(false);
9605
+ const [isOpen, setIsOpen] = useState22(false);
9599
9606
  const promotion = getV4Promotion(promotionKey);
9600
9607
  const toggle = useCallback5(() => {
9601
9608
  setIsOpen((prev) => {
@@ -9715,7 +9722,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
9715
9722
 
9716
9723
  // src/components/repeater/repeater.tsx
9717
9724
  import * as React132 from "react";
9718
- import { useEffect as useEffect21, useState as useState24 } from "react";
9725
+ import { useEffect as useEffect21, useState as useState23 } from "react";
9719
9726
  import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon5, XIcon as XIcon4 } from "@elementor/icons";
9720
9727
  import {
9721
9728
  bindPopover as bindPopover9,
@@ -9745,7 +9752,7 @@ var Repeater3 = ({
9745
9752
  isSortable = true,
9746
9753
  adornment = ControlAdornments
9747
9754
  }) => {
9748
- const [openItem, setOpenItem] = useState24(initialOpenItem);
9755
+ const [openItem, setOpenItem] = useState23(initialOpenItem);
9749
9756
  const uniqueKeys = items2.map(
9750
9757
  (item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
9751
9758
  );
@@ -9921,7 +9928,7 @@ var RepeaterItem = ({
9921
9928
  ), /* @__PURE__ */ React132.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React132.createElement(Box33, null, children({ anchorEl: ref }))));
9922
9929
  };
9923
9930
  var usePopover = (openOnMount, onOpen, onPopoverClose) => {
9924
- const [ref, setRef] = useState24(null);
9931
+ const [ref, setRef] = useState23(null);
9925
9932
  const popoverState = usePopupState12({ variant: "popover" });
9926
9933
  const popoverProps = bindPopover9(popoverState);
9927
9934
  useEffect21(() => {