@elementor/editor-controls 0.30.1 → 0.32.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 +33 -0
- package/dist/index.d.mts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +373 -236
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +303 -168
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -6
- package/src/components/text-field-inner-selection.tsx +3 -0
- package/src/controls/aspect-ratio-control.tsx +121 -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/link-control.tsx +1 -1
- package/src/controls/size-control.tsx +31 -1
- package/src/controls/switch-control.tsx +20 -0
- package/src/index.ts +2 -0
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AspectRatioControl: () => AspectRatioControl,
|
|
33
34
|
BackgroundControl: () => BackgroundControl,
|
|
34
35
|
BoxShadowRepeaterControl: () => BoxShadowRepeaterControl,
|
|
35
36
|
ColorControl: () => ColorControl,
|
|
@@ -52,6 +53,7 @@ __export(index_exports, {
|
|
|
52
53
|
SizeControl: () => SizeControl,
|
|
53
54
|
StrokeControl: () => StrokeControl,
|
|
54
55
|
SvgMediaControl: () => SvgMediaControl,
|
|
56
|
+
SwitchControl: () => SwitchControl2,
|
|
55
57
|
TextAreaControl: () => TextAreaControl,
|
|
56
58
|
TextControl: () => TextControl,
|
|
57
59
|
ToggleControl: () => ToggleControl,
|
|
@@ -500,6 +502,7 @@ var TextAreaControl = createControl(({ placeholder }) => {
|
|
|
500
502
|
|
|
501
503
|
// src/controls/size-control.tsx
|
|
502
504
|
var React14 = __toESM(require("react"));
|
|
505
|
+
var import_react8 = require("react");
|
|
503
506
|
var import_editor_props6 = require("@elementor/editor-props");
|
|
504
507
|
var import_ui10 = require("@elementor/ui");
|
|
505
508
|
|
|
@@ -516,6 +519,7 @@ var TextFieldInnerSelection = (0, import_react6.forwardRef)(
|
|
|
516
519
|
onChange,
|
|
517
520
|
onBlur,
|
|
518
521
|
onKeyDown,
|
|
522
|
+
onKeyUp,
|
|
519
523
|
endAdornment,
|
|
520
524
|
startAdornment
|
|
521
525
|
}, ref) => {
|
|
@@ -529,6 +533,7 @@ var TextFieldInnerSelection = (0, import_react6.forwardRef)(
|
|
|
529
533
|
value,
|
|
530
534
|
onChange,
|
|
531
535
|
onKeyDown,
|
|
536
|
+
onKeyUp,
|
|
532
537
|
onBlur,
|
|
533
538
|
placeholder,
|
|
534
539
|
InputProps: {
|
|
@@ -672,6 +677,21 @@ var SizeInput = ({
|
|
|
672
677
|
size,
|
|
673
678
|
unit
|
|
674
679
|
}) => {
|
|
680
|
+
const unitInputBufferRef = (0, import_react8.useRef)("");
|
|
681
|
+
const handleKeyUp = (event) => {
|
|
682
|
+
const { key } = event;
|
|
683
|
+
if (!/^[a-zA-Z%]$/.test(key)) {
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
686
|
+
event.preventDefault();
|
|
687
|
+
const newChar = key.toLowerCase();
|
|
688
|
+
const updatedBuffer = (unitInputBufferRef.current + newChar).slice(-3);
|
|
689
|
+
unitInputBufferRef.current = updatedBuffer;
|
|
690
|
+
const matchedUnit = units2.find((u) => u.includes(updatedBuffer)) || units2.find((u) => u.startsWith(newChar)) || units2.find((u) => u.includes(newChar));
|
|
691
|
+
if (matchedUnit) {
|
|
692
|
+
handleUnitChange(matchedUnit);
|
|
693
|
+
}
|
|
694
|
+
};
|
|
675
695
|
return /* @__PURE__ */ React14.createElement(ControlActions, null, /* @__PURE__ */ React14.createElement(
|
|
676
696
|
TextFieldInnerSelection,
|
|
677
697
|
{
|
|
@@ -688,12 +708,16 @@ var SizeInput = ({
|
|
|
688
708
|
type: "number",
|
|
689
709
|
value: Number.isNaN(size) ? "" : size,
|
|
690
710
|
onChange: handleSizeChange,
|
|
691
|
-
onBlur
|
|
711
|
+
onBlur: (event) => {
|
|
712
|
+
unitInputBufferRef.current = "";
|
|
713
|
+
onBlur?.(event);
|
|
714
|
+
},
|
|
692
715
|
onKeyDown: (event) => {
|
|
693
716
|
if (RESTRICTED_INPUT_KEYS.includes(event.key)) {
|
|
694
717
|
event.preventDefault();
|
|
695
718
|
}
|
|
696
|
-
}
|
|
719
|
+
},
|
|
720
|
+
onKeyUp: handleKeyUp
|
|
697
721
|
}
|
|
698
722
|
));
|
|
699
723
|
};
|
|
@@ -713,13 +737,38 @@ var SectionContent = ({ gap = 2, sx, children }) => /* @__PURE__ */ React15.crea
|
|
|
713
737
|
var React16 = __toESM(require("react"));
|
|
714
738
|
var import_editor_props7 = require("@elementor/editor-props");
|
|
715
739
|
var import_ui12 = require("@elementor/ui");
|
|
716
|
-
var ColorControl = createControl(
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
740
|
+
var ColorControl = createControl(
|
|
741
|
+
({ propTypeUtil = import_editor_props7.colorPropTypeUtil, anchorEl, slotProps = {}, ...props }) => {
|
|
742
|
+
const { value, setValue } = useBoundProp(propTypeUtil);
|
|
743
|
+
const handleChange = (selectedColor) => {
|
|
744
|
+
setValue(selectedColor || null);
|
|
745
|
+
};
|
|
746
|
+
return /* @__PURE__ */ React16.createElement(ControlActions, null, /* @__PURE__ */ React16.createElement(
|
|
747
|
+
import_ui12.UnstableColorField,
|
|
748
|
+
{
|
|
749
|
+
size: "tiny",
|
|
750
|
+
fullWidth: true,
|
|
751
|
+
value: value ?? "",
|
|
752
|
+
onChange: handleChange,
|
|
753
|
+
...props,
|
|
754
|
+
slotProps: {
|
|
755
|
+
...slotProps,
|
|
756
|
+
colorPicker: {
|
|
757
|
+
anchorEl,
|
|
758
|
+
anchorOrigin: {
|
|
759
|
+
vertical: "top",
|
|
760
|
+
horizontal: "right"
|
|
761
|
+
},
|
|
762
|
+
transformOrigin: {
|
|
763
|
+
vertical: "top",
|
|
764
|
+
horizontal: -10
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
));
|
|
770
|
+
}
|
|
771
|
+
);
|
|
723
772
|
|
|
724
773
|
// src/controls/stroke-control.tsx
|
|
725
774
|
var units = ["px", "em", "rem"];
|
|
@@ -752,7 +801,7 @@ var PopoverGridContainer = ({
|
|
|
752
801
|
|
|
753
802
|
// src/components/repeater.tsx
|
|
754
803
|
var React23 = __toESM(require("react"));
|
|
755
|
-
var
|
|
804
|
+
var import_react10 = require("react");
|
|
756
805
|
var import_icons3 = require("@elementor/icons");
|
|
757
806
|
var import_ui17 = require("@elementor/ui");
|
|
758
807
|
var import_i18n4 = require("@wordpress/i18n");
|
|
@@ -762,11 +811,11 @@ var React21 = __toESM(require("react"));
|
|
|
762
811
|
|
|
763
812
|
// src/control-adornments/control-adornments-context.tsx
|
|
764
813
|
var React20 = __toESM(require("react"));
|
|
765
|
-
var
|
|
766
|
-
var Context2 = (0,
|
|
814
|
+
var import_react9 = require("react");
|
|
815
|
+
var Context2 = (0, import_react9.createContext)(null);
|
|
767
816
|
var ControlAdornmentsProvider = ({ children, items }) => /* @__PURE__ */ React20.createElement(Context2.Provider, { value: { items } }, children);
|
|
768
817
|
var useControlAdornments = () => {
|
|
769
|
-
const context = (0,
|
|
818
|
+
const context = (0, import_react9.useContext)(Context2);
|
|
770
819
|
return context?.items ?? [];
|
|
771
820
|
};
|
|
772
821
|
|
|
@@ -867,14 +916,14 @@ var Repeater = ({
|
|
|
867
916
|
values: repeaterValues = [],
|
|
868
917
|
setValues: setRepeaterValues
|
|
869
918
|
}) => {
|
|
870
|
-
const [openItem, setOpenItem] = (0,
|
|
919
|
+
const [openItem, setOpenItem] = (0, import_react10.useState)(EMPTY_OPEN_ITEM);
|
|
871
920
|
const [items, setItems] = useSyncExternalState({
|
|
872
921
|
external: repeaterValues,
|
|
873
922
|
// @ts-expect-error - as long as persistWhen => true, value will never be null
|
|
874
923
|
setExternal: setRepeaterValues,
|
|
875
924
|
persistWhen: () => true
|
|
876
925
|
});
|
|
877
|
-
const [uniqueKeys, setUniqueKeys] = (0,
|
|
926
|
+
const [uniqueKeys, setUniqueKeys] = (0, import_react10.useState)(items.map((_, index) => index));
|
|
878
927
|
const generateNextKey = (source) => {
|
|
879
928
|
return 1 + Math.max(0, ...source);
|
|
880
929
|
};
|
|
@@ -984,7 +1033,7 @@ var RepeaterItem = ({
|
|
|
984
1033
|
openOnMount,
|
|
985
1034
|
onOpen
|
|
986
1035
|
}) => {
|
|
987
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
1036
|
+
const [anchorEl, setAnchorEl] = (0, import_react10.useState)(null);
|
|
988
1037
|
const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, onOpen);
|
|
989
1038
|
const duplicateLabel = (0, import_i18n4.__)("Duplicate", "elementor");
|
|
990
1039
|
const toggleLabel = disabled ? (0, import_i18n4.__)("Show", "elementor") : (0, import_i18n4.__)("Hide", "elementor");
|
|
@@ -1020,10 +1069,10 @@ var RepeaterItem = ({
|
|
|
1020
1069
|
));
|
|
1021
1070
|
};
|
|
1022
1071
|
var usePopover = (openOnMount, onOpen) => {
|
|
1023
|
-
const [ref, setRef] = (0,
|
|
1072
|
+
const [ref, setRef] = (0, import_react10.useState)(null);
|
|
1024
1073
|
const popoverState = (0, import_ui17.usePopupState)({ variant: "popover" });
|
|
1025
1074
|
const popoverProps = (0, import_ui17.bindPopover)(popoverState);
|
|
1026
|
-
(0,
|
|
1075
|
+
(0, import_react10.useEffect)(() => {
|
|
1027
1076
|
if (openOnMount && ref) {
|
|
1028
1077
|
popoverState.open(ref);
|
|
1029
1078
|
onOpen?.();
|
|
@@ -1062,24 +1111,7 @@ var ItemContent = ({ anchorEl, bind }) => {
|
|
|
1062
1111
|
};
|
|
1063
1112
|
var Content = ({ anchorEl }) => {
|
|
1064
1113
|
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(
|
|
1114
|
+
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
1115
|
SelectControl,
|
|
1084
1116
|
{
|
|
1085
1117
|
options: [
|
|
@@ -1143,7 +1175,7 @@ var import_editor_props10 = require("@elementor/editor-props");
|
|
|
1143
1175
|
|
|
1144
1176
|
// src/components/control-toggle-button-group.tsx
|
|
1145
1177
|
var React26 = __toESM(require("react"));
|
|
1146
|
-
var
|
|
1178
|
+
var import_react11 = require("react");
|
|
1147
1179
|
var import_icons4 = require("@elementor/icons");
|
|
1148
1180
|
var import_ui20 = require("@elementor/ui");
|
|
1149
1181
|
|
|
@@ -1191,7 +1223,7 @@ var ControlToggleButtonGroup = ({
|
|
|
1191
1223
|
const handleChange = (_, newValue) => {
|
|
1192
1224
|
onChange(newValue);
|
|
1193
1225
|
};
|
|
1194
|
-
const getGridTemplateColumns = (0,
|
|
1226
|
+
const getGridTemplateColumns = (0, import_react11.useMemo)(() => {
|
|
1195
1227
|
const isOffLimits = menuItems?.length;
|
|
1196
1228
|
const itemsCount = isOffLimits ? fixedItems.length + 1 : fixedItems.length;
|
|
1197
1229
|
const templateColumnsSuffix = isOffLimits ? "auto" : "";
|
|
@@ -1240,8 +1272,8 @@ var SplitButtonGroup = ({
|
|
|
1240
1272
|
value
|
|
1241
1273
|
}) => {
|
|
1242
1274
|
const previewButton = usePreviewButton(items, value);
|
|
1243
|
-
const [isMenuOpen, setIsMenuOpen] = (0,
|
|
1244
|
-
const menuButtonRef = (0,
|
|
1275
|
+
const [isMenuOpen, setIsMenuOpen] = (0, import_react11.useState)(false);
|
|
1276
|
+
const menuButtonRef = (0, import_react11.useRef)(null);
|
|
1245
1277
|
const onMenuToggle = (ev) => {
|
|
1246
1278
|
setIsMenuOpen((prev) => !prev);
|
|
1247
1279
|
ev.preventDefault();
|
|
@@ -1310,10 +1342,10 @@ var SplitButtonGroup = ({
|
|
|
1310
1342
|
));
|
|
1311
1343
|
};
|
|
1312
1344
|
var usePreviewButton = (items, value) => {
|
|
1313
|
-
const [previewButton, setPreviewButton] = (0,
|
|
1345
|
+
const [previewButton, setPreviewButton] = (0, import_react11.useState)(
|
|
1314
1346
|
items.find((item) => item.value === value) ?? items[0]
|
|
1315
1347
|
);
|
|
1316
|
-
(0,
|
|
1348
|
+
(0, import_react11.useEffect)(() => {
|
|
1317
1349
|
const selectedButton = items.find((item) => item.value === value);
|
|
1318
1350
|
if (selectedButton) {
|
|
1319
1351
|
setPreviewButton(selectedButton);
|
|
@@ -1411,7 +1443,7 @@ var NumberControl = createControl(
|
|
|
1411
1443
|
|
|
1412
1444
|
// src/controls/equal-unequal-sizes-control.tsx
|
|
1413
1445
|
var React30 = __toESM(require("react"));
|
|
1414
|
-
var
|
|
1446
|
+
var import_react12 = require("react");
|
|
1415
1447
|
var import_editor_props12 = require("@elementor/editor-props");
|
|
1416
1448
|
var import_ui23 = require("@elementor/ui");
|
|
1417
1449
|
var import_i18n6 = require("@wordpress/i18n");
|
|
@@ -1441,8 +1473,8 @@ function EqualUnequalSizesControl({
|
|
|
1441
1473
|
items,
|
|
1442
1474
|
multiSizePropTypeUtil
|
|
1443
1475
|
}) {
|
|
1444
|
-
const popupId = (0,
|
|
1445
|
-
const controlRef = (0,
|
|
1476
|
+
const popupId = (0, import_react12.useId)();
|
|
1477
|
+
const controlRef = (0, import_react12.useRef)(null);
|
|
1446
1478
|
const popupState = (0, import_ui23.usePopupState)({ variant: "popover", popupId });
|
|
1447
1479
|
const {
|
|
1448
1480
|
propType: multiSizePropType,
|
|
@@ -1607,7 +1639,7 @@ var Control3 = ({
|
|
|
1607
1639
|
|
|
1608
1640
|
// src/controls/font-family-control/font-family-control.tsx
|
|
1609
1641
|
var React32 = __toESM(require("react"));
|
|
1610
|
-
var
|
|
1642
|
+
var import_react13 = require("react");
|
|
1611
1643
|
var import_editor_props14 = require("@elementor/editor-props");
|
|
1612
1644
|
var import_icons6 = require("@elementor/icons");
|
|
1613
1645
|
var import_ui25 = require("@elementor/ui");
|
|
@@ -1640,7 +1672,7 @@ var enqueueFont = (fontFamily, context = "editor") => {
|
|
|
1640
1672
|
// src/controls/font-family-control/font-family-control.tsx
|
|
1641
1673
|
var SIZE2 = "tiny";
|
|
1642
1674
|
var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
1643
|
-
const [searchValue, setSearchValue] = (0,
|
|
1675
|
+
const [searchValue, setSearchValue] = (0, import_react13.useState)("");
|
|
1644
1676
|
const { value: fontFamily, setValue: setFontFamily } = useBoundProp(import_editor_props14.stringPropTypeUtil);
|
|
1645
1677
|
const popoverState = (0, import_ui25.usePopupState)({ variant: "popover" });
|
|
1646
1678
|
const filteredFontFamilies = useFilteredFontFamilies(fontFamilies, searchValue);
|
|
@@ -1725,7 +1757,7 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1725
1757
|
var LIST_ITEM_HEIGHT = 36;
|
|
1726
1758
|
var LIST_ITEMS_BUFFER = 6;
|
|
1727
1759
|
var FontList = ({ fontListItems, setFontFamily, handleClose, fontFamily }) => {
|
|
1728
|
-
const containerRef = (0,
|
|
1760
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
1729
1761
|
const selectedItem = fontListItems.find((item) => item.value === fontFamily);
|
|
1730
1762
|
const debouncedVirtualizeChange = useDebounce(({ getVirtualIndexes }) => {
|
|
1731
1763
|
getVirtualIndexes().forEach((index) => {
|
|
@@ -1742,7 +1774,7 @@ var FontList = ({ fontListItems, setFontFamily, handleClose, fontFamily }) => {
|
|
|
1742
1774
|
overscan: LIST_ITEMS_BUFFER,
|
|
1743
1775
|
onChange: debouncedVirtualizeChange
|
|
1744
1776
|
});
|
|
1745
|
-
(0,
|
|
1777
|
+
(0, import_react13.useEffect)(
|
|
1746
1778
|
() => {
|
|
1747
1779
|
virtualizer.scrollToIndex(fontListItems.findIndex((item) => item.value === fontFamily));
|
|
1748
1780
|
},
|
|
@@ -1850,8 +1882,8 @@ var StyledMenuList = (0, import_ui25.styled)(import_ui25.MenuList)(({ theme }) =
|
|
|
1850
1882
|
position: "relative"
|
|
1851
1883
|
}));
|
|
1852
1884
|
var useDebounce = (fn, delay) => {
|
|
1853
|
-
const [debouncedFn] = (0,
|
|
1854
|
-
(0,
|
|
1885
|
+
const [debouncedFn] = (0, import_react13.useState)(() => (0, import_utils2.debounce)(fn, delay));
|
|
1886
|
+
(0, import_react13.useEffect)(() => () => debouncedFn.cancel(), [debouncedFn]);
|
|
1855
1887
|
return debouncedFn;
|
|
1856
1888
|
};
|
|
1857
1889
|
|
|
@@ -1876,7 +1908,7 @@ var UrlControl = createControl(({ placeholder }) => {
|
|
|
1876
1908
|
|
|
1877
1909
|
// src/controls/link-control.tsx
|
|
1878
1910
|
var React35 = __toESM(require("react"));
|
|
1879
|
-
var
|
|
1911
|
+
var import_react15 = require("react");
|
|
1880
1912
|
var import_editor_elements = require("@elementor/editor-elements");
|
|
1881
1913
|
var import_editor_props16 = require("@elementor/editor-props");
|
|
1882
1914
|
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
@@ -1889,10 +1921,10 @@ var import_i18n9 = require("@wordpress/i18n");
|
|
|
1889
1921
|
|
|
1890
1922
|
// src/components/autocomplete.tsx
|
|
1891
1923
|
var React34 = __toESM(require("react"));
|
|
1892
|
-
var
|
|
1924
|
+
var import_react14 = require("react");
|
|
1893
1925
|
var import_icons7 = require("@elementor/icons");
|
|
1894
1926
|
var import_ui27 = require("@elementor/ui");
|
|
1895
|
-
var Autocomplete = (0,
|
|
1927
|
+
var Autocomplete = (0, import_react14.forwardRef)((props, ref) => {
|
|
1896
1928
|
const {
|
|
1897
1929
|
options,
|
|
1898
1930
|
onOptionChange,
|
|
@@ -2002,7 +2034,7 @@ var learnMoreButton = {
|
|
|
2002
2034
|
var LinkControl = createControl((props) => {
|
|
2003
2035
|
const { value, path, setValue, ...propContext } = useBoundProp(import_editor_props16.linkPropTypeUtil);
|
|
2004
2036
|
const [linkSessionValue, setLinkSessionValue] = (0, import_session.useSessionStorage)(path.join("/"));
|
|
2005
|
-
const [isActive, setIsActive] = (0,
|
|
2037
|
+
const [isActive, setIsActive] = (0, import_react15.useState)(!!value);
|
|
2006
2038
|
const {
|
|
2007
2039
|
allowCustomValues,
|
|
2008
2040
|
queryOptions: { endpoint = "", requestParams = {} },
|
|
@@ -2010,8 +2042,8 @@ var LinkControl = createControl((props) => {
|
|
|
2010
2042
|
minInputLength = 2,
|
|
2011
2043
|
context: { elementId }
|
|
2012
2044
|
} = props || {};
|
|
2013
|
-
const [linkInLinkRestriction, setLinkInLinkRestriction] = (0,
|
|
2014
|
-
const [options, setOptions] = (0,
|
|
2045
|
+
const [linkInLinkRestriction, setLinkInLinkRestriction] = (0, import_react15.useState)((0, import_editor_elements.getLinkInLinkRestriction)(elementId));
|
|
2046
|
+
const [options, setOptions] = (0, import_react15.useState)(
|
|
2015
2047
|
generateFirstLoadedOption(value)
|
|
2016
2048
|
);
|
|
2017
2049
|
const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
|
|
@@ -2029,7 +2061,7 @@ var LinkControl = createControl((props) => {
|
|
|
2029
2061
|
setValue(linkSessionValue.value);
|
|
2030
2062
|
}
|
|
2031
2063
|
setLinkSessionValue({
|
|
2032
|
-
value:
|
|
2064
|
+
value: linkSessionValue?.value,
|
|
2033
2065
|
meta: { isEnabled: newState }
|
|
2034
2066
|
});
|
|
2035
2067
|
};
|
|
@@ -2062,7 +2094,7 @@ var LinkControl = createControl((props) => {
|
|
|
2062
2094
|
}
|
|
2063
2095
|
debounceFetch({ ...requestParams, term: newValue });
|
|
2064
2096
|
};
|
|
2065
|
-
const debounceFetch = (0,
|
|
2097
|
+
const debounceFetch = (0, import_react15.useMemo)(
|
|
2066
2098
|
() => (0, import_utils3.debounce)(
|
|
2067
2099
|
(params) => fetchOptions(endpoint, params).then((newOptions) => {
|
|
2068
2100
|
setOptions(formatOptions(newOptions));
|
|
@@ -2228,33 +2260,121 @@ var Control4 = ({ bind, isLinked }) => {
|
|
|
2228
2260
|
return /* @__PURE__ */ React36.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React36.createElement(SizeControl, null));
|
|
2229
2261
|
};
|
|
2230
2262
|
|
|
2231
|
-
// src/controls/
|
|
2232
|
-
var
|
|
2263
|
+
// src/controls/aspect-ratio-control.tsx
|
|
2264
|
+
var React37 = __toESM(require("react"));
|
|
2233
2265
|
var import_react16 = require("react");
|
|
2234
2266
|
var import_editor_props18 = require("@elementor/editor-props");
|
|
2267
|
+
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
2268
|
+
var import_ui30 = require("@elementor/ui");
|
|
2269
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
2270
|
+
var RATIO_OPTIONS = [
|
|
2271
|
+
{ label: (0, import_i18n11.__)("Auto", "elementor"), value: "auto" },
|
|
2272
|
+
{ label: "1/1", value: "1/1" },
|
|
2273
|
+
{ label: "4/3", value: "4/3" },
|
|
2274
|
+
{ label: "3/4", value: "3/4" },
|
|
2275
|
+
{ label: "16/9", value: "16/9" },
|
|
2276
|
+
{ label: "9/16", value: "9/16" },
|
|
2277
|
+
{ label: "3/2", value: "3/2" },
|
|
2278
|
+
{ label: "2/3", value: "2/3" }
|
|
2279
|
+
];
|
|
2280
|
+
var CUSTOM_RATIO = "custom";
|
|
2281
|
+
var AspectRatioControl = createControl(({ label }) => {
|
|
2282
|
+
const { value: aspectRatioValue, setValue: setAspectRatioValue } = useBoundProp(import_editor_props18.stringPropTypeUtil);
|
|
2283
|
+
const isCustomSelected = aspectRatioValue && !RATIO_OPTIONS.some((option) => option.value === aspectRatioValue);
|
|
2284
|
+
const [initialWidth, initialHeight] = isCustomSelected ? aspectRatioValue.split("/") : ["", ""];
|
|
2285
|
+
const [isCustom, setIsCustom] = (0, import_react16.useState)(isCustomSelected);
|
|
2286
|
+
const [customWidth, setCustomWidth] = (0, import_react16.useState)(initialWidth);
|
|
2287
|
+
const [customHeight, setCustomHeight] = (0, import_react16.useState)(initialHeight);
|
|
2288
|
+
const [selectedValue, setSelectedValue] = (0, import_react16.useState)(
|
|
2289
|
+
isCustomSelected ? CUSTOM_RATIO : aspectRatioValue || ""
|
|
2290
|
+
);
|
|
2291
|
+
const handleSelectChange = (event) => {
|
|
2292
|
+
const newValue = event.target.value;
|
|
2293
|
+
const isCustomRatio = newValue === CUSTOM_RATIO;
|
|
2294
|
+
setIsCustom(isCustomRatio);
|
|
2295
|
+
setSelectedValue(newValue);
|
|
2296
|
+
if (isCustomRatio) {
|
|
2297
|
+
return;
|
|
2298
|
+
}
|
|
2299
|
+
setAspectRatioValue(newValue);
|
|
2300
|
+
};
|
|
2301
|
+
const handleCustomWidthChange = (event) => {
|
|
2302
|
+
const newWidth = event.target.value;
|
|
2303
|
+
setCustomWidth(newWidth);
|
|
2304
|
+
if (newWidth && customHeight) {
|
|
2305
|
+
setAspectRatioValue(`${newWidth}/${customHeight}`);
|
|
2306
|
+
}
|
|
2307
|
+
};
|
|
2308
|
+
const handleCustomHeightChange = (event) => {
|
|
2309
|
+
const newHeight = event.target.value;
|
|
2310
|
+
setCustomHeight(newHeight);
|
|
2311
|
+
if (customWidth && newHeight) {
|
|
2312
|
+
setAspectRatioValue(`${customWidth}/${newHeight}`);
|
|
2313
|
+
}
|
|
2314
|
+
};
|
|
2315
|
+
return /* @__PURE__ */ React37.createElement(import_ui30.Stack, { direction: "column", gap: 2 }, /* @__PURE__ */ React37.createElement(import_ui30.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React37.createElement(import_ui30.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(ControlLabel, null, label)), /* @__PURE__ */ React37.createElement(import_ui30.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(
|
|
2316
|
+
import_ui30.Select,
|
|
2317
|
+
{
|
|
2318
|
+
sx: { overflow: "hidden" },
|
|
2319
|
+
displayEmpty: true,
|
|
2320
|
+
size: "tiny",
|
|
2321
|
+
value: selectedValue,
|
|
2322
|
+
onChange: handleSelectChange,
|
|
2323
|
+
fullWidth: true
|
|
2324
|
+
},
|
|
2325
|
+
[...RATIO_OPTIONS, { label: (0, import_i18n11.__)("Custom", "elementor"), value: CUSTOM_RATIO }].map(
|
|
2326
|
+
({ label: optionLabel, ...props }) => /* @__PURE__ */ React37.createElement(import_editor_ui4.MenuListItem, { key: props.value, ...props, value: props.value ?? "" }, optionLabel)
|
|
2327
|
+
)
|
|
2328
|
+
))), isCustom && /* @__PURE__ */ React37.createElement(import_ui30.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React37.createElement(import_ui30.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(
|
|
2329
|
+
import_ui30.TextField,
|
|
2330
|
+
{
|
|
2331
|
+
size: "tiny",
|
|
2332
|
+
type: "number",
|
|
2333
|
+
fullWidth: true,
|
|
2334
|
+
value: customWidth,
|
|
2335
|
+
onChange: handleCustomWidthChange,
|
|
2336
|
+
placeholder: (0, import_i18n11.__)("Width", "elementor")
|
|
2337
|
+
}
|
|
2338
|
+
)), /* @__PURE__ */ React37.createElement(import_ui30.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(
|
|
2339
|
+
import_ui30.TextField,
|
|
2340
|
+
{
|
|
2341
|
+
size: "tiny",
|
|
2342
|
+
type: "number",
|
|
2343
|
+
fullWidth: true,
|
|
2344
|
+
value: customHeight,
|
|
2345
|
+
onChange: handleCustomHeightChange,
|
|
2346
|
+
placeholder: (0, import_i18n11.__)("Height", "elementor")
|
|
2347
|
+
}
|
|
2348
|
+
))));
|
|
2349
|
+
});
|
|
2350
|
+
|
|
2351
|
+
// src/controls/svg-media-control.tsx
|
|
2352
|
+
var React39 = __toESM(require("react"));
|
|
2353
|
+
var import_react18 = require("react");
|
|
2354
|
+
var import_editor_props19 = require("@elementor/editor-props");
|
|
2235
2355
|
var import_icons10 = require("@elementor/icons");
|
|
2236
|
-
var
|
|
2356
|
+
var import_ui32 = require("@elementor/ui");
|
|
2237
2357
|
var import_wp_media2 = require("@elementor/wp-media");
|
|
2238
|
-
var
|
|
2358
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
2239
2359
|
|
|
2240
2360
|
// src/components/enable-unfiltered-modal.tsx
|
|
2241
|
-
var
|
|
2242
|
-
var
|
|
2361
|
+
var React38 = __toESM(require("react"));
|
|
2362
|
+
var import_react17 = require("react");
|
|
2243
2363
|
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
2244
|
-
var
|
|
2245
|
-
var
|
|
2246
|
-
var ADMIN_TITLE_TEXT = (0,
|
|
2247
|
-
var ADMIN_CONTENT_TEXT = (0,
|
|
2364
|
+
var import_ui31 = require("@elementor/ui");
|
|
2365
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
2366
|
+
var ADMIN_TITLE_TEXT = (0, import_i18n12.__)("Enable Unfiltered Uploads", "elementor");
|
|
2367
|
+
var ADMIN_CONTENT_TEXT = (0, import_i18n12.__)(
|
|
2248
2368
|
"Before you enable unfiltered files upload, note that such files include a security risk. Elementor does run a process to remove possible malicious code, but there is still risk involved when using such files.",
|
|
2249
2369
|
"elementor"
|
|
2250
2370
|
);
|
|
2251
|
-
var NON_ADMIN_TITLE_TEXT = (0,
|
|
2252
|
-
var NON_ADMIN_CONTENT_TEXT = (0,
|
|
2371
|
+
var NON_ADMIN_TITLE_TEXT = (0, import_i18n12.__)("Sorry, you can't upload that file yet", "elementor");
|
|
2372
|
+
var NON_ADMIN_CONTENT_TEXT = (0, import_i18n12.__)(
|
|
2253
2373
|
"This is because this file type may pose a security risk. To upload them anyway, ask the site administrator to enable unfiltered file uploads.",
|
|
2254
2374
|
"elementor"
|
|
2255
2375
|
);
|
|
2256
|
-
var ADMIN_FAILED_CONTENT_TEXT_PT1 = (0,
|
|
2257
|
-
var ADMIN_FAILED_CONTENT_TEXT_PT2 = (0,
|
|
2376
|
+
var ADMIN_FAILED_CONTENT_TEXT_PT1 = (0, import_i18n12.__)("Failed to enable unfiltered files upload.", "elementor");
|
|
2377
|
+
var ADMIN_FAILED_CONTENT_TEXT_PT2 = (0, import_i18n12.__)(
|
|
2258
2378
|
"You can try again, if the problem persists, please contact support.",
|
|
2259
2379
|
"elementor"
|
|
2260
2380
|
);
|
|
@@ -2262,7 +2382,7 @@ var WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
|
|
|
2262
2382
|
var EnableUnfilteredModal = (props) => {
|
|
2263
2383
|
const { mutateAsync, isPending } = useUpdateUnfilteredFilesUpload();
|
|
2264
2384
|
const { canUser } = (0, import_editor_current_user.useCurrentUserCapabilities)();
|
|
2265
|
-
const [isError, setIsError] = (0,
|
|
2385
|
+
const [isError, setIsError] = (0, import_react17.useState)(false);
|
|
2266
2386
|
const canManageOptions = canUser("manage_options");
|
|
2267
2387
|
const onClose = (enabled) => {
|
|
2268
2388
|
props.onClose(enabled);
|
|
@@ -2281,10 +2401,10 @@ var EnableUnfilteredModal = (props) => {
|
|
|
2281
2401
|
}
|
|
2282
2402
|
};
|
|
2283
2403
|
const dialogProps = { ...props, isPending, handleEnable, isError, onClose };
|
|
2284
|
-
return canManageOptions ? /* @__PURE__ */
|
|
2404
|
+
return canManageOptions ? /* @__PURE__ */ React38.createElement(AdminDialog, { ...dialogProps }) : /* @__PURE__ */ React38.createElement(NonAdminDialog, { ...dialogProps });
|
|
2285
2405
|
};
|
|
2286
|
-
var AdminDialog = ({ open, onClose, handleEnable, isPending, isError }) => /* @__PURE__ */
|
|
2287
|
-
|
|
2406
|
+
var AdminDialog = ({ open, onClose, handleEnable, isPending, isError }) => /* @__PURE__ */ React38.createElement(import_ui31.Dialog, { open, maxWidth: "sm", onClose: () => onClose(false) }, /* @__PURE__ */ React38.createElement(import_ui31.DialogHeader, { logo: false }, /* @__PURE__ */ React38.createElement(import_ui31.DialogTitle, null, ADMIN_TITLE_TEXT)), /* @__PURE__ */ React38.createElement(import_ui31.Divider, null), /* @__PURE__ */ React38.createElement(import_ui31.DialogContent, null, /* @__PURE__ */ React38.createElement(import_ui31.DialogContentText, null, isError ? /* @__PURE__ */ React38.createElement(React38.Fragment, null, ADMIN_FAILED_CONTENT_TEXT_PT1, " ", /* @__PURE__ */ React38.createElement("br", null), " ", ADMIN_FAILED_CONTENT_TEXT_PT2) : ADMIN_CONTENT_TEXT)), /* @__PURE__ */ React38.createElement(import_ui31.DialogActions, null, /* @__PURE__ */ React38.createElement(import_ui31.Button, { size: "medium", color: "secondary", onClick: () => onClose(false) }, (0, import_i18n12.__)("Cancel", "elementor")), /* @__PURE__ */ React38.createElement(
|
|
2407
|
+
import_ui31.Button,
|
|
2288
2408
|
{
|
|
2289
2409
|
size: "medium",
|
|
2290
2410
|
onClick: () => handleEnable(),
|
|
@@ -2292,16 +2412,16 @@ var AdminDialog = ({ open, onClose, handleEnable, isPending, isError }) => /* @_
|
|
|
2292
2412
|
color: "primary",
|
|
2293
2413
|
disabled: isPending
|
|
2294
2414
|
},
|
|
2295
|
-
isPending ? /* @__PURE__ */
|
|
2415
|
+
isPending ? /* @__PURE__ */ React38.createElement(import_ui31.CircularProgress, { size: 24 }) : (0, import_i18n12.__)("Enable", "elementor")
|
|
2296
2416
|
)));
|
|
2297
|
-
var NonAdminDialog = ({ open, onClose }) => /* @__PURE__ */
|
|
2417
|
+
var NonAdminDialog = ({ open, onClose }) => /* @__PURE__ */ React38.createElement(import_ui31.Dialog, { open, maxWidth: "sm", onClose: () => onClose(false) }, /* @__PURE__ */ React38.createElement(import_ui31.DialogHeader, { logo: false }, /* @__PURE__ */ React38.createElement(import_ui31.DialogTitle, null, NON_ADMIN_TITLE_TEXT)), /* @__PURE__ */ React38.createElement(import_ui31.Divider, null), /* @__PURE__ */ React38.createElement(import_ui31.DialogContent, null, /* @__PURE__ */ React38.createElement(import_ui31.DialogContentText, null, NON_ADMIN_CONTENT_TEXT)), /* @__PURE__ */ React38.createElement(import_ui31.DialogActions, null, /* @__PURE__ */ React38.createElement(import_ui31.Button, { size: "medium", onClick: () => onClose(false), variant: "contained", color: "primary" }, (0, import_i18n12.__)("Got it", "elementor"))));
|
|
2298
2418
|
|
|
2299
2419
|
// src/controls/svg-media-control.tsx
|
|
2300
2420
|
var TILE_SIZE = 8;
|
|
2301
2421
|
var TILE_WHITE = "transparent";
|
|
2302
2422
|
var TILE_BLACK = "#c1c1c1";
|
|
2303
2423
|
var TILES_GRADIENT_FORMULA = `linear-gradient(45deg, ${TILE_BLACK} 25%, ${TILE_WHITE} 0, ${TILE_WHITE} 75%, ${TILE_BLACK} 0, ${TILE_BLACK})`;
|
|
2304
|
-
var StyledCard = (0,
|
|
2424
|
+
var StyledCard = (0, import_ui32.styled)(import_ui32.Card)`
|
|
2305
2425
|
background-color: white;
|
|
2306
2426
|
background-image: ${TILES_GRADIENT_FORMULA}, ${TILES_GRADIENT_FORMULA};
|
|
2307
2427
|
background-size: ${TILE_SIZE}px ${TILE_SIZE}px;
|
|
@@ -2310,7 +2430,7 @@ var StyledCard = (0, import_ui31.styled)(import_ui31.Card)`
|
|
|
2310
2430
|
${TILE_SIZE / 2}px ${TILE_SIZE / 2}px;
|
|
2311
2431
|
border: none;
|
|
2312
2432
|
`;
|
|
2313
|
-
var StyledCardMediaContainer = (0,
|
|
2433
|
+
var StyledCardMediaContainer = (0, import_ui32.styled)(import_ui32.Stack)`
|
|
2314
2434
|
position: relative;
|
|
2315
2435
|
height: 140px;
|
|
2316
2436
|
object-fit: contain;
|
|
@@ -2322,12 +2442,12 @@ var StyledCardMediaContainer = (0, import_ui31.styled)(import_ui31.Stack)`
|
|
|
2322
2442
|
var MODE_BROWSE = { mode: "browse" };
|
|
2323
2443
|
var MODE_UPLOAD = { mode: "upload" };
|
|
2324
2444
|
var SvgMediaControl = createControl(() => {
|
|
2325
|
-
const { value, setValue } = useBoundProp(
|
|
2445
|
+
const { value, setValue } = useBoundProp(import_editor_props19.imageSrcPropTypeUtil);
|
|
2326
2446
|
const { id, url } = value ?? {};
|
|
2327
2447
|
const { data: attachment, isFetching } = (0, import_wp_media2.useWpMediaAttachment)(id?.value || null);
|
|
2328
2448
|
const src = attachment?.url ?? url?.value ?? null;
|
|
2329
2449
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
2330
|
-
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = (0,
|
|
2450
|
+
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = (0, import_react18.useState)(false);
|
|
2331
2451
|
const { open } = (0, import_wp_media2.useWpMediaFrame)({
|
|
2332
2452
|
mediaTypes: ["svg"],
|
|
2333
2453
|
multiple: false,
|
|
@@ -2355,16 +2475,16 @@ var SvgMediaControl = createControl(() => {
|
|
|
2355
2475
|
open(openOptions);
|
|
2356
2476
|
}
|
|
2357
2477
|
};
|
|
2358
|
-
return /* @__PURE__ */
|
|
2359
|
-
|
|
2478
|
+
return /* @__PURE__ */ React39.createElement(import_ui32.Stack, { gap: 1 }, /* @__PURE__ */ React39.createElement(EnableUnfilteredModal, { open: unfilteredModalOpenState, onClose: onCloseUnfilteredModal }), /* @__PURE__ */ React39.createElement(ControlFormLabel, null, " ", (0, import_i18n13.__)("SVG", "elementor"), " "), /* @__PURE__ */ React39.createElement(ControlActions, null, /* @__PURE__ */ React39.createElement(StyledCard, { variant: "outlined" }, /* @__PURE__ */ React39.createElement(StyledCardMediaContainer, null, isFetching ? /* @__PURE__ */ React39.createElement(import_ui32.CircularProgress, { role: "progressbar" }) : /* @__PURE__ */ React39.createElement(
|
|
2479
|
+
import_ui32.CardMedia,
|
|
2360
2480
|
{
|
|
2361
2481
|
component: "img",
|
|
2362
2482
|
image: src,
|
|
2363
|
-
alt: (0,
|
|
2483
|
+
alt: (0, import_i18n13.__)("Preview SVG", "elementor"),
|
|
2364
2484
|
sx: { maxHeight: "140px", width: "50px" }
|
|
2365
2485
|
}
|
|
2366
|
-
)), /* @__PURE__ */
|
|
2367
|
-
|
|
2486
|
+
)), /* @__PURE__ */ React39.createElement(
|
|
2487
|
+
import_ui32.CardOverlay,
|
|
2368
2488
|
{
|
|
2369
2489
|
sx: {
|
|
2370
2490
|
"&:hover": {
|
|
@@ -2372,68 +2492,69 @@ var SvgMediaControl = createControl(() => {
|
|
|
2372
2492
|
}
|
|
2373
2493
|
}
|
|
2374
2494
|
},
|
|
2375
|
-
/* @__PURE__ */
|
|
2376
|
-
|
|
2495
|
+
/* @__PURE__ */ React39.createElement(import_ui32.Stack, { gap: 1 }, /* @__PURE__ */ React39.createElement(
|
|
2496
|
+
import_ui32.Button,
|
|
2377
2497
|
{
|
|
2378
2498
|
size: "tiny",
|
|
2379
2499
|
color: "inherit",
|
|
2380
2500
|
variant: "outlined",
|
|
2381
2501
|
onClick: () => handleClick(MODE_BROWSE)
|
|
2382
2502
|
},
|
|
2383
|
-
(0,
|
|
2384
|
-
), /* @__PURE__ */
|
|
2385
|
-
|
|
2503
|
+
(0, import_i18n13.__)("Select SVG", "elementor")
|
|
2504
|
+
), /* @__PURE__ */ React39.createElement(
|
|
2505
|
+
import_ui32.Button,
|
|
2386
2506
|
{
|
|
2387
2507
|
size: "tiny",
|
|
2388
2508
|
variant: "text",
|
|
2389
2509
|
color: "inherit",
|
|
2390
|
-
startIcon: /* @__PURE__ */
|
|
2510
|
+
startIcon: /* @__PURE__ */ React39.createElement(import_icons10.UploadIcon, null),
|
|
2391
2511
|
onClick: () => handleClick(MODE_UPLOAD)
|
|
2392
2512
|
},
|
|
2393
|
-
(0,
|
|
2513
|
+
(0, import_i18n13.__)("Upload", "elementor")
|
|
2394
2514
|
))
|
|
2395
2515
|
))));
|
|
2396
2516
|
});
|
|
2397
2517
|
|
|
2398
2518
|
// src/controls/background-control/background-control.tsx
|
|
2519
|
+
var React46 = __toESM(require("react"));
|
|
2520
|
+
var import_editor_props25 = require("@elementor/editor-props");
|
|
2521
|
+
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
2522
|
+
var import_ui40 = require("@elementor/ui");
|
|
2523
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
2524
|
+
|
|
2525
|
+
// src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
|
|
2399
2526
|
var React45 = __toESM(require("react"));
|
|
2400
2527
|
var import_editor_props24 = require("@elementor/editor-props");
|
|
2401
2528
|
var import_ui39 = require("@elementor/ui");
|
|
2402
|
-
var import_i18n18 = require("@wordpress/i18n");
|
|
2403
|
-
|
|
2404
|
-
// src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
|
|
2405
|
-
var React44 = __toESM(require("react"));
|
|
2406
|
-
var import_editor_props23 = require("@elementor/editor-props");
|
|
2407
|
-
var import_ui38 = require("@elementor/ui");
|
|
2408
2529
|
var import_wp_media3 = require("@elementor/wp-media");
|
|
2409
|
-
var
|
|
2530
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
2410
2531
|
|
|
2411
2532
|
// src/env.ts
|
|
2412
2533
|
var import_env = require("@elementor/env");
|
|
2413
2534
|
var { env } = (0, import_env.parseEnv)("@elementor/editor-controls");
|
|
2414
2535
|
|
|
2415
2536
|
// src/controls/background-control/background-gradient-color-control.tsx
|
|
2416
|
-
var
|
|
2417
|
-
var
|
|
2418
|
-
var
|
|
2537
|
+
var React40 = __toESM(require("react"));
|
|
2538
|
+
var import_editor_props20 = require("@elementor/editor-props");
|
|
2539
|
+
var import_ui33 = require("@elementor/ui");
|
|
2419
2540
|
var BackgroundGradientColorControl = createControl(() => {
|
|
2420
|
-
const { value, setValue } = useBoundProp(
|
|
2541
|
+
const { value, setValue } = useBoundProp(import_editor_props20.backgroundGradientOverlayPropTypeUtil);
|
|
2421
2542
|
const handleChange = (newValue) => {
|
|
2422
2543
|
const transformedValue = createTransformableValue(newValue);
|
|
2423
2544
|
if (transformedValue.positions) {
|
|
2424
|
-
transformedValue.positions =
|
|
2545
|
+
transformedValue.positions = import_editor_props20.stringPropTypeUtil.create(newValue.positions.join(" "));
|
|
2425
2546
|
}
|
|
2426
2547
|
setValue(transformedValue);
|
|
2427
2548
|
};
|
|
2428
2549
|
const createTransformableValue = (newValue) => ({
|
|
2429
2550
|
...newValue,
|
|
2430
|
-
type:
|
|
2431
|
-
angle:
|
|
2432
|
-
stops:
|
|
2551
|
+
type: import_editor_props20.stringPropTypeUtil.create(newValue.type),
|
|
2552
|
+
angle: import_editor_props20.numberPropTypeUtil.create(newValue.angle),
|
|
2553
|
+
stops: import_editor_props20.gradientColorStopPropTypeUtil.create(
|
|
2433
2554
|
newValue.stops.map(
|
|
2434
|
-
({ color, offset }) =>
|
|
2435
|
-
color:
|
|
2436
|
-
offset:
|
|
2555
|
+
({ color, offset }) => import_editor_props20.colorStopPropTypeUtil.create({
|
|
2556
|
+
color: import_editor_props20.colorPropTypeUtil.create(color),
|
|
2557
|
+
offset: import_editor_props20.numberPropTypeUtil.create(offset)
|
|
2437
2558
|
})
|
|
2438
2559
|
)
|
|
2439
2560
|
)
|
|
@@ -2453,8 +2574,8 @@ var BackgroundGradientColorControl = createControl(() => {
|
|
|
2453
2574
|
positions: positions?.value.split(" ")
|
|
2454
2575
|
};
|
|
2455
2576
|
};
|
|
2456
|
-
return /* @__PURE__ */
|
|
2457
|
-
|
|
2577
|
+
return /* @__PURE__ */ React40.createElement(ControlActions, null, /* @__PURE__ */ React40.createElement(
|
|
2578
|
+
import_ui33.UnstableGradientBox,
|
|
2458
2579
|
{
|
|
2459
2580
|
sx: { width: "auto", padding: 1.5 },
|
|
2460
2581
|
value: normalizeValue(),
|
|
@@ -2462,66 +2583,66 @@ var BackgroundGradientColorControl = createControl(() => {
|
|
|
2462
2583
|
}
|
|
2463
2584
|
));
|
|
2464
2585
|
});
|
|
2465
|
-
var initialBackgroundGradientOverlay =
|
|
2466
|
-
type:
|
|
2467
|
-
angle:
|
|
2468
|
-
stops:
|
|
2469
|
-
|
|
2470
|
-
color:
|
|
2471
|
-
offset:
|
|
2586
|
+
var initialBackgroundGradientOverlay = import_editor_props20.backgroundGradientOverlayPropTypeUtil.create({
|
|
2587
|
+
type: import_editor_props20.stringPropTypeUtil.create("linear"),
|
|
2588
|
+
angle: import_editor_props20.numberPropTypeUtil.create(180),
|
|
2589
|
+
stops: import_editor_props20.gradientColorStopPropTypeUtil.create([
|
|
2590
|
+
import_editor_props20.colorStopPropTypeUtil.create({
|
|
2591
|
+
color: import_editor_props20.colorPropTypeUtil.create("rgb(0,0,0)"),
|
|
2592
|
+
offset: import_editor_props20.numberPropTypeUtil.create(0)
|
|
2472
2593
|
}),
|
|
2473
|
-
|
|
2474
|
-
color:
|
|
2475
|
-
offset:
|
|
2594
|
+
import_editor_props20.colorStopPropTypeUtil.create({
|
|
2595
|
+
color: import_editor_props20.colorPropTypeUtil.create("rgb(255,255,255)"),
|
|
2596
|
+
offset: import_editor_props20.numberPropTypeUtil.create(100)
|
|
2476
2597
|
})
|
|
2477
2598
|
])
|
|
2478
2599
|
});
|
|
2479
2600
|
|
|
2480
2601
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx
|
|
2481
|
-
var
|
|
2602
|
+
var React41 = __toESM(require("react"));
|
|
2482
2603
|
var import_icons11 = require("@elementor/icons");
|
|
2483
|
-
var
|
|
2484
|
-
var
|
|
2604
|
+
var import_ui34 = require("@elementor/ui");
|
|
2605
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
2485
2606
|
var attachmentControlOptions = [
|
|
2486
2607
|
{
|
|
2487
2608
|
value: "fixed",
|
|
2488
|
-
label: (0,
|
|
2489
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2609
|
+
label: (0, import_i18n14.__)("Fixed", "elementor"),
|
|
2610
|
+
renderContent: ({ size }) => /* @__PURE__ */ React41.createElement(import_icons11.PinIcon, { fontSize: size }),
|
|
2490
2611
|
showTooltip: true
|
|
2491
2612
|
},
|
|
2492
2613
|
{
|
|
2493
2614
|
value: "scroll",
|
|
2494
|
-
label: (0,
|
|
2495
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2615
|
+
label: (0, import_i18n14.__)("Scroll", "elementor"),
|
|
2616
|
+
renderContent: ({ size }) => /* @__PURE__ */ React41.createElement(import_icons11.PinnedOffIcon, { fontSize: size }),
|
|
2496
2617
|
showTooltip: true
|
|
2497
2618
|
}
|
|
2498
2619
|
];
|
|
2499
2620
|
var BackgroundImageOverlayAttachment = () => {
|
|
2500
|
-
return /* @__PURE__ */
|
|
2621
|
+
return /* @__PURE__ */ React41.createElement(PopoverGridContainer, null, /* @__PURE__ */ React41.createElement(import_ui34.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React41.createElement(ControlFormLabel, null, (0, import_i18n14.__)("Attachment", "elementor"))), /* @__PURE__ */ React41.createElement(import_ui34.Grid, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end", overflow: "hidden" } }, /* @__PURE__ */ React41.createElement(ToggleControl, { options: attachmentControlOptions })));
|
|
2501
2622
|
};
|
|
2502
2623
|
|
|
2503
2624
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
|
|
2504
|
-
var
|
|
2505
|
-
var
|
|
2506
|
-
var
|
|
2625
|
+
var React42 = __toESM(require("react"));
|
|
2626
|
+
var import_editor_props21 = require("@elementor/editor-props");
|
|
2627
|
+
var import_editor_ui5 = require("@elementor/editor-ui");
|
|
2507
2628
|
var import_icons12 = require("@elementor/icons");
|
|
2508
|
-
var
|
|
2509
|
-
var
|
|
2629
|
+
var import_ui35 = require("@elementor/ui");
|
|
2630
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
2510
2631
|
var backgroundPositionOptions = [
|
|
2511
|
-
{ label: (0,
|
|
2512
|
-
{ label: (0,
|
|
2513
|
-
{ label: (0,
|
|
2514
|
-
{ label: (0,
|
|
2515
|
-
{ label: (0,
|
|
2516
|
-
{ label: (0,
|
|
2517
|
-
{ label: (0,
|
|
2518
|
-
{ label: (0,
|
|
2519
|
-
{ label: (0,
|
|
2520
|
-
{ label: (0,
|
|
2632
|
+
{ label: (0, import_i18n15.__)("Center center", "elementor"), value: "center center" },
|
|
2633
|
+
{ label: (0, import_i18n15.__)("Center left", "elementor"), value: "center left" },
|
|
2634
|
+
{ label: (0, import_i18n15.__)("Center right", "elementor"), value: "center right" },
|
|
2635
|
+
{ label: (0, import_i18n15.__)("Top center", "elementor"), value: "top center" },
|
|
2636
|
+
{ label: (0, import_i18n15.__)("Top left", "elementor"), value: "top left" },
|
|
2637
|
+
{ label: (0, import_i18n15.__)("Top right", "elementor"), value: "top right" },
|
|
2638
|
+
{ label: (0, import_i18n15.__)("Bottom center", "elementor"), value: "bottom center" },
|
|
2639
|
+
{ label: (0, import_i18n15.__)("Bottom left", "elementor"), value: "bottom left" },
|
|
2640
|
+
{ label: (0, import_i18n15.__)("Bottom right", "elementor"), value: "bottom right" },
|
|
2641
|
+
{ label: (0, import_i18n15.__)("Custom", "elementor"), value: "custom" }
|
|
2521
2642
|
];
|
|
2522
2643
|
var BackgroundImageOverlayPosition = () => {
|
|
2523
|
-
const backgroundImageOffsetContext = useBoundProp(
|
|
2524
|
-
const stringPropContext = useBoundProp(
|
|
2644
|
+
const backgroundImageOffsetContext = useBoundProp(import_editor_props21.backgroundImagePositionOffsetPropTypeUtil);
|
|
2645
|
+
const stringPropContext = useBoundProp(import_editor_props21.stringPropTypeUtil);
|
|
2525
2646
|
const isCustom = !!backgroundImageOffsetContext.value;
|
|
2526
2647
|
const handlePositionChange = (event) => {
|
|
2527
2648
|
const value = event.target.value || null;
|
|
@@ -2531,88 +2652,88 @@ var BackgroundImageOverlayPosition = () => {
|
|
|
2531
2652
|
stringPropContext.setValue(value);
|
|
2532
2653
|
}
|
|
2533
2654
|
};
|
|
2534
|
-
return /* @__PURE__ */
|
|
2535
|
-
|
|
2655
|
+
return /* @__PURE__ */ React42.createElement(import_ui35.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React42.createElement(import_ui35.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React42.createElement(PopoverGridContainer, null, /* @__PURE__ */ React42.createElement(import_ui35.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React42.createElement(ControlFormLabel, null, (0, import_i18n15.__)("Position", "elementor"))), /* @__PURE__ */ React42.createElement(import_ui35.Grid, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end", overflow: "hidden" } }, /* @__PURE__ */ React42.createElement(
|
|
2656
|
+
import_ui35.Select,
|
|
2536
2657
|
{
|
|
2537
2658
|
size: "tiny",
|
|
2538
2659
|
value: (backgroundImageOffsetContext.value ? "custom" : stringPropContext.value) ?? "",
|
|
2539
2660
|
onChange: handlePositionChange,
|
|
2540
2661
|
fullWidth: true
|
|
2541
2662
|
},
|
|
2542
|
-
backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */
|
|
2543
|
-
)))), isCustom ? /* @__PURE__ */
|
|
2663
|
+
backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ React42.createElement(import_editor_ui5.MenuListItem, { key: value, value: value ?? "" }, label))
|
|
2664
|
+
)))), isCustom ? /* @__PURE__ */ React42.createElement(PropProvider, { ...backgroundImageOffsetContext }, /* @__PURE__ */ React42.createElement(import_ui35.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React42.createElement(import_ui35.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React42.createElement(import_ui35.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React42.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ React42.createElement(SizeControl, { startIcon: /* @__PURE__ */ React42.createElement(import_icons12.LetterXIcon, { fontSize: "tiny" }) }))), /* @__PURE__ */ React42.createElement(import_ui35.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React42.createElement(PropKeyProvider, { bind: "y" }, /* @__PURE__ */ React42.createElement(SizeControl, { startIcon: /* @__PURE__ */ React42.createElement(import_icons12.LetterYIcon, { fontSize: "tiny" }) })))))) : null);
|
|
2544
2665
|
};
|
|
2545
2666
|
|
|
2546
2667
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx
|
|
2547
|
-
var
|
|
2668
|
+
var React43 = __toESM(require("react"));
|
|
2548
2669
|
var import_icons13 = require("@elementor/icons");
|
|
2549
|
-
var
|
|
2550
|
-
var
|
|
2670
|
+
var import_ui36 = require("@elementor/ui");
|
|
2671
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
2551
2672
|
var repeatControlOptions = [
|
|
2552
2673
|
{
|
|
2553
2674
|
value: "repeat",
|
|
2554
|
-
label: (0,
|
|
2555
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2675
|
+
label: (0, import_i18n16.__)("Repeat", "elementor"),
|
|
2676
|
+
renderContent: ({ size }) => /* @__PURE__ */ React43.createElement(import_icons13.GridDotsIcon, { fontSize: size }),
|
|
2556
2677
|
showTooltip: true
|
|
2557
2678
|
},
|
|
2558
2679
|
{
|
|
2559
2680
|
value: "repeat-x",
|
|
2560
|
-
label: (0,
|
|
2561
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2681
|
+
label: (0, import_i18n16.__)("Repeat-x", "elementor"),
|
|
2682
|
+
renderContent: ({ size }) => /* @__PURE__ */ React43.createElement(import_icons13.DotsHorizontalIcon, { fontSize: size }),
|
|
2562
2683
|
showTooltip: true
|
|
2563
2684
|
},
|
|
2564
2685
|
{
|
|
2565
2686
|
value: "repeat-y",
|
|
2566
|
-
label: (0,
|
|
2567
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2687
|
+
label: (0, import_i18n16.__)("Repeat-y", "elementor"),
|
|
2688
|
+
renderContent: ({ size }) => /* @__PURE__ */ React43.createElement(import_icons13.DotsVerticalIcon, { fontSize: size }),
|
|
2568
2689
|
showTooltip: true
|
|
2569
2690
|
},
|
|
2570
2691
|
{
|
|
2571
2692
|
value: "no-repeat",
|
|
2572
|
-
label: (0,
|
|
2573
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2693
|
+
label: (0, import_i18n16.__)("No-repeat", "elementor"),
|
|
2694
|
+
renderContent: ({ size }) => /* @__PURE__ */ React43.createElement(import_icons13.XIcon, { fontSize: size }),
|
|
2574
2695
|
showTooltip: true
|
|
2575
2696
|
}
|
|
2576
2697
|
];
|
|
2577
2698
|
var BackgroundImageOverlayRepeat = () => {
|
|
2578
|
-
return /* @__PURE__ */
|
|
2699
|
+
return /* @__PURE__ */ React43.createElement(PopoverGridContainer, null, /* @__PURE__ */ React43.createElement(import_ui36.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React43.createElement(ControlFormLabel, null, (0, import_i18n16.__)("Repeat", "elementor"))), /* @__PURE__ */ React43.createElement(import_ui36.Grid, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React43.createElement(ToggleControl, { options: repeatControlOptions })));
|
|
2579
2700
|
};
|
|
2580
2701
|
|
|
2581
2702
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx
|
|
2582
|
-
var
|
|
2583
|
-
var
|
|
2703
|
+
var React44 = __toESM(require("react"));
|
|
2704
|
+
var import_editor_props22 = require("@elementor/editor-props");
|
|
2584
2705
|
var import_icons14 = require("@elementor/icons");
|
|
2585
|
-
var
|
|
2586
|
-
var
|
|
2706
|
+
var import_ui37 = require("@elementor/ui");
|
|
2707
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
2587
2708
|
var sizeControlOptions = [
|
|
2588
2709
|
{
|
|
2589
2710
|
value: "auto",
|
|
2590
|
-
label: (0,
|
|
2591
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2711
|
+
label: (0, import_i18n17.__)("Auto", "elementor"),
|
|
2712
|
+
renderContent: ({ size }) => /* @__PURE__ */ React44.createElement(import_icons14.LetterAIcon, { fontSize: size }),
|
|
2592
2713
|
showTooltip: true
|
|
2593
2714
|
},
|
|
2594
2715
|
{
|
|
2595
2716
|
value: "cover",
|
|
2596
|
-
label: (0,
|
|
2597
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2717
|
+
label: (0, import_i18n17.__)("Cover", "elementor"),
|
|
2718
|
+
renderContent: ({ size }) => /* @__PURE__ */ React44.createElement(import_icons14.ArrowsMaximizeIcon, { fontSize: size }),
|
|
2598
2719
|
showTooltip: true
|
|
2599
2720
|
},
|
|
2600
2721
|
{
|
|
2601
2722
|
value: "contain",
|
|
2602
|
-
label: (0,
|
|
2603
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2723
|
+
label: (0, import_i18n17.__)("Contain", "elementor"),
|
|
2724
|
+
renderContent: ({ size }) => /* @__PURE__ */ React44.createElement(import_icons14.ArrowBarBothIcon, { fontSize: size }),
|
|
2604
2725
|
showTooltip: true
|
|
2605
2726
|
},
|
|
2606
2727
|
{
|
|
2607
2728
|
value: "custom",
|
|
2608
|
-
label: (0,
|
|
2609
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2729
|
+
label: (0, import_i18n17.__)("Custom", "elementor"),
|
|
2730
|
+
renderContent: ({ size }) => /* @__PURE__ */ React44.createElement(import_icons14.PencilIcon, { fontSize: size }),
|
|
2610
2731
|
showTooltip: true
|
|
2611
2732
|
}
|
|
2612
2733
|
];
|
|
2613
2734
|
var BackgroundImageOverlaySize = () => {
|
|
2614
|
-
const backgroundImageScaleContext = useBoundProp(
|
|
2615
|
-
const stringPropContext = useBoundProp(
|
|
2735
|
+
const backgroundImageScaleContext = useBoundProp(import_editor_props22.backgroundImageSizeScalePropTypeUtil);
|
|
2736
|
+
const stringPropContext = useBoundProp(import_editor_props22.stringPropTypeUtil);
|
|
2616
2737
|
const isCustom = !!backgroundImageScaleContext.value;
|
|
2617
2738
|
const handleSizeChange = (size) => {
|
|
2618
2739
|
if (size === "custom") {
|
|
@@ -2621,7 +2742,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
2621
2742
|
stringPropContext.setValue(size);
|
|
2622
2743
|
}
|
|
2623
2744
|
};
|
|
2624
|
-
return /* @__PURE__ */
|
|
2745
|
+
return /* @__PURE__ */ React44.createElement(import_ui37.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React44.createElement(import_ui37.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React44.createElement(PopoverGridContainer, null, /* @__PURE__ */ React44.createElement(import_ui37.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React44.createElement(ControlFormLabel, null, (0, import_i18n17.__)("Size", "elementor"))), /* @__PURE__ */ React44.createElement(import_ui37.Grid, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React44.createElement(
|
|
2625
2746
|
ControlToggleButtonGroup,
|
|
2626
2747
|
{
|
|
2627
2748
|
exclusive: true,
|
|
@@ -2629,33 +2750,33 @@ var BackgroundImageOverlaySize = () => {
|
|
|
2629
2750
|
value: backgroundImageScaleContext.value ? "custom" : stringPropContext.value,
|
|
2630
2751
|
onChange: handleSizeChange
|
|
2631
2752
|
}
|
|
2632
|
-
)))), isCustom ? /* @__PURE__ */
|
|
2753
|
+
)))), isCustom ? /* @__PURE__ */ React44.createElement(PropProvider, { ...backgroundImageScaleContext }, /* @__PURE__ */ React44.createElement(import_ui37.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React44.createElement(PopoverGridContainer, null, /* @__PURE__ */ React44.createElement(import_ui37.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React44.createElement(PropKeyProvider, { bind: "width" }, /* @__PURE__ */ React44.createElement(
|
|
2633
2754
|
SizeControl,
|
|
2634
2755
|
{
|
|
2635
|
-
startIcon: /* @__PURE__ */
|
|
2756
|
+
startIcon: /* @__PURE__ */ React44.createElement(import_icons14.ArrowsMoveHorizontalIcon, { fontSize: "tiny" }),
|
|
2636
2757
|
extendedValues: ["auto"]
|
|
2637
2758
|
}
|
|
2638
|
-
))), /* @__PURE__ */
|
|
2759
|
+
))), /* @__PURE__ */ React44.createElement(import_ui37.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React44.createElement(PropKeyProvider, { bind: "height" }, /* @__PURE__ */ React44.createElement(
|
|
2639
2760
|
SizeControl,
|
|
2640
2761
|
{
|
|
2641
|
-
startIcon: /* @__PURE__ */
|
|
2762
|
+
startIcon: /* @__PURE__ */ React44.createElement(import_icons14.ArrowsMoveVerticalIcon, { fontSize: "tiny" }),
|
|
2642
2763
|
extendedValues: ["auto"]
|
|
2643
2764
|
}
|
|
2644
2765
|
)))))) : null);
|
|
2645
2766
|
};
|
|
2646
2767
|
|
|
2647
2768
|
// src/controls/background-control/background-overlay/use-background-tabs-history.ts
|
|
2648
|
-
var
|
|
2649
|
-
var
|
|
2650
|
-
var
|
|
2769
|
+
var import_react19 = require("react");
|
|
2770
|
+
var import_editor_props23 = require("@elementor/editor-props");
|
|
2771
|
+
var import_ui38 = require("@elementor/ui");
|
|
2651
2772
|
var useBackgroundTabsHistory = ({
|
|
2652
2773
|
color: initialBackgroundColorOverlay2,
|
|
2653
2774
|
image: initialBackgroundImageOverlay,
|
|
2654
2775
|
gradient: initialBackgroundGradientOverlay2
|
|
2655
2776
|
}) => {
|
|
2656
|
-
const { value: imageValue, setValue: setImageValue } = useBoundProp(
|
|
2657
|
-
const { value: colorValue, setValue: setColorValue } = useBoundProp(
|
|
2658
|
-
const { value: gradientValue, setValue: setGradientValue } = useBoundProp(
|
|
2777
|
+
const { value: imageValue, setValue: setImageValue } = useBoundProp(import_editor_props23.backgroundImageOverlayPropTypeUtil);
|
|
2778
|
+
const { value: colorValue, setValue: setColorValue } = useBoundProp(import_editor_props23.backgroundColorOverlayPropTypeUtil);
|
|
2779
|
+
const { value: gradientValue, setValue: setGradientValue } = useBoundProp(import_editor_props23.backgroundGradientOverlayPropTypeUtil);
|
|
2659
2780
|
const getCurrentOverlayType = () => {
|
|
2660
2781
|
if (colorValue) {
|
|
2661
2782
|
return "color";
|
|
@@ -2665,8 +2786,8 @@ var useBackgroundTabsHistory = ({
|
|
|
2665
2786
|
}
|
|
2666
2787
|
return "image";
|
|
2667
2788
|
};
|
|
2668
|
-
const { getTabsProps, getTabProps, getTabPanelProps } = (0,
|
|
2669
|
-
const valuesHistory = (0,
|
|
2789
|
+
const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui38.useTabs)(getCurrentOverlayType());
|
|
2790
|
+
const valuesHistory = (0, import_react19.useRef)({
|
|
2670
2791
|
image: initialBackgroundImageOverlay,
|
|
2671
2792
|
color: initialBackgroundColorOverlay2,
|
|
2672
2793
|
gradient: initialBackgroundGradientOverlay2
|
|
@@ -2704,9 +2825,9 @@ var useBackgroundTabsHistory = ({
|
|
|
2704
2825
|
|
|
2705
2826
|
// src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
|
|
2706
2827
|
var DEFAULT_BACKGROUND_COLOR_OVERLAY_COLOR = "#00000033";
|
|
2707
|
-
var initialBackgroundColorOverlay =
|
|
2828
|
+
var initialBackgroundColorOverlay = import_editor_props24.backgroundColorOverlayPropTypeUtil.create(
|
|
2708
2829
|
{
|
|
2709
|
-
color:
|
|
2830
|
+
color: import_editor_props24.colorPropTypeUtil.create(DEFAULT_BACKGROUND_COLOR_OVERLAY_COLOR)
|
|
2710
2831
|
}
|
|
2711
2832
|
);
|
|
2712
2833
|
var getInitialBackgroundOverlay = () => ({
|
|
@@ -2734,20 +2855,20 @@ var getInitialBackgroundOverlay = () => ({
|
|
|
2734
2855
|
}
|
|
2735
2856
|
});
|
|
2736
2857
|
var backgroundResolutionOptions = [
|
|
2737
|
-
{ label: (0,
|
|
2738
|
-
{ label: (0,
|
|
2739
|
-
{ label: (0,
|
|
2740
|
-
{ label: (0,
|
|
2858
|
+
{ label: (0, import_i18n18.__)("Thumbnail - 150 x 150", "elementor"), value: "thumbnail" },
|
|
2859
|
+
{ label: (0, import_i18n18.__)("Medium - 300 x 300", "elementor"), value: "medium" },
|
|
2860
|
+
{ label: (0, import_i18n18.__)("Large 1024 x 1024", "elementor"), value: "large" },
|
|
2861
|
+
{ label: (0, import_i18n18.__)("Full", "elementor"), value: "full" }
|
|
2741
2862
|
];
|
|
2742
2863
|
var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
2743
|
-
const { propType, value: overlayValues, setValue } = useBoundProp(
|
|
2744
|
-
return /* @__PURE__ */
|
|
2864
|
+
const { propType, value: overlayValues, setValue } = useBoundProp(import_editor_props24.backgroundOverlayPropTypeUtil);
|
|
2865
|
+
return /* @__PURE__ */ React45.createElement(PropProvider, { propType, value: overlayValues, setValue }, /* @__PURE__ */ React45.createElement(
|
|
2745
2866
|
Repeater,
|
|
2746
2867
|
{
|
|
2747
2868
|
openOnAdd: true,
|
|
2748
2869
|
values: overlayValues ?? [],
|
|
2749
2870
|
setValues: setValue,
|
|
2750
|
-
label: (0,
|
|
2871
|
+
label: (0, import_i18n18.__)("Overlay", "elementor"),
|
|
2751
2872
|
itemSettings: {
|
|
2752
2873
|
Icon: ItemIcon2,
|
|
2753
2874
|
Label: ItemLabel2,
|
|
@@ -2757,36 +2878,36 @@ var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
|
2757
2878
|
}
|
|
2758
2879
|
));
|
|
2759
2880
|
});
|
|
2760
|
-
var ItemContent2 = ({ bind }) => {
|
|
2761
|
-
return /* @__PURE__ */
|
|
2881
|
+
var ItemContent2 = ({ anchorEl = null, bind }) => {
|
|
2882
|
+
return /* @__PURE__ */ React45.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React45.createElement(Content2, { anchorEl }));
|
|
2762
2883
|
};
|
|
2763
|
-
var Content2 = () => {
|
|
2884
|
+
var Content2 = ({ anchorEl }) => {
|
|
2764
2885
|
const { getTabsProps, getTabProps, getTabPanelProps } = useBackgroundTabsHistory({
|
|
2765
2886
|
image: getInitialBackgroundOverlay().value,
|
|
2766
2887
|
color: initialBackgroundColorOverlay.value,
|
|
2767
2888
|
gradient: initialBackgroundGradientOverlay.value
|
|
2768
2889
|
});
|
|
2769
|
-
return /* @__PURE__ */
|
|
2770
|
-
|
|
2890
|
+
return /* @__PURE__ */ React45.createElement(import_ui39.Box, { sx: { width: "100%" } }, /* @__PURE__ */ React45.createElement(import_ui39.Box, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React45.createElement(
|
|
2891
|
+
import_ui39.Tabs,
|
|
2771
2892
|
{
|
|
2772
2893
|
size: "small",
|
|
2773
2894
|
variant: "fullWidth",
|
|
2774
2895
|
...getTabsProps(),
|
|
2775
|
-
"aria-label": (0,
|
|
2896
|
+
"aria-label": (0, import_i18n18.__)("Background Overlay", "elementor")
|
|
2776
2897
|
},
|
|
2777
|
-
/* @__PURE__ */
|
|
2778
|
-
/* @__PURE__ */
|
|
2779
|
-
/* @__PURE__ */
|
|
2780
|
-
)), /* @__PURE__ */
|
|
2898
|
+
/* @__PURE__ */ React45.createElement(import_ui39.Tab, { label: (0, import_i18n18.__)("Image", "elementor"), ...getTabProps("image") }),
|
|
2899
|
+
/* @__PURE__ */ React45.createElement(import_ui39.Tab, { label: (0, import_i18n18.__)("Gradient", "elementor"), ...getTabProps("gradient") }),
|
|
2900
|
+
/* @__PURE__ */ React45.createElement(import_ui39.Tab, { label: (0, import_i18n18.__)("Color", "elementor"), ...getTabProps("color") })
|
|
2901
|
+
)), /* @__PURE__ */ React45.createElement(import_ui39.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("image") }, /* @__PURE__ */ React45.createElement(PopoverContent, null, /* @__PURE__ */ React45.createElement(ImageOverlayContent, null))), /* @__PURE__ */ React45.createElement(import_ui39.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("gradient") }, /* @__PURE__ */ React45.createElement(BackgroundGradientColorControl, null)), /* @__PURE__ */ React45.createElement(import_ui39.TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("color") }, /* @__PURE__ */ React45.createElement(PopoverContent, null, /* @__PURE__ */ React45.createElement(ColorOverlayContent, { anchorEl }))));
|
|
2781
2902
|
};
|
|
2782
2903
|
var ItemIcon2 = ({ value }) => {
|
|
2783
2904
|
switch (value.$$type) {
|
|
2784
2905
|
case "background-image-overlay":
|
|
2785
|
-
return /* @__PURE__ */
|
|
2906
|
+
return /* @__PURE__ */ React45.createElement(ItemIconImage, { value });
|
|
2786
2907
|
case "background-color-overlay":
|
|
2787
|
-
return /* @__PURE__ */
|
|
2908
|
+
return /* @__PURE__ */ React45.createElement(ItemIconColor, { value });
|
|
2788
2909
|
case "background-gradient-overlay":
|
|
2789
|
-
return /* @__PURE__ */
|
|
2910
|
+
return /* @__PURE__ */ React45.createElement(ItemIconGradient, { value });
|
|
2790
2911
|
default:
|
|
2791
2912
|
return null;
|
|
2792
2913
|
}
|
|
@@ -2799,12 +2920,12 @@ var extractColorFrom = (prop) => {
|
|
|
2799
2920
|
};
|
|
2800
2921
|
var ItemIconColor = ({ value: prop }) => {
|
|
2801
2922
|
const color = extractColorFrom(prop);
|
|
2802
|
-
return /* @__PURE__ */
|
|
2923
|
+
return /* @__PURE__ */ React45.createElement(StyledUnstableColorIndicator, { size: "inherit", component: "span", value: color });
|
|
2803
2924
|
};
|
|
2804
2925
|
var ItemIconImage = ({ value }) => {
|
|
2805
2926
|
const { imageUrl } = useImage(value);
|
|
2806
|
-
return /* @__PURE__ */
|
|
2807
|
-
|
|
2927
|
+
return /* @__PURE__ */ React45.createElement(
|
|
2928
|
+
import_ui39.CardMedia,
|
|
2808
2929
|
{
|
|
2809
2930
|
image: imageUrl,
|
|
2810
2931
|
sx: (theme) => ({
|
|
@@ -2818,49 +2939,49 @@ var ItemIconImage = ({ value }) => {
|
|
|
2818
2939
|
};
|
|
2819
2940
|
var ItemIconGradient = ({ value }) => {
|
|
2820
2941
|
const gradient = getGradientValue(value);
|
|
2821
|
-
return /* @__PURE__ */
|
|
2942
|
+
return /* @__PURE__ */ React45.createElement(StyledUnstableColorIndicator, { size: "inherit", component: "span", value: gradient });
|
|
2822
2943
|
};
|
|
2823
2944
|
var ItemLabel2 = ({ value }) => {
|
|
2824
2945
|
switch (value.$$type) {
|
|
2825
2946
|
case "background-image-overlay":
|
|
2826
|
-
return /* @__PURE__ */
|
|
2947
|
+
return /* @__PURE__ */ React45.createElement(ItemLabelImage, { value });
|
|
2827
2948
|
case "background-color-overlay":
|
|
2828
|
-
return /* @__PURE__ */
|
|
2949
|
+
return /* @__PURE__ */ React45.createElement(ItemLabelColor, { value });
|
|
2829
2950
|
case "background-gradient-overlay":
|
|
2830
|
-
return /* @__PURE__ */
|
|
2951
|
+
return /* @__PURE__ */ React45.createElement(ItemLabelGradient, { value });
|
|
2831
2952
|
default:
|
|
2832
2953
|
return null;
|
|
2833
2954
|
}
|
|
2834
2955
|
};
|
|
2835
2956
|
var ItemLabelColor = ({ value: prop }) => {
|
|
2836
2957
|
const color = extractColorFrom(prop);
|
|
2837
|
-
return /* @__PURE__ */
|
|
2958
|
+
return /* @__PURE__ */ React45.createElement("span", null, color);
|
|
2838
2959
|
};
|
|
2839
2960
|
var ItemLabelImage = ({ value }) => {
|
|
2840
2961
|
const { imageTitle } = useImage(value);
|
|
2841
|
-
return /* @__PURE__ */
|
|
2962
|
+
return /* @__PURE__ */ React45.createElement("span", null, imageTitle);
|
|
2842
2963
|
};
|
|
2843
2964
|
var ItemLabelGradient = ({ value }) => {
|
|
2844
2965
|
if (value.value.type.value === "linear") {
|
|
2845
|
-
return /* @__PURE__ */
|
|
2966
|
+
return /* @__PURE__ */ React45.createElement("span", null, (0, import_i18n18.__)("Linear Gradient", "elementor"));
|
|
2846
2967
|
}
|
|
2847
|
-
return /* @__PURE__ */
|
|
2968
|
+
return /* @__PURE__ */ React45.createElement("span", null, (0, import_i18n18.__)("Radial Gradient", "elementor"));
|
|
2848
2969
|
};
|
|
2849
|
-
var ColorOverlayContent = () => {
|
|
2850
|
-
const propContext = useBoundProp(
|
|
2851
|
-
return /* @__PURE__ */
|
|
2970
|
+
var ColorOverlayContent = ({ anchorEl }) => {
|
|
2971
|
+
const propContext = useBoundProp(import_editor_props24.backgroundColorOverlayPropTypeUtil);
|
|
2972
|
+
return /* @__PURE__ */ React45.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React45.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React45.createElement(ColorControl, { anchorEl })));
|
|
2852
2973
|
};
|
|
2853
2974
|
var ImageOverlayContent = () => {
|
|
2854
|
-
const propContext = useBoundProp(
|
|
2855
|
-
return /* @__PURE__ */
|
|
2975
|
+
const propContext = useBoundProp(import_editor_props24.backgroundImageOverlayPropTypeUtil);
|
|
2976
|
+
return /* @__PURE__ */ React45.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React45.createElement(PropKeyProvider, { bind: "image" }, /* @__PURE__ */ React45.createElement(import_ui39.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React45.createElement(import_ui39.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React45.createElement(
|
|
2856
2977
|
ImageControl,
|
|
2857
2978
|
{
|
|
2858
|
-
resolutionLabel: (0,
|
|
2979
|
+
resolutionLabel: (0, import_i18n18.__)("Resolution", "elementor"),
|
|
2859
2980
|
sizes: backgroundResolutionOptions
|
|
2860
2981
|
}
|
|
2861
|
-
)))), /* @__PURE__ */
|
|
2982
|
+
)))), /* @__PURE__ */ React45.createElement(PropKeyProvider, { bind: "position" }, /* @__PURE__ */ React45.createElement(BackgroundImageOverlayPosition, null)), /* @__PURE__ */ React45.createElement(PropKeyProvider, { bind: "repeat" }, /* @__PURE__ */ React45.createElement(BackgroundImageOverlayRepeat, null)), /* @__PURE__ */ React45.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React45.createElement(BackgroundImageOverlaySize, null)), /* @__PURE__ */ React45.createElement(PropKeyProvider, { bind: "attachment" }, /* @__PURE__ */ React45.createElement(BackgroundImageOverlayAttachment, null)));
|
|
2862
2983
|
};
|
|
2863
|
-
var StyledUnstableColorIndicator = (0,
|
|
2984
|
+
var StyledUnstableColorIndicator = (0, import_ui39.styled)(import_ui39.UnstableColorIndicator)(({ theme }) => ({
|
|
2864
2985
|
borderRadius: `${theme.shape.borderRadius / 2}px`
|
|
2865
2986
|
}));
|
|
2866
2987
|
var useImage = (image) => {
|
|
@@ -2895,11 +3016,26 @@ var getGradientValue = (value) => {
|
|
|
2895
3016
|
|
|
2896
3017
|
// src/controls/background-control/background-control.tsx
|
|
2897
3018
|
var BackgroundControl = createControl(() => {
|
|
2898
|
-
const propContext = useBoundProp(
|
|
2899
|
-
|
|
3019
|
+
const propContext = useBoundProp(import_editor_props25.backgroundPropTypeUtil);
|
|
3020
|
+
const isUsingNestedProps = (0, import_editor_v1_adapters.isExperimentActive)("e_v_3_30");
|
|
3021
|
+
const colorLabel = (0, import_i18n19.__)("Color", "elementor");
|
|
3022
|
+
return /* @__PURE__ */ React46.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React46.createElement(SectionContent, null, /* @__PURE__ */ React46.createElement(PropKeyProvider, { bind: "background-overlay" }, /* @__PURE__ */ React46.createElement(BackgroundOverlayRepeaterControl, null)), /* @__PURE__ */ React46.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React46.createElement(import_ui40.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React46.createElement(import_ui40.Grid, { item: true, xs: 6 }, isUsingNestedProps ? /* @__PURE__ */ React46.createElement(ControlLabel, null, colorLabel) : /* @__PURE__ */ React46.createElement(ControlFormLabel, null, colorLabel)), /* @__PURE__ */ React46.createElement(import_ui40.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React46.createElement(ColorControl, null))))));
|
|
3023
|
+
});
|
|
3024
|
+
|
|
3025
|
+
// src/controls/switch-control.tsx
|
|
3026
|
+
var React47 = __toESM(require("react"));
|
|
3027
|
+
var import_editor_props26 = require("@elementor/editor-props");
|
|
3028
|
+
var import_ui41 = require("@elementor/ui");
|
|
3029
|
+
var SwitchControl2 = createControl(() => {
|
|
3030
|
+
const { value, setValue } = useBoundProp(import_editor_props26.booleanPropTypeUtil);
|
|
3031
|
+
const handleChange = (event) => {
|
|
3032
|
+
setValue(event.target.checked);
|
|
3033
|
+
};
|
|
3034
|
+
return /* @__PURE__ */ React47.createElement("div", { style: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React47.createElement(import_ui41.Switch, { checked: !!value, onChange: handleChange, size: "small" }));
|
|
2900
3035
|
});
|
|
2901
3036
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2902
3037
|
0 && (module.exports = {
|
|
3038
|
+
AspectRatioControl,
|
|
2903
3039
|
BackgroundControl,
|
|
2904
3040
|
BoxShadowRepeaterControl,
|
|
2905
3041
|
ColorControl,
|
|
@@ -2922,6 +3058,7 @@ var BackgroundControl = createControl(() => {
|
|
|
2922
3058
|
SizeControl,
|
|
2923
3059
|
StrokeControl,
|
|
2924
3060
|
SvgMediaControl,
|
|
3061
|
+
SwitchControl,
|
|
2925
3062
|
TextAreaControl,
|
|
2926
3063
|
TextControl,
|
|
2927
3064
|
ToggleControl,
|