@elementor/editor-controls 4.1.0-734 → 4.1.0-736
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +162 -158
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/control-repeater/context/repeater-context.tsx +4 -4
- package/src/components/control-repeater/items/item.tsx +2 -1
- package/src/components/inline-editor-toolbar.tsx +2 -2
- package/src/controls/font-family-control/font-family-control.tsx +2 -1
- package/src/controls/size-control.tsx +2 -2
- package/src/controls/transform-control/transform-base-controls/children-perspective-control.tsx +2 -1
- package/src/controls/transform-control/transform-base-controls/transform-origin-control.tsx +2 -1
package/dist/index.mjs
CHANGED
|
@@ -531,7 +531,7 @@ var TextAreaControl = createControl(({ placeholder, ariaLabel }) => {
|
|
|
531
531
|
|
|
532
532
|
// src/controls/size-control.tsx
|
|
533
533
|
import * as React20 from "react";
|
|
534
|
-
import { useEffect as useEffect4, useMemo as useMemo2 } from "react";
|
|
534
|
+
import { useCallback, useEffect as useEffect4, useMemo as useMemo2 } from "react";
|
|
535
535
|
import { sizePropTypeUtil as sizePropTypeUtil2 } from "@elementor/editor-props";
|
|
536
536
|
import { useActiveBreakpoint } from "@elementor/editor-responsive";
|
|
537
537
|
import { usePopupState as usePopupState2 } from "@elementor/ui";
|
|
@@ -1052,7 +1052,7 @@ var SizeControl = createControl(
|
|
|
1052
1052
|
popupState.open(anchorRef?.current);
|
|
1053
1053
|
}
|
|
1054
1054
|
};
|
|
1055
|
-
const maybeClosePopup =
|
|
1055
|
+
const maybeClosePopup = useCallback(() => {
|
|
1056
1056
|
if (popupState && popupState.isOpen) {
|
|
1057
1057
|
popupState.close();
|
|
1058
1058
|
}
|
|
@@ -1221,7 +1221,7 @@ import { __ as __5, sprintf } from "@wordpress/i18n";
|
|
|
1221
1221
|
|
|
1222
1222
|
// src/components/control-repeater/context/repeater-context.tsx
|
|
1223
1223
|
import * as React24 from "react";
|
|
1224
|
-
import { createContext as createContext7, useMemo as useMemo3, useState as useState4 } from "react";
|
|
1224
|
+
import { createContext as createContext7, useContext as useContext6, useEffect as useEffect5, useMemo as useMemo3, useState as useState4 } from "react";
|
|
1225
1225
|
import { usePopupState as usePopupState3 } from "@elementor/ui";
|
|
1226
1226
|
|
|
1227
1227
|
// src/services/event-bus.ts
|
|
@@ -1269,8 +1269,8 @@ var ItemContext = createContext6({
|
|
|
1269
1269
|
var RepeaterContext = createContext7(null);
|
|
1270
1270
|
var EMPTY_OPEN_ITEM = -1;
|
|
1271
1271
|
var useRepeaterContext = () => {
|
|
1272
|
-
const context =
|
|
1273
|
-
const itemContext =
|
|
1272
|
+
const context = useContext6(RepeaterContext);
|
|
1273
|
+
const itemContext = useContext6(ItemContext);
|
|
1274
1274
|
if (!context) {
|
|
1275
1275
|
throw new Error("useRepeaterContext must be used within a RepeaterContextProvider");
|
|
1276
1276
|
}
|
|
@@ -1292,7 +1292,7 @@ var RepeaterContextProvider = ({
|
|
|
1292
1292
|
const [uniqueKeys, setUniqueKeys] = useState4(() => {
|
|
1293
1293
|
return items2?.map(() => generateUniqueKey()) ?? [];
|
|
1294
1294
|
});
|
|
1295
|
-
|
|
1295
|
+
useEffect5(() => {
|
|
1296
1296
|
const nextLength = items2?.length ?? 0;
|
|
1297
1297
|
setUniqueKeys((prev) => {
|
|
1298
1298
|
const prevLength = prev.length;
|
|
@@ -1520,6 +1520,7 @@ var ItemsContainer = ({
|
|
|
1520
1520
|
|
|
1521
1521
|
// src/components/control-repeater/items/item.tsx
|
|
1522
1522
|
import * as React29 from "react";
|
|
1523
|
+
import { useContext as useContext8 } from "react";
|
|
1523
1524
|
import { bindTrigger as bindTrigger2 } from "@elementor/ui";
|
|
1524
1525
|
import { __ as __7 } from "@wordpress/i18n";
|
|
1525
1526
|
|
|
@@ -1569,7 +1570,7 @@ var Item = ({ Label: Label3, Icon, actions }) => {
|
|
|
1569
1570
|
value,
|
|
1570
1571
|
isItemDisabled: isItemDisabled2
|
|
1571
1572
|
} = useRepeaterContext();
|
|
1572
|
-
const repeatableContext =
|
|
1573
|
+
const repeatableContext = useContext8(RepeatableControlContext);
|
|
1573
1574
|
const disableOpen = !!repeatableContext?.props?.readOnly;
|
|
1574
1575
|
const triggerProps = bindTrigger2(popoverState);
|
|
1575
1576
|
const onClick = (ev) => {
|
|
@@ -2968,6 +2969,7 @@ function getCssDimensionProps(label, isSiteRtl) {
|
|
|
2968
2969
|
|
|
2969
2970
|
// src/controls/font-family-control/font-family-control.tsx
|
|
2970
2971
|
import * as React59 from "react";
|
|
2972
|
+
import { useMemo as useMemo6 } from "react";
|
|
2971
2973
|
import { stringPropTypeUtil as stringPropTypeUtil6 } from "@elementor/editor-props";
|
|
2972
2974
|
import { ChevronDownIcon as ChevronDownIcon2, TextIcon } from "@elementor/icons";
|
|
2973
2975
|
import { bindPopover as bindPopover4, bindTrigger as bindTrigger3, Popover as Popover4, UnstableTag as UnstableTag2, usePopupState as usePopupState5 } from "@elementor/ui";
|
|
@@ -3150,7 +3152,7 @@ var FontFamilyControl = createControl(
|
|
|
3150
3152
|
} = useBoundProp(stringPropTypeUtil6);
|
|
3151
3153
|
const popoverState = usePopupState5({ variant: "popover" });
|
|
3152
3154
|
const isShowingPlaceholder = !fontFamily && placeholder;
|
|
3153
|
-
const mapFontSubs =
|
|
3155
|
+
const mapFontSubs = useMemo6(() => {
|
|
3154
3156
|
return fontFamilies.map(({ label, fonts }) => ({
|
|
3155
3157
|
label,
|
|
3156
3158
|
items: fonts
|
|
@@ -5566,6 +5568,7 @@ import { __ as __46 } from "@wordpress/i18n";
|
|
|
5566
5568
|
|
|
5567
5569
|
// src/controls/transform-control/transform-base-controls/children-perspective-control.tsx
|
|
5568
5570
|
import * as React92 from "react";
|
|
5571
|
+
import { useRef as useRef19 } from "react";
|
|
5569
5572
|
import { perspectiveOriginPropTypeUtil } from "@elementor/editor-props";
|
|
5570
5573
|
import { Grid as Grid26, Stack as Stack15 } from "@elementor/ui";
|
|
5571
5574
|
import { __ as __44 } from "@wordpress/i18n";
|
|
@@ -5597,12 +5600,13 @@ var PerspectiveOriginControlProvider = () => {
|
|
|
5597
5600
|
return /* @__PURE__ */ React92.createElement(PropProvider, { ...context }, CHILDREN_PERSPECTIVE_FIELDS.map((control) => /* @__PURE__ */ React92.createElement(PropKeyProvider, { bind: control.bind, key: control.bind }, /* @__PURE__ */ React92.createElement(ControlFields, { control }))));
|
|
5598
5601
|
};
|
|
5599
5602
|
var ControlFields = ({ control }) => {
|
|
5600
|
-
const rowRef =
|
|
5603
|
+
const rowRef = useRef19(null);
|
|
5601
5604
|
return /* @__PURE__ */ React92.createElement(PopoverGridContainer, { ref: rowRef }, /* @__PURE__ */ React92.createElement(Grid26, { item: true, xs: 6 }, /* @__PURE__ */ React92.createElement(ControlFormLabel, null, control.label)), /* @__PURE__ */ React92.createElement(Grid26, { item: true, xs: 6 }, /* @__PURE__ */ React92.createElement(SizeControl, { variant: "length", units: control.units, anchorRef: rowRef, disableCustom: true })));
|
|
5602
5605
|
};
|
|
5603
5606
|
|
|
5604
5607
|
// src/controls/transform-control/transform-base-controls/transform-origin-control.tsx
|
|
5605
5608
|
import * as React93 from "react";
|
|
5609
|
+
import { useRef as useRef20 } from "react";
|
|
5606
5610
|
import { transformOriginPropTypeUtil } from "@elementor/editor-props";
|
|
5607
5611
|
import { Grid as Grid27, Stack as Stack16 } from "@elementor/ui";
|
|
5608
5612
|
import { __ as __45 } from "@wordpress/i18n";
|
|
@@ -5630,7 +5634,7 @@ var TransformOriginControl = () => {
|
|
|
5630
5634
|
};
|
|
5631
5635
|
var ControlFields2 = ({ control }) => {
|
|
5632
5636
|
const context = useBoundProp(transformOriginPropTypeUtil);
|
|
5633
|
-
const rowRef =
|
|
5637
|
+
const rowRef = useRef20(null);
|
|
5634
5638
|
return /* @__PURE__ */ React93.createElement(PropProvider, { ...context }, /* @__PURE__ */ React93.createElement(PropKeyProvider, { bind: control.bind }, /* @__PURE__ */ React93.createElement(PopoverGridContainer, { ref: rowRef }, /* @__PURE__ */ React93.createElement(Grid27, { item: true, xs: 6 }, /* @__PURE__ */ React93.createElement(ControlFormLabel, null, control.label)), /* @__PURE__ */ React93.createElement(Grid27, { item: true, xs: 6 }, /* @__PURE__ */ React93.createElement(SizeControl, { variant: "length", units: control.units, anchorRef: rowRef, disableCustom: true })))));
|
|
5635
5639
|
};
|
|
5636
5640
|
|
|
@@ -7760,7 +7764,7 @@ var usePopover = (openOnMount, onOpen) => {
|
|
|
7760
7764
|
|
|
7761
7765
|
// src/components/inline-editor-toolbar.tsx
|
|
7762
7766
|
import * as React115 from "react";
|
|
7763
|
-
import { useMemo as useMemo16, useRef as useRef29, useState as useState19 } from "react";
|
|
7767
|
+
import { useEffect as useEffect18, useMemo as useMemo16, useRef as useRef29, useState as useState19 } from "react";
|
|
7764
7768
|
import { getContainer, getElementSetting } from "@elementor/editor-elements";
|
|
7765
7769
|
import {
|
|
7766
7770
|
BoldIcon,
|
|
@@ -7896,7 +7900,7 @@ var InlineEditorToolbar = ({ editor, elementId, sx = {} }) => {
|
|
|
7896
7900
|
}
|
|
7897
7901
|
linkPopupState.close();
|
|
7898
7902
|
};
|
|
7899
|
-
|
|
7903
|
+
useEffect18(() => {
|
|
7900
7904
|
editor?.commands?.focus();
|
|
7901
7905
|
}, [editor]);
|
|
7902
7906
|
return /* @__PURE__ */ React115.createElement(
|