@elementor/editor-controls 4.3.0-beta3 → 4.3.1
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.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +261 -207
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +185 -131
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/src/controls/link-control.tsx +18 -8
- package/src/controls/number-control.tsx +81 -25
- package/src/utils/number-value.ts +17 -0
package/dist/index.mjs
CHANGED
|
@@ -2929,8 +2929,24 @@ var ToggleControl = createControl(
|
|
|
2929
2929
|
|
|
2930
2930
|
// src/controls/number-control.tsx
|
|
2931
2931
|
import * as React57 from "react";
|
|
2932
|
+
import { useRef as useRef9, useState as useState8 } from "react";
|
|
2932
2933
|
import { numberPropTypeUtil } from "@elementor/editor-props";
|
|
2933
2934
|
import { InputAdornment as InputAdornment3, Typography as Typography4 } from "@elementor/ui";
|
|
2935
|
+
|
|
2936
|
+
// src/utils/number-value.ts
|
|
2937
|
+
var isEmptyDraft = (raw) => raw.trim() === "";
|
|
2938
|
+
var parseNumberDraft = (raw, shouldForceInt = false) => {
|
|
2939
|
+
const trimmed = raw.trim();
|
|
2940
|
+
if (trimmed === "") {
|
|
2941
|
+
return null;
|
|
2942
|
+
}
|
|
2943
|
+
const parsed = shouldForceInt ? parseInt(trimmed, 10) : Number(trimmed);
|
|
2944
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
2945
|
+
};
|
|
2946
|
+
var isInRange = (value, min, max) => value >= min && value <= max;
|
|
2947
|
+
var clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
2948
|
+
|
|
2949
|
+
// src/controls/number-control.tsx
|
|
2934
2950
|
var isEmptyOrNaN = (value) => value === null || value === void 0 || value === "" || Number.isNaN(Number(value));
|
|
2935
2951
|
var renderSuffix = (propType) => {
|
|
2936
2952
|
if (propType.meta?.suffix) {
|
|
@@ -2941,31 +2957,63 @@ var renderSuffix = (propType) => {
|
|
|
2941
2957
|
var NumberControl = createControl(
|
|
2942
2958
|
({
|
|
2943
2959
|
placeholder: labelPlaceholder,
|
|
2944
|
-
max
|
|
2945
|
-
min
|
|
2946
|
-
step
|
|
2960
|
+
max: maxProp,
|
|
2961
|
+
min: minProp,
|
|
2962
|
+
step: stepProp,
|
|
2947
2963
|
shouldForceInt = false,
|
|
2948
2964
|
startIcon,
|
|
2949
2965
|
disabled: inputDisabled
|
|
2950
2966
|
}) => {
|
|
2967
|
+
const max = maxProp ?? Number.MAX_SAFE_INTEGER;
|
|
2968
|
+
const min = minProp ?? -Number.MAX_SAFE_INTEGER;
|
|
2969
|
+
const step = stepProp ?? 1;
|
|
2951
2970
|
const { value, setValue, placeholder, disabled, restoreValue, propType } = useBoundProp(numberPropTypeUtil);
|
|
2952
|
-
const
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2971
|
+
const [draft, setDraft] = useState8(null);
|
|
2972
|
+
const committedNullOnInputRef = useRef9(false);
|
|
2973
|
+
const handleInput = (event) => {
|
|
2974
|
+
const raw = event.target.value;
|
|
2975
|
+
setDraft(raw);
|
|
2976
|
+
if (isEmptyDraft(raw)) {
|
|
2977
|
+
if (!propType.settings.required) {
|
|
2978
|
+
setValue(null);
|
|
2979
|
+
committedNullOnInputRef.current = true;
|
|
2980
|
+
}
|
|
2981
|
+
return;
|
|
2982
|
+
}
|
|
2983
|
+
committedNullOnInputRef.current = false;
|
|
2984
|
+
const parsed = parseNumberDraft(raw, shouldForceInt);
|
|
2985
|
+
if (parsed === null) {
|
|
2986
|
+
return;
|
|
2987
|
+
}
|
|
2988
|
+
if (isInRange(parsed, min, max)) {
|
|
2989
|
+
setValue(parsed);
|
|
2990
|
+
}
|
|
2991
|
+
};
|
|
2992
|
+
const handleBlur = () => {
|
|
2993
|
+
const raw = draft;
|
|
2994
|
+
const committedNullOnInput = committedNullOnInputRef.current;
|
|
2995
|
+
committedNullOnInputRef.current = false;
|
|
2996
|
+
setDraft(null);
|
|
2997
|
+
restoreValue();
|
|
2998
|
+
if (raw === null) {
|
|
2999
|
+
return;
|
|
3000
|
+
}
|
|
3001
|
+
if (isEmptyDraft(raw)) {
|
|
3002
|
+
if (!propType.settings.required && !committedNullOnInput) {
|
|
3003
|
+
setValue(null);
|
|
3004
|
+
}
|
|
3005
|
+
return;
|
|
3006
|
+
}
|
|
3007
|
+
const parsed = parseNumberDraft(raw, shouldForceInt);
|
|
3008
|
+
if (parsed === null) {
|
|
3009
|
+
return;
|
|
3010
|
+
}
|
|
3011
|
+
if (isInRange(parsed, min, max)) {
|
|
3012
|
+
return;
|
|
2966
3013
|
}
|
|
2967
|
-
setValue(
|
|
3014
|
+
setValue(clamp(parsed, min, max));
|
|
2968
3015
|
};
|
|
3016
|
+
const displayValue = draft ?? (isEmptyOrNaN(value) ? "" : String(value));
|
|
2969
3017
|
return /* @__PURE__ */ React57.createElement(ControlActions, null, /* @__PURE__ */ React57.createElement(
|
|
2970
3018
|
NumberInput,
|
|
2971
3019
|
{
|
|
@@ -2973,11 +3021,11 @@ var NumberControl = createControl(
|
|
|
2973
3021
|
type: "number",
|
|
2974
3022
|
fullWidth: true,
|
|
2975
3023
|
disabled: inputDisabled ?? disabled,
|
|
2976
|
-
value:
|
|
2977
|
-
onInput:
|
|
2978
|
-
onBlur:
|
|
3024
|
+
value: displayValue,
|
|
3025
|
+
onInput: handleInput,
|
|
3026
|
+
onBlur: handleBlur,
|
|
2979
3027
|
placeholder: labelPlaceholder ?? (isEmptyOrNaN(placeholder) ? "" : String(placeholder)),
|
|
2980
|
-
inputProps: { step, min },
|
|
3028
|
+
inputProps: { step, min, ...maxProp !== null && maxProp !== void 0 && { max } },
|
|
2981
3029
|
InputProps: {
|
|
2982
3030
|
startAdornment: startIcon ? /* @__PURE__ */ React57.createElement(InputAdornment3, { position: "start", disabled: inputDisabled ?? disabled }, startIcon) : void 0,
|
|
2983
3031
|
endAdornment: renderSuffix(propType)
|
|
@@ -2989,7 +3037,7 @@ var NumberControl = createControl(
|
|
|
2989
3037
|
|
|
2990
3038
|
// src/controls/equal-unequal-sizes-control.tsx
|
|
2991
3039
|
import * as React58 from "react";
|
|
2992
|
-
import { useId as useId2, useRef as
|
|
3040
|
+
import { useId as useId2, useRef as useRef10 } from "react";
|
|
2993
3041
|
import { bindPopover as bindPopover3, bindToggle, Box as Box7, Grid as Grid8, Popover as Popover3, Stack as Stack7, Tooltip as Tooltip5, usePopupState as usePopupState4 } from "@elementor/ui";
|
|
2994
3042
|
import { __ as __18 } from "@wordpress/i18n";
|
|
2995
3043
|
function EqualUnequalSizesControl({
|
|
@@ -3001,7 +3049,7 @@ function EqualUnequalSizesControl({
|
|
|
3001
3049
|
}) {
|
|
3002
3050
|
const popupId = useId2();
|
|
3003
3051
|
const popupState = usePopupState4({ variant: "popover", popupId });
|
|
3004
|
-
const rowRefs = [
|
|
3052
|
+
const rowRefs = [useRef10(null), useRef10(null)];
|
|
3005
3053
|
const { propType: multiSizePropType, disabled: multiSizeDisabled } = useBoundProp(multiSizePropTypeUtil);
|
|
3006
3054
|
const { value: masterValue, setValue: setMasterValue, placeholder: masterPlaceholder } = useBoundProp();
|
|
3007
3055
|
const getMultiSizeValues = (sourceValue) => {
|
|
@@ -3096,7 +3144,7 @@ var MultiSizeValueControl = ({ item, rowRef }) => {
|
|
|
3096
3144
|
|
|
3097
3145
|
// src/controls/linked-dimensions-control.tsx
|
|
3098
3146
|
import * as React65 from "react";
|
|
3099
|
-
import { useLayoutEffect, useRef as
|
|
3147
|
+
import { useLayoutEffect, useRef as useRef13, useState as useState10 } from "react";
|
|
3100
3148
|
import {
|
|
3101
3149
|
dimensionsPropTypeUtil,
|
|
3102
3150
|
sizePropTypeUtil as sizePropTypeUtil5
|
|
@@ -3108,7 +3156,7 @@ import { __ as __20, sprintf as sprintf2 } from "@wordpress/i18n";
|
|
|
3108
3156
|
|
|
3109
3157
|
// src/controls/size-control/unstable-size-control.tsx
|
|
3110
3158
|
import * as React64 from "react";
|
|
3111
|
-
import { useRef as
|
|
3159
|
+
import { useRef as useRef12 } from "react";
|
|
3112
3160
|
import { sizePropTypeUtil as sizePropTypeUtil4 } from "@elementor/editor-props";
|
|
3113
3161
|
|
|
3114
3162
|
// src/controls/size-control/size-component.tsx
|
|
@@ -3235,9 +3283,9 @@ var sanitizeSize = (size) => {
|
|
|
3235
3283
|
};
|
|
3236
3284
|
|
|
3237
3285
|
// src/controls/size-control/hooks/use-unit-sync.ts
|
|
3238
|
-
import { useEffect as useEffect9, useState as
|
|
3286
|
+
import { useEffect as useEffect9, useState as useState9 } from "react";
|
|
3239
3287
|
var useUnitSync = ({ sizeValue, setUnit, persistWhen }) => {
|
|
3240
|
-
const [state, setState] =
|
|
3288
|
+
const [state, setState] = useState9(sizeValue.unit);
|
|
3241
3289
|
useEffect9(() => {
|
|
3242
3290
|
if (sizeValue.unit !== state) {
|
|
3243
3291
|
setState(sizeValue.unit);
|
|
@@ -3500,14 +3548,14 @@ var shouldHighlightUnit = (value) => {
|
|
|
3500
3548
|
|
|
3501
3549
|
// src/controls/size-control/ui/text-field-popover.tsx
|
|
3502
3550
|
import * as React62 from "react";
|
|
3503
|
-
import { useEffect as useEffect10, useRef as
|
|
3551
|
+
import { useEffect as useEffect10, useRef as useRef11 } from "react";
|
|
3504
3552
|
import { PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
|
|
3505
3553
|
import { MathFunctionIcon as MathFunctionIcon4 } from "@elementor/icons";
|
|
3506
3554
|
import { bindPopover as bindPopover4, Popover as Popover4, TextField as TextField6 } from "@elementor/ui";
|
|
3507
3555
|
import { __ as __19 } from "@wordpress/i18n";
|
|
3508
3556
|
var SIZE7 = "tiny";
|
|
3509
3557
|
var TextFieldPopover2 = ({ popupState, anchorRef, value, onChange, onClose }) => {
|
|
3510
|
-
const inputRef =
|
|
3558
|
+
const inputRef = useRef11(null);
|
|
3511
3559
|
useEffect10(() => {
|
|
3512
3560
|
if (popupState.isOpen) {
|
|
3513
3561
|
requestAnimationFrame(() => {
|
|
@@ -3707,7 +3755,7 @@ var UnstableSizeControl = createControl(
|
|
|
3707
3755
|
placeholder: boundPropPlaceholder,
|
|
3708
3756
|
restoreValue
|
|
3709
3757
|
} = useBoundProp(sizePropTypeUtil4);
|
|
3710
|
-
const lastNonAutoValue =
|
|
3758
|
+
const lastNonAutoValue = useRef12(null);
|
|
3711
3759
|
const { sizeValue, placeholder } = resolveBoundPropValue(
|
|
3712
3760
|
value ?? lastNonAutoValue.current,
|
|
3713
3761
|
boundPropPlaceholder,
|
|
@@ -3764,7 +3812,7 @@ var isTransitioningFromExtendedUnit = (nextValue, previousValue) => {
|
|
|
3764
3812
|
|
|
3765
3813
|
// src/controls/linked-dimensions-control.tsx
|
|
3766
3814
|
var LinkedDimensionsControl = ({ label, isSiteRtl = false, min }) => {
|
|
3767
|
-
const gridRowRefs = [
|
|
3815
|
+
const gridRowRefs = [useRef13(null), useRef13(null)];
|
|
3768
3816
|
const { disabled: sizeDisabled } = useBoundProp(sizePropTypeUtil5);
|
|
3769
3817
|
const {
|
|
3770
3818
|
value: dimensionsValue,
|
|
@@ -3783,7 +3831,7 @@ var LinkedDimensionsControl = ({ label, isSiteRtl = false, min }) => {
|
|
|
3783
3831
|
}
|
|
3784
3832
|
return true;
|
|
3785
3833
|
};
|
|
3786
|
-
const [isLinked, setIsLinked] =
|
|
3834
|
+
const [isLinked, setIsLinked] = useState10(() => inferIsLinked());
|
|
3787
3835
|
const activeBreakpoint = useActiveBreakpoint4();
|
|
3788
3836
|
const isCurrentlyDimensions = dimensionsPropTypeUtil.isValid(masterValue ?? masterPlaceholder);
|
|
3789
3837
|
useLayoutEffect(() => {
|
|
@@ -3965,7 +4013,7 @@ import { __ as __22 } from "@wordpress/i18n";
|
|
|
3965
4013
|
|
|
3966
4014
|
// src/components/item-selector.tsx
|
|
3967
4015
|
import * as React66 from "react";
|
|
3968
|
-
import { useCallback as useCallback3, useEffect as useEffect12, useState as
|
|
4016
|
+
import { useCallback as useCallback3, useEffect as useEffect12, useState as useState11 } from "react";
|
|
3969
4017
|
import { PopoverBody, PopoverHeader as PopoverHeader3, PopoverMenuList, SearchField } from "@elementor/editor-ui";
|
|
3970
4018
|
import { Box as Box9, Divider as Divider2, Link, Stack as Stack9, Typography as Typography5 } from "@elementor/ui";
|
|
3971
4019
|
import { debounce } from "@elementor/utils";
|
|
@@ -4004,7 +4052,7 @@ var ItemSelector = ({
|
|
|
4004
4052
|
footer,
|
|
4005
4053
|
categoryItemContentTemplate
|
|
4006
4054
|
}) => {
|
|
4007
|
-
const [searchValue, setSearchValue] =
|
|
4055
|
+
const [searchValue, setSearchValue] = useState11("");
|
|
4008
4056
|
const filteredItemsList = useFilteredItemsList(itemsList, searchValue, disabledItems);
|
|
4009
4057
|
const IconComponent = icon;
|
|
4010
4058
|
const handleSearch = (value) => {
|
|
@@ -4118,7 +4166,7 @@ var ItemList = ({
|
|
|
4118
4166
|
);
|
|
4119
4167
|
};
|
|
4120
4168
|
var useDebounce = (fn, delay) => {
|
|
4121
|
-
const [debouncedFn] =
|
|
4169
|
+
const [debouncedFn] = useState11(() => debounce(fn, delay));
|
|
4122
4170
|
useEffect12(() => () => debouncedFn.cancel(), [debouncedFn]);
|
|
4123
4171
|
return debouncedFn;
|
|
4124
4172
|
};
|
|
@@ -4221,7 +4269,7 @@ var UrlControl = createControl(
|
|
|
4221
4269
|
|
|
4222
4270
|
// src/controls/link-control.tsx
|
|
4223
4271
|
import * as React73 from "react";
|
|
4224
|
-
import { useEffect as useEffect14, useState as
|
|
4272
|
+
import { useEffect as useEffect14, useState as useState13 } from "react";
|
|
4225
4273
|
import { getLinkInLinkRestriction } from "@elementor/editor-elements";
|
|
4226
4274
|
import { linkPropTypeUtil } from "@elementor/editor-props";
|
|
4227
4275
|
import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
|
|
@@ -4449,7 +4497,7 @@ function factoryFilter(newValue, options, minInputLength) {
|
|
|
4449
4497
|
}
|
|
4450
4498
|
|
|
4451
4499
|
// src/hooks/use-query-autocomplete.ts
|
|
4452
|
-
import { useEffect as useEffect13, useMemo as useMemo9, useState as
|
|
4500
|
+
import { useEffect as useEffect13, useMemo as useMemo9, useState as useState12 } from "react";
|
|
4453
4501
|
import { numberPropTypeUtil as numberPropTypeUtil2, stringPropTypeUtil as stringPropTypeUtil8 } from "@elementor/editor-props";
|
|
4454
4502
|
import { httpService as httpService2 } from "@elementor/http-client";
|
|
4455
4503
|
import { debounce as debounce2 } from "@elementor/utils";
|
|
@@ -4461,7 +4509,7 @@ function useQueryAutocomplete({
|
|
|
4461
4509
|
excludeIds
|
|
4462
4510
|
}) {
|
|
4463
4511
|
const excludeIdSet = useMemo9(() => new Set((excludeIds ?? []).map(String)), [excludeIds]);
|
|
4464
|
-
const [options, setOptions] =
|
|
4512
|
+
const [options, setOptions] = useState12(
|
|
4465
4513
|
generateFirstLoadedOption(initialQueryValue)
|
|
4466
4514
|
);
|
|
4467
4515
|
const debounceFetch = useMemo9(
|
|
@@ -4619,7 +4667,7 @@ var LinkControl = createControl((props) => {
|
|
|
4619
4667
|
const { value, path, setValue, ...propContext } = useBoundProp(linkPropTypeUtil);
|
|
4620
4668
|
const linkPlaceholder = propContext.placeholder;
|
|
4621
4669
|
const [linkSessionValue, setLinkSessionValue] = useSessionStorage(path.join("/"));
|
|
4622
|
-
const [isActive, setIsActive] =
|
|
4670
|
+
const [isActive, setIsActive] = useState13(!!value || !!linkPlaceholder);
|
|
4623
4671
|
const {
|
|
4624
4672
|
allowCustomValues = true,
|
|
4625
4673
|
queryOptions,
|
|
@@ -4629,37 +4677,43 @@ var LinkControl = createControl((props) => {
|
|
|
4629
4677
|
label = __25("Link", "elementor"),
|
|
4630
4678
|
ariaLabel
|
|
4631
4679
|
} = props || {};
|
|
4632
|
-
const [linkInLinkRestriction, setLinkInLinkRestriction] =
|
|
4680
|
+
const [linkInLinkRestriction, setLinkInLinkRestriction] = useState13(
|
|
4633
4681
|
getLinkInLinkRestriction(elementId, value ?? linkPlaceholder)
|
|
4634
4682
|
);
|
|
4635
4683
|
const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
|
|
4636
|
-
const
|
|
4684
|
+
const syncLinkRestriction = (clearActiveLinkWhen = "restricted") => {
|
|
4637
4685
|
const newRestriction = getLinkInLinkRestriction(elementId, value ?? linkPlaceholder);
|
|
4638
|
-
|
|
4686
|
+
const becameRestricted = newRestriction.shouldRestrict && !linkInLinkRestriction.shouldRestrict;
|
|
4687
|
+
const shouldClearActiveLink = clearActiveLinkWhen === "newly-restricted" ? becameRestricted : newRestriction.shouldRestrict;
|
|
4688
|
+
if (shouldClearActiveLink && isActive && !linkPlaceholder) {
|
|
4639
4689
|
setIsActive(false);
|
|
4640
4690
|
if (value !== null) {
|
|
4641
4691
|
setValue(null);
|
|
4642
4692
|
}
|
|
4643
4693
|
}
|
|
4644
4694
|
setLinkInLinkRestriction((prev) => isSameRestriction(prev, newRestriction) ? prev : newRestriction);
|
|
4645
|
-
}
|
|
4695
|
+
};
|
|
4696
|
+
const debouncedSyncLinkRestriction = useDebouncedCallback(
|
|
4697
|
+
(clearActiveLinkWhen = "restricted") => syncLinkRestriction(clearActiveLinkWhen),
|
|
4698
|
+
300
|
|
4699
|
+
);
|
|
4646
4700
|
useListenTo(
|
|
4647
4701
|
commandEndEvent("document/elements/set-settings"),
|
|
4648
4702
|
() => {
|
|
4649
|
-
|
|
4703
|
+
debouncedSyncLinkRestriction("newly-restricted");
|
|
4650
4704
|
},
|
|
4651
|
-
[
|
|
4705
|
+
[debouncedSyncLinkRestriction]
|
|
4652
4706
|
);
|
|
4653
4707
|
useEffect14(() => {
|
|
4654
|
-
|
|
4708
|
+
debouncedSyncLinkRestriction();
|
|
4655
4709
|
const handleInlineLinkChanged = () => {
|
|
4656
|
-
|
|
4710
|
+
debouncedSyncLinkRestriction();
|
|
4657
4711
|
};
|
|
4658
4712
|
window.addEventListener("elementor:inline-link-changed", handleInlineLinkChanged);
|
|
4659
4713
|
return () => {
|
|
4660
4714
|
window.removeEventListener("elementor:inline-link-changed", handleInlineLinkChanged);
|
|
4661
4715
|
};
|
|
4662
|
-
}, [elementId,
|
|
4716
|
+
}, [elementId, debouncedSyncLinkRestriction]);
|
|
4663
4717
|
const onEnabledChange = () => {
|
|
4664
4718
|
setLinkInLinkRestriction(getLinkInLinkRestriction(elementId, value ?? linkPlaceholder));
|
|
4665
4719
|
if (linkInLinkRestriction.shouldRestrict && !isActive) {
|
|
@@ -4904,7 +4958,7 @@ function extractChips(value) {
|
|
|
4904
4958
|
|
|
4905
4959
|
// src/controls/query-filter-repeater-control.tsx
|
|
4906
4960
|
import * as React77 from "react";
|
|
4907
|
-
import { useMemo as useMemo11, useRef as
|
|
4961
|
+
import { useMemo as useMemo11, useRef as useRef14 } from "react";
|
|
4908
4962
|
import { useSelectedElementSettings } from "@elementor/editor-elements";
|
|
4909
4963
|
import {
|
|
4910
4964
|
extractValue,
|
|
@@ -5006,7 +5060,7 @@ var ItemContent = ({
|
|
|
5006
5060
|
chipsPlaceholder
|
|
5007
5061
|
}) => {
|
|
5008
5062
|
const propContext = useBoundProp(queryFilterPropTypeUtil);
|
|
5009
|
-
const snapshotsByKeyRef =
|
|
5063
|
+
const snapshotsByKeyRef = useRef14({});
|
|
5010
5064
|
const handleValueChange = (nextValue, options, meta) => {
|
|
5011
5065
|
if (meta?.bind !== "key") {
|
|
5012
5066
|
propContext.setValue(nextValue, options, meta);
|
|
@@ -5078,7 +5132,7 @@ function getUsedKeys(items2) {
|
|
|
5078
5132
|
|
|
5079
5133
|
// src/controls/gap-control.tsx
|
|
5080
5134
|
import * as React78 from "react";
|
|
5081
|
-
import { useLayoutEffect as useLayoutEffect2, useRef as
|
|
5135
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef15, useState as useState14 } from "react";
|
|
5082
5136
|
import {
|
|
5083
5137
|
layoutDirectionPropTypeUtil,
|
|
5084
5138
|
sizePropTypeUtil as sizePropTypeUtil6
|
|
@@ -5088,7 +5142,7 @@ import { DetachIcon as DetachIcon2, LinkIcon as LinkIcon2 } from "@elementor/ico
|
|
|
5088
5142
|
import { Grid as Grid12, Stack as Stack11, Tooltip as Tooltip7 } from "@elementor/ui";
|
|
5089
5143
|
import { __ as __29 } from "@wordpress/i18n";
|
|
5090
5144
|
var GapControl = ({ label }) => {
|
|
5091
|
-
const stackRef =
|
|
5145
|
+
const stackRef = useRef15(null);
|
|
5092
5146
|
const { disabled: sizeDisabled } = useBoundProp(sizePropTypeUtil6);
|
|
5093
5147
|
const {
|
|
5094
5148
|
value: directionValue,
|
|
@@ -5107,7 +5161,7 @@ var GapControl = ({ label }) => {
|
|
|
5107
5161
|
}
|
|
5108
5162
|
return true;
|
|
5109
5163
|
};
|
|
5110
|
-
const [isLinked, setIsLinked] =
|
|
5164
|
+
const [isLinked, setIsLinked] = useState14(() => inferIsLinked());
|
|
5111
5165
|
const isCurrentlyDirection = layoutDirectionPropTypeUtil.isValid(masterValue ?? masterPlaceholder);
|
|
5112
5166
|
const activeBreakpoint = useActiveBreakpoint5();
|
|
5113
5167
|
useLayoutEffect2(() => {
|
|
@@ -5203,7 +5257,7 @@ var Control4 = ({
|
|
|
5203
5257
|
|
|
5204
5258
|
// src/controls/aspect-ratio-control.tsx
|
|
5205
5259
|
import * as React79 from "react";
|
|
5206
|
-
import { useEffect as useEffect15, useState as
|
|
5260
|
+
import { useEffect as useEffect15, useState as useState15 } from "react";
|
|
5207
5261
|
import { stringPropTypeUtil as stringPropTypeUtil13 } from "@elementor/editor-props";
|
|
5208
5262
|
import { MenuListItem as MenuListItem5 } from "@elementor/editor-ui";
|
|
5209
5263
|
import { ArrowsMoveHorizontalIcon, ArrowsMoveVerticalIcon } from "@elementor/icons";
|
|
@@ -5230,10 +5284,10 @@ var AspectRatioControl = createControl(({ label }) => {
|
|
|
5230
5284
|
const aspectRatioValue = currentPropValue ?? externalPlaceholder;
|
|
5231
5285
|
const isCustomSelected = aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue);
|
|
5232
5286
|
const [initialWidth, initialHeight] = isCustomSelected ? aspectRatioValue.split("/") : ["", ""];
|
|
5233
|
-
const [isCustom, setIsCustom] =
|
|
5234
|
-
const [customWidth, setCustomWidth] =
|
|
5235
|
-
const [customHeight, setCustomHeight] =
|
|
5236
|
-
const [selectedValue, setSelectedValue] =
|
|
5287
|
+
const [isCustom, setIsCustom] = useState15(isCustomSelected);
|
|
5288
|
+
const [customWidth, setCustomWidth] = useState15(initialWidth);
|
|
5289
|
+
const [customHeight, setCustomHeight] = useState15(initialHeight);
|
|
5290
|
+
const [selectedValue, setSelectedValue] = useState15(
|
|
5237
5291
|
isCustomSelected ? CUSTOM_RATIO : aspectRatioValue || ""
|
|
5238
5292
|
);
|
|
5239
5293
|
useEffect15(() => {
|
|
@@ -5323,7 +5377,7 @@ var AspectRatioControl = createControl(({ label }) => {
|
|
|
5323
5377
|
|
|
5324
5378
|
// src/controls/svg-media-control.tsx
|
|
5325
5379
|
import * as React88 from "react";
|
|
5326
|
-
import { useEffect as useEffect16, useRef as
|
|
5380
|
+
import { useEffect as useEffect16, useRef as useRef17, useState as useState19 } from "react";
|
|
5327
5381
|
import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
|
|
5328
5382
|
import { iconPropTypeUtil, svgSrcPropTypeUtil, urlPropTypeUtil as urlPropTypeUtil4 } from "@elementor/editor-props";
|
|
5329
5383
|
import { Box as Box20, Card as Card2, CardOverlay as CardOverlay2, Popover as Popover6, Stack as Stack17, styled as styled11, usePopupState as usePopupState10 } from "@elementor/ui";
|
|
@@ -5332,7 +5386,7 @@ import { __ as __38 } from "@wordpress/i18n";
|
|
|
5332
5386
|
|
|
5333
5387
|
// src/components/enable-unfiltered-modal.tsx
|
|
5334
5388
|
import * as React80 from "react";
|
|
5335
|
-
import { useState as
|
|
5389
|
+
import { useState as useState16 } from "react";
|
|
5336
5390
|
import {
|
|
5337
5391
|
Button as Button4,
|
|
5338
5392
|
CircularProgress as CircularProgress2,
|
|
@@ -5358,7 +5412,7 @@ var ADMIN_FAILED_CONTENT_TEXT_PT2 = __31(
|
|
|
5358
5412
|
var WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
|
|
5359
5413
|
var EnableUnfilteredModal = (props) => {
|
|
5360
5414
|
const { mutateAsync, isPending } = useUpdateUnfilteredFilesUpload();
|
|
5361
|
-
const [isError, setIsError] =
|
|
5415
|
+
const [isError, setIsError] = useState16(false);
|
|
5362
5416
|
const onClose = (enabled) => {
|
|
5363
5417
|
props.onClose(enabled);
|
|
5364
5418
|
setTimeout(() => setIsError(false), WAIT_FOR_CLOSE_TIMEOUT_MS);
|
|
@@ -5407,7 +5461,7 @@ function measureIconLibraryAnchor(container, buttonGroup) {
|
|
|
5407
5461
|
|
|
5408
5462
|
// src/controls/icon-library/icon-library-popover.tsx
|
|
5409
5463
|
import * as React85 from "react";
|
|
5410
|
-
import { useMemo as useMemo12, useState as
|
|
5464
|
+
import { useMemo as useMemo12, useState as useState18 } from "react";
|
|
5411
5465
|
import {
|
|
5412
5466
|
PopoverBody as PopoverBody2,
|
|
5413
5467
|
PopoverHeader as PopoverHeader4,
|
|
@@ -5823,7 +5877,7 @@ var renderFilterMenuItemContent = (label, Icon, selected) => /* @__PURE__ */ Rea
|
|
|
5823
5877
|
|
|
5824
5878
|
// src/controls/icon-library/icon-library-grid.tsx
|
|
5825
5879
|
import * as React83 from "react";
|
|
5826
|
-
import { useLayoutEffect as useLayoutEffect3, useRef as
|
|
5880
|
+
import { useLayoutEffect as useLayoutEffect3, useRef as useRef16, useState as useState17 } from "react";
|
|
5827
5881
|
import { Box as Box16, Tooltip as Tooltip9, useTheme as useTheme3 } from "@elementor/ui";
|
|
5828
5882
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
5829
5883
|
import { __ as __33 } from "@wordpress/i18n";
|
|
@@ -5861,12 +5915,12 @@ var IconLibraryGrid = ({
|
|
|
5861
5915
|
noResultsComponent
|
|
5862
5916
|
}) => {
|
|
5863
5917
|
const theme = useTheme3();
|
|
5864
|
-
const containerRef =
|
|
5865
|
-
const cellRefs =
|
|
5866
|
-
const shouldRestoreFocusRef =
|
|
5918
|
+
const containerRef = useRef16(null);
|
|
5919
|
+
const cellRefs = useRef16(/* @__PURE__ */ new Map());
|
|
5920
|
+
const shouldRestoreFocusRef = useRef16(false);
|
|
5867
5921
|
const selectedIndex = items2.findIndex((item) => item.id === selectedValue);
|
|
5868
|
-
const [focusedIndex, setFocusedIndex] =
|
|
5869
|
-
const [{ columnCount, cellSize }, setGridMetrics] =
|
|
5922
|
+
const [focusedIndex, setFocusedIndex] = useState17(selectedIndex >= 0 ? selectedIndex : 0);
|
|
5923
|
+
const [{ columnCount, cellSize }, setGridMetrics] = useState17(() => getGridMetrics(0, 0, 0));
|
|
5870
5924
|
const rowCount = Math.ceil(items2.length / columnCount);
|
|
5871
5925
|
const virtualizer = useVirtualizer({
|
|
5872
5926
|
count: rowCount,
|
|
@@ -6242,7 +6296,7 @@ var IconLibraryPopover = ({
|
|
|
6242
6296
|
handleChange: handleSearchChange,
|
|
6243
6297
|
setImmediateValue: setSearchValue
|
|
6244
6298
|
} = useDebounceState({ delay: ICON_LIBRARY_SEARCH_DEBOUNCE_DELAY });
|
|
6245
|
-
const [activeLibraries, setActiveLibraries] =
|
|
6299
|
+
const [activeLibraries, setActiveLibraries] = useState18([]);
|
|
6246
6300
|
const [storedView, setStoredView] = useSessionStorage2(
|
|
6247
6301
|
ICON_LIBRARY_VIEW_STORAGE_KEY,
|
|
6248
6302
|
ICON_LIBRARY_VIEW_STORAGE_PREFIX
|
|
@@ -6599,11 +6653,11 @@ var SvgMediaControl = createControl(({ showIconLibrary = false }) => {
|
|
|
6599
6653
|
const { data: attachment, isFetching } = useWpMediaAttachment2(id?.value || null);
|
|
6600
6654
|
const src = attachment?.url ?? url?.value ?? null;
|
|
6601
6655
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
6602
|
-
const [unfilteredModalOpenState, setUnfilteredModalOpenState] =
|
|
6656
|
+
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = useState19(false);
|
|
6603
6657
|
const iconLibraryPopoverState = usePopupState10({ variant: "popover" });
|
|
6604
|
-
const controlContainerRef =
|
|
6605
|
-
const buttonGroupRef =
|
|
6606
|
-
const [iconLibraryAnchor, setIconLibraryAnchor] =
|
|
6658
|
+
const controlContainerRef = useRef17(null);
|
|
6659
|
+
const buttonGroupRef = useRef17(null);
|
|
6660
|
+
const [iconLibraryAnchor, setIconLibraryAnchor] = useState19(null);
|
|
6607
6661
|
const { isAdmin } = useCurrentUserCapabilities();
|
|
6608
6662
|
const selectedIconClass = showIconLibrary && typeof iconValue?.value?.value === "string" ? iconValue.value.value : null;
|
|
6609
6663
|
const selectedIconLibrary = showIconLibrary && typeof iconValue?.library?.value === "string" ? iconValue.library.value : null;
|
|
@@ -6969,7 +7023,7 @@ var BackgroundImageOverlayAttachment = () => {
|
|
|
6969
7023
|
|
|
6970
7024
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
|
|
6971
7025
|
import * as React92 from "react";
|
|
6972
|
-
import { useRef as
|
|
7026
|
+
import { useRef as useRef18 } from "react";
|
|
6973
7027
|
import { backgroundImagePositionOffsetPropTypeUtil, stringPropTypeUtil as stringPropTypeUtil16 } from "@elementor/editor-props";
|
|
6974
7028
|
import { MenuListItem as MenuListItem6 } from "@elementor/editor-ui";
|
|
6975
7029
|
import { LetterXIcon, LetterYIcon } from "@elementor/icons";
|
|
@@ -6991,7 +7045,7 @@ var BackgroundImageOverlayPosition = () => {
|
|
|
6991
7045
|
const backgroundImageOffsetContext = useBoundProp(backgroundImagePositionOffsetPropTypeUtil);
|
|
6992
7046
|
const stringPropContext = useBoundProp(stringPropTypeUtil16);
|
|
6993
7047
|
const isCustom = !!backgroundImageOffsetContext.value;
|
|
6994
|
-
const rowRef =
|
|
7048
|
+
const rowRef = useRef18(null);
|
|
6995
7049
|
const handlePositionChange = (event) => {
|
|
6996
7050
|
const value = event.target.value || null;
|
|
6997
7051
|
if (value === "custom") {
|
|
@@ -7064,7 +7118,7 @@ var BackgroundImageOverlayRepeat = () => {
|
|
|
7064
7118
|
|
|
7065
7119
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx
|
|
7066
7120
|
import * as React94 from "react";
|
|
7067
|
-
import { useRef as
|
|
7121
|
+
import { useRef as useRef19 } from "react";
|
|
7068
7122
|
import { backgroundImageSizeScalePropTypeUtil, stringPropTypeUtil as stringPropTypeUtil17 } from "@elementor/editor-props";
|
|
7069
7123
|
import {
|
|
7070
7124
|
ArrowBarBothIcon,
|
|
@@ -7106,7 +7160,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
7106
7160
|
const backgroundImageScaleContext = useBoundProp(backgroundImageSizeScalePropTypeUtil);
|
|
7107
7161
|
const stringPropContext = useBoundProp(stringPropTypeUtil17);
|
|
7108
7162
|
const isCustom = !!backgroundImageScaleContext.value;
|
|
7109
|
-
const rowRef =
|
|
7163
|
+
const rowRef = useRef19(null);
|
|
7110
7164
|
const handleSizeChange = (size) => {
|
|
7111
7165
|
if (size === "custom") {
|
|
7112
7166
|
backgroundImageScaleContext.setValue({ width: null, height: null });
|
|
@@ -7141,7 +7195,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
7141
7195
|
};
|
|
7142
7196
|
|
|
7143
7197
|
// src/controls/background-control/background-overlay/use-background-tabs-history.ts
|
|
7144
|
-
import { useRef as
|
|
7198
|
+
import { useRef as useRef20 } from "react";
|
|
7145
7199
|
import {
|
|
7146
7200
|
backgroundColorOverlayPropTypeUtil,
|
|
7147
7201
|
backgroundGradientOverlayPropTypeUtil as backgroundGradientOverlayPropTypeUtil2,
|
|
@@ -7166,7 +7220,7 @@ var useBackgroundTabsHistory = ({
|
|
|
7166
7220
|
return "image";
|
|
7167
7221
|
};
|
|
7168
7222
|
const { getTabsProps, getTabProps, getTabPanelProps } = useTabs(getCurrentOverlayType());
|
|
7169
|
-
const valuesHistory =
|
|
7223
|
+
const valuesHistory = useRef20({
|
|
7170
7224
|
image: initialBackgroundImageOverlay,
|
|
7171
7225
|
color: initialBackgroundColorOverlay2,
|
|
7172
7226
|
gradient: initialBackgroundGradientOverlay2
|
|
@@ -7570,7 +7624,7 @@ var getAllProperties = (pattern) => {
|
|
|
7570
7624
|
|
|
7571
7625
|
// src/controls/key-value-control.tsx
|
|
7572
7626
|
import * as React98 from "react";
|
|
7573
|
-
import { useMemo as useMemo14, useState as
|
|
7627
|
+
import { useMemo as useMemo14, useState as useState20 } from "react";
|
|
7574
7628
|
import {
|
|
7575
7629
|
isTransformable,
|
|
7576
7630
|
keyValuePropTypeUtil,
|
|
@@ -7601,9 +7655,9 @@ var getInitialFieldValue = (fieldValue) => {
|
|
|
7601
7655
|
};
|
|
7602
7656
|
var KeyValueControl = createControl((props = {}) => {
|
|
7603
7657
|
const { value, setValue, ...propContext } = useBoundProp(keyValuePropTypeUtil);
|
|
7604
|
-
const [keyError, setKeyError] =
|
|
7605
|
-
const [valueError, setValueError] =
|
|
7606
|
-
const [sessionState, setSessionState] =
|
|
7658
|
+
const [keyError, setKeyError] = useState20("");
|
|
7659
|
+
const [valueError, setValueError] = useState20("");
|
|
7660
|
+
const [sessionState, setSessionState] = useState20({
|
|
7607
7661
|
key: getInitialFieldValue(value?.key),
|
|
7608
7662
|
value: getInitialFieldValue(value?.value)
|
|
7609
7663
|
});
|
|
@@ -7745,7 +7799,7 @@ var PositionControl = () => {
|
|
|
7745
7799
|
|
|
7746
7800
|
// src/controls/transform-control/transform-repeater-control.tsx
|
|
7747
7801
|
import * as React112 from "react";
|
|
7748
|
-
import { useRef as
|
|
7802
|
+
import { useRef as useRef28 } from "react";
|
|
7749
7803
|
import { transformFunctionsPropTypeUtil, transformPropTypeUtil } from "@elementor/editor-props";
|
|
7750
7804
|
import { AdjustmentsIcon as AdjustmentsIcon2, InfoCircleFilledIcon as InfoCircleFilledIcon2 } from "@elementor/icons";
|
|
7751
7805
|
import { bindTrigger as bindTrigger5, Box as Box26, IconButton as IconButton8, Tooltip as Tooltip11, Typography as Typography11, usePopupState as usePopupState11 } from "@elementor/ui";
|
|
@@ -7809,7 +7863,7 @@ import { __ as __52 } from "@wordpress/i18n";
|
|
|
7809
7863
|
|
|
7810
7864
|
// src/controls/transform-control/functions/move.tsx
|
|
7811
7865
|
import * as React101 from "react";
|
|
7812
|
-
import { useRef as
|
|
7866
|
+
import { useRef as useRef21 } from "react";
|
|
7813
7867
|
import { moveTransformPropTypeUtil } from "@elementor/editor-props";
|
|
7814
7868
|
import { ArrowDownLeftIcon, ArrowDownSmallIcon, ArrowRightIcon } from "@elementor/icons";
|
|
7815
7869
|
import { Grid as Grid22 } from "@elementor/ui";
|
|
@@ -7856,7 +7910,7 @@ var moveAxisControls = [
|
|
|
7856
7910
|
];
|
|
7857
7911
|
var Move = () => {
|
|
7858
7912
|
const context = useBoundProp(moveTransformPropTypeUtil);
|
|
7859
|
-
const rowRefs = [
|
|
7913
|
+
const rowRefs = [useRef21(null), useRef21(null), useRef21(null)];
|
|
7860
7914
|
return /* @__PURE__ */ React101.createElement(Grid22, { container: true, spacing: 1.5 }, /* @__PURE__ */ React101.createElement(PropProvider, { ...context }, /* @__PURE__ */ React101.createElement(PropKeyProvider, { bind: TransformFunctionKeys.move }, moveAxisControls.map((control, index) => /* @__PURE__ */ React101.createElement(
|
|
7861
7915
|
AxisRow,
|
|
7862
7916
|
{
|
|
@@ -7871,7 +7925,7 @@ var Move = () => {
|
|
|
7871
7925
|
|
|
7872
7926
|
// src/controls/transform-control/functions/rotate.tsx
|
|
7873
7927
|
import * as React102 from "react";
|
|
7874
|
-
import { useRef as
|
|
7928
|
+
import { useRef as useRef22 } from "react";
|
|
7875
7929
|
import { rotateTransformPropTypeUtil as rotateTransformPropTypeUtil2 } from "@elementor/editor-props";
|
|
7876
7930
|
import { Arrow360Icon, RotateClockwiseIcon } from "@elementor/icons";
|
|
7877
7931
|
import { Grid as Grid23 } from "@elementor/ui";
|
|
@@ -7896,7 +7950,7 @@ var rotateAxisControls = [
|
|
|
7896
7950
|
var rotateUnits = ["deg", "rad", "grad", "turn"];
|
|
7897
7951
|
var Rotate = () => {
|
|
7898
7952
|
const context = useBoundProp(rotateTransformPropTypeUtil2);
|
|
7899
|
-
const rowRefs = [
|
|
7953
|
+
const rowRefs = [useRef22(null), useRef22(null), useRef22(null)];
|
|
7900
7954
|
return /* @__PURE__ */ React102.createElement(Grid23, { container: true, spacing: 1.5 }, /* @__PURE__ */ React102.createElement(PropProvider, { ...context }, /* @__PURE__ */ React102.createElement(PropKeyProvider, { bind: TransformFunctionKeys.rotate }, rotateAxisControls.map((control, index) => /* @__PURE__ */ React102.createElement(
|
|
7901
7955
|
AxisRow,
|
|
7902
7956
|
{
|
|
@@ -7910,7 +7964,7 @@ var Rotate = () => {
|
|
|
7910
7964
|
|
|
7911
7965
|
// src/controls/transform-control/functions/scale.tsx
|
|
7912
7966
|
import * as React104 from "react";
|
|
7913
|
-
import { useRef as
|
|
7967
|
+
import { useRef as useRef23 } from "react";
|
|
7914
7968
|
import { scaleTransformPropTypeUtil as scaleTransformPropTypeUtil2 } from "@elementor/editor-props";
|
|
7915
7969
|
import { ArrowDownLeftIcon as ArrowDownLeftIcon2, ArrowDownSmallIcon as ArrowDownSmallIcon2, ArrowRightIcon as ArrowRightIcon2 } from "@elementor/icons";
|
|
7916
7970
|
import { Grid as Grid25 } from "@elementor/ui";
|
|
@@ -7943,13 +7997,13 @@ var scaleAxisControls = [
|
|
|
7943
7997
|
];
|
|
7944
7998
|
var Scale = () => {
|
|
7945
7999
|
const context = useBoundProp(scaleTransformPropTypeUtil2);
|
|
7946
|
-
const rowRefs = [
|
|
8000
|
+
const rowRefs = [useRef23(null), useRef23(null), useRef23(null)];
|
|
7947
8001
|
return /* @__PURE__ */ React104.createElement(Grid25, { container: true, spacing: 1.5 }, /* @__PURE__ */ React104.createElement(PropProvider, { ...context }, /* @__PURE__ */ React104.createElement(PropKeyProvider, { bind: TransformFunctionKeys.scale }, scaleAxisControls.map((control, index) => /* @__PURE__ */ React104.createElement(ScaleAxisRow, { key: control.bind, ...control, anchorRef: rowRefs[index] })))));
|
|
7948
8002
|
};
|
|
7949
8003
|
|
|
7950
8004
|
// src/controls/transform-control/functions/skew.tsx
|
|
7951
8005
|
import * as React105 from "react";
|
|
7952
|
-
import { useRef as
|
|
8006
|
+
import { useRef as useRef24 } from "react";
|
|
7953
8007
|
import { skewTransformPropTypeUtil as skewTransformPropTypeUtil2 } from "@elementor/editor-props";
|
|
7954
8008
|
import { ArrowLeftIcon, ArrowRightIcon as ArrowRightIcon3 } from "@elementor/icons";
|
|
7955
8009
|
import { Grid as Grid26 } from "@elementor/ui";
|
|
@@ -7969,7 +8023,7 @@ var skewAxisControls = [
|
|
|
7969
8023
|
var skewUnits = ["deg", "rad", "grad", "turn"];
|
|
7970
8024
|
var Skew = () => {
|
|
7971
8025
|
const context = useBoundProp(skewTransformPropTypeUtil2);
|
|
7972
|
-
const rowRefs = [
|
|
8026
|
+
const rowRefs = [useRef24(null), useRef24(null), useRef24(null)];
|
|
7973
8027
|
return /* @__PURE__ */ React105.createElement(Grid26, { container: true, spacing: 1.5 }, /* @__PURE__ */ React105.createElement(PropProvider, { ...context }, /* @__PURE__ */ React105.createElement(PropKeyProvider, { bind: TransformFunctionKeys.skew }, skewAxisControls.map((control, index) => /* @__PURE__ */ React105.createElement(
|
|
7974
8028
|
AxisRow,
|
|
7975
8029
|
{
|
|
@@ -7982,7 +8036,7 @@ var Skew = () => {
|
|
|
7982
8036
|
};
|
|
7983
8037
|
|
|
7984
8038
|
// src/controls/transform-control/use-transform-tabs-history.tsx
|
|
7985
|
-
import { useRef as
|
|
8039
|
+
import { useRef as useRef25 } from "react";
|
|
7986
8040
|
import {
|
|
7987
8041
|
moveTransformPropTypeUtil as moveTransformPropTypeUtil2,
|
|
7988
8042
|
rotateTransformPropTypeUtil as rotateTransformPropTypeUtil3,
|
|
@@ -8014,7 +8068,7 @@ var useTransformTabsHistory = ({
|
|
|
8014
8068
|
}
|
|
8015
8069
|
};
|
|
8016
8070
|
const { getTabsProps, getTabProps, getTabPanelProps } = useTabs2(getCurrentTransformType());
|
|
8017
|
-
const valuesHistory =
|
|
8071
|
+
const valuesHistory = useRef25({
|
|
8018
8072
|
move: initialMove,
|
|
8019
8073
|
scale: initialScale,
|
|
8020
8074
|
rotate: initialRotate,
|
|
@@ -8158,7 +8212,7 @@ import { __ as __56 } from "@wordpress/i18n";
|
|
|
8158
8212
|
|
|
8159
8213
|
// src/controls/transform-control/transform-base-controls/children-perspective-control.tsx
|
|
8160
8214
|
import * as React109 from "react";
|
|
8161
|
-
import { useRef as
|
|
8215
|
+
import { useRef as useRef26 } from "react";
|
|
8162
8216
|
import { perspectiveOriginPropTypeUtil } from "@elementor/editor-props";
|
|
8163
8217
|
import { Grid as Grid27, Stack as Stack19 } from "@elementor/ui";
|
|
8164
8218
|
import { __ as __54 } from "@wordpress/i18n";
|
|
@@ -8190,13 +8244,13 @@ var PerspectiveOriginControlProvider = () => {
|
|
|
8190
8244
|
return /* @__PURE__ */ React109.createElement(PropProvider, { ...context }, CHILDREN_PERSPECTIVE_FIELDS.map((control) => /* @__PURE__ */ React109.createElement(PropKeyProvider, { bind: control.bind, key: control.bind }, /* @__PURE__ */ React109.createElement(ControlFields, { control }))));
|
|
8191
8245
|
};
|
|
8192
8246
|
var ControlFields = ({ control }) => {
|
|
8193
|
-
const rowRef =
|
|
8247
|
+
const rowRef = useRef26(null);
|
|
8194
8248
|
return /* @__PURE__ */ React109.createElement(PopoverGridContainer, { ref: rowRef }, /* @__PURE__ */ React109.createElement(Grid27, { item: true, xs: 6 }, /* @__PURE__ */ React109.createElement(ControlFormLabel, null, control.label)), /* @__PURE__ */ React109.createElement(Grid27, { item: true, xs: 6 }, /* @__PURE__ */ React109.createElement(SizeControl, { variant: "length", units: control.units, anchorRef: rowRef, disableCustom: true })));
|
|
8195
8249
|
};
|
|
8196
8250
|
|
|
8197
8251
|
// src/controls/transform-control/transform-base-controls/transform-origin-control.tsx
|
|
8198
8252
|
import * as React110 from "react";
|
|
8199
|
-
import { useRef as
|
|
8253
|
+
import { useRef as useRef27 } from "react";
|
|
8200
8254
|
import { transformOriginPropTypeUtil } from "@elementor/editor-props";
|
|
8201
8255
|
import { Grid as Grid28, Stack as Stack20 } from "@elementor/ui";
|
|
8202
8256
|
import { __ as __55 } from "@wordpress/i18n";
|
|
@@ -8224,7 +8278,7 @@ var TransformOriginControl = () => {
|
|
|
8224
8278
|
};
|
|
8225
8279
|
var ControlFields2 = ({ control }) => {
|
|
8226
8280
|
const context = useBoundProp(transformOriginPropTypeUtil);
|
|
8227
|
-
const rowRef =
|
|
8281
|
+
const rowRef = useRef27(null);
|
|
8228
8282
|
return /* @__PURE__ */ React110.createElement(PropProvider, { ...context }, /* @__PURE__ */ React110.createElement(PropKeyProvider, { bind: control.bind }, /* @__PURE__ */ React110.createElement(PopoverGridContainer, { ref: rowRef }, /* @__PURE__ */ React110.createElement(Grid28, { item: true, xs: 6 }, /* @__PURE__ */ React110.createElement(ControlFormLabel, null, control.label)), /* @__PURE__ */ React110.createElement(Grid28, { item: true, xs: 6 }, /* @__PURE__ */ React110.createElement(SizeControl, { variant: "length", units: control.units, anchorRef: rowRef })))));
|
|
8229
8283
|
};
|
|
8230
8284
|
|
|
@@ -8272,7 +8326,7 @@ var SIZE11 = "tiny";
|
|
|
8272
8326
|
var TransformRepeaterControl = createControl(
|
|
8273
8327
|
({ showChildrenPerspective }) => {
|
|
8274
8328
|
const context = useBoundProp(transformPropTypeUtil);
|
|
8275
|
-
const headerRef =
|
|
8329
|
+
const headerRef = useRef28(null);
|
|
8276
8330
|
const popupState = usePopupState11({ variant: "popover" });
|
|
8277
8331
|
return /* @__PURE__ */ React112.createElement(PropProvider, { ...context }, /* @__PURE__ */ React112.createElement(
|
|
8278
8332
|
TransformSettingsControl,
|
|
@@ -8352,7 +8406,7 @@ var TransformBasePopoverTrigger = ({
|
|
|
8352
8406
|
|
|
8353
8407
|
// src/controls/transition-control/transition-repeater-control.tsx
|
|
8354
8408
|
import * as React115 from "react";
|
|
8355
|
-
import { useEffect as useEffect17, useMemo as useMemo17, useState as
|
|
8409
|
+
import { useEffect as useEffect17, useMemo as useMemo17, useState as useState21 } from "react";
|
|
8356
8410
|
import {
|
|
8357
8411
|
createArrayPropUtils as createArrayPropUtils3,
|
|
8358
8412
|
selectionSizePropTypeUtil as selectionSizePropTypeUtil2
|
|
@@ -8364,13 +8418,13 @@ import { __ as __60 } from "@wordpress/i18n";
|
|
|
8364
8418
|
|
|
8365
8419
|
// src/controls/selection-size-control.tsx
|
|
8366
8420
|
import * as React113 from "react";
|
|
8367
|
-
import { useMemo as useMemo15, useRef as
|
|
8421
|
+
import { useMemo as useMemo15, useRef as useRef29 } from "react";
|
|
8368
8422
|
import { selectionSizePropTypeUtil } from "@elementor/editor-props";
|
|
8369
8423
|
import { Grid as Grid29 } from "@elementor/ui";
|
|
8370
8424
|
var SelectionSizeControl = createControl(
|
|
8371
8425
|
({ selectionLabel, sizeLabel, selectionConfig, sizeConfigMap }) => {
|
|
8372
8426
|
const { value, setValue, propType } = useBoundProp(selectionSizePropTypeUtil);
|
|
8373
|
-
const rowRef =
|
|
8427
|
+
const rowRef = useRef29(null);
|
|
8374
8428
|
const sizeFieldId = sizeLabel.replace(/\s+/g, "-").toLowerCase();
|
|
8375
8429
|
const currentSizeConfig = useMemo15(() => {
|
|
8376
8430
|
switch (value.selection.$$type) {
|
|
@@ -8585,7 +8639,7 @@ function subscribeToTransitionEvent() {
|
|
|
8585
8639
|
|
|
8586
8640
|
// src/controls/transition-control/transition-selector.tsx
|
|
8587
8641
|
import * as React114 from "react";
|
|
8588
|
-
import { useMemo as useMemo16, useRef as
|
|
8642
|
+
import { useMemo as useMemo16, useRef as useRef30 } from "react";
|
|
8589
8643
|
import { keyValuePropTypeUtil as keyValuePropTypeUtil2 } from "@elementor/editor-props";
|
|
8590
8644
|
import { PromotionAlert, PromotionChip } from "@elementor/editor-ui";
|
|
8591
8645
|
import { ChevronDownIcon as ChevronDownIcon3, VariationsIcon } from "@elementor/icons";
|
|
@@ -8671,7 +8725,7 @@ var TransitionSelector = ({
|
|
|
8671
8725
|
const {
|
|
8672
8726
|
key: { value: transitionLabel }
|
|
8673
8727
|
} = value;
|
|
8674
|
-
const defaultRef =
|
|
8728
|
+
const defaultRef = useRef30(null);
|
|
8675
8729
|
const popoverState = usePopupState12({ variant: "popover" });
|
|
8676
8730
|
const disabledCategories = useMemo16(() => {
|
|
8677
8731
|
return new Set(
|
|
@@ -8899,7 +8953,7 @@ var TransitionRepeaterControl = createControl(
|
|
|
8899
8953
|
currentStyleState
|
|
8900
8954
|
}) => {
|
|
8901
8955
|
const currentStyleIsNormal = currentStyleState === null;
|
|
8902
|
-
const [recentlyUsedList, setRecentlyUsedList] =
|
|
8956
|
+
const [recentlyUsedList, setRecentlyUsedList] = useState21([]);
|
|
8903
8957
|
const proInstalled = hasProInstalled2();
|
|
8904
8958
|
const { value, setValue } = useBoundProp(childArrayPropTypeUtil);
|
|
8905
8959
|
const { allDisabled: disabledItems, proDisabled: proDisabledItems } = useMemo17(
|
|
@@ -9215,13 +9269,13 @@ var BoundTimeStringControl = ({ bind, ariaLabel }) => {
|
|
|
9215
9269
|
|
|
9216
9270
|
// src/controls/inline-editing-control.tsx
|
|
9217
9271
|
import * as React124 from "react";
|
|
9218
|
-
import { useCallback as useCallback4, useState as
|
|
9272
|
+
import { useCallback as useCallback4, useState as useState23 } from "react";
|
|
9219
9273
|
import { escapedHtmlPropTypeUtil as escapedHtmlPropTypeUtil2 } from "@elementor/editor-props";
|
|
9220
9274
|
import { Box as Box32 } from "@elementor/ui";
|
|
9221
9275
|
|
|
9222
9276
|
// src/components/inline-editor.tsx
|
|
9223
9277
|
import * as React121 from "react";
|
|
9224
|
-
import { useEffect as useEffect18, useRef as
|
|
9278
|
+
import { useEffect as useEffect18, useRef as useRef31 } from "react";
|
|
9225
9279
|
import { Box as Box30 } from "@elementor/ui";
|
|
9226
9280
|
import Bold from "@tiptap/extension-bold";
|
|
9227
9281
|
import Document from "@tiptap/extension-document";
|
|
@@ -9284,8 +9338,8 @@ var InlineEditor = React121.forwardRef((props, ref) => {
|
|
|
9284
9338
|
onSelectionEnd,
|
|
9285
9339
|
mountElement = null
|
|
9286
9340
|
} = props;
|
|
9287
|
-
const containerRef =
|
|
9288
|
-
const onBlurRef =
|
|
9341
|
+
const containerRef = useRef31(null);
|
|
9342
|
+
const onBlurRef = useRef31(onBlur);
|
|
9289
9343
|
onBlurRef.current = onBlur;
|
|
9290
9344
|
const documentContentSettings = !!expectedTag ? "block+" : "inline*";
|
|
9291
9345
|
const onUpdate = ({ editor: updatedEditor }) => {
|
|
@@ -9383,7 +9437,7 @@ var InlineEditor = React121.forwardRef((props, ref) => {
|
|
|
9383
9437
|
return /* @__PURE__ */ React121.createElement(Box30, { ref: containerRef, sx, className: wrapperClassName }, /* @__PURE__ */ React121.createElement(EditorContent, { ref, editor }));
|
|
9384
9438
|
});
|
|
9385
9439
|
var useOnUpdate = (callback, dependencies) => {
|
|
9386
|
-
const hasMounted =
|
|
9440
|
+
const hasMounted = useRef31(false);
|
|
9387
9441
|
useEffect18(() => {
|
|
9388
9442
|
if (hasMounted.current) {
|
|
9389
9443
|
callback();
|
|
@@ -9395,7 +9449,7 @@ var useOnUpdate = (callback, dependencies) => {
|
|
|
9395
9449
|
|
|
9396
9450
|
// src/components/inline-editor-toolbar.tsx
|
|
9397
9451
|
import * as React123 from "react";
|
|
9398
|
-
import { useEffect as useEffect20, useMemo as useMemo18, useRef as
|
|
9452
|
+
import { useEffect as useEffect20, useMemo as useMemo18, useRef as useRef33, useState as useState22 } from "react";
|
|
9399
9453
|
import { getContainer as getContainer2, getElementSetting } from "@elementor/editor-elements";
|
|
9400
9454
|
import {
|
|
9401
9455
|
BoldIcon,
|
|
@@ -9421,7 +9475,7 @@ import { __ as __64 } from "@wordpress/i18n";
|
|
|
9421
9475
|
|
|
9422
9476
|
// src/components/url-popover.tsx
|
|
9423
9477
|
import * as React122 from "react";
|
|
9424
|
-
import { useEffect as useEffect19, useRef as
|
|
9478
|
+
import { useEffect as useEffect19, useRef as useRef32 } from "react";
|
|
9425
9479
|
import { ExternalLinkIcon } from "@elementor/icons";
|
|
9426
9480
|
import { bindPopover as bindPopover8, Popover as Popover9, Stack as Stack23, TextField as TextField11, ToggleButton as ToggleButton4, Tooltip as Tooltip12 } from "@elementor/ui";
|
|
9427
9481
|
import { __ as __63 } from "@wordpress/i18n";
|
|
@@ -9434,7 +9488,7 @@ var UrlPopover = ({
|
|
|
9434
9488
|
openInNewTab,
|
|
9435
9489
|
onToggleNewTab
|
|
9436
9490
|
}) => {
|
|
9437
|
-
const inputRef =
|
|
9491
|
+
const inputRef = useRef32(null);
|
|
9438
9492
|
useEffect19(() => {
|
|
9439
9493
|
if (popupState.isOpen) {
|
|
9440
9494
|
requestAnimationFrame(() => inputRef.current?.focus());
|
|
@@ -9490,9 +9544,9 @@ var InlineEditorToolbar = ({
|
|
|
9490
9544
|
sx = {},
|
|
9491
9545
|
inControlPanel = false
|
|
9492
9546
|
}) => {
|
|
9493
|
-
const [urlValue, setUrlValue] =
|
|
9494
|
-
const [openInNewTab, setOpenInNewTab] =
|
|
9495
|
-
const toolbarRef =
|
|
9547
|
+
const [urlValue, setUrlValue] = useState22("");
|
|
9548
|
+
const [openInNewTab, setOpenInNewTab] = useState22(false);
|
|
9549
|
+
const toolbarRef = useRef33(null);
|
|
9496
9550
|
const linkPopupState = usePopupState13({ variant: "popover" });
|
|
9497
9551
|
const isElementClickable = elementId ? checkIfElementIsClickable(elementId) : false;
|
|
9498
9552
|
const editorState = useEditorState({
|
|
@@ -9717,7 +9771,7 @@ var InlineEditingControl = createControl(({ sx, attributes, props, context: { el
|
|
|
9717
9771
|
const { setValue, placeholder, value } = useBoundProp(escapedHtmlPropTypeUtil2);
|
|
9718
9772
|
const { value: rawValue } = usePropKeyContext();
|
|
9719
9773
|
const content = value ?? extractInlineHtmlContent(rawValue);
|
|
9720
|
-
const [editor, setEditor] =
|
|
9774
|
+
const [editor, setEditor] = useState23(null);
|
|
9721
9775
|
const handleChange = useCallback4(
|
|
9722
9776
|
(newValue) => {
|
|
9723
9777
|
const html = newValue ?? "";
|
|
@@ -9900,7 +9954,7 @@ function useFormFieldSuggestions(options) {
|
|
|
9900
9954
|
|
|
9901
9955
|
// src/controls/email-form-action-control/email-chips-field.tsx
|
|
9902
9956
|
import * as React125 from "react";
|
|
9903
|
-
import { useMemo as useMemo19, useState as
|
|
9957
|
+
import { useMemo as useMemo19, useState as useState24 } from "react";
|
|
9904
9958
|
import { stringArrayPropTypeUtil as stringArrayPropTypeUtil3, stringPropTypeUtil as stringPropTypeUtil23 } from "@elementor/editor-props";
|
|
9905
9959
|
import { Autocomplete as Autocomplete4, Grid as Grid32, TextField as TextField12 } from "@elementor/ui";
|
|
9906
9960
|
|
|
@@ -9938,7 +9992,7 @@ function resolveMention(raw, suggestions) {
|
|
|
9938
9992
|
}
|
|
9939
9993
|
var EmailChipsControl = createControl(({ placeholder, suggestions = [] }) => {
|
|
9940
9994
|
const { value, setValue, disabled } = useBoundProp(stringArrayPropTypeUtil3);
|
|
9941
|
-
const [inputValue, setInputValue] =
|
|
9995
|
+
const [inputValue, setInputValue] = useState24("");
|
|
9942
9996
|
const items2 = value || [];
|
|
9943
9997
|
const selectedValues = items2.map((item) => stringPropTypeUtil23.extract(item)).filter((val) => val !== null);
|
|
9944
9998
|
const suggestionOptions = useMemo19(
|
|
@@ -10121,7 +10175,7 @@ var AttachmentTypeControl = createControl(({ label, options }) => {
|
|
|
10121
10175
|
|
|
10122
10176
|
// src/controls/notice-control.tsx
|
|
10123
10177
|
import * as React130 from "react";
|
|
10124
|
-
import { useState as
|
|
10178
|
+
import { useState as useState25 } from "react";
|
|
10125
10179
|
import { ajax } from "@elementor/editor-v1-adapters";
|
|
10126
10180
|
import { BulbIcon } from "@elementor/icons";
|
|
10127
10181
|
import { Alert as Alert3, AlertAction as AlertAction2, AlertTitle as AlertTitle4, styled as styled13, Typography as Typography13 } from "@elementor/ui";
|
|
@@ -10139,7 +10193,7 @@ var markNoticeAsDismissedInSession = (dismissId) => {
|
|
|
10139
10193
|
};
|
|
10140
10194
|
var NoticeControl = createControl(
|
|
10141
10195
|
({ noticeType = "info", heading, content, dismissible, buttonText, buttonUrl }) => {
|
|
10142
|
-
const [isDismissed, setIsDismissed] =
|
|
10196
|
+
const [isDismissed, setIsDismissed] = useState25(false);
|
|
10143
10197
|
if (isDismissed || !content) {
|
|
10144
10198
|
return null;
|
|
10145
10199
|
}
|
|
@@ -10222,14 +10276,14 @@ var GridSpanControl = createControl(
|
|
|
10222
10276
|
|
|
10223
10277
|
// src/components/promotions/display-conditions-control.tsx
|
|
10224
10278
|
import * as React133 from "react";
|
|
10225
|
-
import { useRef as
|
|
10279
|
+
import { useRef as useRef34 } from "react";
|
|
10226
10280
|
import { SitemapIcon } from "@elementor/icons";
|
|
10227
10281
|
import { IconButton as IconButton10, Stack as Stack26, Tooltip as Tooltip14 } from "@elementor/ui";
|
|
10228
10282
|
import { __ as __68 } from "@wordpress/i18n";
|
|
10229
10283
|
|
|
10230
10284
|
// src/components/promotions/promotion-trigger.tsx
|
|
10231
10285
|
import * as React132 from "react";
|
|
10232
|
-
import { forwardRef as forwardRef12, useCallback as useCallback5, useImperativeHandle, useState as
|
|
10286
|
+
import { forwardRef as forwardRef12, useCallback as useCallback5, useImperativeHandle, useState as useState26 } from "react";
|
|
10233
10287
|
import { PromotionChip as PromotionChip2, PromotionInfotip } from "@elementor/editor-ui";
|
|
10234
10288
|
import { Box as Box34 } from "@elementor/ui";
|
|
10235
10289
|
function getV4Promotion(key) {
|
|
@@ -10237,7 +10291,7 @@ function getV4Promotion(key) {
|
|
|
10237
10291
|
}
|
|
10238
10292
|
var PromotionTrigger = forwardRef12(
|
|
10239
10293
|
({ promotionKey, children, trackingData }, ref) => {
|
|
10240
|
-
const [isOpen, setIsOpen] =
|
|
10294
|
+
const [isOpen, setIsOpen] = useState26(false);
|
|
10241
10295
|
const promotion = getV4Promotion(promotionKey);
|
|
10242
10296
|
const toggle = useCallback5(() => {
|
|
10243
10297
|
setIsOpen((prev) => {
|
|
@@ -10281,7 +10335,7 @@ var PromotionTrigger = forwardRef12(
|
|
|
10281
10335
|
var ARIA_LABEL = __68("Display Conditions", "elementor");
|
|
10282
10336
|
var TRACKING_DATA = { target_name: "display_conditions", location_l2: "general" };
|
|
10283
10337
|
var DisplayConditionsControl = createControl(() => {
|
|
10284
|
-
const triggerRef =
|
|
10338
|
+
const triggerRef = useRef34(null);
|
|
10285
10339
|
return /* @__PURE__ */ React133.createElement(
|
|
10286
10340
|
Stack26,
|
|
10287
10341
|
{
|
|
@@ -10313,14 +10367,14 @@ var DisplayConditionsControl = createControl(() => {
|
|
|
10313
10367
|
|
|
10314
10368
|
// src/components/promotions/attributes-control.tsx
|
|
10315
10369
|
import * as React134 from "react";
|
|
10316
|
-
import { useRef as
|
|
10370
|
+
import { useRef as useRef35 } from "react";
|
|
10317
10371
|
import { PlusIcon as PlusIcon4 } from "@elementor/icons";
|
|
10318
10372
|
import { Stack as Stack27, Tooltip as Tooltip15 } from "@elementor/ui";
|
|
10319
10373
|
import { __ as __69 } from "@wordpress/i18n";
|
|
10320
10374
|
var ARIA_LABEL2 = __69("Attributes", "elementor");
|
|
10321
10375
|
var TRACKING_DATA2 = { target_name: "attributes", location_l2: "general" };
|
|
10322
10376
|
var AttributesControl = createControl(() => {
|
|
10323
|
-
const triggerRef =
|
|
10377
|
+
const triggerRef = useRef35(null);
|
|
10324
10378
|
return /* @__PURE__ */ React134.createElement(
|
|
10325
10379
|
Stack27,
|
|
10326
10380
|
{
|
|
@@ -10357,7 +10411,7 @@ var ClearIconButton = ({ tooltipText, onClick, disabled, size = "tiny" }) => /*
|
|
|
10357
10411
|
|
|
10358
10412
|
// src/components/repeater/repeater.tsx
|
|
10359
10413
|
import * as React136 from "react";
|
|
10360
|
-
import { useEffect as useEffect21, useState as
|
|
10414
|
+
import { useEffect as useEffect21, useState as useState27 } from "react";
|
|
10361
10415
|
import { CopyIcon as CopyIcon2, EyeIcon as EyeIcon2, EyeOffIcon as EyeOffIcon2, PlusIcon as PlusIcon5, XIcon as XIcon4 } from "@elementor/icons";
|
|
10362
10416
|
import {
|
|
10363
10417
|
bindPopover as bindPopover9,
|
|
@@ -10387,7 +10441,7 @@ var Repeater3 = ({
|
|
|
10387
10441
|
isSortable = true,
|
|
10388
10442
|
adornment = ControlAdornments
|
|
10389
10443
|
}) => {
|
|
10390
|
-
const [openItem, setOpenItem] =
|
|
10444
|
+
const [openItem, setOpenItem] = useState27(initialOpenItem);
|
|
10391
10445
|
const uniqueKeys = items2.map(
|
|
10392
10446
|
(item, index) => isSortable && "getId" in itemSettings ? itemSettings.getId({ item, index }) : String(index)
|
|
10393
10447
|
);
|
|
@@ -10563,7 +10617,7 @@ var RepeaterItem = ({
|
|
|
10563
10617
|
), /* @__PURE__ */ React136.createElement(RepeaterPopover, { width: ref?.getBoundingClientRect().width, ...popoverProps, anchorEl: ref }, /* @__PURE__ */ React136.createElement(Box35, null, children({ anchorEl: ref }))));
|
|
10564
10618
|
};
|
|
10565
10619
|
var usePopover = (openOnMount, onOpen, onPopoverClose) => {
|
|
10566
|
-
const [ref, setRef] =
|
|
10620
|
+
const [ref, setRef] = useState27(null);
|
|
10567
10621
|
const popoverState = usePopupState14({ variant: "popover" });
|
|
10568
10622
|
const popoverProps = bindPopover9(popoverState);
|
|
10569
10623
|
useEffect21(() => {
|