@elementor/editor-controls 0.7.0 → 0.9.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 +48 -0
- package/dist/index.d.mts +37 -25
- package/dist/index.d.ts +37 -25
- package/dist/index.js +558 -274
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +529 -239
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -6
- package/src/bound-prop-context/prop-key-context.tsx +1 -1
- package/src/components/repeater.tsx +10 -4
- package/src/components/text-field-inner-selection.tsx +2 -2
- package/src/control-actions/control-actions-context.tsx +1 -1
- package/src/control-actions/control-actions.tsx +1 -1
- package/src/controls/autocomplete-control.tsx +99 -80
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx +3 -3
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx +72 -8
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx +1 -1
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx +71 -11
- package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +107 -33
- package/src/controls/box-shadow-repeater-control.tsx +1 -1
- package/src/controls/image-control.tsx +26 -22
- package/src/controls/image-media-control.tsx +1 -1
- package/src/controls/link-control.tsx +134 -17
- package/src/controls/size-control.tsx +1 -1
- package/src/controls/stroke-control.tsx +1 -1
- package/src/controls/svg-media-control.tsx +107 -0
- package/src/create-control-replacement.tsx +2 -2
- package/src/env.ts +5 -0
- package/src/index.ts +2 -1
- package/src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-resolution.tsx +0 -27
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
// src/controls/
|
|
2
|
-
import * as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
// src/controls/autocomplete-control.tsx
|
|
2
|
+
import * as React5 from "react";
|
|
3
|
+
import { XIcon } from "@elementor/icons";
|
|
4
|
+
import {
|
|
5
|
+
Autocomplete,
|
|
6
|
+
Box,
|
|
7
|
+
IconButton,
|
|
8
|
+
InputAdornment,
|
|
9
|
+
TextField
|
|
10
|
+
} from "@elementor/ui";
|
|
6
11
|
|
|
7
12
|
// src/bound-prop-context/prop-context.tsx
|
|
8
13
|
import * as React from "react";
|
|
@@ -153,19 +158,12 @@ var resolveUnionPropType = (propType, key) => {
|
|
|
153
158
|
return resolvedPropType;
|
|
154
159
|
};
|
|
155
160
|
|
|
156
|
-
// src/components/control-label.tsx
|
|
157
|
-
import * as React3 from "react";
|
|
158
|
-
import { Typography } from "@elementor/ui";
|
|
159
|
-
var ControlLabel = ({ children }) => {
|
|
160
|
-
return /* @__PURE__ */ React3.createElement(Typography, { component: "label", variant: "caption", color: "text.secondary" }, children);
|
|
161
|
-
};
|
|
162
|
-
|
|
163
161
|
// src/create-control.tsx
|
|
164
|
-
import * as
|
|
162
|
+
import * as React4 from "react";
|
|
165
163
|
import { ErrorBoundary } from "@elementor/ui";
|
|
166
164
|
|
|
167
165
|
// src/create-control-replacement.tsx
|
|
168
|
-
import * as
|
|
166
|
+
import * as React3 from "react";
|
|
169
167
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
170
168
|
var ControlReplacementContext = createContext3(void 0);
|
|
171
169
|
var ControlReplacementProvider = ({
|
|
@@ -173,7 +171,7 @@ var ControlReplacementProvider = ({
|
|
|
173
171
|
condition,
|
|
174
172
|
children
|
|
175
173
|
}) => {
|
|
176
|
-
return /* @__PURE__ */
|
|
174
|
+
return /* @__PURE__ */ React3.createElement(ControlReplacementContext.Provider, { value: { component, condition } }, children);
|
|
177
175
|
};
|
|
178
176
|
var useControlReplacement = () => {
|
|
179
177
|
const { value } = useBoundProp();
|
|
@@ -202,14 +200,141 @@ function createControl(Component, { supportsReplacements = true } = {}) {
|
|
|
202
200
|
return (props) => {
|
|
203
201
|
const ControlReplacement = useControlReplacement();
|
|
204
202
|
if (ControlReplacement && supportsReplacements) {
|
|
205
|
-
return /* @__PURE__ */
|
|
203
|
+
return /* @__PURE__ */ React4.createElement(ErrorBoundary, { fallback: null }, /* @__PURE__ */ React4.createElement(ControlReplacement, { ...props }));
|
|
206
204
|
}
|
|
207
|
-
return /* @__PURE__ */
|
|
205
|
+
return /* @__PURE__ */ React4.createElement(ErrorBoundary, { fallback: null }, /* @__PURE__ */ React4.createElement(Component, { ...props }));
|
|
208
206
|
};
|
|
209
207
|
}
|
|
210
208
|
|
|
209
|
+
// src/controls/autocomplete-control.tsx
|
|
210
|
+
var AutocompleteControl = createControl(
|
|
211
|
+
(props) => {
|
|
212
|
+
const {
|
|
213
|
+
options,
|
|
214
|
+
optionRestrictedPropTypeUtil,
|
|
215
|
+
onOptionChangeCallback,
|
|
216
|
+
onTextChangeCallback,
|
|
217
|
+
allowCustomValues = false,
|
|
218
|
+
placeholder = "",
|
|
219
|
+
minInputLength = 2,
|
|
220
|
+
customValue
|
|
221
|
+
} = props;
|
|
222
|
+
const { value: selectableValue, setValue: setSelectableValue } = useBoundProp(optionRestrictedPropTypeUtil);
|
|
223
|
+
const value = selectableValue || customValue || "";
|
|
224
|
+
const optionKeys = _factoryFilter(selectableValue || customValue || null, options, minInputLength).map(
|
|
225
|
+
({ id }) => id
|
|
226
|
+
);
|
|
227
|
+
const allowClear = !!value;
|
|
228
|
+
const muiWarningPreventer = allowCustomValues || !!value?.toString()?.length;
|
|
229
|
+
const isOptionEqualToValue = () => {
|
|
230
|
+
return muiWarningPreventer ? void 0 : () => true;
|
|
231
|
+
};
|
|
232
|
+
const hasSelectedValue = !!findMatchingOption(options, selectableValue?.toString());
|
|
233
|
+
const onOptionChange = (newValue) => {
|
|
234
|
+
setSelectableValue(newValue);
|
|
235
|
+
onOptionChangeCallback?.(newValue);
|
|
236
|
+
};
|
|
237
|
+
const onTextChange = (newValue) => {
|
|
238
|
+
onTextChangeCallback?.(newValue);
|
|
239
|
+
};
|
|
240
|
+
return /* @__PURE__ */ React5.createElement(
|
|
241
|
+
Autocomplete,
|
|
242
|
+
{
|
|
243
|
+
forcePopupIcon: false,
|
|
244
|
+
disableClearable: true,
|
|
245
|
+
freeSolo: allowCustomValues,
|
|
246
|
+
value: value?.toString() || "",
|
|
247
|
+
size: "tiny",
|
|
248
|
+
onChange: (_, newValue) => onOptionChange(Number(newValue)),
|
|
249
|
+
readOnly: hasSelectedValue,
|
|
250
|
+
options: optionKeys,
|
|
251
|
+
getOptionKey: (optionId) => findMatchingOption(options, optionId)?.id || optionId,
|
|
252
|
+
getOptionLabel: (optionId) => findMatchingOption(options, optionId)?.label || optionId.toString(),
|
|
253
|
+
groupBy: isCategorizedOptionPool(options) ? (optionId) => findMatchingOption(options, optionId)?.groupLabel || optionId : void 0,
|
|
254
|
+
isOptionEqualToValue: isOptionEqualToValue(),
|
|
255
|
+
filterOptions: () => optionKeys,
|
|
256
|
+
renderOption: (optionProps, optionId) => /* @__PURE__ */ React5.createElement(Box, { component: "li", ...optionProps, key: optionProps.id }, findMatchingOption(options, optionId)?.label ?? optionId),
|
|
257
|
+
renderInput: (params) => /* @__PURE__ */ React5.createElement(
|
|
258
|
+
TextInput,
|
|
259
|
+
{
|
|
260
|
+
params,
|
|
261
|
+
handleChange: onTextChange,
|
|
262
|
+
allowClear,
|
|
263
|
+
placeholder,
|
|
264
|
+
hasSelectedValue
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
var TextInput = ({
|
|
272
|
+
params,
|
|
273
|
+
allowClear,
|
|
274
|
+
placeholder,
|
|
275
|
+
handleChange,
|
|
276
|
+
hasSelectedValue
|
|
277
|
+
}) => {
|
|
278
|
+
const onChange = (event) => {
|
|
279
|
+
handleChange(event.target.value);
|
|
280
|
+
};
|
|
281
|
+
return /* @__PURE__ */ React5.createElement(
|
|
282
|
+
TextField,
|
|
283
|
+
{
|
|
284
|
+
...params,
|
|
285
|
+
placeholder,
|
|
286
|
+
onChange,
|
|
287
|
+
sx: {
|
|
288
|
+
"& .MuiInputBase-input": {
|
|
289
|
+
cursor: hasSelectedValue ? "default" : void 0
|
|
290
|
+
}
|
|
291
|
+
},
|
|
292
|
+
InputProps: {
|
|
293
|
+
...params.InputProps,
|
|
294
|
+
endAdornment: /* @__PURE__ */ React5.createElement(ClearButton, { params, allowClear, handleChange })
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
);
|
|
298
|
+
};
|
|
299
|
+
var ClearButton = ({
|
|
300
|
+
allowClear,
|
|
301
|
+
handleChange,
|
|
302
|
+
params
|
|
303
|
+
}) => /* @__PURE__ */ React5.createElement(InputAdornment, { position: "end" }, allowClear && /* @__PURE__ */ React5.createElement(IconButton, { size: params.size, onClick: () => handleChange(null), sx: { cursor: "pointer" } }, /* @__PURE__ */ React5.createElement(XIcon, { fontSize: params.size })));
|
|
304
|
+
function findMatchingOption(options, optionId = null) {
|
|
305
|
+
return options.find(({ id }) => optionId?.toString() === id.toString());
|
|
306
|
+
}
|
|
307
|
+
function isCategorizedOptionPool(options) {
|
|
308
|
+
return options.every((option) => "groupLabel" in option);
|
|
309
|
+
}
|
|
310
|
+
function _factoryFilter(newValue, options, minInputLength) {
|
|
311
|
+
if (null === newValue) {
|
|
312
|
+
return options;
|
|
313
|
+
}
|
|
314
|
+
const formattedValue = String(newValue || "")?.toLowerCase();
|
|
315
|
+
if (formattedValue.length < minInputLength) {
|
|
316
|
+
return new Array(0);
|
|
317
|
+
}
|
|
318
|
+
return options.filter(
|
|
319
|
+
(option) => String(option.id).toLowerCase().includes(formattedValue) || option.label.toLowerCase().includes(formattedValue)
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// src/controls/image-control.tsx
|
|
324
|
+
import * as React11 from "react";
|
|
325
|
+
import { imagePropTypeUtil } from "@elementor/editor-props";
|
|
326
|
+
import { Grid, Stack as Stack2 } from "@elementor/ui";
|
|
327
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
328
|
+
|
|
329
|
+
// src/components/control-label.tsx
|
|
330
|
+
import * as React6 from "react";
|
|
331
|
+
import { Typography } from "@elementor/ui";
|
|
332
|
+
var ControlLabel = ({ children }) => {
|
|
333
|
+
return /* @__PURE__ */ React6.createElement(Typography, { component: "label", variant: "caption", color: "text.secondary" }, children);
|
|
334
|
+
};
|
|
335
|
+
|
|
211
336
|
// src/controls/image-media-control.tsx
|
|
212
|
-
import * as
|
|
337
|
+
import * as React9 from "react";
|
|
213
338
|
import { imageSrcPropTypeUtil } from "@elementor/editor-props";
|
|
214
339
|
import { UploadIcon } from "@elementor/icons";
|
|
215
340
|
import { Button, Card, CardMedia, CardOverlay, CircularProgress, Stack } from "@elementor/ui";
|
|
@@ -217,14 +342,14 @@ import { useWpMediaAttachment, useWpMediaFrame } from "@elementor/wp-media";
|
|
|
217
342
|
import { __ } from "@wordpress/i18n";
|
|
218
343
|
|
|
219
344
|
// src/control-actions/control-actions.tsx
|
|
220
|
-
import * as
|
|
345
|
+
import * as React8 from "react";
|
|
221
346
|
import { styled, UnstableFloatingActionBar } from "@elementor/ui";
|
|
222
347
|
|
|
223
348
|
// src/control-actions/control-actions-context.tsx
|
|
224
|
-
import * as
|
|
349
|
+
import * as React7 from "react";
|
|
225
350
|
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
226
351
|
var Context = createContext4(null);
|
|
227
|
-
var ControlActionsProvider = ({ children, items }) => /* @__PURE__ */
|
|
352
|
+
var ControlActionsProvider = ({ children, items }) => /* @__PURE__ */ React7.createElement(Context.Provider, { value: { items } }, children);
|
|
228
353
|
var useControlActions = () => {
|
|
229
354
|
const context = useContext4(Context);
|
|
230
355
|
if (!context) {
|
|
@@ -246,8 +371,8 @@ function ControlActions({ children }) {
|
|
|
246
371
|
if (items.length === 0) {
|
|
247
372
|
return children;
|
|
248
373
|
}
|
|
249
|
-
const menuItems = items.map(({ MenuItem:
|
|
250
|
-
return /* @__PURE__ */
|
|
374
|
+
const menuItems = items.map(({ MenuItem: MenuItem5, id }) => /* @__PURE__ */ React8.createElement(MenuItem5, { key: id }));
|
|
375
|
+
return /* @__PURE__ */ React8.createElement(FloatingBarContainer, null, /* @__PURE__ */ React8.createElement(UnstableFloatingActionBar, { actions: menuItems }, children));
|
|
251
376
|
}
|
|
252
377
|
|
|
253
378
|
// src/controls/image-media-control.tsx
|
|
@@ -271,7 +396,7 @@ var ImageMediaControl = createControl((props) => {
|
|
|
271
396
|
});
|
|
272
397
|
}
|
|
273
398
|
});
|
|
274
|
-
return /* @__PURE__ */
|
|
399
|
+
return /* @__PURE__ */ React9.createElement(ControlActions, null, /* @__PURE__ */ React9.createElement(Card, { variant: "outlined" }, /* @__PURE__ */ React9.createElement(CardMedia, { image: src, sx: { height: 150 } }, isFetching ? /* @__PURE__ */ React9.createElement(Stack, { justifyContent: "center", alignItems: "center", width: "100%", height: "100%" }, /* @__PURE__ */ React9.createElement(CircularProgress, null)) : /* @__PURE__ */ React9.createElement(React9.Fragment, null)), /* @__PURE__ */ React9.createElement(CardOverlay, null, /* @__PURE__ */ React9.createElement(Stack, { gap: 1 }, /* @__PURE__ */ React9.createElement(
|
|
275
400
|
Button,
|
|
276
401
|
{
|
|
277
402
|
size: "tiny",
|
|
@@ -280,13 +405,13 @@ var ImageMediaControl = createControl((props) => {
|
|
|
280
405
|
onClick: () => open({ mode: "browse" })
|
|
281
406
|
},
|
|
282
407
|
__("Select Image", "elementor")
|
|
283
|
-
), /* @__PURE__ */
|
|
408
|
+
), /* @__PURE__ */ React9.createElement(
|
|
284
409
|
Button,
|
|
285
410
|
{
|
|
286
411
|
size: "tiny",
|
|
287
412
|
variant: "text",
|
|
288
413
|
color: "inherit",
|
|
289
|
-
startIcon: /* @__PURE__ */
|
|
414
|
+
startIcon: /* @__PURE__ */ React9.createElement(UploadIcon, null),
|
|
290
415
|
onClick: () => open({ mode: "upload" })
|
|
291
416
|
},
|
|
292
417
|
__("Upload Image", "elementor")
|
|
@@ -294,7 +419,7 @@ var ImageMediaControl = createControl((props) => {
|
|
|
294
419
|
});
|
|
295
420
|
|
|
296
421
|
// src/controls/select-control.tsx
|
|
297
|
-
import * as
|
|
422
|
+
import * as React10 from "react";
|
|
298
423
|
import { stringPropTypeUtil } from "@elementor/editor-props";
|
|
299
424
|
import { MenuItem, Select } from "@elementor/ui";
|
|
300
425
|
var SelectControl = createControl(({ options, onChange }) => {
|
|
@@ -304,131 +429,23 @@ var SelectControl = createControl(({ options, onChange }) => {
|
|
|
304
429
|
onChange?.(newValue, value);
|
|
305
430
|
setValue(newValue);
|
|
306
431
|
};
|
|
307
|
-
return /* @__PURE__ */
|
|
432
|
+
return /* @__PURE__ */ React10.createElement(ControlActions, null, /* @__PURE__ */ React10.createElement(Select, { displayEmpty: true, size: "tiny", value: value ?? "", onChange: handleChange, fullWidth: true }, options.map(({ label, ...props }) => /* @__PURE__ */ React10.createElement(MenuItem, { key: props.value, ...props, value: props.value ?? "" }, label))));
|
|
308
433
|
});
|
|
309
434
|
|
|
310
435
|
// src/controls/image-control.tsx
|
|
311
|
-
var ImageControl = createControl(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
// src/controls/autocomplete-control.tsx
|
|
317
|
-
import * as React11 from "react";
|
|
318
|
-
import { stringPropTypeUtil as stringPropTypeUtil2 } from "@elementor/editor-props";
|
|
319
|
-
import { XIcon } from "@elementor/icons";
|
|
320
|
-
import {
|
|
321
|
-
Autocomplete,
|
|
322
|
-
Box,
|
|
323
|
-
IconButton,
|
|
324
|
-
InputAdornment,
|
|
325
|
-
TextField
|
|
326
|
-
} from "@elementor/ui";
|
|
327
|
-
var AutocompleteControl = createControl(
|
|
328
|
-
({
|
|
329
|
-
options,
|
|
330
|
-
placeholder = "",
|
|
331
|
-
allowCustomValues = false,
|
|
332
|
-
propType = stringPropTypeUtil2,
|
|
333
|
-
minInputLength = 2
|
|
334
|
-
}) => {
|
|
335
|
-
const { value = "", setValue } = useBoundProp(propType);
|
|
336
|
-
const hasSelectedValue = !!(value && (options[value] || Object.values(options).find(({ label }) => label === value)));
|
|
337
|
-
const allowClear = !!value;
|
|
338
|
-
const formattedOptions = Object.keys(options);
|
|
339
|
-
const onOptionSelect = (_, newValue) => {
|
|
340
|
-
setValue(newValue);
|
|
341
|
-
};
|
|
342
|
-
const handleChange = (newValue) => {
|
|
343
|
-
setValue(newValue);
|
|
344
|
-
};
|
|
345
|
-
const filterOptions = (_, { inputValue }) => {
|
|
346
|
-
const formattedValue = inputValue?.toLowerCase() || "";
|
|
347
|
-
if (formattedValue.length < minInputLength) {
|
|
348
|
-
return [];
|
|
349
|
-
}
|
|
350
|
-
return formattedOptions.filter(
|
|
351
|
-
(optionValue) => optionValue.toLowerCase().indexOf(formattedValue) !== -1 || options[optionValue].label.toLowerCase().indexOf(formattedValue) !== -1
|
|
352
|
-
);
|
|
353
|
-
};
|
|
354
|
-
const isOptionEqualToValue = () => {
|
|
355
|
-
return muiWarningPreventer() ? void 0 : () => true;
|
|
356
|
-
};
|
|
357
|
-
const muiWarningPreventer = () => allowCustomValues || !!filterOptions([], { inputValue: value }).length;
|
|
358
|
-
return /* @__PURE__ */ React11.createElement(ControlActions, null, /* @__PURE__ */ React11.createElement(
|
|
359
|
-
Autocomplete,
|
|
360
|
-
{
|
|
361
|
-
forcePopupIcon: false,
|
|
362
|
-
disableClearable: true,
|
|
363
|
-
freeSolo: muiWarningPreventer(),
|
|
364
|
-
value: value || "",
|
|
365
|
-
size: "tiny",
|
|
366
|
-
onChange: onOptionSelect,
|
|
367
|
-
readOnly: hasSelectedValue,
|
|
368
|
-
options: formattedOptions,
|
|
369
|
-
getOptionKey: (option) => option,
|
|
370
|
-
getOptionLabel: (option) => options[option]?.label ?? option,
|
|
371
|
-
groupBy: shouldGroupOptions(options) ? (option) => options[option]?.groupLabel : void 0,
|
|
372
|
-
isOptionEqualToValue: isOptionEqualToValue(),
|
|
373
|
-
filterOptions,
|
|
374
|
-
renderOption: (optionProps, option) => /* @__PURE__ */ React11.createElement(Box, { component: "li", ...optionProps, key: optionProps.id }, options[option]?.label ?? option),
|
|
375
|
-
renderInput: (params) => /* @__PURE__ */ React11.createElement(
|
|
376
|
-
TextInput,
|
|
377
|
-
{
|
|
378
|
-
params,
|
|
379
|
-
handleChange,
|
|
380
|
-
allowClear,
|
|
381
|
-
placeholder,
|
|
382
|
-
hasSelectedValue
|
|
383
|
-
}
|
|
384
|
-
)
|
|
385
|
-
}
|
|
386
|
-
));
|
|
436
|
+
var ImageControl = createControl(
|
|
437
|
+
({ sizes, resolutionLabel = __2("Image resolution", "elementor") }) => {
|
|
438
|
+
const propContext = useBoundProp(imagePropTypeUtil);
|
|
439
|
+
return /* @__PURE__ */ React11.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React11.createElement(Stack2, { gap: 1.5 }, /* @__PURE__ */ React11.createElement(PropKeyProvider, { bind: "src" }, /* @__PURE__ */ React11.createElement(ControlLabel, null, " ", __2("Choose image", "elementor"), " "), /* @__PURE__ */ React11.createElement(ImageMediaControl, null)), /* @__PURE__ */ React11.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React11.createElement(Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React11.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React11.createElement(ControlLabel, null, " ", resolutionLabel, " ")), /* @__PURE__ */ React11.createElement(Grid, { item: true, xs: 6 }, /* @__PURE__ */ React11.createElement(SelectControl, { options: sizes }))))));
|
|
387
440
|
}
|
|
388
441
|
);
|
|
389
|
-
var TextInput = ({
|
|
390
|
-
params,
|
|
391
|
-
allowClear,
|
|
392
|
-
placeholder,
|
|
393
|
-
handleChange,
|
|
394
|
-
hasSelectedValue
|
|
395
|
-
}) => {
|
|
396
|
-
const onChange = (event) => {
|
|
397
|
-
handleChange(event.target.value);
|
|
398
|
-
};
|
|
399
|
-
return /* @__PURE__ */ React11.createElement(
|
|
400
|
-
TextField,
|
|
401
|
-
{
|
|
402
|
-
...params,
|
|
403
|
-
placeholder,
|
|
404
|
-
onChange,
|
|
405
|
-
sx: {
|
|
406
|
-
"& .MuiInputBase-input": {
|
|
407
|
-
cursor: hasSelectedValue ? "default" : void 0
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
InputProps: {
|
|
411
|
-
...params.InputProps,
|
|
412
|
-
endAdornment: /* @__PURE__ */ React11.createElement(ClearButton, { params, allowClear, handleChange })
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
);
|
|
416
|
-
};
|
|
417
|
-
var ClearButton = ({
|
|
418
|
-
allowClear,
|
|
419
|
-
handleChange,
|
|
420
|
-
params
|
|
421
|
-
}) => /* @__PURE__ */ React11.createElement(InputAdornment, { position: "end" }, allowClear && /* @__PURE__ */ React11.createElement(IconButton, { size: params.size, onClick: () => handleChange(null), sx: { cursor: "pointer" } }, /* @__PURE__ */ React11.createElement(XIcon, { fontSize: params.size })));
|
|
422
|
-
function shouldGroupOptions(options) {
|
|
423
|
-
return Object.values(options).every((option) => "groupLabel" in option);
|
|
424
|
-
}
|
|
425
442
|
|
|
426
443
|
// src/controls/text-control.tsx
|
|
427
444
|
import * as React12 from "react";
|
|
428
|
-
import { stringPropTypeUtil as
|
|
445
|
+
import { stringPropTypeUtil as stringPropTypeUtil2 } from "@elementor/editor-props";
|
|
429
446
|
import { TextField as TextField2 } from "@elementor/ui";
|
|
430
447
|
var TextControl = createControl(({ placeholder }) => {
|
|
431
|
-
const { value, setValue } = useBoundProp(
|
|
448
|
+
const { value, setValue } = useBoundProp(stringPropTypeUtil2);
|
|
432
449
|
const handleChange = (event) => setValue(event.target.value);
|
|
433
450
|
return /* @__PURE__ */ React12.createElement(ControlActions, null, /* @__PURE__ */ React12.createElement(
|
|
434
451
|
TextField2,
|
|
@@ -444,10 +461,10 @@ var TextControl = createControl(({ placeholder }) => {
|
|
|
444
461
|
|
|
445
462
|
// src/controls/text-area-control.tsx
|
|
446
463
|
import * as React13 from "react";
|
|
447
|
-
import { stringPropTypeUtil as
|
|
464
|
+
import { stringPropTypeUtil as stringPropTypeUtil3 } from "@elementor/editor-props";
|
|
448
465
|
import { TextField as TextField3 } from "@elementor/ui";
|
|
449
466
|
var TextAreaControl = createControl(({ placeholder }) => {
|
|
450
|
-
const { value, setValue } = useBoundProp(
|
|
467
|
+
const { value, setValue } = useBoundProp(stringPropTypeUtil3);
|
|
451
468
|
const handleChange = (event) => {
|
|
452
469
|
setValue(event.target.value);
|
|
453
470
|
};
|
|
@@ -649,12 +666,16 @@ var SIZE = "tiny";
|
|
|
649
666
|
var Repeater = ({
|
|
650
667
|
label,
|
|
651
668
|
itemSettings,
|
|
669
|
+
addToBottom = false,
|
|
652
670
|
values: repeaterValues = [],
|
|
653
671
|
setValues: setRepeaterValues
|
|
654
672
|
}) => {
|
|
655
673
|
const addRepeaterItem = () => {
|
|
656
674
|
const newItem = structuredClone(itemSettings.initialValues);
|
|
657
|
-
|
|
675
|
+
if (addToBottom) {
|
|
676
|
+
return setRepeaterValues([...repeaterValues, newItem]);
|
|
677
|
+
}
|
|
678
|
+
setRepeaterValues([newItem, ...repeaterValues]);
|
|
658
679
|
};
|
|
659
680
|
const duplicateRepeaterItem = (index) => {
|
|
660
681
|
setRepeaterValues([
|
|
@@ -750,13 +771,13 @@ var RepeaterItem = ({
|
|
|
750
771
|
slotProps: {
|
|
751
772
|
paper: {
|
|
752
773
|
ref: setAnchorEl,
|
|
753
|
-
sx: { mt: 0.5,
|
|
774
|
+
sx: { mt: 0.5, width: controlRef.current?.getBoundingClientRect().width }
|
|
754
775
|
}
|
|
755
776
|
},
|
|
756
777
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
757
778
|
...popoverProps
|
|
758
779
|
},
|
|
759
|
-
/* @__PURE__ */ React18.createElement(Box2,
|
|
780
|
+
/* @__PURE__ */ React18.createElement(Box2, null, children({ anchorEl }))
|
|
760
781
|
));
|
|
761
782
|
};
|
|
762
783
|
|
|
@@ -784,7 +805,7 @@ var ItemContent = ({ anchorEl, bind }) => {
|
|
|
784
805
|
};
|
|
785
806
|
var Content = ({ anchorEl }) => {
|
|
786
807
|
const { propType, value, setValue } = useBoundProp(shadowPropTypeUtil);
|
|
787
|
-
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(
|
|
808
|
+
return /* @__PURE__ */ React19.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React19.createElement(Stack5, { gap: 1.5, sx: { p: 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(
|
|
788
809
|
ColorControl,
|
|
789
810
|
{
|
|
790
811
|
slotProps: {
|
|
@@ -856,7 +877,7 @@ var initialShadow = {
|
|
|
856
877
|
|
|
857
878
|
// src/controls/toggle-control.tsx
|
|
858
879
|
import * as React21 from "react";
|
|
859
|
-
import { stringPropTypeUtil as
|
|
880
|
+
import { stringPropTypeUtil as stringPropTypeUtil4 } from "@elementor/editor-props";
|
|
860
881
|
|
|
861
882
|
// src/components/control-toggle-button-group.tsx
|
|
862
883
|
import * as React20 from "react";
|
|
@@ -913,7 +934,7 @@ var ControlToggleButtonGroup = ({
|
|
|
913
934
|
// src/controls/toggle-control.tsx
|
|
914
935
|
var ToggleControl = createControl(
|
|
915
936
|
({ options, fullWidth = false, size = "tiny" }) => {
|
|
916
|
-
const { value, setValue } = useBoundProp(
|
|
937
|
+
const { value, setValue } = useBoundProp(stringPropTypeUtil4);
|
|
917
938
|
const handleToggle = (option) => {
|
|
918
939
|
setValue(option);
|
|
919
940
|
};
|
|
@@ -1135,7 +1156,7 @@ var Control3 = ({ bind, startIcon, isLinked }) => {
|
|
|
1135
1156
|
// src/controls/font-family-control.tsx
|
|
1136
1157
|
import { Fragment as Fragment4, useId as useId3, useState as useState3 } from "react";
|
|
1137
1158
|
import * as React25 from "react";
|
|
1138
|
-
import { stringPropTypeUtil as
|
|
1159
|
+
import { stringPropTypeUtil as stringPropTypeUtil5 } from "@elementor/editor-props";
|
|
1139
1160
|
import { ChevronDownIcon, EditIcon, PhotoIcon, SearchIcon, XIcon as XIcon3 } from "@elementor/icons";
|
|
1140
1161
|
import {
|
|
1141
1162
|
bindPopover as bindPopover3,
|
|
@@ -1191,7 +1212,7 @@ var useFilteredFontFamilies = (fontFamilies, searchValue) => {
|
|
|
1191
1212
|
var SIZE2 = "tiny";
|
|
1192
1213
|
var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
1193
1214
|
const [searchValue, setSearchValue] = useState3("");
|
|
1194
|
-
const { value: fontFamily, setValue: setFontFamily } = useBoundProp(
|
|
1215
|
+
const { value: fontFamily, setValue: setFontFamily } = useBoundProp(stringPropTypeUtil5);
|
|
1195
1216
|
const popupId = useId3();
|
|
1196
1217
|
const popoverState = usePopupState4({ variant: "popover", popupId });
|
|
1197
1218
|
const filteredFontFamilies = useFilteredFontFamilies(fontFamilies, searchValue);
|
|
@@ -1286,7 +1307,9 @@ var UrlControl = createControl(({ placeholder }) => {
|
|
|
1286
1307
|
|
|
1287
1308
|
// src/controls/link-control.tsx
|
|
1288
1309
|
import * as React27 from "react";
|
|
1289
|
-
import {
|
|
1310
|
+
import { useState as useState4 } from "react";
|
|
1311
|
+
import { booleanPropTypeUtil, linkPropTypeUtil, numberPropTypeUtil as numberPropTypeUtil2 } from "@elementor/editor-props";
|
|
1312
|
+
import { httpService } from "@elementor/http";
|
|
1290
1313
|
import { MinusIcon, PlusIcon as PlusIcon2 } from "@elementor/icons";
|
|
1291
1314
|
import { useSessionStorage } from "@elementor/session";
|
|
1292
1315
|
import { Collapse, Divider as Divider2, Grid as Grid6, IconButton as IconButton4, Stack as Stack9, Switch } from "@elementor/ui";
|
|
@@ -1295,17 +1318,58 @@ var SIZE3 = "tiny";
|
|
|
1295
1318
|
var LinkControl = createControl((props) => {
|
|
1296
1319
|
const { value, path, setValue, ...propContext } = useBoundProp(linkPropTypeUtil);
|
|
1297
1320
|
const [linkSessionValue, setLinkSessionValue] = useSessionStorage(path.join("/"));
|
|
1298
|
-
const {
|
|
1321
|
+
const {
|
|
1322
|
+
allowCustomValues,
|
|
1323
|
+
queryOptions: { endpoint = "", requestParams = {} },
|
|
1324
|
+
placeholder,
|
|
1325
|
+
minInputLength = 2
|
|
1326
|
+
} = props || {};
|
|
1327
|
+
const [options, setOptions] = useState4(
|
|
1328
|
+
generateFirstLoadedOption(value)
|
|
1329
|
+
);
|
|
1299
1330
|
const onEnabledChange = () => {
|
|
1300
1331
|
const { meta } = linkSessionValue ?? {};
|
|
1301
1332
|
const { isEnabled } = meta ?? {};
|
|
1302
|
-
|
|
1303
|
-
setValue(null);
|
|
1304
|
-
} else if (linkSessionValue?.value) {
|
|
1305
|
-
setValue(linkSessionValue?.value ?? null);
|
|
1306
|
-
}
|
|
1333
|
+
setValue(isEnabled ? null : linkSessionValue?.value ?? { destination: null });
|
|
1307
1334
|
setLinkSessionValue({ value, meta: { isEnabled: !isEnabled } });
|
|
1308
1335
|
};
|
|
1336
|
+
const onOptionChange = (newValue) => {
|
|
1337
|
+
const valueToSave = {
|
|
1338
|
+
...value,
|
|
1339
|
+
destination: { $$type: "number", value: newValue },
|
|
1340
|
+
label: {
|
|
1341
|
+
$$type: "string",
|
|
1342
|
+
value: findMatchingOption(options, newValue?.toString())?.label || ""
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
onSaveNewValue(valueToSave);
|
|
1346
|
+
};
|
|
1347
|
+
const onTextChange = (newValue) => {
|
|
1348
|
+
const valueToSave = {
|
|
1349
|
+
...value,
|
|
1350
|
+
destination: { $$type: "url", value: newValue },
|
|
1351
|
+
label: null
|
|
1352
|
+
};
|
|
1353
|
+
onSaveNewValue(valueToSave);
|
|
1354
|
+
updateOptions(newValue);
|
|
1355
|
+
};
|
|
1356
|
+
const onSaveNewValue = (newValue) => {
|
|
1357
|
+
setValue(newValue);
|
|
1358
|
+
setLinkSessionValue({ ...linkSessionValue, value: newValue });
|
|
1359
|
+
};
|
|
1360
|
+
const updateOptions = (newValue) => {
|
|
1361
|
+
setOptions([]);
|
|
1362
|
+
if (!newValue || !endpoint || newValue.length < minInputLength) {
|
|
1363
|
+
return;
|
|
1364
|
+
}
|
|
1365
|
+
debounceFetch(newValue)();
|
|
1366
|
+
};
|
|
1367
|
+
const debounceFetch = (newValue) => debounce(
|
|
1368
|
+
() => fetchOptions(endpoint, { ...requestParams, term: newValue }).then((newOptions) => {
|
|
1369
|
+
setOptions(formatOptions(newOptions));
|
|
1370
|
+
}),
|
|
1371
|
+
400
|
|
1372
|
+
);
|
|
1309
1373
|
return /* @__PURE__ */ React27.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React27.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React27.createElement(Divider2, null), /* @__PURE__ */ React27.createElement(
|
|
1310
1374
|
Stack9,
|
|
1311
1375
|
{
|
|
@@ -1324,13 +1388,17 @@ var LinkControl = createControl((props) => {
|
|
|
1324
1388
|
label: __10("Toggle Link", "elementor")
|
|
1325
1389
|
}
|
|
1326
1390
|
)
|
|
1327
|
-
), /* @__PURE__ */ React27.createElement(Collapse, { in: linkSessionValue?.meta?.isEnabled, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React27.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React27.createElement(PropKeyProvider, { bind: "
|
|
1391
|
+
), /* @__PURE__ */ React27.createElement(Collapse, { in: linkSessionValue?.meta?.isEnabled, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React27.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React27.createElement(PropKeyProvider, { bind: "destination" }, /* @__PURE__ */ React27.createElement(
|
|
1328
1392
|
AutocompleteControl,
|
|
1329
1393
|
{
|
|
1330
|
-
allowCustomValues: Object.keys(options).length ? allowCustomValues : true,
|
|
1331
1394
|
options,
|
|
1332
|
-
|
|
1333
|
-
placeholder
|
|
1395
|
+
allowCustomValues,
|
|
1396
|
+
placeholder,
|
|
1397
|
+
optionRestrictedPropTypeUtil: numberPropTypeUtil2,
|
|
1398
|
+
onOptionChangeCallback: onOptionChange,
|
|
1399
|
+
onTextChangeCallback: onTextChange,
|
|
1400
|
+
minInputLength,
|
|
1401
|
+
customValue: value?.destination?.value?.toString()
|
|
1334
1402
|
}
|
|
1335
1403
|
)), /* @__PURE__ */ React27.createElement(PropKeyProvider, { bind: "isTargetBlank" }, /* @__PURE__ */ React27.createElement(SwitchControl, null))))));
|
|
1336
1404
|
});
|
|
@@ -1339,11 +1407,48 @@ var ToggleIconControl = ({ enabled, onIconClick, label }) => {
|
|
|
1339
1407
|
};
|
|
1340
1408
|
var SwitchControl = () => {
|
|
1341
1409
|
const { value = false, setValue } = useBoundProp(booleanPropTypeUtil);
|
|
1342
|
-
const
|
|
1410
|
+
const onClick = () => {
|
|
1343
1411
|
setValue(!value);
|
|
1344
1412
|
};
|
|
1345
|
-
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,
|
|
1413
|
+
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, onClick })));
|
|
1346
1414
|
};
|
|
1415
|
+
async function fetchOptions(ajaxUrl, params) {
|
|
1416
|
+
if (!params || !ajaxUrl) {
|
|
1417
|
+
return [];
|
|
1418
|
+
}
|
|
1419
|
+
try {
|
|
1420
|
+
const { data: response } = await httpService().get(ajaxUrl, { params });
|
|
1421
|
+
return response.data.value;
|
|
1422
|
+
} catch {
|
|
1423
|
+
return [];
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
function formatOptions(options) {
|
|
1427
|
+
const compareKey = isCategorizedOptionPool(options) ? "groupLabel" : "label";
|
|
1428
|
+
return options.sort(
|
|
1429
|
+
(a, b) => a[compareKey] && b[compareKey] ? a[compareKey].localeCompare(b[compareKey]) : 0
|
|
1430
|
+
);
|
|
1431
|
+
}
|
|
1432
|
+
function generateFirstLoadedOption(unionValue) {
|
|
1433
|
+
const value = unionValue?.destination?.value;
|
|
1434
|
+
const label = unionValue?.label?.value;
|
|
1435
|
+
const type = unionValue?.destination?.$$type || "url";
|
|
1436
|
+
return value && label && type === "number" ? [
|
|
1437
|
+
{
|
|
1438
|
+
id: value.toString(),
|
|
1439
|
+
label
|
|
1440
|
+
}
|
|
1441
|
+
] : [];
|
|
1442
|
+
}
|
|
1443
|
+
function debounce(fn, timeout) {
|
|
1444
|
+
let timer;
|
|
1445
|
+
return (...args) => {
|
|
1446
|
+
clearTimeout(timer);
|
|
1447
|
+
timer = setTimeout(() => {
|
|
1448
|
+
fn(...args);
|
|
1449
|
+
}, timeout);
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1347
1452
|
|
|
1348
1453
|
// src/controls/gap-control.tsx
|
|
1349
1454
|
import * as React28 from "react";
|
|
@@ -1391,10 +1496,99 @@ var Control4 = ({ bind, isLinked }) => {
|
|
|
1391
1496
|
return /* @__PURE__ */ React28.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React28.createElement(SizeControl, null));
|
|
1392
1497
|
};
|
|
1393
1498
|
|
|
1499
|
+
// src/controls/svg-media-control.tsx
|
|
1500
|
+
import * as React29 from "react";
|
|
1501
|
+
import { imageSrcPropTypeUtil as imageSrcPropTypeUtil2 } from "@elementor/editor-props";
|
|
1502
|
+
import { UploadIcon as UploadIcon2 } from "@elementor/icons";
|
|
1503
|
+
import { Button as Button3, Card as Card2, CardMedia as CardMedia2, CardOverlay as CardOverlay2, CircularProgress as CircularProgress2, Stack as Stack11, styled as styled3 } from "@elementor/ui";
|
|
1504
|
+
import { useWpMediaAttachment as useWpMediaAttachment2, useWpMediaFrame as useWpMediaFrame2 } from "@elementor/wp-media";
|
|
1505
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
1506
|
+
var TILE_SIZE = 8;
|
|
1507
|
+
var TILE_WHITE = "transparent";
|
|
1508
|
+
var TILE_BLACK = "#c1c1c1";
|
|
1509
|
+
var TILES_GRADIENT_FORMULA = `linear-gradient(45deg, ${TILE_BLACK} 25%, ${TILE_WHITE} 0, ${TILE_WHITE} 75%, ${TILE_BLACK} 0, ${TILE_BLACK})`;
|
|
1510
|
+
var StyledCard = styled3(Card2)`
|
|
1511
|
+
background-color: white;
|
|
1512
|
+
background-image: ${TILES_GRADIENT_FORMULA}, ${TILES_GRADIENT_FORMULA};
|
|
1513
|
+
background-size: ${TILE_SIZE}px ${TILE_SIZE}px;
|
|
1514
|
+
background-position:
|
|
1515
|
+
0 0,
|
|
1516
|
+
${TILE_SIZE / 2}px ${TILE_SIZE / 2}px;
|
|
1517
|
+
border: none;
|
|
1518
|
+
`;
|
|
1519
|
+
var StyledCardMediaContainer = styled3(Stack11)`
|
|
1520
|
+
position: relative;
|
|
1521
|
+
height: 140px;
|
|
1522
|
+
object-fit: contain;
|
|
1523
|
+
padding: 5px;
|
|
1524
|
+
justify-content: center;
|
|
1525
|
+
align-items: center;
|
|
1526
|
+
background-color: rgba( 255, 255, 255, 0.37 );
|
|
1527
|
+
`;
|
|
1528
|
+
var SvgMediaControl = createControl(() => {
|
|
1529
|
+
const { value, setValue } = useBoundProp(imageSrcPropTypeUtil2);
|
|
1530
|
+
const { id, url } = value ?? {};
|
|
1531
|
+
const { data: attachment, isFetching } = useWpMediaAttachment2(id?.value || null);
|
|
1532
|
+
const src = attachment?.url ?? url?.value ?? null;
|
|
1533
|
+
const { open } = useWpMediaFrame2({
|
|
1534
|
+
types: ["image/svg+xml"],
|
|
1535
|
+
allowedExtensions: ["svg"],
|
|
1536
|
+
multiple: false,
|
|
1537
|
+
selected: id?.value || null,
|
|
1538
|
+
onSelect: (selectedAttachment) => {
|
|
1539
|
+
setValue({
|
|
1540
|
+
id: {
|
|
1541
|
+
$$type: "image-attachment-id",
|
|
1542
|
+
value: selectedAttachment.id
|
|
1543
|
+
},
|
|
1544
|
+
url: null
|
|
1545
|
+
});
|
|
1546
|
+
}
|
|
1547
|
+
});
|
|
1548
|
+
return /* @__PURE__ */ React29.createElement(Stack11, { gap: 1 }, /* @__PURE__ */ React29.createElement(ControlLabel, null, " ", __12("Choose SVG", "elementor"), " "), /* @__PURE__ */ React29.createElement(ControlActions, null, /* @__PURE__ */ React29.createElement(StyledCard, { variant: "outlined" }, /* @__PURE__ */ React29.createElement(StyledCardMediaContainer, null, isFetching ? /* @__PURE__ */ React29.createElement(CircularProgress2, { role: "progressbar" }) : /* @__PURE__ */ React29.createElement(
|
|
1549
|
+
CardMedia2,
|
|
1550
|
+
{
|
|
1551
|
+
component: "img",
|
|
1552
|
+
image: src,
|
|
1553
|
+
alt: __12("Preview SVG", "elementor"),
|
|
1554
|
+
sx: { maxHeight: "140px", width: "50px" }
|
|
1555
|
+
}
|
|
1556
|
+
)), /* @__PURE__ */ React29.createElement(
|
|
1557
|
+
CardOverlay2,
|
|
1558
|
+
{
|
|
1559
|
+
sx: {
|
|
1560
|
+
"&:hover": {
|
|
1561
|
+
backgroundColor: "rgba( 0, 0, 0, 0.75 )"
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
},
|
|
1565
|
+
/* @__PURE__ */ React29.createElement(Stack11, { gap: 1 }, /* @__PURE__ */ React29.createElement(
|
|
1566
|
+
Button3,
|
|
1567
|
+
{
|
|
1568
|
+
size: "tiny",
|
|
1569
|
+
color: "inherit",
|
|
1570
|
+
variant: "outlined",
|
|
1571
|
+
onClick: () => open({ mode: "browse" })
|
|
1572
|
+
},
|
|
1573
|
+
__12("Select SVG", "elementor")
|
|
1574
|
+
), /* @__PURE__ */ React29.createElement(
|
|
1575
|
+
Button3,
|
|
1576
|
+
{
|
|
1577
|
+
size: "tiny",
|
|
1578
|
+
variant: "text",
|
|
1579
|
+
color: "inherit",
|
|
1580
|
+
startIcon: /* @__PURE__ */ React29.createElement(UploadIcon2, null),
|
|
1581
|
+
onClick: () => open({ mode: "upload" })
|
|
1582
|
+
},
|
|
1583
|
+
__12("Upload SVG", "elementor")
|
|
1584
|
+
))
|
|
1585
|
+
))));
|
|
1586
|
+
});
|
|
1587
|
+
|
|
1394
1588
|
// src/controls/background-control/background-control.tsx
|
|
1395
1589
|
import * as React35 from "react";
|
|
1396
1590
|
import { backgroundPropTypeUtil } from "@elementor/editor-props";
|
|
1397
|
-
import { Grid as
|
|
1591
|
+
import { Grid as Grid13, Stack as Stack13 } from "@elementor/ui";
|
|
1398
1592
|
import { __ as __18 } from "@wordpress/i18n";
|
|
1399
1593
|
|
|
1400
1594
|
// src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
|
|
@@ -1404,112 +1598,132 @@ import {
|
|
|
1404
1598
|
backgroundImageOverlayPropTypeUtil,
|
|
1405
1599
|
backgroundOverlayPropTypeUtil
|
|
1406
1600
|
} from "@elementor/editor-props";
|
|
1407
|
-
import { Box as Box4, Grid as
|
|
1408
|
-
import { useWpMediaAttachment as
|
|
1601
|
+
import { Box as Box4, CardMedia as CardMedia3, Grid as Grid12, Stack as Stack12, Tab, TabPanel, Tabs, UnstableColorIndicator as UnstableColorIndicator2, useTabs } from "@elementor/ui";
|
|
1602
|
+
import { useWpMediaAttachment as useWpMediaAttachment3 } from "@elementor/wp-media";
|
|
1409
1603
|
import { __ as __17 } from "@wordpress/i18n";
|
|
1410
1604
|
|
|
1605
|
+
// src/env.ts
|
|
1606
|
+
import { parseEnv } from "@elementor/env";
|
|
1607
|
+
var { env } = parseEnv("@elementor/editor-controls");
|
|
1608
|
+
|
|
1411
1609
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-attachment.tsx
|
|
1412
|
-
import * as
|
|
1610
|
+
import * as React30 from "react";
|
|
1413
1611
|
import { PinIcon, PinnedOffIcon } from "@elementor/icons";
|
|
1414
1612
|
import { Grid as Grid8 } from "@elementor/ui";
|
|
1415
|
-
import { __ as
|
|
1613
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
1416
1614
|
var attachmentControlOptions = [
|
|
1417
1615
|
{
|
|
1418
1616
|
value: "fixed",
|
|
1419
|
-
label:
|
|
1420
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
1617
|
+
label: __13("Fixed", "elementor"),
|
|
1618
|
+
renderContent: ({ size }) => /* @__PURE__ */ React30.createElement(PinIcon, { fontSize: size }),
|
|
1421
1619
|
showTooltip: true
|
|
1422
1620
|
},
|
|
1423
1621
|
{
|
|
1424
1622
|
value: "scroll",
|
|
1425
|
-
label:
|
|
1426
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
1623
|
+
label: __13("Scroll", "elementor"),
|
|
1624
|
+
renderContent: ({ size }) => /* @__PURE__ */ React30.createElement(PinnedOffIcon, { fontSize: size }),
|
|
1427
1625
|
showTooltip: true
|
|
1428
1626
|
}
|
|
1429
1627
|
];
|
|
1430
1628
|
var BackgroundImageOverlayAttachment = () => {
|
|
1431
|
-
return /* @__PURE__ */
|
|
1629
|
+
return /* @__PURE__ */ React30.createElement(Grid8, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React30.createElement(Grid8, { item: true, xs: 6 }, /* @__PURE__ */ React30.createElement(ControlLabel, null, __13("Attachment", "elementor"))), /* @__PURE__ */ React30.createElement(Grid8, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React30.createElement(ToggleControl, { options: attachmentControlOptions })));
|
|
1432
1630
|
};
|
|
1433
1631
|
|
|
1434
1632
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-position.tsx
|
|
1435
|
-
import * as
|
|
1436
|
-
import {
|
|
1437
|
-
import {
|
|
1633
|
+
import * as React31 from "react";
|
|
1634
|
+
import { backgroundImagePositionOffsetPropTypeUtil, stringPropTypeUtil as stringPropTypeUtil6 } from "@elementor/editor-props";
|
|
1635
|
+
import { LetterXIcon, LetterYIcon } from "@elementor/icons";
|
|
1636
|
+
import { Grid as Grid9, MenuItem as MenuItem4, Select as Select2 } from "@elementor/ui";
|
|
1637
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
1438
1638
|
var backgroundPositionOptions = [
|
|
1439
|
-
{ label:
|
|
1440
|
-
{ label:
|
|
1441
|
-
{ label:
|
|
1442
|
-
{ label:
|
|
1443
|
-
{ label:
|
|
1444
|
-
{ label:
|
|
1445
|
-
{ label:
|
|
1446
|
-
{ label:
|
|
1447
|
-
{ label:
|
|
1639
|
+
{ label: __14("Center Center", "elementor"), value: "center center" },
|
|
1640
|
+
{ label: __14("Center Left", "elementor"), value: "center left" },
|
|
1641
|
+
{ label: __14("Center Right", "elementor"), value: "center right" },
|
|
1642
|
+
{ label: __14("Top Center", "elementor"), value: "top center" },
|
|
1643
|
+
{ label: __14("Top Left", "elementor"), value: "top left" },
|
|
1644
|
+
{ label: __14("Top Right", "elementor"), value: "top right" },
|
|
1645
|
+
{ label: __14("Bottom Center", "elementor"), value: "bottom center" },
|
|
1646
|
+
{ label: __14("Bottom Left", "elementor"), value: "bottom left" },
|
|
1647
|
+
{ label: __14("Bottom Right", "elementor"), value: "bottom right" },
|
|
1648
|
+
{ label: __14("Custom", "elementor"), value: "custom" }
|
|
1448
1649
|
];
|
|
1449
1650
|
var BackgroundImageOverlayPosition = () => {
|
|
1450
|
-
|
|
1651
|
+
const backgroundImageOffsetContext = useBoundProp(backgroundImagePositionOffsetPropTypeUtil);
|
|
1652
|
+
const stringPropContext = useBoundProp(stringPropTypeUtil6);
|
|
1653
|
+
const isCustom = !!backgroundImageOffsetContext.value;
|
|
1654
|
+
const handlePositionChange = (event) => {
|
|
1655
|
+
const value = event.target.value || null;
|
|
1656
|
+
if (value === "custom") {
|
|
1657
|
+
backgroundImageOffsetContext.setValue({ x: null, y: null });
|
|
1658
|
+
} else {
|
|
1659
|
+
stringPropContext.setValue(value);
|
|
1660
|
+
}
|
|
1661
|
+
};
|
|
1662
|
+
return /* @__PURE__ */ React31.createElement(Grid9, { container: true, spacing: 2 }, /* @__PURE__ */ React31.createElement(Grid9, { item: true, xs: 12 }, /* @__PURE__ */ React31.createElement(Grid9, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React31.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React31.createElement(ControlLabel, null, __14("Position", "elementor"))), /* @__PURE__ */ React31.createElement(Grid9, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React31.createElement(
|
|
1663
|
+
Select2,
|
|
1664
|
+
{
|
|
1665
|
+
size: "tiny",
|
|
1666
|
+
value: (backgroundImageOffsetContext.value ? "custom" : stringPropContext.value) ?? "",
|
|
1667
|
+
onChange: handlePositionChange,
|
|
1668
|
+
fullWidth: true
|
|
1669
|
+
},
|
|
1670
|
+
backgroundPositionOptions.map(({ label, value }) => /* @__PURE__ */ React31.createElement(MenuItem4, { key: value, value: value ?? "" }, label))
|
|
1671
|
+
)))), isCustom ? /* @__PURE__ */ React31.createElement(PropProvider, { ...backgroundImageOffsetContext }, /* @__PURE__ */ React31.createElement(Grid9, { item: true, xs: 12 }, /* @__PURE__ */ React31.createElement(Grid9, { container: true, spacing: 2 }, /* @__PURE__ */ React31.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React31.createElement(PropKeyProvider, { bind: "x" }, /* @__PURE__ */ React31.createElement(SizeControl, { startIcon: /* @__PURE__ */ React31.createElement(LetterXIcon, { fontSize: "tiny" }) }))), /* @__PURE__ */ React31.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React31.createElement(PropKeyProvider, { bind: "y" }, /* @__PURE__ */ React31.createElement(SizeControl, { startIcon: /* @__PURE__ */ React31.createElement(LetterYIcon, { fontSize: "tiny" }) })))))) : null);
|
|
1451
1672
|
};
|
|
1452
1673
|
|
|
1453
1674
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-repeat.tsx
|
|
1454
|
-
import * as
|
|
1675
|
+
import * as React32 from "react";
|
|
1455
1676
|
import { DotsHorizontalIcon, DotsVerticalIcon, GridDotsIcon, XIcon as XIcon4 } from "@elementor/icons";
|
|
1456
1677
|
import { Grid as Grid10 } from "@elementor/ui";
|
|
1457
|
-
import { __ as
|
|
1678
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
1458
1679
|
var repeatControlOptions = [
|
|
1459
1680
|
{
|
|
1460
1681
|
value: "repeat",
|
|
1461
|
-
label:
|
|
1462
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
1682
|
+
label: __15("Repeat", "elementor"),
|
|
1683
|
+
renderContent: ({ size }) => /* @__PURE__ */ React32.createElement(GridDotsIcon, { fontSize: size }),
|
|
1463
1684
|
showTooltip: true
|
|
1464
1685
|
},
|
|
1465
1686
|
{
|
|
1466
1687
|
value: "repeat-x",
|
|
1467
|
-
label:
|
|
1468
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
1688
|
+
label: __15("Repeat-x", "elementor"),
|
|
1689
|
+
renderContent: ({ size }) => /* @__PURE__ */ React32.createElement(DotsHorizontalIcon, { fontSize: size }),
|
|
1469
1690
|
showTooltip: true
|
|
1470
1691
|
},
|
|
1471
1692
|
{
|
|
1472
1693
|
value: "repeat-y",
|
|
1473
|
-
label:
|
|
1474
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
1694
|
+
label: __15("Repeat-y", "elementor"),
|
|
1695
|
+
renderContent: ({ size }) => /* @__PURE__ */ React32.createElement(DotsVerticalIcon, { fontSize: size }),
|
|
1475
1696
|
showTooltip: true
|
|
1476
1697
|
},
|
|
1477
1698
|
{
|
|
1478
1699
|
value: "no-repeat",
|
|
1479
|
-
label:
|
|
1480
|
-
renderContent: ({ size }) => /* @__PURE__ */
|
|
1700
|
+
label: __15("No-Repeat", "elementor"),
|
|
1701
|
+
renderContent: ({ size }) => /* @__PURE__ */ React32.createElement(XIcon4, { fontSize: size }),
|
|
1481
1702
|
showTooltip: true
|
|
1482
1703
|
}
|
|
1483
1704
|
];
|
|
1484
1705
|
var BackgroundImageOverlayRepeat = () => {
|
|
1485
|
-
return /* @__PURE__ */
|
|
1486
|
-
};
|
|
1487
|
-
|
|
1488
|
-
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-resolution.tsx
|
|
1489
|
-
import * as React32 from "react";
|
|
1490
|
-
import { Grid as Grid11 } from "@elementor/ui";
|
|
1491
|
-
import { __ as __15 } from "@wordpress/i18n";
|
|
1492
|
-
var backgroundResolutionOptions = [
|
|
1493
|
-
{ label: __15("Thumbnail - 150 x 150", "elementor"), value: "thumbnail" },
|
|
1494
|
-
{ label: __15("Medium - 300 x 300", "elementor"), value: "medium" },
|
|
1495
|
-
{ label: __15("Medium Large - 768 x 768"), value: "medium_large" },
|
|
1496
|
-
{ label: __15("Large 1024 x 1024", "elementor"), value: "large" },
|
|
1497
|
-
{ label: __15("Full", "elementor"), value: "full" }
|
|
1498
|
-
];
|
|
1499
|
-
var BackgroundImageOverlayResolution = () => {
|
|
1500
|
-
return /* @__PURE__ */ React32.createElement(Grid11, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React32.createElement(Grid11, { item: true, xs: 6 }, /* @__PURE__ */ React32.createElement(ControlLabel, null, __15("Resolution", "elementor"))), /* @__PURE__ */ React32.createElement(Grid11, { item: true, xs: 6 }, /* @__PURE__ */ React32.createElement(SelectControl, { options: backgroundResolutionOptions })));
|
|
1706
|
+
return /* @__PURE__ */ React32.createElement(Grid10, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React32.createElement(Grid10, { item: true, xs: 6 }, /* @__PURE__ */ React32.createElement(ControlLabel, null, __15("Repeat", "elementor"))), /* @__PURE__ */ React32.createElement(Grid10, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React32.createElement(ToggleControl, { options: repeatControlOptions })));
|
|
1501
1707
|
};
|
|
1502
1708
|
|
|
1503
1709
|
// src/controls/background-control/background-overlay/background-image-overlay/background-image-overlay-size.tsx
|
|
1504
1710
|
import * as React33 from "react";
|
|
1505
|
-
import {
|
|
1506
|
-
import {
|
|
1711
|
+
import { backgroundImageSizeScalePropTypeUtil, stringPropTypeUtil as stringPropTypeUtil7 } from "@elementor/editor-props";
|
|
1712
|
+
import {
|
|
1713
|
+
ArrowBarBothIcon,
|
|
1714
|
+
ArrowsMaximizeIcon,
|
|
1715
|
+
ArrowsMoveHorizontalIcon,
|
|
1716
|
+
ArrowsMoveVerticalIcon,
|
|
1717
|
+
LetterAIcon,
|
|
1718
|
+
PencilIcon
|
|
1719
|
+
} from "@elementor/icons";
|
|
1720
|
+
import { Grid as Grid11 } from "@elementor/ui";
|
|
1507
1721
|
import { __ as __16 } from "@wordpress/i18n";
|
|
1508
1722
|
var sizeControlOptions = [
|
|
1509
1723
|
{
|
|
1510
1724
|
value: "auto",
|
|
1511
1725
|
label: __16("Auto", "elementor"),
|
|
1512
|
-
renderContent: () =>
|
|
1726
|
+
renderContent: ({ size }) => /* @__PURE__ */ React33.createElement(LetterAIcon, { fontSize: size }),
|
|
1513
1727
|
showTooltip: true
|
|
1514
1728
|
},
|
|
1515
1729
|
{
|
|
@@ -1523,28 +1737,67 @@ var sizeControlOptions = [
|
|
|
1523
1737
|
label: __16("Contain", "elementor"),
|
|
1524
1738
|
renderContent: ({ size }) => /* @__PURE__ */ React33.createElement(ArrowBarBothIcon, { fontSize: size }),
|
|
1525
1739
|
showTooltip: true
|
|
1740
|
+
},
|
|
1741
|
+
{
|
|
1742
|
+
value: "custom",
|
|
1743
|
+
label: __16("Custom", "elementor"),
|
|
1744
|
+
renderContent: ({ size }) => /* @__PURE__ */ React33.createElement(PencilIcon, { fontSize: size }),
|
|
1745
|
+
showTooltip: true
|
|
1526
1746
|
}
|
|
1527
1747
|
];
|
|
1528
1748
|
var BackgroundImageOverlaySize = () => {
|
|
1529
|
-
|
|
1749
|
+
const backgroundImageScaleContext = useBoundProp(backgroundImageSizeScalePropTypeUtil);
|
|
1750
|
+
const stringPropContext = useBoundProp(stringPropTypeUtil7);
|
|
1751
|
+
const isCustom = !!backgroundImageScaleContext.value;
|
|
1752
|
+
const handleSizeChange = (size) => {
|
|
1753
|
+
if (size === "custom") {
|
|
1754
|
+
backgroundImageScaleContext.setValue({ width: null, height: null });
|
|
1755
|
+
} else {
|
|
1756
|
+
stringPropContext.setValue(size);
|
|
1757
|
+
}
|
|
1758
|
+
};
|
|
1759
|
+
return /* @__PURE__ */ React33.createElement(Grid11, { container: true, spacing: 1.5 }, /* @__PURE__ */ React33.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React33.createElement(Grid11, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React33.createElement(Grid11, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(ControlLabel, null, __16("Size", "elementor"))), /* @__PURE__ */ React33.createElement(Grid11, { item: true, xs: 6, sx: { display: "flex", justifyContent: "flex-end" } }, /* @__PURE__ */ React33.createElement(
|
|
1760
|
+
ControlToggleButtonGroup,
|
|
1761
|
+
{
|
|
1762
|
+
exclusive: true,
|
|
1763
|
+
items: sizeControlOptions,
|
|
1764
|
+
value: backgroundImageScaleContext.value ? "custom" : stringPropContext.value,
|
|
1765
|
+
onChange: handleSizeChange
|
|
1766
|
+
}
|
|
1767
|
+
)))), isCustom ? /* @__PURE__ */ React33.createElement(PropProvider, { ...backgroundImageScaleContext }, /* @__PURE__ */ React33.createElement(Grid11, { item: true, xs: 12 }, /* @__PURE__ */ React33.createElement(Grid11, { container: true, spacing: 2 }, /* @__PURE__ */ React33.createElement(Grid11, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(PropKeyProvider, { bind: "width" }, /* @__PURE__ */ React33.createElement(SizeControl, { startIcon: /* @__PURE__ */ React33.createElement(ArrowsMoveHorizontalIcon, { fontSize: "tiny" }) }))), /* @__PURE__ */ React33.createElement(Grid11, { item: true, xs: 6 }, /* @__PURE__ */ React33.createElement(PropKeyProvider, { bind: "height" }, /* @__PURE__ */ React33.createElement(SizeControl, { startIcon: /* @__PURE__ */ React33.createElement(ArrowsMoveVerticalIcon, { fontSize: "tiny" }) })))))) : null);
|
|
1530
1768
|
};
|
|
1531
1769
|
|
|
1532
1770
|
// src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
|
|
1533
|
-
var
|
|
1534
|
-
var initialBackgroundOverlay = {
|
|
1771
|
+
var initialBackgroundOverlay = (backgroundPlaceholderImage) => ({
|
|
1535
1772
|
$$type: "background-image-overlay",
|
|
1536
1773
|
value: {
|
|
1537
|
-
|
|
1538
|
-
$$type: "image
|
|
1774
|
+
image: {
|
|
1775
|
+
$$type: "image",
|
|
1539
1776
|
value: {
|
|
1540
|
-
|
|
1541
|
-
$$type: "image-
|
|
1542
|
-
value:
|
|
1777
|
+
src: {
|
|
1778
|
+
$$type: "image-src",
|
|
1779
|
+
value: {
|
|
1780
|
+
url: {
|
|
1781
|
+
$$type: "url",
|
|
1782
|
+
value: backgroundPlaceholderImage
|
|
1783
|
+
},
|
|
1784
|
+
id: null
|
|
1785
|
+
}
|
|
1786
|
+
},
|
|
1787
|
+
size: {
|
|
1788
|
+
$$type: "string",
|
|
1789
|
+
value: "large"
|
|
1543
1790
|
}
|
|
1544
1791
|
}
|
|
1545
1792
|
}
|
|
1546
1793
|
}
|
|
1547
|
-
};
|
|
1794
|
+
});
|
|
1795
|
+
var backgroundResolutionOptions = [
|
|
1796
|
+
{ label: __17("Thumbnail - 150 x 150", "elementor"), value: "thumbnail" },
|
|
1797
|
+
{ label: __17("Medium - 300 x 300", "elementor"), value: "medium" },
|
|
1798
|
+
{ label: __17("Large 1024 x 1024", "elementor"), value: "large" },
|
|
1799
|
+
{ label: __17("Full", "elementor"), value: "full" }
|
|
1800
|
+
];
|
|
1548
1801
|
var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
1549
1802
|
const { propType, value: overlayValues, setValue } = useBoundProp(backgroundOverlayPropTypeUtil);
|
|
1550
1803
|
return /* @__PURE__ */ React34.createElement(PropProvider, { propType, value: overlayValues, setValue }, /* @__PURE__ */ React34.createElement(
|
|
@@ -1557,40 +1810,62 @@ var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
|
1557
1810
|
Icon: ItemIcon2,
|
|
1558
1811
|
Label: ItemLabel2,
|
|
1559
1812
|
Content: ItemContent2,
|
|
1560
|
-
initialValues: initialBackgroundOverlay
|
|
1813
|
+
initialValues: initialBackgroundOverlay(env.background_placeholder_image)
|
|
1561
1814
|
}
|
|
1562
1815
|
}
|
|
1563
1816
|
));
|
|
1564
1817
|
});
|
|
1565
|
-
var ItemIcon2 = ({ value }) => /* @__PURE__ */ React34.createElement(UnstableColorIndicator2, { size: "inherit", component: "span", value: value.value });
|
|
1566
1818
|
var ItemContent2 = ({ bind, value }) => {
|
|
1567
1819
|
return /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React34.createElement(Content2, { value }));
|
|
1568
1820
|
};
|
|
1569
1821
|
var Content2 = ({ value }) => {
|
|
1570
1822
|
const activeTab = deriveOverlayType(value.$$type);
|
|
1571
1823
|
const { getTabsProps, getTabProps, getTabPanelProps } = useTabs(activeTab);
|
|
1572
|
-
return /* @__PURE__ */ React34.createElement(Box4, { sx: { width: "100%" } }, /* @__PURE__ */ React34.createElement(Box4, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React34.createElement(Tabs, { ...getTabsProps(), "aria-label": __17("Background Overlay", "elementor") }, /* @__PURE__ */ React34.createElement(Tab, { label: __17("Image", "elementor"), ...getTabProps("image") }), /* @__PURE__ */ React34.createElement(Tab, { label: __17("Color", "elementor"), ...getTabProps("color") }))), /* @__PURE__ */ React34.createElement(TabPanel, { ...getTabPanelProps("image") }, /* @__PURE__ */ React34.createElement(
|
|
1824
|
+
return /* @__PURE__ */ React34.createElement(Box4, { sx: { width: "100%" } }, /* @__PURE__ */ React34.createElement(Box4, { sx: { borderBottom: 1, borderColor: "divider" } }, /* @__PURE__ */ React34.createElement(Tabs, { ...getTabsProps(), "aria-label": __17("Background Overlay", "elementor") }, /* @__PURE__ */ React34.createElement(Tab, { label: __17("Image", "elementor"), ...getTabProps("image") }), /* @__PURE__ */ React34.createElement(Tab, { label: __17("Color", "elementor"), ...getTabProps("color") }))), /* @__PURE__ */ React34.createElement(TabPanel, { sx: { p: 1.5 }, ...getTabPanelProps("image") }, /* @__PURE__ */ React34.createElement(Stack12, { gap: 1.5 }, /* @__PURE__ */ React34.createElement(ImageOverlayContent, null))), /* @__PURE__ */ React34.createElement(TabPanel, { ...getTabPanelProps("color"), sx: { p: 1.5 } }, /* @__PURE__ */ React34.createElement(Grid12, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React34.createElement(Grid12, { item: true, xs: 12 }, /* @__PURE__ */ React34.createElement(ColorControl, { propTypeUtil: backgroundColorOverlayPropTypeUtil })))));
|
|
1573
1825
|
};
|
|
1574
|
-
var
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1826
|
+
var ItemIcon2 = ({ value }) => {
|
|
1827
|
+
switch (value.$$type) {
|
|
1828
|
+
case "background-image-overlay":
|
|
1829
|
+
return /* @__PURE__ */ React34.createElement(ItemIconImage, { value });
|
|
1830
|
+
case "background-color-overlay":
|
|
1831
|
+
return /* @__PURE__ */ React34.createElement(ItemIconColor, { value });
|
|
1832
|
+
default:
|
|
1833
|
+
return null;
|
|
1578
1834
|
}
|
|
1579
|
-
|
|
1580
|
-
|
|
1835
|
+
};
|
|
1836
|
+
var ItemIconColor = ({ value }) => {
|
|
1837
|
+
return /* @__PURE__ */ React34.createElement(UnstableColorIndicator2, { size: "inherit", component: "span", value: value.value });
|
|
1838
|
+
};
|
|
1839
|
+
var ItemIconImage = ({ value }) => {
|
|
1840
|
+
const { imageUrl } = useImage(value);
|
|
1841
|
+
return /* @__PURE__ */ React34.createElement(CardMedia3, { image: imageUrl, sx: { height: 13, width: 13, borderRadius: "4px" } });
|
|
1842
|
+
};
|
|
1843
|
+
var ItemLabel2 = ({ value }) => {
|
|
1844
|
+
switch (value.$$type) {
|
|
1845
|
+
case "background-image-overlay":
|
|
1846
|
+
return /* @__PURE__ */ React34.createElement(ItemLabelImage, { value });
|
|
1847
|
+
case "background-color-overlay":
|
|
1848
|
+
return /* @__PURE__ */ React34.createElement(ItemLabelColor, { value });
|
|
1849
|
+
default:
|
|
1850
|
+
return null;
|
|
1581
1851
|
}
|
|
1582
1852
|
};
|
|
1583
1853
|
var ItemLabelColor = ({ value }) => {
|
|
1584
1854
|
return /* @__PURE__ */ React34.createElement("span", null, value.value);
|
|
1585
1855
|
};
|
|
1586
1856
|
var ItemLabelImage = ({ value }) => {
|
|
1587
|
-
const {
|
|
1588
|
-
const imageTitle = attachment?.title || null;
|
|
1857
|
+
const { imageTitle } = useImage(value);
|
|
1589
1858
|
return /* @__PURE__ */ React34.createElement("span", null, imageTitle);
|
|
1590
1859
|
};
|
|
1591
1860
|
var ImageOverlayContent = () => {
|
|
1592
1861
|
const propContext = useBoundProp(backgroundImageOverlayPropTypeUtil);
|
|
1593
|
-
return /* @__PURE__ */ React34.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "image
|
|
1862
|
+
return /* @__PURE__ */ React34.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "image" }, /* @__PURE__ */ React34.createElement(Grid12, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React34.createElement(Grid12, { item: true, xs: 12 }, /* @__PURE__ */ React34.createElement(
|
|
1863
|
+
ImageControl,
|
|
1864
|
+
{
|
|
1865
|
+
resolutionLabel: __17("Resolution", "elementor"),
|
|
1866
|
+
sizes: backgroundResolutionOptions
|
|
1867
|
+
}
|
|
1868
|
+
)))), /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "position" }, /* @__PURE__ */ React34.createElement(BackgroundImageOverlayPosition, null)), /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "repeat" }, /* @__PURE__ */ React34.createElement(BackgroundImageOverlayRepeat, null)), /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React34.createElement(BackgroundImageOverlaySize, null)), /* @__PURE__ */ React34.createElement(PropKeyProvider, { bind: "attachment" }, /* @__PURE__ */ React34.createElement(BackgroundImageOverlayAttachment, null)));
|
|
1594
1869
|
};
|
|
1595
1870
|
var deriveOverlayType = (type) => {
|
|
1596
1871
|
if (type === "background-color-overlay") {
|
|
@@ -1601,11 +1876,25 @@ var deriveOverlayType = (type) => {
|
|
|
1601
1876
|
}
|
|
1602
1877
|
throw new Error(`Invalid overlay type: ${type}`);
|
|
1603
1878
|
};
|
|
1879
|
+
var useImage = (image) => {
|
|
1880
|
+
let imageTitle, imageUrl = null;
|
|
1881
|
+
const imageSrc = image?.value.image.value?.src.value;
|
|
1882
|
+
const { data: attachment } = useWpMediaAttachment3(imageSrc.id?.value || null);
|
|
1883
|
+
if (imageSrc.id) {
|
|
1884
|
+
const imageFileTypeExtension = attachment?.subtype ? `.${attachment.subtype}` : "";
|
|
1885
|
+
imageTitle = `${attachment?.title}${imageFileTypeExtension}` || null;
|
|
1886
|
+
imageUrl = attachment?.url || null;
|
|
1887
|
+
} else if (imageSrc.url) {
|
|
1888
|
+
imageUrl = imageSrc.url.value;
|
|
1889
|
+
imageTitle = imageUrl?.substring(imageUrl.lastIndexOf("/") + 1) || null;
|
|
1890
|
+
}
|
|
1891
|
+
return { imageTitle, imageUrl };
|
|
1892
|
+
};
|
|
1604
1893
|
|
|
1605
1894
|
// src/controls/background-control/background-control.tsx
|
|
1606
1895
|
var BackgroundControl = createControl(() => {
|
|
1607
1896
|
const propContext = useBoundProp(backgroundPropTypeUtil);
|
|
1608
|
-
return /* @__PURE__ */ React35.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React35.createElement(
|
|
1897
|
+
return /* @__PURE__ */ React35.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React35.createElement(Stack13, { gap: 1.5 }, /* @__PURE__ */ React35.createElement(PropKeyProvider, { bind: "background-overlay" }, /* @__PURE__ */ React35.createElement(BackgroundOverlayRepeaterControl, null)), /* @__PURE__ */ React35.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React35.createElement(Grid13, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React35.createElement(Grid13, { item: true, xs: 6 }, /* @__PURE__ */ React35.createElement(ControlLabel, null, __18("Color", "elementor"))), /* @__PURE__ */ React35.createElement(Grid13, { item: true, xs: 6 }, /* @__PURE__ */ React35.createElement(ColorControl, null))))));
|
|
1609
1898
|
});
|
|
1610
1899
|
export {
|
|
1611
1900
|
AutocompleteControl,
|
|
@@ -1628,6 +1917,7 @@ export {
|
|
|
1628
1917
|
SelectControl,
|
|
1629
1918
|
SizeControl,
|
|
1630
1919
|
StrokeControl,
|
|
1920
|
+
SvgMediaControl,
|
|
1631
1921
|
TextAreaControl,
|
|
1632
1922
|
TextControl,
|
|
1633
1923
|
ToggleControl,
|