@elementor/editor-controls 0.15.0 → 0.17.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 +45 -0
- package/dist/index.d.mts +19 -6
- package/dist/index.d.ts +19 -6
- package/dist/index.js +478 -178
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +484 -165
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -6
- package/src/components/control-toggle-button-group.tsx +5 -0
- package/src/components/enable-unfiltered-modal.tsx +130 -0
- package/src/components/repeater.tsx +39 -10
- package/src/components/sortable.tsx +2 -7
- package/src/controls/background-control/background-gradient-color-control.tsx +101 -0
- package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +80 -14
- package/src/controls/background-control/background-overlay/use-background-tabs-history.ts +29 -2
- package/src/controls/box-shadow-repeater-control.tsx +15 -4
- package/src/controls/equal-unequal-sizes-control.tsx +1 -1
- package/src/controls/font-family-control/font-family-control.tsx +35 -14
- package/src/controls/link-control.tsx +11 -2
- package/src/controls/svg-media-control.tsx +20 -5
- package/src/controls/toggle-control.tsx +36 -10
- package/src/hooks/use-filtered-font-families.ts +15 -16
- package/src/index.ts +2 -0
- package/src/utils/link-restriction.ts +47 -0
- package/src/utils/types.ts +5 -0
package/dist/index.mjs
CHANGED
|
@@ -232,6 +232,17 @@ var useUnfilteredFilesUpload = () => useQuery({
|
|
|
232
232
|
}),
|
|
233
233
|
staleTime: Infinity
|
|
234
234
|
});
|
|
235
|
+
function useUpdateUnfilteredFilesUpload() {
|
|
236
|
+
const queryClient = useQueryClient();
|
|
237
|
+
const mutate = useMutation({
|
|
238
|
+
mutationFn: ({ allowUnfilteredFilesUpload }) => apiClient.updateElementorSetting(
|
|
239
|
+
UNFILTERED_FILES_UPLOAD_KEY,
|
|
240
|
+
allowUnfilteredFilesUpload ? "1" : "0"
|
|
241
|
+
),
|
|
242
|
+
onSuccess: () => queryClient.invalidateQueries(unfilteredFilesQueryKey)
|
|
243
|
+
});
|
|
244
|
+
return mutate;
|
|
245
|
+
}
|
|
235
246
|
var formatResponse = (response) => {
|
|
236
247
|
return Boolean(response === "1");
|
|
237
248
|
};
|
|
@@ -630,7 +641,7 @@ var PopoverGridContainer = ({
|
|
|
630
641
|
|
|
631
642
|
// src/components/repeater.tsx
|
|
632
643
|
import * as React21 from "react";
|
|
633
|
-
import {
|
|
644
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
634
645
|
import { CopyIcon, EyeIcon, EyeOffIcon, PlusIcon, XIcon } from "@elementor/icons";
|
|
635
646
|
import {
|
|
636
647
|
bindPopover,
|
|
@@ -658,15 +669,7 @@ import {
|
|
|
658
669
|
UnstableSortableProvider
|
|
659
670
|
} from "@elementor/ui";
|
|
660
671
|
var SortableProvider = (props) => {
|
|
661
|
-
return /* @__PURE__ */ React20.createElement(List, { sx: { p: 0,
|
|
662
|
-
UnstableSortableProvider,
|
|
663
|
-
{
|
|
664
|
-
restrictAxis: true,
|
|
665
|
-
disableDragOverlay: false,
|
|
666
|
-
variant: "static",
|
|
667
|
-
...props
|
|
668
|
-
}
|
|
669
|
-
));
|
|
672
|
+
return /* @__PURE__ */ React20.createElement(List, { sx: { p: 0, my: -0.5, mx: 0 } }, /* @__PURE__ */ React20.createElement(UnstableSortableProvider, { restrictAxis: true, disableDragOverlay: false, variant: "static", ...props }));
|
|
670
673
|
};
|
|
671
674
|
var SortableItem = ({ id, children }) => {
|
|
672
675
|
return /* @__PURE__ */ React20.createElement(
|
|
@@ -744,10 +747,12 @@ var SIZE = "tiny";
|
|
|
744
747
|
var Repeater = ({
|
|
745
748
|
label,
|
|
746
749
|
itemSettings,
|
|
750
|
+
openOnAdd = false,
|
|
747
751
|
addToBottom = false,
|
|
748
752
|
values: repeaterValues = [],
|
|
749
753
|
setValues: setRepeaterValues
|
|
750
754
|
}) => {
|
|
755
|
+
const [openItem, setOpenItem] = useState2(-1);
|
|
751
756
|
const [items, setItems] = useSyncExternalState({
|
|
752
757
|
external: repeaterValues,
|
|
753
758
|
// @ts-expect-error - as long as persistWhen => true, value will never be null
|
|
@@ -768,6 +773,9 @@ var Repeater = ({
|
|
|
768
773
|
setItems([newItem, ...items]);
|
|
769
774
|
setUniqueKeys([newKey, ...uniqueKeys]);
|
|
770
775
|
}
|
|
776
|
+
if (openOnAdd) {
|
|
777
|
+
setOpenItem(newKey);
|
|
778
|
+
}
|
|
771
779
|
};
|
|
772
780
|
const duplicateRepeaterItem = (index) => {
|
|
773
781
|
const newItem = structuredClone(items[index]);
|
|
@@ -822,7 +830,8 @@ var Repeater = ({
|
|
|
822
830
|
startIcon: /* @__PURE__ */ React21.createElement(itemSettings.Icon, { value }),
|
|
823
831
|
removeItem: () => removeRepeaterItem(index),
|
|
824
832
|
duplicateItem: () => duplicateRepeaterItem(index),
|
|
825
|
-
toggleDisableItem: () => toggleDisableRepeaterItem(index)
|
|
833
|
+
toggleDisableItem: () => toggleDisableRepeaterItem(index),
|
|
834
|
+
openOnMount: openOnAdd && openItem === key
|
|
826
835
|
},
|
|
827
836
|
(props) => /* @__PURE__ */ React21.createElement(itemSettings.Content, { ...props, value, bind: String(index) })
|
|
828
837
|
));
|
|
@@ -830,19 +839,16 @@ var Repeater = ({
|
|
|
830
839
|
};
|
|
831
840
|
var RepeaterItem = ({
|
|
832
841
|
label,
|
|
833
|
-
bind,
|
|
834
842
|
disabled,
|
|
835
843
|
startIcon,
|
|
836
844
|
children,
|
|
837
845
|
removeItem,
|
|
838
846
|
duplicateItem,
|
|
839
|
-
toggleDisableItem
|
|
847
|
+
toggleDisableItem,
|
|
848
|
+
openOnMount
|
|
840
849
|
}) => {
|
|
841
|
-
const popupId = `repeater-popup-${bind}`;
|
|
842
|
-
const controlRef = useRef(null);
|
|
843
850
|
const [anchorEl, setAnchorEl] = useState2(null);
|
|
844
|
-
const popoverState
|
|
845
|
-
const popoverProps = bindPopover(popoverState);
|
|
851
|
+
const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount);
|
|
846
852
|
const duplicateLabel = __4("Duplicate", "elementor");
|
|
847
853
|
const toggleLabel = disabled ? __4("Show", "elementor") : __4("Hide", "elementor");
|
|
848
854
|
const removeLabel = __4("Remove", "elementor");
|
|
@@ -852,7 +858,7 @@ var RepeaterItem = ({
|
|
|
852
858
|
label,
|
|
853
859
|
showActionsOnHover: true,
|
|
854
860
|
fullWidth: true,
|
|
855
|
-
ref:
|
|
861
|
+
ref: setRef,
|
|
856
862
|
variant: "outlined",
|
|
857
863
|
"aria-label": __4("Open item", "elementor"),
|
|
858
864
|
...bindTrigger2(popoverState),
|
|
@@ -867,15 +873,32 @@ var RepeaterItem = ({
|
|
|
867
873
|
slotProps: {
|
|
868
874
|
paper: {
|
|
869
875
|
ref: setAnchorEl,
|
|
870
|
-
sx: { mt: 0.5, width:
|
|
876
|
+
sx: { mt: 0.5, width: ref?.getBoundingClientRect().width }
|
|
871
877
|
}
|
|
872
878
|
},
|
|
873
879
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
874
|
-
...popoverProps
|
|
880
|
+
...popoverProps,
|
|
881
|
+
anchorEl: ref
|
|
875
882
|
},
|
|
876
883
|
/* @__PURE__ */ React21.createElement(Box, null, children({ anchorEl }))
|
|
877
884
|
));
|
|
878
885
|
};
|
|
886
|
+
var usePopover = (openOnMount) => {
|
|
887
|
+
const [ref, setRef] = useState2(null);
|
|
888
|
+
const popoverState = usePopupState2({ variant: "popover" });
|
|
889
|
+
const popoverProps = bindPopover(popoverState);
|
|
890
|
+
useEffect2(() => {
|
|
891
|
+
if (openOnMount && ref) {
|
|
892
|
+
popoverState.open(ref);
|
|
893
|
+
}
|
|
894
|
+
}, [ref]);
|
|
895
|
+
return {
|
|
896
|
+
popoverState,
|
|
897
|
+
ref,
|
|
898
|
+
setRef,
|
|
899
|
+
popoverProps
|
|
900
|
+
};
|
|
901
|
+
};
|
|
879
902
|
|
|
880
903
|
// src/controls/box-shadow-repeater-control.tsx
|
|
881
904
|
var BoxShadowRepeaterControl = createControl(() => {
|
|
@@ -883,6 +906,7 @@ var BoxShadowRepeaterControl = createControl(() => {
|
|
|
883
906
|
return /* @__PURE__ */ React22.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React22.createElement(
|
|
884
907
|
Repeater,
|
|
885
908
|
{
|
|
909
|
+
openOnAdd: true,
|
|
886
910
|
values: value ?? [],
|
|
887
911
|
setValues: setValue,
|
|
888
912
|
label: __5("Box shadow", "elementor"),
|
|
@@ -918,7 +942,7 @@ var Content = ({ anchorEl }) => {
|
|
|
918
942
|
}
|
|
919
943
|
}
|
|
920
944
|
}
|
|
921
|
-
)), /* @__PURE__ */ React22.createElement(Control2, { bind: "position", label: __5("Position", "elementor") }, /* @__PURE__ */ React22.createElement(
|
|
945
|
+
)), /* @__PURE__ */ React22.createElement(Control2, { bind: "position", label: __5("Position", "elementor"), sx: { overflow: "hidden" } }, /* @__PURE__ */ React22.createElement(
|
|
922
946
|
SelectControl,
|
|
923
947
|
{
|
|
924
948
|
options: [
|
|
@@ -928,7 +952,12 @@ var Content = ({ anchorEl }) => {
|
|
|
928
952
|
}
|
|
929
953
|
))), /* @__PURE__ */ React22.createElement(PopoverGridContainer, null, /* @__PURE__ */ React22.createElement(Control2, { bind: "hOffset", label: __5("Horizontal", "elementor") }, /* @__PURE__ */ React22.createElement(SizeControl, null)), /* @__PURE__ */ React22.createElement(Control2, { bind: "vOffset", label: __5("Vertical", "elementor") }, /* @__PURE__ */ React22.createElement(SizeControl, null))), /* @__PURE__ */ React22.createElement(PopoverGridContainer, null, /* @__PURE__ */ React22.createElement(Control2, { bind: "blur", label: __5("Blur", "elementor") }, /* @__PURE__ */ React22.createElement(SizeControl, null)), /* @__PURE__ */ React22.createElement(Control2, { bind: "spread", label: __5("Spread", "elementor") }, /* @__PURE__ */ React22.createElement(SizeControl, null)))));
|
|
930
954
|
};
|
|
931
|
-
var Control2 = ({
|
|
955
|
+
var Control2 = ({
|
|
956
|
+
label,
|
|
957
|
+
bind,
|
|
958
|
+
children,
|
|
959
|
+
sx
|
|
960
|
+
}) => /* @__PURE__ */ React22.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React22.createElement(Grid4, { item: true, xs: 6, sx }, /* @__PURE__ */ React22.createElement(Grid4, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React22.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(Typography3, { component: "label", variant: "caption", color: "text.secondary" }, label)), /* @__PURE__ */ React22.createElement(Grid4, { item: true, xs: 12 }, children))));
|
|
932
961
|
var ItemLabel = ({ value }) => {
|
|
933
962
|
const { position, hOffset, vOffset, blur, spread } = value.value;
|
|
934
963
|
const { size: blurSize = "", unit: blurUnit = "" } = blur?.value || {};
|
|
@@ -987,6 +1016,7 @@ import {
|
|
|
987
1016
|
var StyledToggleButtonGroup = styled3(ToggleButtonGroup)`
|
|
988
1017
|
${({ justify }) => `justify-content: ${justify};`}
|
|
989
1018
|
`;
|
|
1019
|
+
var MAX_VISIBLE_ITEMS = 4;
|
|
990
1020
|
var ControlToggleButtonGroup = ({
|
|
991
1021
|
justify = "end",
|
|
992
1022
|
size = "tiny",
|
|
@@ -1008,7 +1038,10 @@ var ControlToggleButtonGroup = ({
|
|
|
1008
1038
|
onChange: handleChange,
|
|
1009
1039
|
exclusive,
|
|
1010
1040
|
sx: {
|
|
1011
|
-
direction: isRtl ? "rtl /* @noflip */" : "ltr /* @noflip */"
|
|
1041
|
+
direction: isRtl ? "rtl /* @noflip */" : "ltr /* @noflip */",
|
|
1042
|
+
display: "grid",
|
|
1043
|
+
gridTemplateColumns: `repeat(${items.length}, 1fr)`,
|
|
1044
|
+
width: `${items.length / MAX_VISIBLE_ITEMS * 100}%`
|
|
1012
1045
|
}
|
|
1013
1046
|
},
|
|
1014
1047
|
items.map(
|
|
@@ -1029,20 +1062,40 @@ var ControlToggleButtonGroup = ({
|
|
|
1029
1062
|
|
|
1030
1063
|
// src/controls/toggle-control.tsx
|
|
1031
1064
|
var ToggleControl = createControl(
|
|
1032
|
-
({
|
|
1065
|
+
({
|
|
1066
|
+
options,
|
|
1067
|
+
fullWidth = false,
|
|
1068
|
+
size = "tiny",
|
|
1069
|
+
exclusive = true
|
|
1070
|
+
}) => {
|
|
1033
1071
|
const { value, setValue } = useBoundProp(stringPropTypeUtil5);
|
|
1034
|
-
const
|
|
1035
|
-
|
|
1072
|
+
const exclusiveValues = options.filter((option) => option.exclusive).map((option) => option.value);
|
|
1073
|
+
const handleNonExclusiveToggle = (selectedValues) => {
|
|
1074
|
+
const newSelectedValue = selectedValues[selectedValues.length - 1];
|
|
1075
|
+
const isNewSelectedValueExclusive = exclusiveValues.includes(newSelectedValue);
|
|
1076
|
+
const updatedValues = isNewSelectedValueExclusive ? [newSelectedValue] : selectedValues?.filter((val) => !exclusiveValues.includes(val));
|
|
1077
|
+
setValue(updatedValues?.join(" ") || null);
|
|
1078
|
+
};
|
|
1079
|
+
const toggleButtonGroupProps = {
|
|
1080
|
+
items: options,
|
|
1081
|
+
fullWidth,
|
|
1082
|
+
size
|
|
1036
1083
|
};
|
|
1037
|
-
return /* @__PURE__ */ React24.createElement(
|
|
1084
|
+
return exclusive ? /* @__PURE__ */ React24.createElement(
|
|
1038
1085
|
ControlToggleButtonGroup,
|
|
1039
1086
|
{
|
|
1040
|
-
|
|
1087
|
+
...toggleButtonGroupProps,
|
|
1041
1088
|
value: value ?? null,
|
|
1042
|
-
onChange:
|
|
1043
|
-
exclusive: true
|
|
1044
|
-
|
|
1045
|
-
|
|
1089
|
+
onChange: setValue,
|
|
1090
|
+
exclusive: true
|
|
1091
|
+
}
|
|
1092
|
+
) : /* @__PURE__ */ React24.createElement(
|
|
1093
|
+
ControlToggleButtonGroup,
|
|
1094
|
+
{
|
|
1095
|
+
...toggleButtonGroupProps,
|
|
1096
|
+
value: value?.split(" ") ?? [],
|
|
1097
|
+
onChange: handleNonExclusiveToggle,
|
|
1098
|
+
exclusive: false
|
|
1046
1099
|
}
|
|
1047
1100
|
);
|
|
1048
1101
|
}
|
|
@@ -1088,7 +1141,7 @@ var NumberControl = createControl(
|
|
|
1088
1141
|
|
|
1089
1142
|
// src/controls/equal-unequal-sizes-control.tsx
|
|
1090
1143
|
import * as React26 from "react";
|
|
1091
|
-
import { useId as useId2, useRef
|
|
1144
|
+
import { useId as useId2, useRef } from "react";
|
|
1092
1145
|
import { sizePropTypeUtil as sizePropTypeUtil2 } from "@elementor/editor-props";
|
|
1093
1146
|
import { bindPopover as bindPopover2, bindToggle, Grid as Grid5, Popover as Popover2, Stack as Stack6, ToggleButton as ToggleButton2, Tooltip as Tooltip3, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
1094
1147
|
import { __ as __6 } from "@wordpress/i18n";
|
|
@@ -1110,7 +1163,7 @@ function EqualUnequalSizesControl({
|
|
|
1110
1163
|
multiSizePropTypeUtil
|
|
1111
1164
|
}) {
|
|
1112
1165
|
const popupId = useId2();
|
|
1113
|
-
const controlRef =
|
|
1166
|
+
const controlRef = useRef(null);
|
|
1114
1167
|
const popupState = usePopupState3({ variant: "popover", popupId });
|
|
1115
1168
|
const {
|
|
1116
1169
|
propType: multiSizePropType,
|
|
@@ -1174,7 +1227,7 @@ function EqualUnequalSizesControl({
|
|
|
1174
1227
|
paper: { sx: { mt: 0.5, width: controlRef.current?.getBoundingClientRect().width } }
|
|
1175
1228
|
}
|
|
1176
1229
|
},
|
|
1177
|
-
/* @__PURE__ */ React26.createElement(PropProvider, { propType: multiSizePropType, value: getMultiSizeValues(), setValue: setNestedProp }, /* @__PURE__ */ React26.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React26.createElement(PopoverGridContainer, null, /* @__PURE__ */ React26.createElement(MultiSizeValueControl, { item: items[0] }), /* @__PURE__ */ React26.createElement(MultiSizeValueControl, { item: items[1] })), /* @__PURE__ */ React26.createElement(PopoverGridContainer, null, /* @__PURE__ */ React26.createElement(MultiSizeValueControl, { item: items[
|
|
1230
|
+
/* @__PURE__ */ React26.createElement(PropProvider, { propType: multiSizePropType, value: getMultiSizeValues(), setValue: setNestedProp }, /* @__PURE__ */ React26.createElement(PopoverContent, { p: 1.5 }, /* @__PURE__ */ React26.createElement(PopoverGridContainer, null, /* @__PURE__ */ React26.createElement(MultiSizeValueControl, { item: items[0] }), /* @__PURE__ */ React26.createElement(MultiSizeValueControl, { item: items[1] })), /* @__PURE__ */ React26.createElement(PopoverGridContainer, null, /* @__PURE__ */ React26.createElement(MultiSizeValueControl, { item: items[2] }), /* @__PURE__ */ React26.createElement(MultiSizeValueControl, { item: items[3] }))))
|
|
1178
1231
|
));
|
|
1179
1232
|
}
|
|
1180
1233
|
var MultiSizeValueControl = ({ item }) => /* @__PURE__ */ React26.createElement(PropKeyProvider, { bind: item.bind }, /* @__PURE__ */ React26.createElement(Grid5, { item: true, xs: 6 }, /* @__PURE__ */ React26.createElement(Grid5, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React26.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React26.createElement(ControlLabel, null, item.label)), /* @__PURE__ */ React26.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React26.createElement(SizeControl, { startIcon: item.icon })))));
|
|
@@ -1275,9 +1328,9 @@ var Control3 = ({
|
|
|
1275
1328
|
|
|
1276
1329
|
// src/controls/font-family-control/font-family-control.tsx
|
|
1277
1330
|
import * as React28 from "react";
|
|
1278
|
-
import { useEffect as
|
|
1331
|
+
import { useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
|
|
1279
1332
|
import { stringPropTypeUtil as stringPropTypeUtil6 } from "@elementor/editor-props";
|
|
1280
|
-
import { ChevronDownIcon,
|
|
1333
|
+
import { ChevronDownIcon, SearchIcon, TextIcon, XIcon as XIcon2 } from "@elementor/icons";
|
|
1281
1334
|
import {
|
|
1282
1335
|
bindPopover as bindPopover3,
|
|
1283
1336
|
bindTrigger as bindTrigger3,
|
|
@@ -1302,20 +1355,18 @@ import { __ as __8 } from "@wordpress/i18n";
|
|
|
1302
1355
|
|
|
1303
1356
|
// src/hooks/use-filtered-font-families.ts
|
|
1304
1357
|
var useFilteredFontFamilies = (fontFamilies, searchValue) => {
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
});
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
);
|
|
1318
|
-
return [...filteredFontFamilies];
|
|
1358
|
+
return fontFamilies.reduce((acc, category) => {
|
|
1359
|
+
const filteredFonts = category.fonts.filter(
|
|
1360
|
+
(font) => font.toLowerCase().includes(searchValue.toLowerCase())
|
|
1361
|
+
);
|
|
1362
|
+
if (filteredFonts.length) {
|
|
1363
|
+
acc.push({ type: "category", value: category.label });
|
|
1364
|
+
filteredFonts.forEach((font) => {
|
|
1365
|
+
acc.push({ type: "font", value: font });
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
return acc;
|
|
1369
|
+
}, []);
|
|
1319
1370
|
};
|
|
1320
1371
|
|
|
1321
1372
|
// src/controls/font-family-control/enqueue-font.tsx
|
|
@@ -1356,7 +1407,7 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1356
1407
|
...bindPopover3(popoverState),
|
|
1357
1408
|
onClose: handleClose
|
|
1358
1409
|
},
|
|
1359
|
-
/* @__PURE__ */ React28.createElement(Stack8, null, /* @__PURE__ */ React28.createElement(Stack8, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React28.createElement(
|
|
1410
|
+
/* @__PURE__ */ React28.createElement(Stack8, null, /* @__PURE__ */ React28.createElement(Stack8, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React28.createElement(TextIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React28.createElement(Typography4, { variant: "subtitle2" }, __8("Font Family", "elementor")), /* @__PURE__ */ React28.createElement(IconButton2, { size: SIZE2, sx: { ml: "auto" }, onClick: handleClose }, /* @__PURE__ */ React28.createElement(XIcon2, { fontSize: SIZE2 }))), /* @__PURE__ */ React28.createElement(Box2, { px: 1.5, pb: 1 }, /* @__PURE__ */ React28.createElement(
|
|
1360
1411
|
TextField5,
|
|
1361
1412
|
{
|
|
1362
1413
|
fullWidth: true,
|
|
@@ -1376,7 +1427,27 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1376
1427
|
handleClose,
|
|
1377
1428
|
fontFamily
|
|
1378
1429
|
}
|
|
1379
|
-
) : /* @__PURE__ */ React28.createElement(Box2, { sx: { overflowY: "auto", height: 260, width: 220 } }, /* @__PURE__ */ React28.createElement(Stack8, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React28.createElement(
|
|
1430
|
+
) : /* @__PURE__ */ React28.createElement(Box2, { sx: { overflowY: "auto", height: 260, width: 220 } }, /* @__PURE__ */ React28.createElement(Stack8, { alignItems: "center", p: 2.5, gap: 1.5, overflow: "hidden" }, /* @__PURE__ */ React28.createElement(TextIcon, { fontSize: "large" }), /* @__PURE__ */ React28.createElement(Box2, { sx: { maxWidth: 160, overflow: "hidden" } }, /* @__PURE__ */ React28.createElement(Typography4, { align: "center", variant: "subtitle2", color: "text.secondary" }, __8("Sorry, nothing matched", "elementor")), /* @__PURE__ */ React28.createElement(
|
|
1431
|
+
Typography4,
|
|
1432
|
+
{
|
|
1433
|
+
variant: "subtitle2",
|
|
1434
|
+
color: "text.secondary",
|
|
1435
|
+
sx: {
|
|
1436
|
+
display: "flex",
|
|
1437
|
+
width: "100%",
|
|
1438
|
+
justifyContent: "center"
|
|
1439
|
+
}
|
|
1440
|
+
},
|
|
1441
|
+
/* @__PURE__ */ React28.createElement("span", null, "\u201C"),
|
|
1442
|
+
/* @__PURE__ */ React28.createElement(
|
|
1443
|
+
"span",
|
|
1444
|
+
{
|
|
1445
|
+
style: { maxWidth: "80%", overflow: "hidden", textOverflow: "ellipsis" }
|
|
1446
|
+
},
|
|
1447
|
+
searchValue
|
|
1448
|
+
),
|
|
1449
|
+
/* @__PURE__ */ React28.createElement("span", null, "\u201D.")
|
|
1450
|
+
)), /* @__PURE__ */ React28.createElement(Typography4, { align: "center", variant: "caption", color: "text.secondary" }, __8("Try something else.", "elementor"), /* @__PURE__ */ React28.createElement(
|
|
1380
1451
|
Link,
|
|
1381
1452
|
{
|
|
1382
1453
|
color: "secondary",
|
|
@@ -1384,14 +1455,14 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1384
1455
|
component: "button",
|
|
1385
1456
|
onClick: () => setSearchValue("")
|
|
1386
1457
|
},
|
|
1387
|
-
__8("Clear
|
|
1388
|
-
)
|
|
1458
|
+
__8("Clear & try again", "elementor")
|
|
1459
|
+
)))))
|
|
1389
1460
|
));
|
|
1390
1461
|
});
|
|
1391
1462
|
var LIST_ITEM_HEIGHT = 36;
|
|
1392
1463
|
var LIST_ITEMS_BUFFER = 6;
|
|
1393
1464
|
var FontList = ({ fontListItems, setFontFamily, handleClose, fontFamily }) => {
|
|
1394
|
-
const containerRef =
|
|
1465
|
+
const containerRef = useRef2(null);
|
|
1395
1466
|
const selectedItem = fontListItems.find((item) => item.value === fontFamily);
|
|
1396
1467
|
const debouncedVirtualizeChange = useDebounce(({ getVirtualIndexes }) => {
|
|
1397
1468
|
getVirtualIndexes().forEach((index) => {
|
|
@@ -1408,7 +1479,7 @@ var FontList = ({ fontListItems, setFontFamily, handleClose, fontFamily }) => {
|
|
|
1408
1479
|
overscan: LIST_ITEMS_BUFFER,
|
|
1409
1480
|
onChange: debouncedVirtualizeChange
|
|
1410
1481
|
});
|
|
1411
|
-
|
|
1482
|
+
useEffect3(
|
|
1412
1483
|
() => {
|
|
1413
1484
|
virtualizer.scrollToIndex(fontListItems.findIndex((item) => item.value === fontFamily));
|
|
1414
1485
|
},
|
|
@@ -1499,7 +1570,7 @@ var StyledMenuList = styled4(MenuList)(({ theme }) => ({
|
|
|
1499
1570
|
'& > [role="option"]': {
|
|
1500
1571
|
...theme.typography.caption,
|
|
1501
1572
|
lineHeight: "inherit",
|
|
1502
|
-
padding: theme.spacing(0.75, 2),
|
|
1573
|
+
padding: theme.spacing(0.75, 2, 0.75, 4),
|
|
1503
1574
|
"&:hover, &:focus": {
|
|
1504
1575
|
backgroundColor: theme.palette.action.hover
|
|
1505
1576
|
},
|
|
@@ -1514,7 +1585,7 @@ var StyledMenuList = styled4(MenuList)(({ theme }) => ({
|
|
|
1514
1585
|
}));
|
|
1515
1586
|
var useDebounce = (fn, delay) => {
|
|
1516
1587
|
const [debouncedFn] = useState3(() => debounce(fn, delay));
|
|
1517
|
-
|
|
1588
|
+
useEffect3(() => () => debouncedFn.cancel(), [debouncedFn]);
|
|
1518
1589
|
return debouncedFn;
|
|
1519
1590
|
};
|
|
1520
1591
|
|
|
@@ -1666,6 +1737,36 @@ function _factoryFilter(newValue, options, minInputLength) {
|
|
|
1666
1737
|
);
|
|
1667
1738
|
}
|
|
1668
1739
|
|
|
1740
|
+
// src/utils/link-restriction.ts
|
|
1741
|
+
import { getContainer } from "@elementor/editor-elements";
|
|
1742
|
+
function getLinkRestriction(elementId) {
|
|
1743
|
+
if (getAncestorAnchor(elementId)) {
|
|
1744
|
+
return {
|
|
1745
|
+
shouldRestrict: true,
|
|
1746
|
+
restrictReason: "ancestor"
|
|
1747
|
+
};
|
|
1748
|
+
}
|
|
1749
|
+
if (getDescendantAnchor(elementId)) {
|
|
1750
|
+
return {
|
|
1751
|
+
shouldRestrict: true,
|
|
1752
|
+
restrictReason: "descendant"
|
|
1753
|
+
};
|
|
1754
|
+
}
|
|
1755
|
+
return { shouldRestrict: false };
|
|
1756
|
+
}
|
|
1757
|
+
function getAncestorAnchor(elementId) {
|
|
1758
|
+
const element = getElementView(elementId);
|
|
1759
|
+
return element?.closest("a") || null;
|
|
1760
|
+
}
|
|
1761
|
+
function getDescendantAnchor(elementId) {
|
|
1762
|
+
const element = getElementView(elementId);
|
|
1763
|
+
return element?.querySelector("a") || null;
|
|
1764
|
+
}
|
|
1765
|
+
function getElementView(id) {
|
|
1766
|
+
const elementContainer = getContainer(id);
|
|
1767
|
+
return elementContainer?.view?.el || null;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1669
1770
|
// src/controls/link-control.tsx
|
|
1670
1771
|
var SIZE3 = "tiny";
|
|
1671
1772
|
var LinkControl = createControl((props) => {
|
|
@@ -1676,12 +1777,17 @@ var LinkControl = createControl((props) => {
|
|
|
1676
1777
|
allowCustomValues,
|
|
1677
1778
|
queryOptions: { endpoint = "", requestParams = {} },
|
|
1678
1779
|
placeholder,
|
|
1679
|
-
minInputLength = 2
|
|
1780
|
+
minInputLength = 2,
|
|
1781
|
+
context: { elementId }
|
|
1680
1782
|
} = props || {};
|
|
1681
1783
|
const [options, setOptions] = useState4(
|
|
1682
1784
|
generateFirstLoadedOption(value)
|
|
1683
1785
|
);
|
|
1684
1786
|
const onEnabledChange = () => {
|
|
1787
|
+
const { shouldRestrict } = getLinkRestriction(elementId);
|
|
1788
|
+
if (shouldRestrict && !isEnabled) {
|
|
1789
|
+
return;
|
|
1790
|
+
}
|
|
1685
1791
|
setIsEnabled((prevState) => !prevState);
|
|
1686
1792
|
setValue(isEnabled ? null : linkSessionValue?.value ?? null);
|
|
1687
1793
|
setLinkSessionValue({ value, meta: { isEnabled: !isEnabled } });
|
|
@@ -1844,12 +1950,84 @@ var Control4 = ({ bind, isLinked }) => {
|
|
|
1844
1950
|
};
|
|
1845
1951
|
|
|
1846
1952
|
// src/controls/svg-media-control.tsx
|
|
1847
|
-
import * as
|
|
1953
|
+
import * as React34 from "react";
|
|
1954
|
+
import { useState as useState6 } from "react";
|
|
1848
1955
|
import { imageSrcPropTypeUtil as imageSrcPropTypeUtil2 } from "@elementor/editor-props";
|
|
1849
1956
|
import { UploadIcon as UploadIcon2 } from "@elementor/icons";
|
|
1850
|
-
import { Button as
|
|
1957
|
+
import { Button as Button4, Card as Card2, CardMedia as CardMedia2, CardOverlay as CardOverlay2, CircularProgress as CircularProgress3, Stack as Stack11, styled as styled5 } from "@elementor/ui";
|
|
1851
1958
|
import { useWpMediaAttachment as useWpMediaAttachment2, useWpMediaFrame as useWpMediaFrame2 } from "@elementor/wp-media";
|
|
1959
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
1960
|
+
|
|
1961
|
+
// src/components/enable-unfiltered-modal.tsx
|
|
1962
|
+
import * as React33 from "react";
|
|
1963
|
+
import { useState as useState5 } from "react";
|
|
1964
|
+
import { useCurrentUserCapabilities } from "@elementor/editor-current-user";
|
|
1965
|
+
import {
|
|
1966
|
+
Button as Button3,
|
|
1967
|
+
CircularProgress as CircularProgress2,
|
|
1968
|
+
Dialog,
|
|
1969
|
+
DialogActions,
|
|
1970
|
+
DialogContent,
|
|
1971
|
+
DialogContentText,
|
|
1972
|
+
DialogHeader,
|
|
1973
|
+
DialogTitle,
|
|
1974
|
+
Divider as Divider4
|
|
1975
|
+
} from "@elementor/ui";
|
|
1852
1976
|
import { __ as __11 } from "@wordpress/i18n";
|
|
1977
|
+
var ADMIN_TITLE_TEXT = __11("Enable Unfiltered Uploads", "elementor");
|
|
1978
|
+
var ADMIN_CONTENT_TEXT = __11(
|
|
1979
|
+
"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.",
|
|
1980
|
+
"elementor"
|
|
1981
|
+
);
|
|
1982
|
+
var NON_ADMIN_TITLE_TEXT = __11("Sorry, you can't upload that file yet", "elementor");
|
|
1983
|
+
var NON_ADMIN_CONTENT_TEXT = __11(
|
|
1984
|
+
"This is because this file type may pose a security risk. To upload them anyway, ask the site administrator to enable unfiltered file uploads.",
|
|
1985
|
+
"elementor"
|
|
1986
|
+
);
|
|
1987
|
+
var ADMIN_FAILED_CONTENT_TEXT_PT1 = __11("Failed to enable unfiltered files upload.", "elementor");
|
|
1988
|
+
var ADMIN_FAILED_CONTENT_TEXT_PT2 = __11(
|
|
1989
|
+
"You can try again, if the problem persists, please contact support.",
|
|
1990
|
+
"elementor"
|
|
1991
|
+
);
|
|
1992
|
+
var WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
|
|
1993
|
+
var EnableUnfilteredModal = (props) => {
|
|
1994
|
+
const { mutateAsync, isPending } = useUpdateUnfilteredFilesUpload();
|
|
1995
|
+
const { canUser } = useCurrentUserCapabilities();
|
|
1996
|
+
const [isError, setIsError] = useState5(false);
|
|
1997
|
+
const canManageOptions = canUser("manage_options");
|
|
1998
|
+
const onClose = (enabled) => {
|
|
1999
|
+
props.onClose(enabled);
|
|
2000
|
+
setTimeout(() => setIsError(false), WAIT_FOR_CLOSE_TIMEOUT_MS);
|
|
2001
|
+
};
|
|
2002
|
+
const handleEnable = async () => {
|
|
2003
|
+
try {
|
|
2004
|
+
const response = await mutateAsync({ allowUnfilteredFilesUpload: true });
|
|
2005
|
+
if (response?.data?.success === false) {
|
|
2006
|
+
setIsError(true);
|
|
2007
|
+
} else {
|
|
2008
|
+
props.onClose(true);
|
|
2009
|
+
}
|
|
2010
|
+
} catch {
|
|
2011
|
+
setIsError(true);
|
|
2012
|
+
}
|
|
2013
|
+
};
|
|
2014
|
+
const dialogProps = { ...props, isPending, handleEnable, isError, onClose };
|
|
2015
|
+
return canManageOptions ? /* @__PURE__ */ React33.createElement(AdminDialog, { ...dialogProps }) : /* @__PURE__ */ React33.createElement(NonAdminDialog, { ...dialogProps });
|
|
2016
|
+
};
|
|
2017
|
+
var AdminDialog = ({ open, onClose, handleEnable, isPending, isError }) => /* @__PURE__ */ React33.createElement(Dialog, { open, maxWidth: "sm", onClose: () => onClose(false) }, /* @__PURE__ */ React33.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React33.createElement(DialogTitle, null, ADMIN_TITLE_TEXT)), /* @__PURE__ */ React33.createElement(Divider4, null), /* @__PURE__ */ React33.createElement(DialogContent, null, /* @__PURE__ */ React33.createElement(DialogContentText, null, isError ? /* @__PURE__ */ React33.createElement(React33.Fragment, null, ADMIN_FAILED_CONTENT_TEXT_PT1, " ", /* @__PURE__ */ React33.createElement("br", null), " ", ADMIN_FAILED_CONTENT_TEXT_PT2) : ADMIN_CONTENT_TEXT)), /* @__PURE__ */ React33.createElement(DialogActions, null, /* @__PURE__ */ React33.createElement(Button3, { size: "medium", color: "secondary", onClick: () => onClose(false) }, __11("Cancel", "elementor")), /* @__PURE__ */ React33.createElement(
|
|
2018
|
+
Button3,
|
|
2019
|
+
{
|
|
2020
|
+
size: "medium",
|
|
2021
|
+
onClick: () => handleEnable(),
|
|
2022
|
+
variant: "contained",
|
|
2023
|
+
color: "primary",
|
|
2024
|
+
disabled: isPending
|
|
2025
|
+
},
|
|
2026
|
+
isPending ? /* @__PURE__ */ React33.createElement(CircularProgress2, { size: 24 }) : __11("Enable", "elementor")
|
|
2027
|
+
)));
|
|
2028
|
+
var NonAdminDialog = ({ open, onClose }) => /* @__PURE__ */ React33.createElement(Dialog, { open, maxWidth: "sm", onClose: () => onClose(false) }, /* @__PURE__ */ React33.createElement(DialogHeader, { logo: false }, /* @__PURE__ */ React33.createElement(DialogTitle, null, NON_ADMIN_TITLE_TEXT)), /* @__PURE__ */ React33.createElement(Divider4, null), /* @__PURE__ */ React33.createElement(DialogContent, null, /* @__PURE__ */ React33.createElement(DialogContentText, null, NON_ADMIN_CONTENT_TEXT)), /* @__PURE__ */ React33.createElement(DialogActions, null, /* @__PURE__ */ React33.createElement(Button3, { size: "medium", onClick: () => onClose(false), variant: "contained", color: "primary" }, __11("Got it", "elementor"))));
|
|
2029
|
+
|
|
2030
|
+
// src/controls/svg-media-control.tsx
|
|
1853
2031
|
var TILE_SIZE = 8;
|
|
1854
2032
|
var TILE_WHITE = "transparent";
|
|
1855
2033
|
var TILE_BLACK = "#c1c1c1";
|
|
@@ -1872,12 +2050,15 @@ var StyledCardMediaContainer = styled5(Stack11)`
|
|
|
1872
2050
|
align-items: center;
|
|
1873
2051
|
background-color: rgba( 255, 255, 255, 0.37 );
|
|
1874
2052
|
`;
|
|
2053
|
+
var MODE_BROWSE = { mode: "browse" };
|
|
2054
|
+
var MODE_UPLOAD = { mode: "upload" };
|
|
1875
2055
|
var SvgMediaControl = createControl(() => {
|
|
1876
2056
|
const { value, setValue } = useBoundProp(imageSrcPropTypeUtil2);
|
|
1877
2057
|
const { id, url } = value ?? {};
|
|
1878
2058
|
const { data: attachment, isFetching } = useWpMediaAttachment2(id?.value || null);
|
|
1879
2059
|
const src = attachment?.url ?? url?.value ?? null;
|
|
1880
2060
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
2061
|
+
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = useState6(false);
|
|
1881
2062
|
const { open } = useWpMediaFrame2({
|
|
1882
2063
|
mediaTypes: ["svg"],
|
|
1883
2064
|
multiple: false,
|
|
@@ -1892,21 +2073,28 @@ var SvgMediaControl = createControl(() => {
|
|
|
1892
2073
|
});
|
|
1893
2074
|
}
|
|
1894
2075
|
});
|
|
2076
|
+
const onCloseUnfilteredModal = (enabled) => {
|
|
2077
|
+
setUnfilteredModalOpenState(false);
|
|
2078
|
+
if (enabled) {
|
|
2079
|
+
open(MODE_UPLOAD);
|
|
2080
|
+
}
|
|
2081
|
+
};
|
|
1895
2082
|
const handleClick = (openOptions) => {
|
|
1896
|
-
if (allowSvgUpload) {
|
|
1897
|
-
|
|
2083
|
+
if (!allowSvgUpload && openOptions === MODE_UPLOAD) {
|
|
2084
|
+
setUnfilteredModalOpenState(true);
|
|
1898
2085
|
} else {
|
|
2086
|
+
open(openOptions);
|
|
1899
2087
|
}
|
|
1900
2088
|
};
|
|
1901
|
-
return /* @__PURE__ */
|
|
2089
|
+
return /* @__PURE__ */ React34.createElement(Stack11, { gap: 1 }, /* @__PURE__ */ React34.createElement(EnableUnfilteredModal, { open: unfilteredModalOpenState, onClose: onCloseUnfilteredModal }), /* @__PURE__ */ React34.createElement(ControlLabel, null, " ", __12("SVG", "elementor"), " "), /* @__PURE__ */ React34.createElement(ControlActions, null, /* @__PURE__ */ React34.createElement(StyledCard, { variant: "outlined" }, /* @__PURE__ */ React34.createElement(StyledCardMediaContainer, null, isFetching ? /* @__PURE__ */ React34.createElement(CircularProgress3, { role: "progressbar" }) : /* @__PURE__ */ React34.createElement(
|
|
1902
2090
|
CardMedia2,
|
|
1903
2091
|
{
|
|
1904
2092
|
component: "img",
|
|
1905
2093
|
image: src,
|
|
1906
|
-
alt:
|
|
2094
|
+
alt: __12("Preview SVG", "elementor"),
|
|
1907
2095
|
sx: { maxHeight: "140px", width: "50px" }
|
|
1908
2096
|
}
|
|
1909
|
-
)), /* @__PURE__ */
|
|
2097
|
+
)), /* @__PURE__ */ React34.createElement(
|
|
1910
2098
|
CardOverlay2,
|
|
1911
2099
|
{
|
|
1912
2100
|
sx: {
|
|
@@ -1915,94 +2103,167 @@ var SvgMediaControl = createControl(() => {
|
|
|
1915
2103
|
}
|
|
1916
2104
|
}
|
|
1917
2105
|
},
|
|
1918
|
-
/* @__PURE__ */
|
|
1919
|
-
|
|
2106
|
+
/* @__PURE__ */ React34.createElement(Stack11, { gap: 1 }, /* @__PURE__ */ React34.createElement(
|
|
2107
|
+
Button4,
|
|
1920
2108
|
{
|
|
1921
2109
|
size: "tiny",
|
|
1922
2110
|
color: "inherit",
|
|
1923
2111
|
variant: "outlined",
|
|
1924
|
-
onClick: () => handleClick(
|
|
2112
|
+
onClick: () => handleClick(MODE_BROWSE)
|
|
1925
2113
|
},
|
|
1926
|
-
|
|
1927
|
-
), /* @__PURE__ */
|
|
1928
|
-
|
|
2114
|
+
__12("Select SVG", "elementor")
|
|
2115
|
+
), /* @__PURE__ */ React34.createElement(
|
|
2116
|
+
Button4,
|
|
1929
2117
|
{
|
|
1930
2118
|
size: "tiny",
|
|
1931
2119
|
variant: "text",
|
|
1932
2120
|
color: "inherit",
|
|
1933
|
-
startIcon: /* @__PURE__ */
|
|
1934
|
-
onClick: () => handleClick(
|
|
2121
|
+
startIcon: /* @__PURE__ */ React34.createElement(UploadIcon2, null),
|
|
2122
|
+
onClick: () => handleClick(MODE_UPLOAD)
|
|
1935
2123
|
},
|
|
1936
|
-
|
|
2124
|
+
__12("Upload", "elementor")
|
|
1937
2125
|
))
|
|
1938
2126
|
))));
|
|
1939
2127
|
});
|
|
1940
2128
|
|
|
1941
2129
|
// src/controls/background-control/background-control.tsx
|
|
1942
|
-
import * as
|
|
2130
|
+
import * as React41 from "react";
|
|
1943
2131
|
import { backgroundPropTypeUtil } from "@elementor/editor-props";
|
|
1944
2132
|
import { Grid as Grid14 } from "@elementor/ui";
|
|
1945
|
-
import { __ as
|
|
2133
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
1946
2134
|
|
|
1947
2135
|
// src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
|
|
1948
|
-
import * as
|
|
2136
|
+
import * as React40 from "react";
|
|
1949
2137
|
import {
|
|
1950
2138
|
backgroundColorOverlayPropTypeUtil as backgroundColorOverlayPropTypeUtil2,
|
|
1951
2139
|
backgroundImageOverlayPropTypeUtil as backgroundImageOverlayPropTypeUtil2,
|
|
1952
|
-
backgroundOverlayPropTypeUtil
|
|
2140
|
+
backgroundOverlayPropTypeUtil,
|
|
2141
|
+
colorPropTypeUtil as colorPropTypeUtil3
|
|
1953
2142
|
} from "@elementor/editor-props";
|
|
1954
2143
|
import { Box as Box4, CardMedia as CardMedia3, Grid as Grid13, Tab, TabPanel, Tabs, UnstableColorIndicator as UnstableColorIndicator2 } from "@elementor/ui";
|
|
1955
2144
|
import { useWpMediaAttachment as useWpMediaAttachment3 } from "@elementor/wp-media";
|
|
1956
|
-
import { __ as
|
|
2145
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
1957
2146
|
|
|
1958
2147
|
// src/env.ts
|
|
1959
2148
|
import { parseEnv } from "@elementor/env";
|
|
1960
2149
|
var { env } = parseEnv("@elementor/editor-controls");
|
|
1961
2150
|
|
|
2151
|
+
// src/controls/background-control/background-gradient-color-control.tsx
|
|
2152
|
+
import * as React35 from "react";
|
|
2153
|
+
import {
|
|
2154
|
+
backgroundGradientOverlayPropTypeUtil,
|
|
2155
|
+
colorPropTypeUtil as colorPropTypeUtil2,
|
|
2156
|
+
colorStopPropTypeUtil,
|
|
2157
|
+
gradientColorStopPropTypeUtil,
|
|
2158
|
+
numberPropTypeUtil as numberPropTypeUtil3,
|
|
2159
|
+
stringPropTypeUtil as stringPropTypeUtil8
|
|
2160
|
+
} from "@elementor/editor-props";
|
|
2161
|
+
import { UnstableGradientBox } from "@elementor/ui";
|
|
2162
|
+
var BackgroundGradientColorControl = createControl(() => {
|
|
2163
|
+
const { value, setValue } = useBoundProp(backgroundGradientOverlayPropTypeUtil);
|
|
2164
|
+
const handleChange = (newValue) => {
|
|
2165
|
+
const transformedValue = createTransformableValue(newValue);
|
|
2166
|
+
if (transformedValue.positions) {
|
|
2167
|
+
transformedValue.positions = stringPropTypeUtil8.create(newValue.positions.join(" "));
|
|
2168
|
+
}
|
|
2169
|
+
setValue(transformedValue);
|
|
2170
|
+
};
|
|
2171
|
+
const createTransformableValue = (newValue) => ({
|
|
2172
|
+
...newValue,
|
|
2173
|
+
type: stringPropTypeUtil8.create(newValue.type),
|
|
2174
|
+
angle: numberPropTypeUtil3.create(newValue.angle),
|
|
2175
|
+
stops: gradientColorStopPropTypeUtil.create(
|
|
2176
|
+
newValue.stops.map(
|
|
2177
|
+
({ color, offset }) => colorStopPropTypeUtil.create({
|
|
2178
|
+
color: colorPropTypeUtil2.create(color),
|
|
2179
|
+
offset: numberPropTypeUtil3.create(offset)
|
|
2180
|
+
})
|
|
2181
|
+
)
|
|
2182
|
+
)
|
|
2183
|
+
});
|
|
2184
|
+
const normalizeValue = () => {
|
|
2185
|
+
if (!value) {
|
|
2186
|
+
return;
|
|
2187
|
+
}
|
|
2188
|
+
const { type, angle, stops, positions } = value;
|
|
2189
|
+
return {
|
|
2190
|
+
type: type.value,
|
|
2191
|
+
angle: angle.value,
|
|
2192
|
+
stops: stops.value.map(({ value: { color, offset } }) => ({
|
|
2193
|
+
color: color.value,
|
|
2194
|
+
offset: offset.value
|
|
2195
|
+
})),
|
|
2196
|
+
positions: positions?.value.split(" ")
|
|
2197
|
+
};
|
|
2198
|
+
};
|
|
2199
|
+
return /* @__PURE__ */ React35.createElement(ControlActions, null, /* @__PURE__ */ React35.createElement(
|
|
2200
|
+
UnstableGradientBox,
|
|
2201
|
+
{
|
|
2202
|
+
sx: { width: "auto", padding: 1.5 },
|
|
2203
|
+
value: normalizeValue(),
|
|
2204
|
+
onChange: handleChange
|
|
2205
|
+
}
|
|
2206
|
+
));
|
|
2207
|
+
});
|
|
2208
|
+
var initialBackgroundGradientOverlay = backgroundGradientOverlayPropTypeUtil.create({
|
|
2209
|
+
type: stringPropTypeUtil8.create("linear"),
|
|
2210
|
+
angle: numberPropTypeUtil3.create(180),
|
|
2211
|
+
stops: gradientColorStopPropTypeUtil.create([
|
|
2212
|
+
colorStopPropTypeUtil.create({
|
|
2213
|
+
color: colorPropTypeUtil2.create("rgb(0,0,0)"),
|
|
2214
|
+
offset: numberPropTypeUtil3.create(0)
|
|
2215
|
+
}),
|
|
2216
|
+
colorStopPropTypeUtil.create({
|
|
2217
|
+
color: colorPropTypeUtil2.create("rgb(255,255,255)"),
|
|
2218
|
+
offset: numberPropTypeUtil3.create(100)
|
|
2219
|
+
})
|
|
2220
|
+
])
|
|
2221
|
+
});
|
|
2222
|
+
|
|
1962
2223
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx
|
|
1963
|
-
import * as
|
|
2224
|
+
import * as React36 from "react";
|
|
1964
2225
|
import { PinIcon, PinnedOffIcon } from "@elementor/icons";
|
|
1965
2226
|
import { Grid as Grid9 } from "@elementor/ui";
|
|
1966
|
-
import { __ as
|
|
2227
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
1967
2228
|
var attachmentControlOptions = [
|
|
1968
2229
|
{
|
|
1969
2230
|
value: "fixed",
|
|
1970
|
-
label:
|
|
1971
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2231
|
+
label: __13("Fixed", "elementor"),
|
|
2232
|
+
renderContent: ({ size }) => /* @__PURE__ */ React36.createElement(PinIcon, { fontSize: size }),
|
|
1972
2233
|
showTooltip: true
|
|
1973
2234
|
},
|
|
1974
2235
|
{
|
|
1975
2236
|
value: "scroll",
|
|
1976
|
-
label:
|
|
1977
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2237
|
+
label: __13("Scroll", "elementor"),
|
|
2238
|
+
renderContent: ({ size }) => /* @__PURE__ */ React36.createElement(PinnedOffIcon, { fontSize: size }),
|
|
1978
2239
|
showTooltip: true
|
|
1979
2240
|
}
|
|
1980
2241
|
];
|
|
1981
2242
|
var BackgroundImageOverlayAttachment = () => {
|
|
1982
|
-
return /* @__PURE__ */
|
|
2243
|
+
return /* @__PURE__ */ React36.createElement(PopoverGridContainer, null, /* @__PURE__ */ React36.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React36.createElement(ControlLabel, null, __13("Attachment", "elementor"))), /* @__PURE__ */ React36.createElement(Grid9, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end", overflow: "hidden" } }, /* @__PURE__ */ React36.createElement(ToggleControl, { options: attachmentControlOptions })));
|
|
1983
2244
|
};
|
|
1984
2245
|
|
|
1985
2246
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
|
|
1986
|
-
import * as
|
|
1987
|
-
import { backgroundImagePositionOffsetPropTypeUtil, stringPropTypeUtil as
|
|
2247
|
+
import * as React37 from "react";
|
|
2248
|
+
import { backgroundImagePositionOffsetPropTypeUtil, stringPropTypeUtil as stringPropTypeUtil9 } from "@elementor/editor-props";
|
|
1988
2249
|
import { LetterXIcon, LetterYIcon } from "@elementor/icons";
|
|
1989
2250
|
import { Grid as Grid10, MenuItem as MenuItem3, Select as Select2 } from "@elementor/ui";
|
|
1990
|
-
import { __ as
|
|
2251
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
1991
2252
|
var backgroundPositionOptions = [
|
|
1992
|
-
{ label:
|
|
1993
|
-
{ label:
|
|
1994
|
-
{ label:
|
|
1995
|
-
{ label:
|
|
1996
|
-
{ label:
|
|
1997
|
-
{ label:
|
|
1998
|
-
{ label:
|
|
1999
|
-
{ label:
|
|
2000
|
-
{ label:
|
|
2001
|
-
{ label:
|
|
2253
|
+
{ label: __14("Center center", "elementor"), value: "center center" },
|
|
2254
|
+
{ label: __14("Center left", "elementor"), value: "center left" },
|
|
2255
|
+
{ label: __14("Center right", "elementor"), value: "center right" },
|
|
2256
|
+
{ label: __14("Top center", "elementor"), value: "top center" },
|
|
2257
|
+
{ label: __14("Top left", "elementor"), value: "top left" },
|
|
2258
|
+
{ label: __14("Top right", "elementor"), value: "top right" },
|
|
2259
|
+
{ label: __14("Bottom center", "elementor"), value: "bottom center" },
|
|
2260
|
+
{ label: __14("Bottom left", "elementor"), value: "bottom left" },
|
|
2261
|
+
{ label: __14("Bottom right", "elementor"), value: "bottom right" },
|
|
2262
|
+
{ label: __14("Custom", "elementor"), value: "custom" }
|
|
2002
2263
|
];
|
|
2003
2264
|
var BackgroundImageOverlayPosition = () => {
|
|
2004
2265
|
const backgroundImageOffsetContext = useBoundProp(backgroundImagePositionOffsetPropTypeUtil);
|
|
2005
|
-
const stringPropContext = useBoundProp(
|
|
2266
|
+
const stringPropContext = useBoundProp(stringPropTypeUtil9);
|
|
2006
2267
|
const isCustom = !!backgroundImageOffsetContext.value;
|
|
2007
2268
|
const handlePositionChange = (event) => {
|
|
2008
2269
|
const value = event.target.value || null;
|
|
@@ -2012,7 +2273,7 @@ var BackgroundImageOverlayPosition = () => {
|
|
|
2012
2273
|
stringPropContext.setValue(value);
|
|
2013
2274
|
}
|
|
2014
2275
|
};
|
|
2015
|
-
return /* @__PURE__ */
|
|
2276
|
+
return /* @__PURE__ */ React37.createElement(Grid10, { container: true, spacing: 1.5 }, /* @__PURE__ */ React37.createElement(Grid10, { item: true, xs: 12 }, /* @__PURE__ */ React37.createElement(PopoverGridContainer, null, /* @__PURE__ */ React37.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(ControlLabel, null, __14("Position", "elementor"))), /* @__PURE__ */ React37.createElement(Grid10, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end", overflow: "hidden" } }, /* @__PURE__ */ React37.createElement(
|
|
2016
2277
|
Select2,
|
|
2017
2278
|
{
|
|
2018
2279
|
size: "tiny",
|
|
@@ -2020,48 +2281,48 @@ var BackgroundImageOverlayPosition = () => {
|
|
|
2020
2281
|
onChange: handlePositionChange,
|
|
2021
2282
|
fullWidth: true
|
|
2022
2283
|
},
|
|
2023
|
-
backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */
|
|
2024
|
-
)))), isCustom ? /* @__PURE__ */
|
|
2284
|
+
backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ React37.createElement(MenuItem3, { key: value, value: value ?? "" }, label))
|
|
2285
|
+
)))), isCustom ? /* @__PURE__ */ React37.createElement(PropProvider, { ...backgroundImageOffsetContext }, /* @__PURE__ */ React37.createElement(Grid10, { item: true, xs: 12 }, /* @__PURE__ */ React37.createElement(Grid10, { container: true, spacing: 1.5 }, /* @__PURE__ */ React37.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ React37.createElement(SizeControl, { startIcon: /* @__PURE__ */ React37.createElement(LetterXIcon, { fontSize: "tiny" }) }))), /* @__PURE__ */ React37.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React37.createElement(PropKeyProvider, { bind: "y" }, /* @__PURE__ */ React37.createElement(SizeControl, { startIcon: /* @__PURE__ */ React37.createElement(LetterYIcon, { fontSize: "tiny" }) })))))) : null);
|
|
2025
2286
|
};
|
|
2026
2287
|
|
|
2027
2288
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx
|
|
2028
|
-
import * as
|
|
2289
|
+
import * as React38 from "react";
|
|
2029
2290
|
import { DotsHorizontalIcon, DotsVerticalIcon, GridDotsIcon, XIcon as XIcon4 } from "@elementor/icons";
|
|
2030
2291
|
import { Grid as Grid11 } from "@elementor/ui";
|
|
2031
|
-
import { __ as
|
|
2292
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
2032
2293
|
var repeatControlOptions = [
|
|
2033
2294
|
{
|
|
2034
2295
|
value: "repeat",
|
|
2035
|
-
label:
|
|
2036
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2296
|
+
label: __15("Repeat", "elementor"),
|
|
2297
|
+
renderContent: ({ size }) => /* @__PURE__ */ React38.createElement(GridDotsIcon, { fontSize: size }),
|
|
2037
2298
|
showTooltip: true
|
|
2038
2299
|
},
|
|
2039
2300
|
{
|
|
2040
2301
|
value: "repeat-x",
|
|
2041
|
-
label:
|
|
2042
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2302
|
+
label: __15("Repeat-x", "elementor"),
|
|
2303
|
+
renderContent: ({ size }) => /* @__PURE__ */ React38.createElement(DotsHorizontalIcon, { fontSize: size }),
|
|
2043
2304
|
showTooltip: true
|
|
2044
2305
|
},
|
|
2045
2306
|
{
|
|
2046
2307
|
value: "repeat-y",
|
|
2047
|
-
label:
|
|
2048
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2308
|
+
label: __15("Repeat-y", "elementor"),
|
|
2309
|
+
renderContent: ({ size }) => /* @__PURE__ */ React38.createElement(DotsVerticalIcon, { fontSize: size }),
|
|
2049
2310
|
showTooltip: true
|
|
2050
2311
|
},
|
|
2051
2312
|
{
|
|
2052
2313
|
value: "no-repeat",
|
|
2053
|
-
label:
|
|
2054
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2314
|
+
label: __15("No-repeat", "elementor"),
|
|
2315
|
+
renderContent: ({ size }) => /* @__PURE__ */ React38.createElement(XIcon4, { fontSize: size }),
|
|
2055
2316
|
showTooltip: true
|
|
2056
2317
|
}
|
|
2057
2318
|
];
|
|
2058
2319
|
var BackgroundImageOverlayRepeat = () => {
|
|
2059
|
-
return /* @__PURE__ */
|
|
2320
|
+
return /* @__PURE__ */ React38.createElement(PopoverGridContainer, null, /* @__PURE__ */ React38.createElement(Grid11, { item: true, xs: 6 }, /* @__PURE__ */ React38.createElement(ControlLabel, null, __15("Repeat", "elementor"))), /* @__PURE__ */ React38.createElement(Grid11, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React38.createElement(ToggleControl, { options: repeatControlOptions })));
|
|
2060
2321
|
};
|
|
2061
2322
|
|
|
2062
2323
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx
|
|
2063
|
-
import * as
|
|
2064
|
-
import { backgroundImageSizeScalePropTypeUtil, stringPropTypeUtil as
|
|
2324
|
+
import * as React39 from "react";
|
|
2325
|
+
import { backgroundImageSizeScalePropTypeUtil, stringPropTypeUtil as stringPropTypeUtil10 } from "@elementor/editor-props";
|
|
2065
2326
|
import {
|
|
2066
2327
|
ArrowBarBothIcon,
|
|
2067
2328
|
ArrowsMaximizeIcon,
|
|
@@ -2071,36 +2332,36 @@ import {
|
|
|
2071
2332
|
PencilIcon
|
|
2072
2333
|
} from "@elementor/icons";
|
|
2073
2334
|
import { Grid as Grid12 } from "@elementor/ui";
|
|
2074
|
-
import { __ as
|
|
2335
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
2075
2336
|
var sizeControlOptions = [
|
|
2076
2337
|
{
|
|
2077
2338
|
value: "auto",
|
|
2078
|
-
label:
|
|
2079
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2339
|
+
label: __16("Auto", "elementor"),
|
|
2340
|
+
renderContent: ({ size }) => /* @__PURE__ */ React39.createElement(LetterAIcon, { fontSize: size }),
|
|
2080
2341
|
showTooltip: true
|
|
2081
2342
|
},
|
|
2082
2343
|
{
|
|
2083
2344
|
value: "cover",
|
|
2084
|
-
label:
|
|
2085
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2345
|
+
label: __16("Cover", "elementor"),
|
|
2346
|
+
renderContent: ({ size }) => /* @__PURE__ */ React39.createElement(ArrowsMaximizeIcon, { fontSize: size }),
|
|
2086
2347
|
showTooltip: true
|
|
2087
2348
|
},
|
|
2088
2349
|
{
|
|
2089
2350
|
value: "contain",
|
|
2090
|
-
label:
|
|
2091
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2351
|
+
label: __16("Contain", "elementor"),
|
|
2352
|
+
renderContent: ({ size }) => /* @__PURE__ */ React39.createElement(ArrowBarBothIcon, { fontSize: size }),
|
|
2092
2353
|
showTooltip: true
|
|
2093
2354
|
},
|
|
2094
2355
|
{
|
|
2095
2356
|
value: "custom",
|
|
2096
|
-
label:
|
|
2097
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
2357
|
+
label: __16("Custom", "elementor"),
|
|
2358
|
+
renderContent: ({ size }) => /* @__PURE__ */ React39.createElement(PencilIcon, { fontSize: size }),
|
|
2098
2359
|
showTooltip: true
|
|
2099
2360
|
}
|
|
2100
2361
|
];
|
|
2101
2362
|
var BackgroundImageOverlaySize = () => {
|
|
2102
2363
|
const backgroundImageScaleContext = useBoundProp(backgroundImageSizeScalePropTypeUtil);
|
|
2103
|
-
const stringPropContext = useBoundProp(
|
|
2364
|
+
const stringPropContext = useBoundProp(stringPropTypeUtil10);
|
|
2104
2365
|
const isCustom = !!backgroundImageScaleContext.value;
|
|
2105
2366
|
const handleSizeChange = (size) => {
|
|
2106
2367
|
if (size === "custom") {
|
|
@@ -2109,7 +2370,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
2109
2370
|
stringPropContext.setValue(size);
|
|
2110
2371
|
}
|
|
2111
2372
|
};
|
|
2112
|
-
return /* @__PURE__ */
|
|
2373
|
+
return /* @__PURE__ */ React39.createElement(Grid12, { container: true, spacing: 1.5 }, /* @__PURE__ */ React39.createElement(Grid12, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(PopoverGridContainer, null, /* @__PURE__ */ React39.createElement(Grid12, { item: true, xs: 6 }, /* @__PURE__ */ React39.createElement(ControlLabel, null, __16("Size", "elementor"))), /* @__PURE__ */ React39.createElement(Grid12, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React39.createElement(
|
|
2113
2374
|
ControlToggleButtonGroup,
|
|
2114
2375
|
{
|
|
2115
2376
|
exclusive: true,
|
|
@@ -2117,38 +2378,51 @@ var BackgroundImageOverlaySize = () => {
|
|
|
2117
2378
|
value: backgroundImageScaleContext.value ? "custom" : stringPropContext.value,
|
|
2118
2379
|
onChange: handleSizeChange
|
|
2119
2380
|
}
|
|
2120
|
-
)))), isCustom ? /* @__PURE__ */
|
|
2381
|
+
)))), isCustom ? /* @__PURE__ */ React39.createElement(PropProvider, { ...backgroundImageScaleContext }, /* @__PURE__ */ React39.createElement(Grid12, { item: true, xs: 12 }, /* @__PURE__ */ React39.createElement(PopoverGridContainer, null, /* @__PURE__ */ React39.createElement(Grid12, { item: true, xs: 6 }, /* @__PURE__ */ React39.createElement(PropKeyProvider, { bind: "width" }, /* @__PURE__ */ React39.createElement(
|
|
2121
2382
|
SizeControl,
|
|
2122
2383
|
{
|
|
2123
|
-
startIcon: /* @__PURE__ */
|
|
2384
|
+
startIcon: /* @__PURE__ */ React39.createElement(ArrowsMoveHorizontalIcon, { fontSize: "tiny" }),
|
|
2124
2385
|
extendedValues: ["auto"]
|
|
2125
2386
|
}
|
|
2126
|
-
))), /* @__PURE__ */
|
|
2387
|
+
))), /* @__PURE__ */ React39.createElement(Grid12, { item: true, xs: 6 }, /* @__PURE__ */ React39.createElement(PropKeyProvider, { bind: "height" }, /* @__PURE__ */ React39.createElement(
|
|
2127
2388
|
SizeControl,
|
|
2128
2389
|
{
|
|
2129
|
-
startIcon: /* @__PURE__ */
|
|
2390
|
+
startIcon: /* @__PURE__ */ React39.createElement(ArrowsMoveVerticalIcon, { fontSize: "tiny" }),
|
|
2130
2391
|
extendedValues: ["auto"]
|
|
2131
2392
|
}
|
|
2132
2393
|
)))))) : null);
|
|
2133
2394
|
};
|
|
2134
2395
|
|
|
2135
2396
|
// src/controls/background-control/background-overlay/use-background-tabs-history.ts
|
|
2136
|
-
import { useRef as
|
|
2397
|
+
import { useRef as useRef3 } from "react";
|
|
2137
2398
|
import {
|
|
2138
2399
|
backgroundColorOverlayPropTypeUtil,
|
|
2400
|
+
backgroundGradientOverlayPropTypeUtil as backgroundGradientOverlayPropTypeUtil2,
|
|
2139
2401
|
backgroundImageOverlayPropTypeUtil
|
|
2140
2402
|
} from "@elementor/editor-props";
|
|
2141
2403
|
import { useTabs } from "@elementor/ui";
|
|
2142
2404
|
var useBackgroundTabsHistory = ({
|
|
2143
2405
|
color: initialBackgroundColorOverlay2,
|
|
2144
|
-
image: initialBackgroundImageOverlay
|
|
2406
|
+
image: initialBackgroundImageOverlay,
|
|
2407
|
+
gradient: initialBackgroundGradientOverlay2
|
|
2145
2408
|
}) => {
|
|
2146
2409
|
const { value: imageValue, setValue: setImageValue } = useBoundProp(backgroundImageOverlayPropTypeUtil);
|
|
2147
2410
|
const { value: colorValue, setValue: setColorValue } = useBoundProp(backgroundColorOverlayPropTypeUtil);
|
|
2148
|
-
const {
|
|
2149
|
-
const
|
|
2411
|
+
const { value: gradientValue, setValue: setGradientValue } = useBoundProp(backgroundGradientOverlayPropTypeUtil2);
|
|
2412
|
+
const getCurrentOverlayType = () => {
|
|
2413
|
+
if (colorValue) {
|
|
2414
|
+
return "color";
|
|
2415
|
+
}
|
|
2416
|
+
if (gradientValue) {
|
|
2417
|
+
return "gradient";
|
|
2418
|
+
}
|
|
2419
|
+
return "image";
|
|
2420
|
+
};
|
|
2421
|
+
const { getTabsProps, getTabProps, getTabPanelProps } = useTabs(getCurrentOverlayType());
|
|
2422
|
+
const valuesHistory = useRef3({
|
|
2150
2423
|
image: initialBackgroundImageOverlay,
|
|
2151
|
-
color: initialBackgroundColorOverlay2
|
|
2424
|
+
color: initialBackgroundColorOverlay2,
|
|
2425
|
+
gradient: initialBackgroundGradientOverlay2
|
|
2152
2426
|
});
|
|
2153
2427
|
const saveToHistory = (key, value) => {
|
|
2154
2428
|
if (value) {
|
|
@@ -2160,10 +2434,17 @@ var useBackgroundTabsHistory = ({
|
|
|
2160
2434
|
case "image":
|
|
2161
2435
|
setImageValue(valuesHistory.current.image);
|
|
2162
2436
|
saveToHistory("color", colorValue);
|
|
2437
|
+
saveToHistory("gradient", gradientValue);
|
|
2438
|
+
break;
|
|
2439
|
+
case "gradient":
|
|
2440
|
+
setGradientValue(valuesHistory.current.gradient);
|
|
2441
|
+
saveToHistory("color", colorValue);
|
|
2442
|
+
saveToHistory("image", imageValue);
|
|
2163
2443
|
break;
|
|
2164
2444
|
case "color":
|
|
2165
2445
|
setColorValue(valuesHistory.current.color);
|
|
2166
2446
|
saveToHistory("image", imageValue);
|
|
2447
|
+
saveToHistory("gradient", gradientValue);
|
|
2167
2448
|
}
|
|
2168
2449
|
return getTabsProps().onChange(e, tabName);
|
|
2169
2450
|
};
|
|
@@ -2175,10 +2456,12 @@ var useBackgroundTabsHistory = ({
|
|
|
2175
2456
|
};
|
|
2176
2457
|
|
|
2177
2458
|
// src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
|
|
2178
|
-
var
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2459
|
+
var DEFAULT_BACKGROUND_COLOR_OVERLAY_COLOR = "#00000033";
|
|
2460
|
+
var initialBackgroundColorOverlay = backgroundColorOverlayPropTypeUtil2.create(
|
|
2461
|
+
{
|
|
2462
|
+
color: colorPropTypeUtil3.create(DEFAULT_BACKGROUND_COLOR_OVERLAY_COLOR)
|
|
2463
|
+
}
|
|
2464
|
+
);
|
|
2182
2465
|
var getInitialBackgroundOverlay = () => ({
|
|
2183
2466
|
$$type: "background-image-overlay",
|
|
2184
2467
|
value: {
|
|
@@ -2204,19 +2487,20 @@ var getInitialBackgroundOverlay = () => ({
|
|
|
2204
2487
|
}
|
|
2205
2488
|
});
|
|
2206
2489
|
var backgroundResolutionOptions = [
|
|
2207
|
-
{ label:
|
|
2208
|
-
{ label:
|
|
2209
|
-
{ label:
|
|
2210
|
-
{ label:
|
|
2490
|
+
{ label: __17("Thumbnail - 150 x 150", "elementor"), value: "thumbnail" },
|
|
2491
|
+
{ label: __17("Medium - 300 x 300", "elementor"), value: "medium" },
|
|
2492
|
+
{ label: __17("Large 1024 x 1024", "elementor"), value: "large" },
|
|
2493
|
+
{ label: __17("Full", "elementor"), value: "full" }
|
|
2211
2494
|
];
|
|
2212
2495
|
var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
2213
2496
|
const { propType, value: overlayValues, setValue } = useBoundProp(backgroundOverlayPropTypeUtil);
|
|
2214
|
-
return /* @__PURE__ */
|
|
2497
|
+
return /* @__PURE__ */ React40.createElement(PropProvider, { propType, value: overlayValues, setValue }, /* @__PURE__ */ React40.createElement(
|
|
2215
2498
|
Repeater,
|
|
2216
2499
|
{
|
|
2500
|
+
openOnAdd: true,
|
|
2217
2501
|
values: overlayValues ?? [],
|
|
2218
2502
|
setValues: setValue,
|
|
2219
|
-
label:
|
|
2503
|
+
label: __17("Overlay", "elementor"),
|
|
2220
2504
|
itemSettings: {
|
|
2221
2505
|
Icon: ItemIcon2,
|
|
2222
2506
|
Label: ItemLabel2,
|
|
@@ -2227,58 +2511,85 @@ var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
|
2227
2511
|
));
|
|
2228
2512
|
});
|
|
2229
2513
|
var ItemContent2 = ({ bind }) => {
|
|
2230
|
-
return /* @__PURE__ */
|
|
2514
|
+
return /* @__PURE__ */ React40.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React40.createElement(Content2, null));
|
|
2231
2515
|
};
|
|
2232
2516
|
var Content2 = () => {
|
|
2233
2517
|
const { getTabsProps, getTabProps, getTabPanelProps } = useBackgroundTabsHistory({
|
|
2234
2518
|
image: getInitialBackgroundOverlay().value,
|
|
2235
|
-
color: initialBackgroundColorOverlay.value
|
|
2519
|
+
color: initialBackgroundColorOverlay.value,
|
|
2520
|
+
gradient: initialBackgroundGradientOverlay.value
|
|
2236
2521
|
});
|
|
2237
|
-
return /* @__PURE__ */
|
|
2522
|
+
return /* @__PURE__ */ React40.createElement(Box4, { sx: { width: "100%" } }, /* @__PURE__ */ React40.createElement(Box4, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React40.createElement(Tabs, { ...getTabsProps(), "aria-label": __17("Background Overlay", "elementor") }, /* @__PURE__ */ React40.createElement(Tab, { label: __17("Image", "elementor"), ...getTabProps("image") }), /* @__PURE__ */ React40.createElement(Tab, { label: __17("Gradient", "elementor"), ...getTabProps("gradient") }), /* @__PURE__ */ React40.createElement(Tab, { label: __17("Color", "elementor"), ...getTabProps("color") }))), /* @__PURE__ */ React40.createElement(TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("image") }, /* @__PURE__ */ React40.createElement(PopoverContent, null, /* @__PURE__ */ React40.createElement(ImageOverlayContent, null))), /* @__PURE__ */ React40.createElement(TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("gradient") }, /* @__PURE__ */ React40.createElement(BackgroundGradientColorControl, null)), /* @__PURE__ */ React40.createElement(TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("color") }, /* @__PURE__ */ React40.createElement(PopoverContent, null, /* @__PURE__ */ React40.createElement(ColorOverlayContent, null))));
|
|
2238
2523
|
};
|
|
2239
2524
|
var ItemIcon2 = ({ value }) => {
|
|
2240
2525
|
switch (value.$$type) {
|
|
2241
2526
|
case "background-image-overlay":
|
|
2242
|
-
return /* @__PURE__ */
|
|
2527
|
+
return /* @__PURE__ */ React40.createElement(ItemIconImage, { value });
|
|
2243
2528
|
case "background-color-overlay":
|
|
2244
|
-
return /* @__PURE__ */
|
|
2529
|
+
return /* @__PURE__ */ React40.createElement(ItemIconColor, { value });
|
|
2530
|
+
case "background-gradient-overlay":
|
|
2531
|
+
return /* @__PURE__ */ React40.createElement(ItemIconGradient, { value });
|
|
2245
2532
|
default:
|
|
2246
2533
|
return null;
|
|
2247
2534
|
}
|
|
2248
2535
|
};
|
|
2249
|
-
var
|
|
2250
|
-
|
|
2536
|
+
var extractColorFrom = (prop) => {
|
|
2537
|
+
if (prop?.value?.color?.value) {
|
|
2538
|
+
return prop.value.color.value;
|
|
2539
|
+
}
|
|
2540
|
+
return "";
|
|
2541
|
+
};
|
|
2542
|
+
var ItemIconColor = ({ value: prop }) => {
|
|
2543
|
+
const color = extractColorFrom(prop);
|
|
2544
|
+
return /* @__PURE__ */ React40.createElement(UnstableColorIndicator2, { size: "inherit", component: "span", value: color });
|
|
2251
2545
|
};
|
|
2252
2546
|
var ItemIconImage = ({ value }) => {
|
|
2253
2547
|
const { imageUrl } = useImage(value);
|
|
2254
|
-
return /* @__PURE__ */
|
|
2548
|
+
return /* @__PURE__ */ React40.createElement(CardMedia3, { image: imageUrl, sx: { height: 13, width: 13, borderRadius: "4px" } });
|
|
2549
|
+
};
|
|
2550
|
+
var ItemIconGradient = ({ value }) => {
|
|
2551
|
+
const gradient = getGradientValue(value);
|
|
2552
|
+
return /* @__PURE__ */ React40.createElement(UnstableColorIndicator2, { size: "inherit", component: "span", value: gradient });
|
|
2255
2553
|
};
|
|
2256
2554
|
var ItemLabel2 = ({ value }) => {
|
|
2257
2555
|
switch (value.$$type) {
|
|
2258
2556
|
case "background-image-overlay":
|
|
2259
|
-
return /* @__PURE__ */
|
|
2557
|
+
return /* @__PURE__ */ React40.createElement(ItemLabelImage, { value });
|
|
2260
2558
|
case "background-color-overlay":
|
|
2261
|
-
return /* @__PURE__ */
|
|
2559
|
+
return /* @__PURE__ */ React40.createElement(ItemLabelColor, { value });
|
|
2560
|
+
case "background-gradient-overlay":
|
|
2561
|
+
return /* @__PURE__ */ React40.createElement(ItemLabelGradient, { value });
|
|
2262
2562
|
default:
|
|
2263
2563
|
return null;
|
|
2264
2564
|
}
|
|
2265
2565
|
};
|
|
2266
|
-
var ItemLabelColor = ({ value }) => {
|
|
2267
|
-
|
|
2566
|
+
var ItemLabelColor = ({ value: prop }) => {
|
|
2567
|
+
const color = extractColorFrom(prop);
|
|
2568
|
+
return /* @__PURE__ */ React40.createElement("span", null, color);
|
|
2268
2569
|
};
|
|
2269
2570
|
var ItemLabelImage = ({ value }) => {
|
|
2270
2571
|
const { imageTitle } = useImage(value);
|
|
2271
|
-
return /* @__PURE__ */
|
|
2572
|
+
return /* @__PURE__ */ React40.createElement("span", null, imageTitle);
|
|
2573
|
+
};
|
|
2574
|
+
var ItemLabelGradient = ({ value }) => {
|
|
2575
|
+
if (value.value.type.value === "linear") {
|
|
2576
|
+
return /* @__PURE__ */ React40.createElement("span", null, __17("Linear Gradient", "elementor"));
|
|
2577
|
+
}
|
|
2578
|
+
return /* @__PURE__ */ React40.createElement("span", null, __17("Radial Gradient", "elementor"));
|
|
2579
|
+
};
|
|
2580
|
+
var ColorOverlayContent = () => {
|
|
2581
|
+
const propContext = useBoundProp(backgroundColorOverlayPropTypeUtil2);
|
|
2582
|
+
return /* @__PURE__ */ React40.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React40.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React40.createElement(ColorControl, null)));
|
|
2272
2583
|
};
|
|
2273
2584
|
var ImageOverlayContent = () => {
|
|
2274
2585
|
const propContext = useBoundProp(backgroundImageOverlayPropTypeUtil2);
|
|
2275
|
-
return /* @__PURE__ */
|
|
2586
|
+
return /* @__PURE__ */ React40.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React40.createElement(PropKeyProvider, { bind: "image" }, /* @__PURE__ */ React40.createElement(Grid13, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React40.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React40.createElement(
|
|
2276
2587
|
ImageControl,
|
|
2277
2588
|
{
|
|
2278
|
-
resolutionLabel:
|
|
2589
|
+
resolutionLabel: __17("Resolution", "elementor"),
|
|
2279
2590
|
sizes: backgroundResolutionOptions
|
|
2280
2591
|
}
|
|
2281
|
-
)))), /* @__PURE__ */
|
|
2592
|
+
)))), /* @__PURE__ */ React40.createElement(PropKeyProvider, { bind: "position" }, /* @__PURE__ */ React40.createElement(BackgroundImageOverlayPosition, null)), /* @__PURE__ */ React40.createElement(PropKeyProvider, { bind: "repeat" }, /* @__PURE__ */ React40.createElement(BackgroundImageOverlayRepeat, null)), /* @__PURE__ */ React40.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React40.createElement(BackgroundImageOverlaySize, null)), /* @__PURE__ */ React40.createElement(PropKeyProvider, { bind: "attachment" }, /* @__PURE__ */ React40.createElement(BackgroundImageOverlayAttachment, null)));
|
|
2282
2593
|
};
|
|
2283
2594
|
var useImage = (image) => {
|
|
2284
2595
|
let imageTitle, imageUrl = null;
|
|
@@ -2294,11 +2605,19 @@ var useImage = (image) => {
|
|
|
2294
2605
|
}
|
|
2295
2606
|
return { imageTitle, imageUrl };
|
|
2296
2607
|
};
|
|
2608
|
+
var getGradientValue = (value) => {
|
|
2609
|
+
const gradient = value.value;
|
|
2610
|
+
const stops = gradient.stops.value?.map(({ value: { color, offset } }) => `${color.value} ${offset.value ?? 0}%`)?.join(",");
|
|
2611
|
+
if (gradient.type.value === "linear") {
|
|
2612
|
+
return `linear-gradient(${gradient.angle.value}deg, ${stops})`;
|
|
2613
|
+
}
|
|
2614
|
+
return `radial-gradient(circle at ${gradient.positions.value}, ${stops})`;
|
|
2615
|
+
};
|
|
2297
2616
|
|
|
2298
2617
|
// src/controls/background-control/background-control.tsx
|
|
2299
2618
|
var BackgroundControl = createControl(() => {
|
|
2300
2619
|
const propContext = useBoundProp(backgroundPropTypeUtil);
|
|
2301
|
-
return /* @__PURE__ */
|
|
2620
|
+
return /* @__PURE__ */ React41.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React41.createElement(SectionContent, null, /* @__PURE__ */ React41.createElement(PropKeyProvider, { bind: "background-overlay" }, /* @__PURE__ */ React41.createElement(BackgroundOverlayRepeaterControl, null)), /* @__PURE__ */ React41.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React41.createElement(Grid14, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React41.createElement(Grid14, { item: true, xs: 6 }, /* @__PURE__ */ React41.createElement(ControlLabel, null, __18("Color", "elementor"))), /* @__PURE__ */ React41.createElement(Grid14, { item: true, xs: 6 }, /* @__PURE__ */ React41.createElement(ColorControl, null))))));
|
|
2302
2621
|
});
|
|
2303
2622
|
export {
|
|
2304
2623
|
BackgroundControl,
|