@elementor/editor-controls 0.6.1 → 0.7.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/dist/index.mjs CHANGED
@@ -251,13 +251,14 @@ function ControlActions({ children }) {
251
251
  }
252
252
 
253
253
  // src/controls/image-media-control.tsx
254
- var ImageMediaControl = createControl(() => {
254
+ var ImageMediaControl = createControl((props) => {
255
255
  const { value, setValue } = useBoundProp(imageSrcPropTypeUtil);
256
256
  const { id, url } = value ?? {};
257
257
  const { data: attachment, isFetching } = useWpMediaAttachment(id?.value || null);
258
258
  const src = attachment?.url ?? url?.value ?? null;
259
259
  const { open } = useWpMediaFrame({
260
260
  types: ["image", "image/svg+xml"],
261
+ allowedExtensions: props.allowedExtensions,
261
262
  multiple: false,
262
263
  selected: id?.value || null,
263
264
  onSelect: (selectedAttachment) => {
@@ -270,7 +271,7 @@ var ImageMediaControl = createControl(() => {
270
271
  });
271
272
  }
272
273
  });
273
- return /* @__PURE__ */ React8.createElement(Card, { variant: "outlined" }, /* @__PURE__ */ React8.createElement(CardMedia, { image: src, sx: { height: 150 } }, isFetching ? /* @__PURE__ */ React8.createElement(Stack, { justifyContent: "center", alignItems: "center", width: "100%", height: "100%" }, /* @__PURE__ */ React8.createElement(CircularProgress, null)) : null), /* @__PURE__ */ React8.createElement(CardOverlay, null, /* @__PURE__ */ React8.createElement(ControlActions, null, /* @__PURE__ */ React8.createElement(Stack, { gap: 1 }, /* @__PURE__ */ React8.createElement(
274
+ return /* @__PURE__ */ React8.createElement(ControlActions, null, /* @__PURE__ */ React8.createElement(Card, { variant: "outlined" }, /* @__PURE__ */ React8.createElement(CardMedia, { image: src, sx: { height: 150 } }, isFetching ? /* @__PURE__ */ React8.createElement(Stack, { justifyContent: "center", alignItems: "center", width: "100%", height: "100%" }, /* @__PURE__ */ React8.createElement(CircularProgress, null)) : /* @__PURE__ */ React8.createElement(React8.Fragment, null)), /* @__PURE__ */ React8.createElement(CardOverlay, null, /* @__PURE__ */ React8.createElement(Stack, { gap: 1 }, /* @__PURE__ */ React8.createElement(
274
275
  Button,
275
276
  {
276
277
  size: "tiny",
@@ -299,10 +300,11 @@ import { MenuItem, Select } from "@elementor/ui";
299
300
  var SelectControl = createControl(({ options, onChange }) => {
300
301
  const { value, setValue } = useBoundProp(stringPropTypeUtil);
301
302
  const handleChange = (event) => {
302
- onChange?.(event.target.value, value);
303
- setValue(event.target.value);
303
+ const newValue = event.target.value || null;
304
+ onChange?.(newValue, value);
305
+ setValue(newValue);
304
306
  };
305
- return /* @__PURE__ */ React9.createElement(ControlActions, null, /* @__PURE__ */ React9.createElement(Select, { displayEmpty: true, size: "tiny", value: value ?? "", onChange: handleChange, fullWidth: true }, options.map(({ label, ...props }) => /* @__PURE__ */ React9.createElement(MenuItem, { key: props.value, ...props }, label))));
307
+ return /* @__PURE__ */ React9.createElement(ControlActions, null, /* @__PURE__ */ React9.createElement(Select, { displayEmpty: true, size: "tiny", value: value ?? "", onChange: handleChange, fullWidth: true }, options.map(({ label, ...props }) => /* @__PURE__ */ React9.createElement(MenuItem, { key: props.value, ...props, value: props.value ?? "" }, label))));
306
308
  });
307
309
 
308
310
  // src/controls/image-control.tsx
@@ -313,7 +315,6 @@ var ImageControl = createControl((props) => {
313
315
 
314
316
  // src/controls/autocomplete-control.tsx
315
317
  import * as React11 from "react";
316
- import { useState } from "react";
317
318
  import { stringPropTypeUtil as stringPropTypeUtil2 } from "@elementor/editor-props";
318
319
  import { XIcon } from "@elementor/icons";
319
320
  import {
@@ -332,21 +333,16 @@ var AutocompleteControl = createControl(
332
333
  minInputLength = 2
333
334
  }) => {
334
335
  const { value = "", setValue } = useBoundProp(propType);
335
- const [inputValue, setInputValue] = useState(
336
- value && options[value]?.label ? options[value]?.label : value
337
- );
338
- const hasSelectedValue = !!(inputValue && (options[inputValue] || Object.values(options).find(({ label }) => label === inputValue)));
339
- const allowClear = !!inputValue;
336
+ const hasSelectedValue = !!(value && (options[value] || Object.values(options).find(({ label }) => label === value)));
337
+ const allowClear = !!value;
340
338
  const formattedOptions = Object.keys(options);
341
- const handleChange = (_, newValue = null) => {
342
- const formattedInputValue = newValue && options[newValue]?.label ? options[newValue]?.label : newValue;
343
- setInputValue(formattedInputValue || "");
344
- if (!allowCustomValues && newValue && !options[newValue]) {
345
- return;
346
- }
339
+ const onOptionSelect = (_, newValue) => {
347
340
  setValue(newValue);
348
341
  };
349
- const filterOptions = () => {
342
+ const handleChange = (newValue) => {
343
+ setValue(newValue);
344
+ };
345
+ const filterOptions = (_, { inputValue }) => {
350
346
  const formattedValue = inputValue?.toLowerCase() || "";
351
347
  if (formattedValue.length < minInputLength) {
352
348
  return [];
@@ -358,18 +354,16 @@ var AutocompleteControl = createControl(
358
354
  const isOptionEqualToValue = () => {
359
355
  return muiWarningPreventer() ? void 0 : () => true;
360
356
  };
361
- const muiWarningPreventer = () => allowCustomValues || !!filterOptions().length;
357
+ const muiWarningPreventer = () => allowCustomValues || !!filterOptions([], { inputValue: value }).length;
362
358
  return /* @__PURE__ */ React11.createElement(ControlActions, null, /* @__PURE__ */ React11.createElement(
363
359
  Autocomplete,
364
360
  {
365
361
  forcePopupIcon: false,
366
362
  disableClearable: true,
367
363
  freeSolo: muiWarningPreventer(),
368
- value: inputValue || "",
364
+ value: value || "",
369
365
  size: "tiny",
370
- onChange: handleChange,
371
- onInputChange: handleChange,
372
- onBlur: allowCustomValues ? void 0 : () => handleChange(null, value),
366
+ onChange: onOptionSelect,
373
367
  readOnly: hasSelectedValue,
374
368
  options: formattedOptions,
375
369
  getOptionKey: (option) => option,
@@ -399,11 +393,15 @@ var TextInput = ({
399
393
  handleChange,
400
394
  hasSelectedValue
401
395
  }) => {
396
+ const onChange = (event) => {
397
+ handleChange(event.target.value);
398
+ };
402
399
  return /* @__PURE__ */ React11.createElement(
403
400
  TextField,
404
401
  {
405
402
  ...params,
406
403
  placeholder,
404
+ onChange,
407
405
  sx: {
408
406
  "& .MuiInputBase-input": {
409
407
  cursor: hasSelectedValue ? "default" : void 0
@@ -420,7 +418,7 @@ var ClearButton = ({
420
418
  allowClear,
421
419
  handleChange,
422
420
  params
423
- }) => /* @__PURE__ */ React11.createElement(InputAdornment, { position: "end" }, allowClear && /* @__PURE__ */ React11.createElement(IconButton, { size: params.size, onClick: handleChange, sx: { cursor: "pointer" } }, /* @__PURE__ */ React11.createElement(XIcon, { fontSize: params.size })));
421
+ }) => /* @__PURE__ */ React11.createElement(InputAdornment, { position: "end" }, allowClear && /* @__PURE__ */ React11.createElement(IconButton, { size: params.size, onClick: () => handleChange(null), sx: { cursor: "pointer" } }, /* @__PURE__ */ React11.createElement(XIcon, { fontSize: params.size })));
424
422
  function shouldGroupOptions(options) {
425
423
  return Object.values(options).every((option) => "groupLabel" in option);
426
424
  }
@@ -522,7 +520,7 @@ var SelectionEndAdornment = ({
522
520
  };
523
521
 
524
522
  // src/hooks/use-sync-external-state.tsx
525
- import { useEffect, useState as useState2 } from "react";
523
+ import { useEffect, useState } from "react";
526
524
  var useSyncExternalState = ({
527
525
  external,
528
526
  setExternal,
@@ -541,7 +539,7 @@ var useSyncExternalState = ({
541
539
  }
542
540
  return externalValue;
543
541
  }
544
- const [internal, setInternal] = useState2(toInternal(external, null));
542
+ const [internal, setInternal] = useState(toInternal(external, null));
545
543
  useEffect(() => {
546
544
  setInternal((prevInternal) => toInternal(external, prevInternal));
547
545
  }, [external]);
@@ -633,7 +631,7 @@ import { __ as __5 } from "@wordpress/i18n";
633
631
 
634
632
  // src/components/repeater.tsx
635
633
  import * as React18 from "react";
636
- import { useRef, useState as useState3 } from "react";
634
+ import { useRef, useState as useState2 } from "react";
637
635
  import { CopyIcon, EyeIcon, EyeOffIcon, PlusIcon, XIcon as XIcon2 } from "@elementor/icons";
638
636
  import {
639
637
  bindPopover,
@@ -691,7 +689,7 @@ var Repeater = ({
691
689
  duplicateItem: () => duplicateRepeaterItem(index),
692
690
  toggleDisableItem: () => toggleDisableRepeaterItem(index)
693
691
  },
694
- (props) => /* @__PURE__ */ React18.createElement(itemSettings.Content, { ...props, bind: String(index) })
692
+ (props) => /* @__PURE__ */ React18.createElement(itemSettings.Content, { ...props, value, bind: String(index) })
695
693
  ))));
696
694
  };
697
695
  var RepeaterItem = ({
@@ -706,7 +704,7 @@ var RepeaterItem = ({
706
704
  }) => {
707
705
  const popupId = `repeater-popup-${bind}`;
708
706
  const controlRef = useRef(null);
709
- const [anchorEl, setAnchorEl] = useState3(null);
707
+ const [anchorEl, setAnchorEl] = useState2(null);
710
708
  const popoverState = usePopupState2({ popupId, variant: "popover" });
711
709
  const popoverProps = bindPopover(popoverState);
712
710
  return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(
@@ -808,7 +806,7 @@ var Content = ({ anchorEl }) => {
808
806
  {
809
807
  options: [
810
808
  { label: __5("Inset", "elementor"), value: "inset" },
811
- { label: __5("Outset", "elementor"), value: "" }
809
+ { label: __5("Outset", "elementor"), value: null }
812
810
  ]
813
811
  }
814
812
  ))), /* @__PURE__ */ React19.createElement(Grid3, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React19.createElement(Control2, { bind: "hOffset", label: __5("Horizontal", "elementor") }, /* @__PURE__ */ React19.createElement(SizeControl, null)), /* @__PURE__ */ React19.createElement(Control2, { bind: "vOffset", label: __5("Vertical", "elementor") }, /* @__PURE__ */ React19.createElement(SizeControl, null))), /* @__PURE__ */ React19.createElement(Grid3, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React19.createElement(Control2, { bind: "blur", label: __5("Blur", "elementor") }, /* @__PURE__ */ React19.createElement(SizeControl, null)), /* @__PURE__ */ React19.createElement(Control2, { bind: "spread", label: __5("Spread", "elementor") }, /* @__PURE__ */ React19.createElement(SizeControl, null)))));
@@ -820,13 +818,14 @@ var ItemLabel = ({ value }) => {
820
818
  const { size: spreadSize = "", unit: spreadUnit = "" } = spread?.value || {};
821
819
  const { size: hOffsetSize = "unset", unit: hOffsetUnit = "" } = hOffset?.value || {};
822
820
  const { size: vOffsetSize = "unset", unit: vOffsetUnit = "" } = vOffset?.value || {};
821
+ const positionLabel = position?.value || "outset";
823
822
  const sizes = [
824
823
  hOffsetSize + hOffsetUnit,
825
824
  vOffsetSize + vOffsetUnit,
826
825
  blurSize + blurUnit,
827
826
  spreadSize + spreadUnit
828
827
  ].join(" ");
829
- return /* @__PURE__ */ React19.createElement("span", { style: { textTransform: "capitalize" } }, position ?? "outset", ": ", sizes);
828
+ return /* @__PURE__ */ React19.createElement("span", { style: { textTransform: "capitalize" } }, positionLabel, ": ", sizes);
830
829
  };
831
830
  var initialShadow = {
832
831
  $$type: "shadow",
@@ -1017,7 +1016,7 @@ function EqualUnequalSizesControl({
1017
1016
  };
1018
1017
  const isEqual = isEqualSizes(newMappedValues, items);
1019
1018
  if (isEqual) {
1020
- return setSizeValue(Object.values(newMappedValues)[0].value);
1019
+ return setSizeValue(Object.values(newMappedValues)[0]?.value);
1021
1020
  }
1022
1021
  setMultiSizeValue(newMappedValues);
1023
1022
  };
@@ -1027,7 +1026,8 @@ function EqualUnequalSizesControl({
1027
1026
  }
1028
1027
  return splitEqualValue() ?? null;
1029
1028
  };
1030
- return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(Grid4, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap", ref: controlRef }, /* @__PURE__ */ React23.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(ControlLabel, null, label)), /* @__PURE__ */ React23.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(Stack6, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React23.createElement(SizeControl, { placeholder: __6("Mixed", "elementor") }), /* @__PURE__ */ React23.createElement(
1029
+ const isMixed = !!multiSizeValue;
1030
+ return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(Grid4, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap", ref: controlRef }, /* @__PURE__ */ React23.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(ControlLabel, null, label)), /* @__PURE__ */ React23.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(Stack6, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React23.createElement(SizeControl, { placeholder: isMixed ? __6("Mixed", "elementor") : void 0 }), /* @__PURE__ */ React23.createElement(
1031
1031
  ToggleButton2,
1032
1032
  {
1033
1033
  size: "tiny",
@@ -1062,10 +1062,7 @@ var MultiSizeValueControl = ({ item }) => /* @__PURE__ */ React23.createElement(
1062
1062
 
1063
1063
  // src/controls/linked-dimensions-control.tsx
1064
1064
  import * as React24 from "react";
1065
- import {
1066
- dimensionsPropTypeUtil,
1067
- sizePropTypeUtil as sizePropTypeUtil3
1068
- } from "@elementor/editor-props";
1065
+ import { dimensionsPropTypeUtil, sizePropTypeUtil as sizePropTypeUtil3 } from "@elementor/editor-props";
1069
1066
  import { DetachIcon, LinkIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from "@elementor/icons";
1070
1067
  import { Grid as Grid5, Stack as Stack7, ToggleButton as ToggleButton3 } from "@elementor/ui";
1071
1068
  import { __ as __7 } from "@wordpress/i18n";
@@ -1073,16 +1070,9 @@ var LinkedDimensionsControl = createControl(({ label }) => {
1073
1070
  const { value: dimensionsValue, setValue: setDimensionsValue, propType } = useBoundProp(dimensionsPropTypeUtil);
1074
1071
  const { value: sizeValue, setValue: setSizeValue } = useBoundProp(sizePropTypeUtil3);
1075
1072
  const isLinked = !dimensionsValue && !sizeValue ? true : !!sizeValue;
1076
- const setValue = (newValue) => {
1077
- if (!isLinked) {
1078
- setDimensionsValue(newValue);
1079
- return;
1080
- }
1081
- setSizeValue(newValue.top);
1082
- };
1083
1073
  const onLinkToggle = () => {
1084
1074
  if (!isLinked) {
1085
- setSizeValue(dimensionsValue?.top.value);
1075
+ setSizeValue(dimensionsValue?.top?.value);
1086
1076
  return;
1087
1077
  }
1088
1078
  const value = sizeValue ? sizePropTypeUtil3.create(sizeValue) : null;
@@ -1094,7 +1084,7 @@ var LinkedDimensionsControl = createControl(({ label }) => {
1094
1084
  });
1095
1085
  };
1096
1086
  const LinkedIcon = isLinked ? LinkIcon : DetachIcon;
1097
- return /* @__PURE__ */ React24.createElement(PropProvider, { propType, value: dimensionsValue, setValue }, /* @__PURE__ */ React24.createElement(Stack7, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React24.createElement(ControlLabel, null, label), /* @__PURE__ */ React24.createElement(
1087
+ return /* @__PURE__ */ React24.createElement(PropProvider, { propType, value: dimensionsValue, setValue: setDimensionsValue }, /* @__PURE__ */ React24.createElement(Stack7, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React24.createElement(ControlLabel, null, label), /* @__PURE__ */ React24.createElement(
1098
1088
  ToggleButton3,
1099
1089
  {
1100
1090
  "aria-label": __7("Link Inputs", "elementor"),
@@ -1143,7 +1133,7 @@ var Control3 = ({ bind, startIcon, isLinked }) => {
1143
1133
  };
1144
1134
 
1145
1135
  // src/controls/font-family-control.tsx
1146
- import { Fragment as Fragment3, useId as useId3, useState as useState4 } from "react";
1136
+ import { Fragment as Fragment4, useId as useId3, useState as useState3 } from "react";
1147
1137
  import * as React25 from "react";
1148
1138
  import { stringPropTypeUtil as stringPropTypeUtil6 } from "@elementor/editor-props";
1149
1139
  import { ChevronDownIcon, EditIcon, PhotoIcon, SearchIcon, XIcon as XIcon3 } from "@elementor/icons";
@@ -1200,7 +1190,7 @@ var useFilteredFontFamilies = (fontFamilies, searchValue) => {
1200
1190
  // src/controls/font-family-control.tsx
1201
1191
  var SIZE2 = "tiny";
1202
1192
  var FontFamilyControl = createControl(({ fontFamilies }) => {
1203
- const [searchValue, setSearchValue] = useState4("");
1193
+ const [searchValue, setSearchValue] = useState3("");
1204
1194
  const { value: fontFamily, setValue: setFontFamily } = useBoundProp(stringPropTypeUtil6);
1205
1195
  const popupId = useId3();
1206
1196
  const popoverState = usePopupState4({ variant: "popover", popupId });
@@ -1245,7 +1235,7 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
1245
1235
  startAdornment: /* @__PURE__ */ React25.createElement(InputAdornment4, { position: "start" }, /* @__PURE__ */ React25.createElement(SearchIcon, { fontSize: SIZE2 }))
1246
1236
  }
1247
1237
  }
1248
- )), /* @__PURE__ */ React25.createElement(Divider, null), /* @__PURE__ */ React25.createElement(Box3, { sx: { overflowY: "auto", height: 260, width: 220 } }, filteredFontFamilies.length > 0 ? /* @__PURE__ */ React25.createElement(MenuList, { role: "listbox", tabIndex: 0 }, filteredFontFamilies.map(([category, items], index) => /* @__PURE__ */ React25.createElement(Fragment3, { key: index }, /* @__PURE__ */ React25.createElement(ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, category), items.map((item) => {
1238
+ )), /* @__PURE__ */ React25.createElement(Divider, null), /* @__PURE__ */ React25.createElement(Box3, { sx: { overflowY: "auto", height: 260, width: 220 } }, filteredFontFamilies.length > 0 ? /* @__PURE__ */ React25.createElement(MenuList, { role: "listbox", tabIndex: 0 }, filteredFontFamilies.map(([category, items], index) => /* @__PURE__ */ React25.createElement(Fragment4, { key: index }, /* @__PURE__ */ React25.createElement(ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, category), items.map((item) => {
1249
1239
  const isSelected = item === fontFamily;
1250
1240
  return /* @__PURE__ */ React25.createElement(
1251
1241
  MenuItem3,
@@ -1357,34 +1347,31 @@ var SwitchControl = () => {
1357
1347
 
1358
1348
  // src/controls/gap-control.tsx
1359
1349
  import * as React28 from "react";
1360
- import { gapPropTypeUtil } from "@elementor/editor-props";
1350
+ import { layoutDirectionPropTypeUtil, sizePropTypeUtil as sizePropTypeUtil4 } from "@elementor/editor-props";
1361
1351
  import { DetachIcon as DetachIcon2, LinkIcon as LinkIcon2 } from "@elementor/icons";
1362
1352
  import { Grid as Grid7, Stack as Stack10, ToggleButton as ToggleButton4 } from "@elementor/ui";
1363
1353
  import { __ as __11 } from "@wordpress/i18n";
1364
1354
  var GapControl = createControl(({ label }) => {
1365
- const { propType, value, setValue } = useBoundProp(gapPropTypeUtil);
1366
- const { column, row, isLinked = true } = value || {};
1367
- const setLinkedValue = (newValue, _, meta) => {
1355
+ const {
1356
+ value: directionValue,
1357
+ setValue: setDirectionValue,
1358
+ propType
1359
+ } = useBoundProp(layoutDirectionPropTypeUtil);
1360
+ const { value: sizeValue, setValue: setSizeValue } = useBoundProp(sizePropTypeUtil4);
1361
+ const isLinked = !directionValue && !sizeValue ? true : !!sizeValue;
1362
+ const onLinkToggle = () => {
1368
1363
  if (!isLinked) {
1369
- return setValue(newValue);
1364
+ setSizeValue(directionValue?.column.value);
1365
+ return;
1370
1366
  }
1371
- const newDimension = newValue[meta?.bind];
1372
- setValue({
1373
- isLinked,
1374
- column: newDimension,
1375
- row: newDimension
1367
+ const value = sizeValue ? sizePropTypeUtil4.create(sizeValue) : null;
1368
+ setDirectionValue({
1369
+ row: value,
1370
+ column: value
1376
1371
  });
1377
1372
  };
1378
- const toggleLinked = () => {
1379
- const updatedValue = {
1380
- isLinked: !isLinked,
1381
- column,
1382
- row: !isLinked ? column : row
1383
- };
1384
- setValue(updatedValue);
1385
- };
1386
1373
  const LinkedIcon = isLinked ? LinkIcon2 : DetachIcon2;
1387
- return /* @__PURE__ */ React28.createElement(PropProvider, { propType, value, setValue: setLinkedValue }, /* @__PURE__ */ React28.createElement(Stack10, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React28.createElement(ControlLabel, null, label), /* @__PURE__ */ React28.createElement(
1374
+ return /* @__PURE__ */ React28.createElement(PropProvider, { propType, value: directionValue, setValue: setDirectionValue }, /* @__PURE__ */ React28.createElement(Stack10, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React28.createElement(ControlLabel, null, label), /* @__PURE__ */ React28.createElement(
1388
1375
  ToggleButton4,
1389
1376
  {
1390
1377
  "aria-label": __11("Link Inputs", "elementor"),
@@ -1392,40 +1379,180 @@ var GapControl = createControl(({ label }) => {
1392
1379
  value: "check",
1393
1380
  selected: isLinked,
1394
1381
  sx: { marginLeft: "auto" },
1395
- onChange: toggleLinked
1382
+ onChange: onLinkToggle
1396
1383
  },
1397
1384
  /* @__PURE__ */ React28.createElement(LinkedIcon, { fontSize: "tiny" })
1398
- )), /* @__PURE__ */ React28.createElement(Stack10, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React28.createElement(Grid7, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React28.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(ControlLabel, null, __11("Column", "elementor"))), /* @__PURE__ */ React28.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(PropKeyProvider, { bind: "column" }, /* @__PURE__ */ React28.createElement(SizeControl, null)))), /* @__PURE__ */ React28.createElement(Grid7, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React28.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(ControlLabel, null, __11("Row", "elementor"))), /* @__PURE__ */ React28.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(PropKeyProvider, { bind: "row" }, /* @__PURE__ */ React28.createElement(SizeControl, null))))));
1385
+ )), /* @__PURE__ */ React28.createElement(Stack10, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React28.createElement(Grid7, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React28.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(ControlLabel, null, __11("Column", "elementor"))), /* @__PURE__ */ React28.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(Control4, { bind: "column", isLinked }))), /* @__PURE__ */ React28.createElement(Grid7, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React28.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(ControlLabel, null, __11("Row", "elementor"))), /* @__PURE__ */ React28.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(Control4, { bind: "row", isLinked })))));
1399
1386
  });
1387
+ var Control4 = ({ bind, isLinked }) => {
1388
+ if (isLinked) {
1389
+ return /* @__PURE__ */ React28.createElement(SizeControl, null);
1390
+ }
1391
+ return /* @__PURE__ */ React28.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React28.createElement(SizeControl, null));
1392
+ };
1400
1393
 
1401
1394
  // src/controls/background-control/background-control.tsx
1402
- import * as React30 from "react";
1395
+ import * as React35 from "react";
1403
1396
  import { backgroundPropTypeUtil } from "@elementor/editor-props";
1404
- import { Grid as Grid9, Stack as Stack12 } from "@elementor/ui";
1405
- import { __ as __13 } from "@wordpress/i18n";
1397
+ import { Grid as Grid14, Stack as Stack12 } from "@elementor/ui";
1398
+ import { __ as __18 } from "@wordpress/i18n";
1406
1399
 
1407
1400
  // src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
1408
- import * as React29 from "react";
1401
+ import * as React34 from "react";
1409
1402
  import {
1410
1403
  backgroundColorOverlayPropTypeUtil,
1411
1404
  backgroundImageOverlayPropTypeUtil,
1412
1405
  backgroundOverlayPropTypeUtil
1413
1406
  } from "@elementor/editor-props";
1414
- import { Grid as Grid8, Stack as Stack11, UnstableColorIndicator as UnstableColorIndicator2 } from "@elementor/ui";
1407
+ import { Box as Box4, Grid as Grid13, Stack as Stack11, Tab, TabPanel, Tabs, UnstableColorIndicator as UnstableColorIndicator2, useTabs } from "@elementor/ui";
1415
1408
  import { useWpMediaAttachment as useWpMediaAttachment2 } from "@elementor/wp-media";
1409
+ import { __ as __17 } from "@wordpress/i18n";
1410
+
1411
+ // src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx
1412
+ import * as React29 from "react";
1413
+ import { PinIcon, PinnedOffIcon } from "@elementor/icons";
1414
+ import { Grid as Grid8 } from "@elementor/ui";
1416
1415
  import { __ as __12 } from "@wordpress/i18n";
1416
+ var attachmentControlOptions = [
1417
+ {
1418
+ value: "fixed",
1419
+ label: __12("Fixed", "elementor"),
1420
+ renderContent: ({ size }) => /* @__PURE__ */ React29.createElement(PinIcon, { fontSize: size }),
1421
+ showTooltip: true
1422
+ },
1423
+ {
1424
+ value: "scroll",
1425
+ label: __12("Scroll", "elementor"),
1426
+ renderContent: ({ size }) => /* @__PURE__ */ React29.createElement(PinnedOffIcon, { fontSize: size }),
1427
+ showTooltip: true
1428
+ }
1429
+ ];
1430
+ var BackgroundImageOverlayAttachment = () => {
1431
+ return /* @__PURE__ */ React29.createElement(Grid8, { container: true, gap: 8, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React29.createElement(Grid8, { item: true, xs: 2 }, /* @__PURE__ */ React29.createElement(ControlLabel, null, __12("Attachment", "elementor"))), /* @__PURE__ */ React29.createElement(Grid8, { item: true, justifyContent: "flex-end", xs: 8, sx: { display: "flex" } }, /* @__PURE__ */ React29.createElement(ToggleControl, { options: attachmentControlOptions })));
1432
+ };
1433
+
1434
+ // src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
1435
+ import * as React30 from "react";
1436
+ import { Grid as Grid9 } from "@elementor/ui";
1437
+ import { __ as __13 } from "@wordpress/i18n";
1438
+ var backgroundPositionOptions = [
1439
+ { label: __13("Center Center", "elementor"), value: "center center" },
1440
+ { label: __13("Center Left", "elementor"), value: "center left" },
1441
+ { label: __13("Center Right", "elementor"), value: "center right" },
1442
+ { label: __13("Top Center", "elementor"), value: "top center" },
1443
+ { label: __13("Top Left", "elementor"), value: "top left" },
1444
+ { label: __13("Top Right", "elementor"), value: "top right" },
1445
+ { label: __13("Bottom Center", "elementor"), value: "bottom center" },
1446
+ { label: __13("Bottom Left", "elementor"), value: "bottom left" },
1447
+ { label: __13("Bottom Right", "elementor"), value: "bottom right" }
1448
+ ];
1449
+ var BackgroundImageOverlayPosition = () => {
1450
+ return /* @__PURE__ */ React30.createElement(Grid9, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React30.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React30.createElement(ControlLabel, null, __13("Position", "elementor"))), /* @__PURE__ */ React30.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React30.createElement(SelectControl, { options: backgroundPositionOptions })));
1451
+ };
1452
+
1453
+ // src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx
1454
+ import * as React31 from "react";
1455
+ import { DotsHorizontalIcon, DotsVerticalIcon, GridDotsIcon, XIcon as XIcon4 } from "@elementor/icons";
1456
+ import { Grid as Grid10 } from "@elementor/ui";
1457
+ import { __ as __14 } from "@wordpress/i18n";
1458
+ var repeatControlOptions = [
1459
+ {
1460
+ value: "repeat",
1461
+ label: __14("Repeat", "elementor"),
1462
+ renderContent: ({ size }) => /* @__PURE__ */ React31.createElement(GridDotsIcon, { fontSize: size }),
1463
+ showTooltip: true
1464
+ },
1465
+ {
1466
+ value: "repeat-x",
1467
+ label: __14("Repeat-x", "elementor"),
1468
+ renderContent: ({ size }) => /* @__PURE__ */ React31.createElement(DotsHorizontalIcon, { fontSize: size }),
1469
+ showTooltip: true
1470
+ },
1471
+ {
1472
+ value: "repeat-y",
1473
+ label: __14("Repeat-y", "elementor"),
1474
+ renderContent: ({ size }) => /* @__PURE__ */ React31.createElement(DotsVerticalIcon, { fontSize: size }),
1475
+ showTooltip: true
1476
+ },
1477
+ {
1478
+ value: "no-repeat",
1479
+ label: __14("No-Repeat", "elementor"),
1480
+ renderContent: ({ size }) => /* @__PURE__ */ React31.createElement(XIcon4, { fontSize: size }),
1481
+ showTooltip: true
1482
+ }
1483
+ ];
1484
+ var BackgroundImageOverlayRepeat = () => {
1485
+ return /* @__PURE__ */ React31.createElement(Grid10, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React31.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React31.createElement(ControlLabel, null, __14("Repeat", "elementor"))), /* @__PURE__ */ React31.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React31.createElement(ToggleControl, { options: repeatControlOptions })));
1486
+ };
1487
+
1488
+ // src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-resolution.tsx
1489
+ import * as React32 from "react";
1490
+ import { Grid as Grid11 } from "@elementor/ui";
1491
+ import { __ as __15 } from "@wordpress/i18n";
1492
+ var backgroundResolutionOptions = [
1493
+ { label: __15("Thumbnail - 150 x 150", "elementor"), value: "thumbnail" },
1494
+ { label: __15("Medium - 300 x 300", "elementor"), value: "medium" },
1495
+ { label: __15("Medium Large - 768 x 768"), value: "medium_large" },
1496
+ { label: __15("Large 1024 x 1024", "elementor"), value: "large" },
1497
+ { label: __15("Full", "elementor"), value: "full" }
1498
+ ];
1499
+ var BackgroundImageOverlayResolution = () => {
1500
+ return /* @__PURE__ */ React32.createElement(Grid11, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React32.createElement(Grid11, { item: true, xs: 6 }, /* @__PURE__ */ React32.createElement(ControlLabel, null, __15("Resolution", "elementor"))), /* @__PURE__ */ React32.createElement(Grid11, { item: true, xs: 6 }, /* @__PURE__ */ React32.createElement(SelectControl, { options: backgroundResolutionOptions })));
1501
+ };
1502
+
1503
+ // src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx
1504
+ import * as React33 from "react";
1505
+ import { ArrowBarBothIcon, ArrowsMaximizeIcon } from "@elementor/icons";
1506
+ import { Grid as Grid12 } from "@elementor/ui";
1507
+ import { __ as __16 } from "@wordpress/i18n";
1508
+ var sizeControlOptions = [
1509
+ {
1510
+ value: "auto",
1511
+ label: __16("Auto", "elementor"),
1512
+ renderContent: () => "Auto",
1513
+ showTooltip: true
1514
+ },
1515
+ {
1516
+ value: "cover",
1517
+ label: __16("Cover", "elementor"),
1518
+ renderContent: ({ size }) => /* @__PURE__ */ React33.createElement(ArrowsMaximizeIcon, { fontSize: size }),
1519
+ showTooltip: true
1520
+ },
1521
+ {
1522
+ value: "contain",
1523
+ label: __16("Contain", "elementor"),
1524
+ renderContent: ({ size }) => /* @__PURE__ */ React33.createElement(ArrowBarBothIcon, { fontSize: size }),
1525
+ showTooltip: true
1526
+ }
1527
+ ];
1528
+ var BackgroundImageOverlaySize = () => {
1529
+ return /* @__PURE__ */ React33.createElement(Grid12, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React33.createElement(Grid12, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(ControlLabel, null, __16("Size", "elementor"))), /* @__PURE__ */ React33.createElement(Grid12, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React33.createElement(ToggleControl, { options: sizeControlOptions })));
1530
+ };
1531
+
1532
+ // src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
1533
+ var defaultImagePlaceholderId = 1;
1417
1534
  var initialBackgroundOverlay = {
1418
- $$type: "background-color-overlay",
1419
- value: "rgba(0, 0, 0, 0.2)"
1535
+ $$type: "background-image-overlay",
1536
+ value: {
1537
+ "image-src": {
1538
+ $$type: "image-src",
1539
+ value: {
1540
+ id: {
1541
+ $$type: "image-attachment-id",
1542
+ value: defaultImagePlaceholderId
1543
+ }
1544
+ }
1545
+ }
1546
+ }
1420
1547
  };
1421
1548
  var BackgroundOverlayRepeaterControl = createControl(() => {
1422
1549
  const { propType, value: overlayValues, setValue } = useBoundProp(backgroundOverlayPropTypeUtil);
1423
- return /* @__PURE__ */ React29.createElement(PropProvider, { propType, value: overlayValues, setValue }, /* @__PURE__ */ React29.createElement(
1550
+ return /* @__PURE__ */ React34.createElement(PropProvider, { propType, value: overlayValues, setValue }, /* @__PURE__ */ React34.createElement(
1424
1551
  Repeater,
1425
1552
  {
1426
1553
  values: overlayValues ?? [],
1427
1554
  setValues: setValue,
1428
- label: __12("Overlay", "elementor"),
1555
+ label: __17("Overlay", "elementor"),
1429
1556
  itemSettings: {
1430
1557
  Icon: ItemIcon2,
1431
1558
  Label: ItemLabel2,
@@ -1435,36 +1562,50 @@ var BackgroundOverlayRepeaterControl = createControl(() => {
1435
1562
  }
1436
1563
  ));
1437
1564
  });
1438
- var ItemIcon2 = ({ value }) => /* @__PURE__ */ React29.createElement(UnstableColorIndicator2, { size: "inherit", component: "span", value: value.value });
1439
- var ItemContent2 = ({ bind }) => {
1440
- return /* @__PURE__ */ React29.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React29.createElement(Content2, null));
1565
+ var ItemIcon2 = ({ value }) => /* @__PURE__ */ React34.createElement(UnstableColorIndicator2, { size: "inherit", component: "span", value: value.value });
1566
+ var ItemContent2 = ({ bind, value }) => {
1567
+ return /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React34.createElement(Content2, { value }));
1441
1568
  };
1442
- var Content2 = () => {
1443
- const propContext = useBoundProp(backgroundImageOverlayPropTypeUtil);
1444
- return /* @__PURE__ */ React29.createElement(Stack11, { gap: 1.5 }, /* @__PURE__ */ React29.createElement(Grid8, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React29.createElement(Grid8, { item: true, xs: 12 }, /* @__PURE__ */ React29.createElement(ControlLabel, null, __12("Color", "elementor"))), /* @__PURE__ */ React29.createElement(Grid8, { item: true, xs: 12 }, /* @__PURE__ */ React29.createElement(ColorControl, { propTypeUtil: backgroundColorOverlayPropTypeUtil }))), /* @__PURE__ */ React29.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React29.createElement(PropKeyProvider, { bind: "image-src" }, /* @__PURE__ */ React29.createElement(Grid8, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React29.createElement(Grid8, { item: true, xs: 12 }, /* @__PURE__ */ React29.createElement(ImageMediaControl, null))))));
1569
+ var Content2 = ({ value }) => {
1570
+ const activeTab = deriveOverlayType(value.$$type);
1571
+ const { getTabsProps, getTabProps, getTabPanelProps } = useTabs(activeTab);
1572
+ return /* @__PURE__ */ React34.createElement(Box4, { sx: { width: "100%" } }, /* @__PURE__ */ React34.createElement(Box4, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React34.createElement(Tabs, { ...getTabsProps(), "aria-label": __17("Background Overlay", "elementor") }, /* @__PURE__ */ React34.createElement(Tab, { label: __17("Image", "elementor"), ...getTabProps("image") }), /* @__PURE__ */ React34.createElement(Tab, { label: __17("Color", "elementor"), ...getTabProps("color") }))), /* @__PURE__ */ React34.createElement(TabPanel, { ...getTabPanelProps("image") }, /* @__PURE__ */ React34.createElement(Stack11, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(ImageOverlayContent, null))), /* @__PURE__ */ React34.createElement(TabPanel, { ...getTabPanelProps("color") }, /* @__PURE__ */ React34.createElement(Grid13, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React34.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React34.createElement(ColorControl, { propTypeUtil: backgroundColorOverlayPropTypeUtil })))));
1445
1573
  };
1446
1574
  var ItemLabel2 = ({ value }) => {
1447
1575
  const type = value.$$type;
1448
1576
  if (type === "background-color-overlay") {
1449
- return /* @__PURE__ */ React29.createElement(ItemLabelColor, { value });
1577
+ return /* @__PURE__ */ React34.createElement(ItemLabelColor, { value });
1450
1578
  }
1451
1579
  if (type === "background-image-overlay") {
1452
- return /* @__PURE__ */ React29.createElement(ItemLabelImage, { value });
1580
+ return /* @__PURE__ */ React34.createElement(ItemLabelImage, { value });
1453
1581
  }
1454
1582
  };
1455
1583
  var ItemLabelColor = ({ value }) => {
1456
- return /* @__PURE__ */ React29.createElement("span", null, value.value);
1584
+ return /* @__PURE__ */ React34.createElement("span", null, value.value);
1457
1585
  };
1458
1586
  var ItemLabelImage = ({ value }) => {
1459
1587
  const { data: attachment } = useWpMediaAttachment2(value?.value["image-src"]?.value.id.value || null);
1460
1588
  const imageTitle = attachment?.title || null;
1461
- return /* @__PURE__ */ React29.createElement("span", null, imageTitle);
1589
+ return /* @__PURE__ */ React34.createElement("span", null, imageTitle);
1590
+ };
1591
+ var ImageOverlayContent = () => {
1592
+ const propContext = useBoundProp(backgroundImageOverlayPropTypeUtil);
1593
+ return /* @__PURE__ */ React34.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "image-src" }, /* @__PURE__ */ React34.createElement(Grid13, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React34.createElement(Grid13, { item: true, xs: 12 }, /* @__PURE__ */ React34.createElement(ImageMediaControl, null)))), /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "resolution" }, /* @__PURE__ */ React34.createElement(BackgroundImageOverlayResolution, null)), /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "position" }, /* @__PURE__ */ React34.createElement(BackgroundImageOverlayPosition, null)), /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "repeat" }, /* @__PURE__ */ React34.createElement(BackgroundImageOverlayRepeat, null)), /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React34.createElement(BackgroundImageOverlaySize, null)), /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "attachment" }, /* @__PURE__ */ React34.createElement(BackgroundImageOverlayAttachment, null)));
1594
+ };
1595
+ var deriveOverlayType = (type) => {
1596
+ if (type === "background-color-overlay") {
1597
+ return "color";
1598
+ }
1599
+ if (type === "background-image-overlay") {
1600
+ return "image";
1601
+ }
1602
+ throw new Error(`Invalid overlay type: ${type}`);
1462
1603
  };
1463
1604
 
1464
1605
  // src/controls/background-control/background-control.tsx
1465
1606
  var BackgroundControl = createControl(() => {
1466
1607
  const propContext = useBoundProp(backgroundPropTypeUtil);
1467
- return /* @__PURE__ */ React30.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React30.createElement(Stack12, { gap: 1.5 }, /* @__PURE__ */ React30.createElement(PropKeyProvider, { bind: "background-overlay" }, /* @__PURE__ */ React30.createElement(BackgroundOverlayRepeaterControl, null)), /* @__PURE__ */ React30.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React30.createElement(Grid9, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React30.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React30.createElement(ControlLabel, null, __13("Color", "elementor"))), /* @__PURE__ */ React30.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React30.createElement(ColorControl, null))))));
1608
+ return /* @__PURE__ */ React35.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React35.createElement(Stack12, { gap: 1.5 }, /* @__PURE__ */ React35.createElement(PropKeyProvider, { bind: "background-overlay" }, /* @__PURE__ */ React35.createElement(BackgroundOverlayRepeaterControl, null)), /* @__PURE__ */ React35.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React35.createElement(Grid14, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React35.createElement(Grid14, { item: true, xs: 6 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, __18("Color", "elementor"))), /* @__PURE__ */ React35.createElement(Grid14, { item: true, xs: 6 }, /* @__PURE__ */ React35.createElement(ColorControl, null))))));
1468
1609
  });
1469
1610
  export {
1470
1611
  AutocompleteControl,