@elementor/editor-controls 0.21.0 → 0.25.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 +56 -0
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +215 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +193 -88
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/bound-prop-context/prop-context.tsx +3 -0
- package/src/bound-prop-context/prop-key-context.tsx +3 -1
- package/src/bound-prop-context/use-bound-prop.ts +41 -2
- package/src/components/repeater.tsx +9 -6
- package/src/components/sortable.tsx +6 -6
- package/src/components/text-field-inner-selection.tsx +21 -5
- package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +12 -1
- package/src/controls/font-family-control/font-family-control.tsx +4 -0
- package/src/controls/link-control.tsx +95 -23
- package/src/controls/number-control.tsx +7 -0
- package/src/controls/size-control.tsx +25 -15
- package/src/controls/toggle-control.tsx +3 -3
package/dist/index.js
CHANGED
|
@@ -94,7 +94,8 @@ var PropProvider = ({
|
|
|
94
94
|
children,
|
|
95
95
|
value,
|
|
96
96
|
setValue,
|
|
97
|
-
propType
|
|
97
|
+
propType,
|
|
98
|
+
placeholder
|
|
98
99
|
}) => {
|
|
99
100
|
return /* @__PURE__ */ React.createElement(
|
|
100
101
|
PropContext.Provider,
|
|
@@ -102,7 +103,8 @@ var PropProvider = ({
|
|
|
102
103
|
value: {
|
|
103
104
|
value,
|
|
104
105
|
propType,
|
|
105
|
-
setValue
|
|
106
|
+
setValue,
|
|
107
|
+
placeholder
|
|
106
108
|
}
|
|
107
109
|
},
|
|
108
110
|
children
|
|
@@ -149,11 +151,12 @@ var ObjectPropKeyProvider = ({ children, bind }) => {
|
|
|
149
151
|
return context?.setValue(newValue, options, { ...meta, bind });
|
|
150
152
|
};
|
|
151
153
|
const value = context.value?.[bind];
|
|
154
|
+
const placeholder = context.placeholder?.[bind];
|
|
152
155
|
const propType = context.propType.shape[bind];
|
|
153
156
|
return /* @__PURE__ */ React2.createElement(
|
|
154
157
|
PropKeyContext.Provider,
|
|
155
158
|
{
|
|
156
|
-
value: { ...context, value, setValue, bind, propType, path: [...path ?? [], bind] }
|
|
159
|
+
value: { ...context, value, setValue, placeholder, bind, propType, path: [...path ?? [], bind] }
|
|
157
160
|
},
|
|
158
161
|
children
|
|
159
162
|
);
|
|
@@ -187,12 +190,17 @@ var usePropKeyContext = () => {
|
|
|
187
190
|
};
|
|
188
191
|
|
|
189
192
|
// src/bound-prop-context/use-bound-prop.ts
|
|
193
|
+
var import_react3 = require("react");
|
|
190
194
|
function useBoundProp(propTypeUtil) {
|
|
191
195
|
const propKeyContext = usePropKeyContext();
|
|
196
|
+
const { isValid, validate, restoreValue } = useValidation(propKeyContext.propType);
|
|
192
197
|
if (!propTypeUtil) {
|
|
193
198
|
return propKeyContext;
|
|
194
199
|
}
|
|
195
200
|
function setValue(value2, options, meta) {
|
|
201
|
+
if (!validate(value2)) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
196
204
|
if (value2 === null) {
|
|
197
205
|
return propKeyContext?.setValue(null, options, meta);
|
|
198
206
|
}
|
|
@@ -200,13 +208,34 @@ function useBoundProp(propTypeUtil) {
|
|
|
200
208
|
}
|
|
201
209
|
const propType = resolveUnionPropType(propKeyContext.propType, propTypeUtil.key);
|
|
202
210
|
const value = propTypeUtil.extract(propKeyContext.value ?? propType.default ?? null);
|
|
211
|
+
const placeholder = propTypeUtil.extract(propKeyContext.placeholder ?? null);
|
|
203
212
|
return {
|
|
204
213
|
...propKeyContext,
|
|
214
|
+
propType,
|
|
205
215
|
setValue,
|
|
206
|
-
value,
|
|
207
|
-
|
|
216
|
+
value: isValid ? value : null,
|
|
217
|
+
restoreValue,
|
|
218
|
+
placeholder
|
|
208
219
|
};
|
|
209
220
|
}
|
|
221
|
+
var useValidation = (propType) => {
|
|
222
|
+
const [isValid, setIsValid] = (0, import_react3.useState)(true);
|
|
223
|
+
const validate = (value) => {
|
|
224
|
+
let valid = true;
|
|
225
|
+
if (propType.settings.required && value === null) {
|
|
226
|
+
valid = false;
|
|
227
|
+
}
|
|
228
|
+
setIsValid(valid);
|
|
229
|
+
return valid;
|
|
230
|
+
};
|
|
231
|
+
const restoreValue = () => setIsValid(true);
|
|
232
|
+
return {
|
|
233
|
+
isValid,
|
|
234
|
+
setIsValid,
|
|
235
|
+
validate,
|
|
236
|
+
restoreValue
|
|
237
|
+
};
|
|
238
|
+
};
|
|
210
239
|
var resolveUnionPropType = (propType, key) => {
|
|
211
240
|
let resolvedPropType = propType;
|
|
212
241
|
if (propType.kind === "union") {
|
|
@@ -231,8 +260,8 @@ var import_ui2 = require("@elementor/ui");
|
|
|
231
260
|
|
|
232
261
|
// src/create-control-replacement.tsx
|
|
233
262
|
var React4 = __toESM(require("react"));
|
|
234
|
-
var
|
|
235
|
-
var ControlReplacementContext = (0,
|
|
263
|
+
var import_react4 = require("react");
|
|
264
|
+
var ControlReplacementContext = (0, import_react4.createContext)(void 0);
|
|
236
265
|
var ControlReplacementProvider = ({
|
|
237
266
|
component,
|
|
238
267
|
condition,
|
|
@@ -242,7 +271,7 @@ var ControlReplacementProvider = ({
|
|
|
242
271
|
};
|
|
243
272
|
var useControlReplacement = () => {
|
|
244
273
|
const { value } = useBoundProp();
|
|
245
|
-
const controlReplacement = (0,
|
|
274
|
+
const controlReplacement = (0, import_react4.useContext)(ControlReplacementContext);
|
|
246
275
|
let shouldReplace = false;
|
|
247
276
|
try {
|
|
248
277
|
shouldReplace = !!controlReplacement?.condition({ value }) && !!controlReplacement.component;
|
|
@@ -326,11 +355,11 @@ var import_ui3 = require("@elementor/ui");
|
|
|
326
355
|
|
|
327
356
|
// src/control-actions/control-actions-context.tsx
|
|
328
357
|
var React6 = __toESM(require("react"));
|
|
329
|
-
var
|
|
330
|
-
var Context = (0,
|
|
358
|
+
var import_react5 = require("react");
|
|
359
|
+
var Context = (0, import_react5.createContext)(null);
|
|
331
360
|
var ControlActionsProvider = ({ children, items }) => /* @__PURE__ */ React6.createElement(Context.Provider, { value: { items } }, children);
|
|
332
361
|
var useControlActions = () => {
|
|
333
|
-
const context = (0,
|
|
362
|
+
const context = (0, import_react5.useContext)(Context);
|
|
334
363
|
if (!context) {
|
|
335
364
|
throw new Error("useControlActions must be used within a ControlActionsProvider");
|
|
336
365
|
}
|
|
@@ -481,25 +510,36 @@ var import_ui10 = require("@elementor/ui");
|
|
|
481
510
|
|
|
482
511
|
// src/components/text-field-inner-selection.tsx
|
|
483
512
|
var React13 = __toESM(require("react"));
|
|
484
|
-
var
|
|
513
|
+
var import_react6 = require("react");
|
|
485
514
|
var import_editor_ui2 = require("@elementor/editor-ui");
|
|
486
515
|
var import_ui9 = require("@elementor/ui");
|
|
487
|
-
var TextFieldInnerSelection = (0,
|
|
488
|
-
({
|
|
516
|
+
var TextFieldInnerSelection = (0, import_react6.forwardRef)(
|
|
517
|
+
({
|
|
518
|
+
placeholder,
|
|
519
|
+
type,
|
|
520
|
+
value,
|
|
521
|
+
onChange,
|
|
522
|
+
onBlur,
|
|
523
|
+
onKeyDown,
|
|
524
|
+
endAdornment,
|
|
525
|
+
startAdornment
|
|
526
|
+
}, ref) => {
|
|
489
527
|
return /* @__PURE__ */ React13.createElement(
|
|
490
528
|
import_ui9.TextField,
|
|
491
529
|
{
|
|
530
|
+
ref,
|
|
492
531
|
size: "tiny",
|
|
493
532
|
fullWidth: true,
|
|
494
533
|
type,
|
|
495
534
|
value,
|
|
496
535
|
onChange,
|
|
536
|
+
onKeyDown,
|
|
537
|
+
onBlur,
|
|
497
538
|
placeholder,
|
|
498
539
|
InputProps: {
|
|
499
540
|
endAdornment,
|
|
500
541
|
startAdornment
|
|
501
|
-
}
|
|
502
|
-
ref
|
|
542
|
+
}
|
|
503
543
|
}
|
|
504
544
|
);
|
|
505
545
|
}
|
|
@@ -511,7 +551,7 @@ var SelectionEndAdornment = ({
|
|
|
511
551
|
}) => {
|
|
512
552
|
const popupState = (0, import_ui9.usePopupState)({
|
|
513
553
|
variant: "popover",
|
|
514
|
-
popupId: (0,
|
|
554
|
+
popupId: (0, import_react6.useId)()
|
|
515
555
|
});
|
|
516
556
|
const handleMenuItemClick = (index) => {
|
|
517
557
|
onClick(options[index]);
|
|
@@ -521,16 +561,16 @@ var SelectionEndAdornment = ({
|
|
|
521
561
|
import_ui9.Button,
|
|
522
562
|
{
|
|
523
563
|
size: "small",
|
|
524
|
-
color: "
|
|
525
|
-
sx: { font: "inherit", minWidth: "initial" },
|
|
564
|
+
color: "secondary",
|
|
565
|
+
sx: { font: "inherit", minWidth: "initial", textTransform: "uppercase" },
|
|
526
566
|
...(0, import_ui9.bindTrigger)(popupState)
|
|
527
567
|
},
|
|
528
|
-
value
|
|
568
|
+
value
|
|
529
569
|
), /* @__PURE__ */ React13.createElement(import_ui9.Menu, { MenuListProps: { dense: true }, ...(0, import_ui9.bindMenu)(popupState) }, options.map((option, index) => /* @__PURE__ */ React13.createElement(import_editor_ui2.MenuListItem, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
|
|
530
570
|
};
|
|
531
571
|
|
|
532
572
|
// src/hooks/use-sync-external-state.tsx
|
|
533
|
-
var
|
|
573
|
+
var import_react7 = require("react");
|
|
534
574
|
var useSyncExternalState = ({
|
|
535
575
|
external,
|
|
536
576
|
setExternal,
|
|
@@ -549,8 +589,8 @@ var useSyncExternalState = ({
|
|
|
549
589
|
}
|
|
550
590
|
return externalValue;
|
|
551
591
|
}
|
|
552
|
-
const [internal, setInternal] = (0,
|
|
553
|
-
(0,
|
|
592
|
+
const [internal, setInternal] = (0, import_react7.useState)(toInternal(external, null));
|
|
593
|
+
(0, import_react7.useEffect)(() => {
|
|
554
594
|
setInternal((prevInternal) => toInternal(external, prevInternal));
|
|
555
595
|
}, [external]);
|
|
556
596
|
const setInternalValue = (setter) => {
|
|
@@ -568,7 +608,7 @@ var defaultUnit = "px";
|
|
|
568
608
|
var defaultSize = NaN;
|
|
569
609
|
var SizeControl = createControl(
|
|
570
610
|
({ units: units2 = defaultUnits, extendedValues = [], placeholder, startIcon }) => {
|
|
571
|
-
const { value: sizeValue, setValue: setSizeValue } = useBoundProp(import_editor_props6.sizePropTypeUtil);
|
|
611
|
+
const { value: sizeValue, setValue: setSizeValue, restoreValue } = useBoundProp(import_editor_props6.sizePropTypeUtil);
|
|
572
612
|
const [state, setState] = useSyncExternalState({
|
|
573
613
|
external: sizeValue,
|
|
574
614
|
setExternal: setSizeValue,
|
|
@@ -588,20 +628,21 @@ var SizeControl = createControl(
|
|
|
588
628
|
size: size || size === "0" ? parseFloat(size) : defaultSize
|
|
589
629
|
}));
|
|
590
630
|
};
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
631
|
+
const Input = extendedValues?.length ? ExtendedSizeInput : SizeInput;
|
|
632
|
+
return /* @__PURE__ */ React14.createElement(
|
|
633
|
+
Input,
|
|
634
|
+
{
|
|
635
|
+
size: state.size,
|
|
636
|
+
unit: state.unit,
|
|
637
|
+
placeholder,
|
|
638
|
+
startIcon,
|
|
639
|
+
units: units2,
|
|
640
|
+
extendedValues,
|
|
641
|
+
handleSizeChange,
|
|
642
|
+
handleUnitChange,
|
|
643
|
+
onBlur: restoreValue
|
|
644
|
+
}
|
|
645
|
+
);
|
|
605
646
|
}
|
|
606
647
|
);
|
|
607
648
|
var ExtendedSizeInput = (props) => {
|
|
@@ -625,12 +666,14 @@ var ExtendedSizeInput = (props) => {
|
|
|
625
666
|
}
|
|
626
667
|
);
|
|
627
668
|
};
|
|
669
|
+
var RESTRICTED_INPUT_KEYS = ["e", "E", "+", "-"];
|
|
628
670
|
var SizeInput = ({
|
|
629
671
|
units: units2,
|
|
630
672
|
handleUnitChange,
|
|
631
673
|
handleSizeChange,
|
|
632
674
|
placeholder,
|
|
633
675
|
startIcon,
|
|
676
|
+
onBlur,
|
|
634
677
|
size,
|
|
635
678
|
unit
|
|
636
679
|
}) => {
|
|
@@ -649,7 +692,13 @@ var SizeInput = ({
|
|
|
649
692
|
startAdornment: startIcon ? /* @__PURE__ */ React14.createElement(import_ui10.InputAdornment, { position: "start" }, startIcon) : void 0,
|
|
650
693
|
type: "number",
|
|
651
694
|
value: Number.isNaN(size) ? "" : size,
|
|
652
|
-
onChange: handleSizeChange
|
|
695
|
+
onChange: handleSizeChange,
|
|
696
|
+
onBlur,
|
|
697
|
+
onKeyDown: (event) => {
|
|
698
|
+
if (RESTRICTED_INPUT_KEYS.includes(event.key)) {
|
|
699
|
+
event.preventDefault();
|
|
700
|
+
}
|
|
701
|
+
}
|
|
653
702
|
}
|
|
654
703
|
));
|
|
655
704
|
};
|
|
@@ -708,7 +757,7 @@ var PopoverGridContainer = ({
|
|
|
708
757
|
|
|
709
758
|
// src/components/repeater.tsx
|
|
710
759
|
var React23 = __toESM(require("react"));
|
|
711
|
-
var
|
|
760
|
+
var import_react9 = require("react");
|
|
712
761
|
var import_icons3 = require("@elementor/icons");
|
|
713
762
|
var import_ui17 = require("@elementor/ui");
|
|
714
763
|
var import_i18n4 = require("@wordpress/i18n");
|
|
@@ -718,11 +767,11 @@ var React21 = __toESM(require("react"));
|
|
|
718
767
|
|
|
719
768
|
// src/control-adornments/control-adornments-context.tsx
|
|
720
769
|
var React20 = __toESM(require("react"));
|
|
721
|
-
var
|
|
722
|
-
var Context2 = (0,
|
|
770
|
+
var import_react8 = require("react");
|
|
771
|
+
var Context2 = (0, import_react8.createContext)(null);
|
|
723
772
|
var ControlAdornmentsProvider = ({ children, items }) => /* @__PURE__ */ React20.createElement(Context2.Provider, { value: { items } }, children);
|
|
724
773
|
var useControlAdornments = () => {
|
|
725
|
-
const context = (0,
|
|
774
|
+
const context = (0, import_react8.useContext)(Context2);
|
|
726
775
|
return context?.items ?? [];
|
|
727
776
|
};
|
|
728
777
|
|
|
@@ -752,21 +801,10 @@ var SortableItem = ({ id, children }) => {
|
|
|
752
801
|
triggerProps,
|
|
753
802
|
itemStyle,
|
|
754
803
|
triggerStyle,
|
|
755
|
-
isDragOverlay,
|
|
756
804
|
showDropIndication,
|
|
757
805
|
dropIndicationStyle
|
|
758
806
|
}) => {
|
|
759
|
-
return /* @__PURE__ */ React22.createElement(
|
|
760
|
-
StyledListItem,
|
|
761
|
-
{
|
|
762
|
-
...itemProps,
|
|
763
|
-
style: itemStyle,
|
|
764
|
-
sx: { backgroundColor: isDragOverlay ? "background.paper" : void 0 }
|
|
765
|
-
},
|
|
766
|
-
/* @__PURE__ */ React22.createElement(SortableTrigger, { ...triggerProps, style: triggerStyle }),
|
|
767
|
-
children,
|
|
768
|
-
showDropIndication && /* @__PURE__ */ React22.createElement(StyledDivider, { style: dropIndicationStyle })
|
|
769
|
-
);
|
|
807
|
+
return /* @__PURE__ */ React22.createElement(StyledListItem, { ...itemProps, style: itemStyle }, /* @__PURE__ */ React22.createElement(SortableTrigger, { ...triggerProps, style: triggerStyle }), children, showDropIndication && /* @__PURE__ */ React22.createElement(StyledDivider, { style: dropIndicationStyle }));
|
|
770
808
|
}
|
|
771
809
|
}
|
|
772
810
|
);
|
|
@@ -789,6 +827,11 @@ var StyledListItem = (0, import_ui16.styled)(import_ui16.ListItem)`
|
|
|
789
827
|
transform: translate( -75%, -50% );
|
|
790
828
|
}
|
|
791
829
|
|
|
830
|
+
&[aria-describedby=''] > .MuiTag-root {
|
|
831
|
+
background-color: ${({ theme }) => theme.palette.background.paper};
|
|
832
|
+
box-shadow: ${({ theme }) => theme.shadows[3]};
|
|
833
|
+
}
|
|
834
|
+
|
|
792
835
|
&:hover {
|
|
793
836
|
& .class-item-sortable-trigger {
|
|
794
837
|
visibility: visible;
|
|
@@ -815,6 +858,7 @@ var StyledDivider = (0, import_ui16.styled)(import_ui16.Divider)`
|
|
|
815
858
|
|
|
816
859
|
// src/components/repeater.tsx
|
|
817
860
|
var SIZE = "tiny";
|
|
861
|
+
var EMPTY_OPEN_ITEM = -1;
|
|
818
862
|
var Repeater = ({
|
|
819
863
|
label,
|
|
820
864
|
itemSettings,
|
|
@@ -823,14 +867,14 @@ var Repeater = ({
|
|
|
823
867
|
values: repeaterValues = [],
|
|
824
868
|
setValues: setRepeaterValues
|
|
825
869
|
}) => {
|
|
826
|
-
const [openItem, setOpenItem] = (0,
|
|
870
|
+
const [openItem, setOpenItem] = (0, import_react9.useState)(EMPTY_OPEN_ITEM);
|
|
827
871
|
const [items, setItems] = useSyncExternalState({
|
|
828
872
|
external: repeaterValues,
|
|
829
873
|
// @ts-expect-error - as long as persistWhen => true, value will never be null
|
|
830
874
|
setExternal: setRepeaterValues,
|
|
831
875
|
persistWhen: () => true
|
|
832
876
|
});
|
|
833
|
-
const [uniqueKeys, setUniqueKeys] = (0,
|
|
877
|
+
const [uniqueKeys, setUniqueKeys] = (0, import_react9.useState)(items.map((_, index) => index));
|
|
834
878
|
const generateNextKey = (source) => {
|
|
835
879
|
return 1 + Math.max(0, ...source);
|
|
836
880
|
};
|
|
@@ -904,14 +948,14 @@ var Repeater = ({
|
|
|
904
948
|
return /* @__PURE__ */ React23.createElement(SortableItem, { id: key, key: `sortable-${key}` }, /* @__PURE__ */ React23.createElement(
|
|
905
949
|
RepeaterItem,
|
|
906
950
|
{
|
|
907
|
-
bind: String(index),
|
|
908
951
|
disabled: value?.disabled,
|
|
909
952
|
label: /* @__PURE__ */ React23.createElement(itemSettings.Label, { value }),
|
|
910
953
|
startIcon: /* @__PURE__ */ React23.createElement(itemSettings.Icon, { value }),
|
|
911
954
|
removeItem: () => removeRepeaterItem(index),
|
|
912
955
|
duplicateItem: () => duplicateRepeaterItem(index),
|
|
913
956
|
toggleDisableItem: () => toggleDisableRepeaterItem(index),
|
|
914
|
-
openOnMount: openOnAdd && openItem === key
|
|
957
|
+
openOnMount: openOnAdd && openItem === key,
|
|
958
|
+
onOpen: () => setOpenItem(EMPTY_OPEN_ITEM)
|
|
915
959
|
},
|
|
916
960
|
(props) => /* @__PURE__ */ React23.createElement(itemSettings.Content, { ...props, value, bind: String(index) })
|
|
917
961
|
));
|
|
@@ -925,10 +969,11 @@ var RepeaterItem = ({
|
|
|
925
969
|
removeItem,
|
|
926
970
|
duplicateItem,
|
|
927
971
|
toggleDisableItem,
|
|
928
|
-
openOnMount
|
|
972
|
+
openOnMount,
|
|
973
|
+
onOpen
|
|
929
974
|
}) => {
|
|
930
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
931
|
-
const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount);
|
|
975
|
+
const [anchorEl, setAnchorEl] = (0, import_react9.useState)(null);
|
|
976
|
+
const { popoverState, popoverProps, ref, setRef } = usePopover(openOnMount, onOpen);
|
|
932
977
|
const duplicateLabel = (0, import_i18n4.__)("Duplicate", "elementor");
|
|
933
978
|
const toggleLabel = disabled ? (0, import_i18n4.__)("Show", "elementor") : (0, import_i18n4.__)("Hide", "elementor");
|
|
934
979
|
const removeLabel = (0, import_i18n4.__)("Remove", "elementor");
|
|
@@ -943,8 +988,7 @@ var RepeaterItem = ({
|
|
|
943
988
|
"aria-label": (0, import_i18n4.__)("Open item", "elementor"),
|
|
944
989
|
...(0, import_ui17.bindTrigger)(popoverState),
|
|
945
990
|
startIcon,
|
|
946
|
-
actions: /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(import_ui17.Tooltip, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React23.createElement(import_ui17.IconButton, { size: SIZE, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React23.createElement(import_icons3.CopyIcon, { fontSize: SIZE }))), /* @__PURE__ */ React23.createElement(import_ui17.Tooltip, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React23.createElement(import_ui17.IconButton, { size: SIZE, onClick: toggleDisableItem, "aria-label": toggleLabel }, disabled ? /* @__PURE__ */ React23.createElement(import_icons3.EyeOffIcon, { fontSize: SIZE }) : /* @__PURE__ */ React23.createElement(import_icons3.EyeIcon, { fontSize: SIZE }))), /* @__PURE__ */ React23.createElement(import_ui17.Tooltip, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React23.createElement(import_ui17.IconButton, { size: SIZE, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React23.createElement(import_icons3.XIcon, { fontSize: SIZE }))))
|
|
947
|
-
sx: { backgroundColor: "background.paper" }
|
|
991
|
+
actions: /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(import_ui17.Tooltip, { title: duplicateLabel, placement: "top" }, /* @__PURE__ */ React23.createElement(import_ui17.IconButton, { size: SIZE, onClick: duplicateItem, "aria-label": duplicateLabel }, /* @__PURE__ */ React23.createElement(import_icons3.CopyIcon, { fontSize: SIZE }))), /* @__PURE__ */ React23.createElement(import_ui17.Tooltip, { title: toggleLabel, placement: "top" }, /* @__PURE__ */ React23.createElement(import_ui17.IconButton, { size: SIZE, onClick: toggleDisableItem, "aria-label": toggleLabel }, disabled ? /* @__PURE__ */ React23.createElement(import_icons3.EyeOffIcon, { fontSize: SIZE }) : /* @__PURE__ */ React23.createElement(import_icons3.EyeIcon, { fontSize: SIZE }))), /* @__PURE__ */ React23.createElement(import_ui17.Tooltip, { title: removeLabel, placement: "top" }, /* @__PURE__ */ React23.createElement(import_ui17.IconButton, { size: SIZE, onClick: removeItem, "aria-label": removeLabel }, /* @__PURE__ */ React23.createElement(import_icons3.XIcon, { fontSize: SIZE }))))
|
|
948
992
|
}
|
|
949
993
|
), /* @__PURE__ */ React23.createElement(
|
|
950
994
|
import_ui17.Popover,
|
|
@@ -963,13 +1007,14 @@ var RepeaterItem = ({
|
|
|
963
1007
|
/* @__PURE__ */ React23.createElement(import_ui17.Box, null, children({ anchorEl }))
|
|
964
1008
|
));
|
|
965
1009
|
};
|
|
966
|
-
var usePopover = (openOnMount) => {
|
|
967
|
-
const [ref, setRef] = (0,
|
|
1010
|
+
var usePopover = (openOnMount, onOpen) => {
|
|
1011
|
+
const [ref, setRef] = (0, import_react9.useState)(null);
|
|
968
1012
|
const popoverState = (0, import_ui17.usePopupState)({ variant: "popover" });
|
|
969
1013
|
const popoverProps = (0, import_ui17.bindPopover)(popoverState);
|
|
970
|
-
(0,
|
|
1014
|
+
(0, import_react9.useEffect)(() => {
|
|
971
1015
|
if (openOnMount && ref) {
|
|
972
1016
|
popoverState.open(ref);
|
|
1017
|
+
onOpen?.();
|
|
973
1018
|
}
|
|
974
1019
|
}, [ref]);
|
|
975
1020
|
return {
|
|
@@ -1141,7 +1186,7 @@ var ToggleControl = createControl(
|
|
|
1141
1186
|
size = "tiny",
|
|
1142
1187
|
exclusive = true
|
|
1143
1188
|
}) => {
|
|
1144
|
-
const { value, setValue } = useBoundProp(import_editor_props10.stringPropTypeUtil);
|
|
1189
|
+
const { value, setValue, placeholder } = useBoundProp(import_editor_props10.stringPropTypeUtil);
|
|
1145
1190
|
const exclusiveValues = options.filter((option) => option.exclusive).map((option) => option.value);
|
|
1146
1191
|
const handleNonExclusiveToggle = (selectedValues) => {
|
|
1147
1192
|
const newSelectedValue = selectedValues[selectedValues.length - 1];
|
|
@@ -1158,7 +1203,7 @@ var ToggleControl = createControl(
|
|
|
1158
1203
|
ControlToggleButtonGroup,
|
|
1159
1204
|
{
|
|
1160
1205
|
...toggleButtonGroupProps,
|
|
1161
|
-
value: value ?? null,
|
|
1206
|
+
value: value ?? placeholder ?? null,
|
|
1162
1207
|
onChange: setValue,
|
|
1163
1208
|
exclusive: true
|
|
1164
1209
|
}
|
|
@@ -1166,7 +1211,7 @@ var ToggleControl = createControl(
|
|
|
1166
1211
|
ControlToggleButtonGroup,
|
|
1167
1212
|
{
|
|
1168
1213
|
...toggleButtonGroupProps,
|
|
1169
|
-
value: value?.split(" ") ?? [],
|
|
1214
|
+
value: (value ?? placeholder)?.split(" ") ?? [],
|
|
1170
1215
|
onChange: handleNonExclusiveToggle,
|
|
1171
1216
|
exclusive: false
|
|
1172
1217
|
}
|
|
@@ -1179,6 +1224,7 @@ var React27 = __toESM(require("react"));
|
|
|
1179
1224
|
var import_editor_props11 = require("@elementor/editor-props");
|
|
1180
1225
|
var import_ui20 = require("@elementor/ui");
|
|
1181
1226
|
var isEmptyOrNaN = (value) => value === null || value === void 0 || value === "" || Number.isNaN(Number(value));
|
|
1227
|
+
var RESTRICTED_INPUT_KEYS2 = ["e", "E", "+", "-"];
|
|
1182
1228
|
var NumberControl = createControl(
|
|
1183
1229
|
({
|
|
1184
1230
|
placeholder,
|
|
@@ -1206,7 +1252,12 @@ var NumberControl = createControl(
|
|
|
1206
1252
|
value: isEmptyOrNaN(value) ? "" : value,
|
|
1207
1253
|
onChange: handleChange,
|
|
1208
1254
|
placeholder,
|
|
1209
|
-
inputProps: { step }
|
|
1255
|
+
inputProps: { step },
|
|
1256
|
+
onKeyDown: (event) => {
|
|
1257
|
+
if (RESTRICTED_INPUT_KEYS2.includes(event.key)) {
|
|
1258
|
+
event.preventDefault();
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1210
1261
|
}
|
|
1211
1262
|
));
|
|
1212
1263
|
}
|
|
@@ -1214,7 +1265,7 @@ var NumberControl = createControl(
|
|
|
1214
1265
|
|
|
1215
1266
|
// src/controls/equal-unequal-sizes-control.tsx
|
|
1216
1267
|
var React29 = __toESM(require("react"));
|
|
1217
|
-
var
|
|
1268
|
+
var import_react10 = require("react");
|
|
1218
1269
|
var import_editor_props12 = require("@elementor/editor-props");
|
|
1219
1270
|
var import_ui22 = require("@elementor/ui");
|
|
1220
1271
|
var import_i18n6 = require("@wordpress/i18n");
|
|
@@ -1244,8 +1295,8 @@ function EqualUnequalSizesControl({
|
|
|
1244
1295
|
items,
|
|
1245
1296
|
multiSizePropTypeUtil
|
|
1246
1297
|
}) {
|
|
1247
|
-
const popupId = (0,
|
|
1248
|
-
const controlRef = (0,
|
|
1298
|
+
const popupId = (0, import_react10.useId)();
|
|
1299
|
+
const controlRef = (0, import_react10.useRef)(null);
|
|
1249
1300
|
const popupState = (0, import_ui22.usePopupState)({ variant: "popover", popupId });
|
|
1250
1301
|
const {
|
|
1251
1302
|
propType: multiSizePropType,
|
|
@@ -1411,7 +1462,7 @@ var Control3 = ({
|
|
|
1411
1462
|
|
|
1412
1463
|
// src/controls/font-family-control/font-family-control.tsx
|
|
1413
1464
|
var React31 = __toESM(require("react"));
|
|
1414
|
-
var
|
|
1465
|
+
var import_react11 = require("react");
|
|
1415
1466
|
var import_editor_props14 = require("@elementor/editor-props");
|
|
1416
1467
|
var import_icons5 = require("@elementor/icons");
|
|
1417
1468
|
var import_ui24 = require("@elementor/ui");
|
|
@@ -1444,7 +1495,7 @@ var enqueueFont = (fontFamily, context = "editor") => {
|
|
|
1444
1495
|
// src/controls/font-family-control/font-family-control.tsx
|
|
1445
1496
|
var SIZE2 = "tiny";
|
|
1446
1497
|
var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
1447
|
-
const [searchValue, setSearchValue] = (0,
|
|
1498
|
+
const [searchValue, setSearchValue] = (0, import_react11.useState)("");
|
|
1448
1499
|
const { value: fontFamily, setValue: setFontFamily } = useBoundProp(import_editor_props14.stringPropTypeUtil);
|
|
1449
1500
|
const popoverState = (0, import_ui24.usePopupState)({ variant: "popover" });
|
|
1450
1501
|
const filteredFontFamilies = useFilteredFontFamilies(fontFamilies, searchValue);
|
|
@@ -1476,6 +1527,7 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1476
1527
|
/* @__PURE__ */ React31.createElement(import_ui24.Stack, null, /* @__PURE__ */ React31.createElement(import_ui24.Stack, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React31.createElement(import_icons5.TextIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React31.createElement(import_ui24.Typography, { variant: "subtitle2" }, (0, import_i18n8.__)("Font Family", "elementor")), /* @__PURE__ */ React31.createElement(import_ui24.IconButton, { size: SIZE2, sx: { ml: "auto" }, onClick: handleClose }, /* @__PURE__ */ React31.createElement(import_icons5.XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React31.createElement(import_ui24.Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React31.createElement(
|
|
1477
1528
|
import_ui24.TextField,
|
|
1478
1529
|
{
|
|
1530
|
+
autoFocus: true,
|
|
1479
1531
|
fullWidth: true,
|
|
1480
1532
|
size: SIZE2,
|
|
1481
1533
|
value: searchValue,
|
|
@@ -1528,7 +1580,7 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1528
1580
|
var LIST_ITEM_HEIGHT = 36;
|
|
1529
1581
|
var LIST_ITEMS_BUFFER = 6;
|
|
1530
1582
|
var FontList = ({ fontListItems, setFontFamily, handleClose, fontFamily }) => {
|
|
1531
|
-
const containerRef = (0,
|
|
1583
|
+
const containerRef = (0, import_react11.useRef)(null);
|
|
1532
1584
|
const selectedItem = fontListItems.find((item) => item.value === fontFamily);
|
|
1533
1585
|
const debouncedVirtualizeChange = useDebounce(({ getVirtualIndexes }) => {
|
|
1534
1586
|
getVirtualIndexes().forEach((index) => {
|
|
@@ -1545,7 +1597,7 @@ var FontList = ({ fontListItems, setFontFamily, handleClose, fontFamily }) => {
|
|
|
1545
1597
|
overscan: LIST_ITEMS_BUFFER,
|
|
1546
1598
|
onChange: debouncedVirtualizeChange
|
|
1547
1599
|
});
|
|
1548
|
-
(0,
|
|
1600
|
+
(0, import_react11.useEffect)(
|
|
1549
1601
|
() => {
|
|
1550
1602
|
virtualizer.scrollToIndex(fontListItems.findIndex((item) => item.value === fontFamily));
|
|
1551
1603
|
},
|
|
@@ -1632,7 +1684,9 @@ var StyledMenuList = (0, import_ui24.styled)(import_ui24.MenuList)(({ theme }) =
|
|
|
1632
1684
|
position: "absolute",
|
|
1633
1685
|
top: 0,
|
|
1634
1686
|
left: 0,
|
|
1635
|
-
width: "100%"
|
|
1687
|
+
width: "100%",
|
|
1688
|
+
display: "flex",
|
|
1689
|
+
alignItems: "center"
|
|
1636
1690
|
},
|
|
1637
1691
|
'& > [role="option"]': {
|
|
1638
1692
|
...theme.typography.caption,
|
|
@@ -1651,8 +1705,8 @@ var StyledMenuList = (0, import_ui24.styled)(import_ui24.MenuList)(({ theme }) =
|
|
|
1651
1705
|
position: "relative"
|
|
1652
1706
|
}));
|
|
1653
1707
|
var useDebounce = (fn, delay) => {
|
|
1654
|
-
const [debouncedFn] = (0,
|
|
1655
|
-
(0,
|
|
1708
|
+
const [debouncedFn] = (0, import_react11.useState)(() => (0, import_utils2.debounce)(fn, delay));
|
|
1709
|
+
(0, import_react11.useEffect)(() => () => debouncedFn.cancel(), [debouncedFn]);
|
|
1656
1710
|
return debouncedFn;
|
|
1657
1711
|
};
|
|
1658
1712
|
|
|
@@ -1677,9 +1731,10 @@ var UrlControl = createControl(({ placeholder }) => {
|
|
|
1677
1731
|
|
|
1678
1732
|
// src/controls/link-control.tsx
|
|
1679
1733
|
var React34 = __toESM(require("react"));
|
|
1680
|
-
var
|
|
1734
|
+
var import_react13 = require("react");
|
|
1681
1735
|
var import_editor_elements = require("@elementor/editor-elements");
|
|
1682
1736
|
var import_editor_props16 = require("@elementor/editor-props");
|
|
1737
|
+
var import_editor_ui3 = require("@elementor/editor-ui");
|
|
1683
1738
|
var import_http2 = require("@elementor/http");
|
|
1684
1739
|
var import_icons7 = require("@elementor/icons");
|
|
1685
1740
|
var import_session = require("@elementor/session");
|
|
@@ -1689,10 +1744,10 @@ var import_i18n9 = require("@wordpress/i18n");
|
|
|
1689
1744
|
|
|
1690
1745
|
// src/components/autocomplete.tsx
|
|
1691
1746
|
var React33 = __toESM(require("react"));
|
|
1692
|
-
var
|
|
1747
|
+
var import_react12 = require("react");
|
|
1693
1748
|
var import_icons6 = require("@elementor/icons");
|
|
1694
1749
|
var import_ui26 = require("@elementor/ui");
|
|
1695
|
-
var Autocomplete = (0,
|
|
1750
|
+
var Autocomplete = (0, import_react12.forwardRef)((props, ref) => {
|
|
1696
1751
|
const {
|
|
1697
1752
|
options,
|
|
1698
1753
|
onOptionChange,
|
|
@@ -1795,10 +1850,14 @@ function _factoryFilter(newValue, options, minInputLength) {
|
|
|
1795
1850
|
|
|
1796
1851
|
// src/controls/link-control.tsx
|
|
1797
1852
|
var SIZE3 = "tiny";
|
|
1853
|
+
var learnMoreButton = {
|
|
1854
|
+
label: (0, import_i18n9.__)("Learn More", "elementor"),
|
|
1855
|
+
href: "https://go.elementor.com/element-link-inside-link-infotip"
|
|
1856
|
+
};
|
|
1798
1857
|
var LinkControl = createControl((props) => {
|
|
1799
1858
|
const { value, path, setValue, ...propContext } = useBoundProp(import_editor_props16.linkPropTypeUtil);
|
|
1800
1859
|
const [linkSessionValue, setLinkSessionValue] = (0, import_session.useSessionStorage)(path.join("/"));
|
|
1801
|
-
const [
|
|
1860
|
+
const [isActive, setIsActive] = (0, import_react13.useState)(!!value);
|
|
1802
1861
|
const {
|
|
1803
1862
|
allowCustomValues,
|
|
1804
1863
|
queryOptions: { endpoint = "", requestParams = {} },
|
|
@@ -1806,17 +1865,19 @@ var LinkControl = createControl((props) => {
|
|
|
1806
1865
|
minInputLength = 2,
|
|
1807
1866
|
context: { elementId }
|
|
1808
1867
|
} = props || {};
|
|
1809
|
-
const [
|
|
1868
|
+
const [linkInLinkRestriction, setLinkInLinkRestriction] = (0, import_react13.useState)((0, import_editor_elements.getLinkInLinkRestriction)(elementId));
|
|
1869
|
+
const [options, setOptions] = (0, import_react13.useState)(
|
|
1810
1870
|
generateFirstLoadedOption(value)
|
|
1811
1871
|
);
|
|
1872
|
+
const shouldDisableAddingLink = !isActive && linkInLinkRestriction.shouldRestrict;
|
|
1812
1873
|
const onEnabledChange = () => {
|
|
1813
|
-
|
|
1814
|
-
if (shouldRestrict && !
|
|
1874
|
+
setLinkInLinkRestriction((0, import_editor_elements.getLinkInLinkRestriction)(elementId));
|
|
1875
|
+
if (linkInLinkRestriction.shouldRestrict && !isActive) {
|
|
1815
1876
|
return;
|
|
1816
1877
|
}
|
|
1817
|
-
|
|
1818
|
-
setValue(
|
|
1819
|
-
setLinkSessionValue({ value, meta: { isEnabled: !
|
|
1878
|
+
setIsActive((prevState) => !prevState);
|
|
1879
|
+
setValue(isActive ? null : linkSessionValue?.value ?? null);
|
|
1880
|
+
setLinkSessionValue({ value, meta: { isEnabled: !isActive } });
|
|
1820
1881
|
};
|
|
1821
1882
|
const onOptionChange = (newValue) => {
|
|
1822
1883
|
const valueToSave = newValue ? {
|
|
@@ -1847,7 +1908,7 @@ var LinkControl = createControl((props) => {
|
|
|
1847
1908
|
}
|
|
1848
1909
|
debounceFetch({ ...requestParams, term: newValue });
|
|
1849
1910
|
};
|
|
1850
|
-
const debounceFetch = (0,
|
|
1911
|
+
const debounceFetch = (0, import_react13.useMemo)(
|
|
1851
1912
|
() => (0, import_utils3.debounce)(
|
|
1852
1913
|
(params) => fetchOptions(endpoint, params).then((newOptions) => {
|
|
1853
1914
|
setOptions(formatOptions(newOptions));
|
|
@@ -1866,15 +1927,16 @@ var LinkControl = createControl((props) => {
|
|
|
1866
1927
|
}
|
|
1867
1928
|
},
|
|
1868
1929
|
/* @__PURE__ */ React34.createElement(ControlFormLabel, null, (0, import_i18n9.__)("Link", "elementor")),
|
|
1869
|
-
/* @__PURE__ */ React34.createElement(
|
|
1930
|
+
/* @__PURE__ */ React34.createElement(ConditionalInfoTip, { isVisible: !isActive, linkInLinkRestriction }, /* @__PURE__ */ React34.createElement(
|
|
1870
1931
|
ToggleIconControl,
|
|
1871
1932
|
{
|
|
1872
|
-
|
|
1933
|
+
disabled: shouldDisableAddingLink,
|
|
1934
|
+
active: isActive,
|
|
1873
1935
|
onIconClick: onEnabledChange,
|
|
1874
1936
|
label: (0, import_i18n9.__)("Toggle link", "elementor")
|
|
1875
1937
|
}
|
|
1876
|
-
)
|
|
1877
|
-
), /* @__PURE__ */ React34.createElement(import_ui27.Collapse, { in:
|
|
1938
|
+
))
|
|
1939
|
+
), /* @__PURE__ */ React34.createElement(import_ui27.Collapse, { in: isActive, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React34.createElement(import_ui27.Stack, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "destination" }, /* @__PURE__ */ React34.createElement(ControlActions, null, /* @__PURE__ */ React34.createElement(
|
|
1878
1940
|
Autocomplete,
|
|
1879
1941
|
{
|
|
1880
1942
|
options,
|
|
@@ -1885,17 +1947,22 @@ var LinkControl = createControl((props) => {
|
|
|
1885
1947
|
onTextChange,
|
|
1886
1948
|
minInputLength
|
|
1887
1949
|
}
|
|
1888
|
-
))), /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "isTargetBlank" }, /* @__PURE__ */ React34.createElement(SwitchControl,
|
|
1950
|
+
))), /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "isTargetBlank" }, /* @__PURE__ */ React34.createElement(SwitchControl, { disabled: !value }))))));
|
|
1889
1951
|
});
|
|
1890
|
-
var ToggleIconControl = ({
|
|
1891
|
-
return /* @__PURE__ */ React34.createElement(import_ui27.IconButton, { size: SIZE3, onClick: onIconClick, "aria-label": label },
|
|
1952
|
+
var ToggleIconControl = ({ disabled, active, onIconClick, label }) => {
|
|
1953
|
+
return /* @__PURE__ */ React34.createElement(import_ui27.IconButton, { size: SIZE3, onClick: onIconClick, "aria-label": label, disabled }, active ? /* @__PURE__ */ React34.createElement(import_icons7.MinusIcon, { fontSize: SIZE3 }) : /* @__PURE__ */ React34.createElement(import_icons7.PlusIcon, { fontSize: SIZE3 }));
|
|
1892
1954
|
};
|
|
1893
|
-
var SwitchControl = () => {
|
|
1955
|
+
var SwitchControl = ({ disabled }) => {
|
|
1894
1956
|
const { value = false, setValue } = useBoundProp(import_editor_props16.booleanPropTypeUtil);
|
|
1895
1957
|
const onClick = () => {
|
|
1896
1958
|
setValue(!value);
|
|
1897
1959
|
};
|
|
1898
|
-
|
|
1960
|
+
const inputProps = disabled ? {
|
|
1961
|
+
style: {
|
|
1962
|
+
opacity: 0
|
|
1963
|
+
}
|
|
1964
|
+
} : {};
|
|
1965
|
+
return /* @__PURE__ */ React34.createElement(import_ui27.Grid, { container: true, alignItems: "center", flexWrap: "nowrap", justifyContent: "space-between" }, /* @__PURE__ */ React34.createElement(import_ui27.Grid, { item: true }, /* @__PURE__ */ React34.createElement(ControlFormLabel, null, (0, import_i18n9.__)("Open in a new tab", "elementor"))), /* @__PURE__ */ React34.createElement(import_ui27.Grid, { item: true }, /* @__PURE__ */ React34.createElement(import_ui27.Switch, { checked: value, onClick, disabled, inputProps })));
|
|
1899
1966
|
};
|
|
1900
1967
|
async function fetchOptions(ajaxUrl, params) {
|
|
1901
1968
|
if (!params || !ajaxUrl) {
|
|
@@ -1925,6 +1992,37 @@ function generateFirstLoadedOption(unionValue) {
|
|
|
1925
1992
|
}
|
|
1926
1993
|
] : [];
|
|
1927
1994
|
}
|
|
1995
|
+
var ConditionalInfoTip = ({ linkInLinkRestriction, isVisible, children }) => {
|
|
1996
|
+
const { shouldRestrict, reason, elementId } = linkInLinkRestriction;
|
|
1997
|
+
const handleTakeMeClick = () => {
|
|
1998
|
+
if (elementId) {
|
|
1999
|
+
(0, import_editor_elements.selectElement)(elementId);
|
|
2000
|
+
}
|
|
2001
|
+
};
|
|
2002
|
+
return shouldRestrict && isVisible ? /* @__PURE__ */ React34.createElement(
|
|
2003
|
+
import_ui27.Infotip,
|
|
2004
|
+
{
|
|
2005
|
+
placement: "right",
|
|
2006
|
+
content: /* @__PURE__ */ React34.createElement(
|
|
2007
|
+
import_editor_ui3.InfoTipCard,
|
|
2008
|
+
{
|
|
2009
|
+
content: INFOTIP_CONTENT[reason],
|
|
2010
|
+
svgIcon: /* @__PURE__ */ React34.createElement(import_icons7.AlertTriangleIcon, null),
|
|
2011
|
+
learnMoreButton,
|
|
2012
|
+
ctaButton: {
|
|
2013
|
+
label: (0, import_i18n9.__)("Take me there", "elementor"),
|
|
2014
|
+
onClick: handleTakeMeClick
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
)
|
|
2018
|
+
},
|
|
2019
|
+
/* @__PURE__ */ React34.createElement(import_ui27.Box, null, children)
|
|
2020
|
+
) : /* @__PURE__ */ React34.createElement(React34.Fragment, null, children);
|
|
2021
|
+
};
|
|
2022
|
+
var INFOTIP_CONTENT = {
|
|
2023
|
+
descendant: /* @__PURE__ */ React34.createElement(React34.Fragment, null, (0, import_i18n9.__)("To add a link to this container,", "elementor"), /* @__PURE__ */ React34.createElement("br", null), (0, import_i18n9.__)("first remove the link from the elements inside of it.", "elementor")),
|
|
2024
|
+
ancestor: /* @__PURE__ */ React34.createElement(React34.Fragment, null, (0, import_i18n9.__)("To add a link to this element,", "elementor"), /* @__PURE__ */ React34.createElement("br", null), (0, import_i18n9.__)("first remove the link from its parent container.", "elementor"))
|
|
2025
|
+
};
|
|
1928
2026
|
|
|
1929
2027
|
// src/controls/gap-control.tsx
|
|
1930
2028
|
var React35 = __toESM(require("react"));
|
|
@@ -1977,7 +2075,7 @@ var Control4 = ({ bind, isLinked }) => {
|
|
|
1977
2075
|
|
|
1978
2076
|
// src/controls/svg-media-control.tsx
|
|
1979
2077
|
var React37 = __toESM(require("react"));
|
|
1980
|
-
var
|
|
2078
|
+
var import_react15 = require("react");
|
|
1981
2079
|
var import_editor_props18 = require("@elementor/editor-props");
|
|
1982
2080
|
var import_icons9 = require("@elementor/icons");
|
|
1983
2081
|
var import_ui30 = require("@elementor/ui");
|
|
@@ -1986,7 +2084,7 @@ var import_i18n12 = require("@wordpress/i18n");
|
|
|
1986
2084
|
|
|
1987
2085
|
// src/components/enable-unfiltered-modal.tsx
|
|
1988
2086
|
var React36 = __toESM(require("react"));
|
|
1989
|
-
var
|
|
2087
|
+
var import_react14 = require("react");
|
|
1990
2088
|
var import_editor_current_user = require("@elementor/editor-current-user");
|
|
1991
2089
|
var import_ui29 = require("@elementor/ui");
|
|
1992
2090
|
var import_i18n11 = require("@wordpress/i18n");
|
|
@@ -2009,7 +2107,7 @@ var WAIT_FOR_CLOSE_TIMEOUT_MS = 300;
|
|
|
2009
2107
|
var EnableUnfilteredModal = (props) => {
|
|
2010
2108
|
const { mutateAsync, isPending } = useUpdateUnfilteredFilesUpload();
|
|
2011
2109
|
const { canUser } = (0, import_editor_current_user.useCurrentUserCapabilities)();
|
|
2012
|
-
const [isError, setIsError] = (0,
|
|
2110
|
+
const [isError, setIsError] = (0, import_react14.useState)(false);
|
|
2013
2111
|
const canManageOptions = canUser("manage_options");
|
|
2014
2112
|
const onClose = (enabled) => {
|
|
2015
2113
|
props.onClose(enabled);
|
|
@@ -2074,7 +2172,7 @@ var SvgMediaControl = createControl(() => {
|
|
|
2074
2172
|
const { data: attachment, isFetching } = (0, import_wp_media2.useWpMediaAttachment)(id?.value || null);
|
|
2075
2173
|
const src = attachment?.url ?? url?.value ?? null;
|
|
2076
2174
|
const { data: allowSvgUpload } = useUnfilteredFilesUpload();
|
|
2077
|
-
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = (0,
|
|
2175
|
+
const [unfilteredModalOpenState, setUnfilteredModalOpenState] = (0, import_react15.useState)(false);
|
|
2078
2176
|
const { open } = (0, import_wp_media2.useWpMediaFrame)({
|
|
2079
2177
|
mediaTypes: ["svg"],
|
|
2080
2178
|
multiple: false,
|
|
@@ -2250,7 +2348,7 @@ var BackgroundImageOverlayAttachment = () => {
|
|
|
2250
2348
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
|
|
2251
2349
|
var React40 = __toESM(require("react"));
|
|
2252
2350
|
var import_editor_props20 = require("@elementor/editor-props");
|
|
2253
|
-
var
|
|
2351
|
+
var import_editor_ui4 = require("@elementor/editor-ui");
|
|
2254
2352
|
var import_icons11 = require("@elementor/icons");
|
|
2255
2353
|
var import_ui33 = require("@elementor/ui");
|
|
2256
2354
|
var import_i18n14 = require("@wordpress/i18n");
|
|
@@ -2286,7 +2384,7 @@ var BackgroundImageOverlayPosition = () => {
|
|
|
2286
2384
|
onChange: handlePositionChange,
|
|
2287
2385
|
fullWidth: true
|
|
2288
2386
|
},
|
|
2289
|
-
backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ React40.createElement(
|
|
2387
|
+
backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ React40.createElement(import_editor_ui4.MenuListItem, { key: value, value: value ?? "" }, label))
|
|
2290
2388
|
)))), isCustom ? /* @__PURE__ */ React40.createElement(PropProvider, { ...backgroundImageOffsetContext }, /* @__PURE__ */ React40.createElement(import_ui33.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React40.createElement(import_ui33.Grid, { container: true, spacing: 1.5 }, /* @__PURE__ */ React40.createElement(import_ui33.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React40.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ React40.createElement(SizeControl, { startIcon: /* @__PURE__ */ React40.createElement(import_icons11.LetterXIcon, { fontSize: "tiny" }) }))), /* @__PURE__ */ React40.createElement(import_ui33.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React40.createElement(PropKeyProvider, { bind: "y" }, /* @__PURE__ */ React40.createElement(SizeControl, { startIcon: /* @__PURE__ */ React40.createElement(import_icons11.LetterYIcon, { fontSize: "tiny" }) })))))) : null);
|
|
2291
2389
|
};
|
|
2292
2390
|
|
|
@@ -2392,7 +2490,7 @@ var BackgroundImageOverlaySize = () => {
|
|
|
2392
2490
|
};
|
|
2393
2491
|
|
|
2394
2492
|
// src/controls/background-control/background-overlay/use-background-tabs-history.ts
|
|
2395
|
-
var
|
|
2493
|
+
var import_react16 = require("react");
|
|
2396
2494
|
var import_editor_props22 = require("@elementor/editor-props");
|
|
2397
2495
|
var import_ui36 = require("@elementor/ui");
|
|
2398
2496
|
var useBackgroundTabsHistory = ({
|
|
@@ -2413,7 +2511,7 @@ var useBackgroundTabsHistory = ({
|
|
|
2413
2511
|
return "image";
|
|
2414
2512
|
};
|
|
2415
2513
|
const { getTabsProps, getTabProps, getTabPanelProps } = (0, import_ui36.useTabs)(getCurrentOverlayType());
|
|
2416
|
-
const valuesHistory = (0,
|
|
2514
|
+
const valuesHistory = (0, import_react16.useRef)({
|
|
2417
2515
|
image: initialBackgroundImageOverlay,
|
|
2418
2516
|
color: initialBackgroundColorOverlay2,
|
|
2419
2517
|
gradient: initialBackgroundGradientOverlay2
|
|
@@ -2615,7 +2713,7 @@ var useImage = (image) => {
|
|
|
2615
2713
|
const imageSrc = image?.value.image.value?.src.value;
|
|
2616
2714
|
const { data: attachment } = (0, import_wp_media3.useWpMediaAttachment)(imageSrc.id?.value || null);
|
|
2617
2715
|
if (imageSrc.id) {
|
|
2618
|
-
const imageFileTypeExtension = attachment?.
|
|
2716
|
+
const imageFileTypeExtension = getFileExtensionFromFilename(attachment?.filename);
|
|
2619
2717
|
imageTitle = `${attachment?.title}${imageFileTypeExtension}` || null;
|
|
2620
2718
|
imageUrl = attachment?.url || null;
|
|
2621
2719
|
} else if (imageSrc.url) {
|
|
@@ -2624,6 +2722,13 @@ var useImage = (image) => {
|
|
|
2624
2722
|
}
|
|
2625
2723
|
return { imageTitle, imageUrl };
|
|
2626
2724
|
};
|
|
2725
|
+
var getFileExtensionFromFilename = (filename) => {
|
|
2726
|
+
if (!filename) {
|
|
2727
|
+
return "";
|
|
2728
|
+
}
|
|
2729
|
+
const extension = filename.substring(filename.lastIndexOf(".") + 1);
|
|
2730
|
+
return `.${extension}`;
|
|
2731
|
+
};
|
|
2627
2732
|
var getGradientValue = (value) => {
|
|
2628
2733
|
const gradient = value.value;
|
|
2629
2734
|
const stops = gradient.stops.value?.map(({ value: { color, offset } }) => `${color.value} ${offset.value ?? 0}%`)?.join(",");
|