@elementor/editor-controls 0.30.0 → 0.31.0
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/CHANGELOG.md +24 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +104 -71
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +75 -42
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -5
- package/src/components/text-field-inner-selection.tsx +3 -0
- package/src/controls/background-control/background-control.tsx +10 -1
- package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +6 -6
- package/src/controls/box-shadow-repeater-control.tsx +1 -15
- package/src/controls/color-control.tsx +34 -11
- package/src/controls/size-control.tsx +31 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @elementor/editor-controls
|
|
2
2
|
|
|
3
|
+
## 0.31.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7c8df3b: Fix color picker to open aligned with the overlay popover.
|
|
8
|
+
- 97fbdf0: Add keyboard-based unit switching to size control
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- 27c4c1f: Added a separated style inheritance indicator to background-color
|
|
13
|
+
- Updated dependencies [89dfaf2]
|
|
14
|
+
- Updated dependencies [27c4c1f]
|
|
15
|
+
- @elementor/editor-current-user@0.4.0
|
|
16
|
+
- @elementor/editor-props@0.12.1
|
|
17
|
+
- @elementor/editor-elements@0.8.4
|
|
18
|
+
|
|
19
|
+
## 0.30.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [bde1731]
|
|
24
|
+
- @elementor/editor-ui@0.8.2
|
|
25
|
+
- @elementor/editor-elements@0.8.3
|
|
26
|
+
|
|
3
27
|
## 0.30.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -49,8 +49,9 @@ declare const SelectControl: ControlComponent<({ options, onChange }: Props$5) =
|
|
|
49
49
|
|
|
50
50
|
type Props$4 = Partial<Omit<UnstableColorFieldProps, 'value' | 'onChange'>> & {
|
|
51
51
|
propTypeUtil?: PropTypeUtil<string, string>;
|
|
52
|
+
anchorEl?: HTMLElement | null;
|
|
52
53
|
};
|
|
53
|
-
declare const ColorControl: ControlComponent<({ propTypeUtil, ...props }: Props$4) => React.JSX.Element>;
|
|
54
|
+
declare const ColorControl: ControlComponent<({ propTypeUtil, anchorEl, slotProps, ...props }: Props$4) => React.JSX.Element>;
|
|
54
55
|
|
|
55
56
|
type RenderContentProps = {
|
|
56
57
|
size: ToggleButtonProps['size'];
|
package/dist/index.d.ts
CHANGED
|
@@ -49,8 +49,9 @@ declare const SelectControl: ControlComponent<({ options, onChange }: Props$5) =
|
|
|
49
49
|
|
|
50
50
|
type Props$4 = Partial<Omit<UnstableColorFieldProps, 'value' | 'onChange'>> & {
|
|
51
51
|
propTypeUtil?: PropTypeUtil<string, string>;
|
|
52
|
+
anchorEl?: HTMLElement | null;
|
|
52
53
|
};
|
|
53
|
-
declare const ColorControl: ControlComponent<({ propTypeUtil, ...props }: Props$4) => React.JSX.Element>;
|
|
54
|
+
declare const ColorControl: ControlComponent<({ propTypeUtil, anchorEl, slotProps, ...props }: Props$4) => React.JSX.Element>;
|
|
54
55
|
|
|
55
56
|
type RenderContentProps = {
|
|
56
57
|
size: ToggleButtonProps['size'];
|
package/dist/index.js
CHANGED
|
@@ -500,6 +500,7 @@ var TextAreaControl = createControl(({ placeholder }) => {
|
|
|
500
500
|
|
|
501
501
|
// src/controls/size-control.tsx
|
|
502
502
|
var React14 = __toESM(require("react"));
|
|
503
|
+
var import_react8 = require("react");
|
|
503
504
|
var import_editor_props6 = require("@elementor/editor-props");
|
|
504
505
|
var import_ui10 = require("@elementor/ui");
|
|
505
506
|
|
|
@@ -516,6 +517,7 @@ var TextFieldInnerSelection = (0, import_react6.forwardRef)(
|
|
|
516
517
|
onChange,
|
|
517
518
|
onBlur,
|
|
518
519
|
onKeyDown,
|
|
520
|
+
onKeyUp,
|
|
519
521
|
endAdornment,
|
|
520
522
|
startAdornment
|
|
521
523
|
}, ref) => {
|
|
@@ -529,6 +531,7 @@ var TextFieldInnerSelection = (0, import_react6.forwardRef)(
|
|
|
529
531
|
value,
|
|
530
532
|
onChange,
|
|
531
533
|
onKeyDown,
|
|
534
|
+
onKeyUp,
|
|
532
535
|
onBlur,
|
|
533
536
|
placeholder,
|
|
534
537
|
InputProps: {
|
|
@@ -672,6 +675,21 @@ var SizeInput = ({
|
|
|
672
675
|
size,
|
|
673
676
|
unit
|
|
674
677
|
}) => {
|
|
678
|
+
const unitInputBufferRef = (0, import_react8.useRef)("");
|
|
679
|
+
const handleKeyUp = (event) => {
|
|
680
|
+
const { key } = event;
|
|
681
|
+
if (!/^[a-zA-Z%]$/.test(key)) {
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
event.preventDefault();
|
|
685
|
+
const newChar = key.toLowerCase();
|
|
686
|
+
const updatedBuffer = (unitInputBufferRef.current + newChar).slice(-3);
|
|
687
|
+
unitInputBufferRef.current = updatedBuffer;
|
|
688
|
+
const matchedUnit = units2.find((u) => u.includes(updatedBuffer)) || units2.find((u) => u.startsWith(newChar)) || units2.find((u) => u.includes(newChar));
|
|
689
|
+
if (matchedUnit) {
|
|
690
|
+
handleUnitChange(matchedUnit);
|
|
691
|
+
}
|
|
692
|
+
};
|
|
675
693
|
return /* @__PURE__ */ React14.createElement(ControlActions, null, /* @__PURE__ */ React14.createElement(
|
|
676
694
|
TextFieldInnerSelection,
|
|
677
695
|
{
|
|
@@ -688,12 +706,16 @@ var SizeInput = ({
|
|
|
688
706
|
type: "number",
|
|
689
707
|
value: Number.isNaN(size) ? "" : size,
|
|
690
708
|
onChange: handleSizeChange,
|
|
691
|
-
onBlur
|
|
709
|
+
onBlur: (event) => {
|
|
710
|
+
unitInputBufferRef.current = "";
|
|
711
|
+
onBlur?.(event);
|
|
712
|
+
},
|
|
692
713
|
onKeyDown: (event) => {
|
|
693
714
|
if (RESTRICTED_INPUT_KEYS.includes(event.key)) {
|
|
694
715
|
event.preventDefault();
|
|
695
716
|
}
|
|
696
|
-
}
|
|
717
|
+
},
|
|
718
|
+
onKeyUp: handleKeyUp
|
|
697
719
|
}
|
|
698
720
|
));
|
|
699
721
|
};
|
|
@@ -713,13 +735,38 @@ var SectionContent = ({ gap = 2, sx, children }) => /* @__PURE__ */ React15.crea
|
|
|
713
735
|
var React16 = __toESM(require("react"));
|
|
714
736
|
var import_editor_props7 = require("@elementor/editor-props");
|
|
715
737
|
var import_ui12 = require("@elementor/ui");
|
|
716
|
-
var ColorControl = createControl(
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
738
|
+
var ColorControl = createControl(
|
|
739
|
+
({ propTypeUtil = import_editor_props7.colorPropTypeUtil, anchorEl, slotProps = {}, ...props }) => {
|
|
740
|
+
const { value, setValue } = useBoundProp(propTypeUtil);
|
|
741
|
+
const handleChange = (selectedColor) => {
|
|
742
|
+
setValue(selectedColor || null);
|
|
743
|
+
};
|
|
744
|
+
return /* @__PURE__ */ React16.createElement(ControlActions, null, /* @__PURE__ */ React16.createElement(
|
|
745
|
+
import_ui12.UnstableColorField,
|
|
746
|
+
{
|
|
747
|
+
size: "tiny",
|
|
748
|
+
fullWidth: true,
|
|
749
|
+
value: value ?? "",
|
|
750
|
+
onChange: handleChange,
|
|
751
|
+
...props,
|
|
752
|
+
slotProps: {
|
|
753
|
+
...slotProps,
|
|
754
|
+
colorPicker: {
|
|
755
|
+
anchorEl,
|
|
756
|
+
anchorOrigin: {
|
|
757
|
+
vertical: "top",
|
|
758
|
+
horizontal: "right"
|
|
759
|
+
},
|
|
760
|
+
transformOrigin: {
|
|
761
|
+
vertical: "top",
|
|
762
|
+
horizontal: -10
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
));
|
|
768
|
+
}
|
|
769
|
+
);
|
|
723
770
|
|
|
724
771
|
// src/controls/stroke-control.tsx
|
|
725
772
|
var units = ["px", "em", "rem"];
|
|
@@ -752,7 +799,7 @@ var PopoverGridContainer = ({
|
|
|
752
799
|
|
|
753
800
|
// src/components/repeater.tsx
|
|
754
801
|
var React23 = __toESM(require("react"));
|
|
755
|
-
var
|
|
802
|
+
var import_react10 = require("react");
|
|
756
803
|
var import_icons3 = require("@elementor/icons");
|
|
757
804
|
var import_ui17 = require("@elementor/ui");
|
|
758
805
|
var import_i18n4 = require("@wordpress/i18n");
|
|
@@ -762,11 +809,11 @@ var React21 = __toESM(require("react"));
|
|
|
762
809
|
|
|
763
810
|
// src/control-adornments/control-adornments-context.tsx
|
|
764
811
|
var React20 = __toESM(require("react"));
|
|
765
|
-
var
|
|
766
|
-
var Context2 = (0,
|
|
812
|
+
var import_react9 = require("react");
|
|
813
|
+
var Context2 = (0, import_react9.createContext)(null);
|
|
767
814
|
var ControlAdornmentsProvider = ({ children, items }) => /* @__PURE__ */ React20.createElement(Context2.Provider, { value: { items } }, children);
|
|
768
815
|
var useControlAdornments = () => {
|
|
769
|
-
const context = (0,
|
|
816
|
+
const context = (0, import_react9.useContext)(Context2);
|
|
770
817
|
return context?.items ?? [];
|
|
771
818
|
};
|
|
772
819
|
|
|
@@ -867,14 +914,14 @@ var Repeater = ({
|
|
|
867
914
|
values: repeaterValues = [],
|
|
868
915
|
setValues: setRepeaterValues
|
|
869
916
|
}) => {
|
|
870
|
-
const [openItem, setOpenItem] = (0,
|
|
917
|
+
const [openItem, setOpenItem] = (0, import_react10.useState)(EMPTY_OPEN_ITEM);
|
|
871
918
|
const [items, setItems] = useSyncExternalState({
|
|
872
919
|
external: repeaterValues,
|
|
873
920
|
// @ts-expect-error - as long as persistWhen => true, value will never be null
|
|
874
921
|
setExternal: setRepeaterValues,
|
|
875
922
|
persistWhen: () => true
|
|
876
923
|
});
|
|
877
|
-
const [uniqueKeys, setUniqueKeys] = (0,
|
|
924
|
+
const [uniqueKeys, setUniqueKeys] = (0, import_react10.useState)(items.map((_, index) => index));
|
|
878
925
|
const generateNextKey = (source) => {
|
|
879
926
|
return 1 + Math.max(0, ...source);
|
|
880
927
|
};
|
|
@@ -984,7 +1031,7 @@ var RepeaterItem = ({
|
|
|
984
1031
|
openOnMount,
|
|
985
1032
|
onOpen
|
|
986
1033
|
}) => {
|
|
987
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
1034
|
+
const [anchorEl, setAnchorEl] = (0, import_react10.useState)(null);
|
|
988
1035
|
const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, onOpen);
|
|
989
1036
|
const duplicateLabel = (0, import_i18n4.__)("Duplicate", "elementor");
|
|
990
1037
|
const toggleLabel = disabled ? (0, import_i18n4.__)("Show", "elementor") : (0, import_i18n4.__)("Hide", "elementor");
|
|
@@ -1020,10 +1067,10 @@ var RepeaterItem = ({
|
|
|
1020
1067
|
));
|
|
1021
1068
|
};
|
|
1022
1069
|
var usePopover = (openOnMount, onOpen) => {
|
|
1023
|
-
const [ref, setRef] = (0,
|
|
1070
|
+
const [ref, setRef] = (0, import_react10.useState)(null);
|
|
1024
1071
|
const popoverState = (0, import_ui17.usePopupState)({ variant: "popover" });
|
|
1025
1072
|
const popoverProps = (0, import_ui17.bindPopover)(popoverState);
|
|
1026
|
-
(0,
|
|
1073
|
+
(0, import_react10.useEffect)(() => {
|
|
1027
1074
|
if (openOnMount && ref) {
|
|
1028
1075
|
popoverState.open(ref);
|
|
1029
1076
|
onOpen?.();
|
|
@@ -1062,24 +1109,7 @@ var ItemContent = ({ anchorEl, bind }) => {
|
|
|
1062
1109
|
};
|
|
1063
1110
|
var Content = ({ anchorEl }) => {
|
|
1064
1111
|
const { propType, value, setValue } = useBoundProp(import_editor_props9.shadowPropTypeUtil);
|
|
1065
|
-
return /* @__PURE__ */ React24.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React24.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React24.createElement(PopoverGridContainer, null, /* @__PURE__ */ React24.createElement(Control2, { bind: "color", label: (0, import_i18n5.__)("Color", "elementor") }, /* @__PURE__ */ React24.createElement(
|
|
1066
|
-
ColorControl,
|
|
1067
|
-
{
|
|
1068
|
-
slotProps: {
|
|
1069
|
-
colorPicker: {
|
|
1070
|
-
anchorEl,
|
|
1071
|
-
anchorOrigin: {
|
|
1072
|
-
vertical: "top",
|
|
1073
|
-
horizontal: "right"
|
|
1074
|
-
},
|
|
1075
|
-
transformOrigin: {
|
|
1076
|
-
vertical: "top",
|
|
1077
|
-
horizontal: -10
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
)), /* @__PURE__ */ React24.createElement(Control2, { bind: "position", label: (0, import_i18n5.__)("Position", "elementor"), sx: { overflow: "hidden" } }, /* @__PURE__ */ React24.createElement(
|
|
1112
|
+
return /* @__PURE__ */ React24.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React24.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React24.createElement(PopoverGridContainer, null, /* @__PURE__ */ React24.createElement(Control2, { bind: "color", label: (0, import_i18n5.__)("Color", "elementor") }, /* @__PURE__ */ React24.createElement(ColorControl, { anchorEl })), /* @__PURE__ */ React24.createElement(Control2, { bind: "position", label: (0, import_i18n5.__)("Position", "elementor"), sx: { overflow: "hidden" } }, /* @__PURE__ */ React24.createElement(
|
|
1083
1113
|
SelectControl,
|
|
1084
1114
|
{
|
|
1085
1115
|
options: [
|
|
@@ -1143,7 +1173,7 @@ var import_editor_props10 = require("@elementor/editor-props");
|
|
|
1143
1173
|
|
|
1144
1174
|
// src/components/control-toggle-button-group.tsx
|
|
1145
1175
|
var React26 = __toESM(require("react"));
|
|
1146
|
-
var
|
|
1176
|
+
var import_react11 = require("react");
|
|
1147
1177
|
var import_icons4 = require("@elementor/icons");
|
|
1148
1178
|
var import_ui20 = require("@elementor/ui");
|
|
1149
1179
|
|
|
@@ -1191,7 +1221,7 @@ var ControlToggleButtonGroup = ({
|
|
|
1191
1221
|
const handleChange = (_, newValue) => {
|
|
1192
1222
|
onChange(newValue);
|
|
1193
1223
|
};
|
|
1194
|
-
const getGridTemplateColumns = (0,
|
|
1224
|
+
const getGridTemplateColumns = (0, import_react11.useMemo)(() => {
|
|
1195
1225
|
const isOffLimits = menuItems?.length;
|
|
1196
1226
|
const itemsCount = isOffLimits ? fixedItems.length + 1 : fixedItems.length;
|
|
1197
1227
|
const templateColumnsSuffix = isOffLimits ? "auto" : "";
|
|
@@ -1240,8 +1270,8 @@ var SplitButtonGroup = ({
|
|
|
1240
1270
|
value
|
|
1241
1271
|
}) => {
|
|
1242
1272
|
const previewButton = usePreviewButton(items, value);
|
|
1243
|
-
const [isMenuOpen, setIsMenuOpen] = (0,
|
|
1244
|
-
const menuButtonRef = (0,
|
|
1273
|
+
const [isMenuOpen, setIsMenuOpen] = (0, import_react11.useState)(false);
|
|
1274
|
+
const menuButtonRef = (0, import_react11.useRef)(null);
|
|
1245
1275
|
const onMenuToggle = (ev) => {
|
|
1246
1276
|
setIsMenuOpen((prev) => !prev);
|
|
1247
1277
|
ev.preventDefault();
|
|
@@ -1310,10 +1340,10 @@ var SplitButtonGroup = ({
|
|
|
1310
1340
|
));
|
|
1311
1341
|
};
|
|
1312
1342
|
var usePreviewButton = (items, value) => {
|
|
1313
|
-
const [previewButton, setPreviewButton] = (0,
|
|
1343
|
+
const [previewButton, setPreviewButton] = (0, import_react11.useState)(
|
|
1314
1344
|
items.find((item) => item.value === value) ?? items[0]
|
|
1315
1345
|
);
|
|
1316
|
-
(0,
|
|
1346
|
+
(0, import_react11.useEffect)(() => {
|
|
1317
1347
|
const selectedButton = items.find((item) => item.value === value);
|
|
1318
1348
|
if (selectedButton) {
|
|
1319
1349
|
setPreviewButton(selectedButton);
|
|
@@ -1411,7 +1441,7 @@ var NumberControl = createControl(
|
|
|
1411
1441
|
|
|
1412
1442
|
// src/controls/equal-unequal-sizes-control.tsx
|
|
1413
1443
|
var React30 = __toESM(require("react"));
|
|
1414
|
-
var
|
|
1444
|
+
var import_react12 = require("react");
|
|
1415
1445
|
var import_editor_props12 = require("@elementor/editor-props");
|
|
1416
1446
|
var import_ui23 = require("@elementor/ui");
|
|
1417
1447
|
var import_i18n6 = require("@wordpress/i18n");
|
|
@@ -1441,8 +1471,8 @@ function EqualUnequalSizesControl({
|
|
|
1441
1471
|
items,
|
|
1442
1472
|
multiSizePropTypeUtil
|
|
1443
1473
|
}) {
|
|
1444
|
-
const popupId = (0,
|
|
1445
|
-
const controlRef = (0,
|
|
1474
|
+
const popupId = (0, import_react12.useId)();
|
|
1475
|
+
const controlRef = (0, import_react12.useRef)(null);
|
|
1446
1476
|
const popupState = (0, import_ui23.usePopupState)({ variant: "popover", popupId });
|
|
1447
1477
|
const {
|
|
1448
1478
|
propType: multiSizePropType,
|
|
@@ -1607,7 +1637,7 @@ var Control3 = ({
|
|
|
1607
1637
|
|
|
1608
1638
|
// src/controls/font-family-control/font-family-control.tsx
|
|
1609
1639
|
var React32 = __toESM(require("react"));
|
|
1610
|
-
var
|
|
1640
|
+
var import_react13 = require("react");
|
|
1611
1641
|
var import_editor_props14 = require("@elementor/editor-props");
|
|
1612
1642
|
var import_icons6 = require("@elementor/icons");
|
|
1613
1643
|
var import_ui25 = require("@elementor/ui");
|
|
@@ -1640,7 +1670,7 @@ var enqueueFont = (fontFamily, context = "editor") => {
|
|
|
1640
1670
|
// src/controls/font-family-control/font-family-control.tsx
|
|
1641
1671
|
var SIZE2 = "tiny";
|
|
1642
1672
|
var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
1643
|
-
const [searchValue, setSearchValue] = (0,
|
|
1673
|
+
const [searchValue, setSearchValue] = (0, import_react13.useState)("");
|
|
1644
1674
|
const { value: fontFamily, setValue: setFontFamily } = useBoundProp(import_editor_props14.stringPropTypeUtil);
|
|
1645
1675
|
const popoverState = (0, import_ui25.usePopupState)({ variant: "popover" });
|
|
1646
1676
|
const filteredFontFamilies = useFilteredFontFamilies(fontFamilies, searchValue);
|
|
@@ -1725,7 +1755,7 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1725
1755
|
var LIST_ITEM_HEIGHT = 36;
|
|
1726
1756
|
var LIST_ITEMS_BUFFER = 6;
|
|
1727
1757
|
var FontList = ({ fontListItems, setFontFamily, handleClose, fontFamily }) => {
|
|
1728
|
-
const containerRef = (0,
|
|
1758
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
1729
1759
|
const selectedItem = fontListItems.find((item) => item.value === fontFamily);
|
|
1730
1760
|
const debouncedVirtualizeChange = useDebounce(({ getVirtualIndexes }) => {
|
|
1731
1761
|
getVirtualIndexes().forEach((index) => {
|
|
@@ -1742,7 +1772,7 @@ var FontList = ({ fontListItems, setFontFamily, handleClose, fontFamily }) => {
|
|
|
1742
1772
|
overscan: LIST_ITEMS_BUFFER,
|
|
1743
1773
|
onChange: debouncedVirtualizeChange
|
|
1744
1774
|
});
|
|
1745
|
-
(0,
|
|
1775
|
+
(0, import_react13.useEffect)(
|
|
1746
1776
|
() => {
|
|
1747
1777
|
virtualizer.scrollToIndex(fontListItems.findIndex((item) => item.value === fontFamily));
|
|
1748
1778
|
},
|
|
@@ -1850,8 +1880,8 @@ var StyledMenuList = (0, import_ui25.styled)(import_ui25.MenuList)(({ theme }) =
|
|
|
1850
1880
|
position: "relative"
|
|
1851
1881
|
}));
|
|
1852
1882
|
var useDebounce = (fn, delay) => {
|
|
1853
|
-
const [debouncedFn] = (0,
|
|
1854
|
-
(0,
|
|
1883
|
+
const [debouncedFn] = (0, import_react13.useState)(() => (0, import_utils2.debounce)(fn, delay));
|
|
1884
|
+
(0, import_react13.useEffect)(() => () => debouncedFn.cancel(), [debouncedFn]);
|
|
1855
1885
|
return debouncedFn;
|
|
1856
1886
|
};
|
|
1857
1887
|
|
|
@@ -1876,7 +1906,7 @@ var UrlControl = createControl(({ placeholder }) => {
|
|
|
1876
1906
|
|
|
1877
1907
|
// src/controls/link-control.tsx
|
|
1878
1908
|
var React35 = __toESM(require("react"));
|
|
1879
|
-
var
|
|
1909
|
+
var import_react15 = require("react");
|
|
1880
1910
|
var import_editor_elements = require("@elementor/editor-elements");
|
|
1881
1911
|
var import_editor_props16 = require("@elementor/editor-props");
|
|
1882
1912
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
@@ -1889,10 +1919,10 @@ var import_i18n9 = require("@wordpress/i18n");
|
|
|
1889
1919
|
|
|
1890
1920
|
// src/components/autocomplete.tsx
|
|
1891
1921
|
var React34 = __toESM(require("react"));
|
|
1892
|
-
var
|
|
1922
|
+
var import_react14 = require("react");
|
|
1893
1923
|
var import_icons7 = require("@elementor/icons");
|
|
1894
1924
|
var import_ui27 = require("@elementor/ui");
|
|
1895
|
-
var Autocomplete = (0,
|
|
1925
|
+
var Autocomplete = (0, import_react14.forwardRef)((props, ref) => {
|
|
1896
1926
|
const {
|
|
1897
1927
|
options,
|
|
1898
1928
|
onOptionChange,
|
|
@@ -2002,7 +2032,7 @@ var learnMoreButton = {
|
|
|
2002
2032
|
var LinkControl = createControl((props) => {
|
|
2003
2033
|
const { value, path, setValue, ...propContext } = useBoundProp(import_editor_props16.linkPropTypeUtil);
|
|
2004
2034
|
const [linkSessionValue, setLinkSessionValue] = (0, import_session.useSessionStorage)(path.join("/"));
|
|
2005
|
-
const [isActive, setIsActive] = (0,
|
|
2035
|
+
const [isActive, setIsActive] = (0, import_react15.useState)(!!value);
|
|
2006
2036
|
const {
|
|
2007
2037
|
allowCustomValues,
|
|
2008
2038
|
queryOptions: { endpoint = "", requestParams = {} },
|
|
@@ -2010,8 +2040,8 @@ var LinkControl = createControl((props) => {
|
|
|
2010
2040
|
minInputLength = 2,
|
|
2011
2041
|
context: { elementId }
|
|
2012
2042
|
} = props || {};
|
|
2013
|
-
const [linkInLinkRestriction, setLinkInLinkRestriction] = (0,
|
|
2014
|
-
const [options, setOptions] = (0,
|
|
2043
|
+
const [linkInLinkRestriction, setLinkInLinkRestriction] = (0, import_react15.useState)((0, import_editor_elements.getLinkInLinkRestriction)(elementId));
|
|
2044
|
+
const [options, setOptions] = (0, import_react15.useState)(
|
|
2015
2045
|
generateFirstLoadedOption(value)
|
|
2016
2046
|
);
|
|
2017
2047
|
const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
|
|
@@ -2062,7 +2092,7 @@ var LinkControl = createControl((props) => {
|
|
|
2062
2092
|
}
|
|
2063
2093
|
debounceFetch({ ...requestParams, term: newValue });
|
|
2064
2094
|
};
|
|
2065
|
-
const debounceFetch = (0,
|
|
2095
|
+
const debounceFetch = (0, import_react15.useMemo)(
|
|
2066
2096
|
() => (0, import_utils3.debounce)(
|
|
2067
2097
|
(params) => fetchOptions(endpoint, params).then((newOptions) => {
|
|
2068
2098
|
setOptions(formatOptions(newOptions));
|
|
@@ -2230,7 +2260,7 @@ var Control4 = ({ bind, isLinked }) => {
|
|
|
2230
2260
|
|
|
2231
2261
|
// src/controls/svg-media-control.tsx
|
|
2232
2262
|
var React38 = __toESM(require("react"));
|
|
2233
|
-
var
|
|
2263
|
+
var import_react17 = require("react");
|
|
2234
2264
|
var import_editor_props18 = require("@elementor/editor-props");
|
|
2235
2265
|
var import_icons10 = require("@elementor/icons");
|
|
2236
2266
|
var import_ui31 = require("@elementor/ui");
|
|
@@ -2239,7 +2269,7 @@ var import_i18n12 = require("@wordpress/i18n");
|
|
|
2239
2269
|
|
|
2240
2270
|
// src/components/enable-unfiltered-modal.tsx
|
|
2241
2271
|
var React37 = __toESM(require("react"));
|
|
2242
|
-
var
|
|
2272
|
+
var import_react16 = require("react");
|
|
2243
2273
|
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
2244
2274
|
var import_ui30 = require("@elementor/ui");
|
|
2245
2275
|
var import_i18n11 = require("@wordpress/i18n");
|
|
@@ -2262,7 +2292,7 @@ var WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
|
|
|
2262
2292
|
var EnableUnfilteredModal = (props) => {
|
|
2263
2293
|
const { mutateAsync, isPending } = useUpdateUnfilteredFilesUpload();
|
|
2264
2294
|
const { canUser } = (0, import_editor_current_user.useCurrentUserCapabilities)();
|
|
2265
|
-
const [isError, setIsError] = (0,
|
|
2295
|
+
const [isError, setIsError] = (0, import_react16.useState)(false);
|
|
2266
2296
|
const canManageOptions = canUser("manage_options");
|
|
2267
2297
|
const onClose = (enabled) => {
|
|
2268
2298
|
props.onClose(enabled);
|
|
@@ -2327,7 +2357,7 @@ var SvgMediaControl = createControl(() => {
|
|
|
2327
2357
|
const { data: attachment, isFetching } = (0, import_wp_media2.useWpMediaAttachment)(id?.value || null);
|
|
2328
2358
|
const src = attachment?.url ?? url?.value ?? null;
|
|
2329
2359
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
2330
|
-
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = (0,
|
|
2360
|
+
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = (0, import_react17.useState)(false);
|
|
2331
2361
|
const { open } = (0, import_wp_media2.useWpMediaFrame)({
|
|
2332
2362
|
mediaTypes: ["svg"],
|
|
2333
2363
|
multiple: false,
|
|
@@ -2398,6 +2428,7 @@ var SvgMediaControl = createControl(() => {
|
|
|
2398
2428
|
// src/controls/background-control/background-control.tsx
|
|
2399
2429
|
var React45 = __toESM(require("react"));
|
|
2400
2430
|
var import_editor_props24 = require("@elementor/editor-props");
|
|
2431
|
+
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
2401
2432
|
var import_ui39 = require("@elementor/ui");
|
|
2402
2433
|
var import_i18n18 = require("@wordpress/i18n");
|
|
2403
2434
|
|
|
@@ -2645,7 +2676,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
2645
2676
|
};
|
|
2646
2677
|
|
|
2647
2678
|
// src/controls/background-control/background-overlay/use-background-tabs-history.ts
|
|
2648
|
-
var
|
|
2679
|
+
var import_react18 = require("react");
|
|
2649
2680
|
var import_editor_props22 = require("@elementor/editor-props");
|
|
2650
2681
|
var import_ui37 = require("@elementor/ui");
|
|
2651
2682
|
var useBackgroundTabsHistory = ({
|
|
@@ -2666,7 +2697,7 @@ var useBackgroundTabsHistory = ({
|
|
|
2666
2697
|
return "image";
|
|
2667
2698
|
};
|
|
2668
2699
|
const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui37.useTabs)(getCurrentOverlayType());
|
|
2669
|
-
const valuesHistory = (0,
|
|
2700
|
+
const valuesHistory = (0, import_react18.useRef)({
|
|
2670
2701
|
image: initialBackgroundImageOverlay,
|
|
2671
2702
|
color: initialBackgroundColorOverlay2,
|
|
2672
2703
|
gradient: initialBackgroundGradientOverlay2
|
|
@@ -2757,10 +2788,10 @@ var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
|
2757
2788
|
}
|
|
2758
2789
|
));
|
|
2759
2790
|
});
|
|
2760
|
-
var ItemContent2 = ({ bind }) => {
|
|
2761
|
-
return /* @__PURE__ */ React44.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React44.createElement(Content2,
|
|
2791
|
+
var ItemContent2 = ({ anchorEl = null, bind }) => {
|
|
2792
|
+
return /* @__PURE__ */ React44.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React44.createElement(Content2, { anchorEl }));
|
|
2762
2793
|
};
|
|
2763
|
-
var Content2 = () => {
|
|
2794
|
+
var Content2 = ({ anchorEl }) => {
|
|
2764
2795
|
const { getTabsProps, getTabProps, getTabPanelProps } = useBackgroundTabsHistory({
|
|
2765
2796
|
image: getInitialBackgroundOverlay().value,
|
|
2766
2797
|
color: initialBackgroundColorOverlay.value,
|
|
@@ -2777,7 +2808,7 @@ var Content2 = () => {
|
|
|
2777
2808
|
/* @__PURE__ */ React44.createElement(import_ui38.Tab, { label: (0, import_i18n17.__)("Image", "elementor"), ...getTabProps("image") }),
|
|
2778
2809
|
/* @__PURE__ */ React44.createElement(import_ui38.Tab, { label: (0, import_i18n17.__)("Gradient", "elementor"), ...getTabProps("gradient") }),
|
|
2779
2810
|
/* @__PURE__ */ React44.createElement(import_ui38.Tab, { label: (0, import_i18n17.__)("Color", "elementor"), ...getTabProps("color") })
|
|
2780
|
-
)), /* @__PURE__ */ React44.createElement(import_ui38.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("image") }, /* @__PURE__ */ React44.createElement(PopoverContent, null, /* @__PURE__ */ React44.createElement(ImageOverlayContent, null))), /* @__PURE__ */ React44.createElement(import_ui38.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("gradient") }, /* @__PURE__ */ React44.createElement(BackgroundGradientColorControl, null)), /* @__PURE__ */ React44.createElement(import_ui38.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("color") }, /* @__PURE__ */ React44.createElement(PopoverContent, null, /* @__PURE__ */ React44.createElement(ColorOverlayContent,
|
|
2811
|
+
)), /* @__PURE__ */ React44.createElement(import_ui38.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("image") }, /* @__PURE__ */ React44.createElement(PopoverContent, null, /* @__PURE__ */ React44.createElement(ImageOverlayContent, null))), /* @__PURE__ */ React44.createElement(import_ui38.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("gradient") }, /* @__PURE__ */ React44.createElement(BackgroundGradientColorControl, null)), /* @__PURE__ */ React44.createElement(import_ui38.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("color") }, /* @__PURE__ */ React44.createElement(PopoverContent, null, /* @__PURE__ */ React44.createElement(ColorOverlayContent, { anchorEl }))));
|
|
2781
2812
|
};
|
|
2782
2813
|
var ItemIcon2 = ({ value }) => {
|
|
2783
2814
|
switch (value.$$type) {
|
|
@@ -2846,9 +2877,9 @@ var ItemLabelGradient = ({ value }) => {
|
|
|
2846
2877
|
}
|
|
2847
2878
|
return /* @__PURE__ */ React44.createElement("span", null, (0, import_i18n17.__)("Radial Gradient", "elementor"));
|
|
2848
2879
|
};
|
|
2849
|
-
var ColorOverlayContent = () => {
|
|
2880
|
+
var ColorOverlayContent = ({ anchorEl }) => {
|
|
2850
2881
|
const propContext = useBoundProp(import_editor_props23.backgroundColorOverlayPropTypeUtil);
|
|
2851
|
-
return /* @__PURE__ */ React44.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React44.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React44.createElement(ColorControl,
|
|
2882
|
+
return /* @__PURE__ */ React44.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React44.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React44.createElement(ColorControl, { anchorEl })));
|
|
2852
2883
|
};
|
|
2853
2884
|
var ImageOverlayContent = () => {
|
|
2854
2885
|
const propContext = useBoundProp(import_editor_props23.backgroundImageOverlayPropTypeUtil);
|
|
@@ -2896,7 +2927,9 @@ var getGradientValue = (value) => {
|
|
|
2896
2927
|
// src/controls/background-control/background-control.tsx
|
|
2897
2928
|
var BackgroundControl = createControl(() => {
|
|
2898
2929
|
const propContext = useBoundProp(import_editor_props24.backgroundPropTypeUtil);
|
|
2899
|
-
|
|
2930
|
+
const isUsingNestedProps = (0, import_editor_v1_adapters.isExperimentActive)("e_v_3_30");
|
|
2931
|
+
const colorLabel = (0, import_i18n18.__)("Color", "elementor");
|
|
2932
|
+
return /* @__PURE__ */ React45.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React45.createElement(SectionContent, null, /* @__PURE__ */ React45.createElement(PropKeyProvider, { bind: "background-overlay" }, /* @__PURE__ */ React45.createElement(BackgroundOverlayRepeaterControl, null)), /* @__PURE__ */ React45.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React45.createElement(import_ui39.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React45.createElement(import_ui39.Grid, { item: true, xs: 6 }, isUsingNestedProps ? /* @__PURE__ */ React45.createElement(ControlLabel, null, colorLabel) : /* @__PURE__ */ React45.createElement(ControlFormLabel, null, colorLabel)), /* @__PURE__ */ React45.createElement(import_ui39.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React45.createElement(ColorControl, null))))));
|
|
2900
2933
|
});
|
|
2901
2934
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2902
2935
|
0 && (module.exports = {
|