@elementor/editor-controls 0.5.0 → 0.6.1
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 +31 -0
- package/dist/index.d.mts +37 -13
- package/dist/index.d.ts +37 -13
- package/dist/index.js +443 -234
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +389 -171
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
- package/src/bound-prop-context/prop-context.tsx +11 -2
- package/src/bound-prop-context/prop-key-context.tsx +9 -2
- package/src/bound-prop-context/use-bound-prop.ts +1 -0
- package/src/components/repeater.tsx +5 -2
- package/src/controls/autocomplete-control.tsx +181 -0
- package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +32 -2
- package/src/controls/equal-unequal-sizes-control.tsx +1 -1
- package/src/controls/image-media-control.tsx +1 -1
- package/src/controls/link-control.tsx +56 -26
- package/src/controls/linked-dimensions-control.tsx +60 -34
- package/src/controls/url-control.tsx +7 -2
- package/src/index.ts +1 -0
package/dist/index.mjs
CHANGED
|
@@ -31,7 +31,17 @@ var PropProvider = ({
|
|
|
31
31
|
setValue,
|
|
32
32
|
propType
|
|
33
33
|
}) => {
|
|
34
|
-
return /* @__PURE__ */ React.createElement(
|
|
34
|
+
return /* @__PURE__ */ React.createElement(
|
|
35
|
+
PropContext.Provider,
|
|
36
|
+
{
|
|
37
|
+
value: {
|
|
38
|
+
value,
|
|
39
|
+
propType,
|
|
40
|
+
setValue
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
children
|
|
44
|
+
);
|
|
35
45
|
};
|
|
36
46
|
var usePropContext = () => {
|
|
37
47
|
const context = useContext(PropContext);
|
|
@@ -65,6 +75,7 @@ var PropKeyProvider = ({ children, bind }) => {
|
|
|
65
75
|
};
|
|
66
76
|
var ObjectPropKeyProvider = ({ children, bind }) => {
|
|
67
77
|
const context = usePropContext();
|
|
78
|
+
const { path } = useContext2(PropKeyContext) ?? {};
|
|
68
79
|
const setValue = (value2, options, meta) => {
|
|
69
80
|
const newValue = {
|
|
70
81
|
...context.value,
|
|
@@ -74,10 +85,17 @@ var ObjectPropKeyProvider = ({ children, bind }) => {
|
|
|
74
85
|
};
|
|
75
86
|
const value = context.value?.[bind];
|
|
76
87
|
const propType = context.propType.shape[bind];
|
|
77
|
-
return /* @__PURE__ */ React2.createElement(
|
|
88
|
+
return /* @__PURE__ */ React2.createElement(
|
|
89
|
+
PropKeyContext.Provider,
|
|
90
|
+
{
|
|
91
|
+
value: { ...context, value, setValue, bind, propType, path: [...path ?? [], bind] }
|
|
92
|
+
},
|
|
93
|
+
children
|
|
94
|
+
);
|
|
78
95
|
};
|
|
79
96
|
var ArrayPropKeyProvider = ({ children, bind }) => {
|
|
80
97
|
const context = usePropContext();
|
|
98
|
+
const { path } = useContext2(PropKeyContext) ?? {};
|
|
81
99
|
const setValue = (value2, options) => {
|
|
82
100
|
const newValue = [...context.value ?? []];
|
|
83
101
|
newValue[Number(bind)] = value2;
|
|
@@ -85,7 +103,13 @@ var ArrayPropKeyProvider = ({ children, bind }) => {
|
|
|
85
103
|
};
|
|
86
104
|
const value = context.value?.[Number(bind)];
|
|
87
105
|
const propType = context.propType.item_prop_type;
|
|
88
|
-
return /* @__PURE__ */ React2.createElement(
|
|
106
|
+
return /* @__PURE__ */ React2.createElement(
|
|
107
|
+
PropKeyContext.Provider,
|
|
108
|
+
{
|
|
109
|
+
value: { ...context, value, setValue, bind, propType, path: [...path ?? [], bind] }
|
|
110
|
+
},
|
|
111
|
+
children
|
|
112
|
+
);
|
|
89
113
|
};
|
|
90
114
|
var usePropKeyContext = () => {
|
|
91
115
|
const context = useContext2(PropKeyContext);
|
|
@@ -233,7 +257,7 @@ var ImageMediaControl = createControl(() => {
|
|
|
233
257
|
const { data: attachment, isFetching } = useWpMediaAttachment(id?.value || null);
|
|
234
258
|
const src = attachment?.url ?? url?.value ?? null;
|
|
235
259
|
const { open } = useWpMediaFrame({
|
|
236
|
-
types: ["image"],
|
|
260
|
+
types: ["image", "image/svg+xml"],
|
|
237
261
|
multiple: false,
|
|
238
262
|
selected: id?.value || null,
|
|
239
263
|
onSelect: (selectedAttachment) => {
|
|
@@ -287,15 +311,129 @@ var ImageControl = createControl((props) => {
|
|
|
287
311
|
return /* @__PURE__ */ React10.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React10.createElement(Stack2, { gap: 1.5 }, /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "src" }, /* @__PURE__ */ React10.createElement(ImageMediaControl, null)), /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React10.createElement(Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React10.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React10.createElement(ControlLabel, null, " ", __2("Image Resolution", "elementor"))), /* @__PURE__ */ React10.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React10.createElement(SelectControl, { options: props.sizes }))))));
|
|
288
312
|
});
|
|
289
313
|
|
|
290
|
-
// src/controls/
|
|
314
|
+
// src/controls/autocomplete-control.tsx
|
|
291
315
|
import * as React11 from "react";
|
|
316
|
+
import { useState } from "react";
|
|
292
317
|
import { stringPropTypeUtil as stringPropTypeUtil2 } from "@elementor/editor-props";
|
|
293
|
-
import {
|
|
318
|
+
import { XIcon } from "@elementor/icons";
|
|
319
|
+
import {
|
|
320
|
+
Autocomplete,
|
|
321
|
+
Box,
|
|
322
|
+
IconButton,
|
|
323
|
+
InputAdornment,
|
|
324
|
+
TextField
|
|
325
|
+
} from "@elementor/ui";
|
|
326
|
+
var AutocompleteControl = createControl(
|
|
327
|
+
({
|
|
328
|
+
options,
|
|
329
|
+
placeholder = "",
|
|
330
|
+
allowCustomValues = false,
|
|
331
|
+
propType = stringPropTypeUtil2,
|
|
332
|
+
minInputLength = 2
|
|
333
|
+
}) => {
|
|
334
|
+
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;
|
|
340
|
+
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
|
+
}
|
|
347
|
+
setValue(newValue);
|
|
348
|
+
};
|
|
349
|
+
const filterOptions = () => {
|
|
350
|
+
const formattedValue = inputValue?.toLowerCase() || "";
|
|
351
|
+
if (formattedValue.length < minInputLength) {
|
|
352
|
+
return [];
|
|
353
|
+
}
|
|
354
|
+
return formattedOptions.filter(
|
|
355
|
+
(optionValue) => optionValue.toLowerCase().indexOf(formattedValue) !== -1 || options[optionValue].label.toLowerCase().indexOf(formattedValue) !== -1
|
|
356
|
+
);
|
|
357
|
+
};
|
|
358
|
+
const isOptionEqualToValue = () => {
|
|
359
|
+
return muiWarningPreventer() ? void 0 : () => true;
|
|
360
|
+
};
|
|
361
|
+
const muiWarningPreventer = () => allowCustomValues || !!filterOptions().length;
|
|
362
|
+
return /* @__PURE__ */ React11.createElement(ControlActions, null, /* @__PURE__ */ React11.createElement(
|
|
363
|
+
Autocomplete,
|
|
364
|
+
{
|
|
365
|
+
forcePopupIcon: false,
|
|
366
|
+
disableClearable: true,
|
|
367
|
+
freeSolo: muiWarningPreventer(),
|
|
368
|
+
value: inputValue || "",
|
|
369
|
+
size: "tiny",
|
|
370
|
+
onChange: handleChange,
|
|
371
|
+
onInputChange: handleChange,
|
|
372
|
+
onBlur: allowCustomValues ? void 0 : () => handleChange(null, value),
|
|
373
|
+
readOnly: hasSelectedValue,
|
|
374
|
+
options: formattedOptions,
|
|
375
|
+
getOptionKey: (option) => option,
|
|
376
|
+
getOptionLabel: (option) => options[option]?.label ?? option,
|
|
377
|
+
groupBy: shouldGroupOptions(options) ? (option) => options[option]?.groupLabel : void 0,
|
|
378
|
+
isOptionEqualToValue: isOptionEqualToValue(),
|
|
379
|
+
filterOptions,
|
|
380
|
+
renderOption: (optionProps, option) => /* @__PURE__ */ React11.createElement(Box, { component: "li", ...optionProps, key: optionProps.id }, options[option]?.label ?? option),
|
|
381
|
+
renderInput: (params) => /* @__PURE__ */ React11.createElement(
|
|
382
|
+
TextInput,
|
|
383
|
+
{
|
|
384
|
+
params,
|
|
385
|
+
handleChange,
|
|
386
|
+
allowClear,
|
|
387
|
+
placeholder,
|
|
388
|
+
hasSelectedValue
|
|
389
|
+
}
|
|
390
|
+
)
|
|
391
|
+
}
|
|
392
|
+
));
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
var TextInput = ({
|
|
396
|
+
params,
|
|
397
|
+
allowClear,
|
|
398
|
+
placeholder,
|
|
399
|
+
handleChange,
|
|
400
|
+
hasSelectedValue
|
|
401
|
+
}) => {
|
|
402
|
+
return /* @__PURE__ */ React11.createElement(
|
|
403
|
+
TextField,
|
|
404
|
+
{
|
|
405
|
+
...params,
|
|
406
|
+
placeholder,
|
|
407
|
+
sx: {
|
|
408
|
+
"& .MuiInputBase-input": {
|
|
409
|
+
cursor: hasSelectedValue ? "default" : void 0
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
InputProps: {
|
|
413
|
+
...params.InputProps,
|
|
414
|
+
endAdornment: /* @__PURE__ */ React11.createElement(ClearButton, { params, allowClear, handleChange })
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
);
|
|
418
|
+
};
|
|
419
|
+
var ClearButton = ({
|
|
420
|
+
allowClear,
|
|
421
|
+
handleChange,
|
|
422
|
+
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 })));
|
|
424
|
+
function shouldGroupOptions(options) {
|
|
425
|
+
return Object.values(options).every((option) => "groupLabel" in option);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// src/controls/text-control.tsx
|
|
429
|
+
import * as React12 from "react";
|
|
430
|
+
import { stringPropTypeUtil as stringPropTypeUtil3 } from "@elementor/editor-props";
|
|
431
|
+
import { TextField as TextField2 } from "@elementor/ui";
|
|
294
432
|
var TextControl = createControl(({ placeholder }) => {
|
|
295
|
-
const { value, setValue } = useBoundProp(
|
|
433
|
+
const { value, setValue } = useBoundProp(stringPropTypeUtil3);
|
|
296
434
|
const handleChange = (event) => setValue(event.target.value);
|
|
297
|
-
return /* @__PURE__ */
|
|
298
|
-
|
|
435
|
+
return /* @__PURE__ */ React12.createElement(ControlActions, null, /* @__PURE__ */ React12.createElement(
|
|
436
|
+
TextField2,
|
|
299
437
|
{
|
|
300
438
|
size: "tiny",
|
|
301
439
|
fullWidth: true,
|
|
@@ -307,16 +445,16 @@ var TextControl = createControl(({ placeholder }) => {
|
|
|
307
445
|
});
|
|
308
446
|
|
|
309
447
|
// src/controls/text-area-control.tsx
|
|
310
|
-
import * as
|
|
311
|
-
import { stringPropTypeUtil as
|
|
312
|
-
import { TextField as
|
|
448
|
+
import * as React13 from "react";
|
|
449
|
+
import { stringPropTypeUtil as stringPropTypeUtil4 } from "@elementor/editor-props";
|
|
450
|
+
import { TextField as TextField3 } from "@elementor/ui";
|
|
313
451
|
var TextAreaControl = createControl(({ placeholder }) => {
|
|
314
|
-
const { value, setValue } = useBoundProp(
|
|
452
|
+
const { value, setValue } = useBoundProp(stringPropTypeUtil4);
|
|
315
453
|
const handleChange = (event) => {
|
|
316
454
|
setValue(event.target.value);
|
|
317
455
|
};
|
|
318
|
-
return /* @__PURE__ */
|
|
319
|
-
|
|
456
|
+
return /* @__PURE__ */ React13.createElement(ControlActions, null, /* @__PURE__ */ React13.createElement(
|
|
457
|
+
TextField3,
|
|
320
458
|
{
|
|
321
459
|
size: "tiny",
|
|
322
460
|
multiline: true,
|
|
@@ -330,18 +468,18 @@ var TextAreaControl = createControl(({ placeholder }) => {
|
|
|
330
468
|
});
|
|
331
469
|
|
|
332
470
|
// src/controls/size-control.tsx
|
|
333
|
-
import * as
|
|
471
|
+
import * as React15 from "react";
|
|
334
472
|
import { sizePropTypeUtil } from "@elementor/editor-props";
|
|
335
|
-
import { InputAdornment as
|
|
473
|
+
import { InputAdornment as InputAdornment3 } from "@elementor/ui";
|
|
336
474
|
|
|
337
475
|
// src/components/text-field-inner-selection.tsx
|
|
338
|
-
import * as
|
|
476
|
+
import * as React14 from "react";
|
|
339
477
|
import { forwardRef, useId } from "react";
|
|
340
|
-
import { bindMenu, bindTrigger, Button as Button2, InputAdornment, Menu, MenuItem as MenuItem2, TextField as
|
|
478
|
+
import { bindMenu, bindTrigger, Button as Button2, InputAdornment as InputAdornment2, Menu, MenuItem as MenuItem2, TextField as TextField4, usePopupState } from "@elementor/ui";
|
|
341
479
|
var TextFieldInnerSelection = forwardRef(
|
|
342
480
|
({ placeholder, type, value, onChange, endAdornment, startAdornment }, ref) => {
|
|
343
|
-
return /* @__PURE__ */
|
|
344
|
-
|
|
481
|
+
return /* @__PURE__ */ React14.createElement(
|
|
482
|
+
TextField4,
|
|
345
483
|
{
|
|
346
484
|
size: "tiny",
|
|
347
485
|
fullWidth: true,
|
|
@@ -371,7 +509,7 @@ var SelectionEndAdornment = ({
|
|
|
371
509
|
onClick(options[index]);
|
|
372
510
|
popupState.close();
|
|
373
511
|
};
|
|
374
|
-
return /* @__PURE__ */
|
|
512
|
+
return /* @__PURE__ */ React14.createElement(InputAdornment2, { position: "end" }, /* @__PURE__ */ React14.createElement(
|
|
375
513
|
Button2,
|
|
376
514
|
{
|
|
377
515
|
size: "small",
|
|
@@ -380,11 +518,11 @@ var SelectionEndAdornment = ({
|
|
|
380
518
|
...bindTrigger(popupState)
|
|
381
519
|
},
|
|
382
520
|
value.toUpperCase()
|
|
383
|
-
), /* @__PURE__ */
|
|
521
|
+
), /* @__PURE__ */ React14.createElement(Menu, { MenuListProps: { dense: true }, ...bindMenu(popupState) }, options.map((option, index) => /* @__PURE__ */ React14.createElement(MenuItem2, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
|
|
384
522
|
};
|
|
385
523
|
|
|
386
524
|
// src/hooks/use-sync-external-state.tsx
|
|
387
|
-
import { useEffect, useState } from "react";
|
|
525
|
+
import { useEffect, useState as useState2 } from "react";
|
|
388
526
|
var useSyncExternalState = ({
|
|
389
527
|
external,
|
|
390
528
|
setExternal,
|
|
@@ -403,7 +541,7 @@ var useSyncExternalState = ({
|
|
|
403
541
|
}
|
|
404
542
|
return externalValue;
|
|
405
543
|
}
|
|
406
|
-
const [internal, setInternal] =
|
|
544
|
+
const [internal, setInternal] = useState2(toInternal(external, null));
|
|
407
545
|
useEffect(() => {
|
|
408
546
|
setInternal((prevInternal) => toInternal(external, prevInternal));
|
|
409
547
|
}, [external]);
|
|
@@ -441,10 +579,10 @@ var SizeControl = createControl(({ units: units2 = defaultUnits, placeholder, st
|
|
|
441
579
|
size: size || size === "0" ? parseFloat(size) : defaultSize
|
|
442
580
|
}));
|
|
443
581
|
};
|
|
444
|
-
return /* @__PURE__ */
|
|
582
|
+
return /* @__PURE__ */ React15.createElement(ControlActions, null, /* @__PURE__ */ React15.createElement(
|
|
445
583
|
TextFieldInnerSelection,
|
|
446
584
|
{
|
|
447
|
-
endAdornment: /* @__PURE__ */
|
|
585
|
+
endAdornment: /* @__PURE__ */ React15.createElement(
|
|
448
586
|
SelectionEndAdornment,
|
|
449
587
|
{
|
|
450
588
|
options: units2,
|
|
@@ -453,7 +591,7 @@ var SizeControl = createControl(({ units: units2 = defaultUnits, placeholder, st
|
|
|
453
591
|
}
|
|
454
592
|
),
|
|
455
593
|
placeholder,
|
|
456
|
-
startAdornment: startIcon ?? /* @__PURE__ */
|
|
594
|
+
startAdornment: startIcon ?? /* @__PURE__ */ React15.createElement(InputAdornment3, { position: "start" }, startIcon),
|
|
457
595
|
type: "number",
|
|
458
596
|
value: Number.isNaN(state?.size) ? "" : state?.size,
|
|
459
597
|
onChange: handleSizeChange
|
|
@@ -462,13 +600,13 @@ var SizeControl = createControl(({ units: units2 = defaultUnits, placeholder, st
|
|
|
462
600
|
});
|
|
463
601
|
|
|
464
602
|
// src/controls/stroke-control.tsx
|
|
465
|
-
import * as
|
|
603
|
+
import * as React17 from "react";
|
|
466
604
|
import { strokePropTypeUtil } from "@elementor/editor-props";
|
|
467
605
|
import { Grid as Grid2, Stack as Stack3 } from "@elementor/ui";
|
|
468
606
|
import { __ as __3 } from "@wordpress/i18n";
|
|
469
607
|
|
|
470
608
|
// src/controls/color-control.tsx
|
|
471
|
-
import * as
|
|
609
|
+
import * as React16 from "react";
|
|
472
610
|
import { colorPropTypeUtil } from "@elementor/editor-props";
|
|
473
611
|
import { UnstableColorField } from "@elementor/ui";
|
|
474
612
|
var ColorControl = createControl(({ propTypeUtil = colorPropTypeUtil, ...props }) => {
|
|
@@ -476,32 +614,32 @@ var ColorControl = createControl(({ propTypeUtil = colorPropTypeUtil, ...props }
|
|
|
476
614
|
const handleChange = (selectedColor) => {
|
|
477
615
|
setValue(selectedColor);
|
|
478
616
|
};
|
|
479
|
-
return /* @__PURE__ */
|
|
617
|
+
return /* @__PURE__ */ React16.createElement(ControlActions, null, /* @__PURE__ */ React16.createElement(UnstableColorField, { size: "tiny", ...props, value: value ?? "", onChange: handleChange, fullWidth: true }));
|
|
480
618
|
});
|
|
481
619
|
|
|
482
620
|
// src/controls/stroke-control.tsx
|
|
483
621
|
var units = ["px", "em", "rem"];
|
|
484
622
|
var StrokeControl = createControl(() => {
|
|
485
623
|
const propContext = useBoundProp(strokePropTypeUtil);
|
|
486
|
-
return /* @__PURE__ */
|
|
624
|
+
return /* @__PURE__ */ React17.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React17.createElement(Stack3, { gap: 1.5 }, /* @__PURE__ */ React17.createElement(Control, { bind: "width", label: __3("Stroke Width", "elementor") }, /* @__PURE__ */ React17.createElement(SizeControl, { units })), /* @__PURE__ */ React17.createElement(Control, { bind: "color", label: __3("Stroke Color", "elementor") }, /* @__PURE__ */ React17.createElement(ColorControl, null))));
|
|
487
625
|
});
|
|
488
|
-
var Control = ({ bind, label, children }) => /* @__PURE__ */
|
|
626
|
+
var Control = ({ bind, label, children }) => /* @__PURE__ */ React17.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React17.createElement(Grid2, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React17.createElement(Grid2, { item: true, xs: 6 }, /* @__PURE__ */ React17.createElement(ControlLabel, null, label)), /* @__PURE__ */ React17.createElement(Grid2, { item: true, xs: 6 }, children)));
|
|
489
627
|
|
|
490
628
|
// src/controls/box-shadow-repeater-control.tsx
|
|
491
|
-
import * as
|
|
629
|
+
import * as React19 from "react";
|
|
492
630
|
import { boxShadowPropTypeUtil, shadowPropTypeUtil } from "@elementor/editor-props";
|
|
493
631
|
import { Grid as Grid3, Stack as Stack5, Typography as Typography3, UnstableColorIndicator } from "@elementor/ui";
|
|
494
632
|
import { __ as __5 } from "@wordpress/i18n";
|
|
495
633
|
|
|
496
634
|
// src/components/repeater.tsx
|
|
497
|
-
import * as
|
|
498
|
-
import {
|
|
499
|
-
import { CopyIcon, EyeIcon, EyeOffIcon, PlusIcon, XIcon } from "@elementor/icons";
|
|
635
|
+
import * as React18 from "react";
|
|
636
|
+
import { useRef, useState as useState3 } from "react";
|
|
637
|
+
import { CopyIcon, EyeIcon, EyeOffIcon, PlusIcon, XIcon as XIcon2 } from "@elementor/icons";
|
|
500
638
|
import {
|
|
501
639
|
bindPopover,
|
|
502
640
|
bindTrigger as bindTrigger2,
|
|
503
|
-
Box,
|
|
504
|
-
IconButton,
|
|
641
|
+
Box as Box2,
|
|
642
|
+
IconButton as IconButton2,
|
|
505
643
|
Popover,
|
|
506
644
|
Stack as Stack4,
|
|
507
645
|
Typography as Typography2,
|
|
@@ -541,22 +679,24 @@ var Repeater = ({
|
|
|
541
679
|
})
|
|
542
680
|
);
|
|
543
681
|
};
|
|
544
|
-
return /* @__PURE__ */
|
|
682
|
+
return /* @__PURE__ */ React18.createElement(Stack4, null, /* @__PURE__ */ React18.createElement(Stack4, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pb: 1 } }, /* @__PURE__ */ React18.createElement(Typography2, { component: "label", variant: "caption", color: "text.secondary" }, label), /* @__PURE__ */ React18.createElement(IconButton2, { size: SIZE, onClick: addRepeaterItem, "aria-label": __4("Add item", "elementor") }, /* @__PURE__ */ React18.createElement(PlusIcon, { fontSize: SIZE }))), /* @__PURE__ */ React18.createElement(Stack4, { gap: 1 }, repeaterValues.map((value, index) => /* @__PURE__ */ React18.createElement(
|
|
545
683
|
RepeaterItem,
|
|
546
684
|
{
|
|
547
685
|
key: index,
|
|
686
|
+
bind: String(index),
|
|
548
687
|
disabled: value.disabled,
|
|
549
|
-
label: /* @__PURE__ */
|
|
550
|
-
startIcon: /* @__PURE__ */
|
|
688
|
+
label: /* @__PURE__ */ React18.createElement(itemSettings.Label, { value }),
|
|
689
|
+
startIcon: /* @__PURE__ */ React18.createElement(itemSettings.Icon, { value }),
|
|
551
690
|
removeItem: () => removeRepeaterItem(index),
|
|
552
691
|
duplicateItem: () => duplicateRepeaterItem(index),
|
|
553
692
|
toggleDisableItem: () => toggleDisableRepeaterItem(index)
|
|
554
693
|
},
|
|
555
|
-
(props) => /* @__PURE__ */
|
|
694
|
+
(props) => /* @__PURE__ */ React18.createElement(itemSettings.Content, { ...props, bind: String(index) })
|
|
556
695
|
))));
|
|
557
696
|
};
|
|
558
697
|
var RepeaterItem = ({
|
|
559
698
|
label,
|
|
699
|
+
bind,
|
|
560
700
|
disabled,
|
|
561
701
|
startIcon,
|
|
562
702
|
children,
|
|
@@ -564,12 +704,12 @@ var RepeaterItem = ({
|
|
|
564
704
|
duplicateItem,
|
|
565
705
|
toggleDisableItem
|
|
566
706
|
}) => {
|
|
567
|
-
const popupId =
|
|
707
|
+
const popupId = `repeater-popup-${bind}`;
|
|
568
708
|
const controlRef = useRef(null);
|
|
569
|
-
const [anchorEl, setAnchorEl] =
|
|
709
|
+
const [anchorEl, setAnchorEl] = useState3(null);
|
|
570
710
|
const popoverState = usePopupState2({ popupId, variant: "popover" });
|
|
571
711
|
const popoverProps = bindPopover(popoverState);
|
|
572
|
-
return /* @__PURE__ */
|
|
712
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(
|
|
573
713
|
UnstableTag,
|
|
574
714
|
{
|
|
575
715
|
label,
|
|
@@ -579,33 +719,33 @@ var RepeaterItem = ({
|
|
|
579
719
|
"aria-label": __4("Open item", "elementor"),
|
|
580
720
|
...bindTrigger2(popoverState),
|
|
581
721
|
startIcon,
|
|
582
|
-
actions: /* @__PURE__ */
|
|
583
|
-
|
|
722
|
+
actions: /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(
|
|
723
|
+
IconButton2,
|
|
584
724
|
{
|
|
585
725
|
size: SIZE,
|
|
586
726
|
onClick: duplicateItem,
|
|
587
727
|
"aria-label": __4("Duplicate item", "elementor")
|
|
588
728
|
},
|
|
589
|
-
/* @__PURE__ */
|
|
590
|
-
), /* @__PURE__ */
|
|
591
|
-
|
|
729
|
+
/* @__PURE__ */ React18.createElement(CopyIcon, { fontSize: SIZE })
|
|
730
|
+
), /* @__PURE__ */ React18.createElement(
|
|
731
|
+
IconButton2,
|
|
592
732
|
{
|
|
593
733
|
size: SIZE,
|
|
594
734
|
onClick: toggleDisableItem,
|
|
595
735
|
"aria-label": disabled ? __4("Enable item", "elementor") : __4("Disable item", "elementor")
|
|
596
736
|
},
|
|
597
|
-
disabled ? /* @__PURE__ */
|
|
598
|
-
), /* @__PURE__ */
|
|
599
|
-
|
|
737
|
+
disabled ? /* @__PURE__ */ React18.createElement(EyeOffIcon, { fontSize: SIZE }) : /* @__PURE__ */ React18.createElement(EyeIcon, { fontSize: SIZE })
|
|
738
|
+
), /* @__PURE__ */ React18.createElement(
|
|
739
|
+
IconButton2,
|
|
600
740
|
{
|
|
601
741
|
size: SIZE,
|
|
602
742
|
onClick: removeItem,
|
|
603
743
|
"aria-label": __4("Remove item", "elementor")
|
|
604
744
|
},
|
|
605
|
-
/* @__PURE__ */
|
|
745
|
+
/* @__PURE__ */ React18.createElement(XIcon2, { fontSize: SIZE })
|
|
606
746
|
))
|
|
607
747
|
}
|
|
608
|
-
), /* @__PURE__ */
|
|
748
|
+
), /* @__PURE__ */ React18.createElement(
|
|
609
749
|
Popover,
|
|
610
750
|
{
|
|
611
751
|
disablePortal: true,
|
|
@@ -618,14 +758,14 @@ var RepeaterItem = ({
|
|
|
618
758
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
619
759
|
...popoverProps
|
|
620
760
|
},
|
|
621
|
-
/* @__PURE__ */
|
|
761
|
+
/* @__PURE__ */ React18.createElement(Box2, { p: 0.5 }, children({ anchorEl }))
|
|
622
762
|
));
|
|
623
763
|
};
|
|
624
764
|
|
|
625
765
|
// src/controls/box-shadow-repeater-control.tsx
|
|
626
766
|
var BoxShadowRepeaterControl = createControl(() => {
|
|
627
767
|
const { propType, value, setValue } = useBoundProp(boxShadowPropTypeUtil);
|
|
628
|
-
return /* @__PURE__ */
|
|
768
|
+
return /* @__PURE__ */ React19.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React19.createElement(
|
|
629
769
|
Repeater,
|
|
630
770
|
{
|
|
631
771
|
values: value ?? [],
|
|
@@ -640,13 +780,13 @@ var BoxShadowRepeaterControl = createControl(() => {
|
|
|
640
780
|
}
|
|
641
781
|
));
|
|
642
782
|
});
|
|
643
|
-
var ItemIcon = ({ value }) => /* @__PURE__ */
|
|
783
|
+
var ItemIcon = ({ value }) => /* @__PURE__ */ React19.createElement(UnstableColorIndicator, { size: "inherit", component: "span", value: value.value.color.value });
|
|
644
784
|
var ItemContent = ({ anchorEl, bind }) => {
|
|
645
|
-
return /* @__PURE__ */
|
|
785
|
+
return /* @__PURE__ */ React19.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React19.createElement(Content, { anchorEl }));
|
|
646
786
|
};
|
|
647
787
|
var Content = ({ anchorEl }) => {
|
|
648
788
|
const { propType, value, setValue } = useBoundProp(shadowPropTypeUtil);
|
|
649
|
-
return /* @__PURE__ */
|
|
789
|
+
return /* @__PURE__ */ React19.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React19.createElement(Stack5, { gap: 1.5 }, /* @__PURE__ */ React19.createElement(Grid3, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React19.createElement(Control2, { bind: "color", label: __5("Color", "elementor") }, /* @__PURE__ */ React19.createElement(
|
|
650
790
|
ColorControl,
|
|
651
791
|
{
|
|
652
792
|
slotProps: {
|
|
@@ -663,7 +803,7 @@ var Content = ({ anchorEl }) => {
|
|
|
663
803
|
}
|
|
664
804
|
}
|
|
665
805
|
}
|
|
666
|
-
)), /* @__PURE__ */
|
|
806
|
+
)), /* @__PURE__ */ React19.createElement(Control2, { bind: "position", label: __5("Position", "elementor") }, /* @__PURE__ */ React19.createElement(
|
|
667
807
|
SelectControl,
|
|
668
808
|
{
|
|
669
809
|
options: [
|
|
@@ -671,9 +811,9 @@ var Content = ({ anchorEl }) => {
|
|
|
671
811
|
{ label: __5("Outset", "elementor"), value: "" }
|
|
672
812
|
]
|
|
673
813
|
}
|
|
674
|
-
))), /* @__PURE__ */
|
|
814
|
+
))), /* @__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)))));
|
|
675
815
|
};
|
|
676
|
-
var Control2 = ({ label, bind, children }) => /* @__PURE__ */
|
|
816
|
+
var Control2 = ({ label, bind, children }) => /* @__PURE__ */ React19.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React19.createElement(Grid3, { item: true, xs: 6 }, /* @__PURE__ */ React19.createElement(Grid3, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React19.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React19.createElement(Typography3, { component: "label", variant: "caption", color: "text.secondary" }, label)), /* @__PURE__ */ React19.createElement(Grid3, { item: true, xs: 12 }, children))));
|
|
677
817
|
var ItemLabel = ({ value }) => {
|
|
678
818
|
const { position, hOffset, vOffset, blur, spread } = value.value;
|
|
679
819
|
const { size: blurSize = "", unit: blurUnit = "" } = blur?.value || {};
|
|
@@ -686,7 +826,7 @@ var ItemLabel = ({ value }) => {
|
|
|
686
826
|
blurSize + blurUnit,
|
|
687
827
|
spreadSize + spreadUnit
|
|
688
828
|
].join(" ");
|
|
689
|
-
return /* @__PURE__ */
|
|
829
|
+
return /* @__PURE__ */ React19.createElement("span", { style: { textTransform: "capitalize" } }, position ?? "outset", ": ", sizes);
|
|
690
830
|
};
|
|
691
831
|
var initialShadow = {
|
|
692
832
|
$$type: "shadow",
|
|
@@ -716,11 +856,11 @@ var initialShadow = {
|
|
|
716
856
|
};
|
|
717
857
|
|
|
718
858
|
// src/controls/toggle-control.tsx
|
|
719
|
-
import * as
|
|
720
|
-
import { stringPropTypeUtil as
|
|
859
|
+
import * as React21 from "react";
|
|
860
|
+
import { stringPropTypeUtil as stringPropTypeUtil5 } from "@elementor/editor-props";
|
|
721
861
|
|
|
722
862
|
// src/components/control-toggle-button-group.tsx
|
|
723
|
-
import * as
|
|
863
|
+
import * as React20 from "react";
|
|
724
864
|
import {
|
|
725
865
|
styled as styled2,
|
|
726
866
|
ToggleButton,
|
|
@@ -744,7 +884,7 @@ var ControlToggleButtonGroup = ({
|
|
|
744
884
|
const handleChange = (_, newValue) => {
|
|
745
885
|
onChange(newValue);
|
|
746
886
|
};
|
|
747
|
-
return /* @__PURE__ */
|
|
887
|
+
return /* @__PURE__ */ React20.createElement(
|
|
748
888
|
StyledToggleButtonGroup,
|
|
749
889
|
{
|
|
750
890
|
justify,
|
|
@@ -756,7 +896,7 @@ var ControlToggleButtonGroup = ({
|
|
|
756
896
|
}
|
|
757
897
|
},
|
|
758
898
|
items.map(
|
|
759
|
-
({ label, value: buttonValue, renderContent: Content3, showTooltip }) => showTooltip ? /* @__PURE__ */
|
|
899
|
+
({ label, value: buttonValue, renderContent: Content3, showTooltip }) => showTooltip ? /* @__PURE__ */ React20.createElement(Tooltip, { key: buttonValue, title: label, disableFocusListener: true, placement: "top" }, /* @__PURE__ */ React20.createElement(ToggleButton, { value: buttonValue, "aria-label": label, size, fullWidth }, /* @__PURE__ */ React20.createElement(Content3, { size }))) : /* @__PURE__ */ React20.createElement(
|
|
760
900
|
ToggleButton,
|
|
761
901
|
{
|
|
762
902
|
key: buttonValue,
|
|
@@ -765,7 +905,7 @@ var ControlToggleButtonGroup = ({
|
|
|
765
905
|
size,
|
|
766
906
|
fullWidth
|
|
767
907
|
},
|
|
768
|
-
/* @__PURE__ */
|
|
908
|
+
/* @__PURE__ */ React20.createElement(Content3, { size })
|
|
769
909
|
)
|
|
770
910
|
)
|
|
771
911
|
);
|
|
@@ -774,11 +914,11 @@ var ControlToggleButtonGroup = ({
|
|
|
774
914
|
// src/controls/toggle-control.tsx
|
|
775
915
|
var ToggleControl = createControl(
|
|
776
916
|
({ options, fullWidth = false, size = "tiny" }) => {
|
|
777
|
-
const { value, setValue } = useBoundProp(
|
|
917
|
+
const { value, setValue } = useBoundProp(stringPropTypeUtil5);
|
|
778
918
|
const handleToggle = (option) => {
|
|
779
919
|
setValue(option);
|
|
780
920
|
};
|
|
781
|
-
return /* @__PURE__ */
|
|
921
|
+
return /* @__PURE__ */ React21.createElement(
|
|
782
922
|
ControlToggleButtonGroup,
|
|
783
923
|
{
|
|
784
924
|
items: options,
|
|
@@ -793,9 +933,9 @@ var ToggleControl = createControl(
|
|
|
793
933
|
);
|
|
794
934
|
|
|
795
935
|
// src/controls/number-control.tsx
|
|
796
|
-
import * as
|
|
936
|
+
import * as React22 from "react";
|
|
797
937
|
import { numberPropTypeUtil } from "@elementor/editor-props";
|
|
798
|
-
import { TextField as
|
|
938
|
+
import { TextField as TextField5 } from "@elementor/ui";
|
|
799
939
|
var isEmptyOrNaN = (value) => value === null || value === void 0 || value === "" || Number.isNaN(Number(value));
|
|
800
940
|
var NumberControl = createControl(
|
|
801
941
|
({
|
|
@@ -815,8 +955,8 @@ var NumberControl = createControl(
|
|
|
815
955
|
const formattedValue = shouldForceInt ? +parseInt(eventValue) : Number(eventValue);
|
|
816
956
|
setValue(Math.min(Math.max(formattedValue, min), max));
|
|
817
957
|
};
|
|
818
|
-
return /* @__PURE__ */
|
|
819
|
-
|
|
958
|
+
return /* @__PURE__ */ React22.createElement(ControlActions, null, /* @__PURE__ */ React22.createElement(
|
|
959
|
+
TextField5,
|
|
820
960
|
{
|
|
821
961
|
size: "tiny",
|
|
822
962
|
type: "number",
|
|
@@ -831,8 +971,8 @@ var NumberControl = createControl(
|
|
|
831
971
|
);
|
|
832
972
|
|
|
833
973
|
// src/controls/equal-unequal-sizes-control.tsx
|
|
834
|
-
import * as
|
|
835
|
-
import { useId as
|
|
974
|
+
import * as React23 from "react";
|
|
975
|
+
import { useId as useId2, useRef as useRef2 } from "react";
|
|
836
976
|
import { sizePropTypeUtil as sizePropTypeUtil2 } from "@elementor/editor-props";
|
|
837
977
|
import { bindPopover as bindPopover2, bindToggle, Grid as Grid4, Popover as Popover2, Stack as Stack6, ToggleButton as ToggleButton2, usePopupState as usePopupState3 } from "@elementor/ui";
|
|
838
978
|
import { __ as __6 } from "@wordpress/i18n";
|
|
@@ -852,7 +992,7 @@ function EqualUnequalSizesControl({
|
|
|
852
992
|
items,
|
|
853
993
|
multiSizePropTypeUtil
|
|
854
994
|
}) {
|
|
855
|
-
const popupId =
|
|
995
|
+
const popupId = useId2();
|
|
856
996
|
const controlRef = useRef2(null);
|
|
857
997
|
const popupState = usePopupState3({ variant: "popover", popupId });
|
|
858
998
|
const {
|
|
@@ -887,7 +1027,7 @@ function EqualUnequalSizesControl({
|
|
|
887
1027
|
}
|
|
888
1028
|
return splitEqualValue() ?? null;
|
|
889
1029
|
};
|
|
890
|
-
return /* @__PURE__ */
|
|
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(
|
|
891
1031
|
ToggleButton2,
|
|
892
1032
|
{
|
|
893
1033
|
size: "tiny",
|
|
@@ -897,7 +1037,7 @@ function EqualUnequalSizesControl({
|
|
|
897
1037
|
selected: popupState.isOpen
|
|
898
1038
|
},
|
|
899
1039
|
icon
|
|
900
|
-
)))), /* @__PURE__ */
|
|
1040
|
+
)))), /* @__PURE__ */ React23.createElement(
|
|
901
1041
|
Popover2,
|
|
902
1042
|
{
|
|
903
1043
|
disablePortal: true,
|
|
@@ -915,45 +1055,46 @@ function EqualUnequalSizesControl({
|
|
|
915
1055
|
paper: { sx: { mt: 0.5, p: 2, pt: 1, width: controlRef.current?.getBoundingClientRect().width } }
|
|
916
1056
|
}
|
|
917
1057
|
},
|
|
918
|
-
/* @__PURE__ */
|
|
1058
|
+
/* @__PURE__ */ React23.createElement(PropProvider, { propType: multiSizePropType, value: getMultiSizeValues(), setValue: setNestedProp }, /* @__PURE__ */ React23.createElement(Stack6, { gap: 1.5 }, /* @__PURE__ */ React23.createElement(Grid4, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React23.createElement(MultiSizeValueControl, { item: items[0] }), /* @__PURE__ */ React23.createElement(MultiSizeValueControl, { item: items[1] })), /* @__PURE__ */ React23.createElement(Grid4, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React23.createElement(MultiSizeValueControl, { item: items[3] }), /* @__PURE__ */ React23.createElement(MultiSizeValueControl, { item: items[2] }))))
|
|
919
1059
|
));
|
|
920
1060
|
}
|
|
921
|
-
var MultiSizeValueControl = ({ item }) => /* @__PURE__ */
|
|
1061
|
+
var MultiSizeValueControl = ({ item }) => /* @__PURE__ */ React23.createElement(PropKeyProvider, { bind: item.bind }, /* @__PURE__ */ React23.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(Grid4, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React23.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(ControlLabel, null, item.label)), /* @__PURE__ */ React23.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(SizeControl, { startIcon: item.icon })))));
|
|
922
1062
|
|
|
923
1063
|
// src/controls/linked-dimensions-control.tsx
|
|
924
|
-
import * as
|
|
925
|
-
import {
|
|
1064
|
+
import * as React24 from "react";
|
|
1065
|
+
import {
|
|
1066
|
+
dimensionsPropTypeUtil,
|
|
1067
|
+
sizePropTypeUtil as sizePropTypeUtil3
|
|
1068
|
+
} from "@elementor/editor-props";
|
|
926
1069
|
import { DetachIcon, LinkIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from "@elementor/icons";
|
|
927
1070
|
import { Grid as Grid5, Stack as Stack7, ToggleButton as ToggleButton3 } from "@elementor/ui";
|
|
928
1071
|
import { __ as __7 } from "@wordpress/i18n";
|
|
929
1072
|
var LinkedDimensionsControl = createControl(({ label }) => {
|
|
930
|
-
const { value, setValue, propType } = useBoundProp(
|
|
931
|
-
const {
|
|
932
|
-
const
|
|
1073
|
+
const { value: dimensionsValue, setValue: setDimensionsValue, propType } = useBoundProp(dimensionsPropTypeUtil);
|
|
1074
|
+
const { value: sizeValue, setValue: setSizeValue } = useBoundProp(sizePropTypeUtil3);
|
|
1075
|
+
const isLinked = !dimensionsValue && !sizeValue ? true : !!sizeValue;
|
|
1076
|
+
const setValue = (newValue) => {
|
|
933
1077
|
if (!isLinked) {
|
|
934
|
-
|
|
1078
|
+
setDimensionsValue(newValue);
|
|
1079
|
+
return;
|
|
935
1080
|
}
|
|
936
|
-
|
|
937
|
-
setValue({
|
|
938
|
-
isLinked,
|
|
939
|
-
top: newDimension,
|
|
940
|
-
right: newDimension,
|
|
941
|
-
bottom: newDimension,
|
|
942
|
-
left: newDimension
|
|
943
|
-
});
|
|
1081
|
+
setSizeValue(newValue.top);
|
|
944
1082
|
};
|
|
945
|
-
const
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
1083
|
+
const onLinkToggle = () => {
|
|
1084
|
+
if (!isLinked) {
|
|
1085
|
+
setSizeValue(dimensionsValue?.top.value);
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
const value = sizeValue ? sizePropTypeUtil3.create(sizeValue) : null;
|
|
1089
|
+
setDimensionsValue({
|
|
1090
|
+
top: value,
|
|
1091
|
+
right: value,
|
|
1092
|
+
bottom: value,
|
|
1093
|
+
left: value
|
|
1094
|
+
});
|
|
954
1095
|
};
|
|
955
1096
|
const LinkedIcon = isLinked ? LinkIcon : DetachIcon;
|
|
956
|
-
return /* @__PURE__ */
|
|
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(
|
|
957
1098
|
ToggleButton3,
|
|
958
1099
|
{
|
|
959
1100
|
"aria-label": __7("Link Inputs", "elementor"),
|
|
@@ -961,32 +1102,65 @@ var LinkedDimensionsControl = createControl(({ label }) => {
|
|
|
961
1102
|
value: "check",
|
|
962
1103
|
selected: isLinked,
|
|
963
1104
|
sx: { marginLeft: "auto" },
|
|
964
|
-
onChange:
|
|
1105
|
+
onChange: onLinkToggle
|
|
965
1106
|
},
|
|
966
|
-
/* @__PURE__ */
|
|
967
|
-
)), /* @__PURE__ */
|
|
1107
|
+
/* @__PURE__ */ React24.createElement(LinkedIcon, { fontSize: "tiny" })
|
|
1108
|
+
)), /* @__PURE__ */ React24.createElement(Stack7, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React24.createElement(Grid5, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React24.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(ControlLabel, null, __7("Top", "elementor"))), /* @__PURE__ */ React24.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(
|
|
1109
|
+
Control3,
|
|
1110
|
+
{
|
|
1111
|
+
bind: "top",
|
|
1112
|
+
startIcon: /* @__PURE__ */ React24.createElement(SideTopIcon, { fontSize: "tiny" }),
|
|
1113
|
+
isLinked
|
|
1114
|
+
}
|
|
1115
|
+
))), /* @__PURE__ */ React24.createElement(Grid5, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React24.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(ControlLabel, null, __7("Right", "elementor"))), /* @__PURE__ */ React24.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(
|
|
1116
|
+
Control3,
|
|
1117
|
+
{
|
|
1118
|
+
bind: "right",
|
|
1119
|
+
startIcon: /* @__PURE__ */ React24.createElement(SideRightIcon, { fontSize: "tiny" }),
|
|
1120
|
+
isLinked
|
|
1121
|
+
}
|
|
1122
|
+
)))), /* @__PURE__ */ React24.createElement(Stack7, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React24.createElement(Grid5, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React24.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(ControlLabel, null, __7("Bottom", "elementor"))), /* @__PURE__ */ React24.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(
|
|
1123
|
+
Control3,
|
|
1124
|
+
{
|
|
1125
|
+
bind: "bottom",
|
|
1126
|
+
startIcon: /* @__PURE__ */ React24.createElement(SideBottomIcon, { fontSize: "tiny" }),
|
|
1127
|
+
isLinked
|
|
1128
|
+
}
|
|
1129
|
+
))), /* @__PURE__ */ React24.createElement(Grid5, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React24.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(ControlLabel, null, __7("Left", "elementor"))), /* @__PURE__ */ React24.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(
|
|
1130
|
+
Control3,
|
|
1131
|
+
{
|
|
1132
|
+
bind: "left",
|
|
1133
|
+
startIcon: /* @__PURE__ */ React24.createElement(SideLeftIcon, { fontSize: "tiny" }),
|
|
1134
|
+
isLinked
|
|
1135
|
+
}
|
|
1136
|
+
)))));
|
|
968
1137
|
});
|
|
969
|
-
var Control3 = ({ bind, startIcon }) =>
|
|
1138
|
+
var Control3 = ({ bind, startIcon, isLinked }) => {
|
|
1139
|
+
if (isLinked) {
|
|
1140
|
+
return /* @__PURE__ */ React24.createElement(SizeControl, { startIcon });
|
|
1141
|
+
}
|
|
1142
|
+
return /* @__PURE__ */ React24.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React24.createElement(SizeControl, { startIcon }));
|
|
1143
|
+
};
|
|
970
1144
|
|
|
971
1145
|
// src/controls/font-family-control.tsx
|
|
972
|
-
import { Fragment as Fragment3, useId as
|
|
973
|
-
import * as
|
|
974
|
-
import { stringPropTypeUtil as
|
|
975
|
-
import { ChevronDownIcon, EditIcon, PhotoIcon, SearchIcon, XIcon as
|
|
1146
|
+
import { Fragment as Fragment3, useId as useId3, useState as useState4 } from "react";
|
|
1147
|
+
import * as React25 from "react";
|
|
1148
|
+
import { stringPropTypeUtil as stringPropTypeUtil6 } from "@elementor/editor-props";
|
|
1149
|
+
import { ChevronDownIcon, EditIcon, PhotoIcon, SearchIcon, XIcon as XIcon3 } from "@elementor/icons";
|
|
976
1150
|
import {
|
|
977
1151
|
bindPopover as bindPopover3,
|
|
978
1152
|
bindTrigger as bindTrigger3,
|
|
979
|
-
Box as
|
|
1153
|
+
Box as Box3,
|
|
980
1154
|
Divider,
|
|
981
|
-
IconButton as
|
|
982
|
-
InputAdornment as
|
|
1155
|
+
IconButton as IconButton3,
|
|
1156
|
+
InputAdornment as InputAdornment4,
|
|
983
1157
|
Link,
|
|
984
1158
|
ListSubheader,
|
|
985
1159
|
MenuItem as MenuItem3,
|
|
986
1160
|
MenuList,
|
|
987
1161
|
Popover as Popover3,
|
|
988
1162
|
Stack as Stack8,
|
|
989
|
-
TextField as
|
|
1163
|
+
TextField as TextField6,
|
|
990
1164
|
Typography as Typography4,
|
|
991
1165
|
UnstableTag as UnstableTag2,
|
|
992
1166
|
usePopupState as usePopupState4
|
|
@@ -1026,9 +1200,9 @@ var useFilteredFontFamilies = (fontFamilies, searchValue) => {
|
|
|
1026
1200
|
// src/controls/font-family-control.tsx
|
|
1027
1201
|
var SIZE2 = "tiny";
|
|
1028
1202
|
var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
1029
|
-
const [searchValue, setSearchValue] =
|
|
1030
|
-
const { value: fontFamily, setValue: setFontFamily } = useBoundProp(
|
|
1031
|
-
const popupId =
|
|
1203
|
+
const [searchValue, setSearchValue] = useState4("");
|
|
1204
|
+
const { value: fontFamily, setValue: setFontFamily } = useBoundProp(stringPropTypeUtil6);
|
|
1205
|
+
const popupId = useId3();
|
|
1032
1206
|
const popoverState = usePopupState4({ variant: "popover", popupId });
|
|
1033
1207
|
const filteredFontFamilies = useFilteredFontFamilies(fontFamilies, searchValue);
|
|
1034
1208
|
if (!filteredFontFamilies) {
|
|
@@ -1041,16 +1215,16 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1041
1215
|
setSearchValue("");
|
|
1042
1216
|
popoverState.close();
|
|
1043
1217
|
};
|
|
1044
|
-
return /* @__PURE__ */
|
|
1218
|
+
return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(
|
|
1045
1219
|
UnstableTag2,
|
|
1046
1220
|
{
|
|
1047
1221
|
variant: "outlined",
|
|
1048
1222
|
label: fontFamily,
|
|
1049
|
-
endIcon: /* @__PURE__ */
|
|
1223
|
+
endIcon: /* @__PURE__ */ React25.createElement(ChevronDownIcon, { fontSize: "tiny" }),
|
|
1050
1224
|
...bindTrigger3(popoverState),
|
|
1051
1225
|
fullWidth: true
|
|
1052
1226
|
}
|
|
1053
|
-
), /* @__PURE__ */
|
|
1227
|
+
), /* @__PURE__ */ React25.createElement(
|
|
1054
1228
|
Popover3,
|
|
1055
1229
|
{
|
|
1056
1230
|
disablePortal: true,
|
|
@@ -1059,8 +1233,8 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1059
1233
|
...bindPopover3(popoverState),
|
|
1060
1234
|
onClose: handleClose
|
|
1061
1235
|
},
|
|
1062
|
-
/* @__PURE__ */
|
|
1063
|
-
|
|
1236
|
+
/* @__PURE__ */ React25.createElement(Stack8, null, /* @__PURE__ */ React25.createElement(Stack8, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React25.createElement(EditIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React25.createElement(Typography4, { variant: "subtitle2" }, __9("Font Family", "elementor")), /* @__PURE__ */ React25.createElement(IconButton3, { size: SIZE2, sx: { ml: "auto" }, onClick: handleClose }, /* @__PURE__ */ React25.createElement(XIcon3, { fontSize: SIZE2 }))), /* @__PURE__ */ React25.createElement(Box3, { px: 1.5, pb: 1 }, /* @__PURE__ */ React25.createElement(
|
|
1237
|
+
TextField6,
|
|
1064
1238
|
{
|
|
1065
1239
|
fullWidth: true,
|
|
1066
1240
|
size: SIZE2,
|
|
@@ -1068,12 +1242,12 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1068
1242
|
placeholder: __9("Search", "elementor"),
|
|
1069
1243
|
onChange: handleSearch,
|
|
1070
1244
|
InputProps: {
|
|
1071
|
-
startAdornment: /* @__PURE__ */
|
|
1245
|
+
startAdornment: /* @__PURE__ */ React25.createElement(InputAdornment4, { position: "start" }, /* @__PURE__ */ React25.createElement(SearchIcon, { fontSize: SIZE2 }))
|
|
1072
1246
|
}
|
|
1073
1247
|
}
|
|
1074
|
-
)), /* @__PURE__ */
|
|
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) => {
|
|
1075
1249
|
const isSelected = item === fontFamily;
|
|
1076
|
-
return /* @__PURE__ */
|
|
1250
|
+
return /* @__PURE__ */ React25.createElement(
|
|
1077
1251
|
MenuItem3,
|
|
1078
1252
|
{
|
|
1079
1253
|
key: item,
|
|
@@ -1088,7 +1262,7 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1088
1262
|
},
|
|
1089
1263
|
item
|
|
1090
1264
|
);
|
|
1091
|
-
})))) : /* @__PURE__ */
|
|
1265
|
+
})))) : /* @__PURE__ */ React25.createElement(Stack8, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React25.createElement(PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React25.createElement(Typography4, { align: "center", variant: "caption", color: "text.secondary" }, __9("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React25.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React25.createElement(Typography4, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React25.createElement(
|
|
1092
1266
|
Link,
|
|
1093
1267
|
{
|
|
1094
1268
|
color: "secondary",
|
|
@@ -1102,33 +1276,47 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1102
1276
|
});
|
|
1103
1277
|
|
|
1104
1278
|
// src/controls/url-control.tsx
|
|
1105
|
-
import * as
|
|
1279
|
+
import * as React26 from "react";
|
|
1106
1280
|
import { urlPropTypeUtil } from "@elementor/editor-props";
|
|
1107
|
-
import { TextField as
|
|
1281
|
+
import { TextField as TextField7 } from "@elementor/ui";
|
|
1108
1282
|
var UrlControl = createControl(({ placeholder }) => {
|
|
1109
1283
|
const { value, setValue } = useBoundProp(urlPropTypeUtil);
|
|
1110
1284
|
const handleChange = (event) => setValue(event.target.value);
|
|
1111
|
-
return /* @__PURE__ */
|
|
1285
|
+
return /* @__PURE__ */ React26.createElement(ControlActions, null, /* @__PURE__ */ React26.createElement(
|
|
1286
|
+
TextField7,
|
|
1287
|
+
{
|
|
1288
|
+
size: "tiny",
|
|
1289
|
+
fullWidth: true,
|
|
1290
|
+
value: value ?? "",
|
|
1291
|
+
onChange: handleChange,
|
|
1292
|
+
placeholder
|
|
1293
|
+
}
|
|
1294
|
+
));
|
|
1112
1295
|
});
|
|
1113
1296
|
|
|
1114
1297
|
// src/controls/link-control.tsx
|
|
1115
|
-
import * as
|
|
1116
|
-
import { linkPropTypeUtil } from "@elementor/editor-props";
|
|
1298
|
+
import * as React27 from "react";
|
|
1299
|
+
import { booleanPropTypeUtil, linkPropTypeUtil, urlPropTypeUtil as urlPropTypeUtil2 } from "@elementor/editor-props";
|
|
1117
1300
|
import { MinusIcon, PlusIcon as PlusIcon2 } from "@elementor/icons";
|
|
1118
|
-
import {
|
|
1301
|
+
import { useSessionStorage } from "@elementor/session";
|
|
1302
|
+
import { Collapse, Divider as Divider2, Grid as Grid6, IconButton as IconButton4, Stack as Stack9, Switch } from "@elementor/ui";
|
|
1119
1303
|
import { __ as __10 } from "@wordpress/i18n";
|
|
1120
1304
|
var SIZE3 = "tiny";
|
|
1121
|
-
var
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1305
|
+
var LinkControl = createControl((props) => {
|
|
1306
|
+
const { value, path, setValue, ...propContext } = useBoundProp(linkPropTypeUtil);
|
|
1307
|
+
const [linkSessionValue, setLinkSessionValue] = useSessionStorage(path.join("/"));
|
|
1308
|
+
const { allowCustomValues = false, options = {}, placeholder } = props || {};
|
|
1309
|
+
const onEnabledChange = () => {
|
|
1310
|
+
const { meta } = linkSessionValue ?? {};
|
|
1311
|
+
const { isEnabled } = meta ?? {};
|
|
1312
|
+
if (isEnabled && value) {
|
|
1313
|
+
setValue(null);
|
|
1314
|
+
} else if (linkSessionValue?.value) {
|
|
1315
|
+
setValue(linkSessionValue?.value ?? null);
|
|
1316
|
+
}
|
|
1317
|
+
setLinkSessionValue({ value, meta: { isEnabled: !isEnabled } });
|
|
1318
|
+
};
|
|
1319
|
+
return /* @__PURE__ */ React27.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React27.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React27.createElement(Divider2, null), /* @__PURE__ */ React27.createElement(
|
|
1132
1320
|
Stack9,
|
|
1133
1321
|
{
|
|
1134
1322
|
direction: "row",
|
|
@@ -1137,25 +1325,38 @@ var LinkControl = createControl(() => {
|
|
|
1137
1325
|
alignItems: "center"
|
|
1138
1326
|
}
|
|
1139
1327
|
},
|
|
1140
|
-
/* @__PURE__ */
|
|
1141
|
-
/* @__PURE__ */
|
|
1142
|
-
|
|
1328
|
+
/* @__PURE__ */ React27.createElement(ControlLabel, null, __10("Link", "elementor")),
|
|
1329
|
+
/* @__PURE__ */ React27.createElement(
|
|
1330
|
+
ToggleIconControl,
|
|
1331
|
+
{
|
|
1332
|
+
enabled: linkSessionValue?.meta?.isEnabled ?? false,
|
|
1333
|
+
onIconClick: onEnabledChange,
|
|
1334
|
+
label: __10("Toggle Link", "elementor")
|
|
1335
|
+
}
|
|
1336
|
+
)
|
|
1337
|
+
), /* @__PURE__ */ React27.createElement(Collapse, { in: linkSessionValue?.meta?.isEnabled, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React27.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React27.createElement(PropKeyProvider, { bind: "href" }, /* @__PURE__ */ React27.createElement(
|
|
1338
|
+
AutocompleteControl,
|
|
1339
|
+
{
|
|
1340
|
+
allowCustomValues: Object.keys(options).length ? allowCustomValues : true,
|
|
1341
|
+
options,
|
|
1342
|
+
propType: urlPropTypeUtil2,
|
|
1343
|
+
placeholder
|
|
1344
|
+
}
|
|
1345
|
+
)), /* @__PURE__ */ React27.createElement(PropKeyProvider, { bind: "isTargetBlank" }, /* @__PURE__ */ React27.createElement(SwitchControl, null))))));
|
|
1143
1346
|
});
|
|
1144
|
-
var ToggleIconControl = () => {
|
|
1145
|
-
|
|
1146
|
-
const handleOnChange = () => setValue(!value);
|
|
1147
|
-
return /* @__PURE__ */ React26.createElement(IconButton3, { size: SIZE3, onClick: handleOnChange }, value ? /* @__PURE__ */ React26.createElement(MinusIcon, { fontSize: SIZE3 }) : /* @__PURE__ */ React26.createElement(PlusIcon2, { fontSize: SIZE3 }));
|
|
1347
|
+
var ToggleIconControl = ({ enabled, onIconClick, label }) => {
|
|
1348
|
+
return /* @__PURE__ */ React27.createElement(IconButton4, { size: SIZE3, onClick: onIconClick, "aria-label": label }, enabled ? /* @__PURE__ */ React27.createElement(MinusIcon, { fontSize: SIZE3 }) : /* @__PURE__ */ React27.createElement(PlusIcon2, { fontSize: SIZE3 }));
|
|
1148
1349
|
};
|
|
1149
1350
|
var SwitchControl = () => {
|
|
1150
|
-
const { value = false, setValue } = useBoundProp();
|
|
1351
|
+
const { value = false, setValue } = useBoundProp(booleanPropTypeUtil);
|
|
1151
1352
|
const onChange = () => {
|
|
1152
1353
|
setValue(!value);
|
|
1153
1354
|
};
|
|
1154
|
-
return /* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ React27.createElement(Grid6, { container: true, alignItems: "center", flexWrap: "nowrap", justifyContent: "space-between" }, /* @__PURE__ */ React27.createElement(Grid6, { item: true }, /* @__PURE__ */ React27.createElement(ControlLabel, null, __10("Open in new tab", "elementor"))), /* @__PURE__ */ React27.createElement(Grid6, { item: true }, /* @__PURE__ */ React27.createElement(Switch, { checked: value, onChange })));
|
|
1155
1356
|
};
|
|
1156
1357
|
|
|
1157
1358
|
// src/controls/gap-control.tsx
|
|
1158
|
-
import * as
|
|
1359
|
+
import * as React28 from "react";
|
|
1159
1360
|
import { gapPropTypeUtil } from "@elementor/editor-props";
|
|
1160
1361
|
import { DetachIcon as DetachIcon2, LinkIcon as LinkIcon2 } from "@elementor/icons";
|
|
1161
1362
|
import { Grid as Grid7, Stack as Stack10, ToggleButton as ToggleButton4 } from "@elementor/ui";
|
|
@@ -1183,7 +1384,7 @@ var GapControl = createControl(({ label }) => {
|
|
|
1183
1384
|
setValue(updatedValue);
|
|
1184
1385
|
};
|
|
1185
1386
|
const LinkedIcon = isLinked ? LinkIcon2 : DetachIcon2;
|
|
1186
|
-
return /* @__PURE__ */
|
|
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(
|
|
1187
1388
|
ToggleButton4,
|
|
1188
1389
|
{
|
|
1189
1390
|
"aria-label": __11("Link Inputs", "elementor"),
|
|
@@ -1193,23 +1394,25 @@ var GapControl = createControl(({ label }) => {
|
|
|
1193
1394
|
sx: { marginLeft: "auto" },
|
|
1194
1395
|
onChange: toggleLinked
|
|
1195
1396
|
},
|
|
1196
|
-
/* @__PURE__ */
|
|
1197
|
-
)), /* @__PURE__ */
|
|
1397
|
+
/* @__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))))));
|
|
1198
1399
|
});
|
|
1199
1400
|
|
|
1200
1401
|
// src/controls/background-control/background-control.tsx
|
|
1201
|
-
import * as
|
|
1402
|
+
import * as React30 from "react";
|
|
1202
1403
|
import { backgroundPropTypeUtil } from "@elementor/editor-props";
|
|
1203
1404
|
import { Grid as Grid9, Stack as Stack12 } from "@elementor/ui";
|
|
1204
1405
|
import { __ as __13 } from "@wordpress/i18n";
|
|
1205
1406
|
|
|
1206
1407
|
// src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
|
|
1207
|
-
import * as
|
|
1408
|
+
import * as React29 from "react";
|
|
1208
1409
|
import {
|
|
1209
1410
|
backgroundColorOverlayPropTypeUtil,
|
|
1411
|
+
backgroundImageOverlayPropTypeUtil,
|
|
1210
1412
|
backgroundOverlayPropTypeUtil
|
|
1211
1413
|
} from "@elementor/editor-props";
|
|
1212
1414
|
import { Grid as Grid8, Stack as Stack11, UnstableColorIndicator as UnstableColorIndicator2 } from "@elementor/ui";
|
|
1415
|
+
import { useWpMediaAttachment as useWpMediaAttachment2 } from "@elementor/wp-media";
|
|
1213
1416
|
import { __ as __12 } from "@wordpress/i18n";
|
|
1214
1417
|
var initialBackgroundOverlay = {
|
|
1215
1418
|
$$type: "background-color-overlay",
|
|
@@ -1217,7 +1420,7 @@ var initialBackgroundOverlay = {
|
|
|
1217
1420
|
};
|
|
1218
1421
|
var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
1219
1422
|
const { propType, value: overlayValues, setValue } = useBoundProp(backgroundOverlayPropTypeUtil);
|
|
1220
|
-
return /* @__PURE__ */
|
|
1423
|
+
return /* @__PURE__ */ React29.createElement(PropProvider, { propType, value: overlayValues, setValue }, /* @__PURE__ */ React29.createElement(
|
|
1221
1424
|
Repeater,
|
|
1222
1425
|
{
|
|
1223
1426
|
values: overlayValues ?? [],
|
|
@@ -1232,24 +1435,39 @@ var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
|
1232
1435
|
}
|
|
1233
1436
|
));
|
|
1234
1437
|
});
|
|
1235
|
-
var ItemIcon2 = ({ value }) => /* @__PURE__ */
|
|
1438
|
+
var ItemIcon2 = ({ value }) => /* @__PURE__ */ React29.createElement(UnstableColorIndicator2, { size: "inherit", component: "span", value: value.value });
|
|
1236
1439
|
var ItemContent2 = ({ bind }) => {
|
|
1237
|
-
return /* @__PURE__ */
|
|
1440
|
+
return /* @__PURE__ */ React29.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React29.createElement(Content2, null));
|
|
1238
1441
|
};
|
|
1239
1442
|
var Content2 = () => {
|
|
1240
|
-
|
|
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))))));
|
|
1241
1445
|
};
|
|
1242
1446
|
var ItemLabel2 = ({ value }) => {
|
|
1243
|
-
const
|
|
1244
|
-
|
|
1447
|
+
const type = value.$$type;
|
|
1448
|
+
if (type === "background-color-overlay") {
|
|
1449
|
+
return /* @__PURE__ */ React29.createElement(ItemLabelColor, { value });
|
|
1450
|
+
}
|
|
1451
|
+
if (type === "background-image-overlay") {
|
|
1452
|
+
return /* @__PURE__ */ React29.createElement(ItemLabelImage, { value });
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
var ItemLabelColor = ({ value }) => {
|
|
1456
|
+
return /* @__PURE__ */ React29.createElement("span", null, value.value);
|
|
1457
|
+
};
|
|
1458
|
+
var ItemLabelImage = ({ value }) => {
|
|
1459
|
+
const { data: attachment } = useWpMediaAttachment2(value?.value["image-src"]?.value.id.value || null);
|
|
1460
|
+
const imageTitle = attachment?.title || null;
|
|
1461
|
+
return /* @__PURE__ */ React29.createElement("span", null, imageTitle);
|
|
1245
1462
|
};
|
|
1246
1463
|
|
|
1247
1464
|
// src/controls/background-control/background-control.tsx
|
|
1248
1465
|
var BackgroundControl = createControl(() => {
|
|
1249
1466
|
const propContext = useBoundProp(backgroundPropTypeUtil);
|
|
1250
|
-
return /* @__PURE__ */
|
|
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))))));
|
|
1251
1468
|
});
|
|
1252
1469
|
export {
|
|
1470
|
+
AutocompleteControl,
|
|
1253
1471
|
BackgroundControl,
|
|
1254
1472
|
BoxShadowRepeaterControl,
|
|
1255
1473
|
ColorControl,
|