@elementor/editor-controls 0.4.1 → 0.6.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 +29 -0
- package/dist/index.d.mts +64 -23
- package/dist/index.d.ts +64 -23
- package/dist/index.js +609 -643
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +565 -599
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
- package/src/bound-prop-context/errors.ts +16 -0
- package/src/bound-prop-context/index.ts +3 -0
- package/src/bound-prop-context/prop-context.tsx +57 -0
- package/src/bound-prop-context/prop-key-context.tsx +110 -0
- package/src/bound-prop-context/use-bound-prop.ts +70 -0
- package/src/components/repeater.tsx +8 -15
- package/src/controls/autocomplete-control.tsx +181 -0
- package/src/controls/background-control/background-control.tsx +19 -42
- package/src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx +64 -50
- package/src/controls/box-shadow-repeater-control.tsx +75 -139
- package/src/controls/color-control.tsx +16 -20
- package/src/controls/equal-unequal-sizes-control.tsx +65 -139
- package/src/controls/gap-control.tsx +20 -25
- package/src/controls/image-control.tsx +19 -34
- package/src/controls/image-media-control.tsx +1 -1
- package/src/controls/link-control.tsx +89 -60
- package/src/controls/linked-dimensions-control.tsx +25 -54
- package/src/controls/number-control.tsx +1 -1
- package/src/controls/stroke-control.tsx +18 -48
- package/src/controls/url-control.tsx +4 -9
- package/src/index.ts +4 -2
- package/src/bound-prop-context.tsx +0 -67
package/dist/index.js
CHANGED
|
@@ -30,8 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AutocompleteControl: () => AutocompleteControl,
|
|
33
34
|
BackgroundControl: () => BackgroundControl,
|
|
34
|
-
BoundPropProvider: () => BoundPropProvider,
|
|
35
35
|
BoxShadowRepeaterControl: () => BoxShadowRepeaterControl,
|
|
36
36
|
ColorControl: () => ColorControl,
|
|
37
37
|
ControlActionsProvider: () => ControlActionsProvider,
|
|
@@ -45,6 +45,8 @@ __export(index_exports, {
|
|
|
45
45
|
LinkControl: () => LinkControl,
|
|
46
46
|
LinkedDimensionsControl: () => LinkedDimensionsControl,
|
|
47
47
|
NumberControl: () => NumberControl,
|
|
48
|
+
PropKeyProvider: () => PropKeyProvider,
|
|
49
|
+
PropProvider: () => PropProvider,
|
|
48
50
|
SelectControl: () => SelectControl,
|
|
49
51
|
SizeControl: () => SizeControl,
|
|
50
52
|
StrokeControl: () => StrokeControl,
|
|
@@ -60,65 +62,185 @@ __export(index_exports, {
|
|
|
60
62
|
module.exports = __toCommonJS(index_exports);
|
|
61
63
|
|
|
62
64
|
// src/controls/image-control.tsx
|
|
63
|
-
var
|
|
65
|
+
var React10 = __toESM(require("react"));
|
|
64
66
|
var import_editor_props3 = require("@elementor/editor-props");
|
|
65
67
|
var import_ui6 = require("@elementor/ui");
|
|
66
68
|
var import_i18n2 = require("@wordpress/i18n");
|
|
67
69
|
|
|
68
|
-
// src/bound-prop-context.tsx
|
|
70
|
+
// src/bound-prop-context/prop-context.tsx
|
|
69
71
|
var React = __toESM(require("react"));
|
|
70
72
|
var import_react = require("react");
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
|
|
74
|
+
// src/bound-prop-context/errors.ts
|
|
75
|
+
var import_utils = require("@elementor/utils");
|
|
76
|
+
var MissingPropTypeError = (0, import_utils.createError)({
|
|
77
|
+
code: "missing_prop_provider_prop_type",
|
|
78
|
+
message: "Prop type is missing"
|
|
79
|
+
});
|
|
80
|
+
var UnsupportedParentError = (0, import_utils.createError)({
|
|
81
|
+
code: "unsupported_prop_provider_prop_type",
|
|
82
|
+
message: "Parent prop type is not supported"
|
|
83
|
+
});
|
|
84
|
+
var HookOutsideProviderError = (0, import_utils.createError)({
|
|
85
|
+
code: "hook_outside_provider",
|
|
86
|
+
message: "Hook used outside of provider"
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// src/bound-prop-context/prop-context.tsx
|
|
90
|
+
var PropContext = (0, import_react.createContext)(null);
|
|
91
|
+
var PropProvider = ({
|
|
92
|
+
children,
|
|
93
|
+
value,
|
|
94
|
+
setValue,
|
|
95
|
+
propType
|
|
96
|
+
}) => {
|
|
97
|
+
return /* @__PURE__ */ React.createElement(
|
|
98
|
+
PropContext.Provider,
|
|
99
|
+
{
|
|
100
|
+
value: {
|
|
101
|
+
value,
|
|
102
|
+
propType,
|
|
103
|
+
setValue
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
children
|
|
107
|
+
);
|
|
74
108
|
};
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
if (!
|
|
78
|
-
throw new
|
|
109
|
+
var usePropContext = () => {
|
|
110
|
+
const context = (0, import_react.useContext)(PropContext);
|
|
111
|
+
if (!context) {
|
|
112
|
+
throw new HookOutsideProviderError({
|
|
113
|
+
context: {
|
|
114
|
+
hook: "usePropContext",
|
|
115
|
+
provider: "PropProvider"
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return context;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// src/bound-prop-context/prop-key-context.tsx
|
|
123
|
+
var React2 = __toESM(require("react"));
|
|
124
|
+
var import_react2 = require("react");
|
|
125
|
+
var PropKeyContext = (0, import_react2.createContext)(null);
|
|
126
|
+
var PropKeyProvider = ({ children, bind }) => {
|
|
127
|
+
const { propType } = usePropContext();
|
|
128
|
+
if (!propType) {
|
|
129
|
+
throw new MissingPropTypeError({ context: { bind } });
|
|
130
|
+
}
|
|
131
|
+
if (propType.kind === "array") {
|
|
132
|
+
return /* @__PURE__ */ React2.createElement(ArrayPropKeyProvider, { bind }, children);
|
|
133
|
+
}
|
|
134
|
+
if (propType.kind === "object") {
|
|
135
|
+
return /* @__PURE__ */ React2.createElement(ObjectPropKeyProvider, { bind }, children);
|
|
136
|
+
}
|
|
137
|
+
throw new UnsupportedParentError({ context: { propType } });
|
|
138
|
+
};
|
|
139
|
+
var ObjectPropKeyProvider = ({ children, bind }) => {
|
|
140
|
+
const context = usePropContext();
|
|
141
|
+
const { path } = (0, import_react2.useContext)(PropKeyContext) ?? {};
|
|
142
|
+
const setValue = (value2, options, meta) => {
|
|
143
|
+
const newValue = {
|
|
144
|
+
...context.value,
|
|
145
|
+
[bind]: value2
|
|
146
|
+
};
|
|
147
|
+
return context?.setValue(newValue, options, { ...meta, bind });
|
|
148
|
+
};
|
|
149
|
+
const value = context.value?.[bind];
|
|
150
|
+
const propType = context.propType.shape[bind];
|
|
151
|
+
return /* @__PURE__ */ React2.createElement(
|
|
152
|
+
PropKeyContext.Provider,
|
|
153
|
+
{
|
|
154
|
+
value: { ...context, value, setValue, bind, propType, path: [...path ?? [], bind] }
|
|
155
|
+
},
|
|
156
|
+
children
|
|
157
|
+
);
|
|
158
|
+
};
|
|
159
|
+
var ArrayPropKeyProvider = ({ children, bind }) => {
|
|
160
|
+
const context = usePropContext();
|
|
161
|
+
const { path } = (0, import_react2.useContext)(PropKeyContext) ?? {};
|
|
162
|
+
const setValue = (value2, options) => {
|
|
163
|
+
const newValue = [...context.value ?? []];
|
|
164
|
+
newValue[Number(bind)] = value2;
|
|
165
|
+
return context?.setValue(newValue, options, { bind });
|
|
166
|
+
};
|
|
167
|
+
const value = context.value?.[Number(bind)];
|
|
168
|
+
const propType = context.propType.item_prop_type;
|
|
169
|
+
return /* @__PURE__ */ React2.createElement(
|
|
170
|
+
PropKeyContext.Provider,
|
|
171
|
+
{
|
|
172
|
+
value: { ...context, value, setValue, bind, propType, path: [...path ?? [], bind] }
|
|
173
|
+
},
|
|
174
|
+
children
|
|
175
|
+
);
|
|
176
|
+
};
|
|
177
|
+
var usePropKeyContext = () => {
|
|
178
|
+
const context = (0, import_react2.useContext)(PropKeyContext);
|
|
179
|
+
if (!context) {
|
|
180
|
+
throw new HookOutsideProviderError({
|
|
181
|
+
context: { hook: "usePropKeyContext", provider: "PropKeyProvider" }
|
|
182
|
+
});
|
|
79
183
|
}
|
|
184
|
+
return context;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// src/bound-prop-context/use-bound-prop.ts
|
|
188
|
+
function useBoundProp(propTypeUtil) {
|
|
189
|
+
const propKeyContext = usePropKeyContext();
|
|
80
190
|
if (!propTypeUtil) {
|
|
81
|
-
return
|
|
191
|
+
return propKeyContext;
|
|
82
192
|
}
|
|
83
|
-
function setValue(value2, options) {
|
|
193
|
+
function setValue(value2, options, meta) {
|
|
84
194
|
if (value2 === null) {
|
|
85
|
-
return
|
|
195
|
+
return propKeyContext?.setValue(null, options, meta);
|
|
86
196
|
}
|
|
87
|
-
return
|
|
197
|
+
return propKeyContext?.setValue(propTypeUtil?.create(value2, options), {}, meta);
|
|
88
198
|
}
|
|
89
|
-
const
|
|
199
|
+
const propType = resolveUnionPropType(propKeyContext.propType, propTypeUtil.key);
|
|
200
|
+
const value = propTypeUtil.extract(propKeyContext.value ?? propType.default ?? null);
|
|
90
201
|
return {
|
|
91
|
-
...
|
|
202
|
+
...propKeyContext,
|
|
92
203
|
setValue,
|
|
93
|
-
value
|
|
204
|
+
value,
|
|
205
|
+
propType
|
|
94
206
|
};
|
|
95
207
|
}
|
|
208
|
+
var resolveUnionPropType = (propType, key) => {
|
|
209
|
+
let resolvedPropType = propType;
|
|
210
|
+
if (propType.kind === "union") {
|
|
211
|
+
resolvedPropType = propType.prop_types[key];
|
|
212
|
+
}
|
|
213
|
+
if (!resolvedPropType) {
|
|
214
|
+
throw new MissingPropTypeError({ context: { key } });
|
|
215
|
+
}
|
|
216
|
+
return resolvedPropType;
|
|
217
|
+
};
|
|
96
218
|
|
|
97
219
|
// src/components/control-label.tsx
|
|
98
|
-
var
|
|
220
|
+
var React3 = __toESM(require("react"));
|
|
99
221
|
var import_ui = require("@elementor/ui");
|
|
100
222
|
var ControlLabel = ({ children }) => {
|
|
101
|
-
return /* @__PURE__ */
|
|
223
|
+
return /* @__PURE__ */ React3.createElement(import_ui.Typography, { component: "label", variant: "caption", color: "text.secondary" }, children);
|
|
102
224
|
};
|
|
103
225
|
|
|
104
226
|
// src/create-control.tsx
|
|
105
|
-
var
|
|
227
|
+
var React5 = __toESM(require("react"));
|
|
106
228
|
var import_ui2 = require("@elementor/ui");
|
|
107
229
|
|
|
108
230
|
// src/create-control-replacement.tsx
|
|
109
|
-
var
|
|
110
|
-
var
|
|
111
|
-
var ControlReplacementContext = (0,
|
|
231
|
+
var React4 = __toESM(require("react"));
|
|
232
|
+
var import_react3 = require("react");
|
|
233
|
+
var ControlReplacementContext = (0, import_react3.createContext)(void 0);
|
|
112
234
|
var ControlReplacementProvider = ({
|
|
113
235
|
component,
|
|
114
236
|
condition,
|
|
115
237
|
children
|
|
116
238
|
}) => {
|
|
117
|
-
return /* @__PURE__ */
|
|
239
|
+
return /* @__PURE__ */ React4.createElement(ControlReplacementContext.Provider, { value: { component, condition } }, children);
|
|
118
240
|
};
|
|
119
241
|
var useControlReplacement = () => {
|
|
120
242
|
const { value } = useBoundProp();
|
|
121
|
-
const controlReplacement = (0,
|
|
243
|
+
const controlReplacement = (0, import_react3.useContext)(ControlReplacementContext);
|
|
122
244
|
let shouldReplace = false;
|
|
123
245
|
try {
|
|
124
246
|
shouldReplace = !!controlReplacement?.condition({ value }) && !!controlReplacement.component;
|
|
@@ -143,14 +265,14 @@ function createControl(Component, { supportsReplacements = true } = {}) {
|
|
|
143
265
|
return (props) => {
|
|
144
266
|
const ControlReplacement = useControlReplacement();
|
|
145
267
|
if (ControlReplacement && supportsReplacements) {
|
|
146
|
-
return /* @__PURE__ */
|
|
268
|
+
return /* @__PURE__ */ React5.createElement(import_ui2.ErrorBoundary, { fallback: null }, /* @__PURE__ */ React5.createElement(ControlReplacement, { ...props }));
|
|
147
269
|
}
|
|
148
|
-
return /* @__PURE__ */
|
|
270
|
+
return /* @__PURE__ */ React5.createElement(import_ui2.ErrorBoundary, { fallback: null }, /* @__PURE__ */ React5.createElement(Component, { ...props }));
|
|
149
271
|
};
|
|
150
272
|
}
|
|
151
273
|
|
|
152
274
|
// src/controls/image-media-control.tsx
|
|
153
|
-
var
|
|
275
|
+
var React8 = __toESM(require("react"));
|
|
154
276
|
var import_editor_props = require("@elementor/editor-props");
|
|
155
277
|
var import_icons = require("@elementor/icons");
|
|
156
278
|
var import_ui4 = require("@elementor/ui");
|
|
@@ -158,16 +280,16 @@ var import_wp_media = require("@elementor/wp-media");
|
|
|
158
280
|
var import_i18n = require("@wordpress/i18n");
|
|
159
281
|
|
|
160
282
|
// src/control-actions/control-actions.tsx
|
|
161
|
-
var
|
|
283
|
+
var React7 = __toESM(require("react"));
|
|
162
284
|
var import_ui3 = require("@elementor/ui");
|
|
163
285
|
|
|
164
286
|
// src/control-actions/control-actions-context.tsx
|
|
165
|
-
var
|
|
166
|
-
var
|
|
167
|
-
var Context = (0,
|
|
168
|
-
var ControlActionsProvider = ({ children, items }) => /* @__PURE__ */
|
|
287
|
+
var React6 = __toESM(require("react"));
|
|
288
|
+
var import_react4 = require("react");
|
|
289
|
+
var Context = (0, import_react4.createContext)(null);
|
|
290
|
+
var ControlActionsProvider = ({ children, items }) => /* @__PURE__ */ React6.createElement(Context.Provider, { value: { items } }, children);
|
|
169
291
|
var useControlActions = () => {
|
|
170
|
-
const context = (0,
|
|
292
|
+
const context = (0, import_react4.useContext)(Context);
|
|
171
293
|
if (!context) {
|
|
172
294
|
throw new Error("useControlActions must be used within a ControlActionsProvider");
|
|
173
295
|
}
|
|
@@ -187,8 +309,8 @@ function ControlActions({ children }) {
|
|
|
187
309
|
if (items.length === 0) {
|
|
188
310
|
return children;
|
|
189
311
|
}
|
|
190
|
-
const menuItems = items.map(({ MenuItem: MenuItem4, id }) => /* @__PURE__ */
|
|
191
|
-
return /* @__PURE__ */
|
|
312
|
+
const menuItems = items.map(({ MenuItem: MenuItem4, id }) => /* @__PURE__ */ React7.createElement(MenuItem4, { key: id }));
|
|
313
|
+
return /* @__PURE__ */ React7.createElement(FloatingBarContainer, null, /* @__PURE__ */ React7.createElement(import_ui3.UnstableFloatingActionBar, { actions: menuItems }, children));
|
|
192
314
|
}
|
|
193
315
|
|
|
194
316
|
// src/controls/image-media-control.tsx
|
|
@@ -196,7 +318,7 @@ var ImageMediaControl = createControl(() => {
|
|
|
196
318
|
const { value, setValue } = useBoundProp(import_editor_props.imageSrcPropTypeUtil);
|
|
197
319
|
const { id, url } = value ?? {};
|
|
198
320
|
const { data: attachment, isFetching } = (0, import_wp_media.useWpMediaAttachment)(id?.value || null);
|
|
199
|
-
const src = attachment?.url ?? url;
|
|
321
|
+
const src = attachment?.url ?? url?.value ?? null;
|
|
200
322
|
const { open } = (0, import_wp_media.useWpMediaFrame)({
|
|
201
323
|
types: ["image"],
|
|
202
324
|
multiple: false,
|
|
@@ -211,7 +333,7 @@ var ImageMediaControl = createControl(() => {
|
|
|
211
333
|
});
|
|
212
334
|
}
|
|
213
335
|
});
|
|
214
|
-
return /* @__PURE__ */
|
|
336
|
+
return /* @__PURE__ */ React8.createElement(import_ui4.Card, { variant: "outlined" }, /* @__PURE__ */ React8.createElement(import_ui4.CardMedia, { image: src, sx: { height: 150 } }, isFetching ? /* @__PURE__ */ React8.createElement(import_ui4.Stack, { justifyContent: "center", alignItems: "center", width: "100%", height: "100%" }, /* @__PURE__ */ React8.createElement(import_ui4.CircularProgress, null)) : null), /* @__PURE__ */ React8.createElement(import_ui4.CardOverlay, null, /* @__PURE__ */ React8.createElement(ControlActions, null, /* @__PURE__ */ React8.createElement(import_ui4.Stack, { gap: 1 }, /* @__PURE__ */ React8.createElement(
|
|
215
337
|
import_ui4.Button,
|
|
216
338
|
{
|
|
217
339
|
size: "tiny",
|
|
@@ -220,13 +342,13 @@ var ImageMediaControl = createControl(() => {
|
|
|
220
342
|
onClick: () => open({ mode: "browse" })
|
|
221
343
|
},
|
|
222
344
|
(0, import_i18n.__)("Select Image", "elementor")
|
|
223
|
-
), /* @__PURE__ */
|
|
345
|
+
), /* @__PURE__ */ React8.createElement(
|
|
224
346
|
import_ui4.Button,
|
|
225
347
|
{
|
|
226
348
|
size: "tiny",
|
|
227
349
|
variant: "text",
|
|
228
350
|
color: "inherit",
|
|
229
|
-
startIcon: /* @__PURE__ */
|
|
351
|
+
startIcon: /* @__PURE__ */ React8.createElement(import_icons.UploadIcon, null),
|
|
230
352
|
onClick: () => open({ mode: "upload" })
|
|
231
353
|
},
|
|
232
354
|
(0, import_i18n.__)("Upload Image", "elementor")
|
|
@@ -234,7 +356,7 @@ var ImageMediaControl = createControl(() => {
|
|
|
234
356
|
});
|
|
235
357
|
|
|
236
358
|
// src/controls/select-control.tsx
|
|
237
|
-
var
|
|
359
|
+
var React9 = __toESM(require("react"));
|
|
238
360
|
var import_editor_props2 = require("@elementor/editor-props");
|
|
239
361
|
var import_ui5 = require("@elementor/ui");
|
|
240
362
|
var SelectControl = createControl(({ options, onChange }) => {
|
|
@@ -243,37 +365,132 @@ var SelectControl = createControl(({ options, onChange }) => {
|
|
|
243
365
|
onChange?.(event.target.value, value);
|
|
244
366
|
setValue(event.target.value);
|
|
245
367
|
};
|
|
246
|
-
return /* @__PURE__ */
|
|
368
|
+
return /* @__PURE__ */ React9.createElement(ControlActions, null, /* @__PURE__ */ React9.createElement(import_ui5.Select, { displayEmpty: true, size: "tiny", value: value ?? "", onChange: handleChange, fullWidth: true }, options.map(({ label, ...props }) => /* @__PURE__ */ React9.createElement(import_ui5.MenuItem, { key: props.value, ...props }, label))));
|
|
247
369
|
});
|
|
248
370
|
|
|
249
371
|
// src/controls/image-control.tsx
|
|
250
372
|
var ImageControl = createControl((props) => {
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
const setImageSrc = (newValue) => {
|
|
254
|
-
setValue({
|
|
255
|
-
src: newValue,
|
|
256
|
-
size
|
|
257
|
-
});
|
|
258
|
-
};
|
|
259
|
-
const setImageSize = (newValue) => {
|
|
260
|
-
setValue({
|
|
261
|
-
src,
|
|
262
|
-
size: newValue
|
|
263
|
-
});
|
|
264
|
-
};
|
|
265
|
-
return /* @__PURE__ */ React9.createElement(import_ui6.Stack, { gap: 1.5 }, /* @__PURE__ */ React9.createElement(BoundPropProvider, { value: src, setValue: setImageSrc, bind: "src" }, /* @__PURE__ */ React9.createElement(ImageMediaControl, null)), /* @__PURE__ */ React9.createElement(BoundPropProvider, { value: size, setValue: setImageSize, bind: "size" }, /* @__PURE__ */ React9.createElement(import_ui6.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React9.createElement(import_ui6.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React9.createElement(ControlLabel, null, " ", (0, import_i18n2.__)("Image Resolution", "elementor"))), /* @__PURE__ */ React9.createElement(import_ui6.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React9.createElement(SelectControl, { options: props.sizes })))));
|
|
373
|
+
const propContext = useBoundProp(import_editor_props3.imagePropTypeUtil);
|
|
374
|
+
return /* @__PURE__ */ React10.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React10.createElement(import_ui6.Stack, { gap: 1.5 }, /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "src" }, /* @__PURE__ */ React10.createElement(ImageMediaControl, null)), /* @__PURE__ */ React10.createElement(PropKeyProvider, { bind: "size" }, /* @__PURE__ */ React10.createElement(import_ui6.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React10.createElement(import_ui6.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React10.createElement(ControlLabel, null, " ", (0, import_i18n2.__)("Image Resolution", "elementor"))), /* @__PURE__ */ React10.createElement(import_ui6.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React10.createElement(SelectControl, { options: props.sizes }))))));
|
|
266
375
|
});
|
|
267
376
|
|
|
268
|
-
// src/controls/
|
|
269
|
-
var
|
|
377
|
+
// src/controls/autocomplete-control.tsx
|
|
378
|
+
var React11 = __toESM(require("react"));
|
|
379
|
+
var import_react5 = require("react");
|
|
270
380
|
var import_editor_props4 = require("@elementor/editor-props");
|
|
381
|
+
var import_icons2 = require("@elementor/icons");
|
|
271
382
|
var import_ui7 = require("@elementor/ui");
|
|
383
|
+
var AutocompleteControl = createControl(
|
|
384
|
+
({
|
|
385
|
+
options,
|
|
386
|
+
placeholder = "",
|
|
387
|
+
allowCustomValues = false,
|
|
388
|
+
propType = import_editor_props4.stringPropTypeUtil,
|
|
389
|
+
minInputLength = 2
|
|
390
|
+
}) => {
|
|
391
|
+
const { value = "", setValue } = useBoundProp(propType);
|
|
392
|
+
const [inputValue, setInputValue] = (0, import_react5.useState)(
|
|
393
|
+
value && options[value]?.label ? options[value]?.label : value
|
|
394
|
+
);
|
|
395
|
+
const hasSelectedValue = !!(inputValue && (options[inputValue] || Object.values(options).find(({ label }) => label === inputValue)));
|
|
396
|
+
const allowClear = !!inputValue;
|
|
397
|
+
const formattedOptions = Object.keys(options);
|
|
398
|
+
const handleChange = (_, newValue = null) => {
|
|
399
|
+
const formattedInputValue = newValue && options[newValue]?.label ? options[newValue]?.label : newValue;
|
|
400
|
+
setInputValue(formattedInputValue || "");
|
|
401
|
+
if (!allowCustomValues && newValue && !options[newValue]) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
setValue(newValue);
|
|
405
|
+
};
|
|
406
|
+
const filterOptions = () => {
|
|
407
|
+
const formattedValue = inputValue?.toLowerCase() || "";
|
|
408
|
+
if (formattedValue.length < minInputLength) {
|
|
409
|
+
return [];
|
|
410
|
+
}
|
|
411
|
+
return formattedOptions.filter(
|
|
412
|
+
(optionValue) => optionValue.toLowerCase().indexOf(formattedValue) !== -1 || options[optionValue].label.toLowerCase().indexOf(formattedValue) !== -1
|
|
413
|
+
);
|
|
414
|
+
};
|
|
415
|
+
const isOptionEqualToValue = () => {
|
|
416
|
+
return muiWarningPreventer() ? void 0 : () => true;
|
|
417
|
+
};
|
|
418
|
+
const muiWarningPreventer = () => allowCustomValues || !!filterOptions().length;
|
|
419
|
+
return /* @__PURE__ */ React11.createElement(ControlActions, null, /* @__PURE__ */ React11.createElement(
|
|
420
|
+
import_ui7.Autocomplete,
|
|
421
|
+
{
|
|
422
|
+
forcePopupIcon: false,
|
|
423
|
+
disableClearable: true,
|
|
424
|
+
freeSolo: muiWarningPreventer(),
|
|
425
|
+
value: inputValue || "",
|
|
426
|
+
size: "tiny",
|
|
427
|
+
onChange: handleChange,
|
|
428
|
+
onInputChange: handleChange,
|
|
429
|
+
onBlur: allowCustomValues ? void 0 : () => handleChange(null, value),
|
|
430
|
+
readOnly: hasSelectedValue,
|
|
431
|
+
options: formattedOptions,
|
|
432
|
+
getOptionKey: (option) => option,
|
|
433
|
+
getOptionLabel: (option) => options[option]?.label ?? option,
|
|
434
|
+
groupBy: shouldGroupOptions(options) ? (option) => options[option]?.groupLabel : void 0,
|
|
435
|
+
isOptionEqualToValue: isOptionEqualToValue(),
|
|
436
|
+
filterOptions,
|
|
437
|
+
renderOption: (optionProps, option) => /* @__PURE__ */ React11.createElement(import_ui7.Box, { component: "li", ...optionProps, key: optionProps.id }, options[option]?.label ?? option),
|
|
438
|
+
renderInput: (params) => /* @__PURE__ */ React11.createElement(
|
|
439
|
+
TextInput,
|
|
440
|
+
{
|
|
441
|
+
params,
|
|
442
|
+
handleChange,
|
|
443
|
+
allowClear,
|
|
444
|
+
placeholder,
|
|
445
|
+
hasSelectedValue
|
|
446
|
+
}
|
|
447
|
+
)
|
|
448
|
+
}
|
|
449
|
+
));
|
|
450
|
+
}
|
|
451
|
+
);
|
|
452
|
+
var TextInput = ({
|
|
453
|
+
params,
|
|
454
|
+
allowClear,
|
|
455
|
+
placeholder,
|
|
456
|
+
handleChange,
|
|
457
|
+
hasSelectedValue
|
|
458
|
+
}) => {
|
|
459
|
+
return /* @__PURE__ */ React11.createElement(
|
|
460
|
+
import_ui7.TextField,
|
|
461
|
+
{
|
|
462
|
+
...params,
|
|
463
|
+
placeholder,
|
|
464
|
+
sx: {
|
|
465
|
+
"& .MuiInputBase-input": {
|
|
466
|
+
cursor: hasSelectedValue ? "default" : void 0
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
InputProps: {
|
|
470
|
+
...params.InputProps,
|
|
471
|
+
endAdornment: /* @__PURE__ */ React11.createElement(ClearButton, { params, allowClear, handleChange })
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
);
|
|
475
|
+
};
|
|
476
|
+
var ClearButton = ({
|
|
477
|
+
allowClear,
|
|
478
|
+
handleChange,
|
|
479
|
+
params
|
|
480
|
+
}) => /* @__PURE__ */ React11.createElement(import_ui7.InputAdornment, { position: "end" }, allowClear && /* @__PURE__ */ React11.createElement(import_ui7.IconButton, { size: params.size, onClick: handleChange, sx: { cursor: "pointer" } }, /* @__PURE__ */ React11.createElement(import_icons2.XIcon, { fontSize: params.size })));
|
|
481
|
+
function shouldGroupOptions(options) {
|
|
482
|
+
return Object.values(options).every((option) => "groupLabel" in option);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// src/controls/text-control.tsx
|
|
486
|
+
var React12 = __toESM(require("react"));
|
|
487
|
+
var import_editor_props5 = require("@elementor/editor-props");
|
|
488
|
+
var import_ui8 = require("@elementor/ui");
|
|
272
489
|
var TextControl = createControl(({ placeholder }) => {
|
|
273
|
-
const { value, setValue } = useBoundProp(
|
|
490
|
+
const { value, setValue } = useBoundProp(import_editor_props5.stringPropTypeUtil);
|
|
274
491
|
const handleChange = (event) => setValue(event.target.value);
|
|
275
|
-
return /* @__PURE__ */
|
|
276
|
-
|
|
492
|
+
return /* @__PURE__ */ React12.createElement(ControlActions, null, /* @__PURE__ */ React12.createElement(
|
|
493
|
+
import_ui8.TextField,
|
|
277
494
|
{
|
|
278
495
|
size: "tiny",
|
|
279
496
|
fullWidth: true,
|
|
@@ -285,16 +502,16 @@ var TextControl = createControl(({ placeholder }) => {
|
|
|
285
502
|
});
|
|
286
503
|
|
|
287
504
|
// src/controls/text-area-control.tsx
|
|
288
|
-
var
|
|
289
|
-
var
|
|
290
|
-
var
|
|
505
|
+
var React13 = __toESM(require("react"));
|
|
506
|
+
var import_editor_props6 = require("@elementor/editor-props");
|
|
507
|
+
var import_ui9 = require("@elementor/ui");
|
|
291
508
|
var TextAreaControl = createControl(({ placeholder }) => {
|
|
292
|
-
const { value, setValue } = useBoundProp(
|
|
509
|
+
const { value, setValue } = useBoundProp(import_editor_props6.stringPropTypeUtil);
|
|
293
510
|
const handleChange = (event) => {
|
|
294
511
|
setValue(event.target.value);
|
|
295
512
|
};
|
|
296
|
-
return /* @__PURE__ */
|
|
297
|
-
|
|
513
|
+
return /* @__PURE__ */ React13.createElement(ControlActions, null, /* @__PURE__ */ React13.createElement(
|
|
514
|
+
import_ui9.TextField,
|
|
298
515
|
{
|
|
299
516
|
size: "tiny",
|
|
300
517
|
multiline: true,
|
|
@@ -308,18 +525,18 @@ var TextAreaControl = createControl(({ placeholder }) => {
|
|
|
308
525
|
});
|
|
309
526
|
|
|
310
527
|
// src/controls/size-control.tsx
|
|
311
|
-
var
|
|
312
|
-
var
|
|
313
|
-
var
|
|
528
|
+
var React15 = __toESM(require("react"));
|
|
529
|
+
var import_editor_props7 = require("@elementor/editor-props");
|
|
530
|
+
var import_ui11 = require("@elementor/ui");
|
|
314
531
|
|
|
315
532
|
// src/components/text-field-inner-selection.tsx
|
|
316
|
-
var
|
|
317
|
-
var
|
|
318
|
-
var
|
|
319
|
-
var TextFieldInnerSelection = (0,
|
|
533
|
+
var React14 = __toESM(require("react"));
|
|
534
|
+
var import_react6 = require("react");
|
|
535
|
+
var import_ui10 = require("@elementor/ui");
|
|
536
|
+
var TextFieldInnerSelection = (0, import_react6.forwardRef)(
|
|
320
537
|
({ placeholder, type, value, onChange, endAdornment, startAdornment }, ref) => {
|
|
321
|
-
return /* @__PURE__ */
|
|
322
|
-
|
|
538
|
+
return /* @__PURE__ */ React14.createElement(
|
|
539
|
+
import_ui10.TextField,
|
|
323
540
|
{
|
|
324
541
|
size: "tiny",
|
|
325
542
|
fullWidth: true,
|
|
@@ -341,28 +558,28 @@ var SelectionEndAdornment = ({
|
|
|
341
558
|
onClick,
|
|
342
559
|
value
|
|
343
560
|
}) => {
|
|
344
|
-
const popupState = (0,
|
|
561
|
+
const popupState = (0, import_ui10.usePopupState)({
|
|
345
562
|
variant: "popover",
|
|
346
|
-
popupId: (0,
|
|
563
|
+
popupId: (0, import_react6.useId)()
|
|
347
564
|
});
|
|
348
565
|
const handleMenuItemClick = (index) => {
|
|
349
566
|
onClick(options[index]);
|
|
350
567
|
popupState.close();
|
|
351
568
|
};
|
|
352
|
-
return /* @__PURE__ */
|
|
353
|
-
|
|
569
|
+
return /* @__PURE__ */ React14.createElement(import_ui10.InputAdornment, { position: "end" }, /* @__PURE__ */ React14.createElement(
|
|
570
|
+
import_ui10.Button,
|
|
354
571
|
{
|
|
355
572
|
size: "small",
|
|
356
573
|
color: "inherit",
|
|
357
574
|
sx: { font: "inherit", minWidth: "initial" },
|
|
358
|
-
...(0,
|
|
575
|
+
...(0, import_ui10.bindTrigger)(popupState)
|
|
359
576
|
},
|
|
360
577
|
value.toUpperCase()
|
|
361
|
-
), /* @__PURE__ */
|
|
578
|
+
), /* @__PURE__ */ React14.createElement(import_ui10.Menu, { MenuListProps: { dense: true }, ...(0, import_ui10.bindMenu)(popupState) }, options.map((option, index) => /* @__PURE__ */ React14.createElement(import_ui10.MenuItem, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
|
|
362
579
|
};
|
|
363
580
|
|
|
364
581
|
// src/hooks/use-sync-external-state.tsx
|
|
365
|
-
var
|
|
582
|
+
var import_react7 = require("react");
|
|
366
583
|
var useSyncExternalState = ({
|
|
367
584
|
external,
|
|
368
585
|
setExternal,
|
|
@@ -381,8 +598,8 @@ var useSyncExternalState = ({
|
|
|
381
598
|
}
|
|
382
599
|
return externalValue;
|
|
383
600
|
}
|
|
384
|
-
const [internal, setInternal] = (0,
|
|
385
|
-
(0,
|
|
601
|
+
const [internal, setInternal] = (0, import_react7.useState)(toInternal(external, null));
|
|
602
|
+
(0, import_react7.useEffect)(() => {
|
|
386
603
|
setInternal((prevInternal) => toInternal(external, prevInternal));
|
|
387
604
|
}, [external]);
|
|
388
605
|
const setInternalValue = (setter) => {
|
|
@@ -399,7 +616,7 @@ var defaultUnits = ["px", "%", "em", "rem", "vw", "vh"];
|
|
|
399
616
|
var defaultUnit = "px";
|
|
400
617
|
var defaultSize = NaN;
|
|
401
618
|
var SizeControl = createControl(({ units: units2 = defaultUnits, placeholder, startIcon }) => {
|
|
402
|
-
const { value, setValue } = useBoundProp(
|
|
619
|
+
const { value, setValue } = useBoundProp(import_editor_props7.sizePropTypeUtil);
|
|
403
620
|
const [state, setState] = useSyncExternalState({
|
|
404
621
|
external: value,
|
|
405
622
|
setExternal: setValue,
|
|
@@ -419,10 +636,10 @@ var SizeControl = createControl(({ units: units2 = defaultUnits, placeholder, st
|
|
|
419
636
|
size: size || size === "0" ? parseFloat(size) : defaultSize
|
|
420
637
|
}));
|
|
421
638
|
};
|
|
422
|
-
return /* @__PURE__ */
|
|
639
|
+
return /* @__PURE__ */ React15.createElement(ControlActions, null, /* @__PURE__ */ React15.createElement(
|
|
423
640
|
TextFieldInnerSelection,
|
|
424
641
|
{
|
|
425
|
-
endAdornment: /* @__PURE__ */
|
|
642
|
+
endAdornment: /* @__PURE__ */ React15.createElement(
|
|
426
643
|
SelectionEndAdornment,
|
|
427
644
|
{
|
|
428
645
|
options: units2,
|
|
@@ -431,7 +648,7 @@ var SizeControl = createControl(({ units: units2 = defaultUnits, placeholder, st
|
|
|
431
648
|
}
|
|
432
649
|
),
|
|
433
650
|
placeholder,
|
|
434
|
-
startAdornment: startIcon ?? /* @__PURE__ */
|
|
651
|
+
startAdornment: startIcon ?? /* @__PURE__ */ React15.createElement(import_ui11.InputAdornment, { position: "start" }, startIcon),
|
|
435
652
|
type: "number",
|
|
436
653
|
value: Number.isNaN(state?.size) ? "" : state?.size,
|
|
437
654
|
onChange: handleSizeChange
|
|
@@ -440,85 +657,42 @@ var SizeControl = createControl(({ units: units2 = defaultUnits, placeholder, st
|
|
|
440
657
|
});
|
|
441
658
|
|
|
442
659
|
// src/controls/stroke-control.tsx
|
|
443
|
-
var
|
|
444
|
-
var
|
|
445
|
-
var
|
|
660
|
+
var React17 = __toESM(require("react"));
|
|
661
|
+
var import_editor_props9 = require("@elementor/editor-props");
|
|
662
|
+
var import_ui13 = require("@elementor/ui");
|
|
446
663
|
var import_i18n3 = require("@wordpress/i18n");
|
|
447
664
|
|
|
448
665
|
// src/controls/color-control.tsx
|
|
449
|
-
var
|
|
450
|
-
var
|
|
451
|
-
var
|
|
452
|
-
var ColorControl = createControl(
|
|
453
|
-
(
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
import_ui11.UnstableColorField,
|
|
460
|
-
{
|
|
461
|
-
size: "tiny",
|
|
462
|
-
...props,
|
|
463
|
-
value: value ?? "",
|
|
464
|
-
onChange: handleChange,
|
|
465
|
-
fullWidth: true
|
|
466
|
-
}
|
|
467
|
-
));
|
|
468
|
-
}
|
|
469
|
-
);
|
|
666
|
+
var React16 = __toESM(require("react"));
|
|
667
|
+
var import_editor_props8 = require("@elementor/editor-props");
|
|
668
|
+
var import_ui12 = require("@elementor/ui");
|
|
669
|
+
var ColorControl = createControl(({ propTypeUtil = import_editor_props8.colorPropTypeUtil, ...props }) => {
|
|
670
|
+
const { value, setValue } = useBoundProp(propTypeUtil);
|
|
671
|
+
const handleChange = (selectedColor) => {
|
|
672
|
+
setValue(selectedColor);
|
|
673
|
+
};
|
|
674
|
+
return /* @__PURE__ */ React16.createElement(ControlActions, null, /* @__PURE__ */ React16.createElement(import_ui12.UnstableColorField, { size: "tiny", ...props, value: value ?? "", onChange: handleChange, fullWidth: true }));
|
|
675
|
+
});
|
|
470
676
|
|
|
471
677
|
// src/controls/stroke-control.tsx
|
|
472
678
|
var units = ["px", "em", "rem"];
|
|
473
679
|
var StrokeControl = createControl(() => {
|
|
474
|
-
const
|
|
475
|
-
|
|
476
|
-
const updatedValue = {
|
|
477
|
-
...value,
|
|
478
|
-
width: newValue
|
|
479
|
-
};
|
|
480
|
-
setValue(updatedValue);
|
|
481
|
-
};
|
|
482
|
-
const setStrokeColor = (newValue) => {
|
|
483
|
-
const updatedValue = {
|
|
484
|
-
...value,
|
|
485
|
-
color: newValue
|
|
486
|
-
};
|
|
487
|
-
setValue(updatedValue);
|
|
488
|
-
};
|
|
489
|
-
return /* @__PURE__ */ React15.createElement(import_ui12.Stack, { gap: 1.5 }, /* @__PURE__ */ React15.createElement(
|
|
490
|
-
Control,
|
|
491
|
-
{
|
|
492
|
-
bind: "width",
|
|
493
|
-
label: (0, import_i18n3.__)("Stroke Width", "elementor"),
|
|
494
|
-
value: value?.width,
|
|
495
|
-
setValue: setStrokeWidth
|
|
496
|
-
},
|
|
497
|
-
/* @__PURE__ */ React15.createElement(SizeControl, { units })
|
|
498
|
-
), /* @__PURE__ */ React15.createElement(
|
|
499
|
-
Control,
|
|
500
|
-
{
|
|
501
|
-
bind: "color",
|
|
502
|
-
label: (0, import_i18n3.__)("Stroke Color", "elementor"),
|
|
503
|
-
value: value?.color,
|
|
504
|
-
setValue: setStrokeColor
|
|
505
|
-
},
|
|
506
|
-
/* @__PURE__ */ React15.createElement(ColorControl, null)
|
|
507
|
-
));
|
|
680
|
+
const propContext = useBoundProp(import_editor_props9.strokePropTypeUtil);
|
|
681
|
+
return /* @__PURE__ */ React17.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React17.createElement(import_ui13.Stack, { gap: 1.5 }, /* @__PURE__ */ React17.createElement(Control, { bind: "width", label: (0, import_i18n3.__)("Stroke Width", "elementor") }, /* @__PURE__ */ React17.createElement(SizeControl, { units })), /* @__PURE__ */ React17.createElement(Control, { bind: "color", label: (0, import_i18n3.__)("Stroke Color", "elementor") }, /* @__PURE__ */ React17.createElement(ColorControl, null))));
|
|
508
682
|
});
|
|
509
|
-
var Control = ({ bind,
|
|
683
|
+
var Control = ({ bind, label, children }) => /* @__PURE__ */ React17.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React17.createElement(import_ui13.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React17.createElement(import_ui13.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React17.createElement(ControlLabel, null, label)), /* @__PURE__ */ React17.createElement(import_ui13.Grid, { item: true, xs: 6 }, children)));
|
|
510
684
|
|
|
511
685
|
// src/controls/box-shadow-repeater-control.tsx
|
|
512
|
-
var
|
|
513
|
-
var
|
|
514
|
-
var
|
|
686
|
+
var React19 = __toESM(require("react"));
|
|
687
|
+
var import_editor_props10 = require("@elementor/editor-props");
|
|
688
|
+
var import_ui15 = require("@elementor/ui");
|
|
515
689
|
var import_i18n5 = require("@wordpress/i18n");
|
|
516
690
|
|
|
517
691
|
// src/components/repeater.tsx
|
|
518
|
-
var
|
|
519
|
-
var
|
|
520
|
-
var
|
|
521
|
-
var
|
|
692
|
+
var React18 = __toESM(require("react"));
|
|
693
|
+
var import_react8 = require("react");
|
|
694
|
+
var import_icons3 = require("@elementor/icons");
|
|
695
|
+
var import_ui14 = require("@elementor/ui");
|
|
522
696
|
var import_i18n4 = require("@wordpress/i18n");
|
|
523
697
|
var SIZE = "tiny";
|
|
524
698
|
var Repeater = ({
|
|
@@ -552,31 +726,24 @@ var Repeater = ({
|
|
|
552
726
|
})
|
|
553
727
|
);
|
|
554
728
|
};
|
|
555
|
-
return /* @__PURE__ */
|
|
729
|
+
return /* @__PURE__ */ React18.createElement(import_ui14.Stack, null, /* @__PURE__ */ React18.createElement(import_ui14.Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pb: 1 } }, /* @__PURE__ */ React18.createElement(import_ui14.Typography, { component: "label", variant: "caption", color: "text.secondary" }, label), /* @__PURE__ */ React18.createElement(import_ui14.IconButton, { size: SIZE, onClick: addRepeaterItem, "aria-label": (0, import_i18n4.__)("Add item", "elementor") }, /* @__PURE__ */ React18.createElement(import_icons3.PlusIcon, { fontSize: SIZE }))), /* @__PURE__ */ React18.createElement(import_ui14.Stack, { gap: 1 }, repeaterValues.map((value, index) => /* @__PURE__ */ React18.createElement(
|
|
556
730
|
RepeaterItem,
|
|
557
731
|
{
|
|
558
732
|
key: index,
|
|
733
|
+
bind: String(index),
|
|
559
734
|
disabled: value.disabled,
|
|
560
|
-
label: /* @__PURE__ */
|
|
561
|
-
startIcon: /* @__PURE__ */
|
|
735
|
+
label: /* @__PURE__ */ React18.createElement(itemSettings.Label, { value }),
|
|
736
|
+
startIcon: /* @__PURE__ */ React18.createElement(itemSettings.Icon, { value }),
|
|
562
737
|
removeItem: () => removeRepeaterItem(index),
|
|
563
738
|
duplicateItem: () => duplicateRepeaterItem(index),
|
|
564
739
|
toggleDisableItem: () => toggleDisableRepeaterItem(index)
|
|
565
740
|
},
|
|
566
|
-
(props) => /* @__PURE__ */
|
|
567
|
-
itemSettings.Content,
|
|
568
|
-
{
|
|
569
|
-
...props,
|
|
570
|
-
value,
|
|
571
|
-
setValue: (newValue) => setRepeaterValues(
|
|
572
|
-
repeaterValues.map((item, i) => i === index ? newValue : item)
|
|
573
|
-
)
|
|
574
|
-
}
|
|
575
|
-
)
|
|
741
|
+
(props) => /* @__PURE__ */ React18.createElement(itemSettings.Content, { ...props, bind: String(index) })
|
|
576
742
|
))));
|
|
577
743
|
};
|
|
578
744
|
var RepeaterItem = ({
|
|
579
745
|
label,
|
|
746
|
+
bind,
|
|
580
747
|
disabled,
|
|
581
748
|
startIcon,
|
|
582
749
|
children,
|
|
@@ -584,49 +751,49 @@ var RepeaterItem = ({
|
|
|
584
751
|
duplicateItem,
|
|
585
752
|
toggleDisableItem
|
|
586
753
|
}) => {
|
|
587
|
-
const popupId =
|
|
588
|
-
const controlRef = (0,
|
|
589
|
-
const [anchorEl, setAnchorEl] = (0,
|
|
590
|
-
const popoverState = (0,
|
|
591
|
-
const popoverProps = (0,
|
|
592
|
-
return /* @__PURE__ */
|
|
593
|
-
|
|
754
|
+
const popupId = `repeater-popup-${bind}`;
|
|
755
|
+
const controlRef = (0, import_react8.useRef)(null);
|
|
756
|
+
const [anchorEl, setAnchorEl] = (0, import_react8.useState)(null);
|
|
757
|
+
const popoverState = (0, import_ui14.usePopupState)({ popupId, variant: "popover" });
|
|
758
|
+
const popoverProps = (0, import_ui14.bindPopover)(popoverState);
|
|
759
|
+
return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(
|
|
760
|
+
import_ui14.UnstableTag,
|
|
594
761
|
{
|
|
595
762
|
label,
|
|
596
763
|
showActionsOnHover: true,
|
|
597
764
|
ref: controlRef,
|
|
598
765
|
variant: "outlined",
|
|
599
766
|
"aria-label": (0, import_i18n4.__)("Open item", "elementor"),
|
|
600
|
-
...(0,
|
|
767
|
+
...(0, import_ui14.bindTrigger)(popoverState),
|
|
601
768
|
startIcon,
|
|
602
|
-
actions: /* @__PURE__ */
|
|
603
|
-
|
|
769
|
+
actions: /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(
|
|
770
|
+
import_ui14.IconButton,
|
|
604
771
|
{
|
|
605
772
|
size: SIZE,
|
|
606
773
|
onClick: duplicateItem,
|
|
607
774
|
"aria-label": (0, import_i18n4.__)("Duplicate item", "elementor")
|
|
608
775
|
},
|
|
609
|
-
/* @__PURE__ */
|
|
610
|
-
), /* @__PURE__ */
|
|
611
|
-
|
|
776
|
+
/* @__PURE__ */ React18.createElement(import_icons3.CopyIcon, { fontSize: SIZE })
|
|
777
|
+
), /* @__PURE__ */ React18.createElement(
|
|
778
|
+
import_ui14.IconButton,
|
|
612
779
|
{
|
|
613
780
|
size: SIZE,
|
|
614
781
|
onClick: toggleDisableItem,
|
|
615
782
|
"aria-label": disabled ? (0, import_i18n4.__)("Enable item", "elementor") : (0, import_i18n4.__)("Disable item", "elementor")
|
|
616
783
|
},
|
|
617
|
-
disabled ? /* @__PURE__ */
|
|
618
|
-
), /* @__PURE__ */
|
|
619
|
-
|
|
784
|
+
disabled ? /* @__PURE__ */ React18.createElement(import_icons3.EyeOffIcon, { fontSize: SIZE }) : /* @__PURE__ */ React18.createElement(import_icons3.EyeIcon, { fontSize: SIZE })
|
|
785
|
+
), /* @__PURE__ */ React18.createElement(
|
|
786
|
+
import_ui14.IconButton,
|
|
620
787
|
{
|
|
621
788
|
size: SIZE,
|
|
622
789
|
onClick: removeItem,
|
|
623
790
|
"aria-label": (0, import_i18n4.__)("Remove item", "elementor")
|
|
624
791
|
},
|
|
625
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ React18.createElement(import_icons3.XIcon, { fontSize: SIZE })
|
|
626
793
|
))
|
|
627
794
|
}
|
|
628
|
-
), /* @__PURE__ */
|
|
629
|
-
|
|
795
|
+
), /* @__PURE__ */ React18.createElement(
|
|
796
|
+
import_ui14.Popover,
|
|
630
797
|
{
|
|
631
798
|
disablePortal: true,
|
|
632
799
|
slotProps: {
|
|
@@ -638,21 +805,18 @@ var RepeaterItem = ({
|
|
|
638
805
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
639
806
|
...popoverProps
|
|
640
807
|
},
|
|
641
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ React18.createElement(import_ui14.Box, { p: 0.5 }, children({ anchorEl }))
|
|
642
809
|
));
|
|
643
810
|
};
|
|
644
811
|
|
|
645
812
|
// src/controls/box-shadow-repeater-control.tsx
|
|
646
813
|
var BoxShadowRepeaterControl = createControl(() => {
|
|
647
|
-
const { value
|
|
648
|
-
|
|
649
|
-
setValue(newValue);
|
|
650
|
-
};
|
|
651
|
-
return /* @__PURE__ */ React17.createElement(
|
|
814
|
+
const { propType, value, setValue } = useBoundProp(import_editor_props10.boxShadowPropTypeUtil);
|
|
815
|
+
return /* @__PURE__ */ React19.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React19.createElement(
|
|
652
816
|
Repeater,
|
|
653
817
|
{
|
|
654
|
-
values:
|
|
655
|
-
setValues:
|
|
818
|
+
values: value ?? [],
|
|
819
|
+
setValues: setValue,
|
|
656
820
|
label: (0, import_i18n5.__)("Box shadow", "elementor"),
|
|
657
821
|
itemSettings: {
|
|
658
822
|
Icon: ItemIcon,
|
|
@@ -661,108 +825,42 @@ var BoxShadowRepeaterControl = createControl(() => {
|
|
|
661
825
|
initialValues: initialShadow
|
|
662
826
|
}
|
|
663
827
|
}
|
|
664
|
-
);
|
|
828
|
+
));
|
|
665
829
|
});
|
|
666
|
-
var ItemIcon = ({ value }) => /* @__PURE__ */
|
|
667
|
-
var ItemContent = ({
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
$$type: "shadow",
|
|
675
|
-
value: newValue
|
|
676
|
-
});
|
|
677
|
-
};
|
|
678
|
-
return /* @__PURE__ */ React17.createElement(import_ui14.Stack, { gap: 1.5 }, /* @__PURE__ */ React17.createElement(import_ui14.Grid, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React17.createElement(
|
|
679
|
-
Control2,
|
|
830
|
+
var ItemIcon = ({ value }) => /* @__PURE__ */ React19.createElement(import_ui15.UnstableColorIndicator, { size: "inherit", component: "span", value: value.value.color.value });
|
|
831
|
+
var ItemContent = ({ anchorEl, bind }) => {
|
|
832
|
+
return /* @__PURE__ */ React19.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React19.createElement(Content, { anchorEl }));
|
|
833
|
+
};
|
|
834
|
+
var Content = ({ anchorEl }) => {
|
|
835
|
+
const { propType, value, setValue } = useBoundProp(import_editor_props10.shadowPropTypeUtil);
|
|
836
|
+
return /* @__PURE__ */ React19.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React19.createElement(import_ui15.Stack, { gap: 1.5 }, /* @__PURE__ */ React19.createElement(import_ui15.Grid, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React19.createElement(Control2, { bind: "color", label: (0, import_i18n5.__)("Color", "elementor") }, /* @__PURE__ */ React19.createElement(
|
|
837
|
+
ColorControl,
|
|
680
838
|
{
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
anchorEl,
|
|
692
|
-
anchorOrigin: {
|
|
693
|
-
vertical: "top",
|
|
694
|
-
horizontal: "right"
|
|
695
|
-
},
|
|
696
|
-
transformOrigin: {
|
|
697
|
-
vertical: "top",
|
|
698
|
-
horizontal: -10
|
|
699
|
-
}
|
|
839
|
+
slotProps: {
|
|
840
|
+
colorPicker: {
|
|
841
|
+
anchorEl,
|
|
842
|
+
anchorOrigin: {
|
|
843
|
+
vertical: "top",
|
|
844
|
+
horizontal: "right"
|
|
845
|
+
},
|
|
846
|
+
transformOrigin: {
|
|
847
|
+
vertical: "top",
|
|
848
|
+
horizontal: -10
|
|
700
849
|
}
|
|
701
850
|
}
|
|
702
851
|
}
|
|
703
|
-
|
|
704
|
-
), /* @__PURE__ */
|
|
705
|
-
|
|
706
|
-
{
|
|
707
|
-
bind: "position",
|
|
708
|
-
value: value.value.position,
|
|
709
|
-
label: (0, import_i18n5.__)("Position", "elementor"),
|
|
710
|
-
setValue: (v) => setShadow({ ...value.value, position: v || null })
|
|
711
|
-
},
|
|
712
|
-
/* @__PURE__ */ React17.createElement(
|
|
713
|
-
SelectControl,
|
|
714
|
-
{
|
|
715
|
-
options: [
|
|
716
|
-
{ label: (0, import_i18n5.__)("Inset", "elementor"), value: "inset" },
|
|
717
|
-
{ label: (0, import_i18n5.__)("Outset", "elementor"), value: "" }
|
|
718
|
-
]
|
|
719
|
-
}
|
|
720
|
-
)
|
|
721
|
-
)), /* @__PURE__ */ React17.createElement(import_ui14.Grid, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React17.createElement(
|
|
722
|
-
Control2,
|
|
723
|
-
{
|
|
724
|
-
bind: "hOffset",
|
|
725
|
-
label: (0, import_i18n5.__)("Horizontal", "elementor"),
|
|
726
|
-
value: value.value.hOffset,
|
|
727
|
-
setValue: (v) => setShadow({ ...value.value, hOffset: v })
|
|
728
|
-
},
|
|
729
|
-
/* @__PURE__ */ React17.createElement(SizeControl, null)
|
|
730
|
-
), /* @__PURE__ */ React17.createElement(
|
|
731
|
-
Control2,
|
|
732
|
-
{
|
|
733
|
-
bind: "vOffset",
|
|
734
|
-
label: (0, import_i18n5.__)("Vertical", "elementor"),
|
|
735
|
-
value: value.value.vOffset,
|
|
736
|
-
setValue: (v) => setShadow({ ...value.value, vOffset: v })
|
|
737
|
-
},
|
|
738
|
-
/* @__PURE__ */ React17.createElement(SizeControl, null)
|
|
739
|
-
)), /* @__PURE__ */ React17.createElement(import_ui14.Grid, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React17.createElement(
|
|
740
|
-
Control2,
|
|
741
|
-
{
|
|
742
|
-
bind: "blur",
|
|
743
|
-
value: value.value.blur,
|
|
744
|
-
label: (0, import_i18n5.__)("Blur", "elementor"),
|
|
745
|
-
setValue: (v) => setShadow({ ...value.value, blur: v })
|
|
746
|
-
},
|
|
747
|
-
/* @__PURE__ */ React17.createElement(SizeControl, null)
|
|
748
|
-
), /* @__PURE__ */ React17.createElement(
|
|
749
|
-
Control2,
|
|
852
|
+
}
|
|
853
|
+
)), /* @__PURE__ */ React19.createElement(Control2, { bind: "position", label: (0, import_i18n5.__)("Position", "elementor") }, /* @__PURE__ */ React19.createElement(
|
|
854
|
+
SelectControl,
|
|
750
855
|
{
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
)));
|
|
856
|
+
options: [
|
|
857
|
+
{ label: (0, import_i18n5.__)("Inset", "elementor"), value: "inset" },
|
|
858
|
+
{ label: (0, import_i18n5.__)("Outset", "elementor"), value: "" }
|
|
859
|
+
]
|
|
860
|
+
}
|
|
861
|
+
))), /* @__PURE__ */ React19.createElement(import_ui15.Grid, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React19.createElement(Control2, { bind: "hOffset", label: (0, import_i18n5.__)("Horizontal", "elementor") }, /* @__PURE__ */ React19.createElement(SizeControl, null)), /* @__PURE__ */ React19.createElement(Control2, { bind: "vOffset", label: (0, import_i18n5.__)("Vertical", "elementor") }, /* @__PURE__ */ React19.createElement(SizeControl, null))), /* @__PURE__ */ React19.createElement(import_ui15.Grid, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React19.createElement(Control2, { bind: "blur", label: (0, import_i18n5.__)("Blur", "elementor") }, /* @__PURE__ */ React19.createElement(SizeControl, null)), /* @__PURE__ */ React19.createElement(Control2, { bind: "spread", label: (0, import_i18n5.__)("Spread", "elementor") }, /* @__PURE__ */ React19.createElement(SizeControl, null)))));
|
|
758
862
|
};
|
|
759
|
-
var Control2 = ({
|
|
760
|
-
value,
|
|
761
|
-
setValue,
|
|
762
|
-
label,
|
|
763
|
-
bind,
|
|
764
|
-
children
|
|
765
|
-
}) => /* @__PURE__ */ React17.createElement(BoundPropProvider, { value, setValue, bind }, /* @__PURE__ */ React17.createElement(import_ui14.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React17.createElement(import_ui14.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React17.createElement(import_ui14.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React17.createElement(import_ui14.Typography, { component: "label", variant: "caption", color: "text.secondary" }, label)), /* @__PURE__ */ React17.createElement(import_ui14.Grid, { item: true, xs: 12 }, children))));
|
|
863
|
+
var Control2 = ({ label, bind, children }) => /* @__PURE__ */ React19.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React19.createElement(import_ui15.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React19.createElement(import_ui15.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React19.createElement(import_ui15.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React19.createElement(import_ui15.Typography, { component: "label", variant: "caption", color: "text.secondary" }, label)), /* @__PURE__ */ React19.createElement(import_ui15.Grid, { item: true, xs: 12 }, children))));
|
|
766
864
|
var ItemLabel = ({ value }) => {
|
|
767
865
|
const { position, hOffset, vOffset, blur, spread } = value.value;
|
|
768
866
|
const { size: blurSize = "", unit: blurUnit = "" } = blur?.value || {};
|
|
@@ -775,7 +873,7 @@ var ItemLabel = ({ value }) => {
|
|
|
775
873
|
blurSize + blurUnit,
|
|
776
874
|
spreadSize + spreadUnit
|
|
777
875
|
].join(" ");
|
|
778
|
-
return /* @__PURE__ */
|
|
876
|
+
return /* @__PURE__ */ React19.createElement("span", { style: { textTransform: "capitalize" } }, position ?? "outset", ": ", sizes);
|
|
779
877
|
};
|
|
780
878
|
var initialShadow = {
|
|
781
879
|
$$type: "shadow",
|
|
@@ -805,13 +903,13 @@ var initialShadow = {
|
|
|
805
903
|
};
|
|
806
904
|
|
|
807
905
|
// src/controls/toggle-control.tsx
|
|
808
|
-
var
|
|
809
|
-
var
|
|
906
|
+
var React21 = __toESM(require("react"));
|
|
907
|
+
var import_editor_props11 = require("@elementor/editor-props");
|
|
810
908
|
|
|
811
909
|
// src/components/control-toggle-button-group.tsx
|
|
812
|
-
var
|
|
813
|
-
var
|
|
814
|
-
var StyledToggleButtonGroup = (0,
|
|
910
|
+
var React20 = __toESM(require("react"));
|
|
911
|
+
var import_ui16 = require("@elementor/ui");
|
|
912
|
+
var StyledToggleButtonGroup = (0, import_ui16.styled)(import_ui16.ToggleButtonGroup)`
|
|
815
913
|
${({ justify }) => `justify-content: ${justify};`}
|
|
816
914
|
`;
|
|
817
915
|
var ControlToggleButtonGroup = ({
|
|
@@ -823,11 +921,11 @@ var ControlToggleButtonGroup = ({
|
|
|
823
921
|
exclusive = false,
|
|
824
922
|
fullWidth = false
|
|
825
923
|
}) => {
|
|
826
|
-
const isRtl = "rtl" === (0,
|
|
924
|
+
const isRtl = "rtl" === (0, import_ui16.useTheme)().direction;
|
|
827
925
|
const handleChange = (_, newValue) => {
|
|
828
926
|
onChange(newValue);
|
|
829
927
|
};
|
|
830
|
-
return /* @__PURE__ */
|
|
928
|
+
return /* @__PURE__ */ React20.createElement(
|
|
831
929
|
StyledToggleButtonGroup,
|
|
832
930
|
{
|
|
833
931
|
justify,
|
|
@@ -839,8 +937,8 @@ var ControlToggleButtonGroup = ({
|
|
|
839
937
|
}
|
|
840
938
|
},
|
|
841
939
|
items.map(
|
|
842
|
-
({ label, value: buttonValue, renderContent:
|
|
843
|
-
|
|
940
|
+
({ label, value: buttonValue, renderContent: Content3, showTooltip }) => showTooltip ? /* @__PURE__ */ React20.createElement(import_ui16.Tooltip, { key: buttonValue, title: label, disableFocusListener: true, placement: "top" }, /* @__PURE__ */ React20.createElement(import_ui16.ToggleButton, { value: buttonValue, "aria-label": label, size, fullWidth }, /* @__PURE__ */ React20.createElement(Content3, { size }))) : /* @__PURE__ */ React20.createElement(
|
|
941
|
+
import_ui16.ToggleButton,
|
|
844
942
|
{
|
|
845
943
|
key: buttonValue,
|
|
846
944
|
value: buttonValue,
|
|
@@ -848,7 +946,7 @@ var ControlToggleButtonGroup = ({
|
|
|
848
946
|
size,
|
|
849
947
|
fullWidth
|
|
850
948
|
},
|
|
851
|
-
/* @__PURE__ */
|
|
949
|
+
/* @__PURE__ */ React20.createElement(Content3, { size })
|
|
852
950
|
)
|
|
853
951
|
)
|
|
854
952
|
);
|
|
@@ -857,11 +955,11 @@ var ControlToggleButtonGroup = ({
|
|
|
857
955
|
// src/controls/toggle-control.tsx
|
|
858
956
|
var ToggleControl = createControl(
|
|
859
957
|
({ options, fullWidth = false, size = "tiny" }) => {
|
|
860
|
-
const { value, setValue } = useBoundProp(
|
|
958
|
+
const { value, setValue } = useBoundProp(import_editor_props11.stringPropTypeUtil);
|
|
861
959
|
const handleToggle = (option) => {
|
|
862
960
|
setValue(option);
|
|
863
961
|
};
|
|
864
|
-
return /* @__PURE__ */
|
|
962
|
+
return /* @__PURE__ */ React21.createElement(
|
|
865
963
|
ControlToggleButtonGroup,
|
|
866
964
|
{
|
|
867
965
|
items: options,
|
|
@@ -876,9 +974,9 @@ var ToggleControl = createControl(
|
|
|
876
974
|
);
|
|
877
975
|
|
|
878
976
|
// src/controls/number-control.tsx
|
|
879
|
-
var
|
|
880
|
-
var
|
|
881
|
-
var
|
|
977
|
+
var React22 = __toESM(require("react"));
|
|
978
|
+
var import_editor_props12 = require("@elementor/editor-props");
|
|
979
|
+
var import_ui17 = require("@elementor/ui");
|
|
882
980
|
var isEmptyOrNaN = (value) => value === null || value === void 0 || value === "" || Number.isNaN(Number(value));
|
|
883
981
|
var NumberControl = createControl(
|
|
884
982
|
({
|
|
@@ -888,7 +986,7 @@ var NumberControl = createControl(
|
|
|
888
986
|
step = 1,
|
|
889
987
|
shouldForceInt = false
|
|
890
988
|
}) => {
|
|
891
|
-
const { value, setValue } = useBoundProp(
|
|
989
|
+
const { value, setValue } = useBoundProp(import_editor_props12.numberPropTypeUtil);
|
|
892
990
|
const handleChange = (event) => {
|
|
893
991
|
const eventValue = event.target.value;
|
|
894
992
|
if (isEmptyOrNaN(eventValue)) {
|
|
@@ -898,8 +996,8 @@ var NumberControl = createControl(
|
|
|
898
996
|
const formattedValue = shouldForceInt ? +parseInt(eventValue) : Number(eventValue);
|
|
899
997
|
setValue(Math.min(Math.max(formattedValue, min), max));
|
|
900
998
|
};
|
|
901
|
-
return /* @__PURE__ */
|
|
902
|
-
|
|
999
|
+
return /* @__PURE__ */ React22.createElement(ControlActions, null, /* @__PURE__ */ React22.createElement(
|
|
1000
|
+
import_ui17.TextField,
|
|
903
1001
|
{
|
|
904
1002
|
size: "tiny",
|
|
905
1003
|
type: "number",
|
|
@@ -914,18 +1012,19 @@ var NumberControl = createControl(
|
|
|
914
1012
|
);
|
|
915
1013
|
|
|
916
1014
|
// src/controls/equal-unequal-sizes-control.tsx
|
|
917
|
-
var
|
|
918
|
-
var
|
|
919
|
-
var
|
|
920
|
-
var
|
|
1015
|
+
var React23 = __toESM(require("react"));
|
|
1016
|
+
var import_react9 = require("react");
|
|
1017
|
+
var import_editor_props13 = require("@elementor/editor-props");
|
|
1018
|
+
var import_ui18 = require("@elementor/ui");
|
|
921
1019
|
var import_i18n6 = require("@wordpress/i18n");
|
|
922
|
-
var isEqualSizes = (
|
|
1020
|
+
var isEqualSizes = (propValue, items) => {
|
|
1021
|
+
const values = Object.values(propValue);
|
|
923
1022
|
if (values.length !== items.length) {
|
|
924
1023
|
return false;
|
|
925
1024
|
}
|
|
926
1025
|
const [firstValue, ...restValues] = values;
|
|
927
1026
|
return restValues.every(
|
|
928
|
-
(value) => value
|
|
1027
|
+
(value) => value?.value?.size === firstValue?.value?.size && value?.value?.unit === firstValue?.value?.unit
|
|
929
1028
|
);
|
|
930
1029
|
};
|
|
931
1030
|
function EqualUnequalSizesControl({
|
|
@@ -934,49 +1033,53 @@ function EqualUnequalSizesControl({
|
|
|
934
1033
|
items,
|
|
935
1034
|
multiSizePropTypeUtil
|
|
936
1035
|
}) {
|
|
937
|
-
const popupId = (0,
|
|
938
|
-
const controlRef = (0,
|
|
939
|
-
const popupState = (0,
|
|
940
|
-
const {
|
|
941
|
-
|
|
1036
|
+
const popupId = (0, import_react9.useId)();
|
|
1037
|
+
const controlRef = (0, import_react9.useRef)(null);
|
|
1038
|
+
const popupState = (0, import_ui18.usePopupState)({ variant: "popover", popupId });
|
|
1039
|
+
const {
|
|
1040
|
+
propType: multiSizePropType,
|
|
1041
|
+
value: multiSizeValue,
|
|
1042
|
+
setValue: setMultiSizeValue
|
|
1043
|
+
} = useBoundProp(multiSizePropTypeUtil);
|
|
1044
|
+
const { value: sizeValue, setValue: setSizeValue } = useBoundProp(import_editor_props13.sizePropTypeUtil);
|
|
942
1045
|
const splitEqualValue = () => {
|
|
943
1046
|
if (!sizeValue) {
|
|
944
|
-
return
|
|
1047
|
+
return null;
|
|
945
1048
|
}
|
|
946
|
-
return items.reduce(
|
|
1049
|
+
return items.reduce(
|
|
1050
|
+
(acc, { bind }) => ({ ...acc, [bind]: import_editor_props13.sizePropTypeUtil.create(sizeValue) }),
|
|
1051
|
+
{}
|
|
1052
|
+
);
|
|
947
1053
|
};
|
|
948
|
-
const setNestedProp = (
|
|
1054
|
+
const setNestedProp = (newValue) => {
|
|
949
1055
|
const newMappedValues = {
|
|
950
1056
|
...multiSizeValue ?? splitEqualValue(),
|
|
951
|
-
|
|
1057
|
+
...newValue
|
|
952
1058
|
};
|
|
953
|
-
const isEqual = isEqualSizes(
|
|
1059
|
+
const isEqual = isEqualSizes(newMappedValues, items);
|
|
954
1060
|
if (isEqual) {
|
|
955
|
-
return setSizeValue(
|
|
1061
|
+
return setSizeValue(Object.values(newMappedValues)[0].value);
|
|
956
1062
|
}
|
|
957
1063
|
setMultiSizeValue(newMappedValues);
|
|
958
1064
|
};
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
items,
|
|
963
|
-
value: sizeValue,
|
|
964
|
-
multiSizeValue,
|
|
965
|
-
setValue: setSizeValue,
|
|
966
|
-
iconButton: /* @__PURE__ */ React21.createElement(
|
|
967
|
-
import_ui17.ToggleButton,
|
|
968
|
-
{
|
|
969
|
-
size: "tiny",
|
|
970
|
-
value: "check",
|
|
971
|
-
sx: { marginLeft: "auto" },
|
|
972
|
-
...(0, import_ui17.bindToggle)(popupState),
|
|
973
|
-
selected: popupState.isOpen
|
|
974
|
-
},
|
|
975
|
-
icon
|
|
976
|
-
)
|
|
1065
|
+
const getMultiSizeValues = () => {
|
|
1066
|
+
if (multiSizeValue) {
|
|
1067
|
+
return multiSizeValue;
|
|
977
1068
|
}
|
|
978
|
-
|
|
979
|
-
|
|
1069
|
+
return splitEqualValue() ?? null;
|
|
1070
|
+
};
|
|
1071
|
+
return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(import_ui18.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap", ref: controlRef }, /* @__PURE__ */ React23.createElement(import_ui18.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(ControlLabel, null, label)), /* @__PURE__ */ React23.createElement(import_ui18.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(import_ui18.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React23.createElement(SizeControl, { placeholder: (0, import_i18n6.__)("MIXED", "elementor") }), /* @__PURE__ */ React23.createElement(
|
|
1072
|
+
import_ui18.ToggleButton,
|
|
1073
|
+
{
|
|
1074
|
+
size: "tiny",
|
|
1075
|
+
value: "check",
|
|
1076
|
+
sx: { marginLeft: "auto" },
|
|
1077
|
+
...(0, import_ui18.bindToggle)(popupState),
|
|
1078
|
+
selected: popupState.isOpen
|
|
1079
|
+
},
|
|
1080
|
+
icon
|
|
1081
|
+
)))), /* @__PURE__ */ React23.createElement(
|
|
1082
|
+
import_ui18.Popover,
|
|
980
1083
|
{
|
|
981
1084
|
disablePortal: true,
|
|
982
1085
|
disableScrollLock: true,
|
|
@@ -988,102 +1091,37 @@ function EqualUnequalSizesControl({
|
|
|
988
1091
|
vertical: "top",
|
|
989
1092
|
horizontal: "right"
|
|
990
1093
|
},
|
|
991
|
-
...(0,
|
|
1094
|
+
...(0, import_ui18.bindPopover)(popupState),
|
|
992
1095
|
slotProps: {
|
|
993
1096
|
paper: { sx: { mt: 0.5, p: 2, pt: 1, width: controlRef.current?.getBoundingClientRect().width } }
|
|
994
1097
|
}
|
|
995
1098
|
},
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
MultiSizeValueControl,
|
|
998
|
-
{
|
|
999
|
-
item: items[0],
|
|
1000
|
-
value: multiSizeValue,
|
|
1001
|
-
setNestedProp,
|
|
1002
|
-
splitEqualValue
|
|
1003
|
-
}
|
|
1004
|
-
), /* @__PURE__ */ React21.createElement(
|
|
1005
|
-
MultiSizeValueControl,
|
|
1006
|
-
{
|
|
1007
|
-
item: items[1],
|
|
1008
|
-
value: multiSizeValue,
|
|
1009
|
-
setNestedProp,
|
|
1010
|
-
splitEqualValue
|
|
1011
|
-
}
|
|
1012
|
-
)), /* @__PURE__ */ React21.createElement(import_ui17.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React21.createElement(
|
|
1013
|
-
MultiSizeValueControl,
|
|
1014
|
-
{
|
|
1015
|
-
item: items[3],
|
|
1016
|
-
value: multiSizeValue,
|
|
1017
|
-
setNestedProp,
|
|
1018
|
-
splitEqualValue
|
|
1019
|
-
}
|
|
1020
|
-
), /* @__PURE__ */ React21.createElement(
|
|
1021
|
-
MultiSizeValueControl,
|
|
1022
|
-
{
|
|
1023
|
-
item: items[2],
|
|
1024
|
-
value: multiSizeValue,
|
|
1025
|
-
setNestedProp,
|
|
1026
|
-
splitEqualValue
|
|
1027
|
-
}
|
|
1028
|
-
)))
|
|
1099
|
+
/* @__PURE__ */ React23.createElement(PropProvider, { propType: multiSizePropType, value: getMultiSizeValues(), setValue: setNestedProp }, /* @__PURE__ */ React23.createElement(import_ui18.Stack, { gap: 1.5 }, /* @__PURE__ */ React23.createElement(import_ui18.Grid, { 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(import_ui18.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React23.createElement(MultiSizeValueControl, { item: items[3] }), /* @__PURE__ */ React23.createElement(MultiSizeValueControl, { item: items[2] }))))
|
|
1029
1100
|
));
|
|
1030
1101
|
}
|
|
1031
|
-
var MultiSizeValueControl = ({
|
|
1032
|
-
item,
|
|
1033
|
-
value,
|
|
1034
|
-
setNestedProp,
|
|
1035
|
-
splitEqualValue
|
|
1036
|
-
}) => {
|
|
1037
|
-
const handleChange = (val) => setNestedProp(item, val);
|
|
1038
|
-
const getMultiSizeValues = () => {
|
|
1039
|
-
if (value) {
|
|
1040
|
-
return value?.[item.bind] ?? null;
|
|
1041
|
-
}
|
|
1042
|
-
return splitEqualValue()?.[item.bind] ?? null;
|
|
1043
|
-
};
|
|
1044
|
-
return /* @__PURE__ */ React21.createElement(BoundPropProvider, { bind: "", setValue: handleChange, value: getMultiSizeValues() }, /* @__PURE__ */ React21.createElement(import_ui17.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React21.createElement(import_ui17.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React21.createElement(import_ui17.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React21.createElement(ControlLabel, null, item.label)), /* @__PURE__ */ React21.createElement(import_ui17.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React21.createElement(SizeControl, { startIcon: item.icon })))));
|
|
1045
|
-
};
|
|
1046
|
-
var EqualSizeControl = ({
|
|
1047
|
-
value,
|
|
1048
|
-
items,
|
|
1049
|
-
setValue,
|
|
1050
|
-
iconButton,
|
|
1051
|
-
multiSizeValue
|
|
1052
|
-
}) => {
|
|
1053
|
-
const handleChange = (newValue) => {
|
|
1054
|
-
setValue(newValue.value);
|
|
1055
|
-
};
|
|
1056
|
-
const getDisplayValue = () => {
|
|
1057
|
-
if (value) {
|
|
1058
|
-
return import_editor_props12.sizePropTypeUtil.create(value);
|
|
1059
|
-
}
|
|
1060
|
-
const multiValues = Object.values(multiSizeValue ?? {});
|
|
1061
|
-
if (isEqualSizes(multiValues, items)) {
|
|
1062
|
-
return import_editor_props12.sizePropTypeUtil.create(multiValues[0].value);
|
|
1063
|
-
}
|
|
1064
|
-
};
|
|
1065
|
-
return /* @__PURE__ */ React21.createElement(BoundPropProvider, { bind: "", setValue: handleChange, value: getDisplayValue() ?? null }, /* @__PURE__ */ React21.createElement(import_ui17.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React21.createElement(SizeControl, { placeholder: (0, import_i18n6.__)("MIXED", "elementor") }), iconButton));
|
|
1066
|
-
};
|
|
1102
|
+
var MultiSizeValueControl = ({ item }) => /* @__PURE__ */ React23.createElement(PropKeyProvider, { bind: item.bind }, /* @__PURE__ */ React23.createElement(import_ui18.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React23.createElement(import_ui18.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React23.createElement(import_ui18.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(ControlLabel, null, item.label)), /* @__PURE__ */ React23.createElement(import_ui18.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(SizeControl, { startIcon: item.icon })))));
|
|
1067
1103
|
|
|
1068
1104
|
// src/controls/linked-dimensions-control.tsx
|
|
1069
|
-
var
|
|
1070
|
-
var
|
|
1071
|
-
var
|
|
1072
|
-
var
|
|
1105
|
+
var React24 = __toESM(require("react"));
|
|
1106
|
+
var import_editor_props14 = require("@elementor/editor-props");
|
|
1107
|
+
var import_icons4 = require("@elementor/icons");
|
|
1108
|
+
var import_ui19 = require("@elementor/ui");
|
|
1073
1109
|
var import_i18n7 = require("@wordpress/i18n");
|
|
1074
1110
|
var LinkedDimensionsControl = createControl(({ label }) => {
|
|
1075
|
-
const { value, setValue } = useBoundProp(
|
|
1111
|
+
const { value, setValue, propType } = useBoundProp(import_editor_props14.linkedDimensionsPropTypeUtil);
|
|
1076
1112
|
const { top, right, bottom, left, isLinked = true } = value || {};
|
|
1077
|
-
const setLinkedValue = (
|
|
1078
|
-
|
|
1113
|
+
const setLinkedValue = (newValue, _, meta) => {
|
|
1114
|
+
if (!isLinked) {
|
|
1115
|
+
return setValue(newValue);
|
|
1116
|
+
}
|
|
1117
|
+
const newDimension = newValue[meta?.bind];
|
|
1118
|
+
setValue({
|
|
1079
1119
|
isLinked,
|
|
1080
|
-
top:
|
|
1081
|
-
right:
|
|
1082
|
-
bottom:
|
|
1083
|
-
left:
|
|
1084
|
-
|
|
1085
|
-
};
|
|
1086
|
-
setValue(updatedValue);
|
|
1120
|
+
top: newDimension,
|
|
1121
|
+
right: newDimension,
|
|
1122
|
+
bottom: newDimension,
|
|
1123
|
+
left: newDimension
|
|
1124
|
+
});
|
|
1087
1125
|
};
|
|
1088
1126
|
const toggleLinked = () => {
|
|
1089
1127
|
const updatedValue = {
|
|
@@ -1095,9 +1133,9 @@ var LinkedDimensionsControl = createControl(({ label }) => {
|
|
|
1095
1133
|
};
|
|
1096
1134
|
setValue(updatedValue);
|
|
1097
1135
|
};
|
|
1098
|
-
const LinkedIcon = isLinked ?
|
|
1099
|
-
return /* @__PURE__ */
|
|
1100
|
-
|
|
1136
|
+
const LinkedIcon = isLinked ? import_icons4.LinkIcon : import_icons4.DetachIcon;
|
|
1137
|
+
return /* @__PURE__ */ React24.createElement(PropProvider, { propType, value, setValue: setLinkedValue }, /* @__PURE__ */ React24.createElement(import_ui19.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React24.createElement(ControlLabel, null, label), /* @__PURE__ */ React24.createElement(
|
|
1138
|
+
import_ui19.ToggleButton,
|
|
1101
1139
|
{
|
|
1102
1140
|
"aria-label": (0, import_i18n7.__)("Link Inputs", "elementor"),
|
|
1103
1141
|
size: "tiny",
|
|
@@ -1106,54 +1144,17 @@ var LinkedDimensionsControl = createControl(({ label }) => {
|
|
|
1106
1144
|
sx: { marginLeft: "auto" },
|
|
1107
1145
|
onChange: toggleLinked
|
|
1108
1146
|
},
|
|
1109
|
-
/* @__PURE__ */
|
|
1110
|
-
)), /* @__PURE__ */
|
|
1111
|
-
Control3,
|
|
1112
|
-
{
|
|
1113
|
-
bind: "top",
|
|
1114
|
-
value: top,
|
|
1115
|
-
setValue: setLinkedValue,
|
|
1116
|
-
startIcon: /* @__PURE__ */ React22.createElement(import_icons3.SideTopIcon, { fontSize: "tiny" })
|
|
1117
|
-
}
|
|
1118
|
-
))), /* @__PURE__ */ React22.createElement(import_ui18.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React22.createElement(import_ui18.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(ControlLabel, null, (0, import_i18n7.__)("Right", "elementor"))), /* @__PURE__ */ React22.createElement(import_ui18.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(
|
|
1119
|
-
Control3,
|
|
1120
|
-
{
|
|
1121
|
-
bind: "right",
|
|
1122
|
-
value: right,
|
|
1123
|
-
setValue: setLinkedValue,
|
|
1124
|
-
startIcon: /* @__PURE__ */ React22.createElement(import_icons3.SideRightIcon, { fontSize: "tiny" })
|
|
1125
|
-
}
|
|
1126
|
-
)))), /* @__PURE__ */ React22.createElement(import_ui18.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React22.createElement(import_ui18.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React22.createElement(import_ui18.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(ControlLabel, null, (0, import_i18n7.__)("Bottom", "elementor"))), /* @__PURE__ */ React22.createElement(import_ui18.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(
|
|
1127
|
-
Control3,
|
|
1128
|
-
{
|
|
1129
|
-
bind: "bottom",
|
|
1130
|
-
value: bottom,
|
|
1131
|
-
setValue: setLinkedValue,
|
|
1132
|
-
startIcon: /* @__PURE__ */ React22.createElement(import_icons3.SideBottomIcon, { fontSize: "tiny" })
|
|
1133
|
-
}
|
|
1134
|
-
))), /* @__PURE__ */ React22.createElement(import_ui18.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React22.createElement(import_ui18.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(ControlLabel, null, (0, import_i18n7.__)("Left", "elementor"))), /* @__PURE__ */ React22.createElement(import_ui18.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(
|
|
1135
|
-
Control3,
|
|
1136
|
-
{
|
|
1137
|
-
bind: "left",
|
|
1138
|
-
value: left,
|
|
1139
|
-
setValue: setLinkedValue,
|
|
1140
|
-
startIcon: /* @__PURE__ */ React22.createElement(import_icons3.SideLeftIcon, { fontSize: "tiny" })
|
|
1141
|
-
}
|
|
1142
|
-
)))));
|
|
1147
|
+
/* @__PURE__ */ React24.createElement(LinkedIcon, { fontSize: "tiny" })
|
|
1148
|
+
)), /* @__PURE__ */ React24.createElement(import_ui19.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React24.createElement(import_ui19.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React24.createElement(import_ui19.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(ControlLabel, null, (0, import_i18n7.__)("Top", "elementor"))), /* @__PURE__ */ React24.createElement(import_ui19.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(Control3, { bind: "top", startIcon: /* @__PURE__ */ React24.createElement(import_icons4.SideTopIcon, { fontSize: "tiny" }) }))), /* @__PURE__ */ React24.createElement(import_ui19.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React24.createElement(import_ui19.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(ControlLabel, null, (0, import_i18n7.__)("Right", "elementor"))), /* @__PURE__ */ React24.createElement(import_ui19.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(Control3, { bind: "right", startIcon: /* @__PURE__ */ React24.createElement(import_icons4.SideRightIcon, { fontSize: "tiny" }) })))), /* @__PURE__ */ React24.createElement(import_ui19.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React24.createElement(import_ui19.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React24.createElement(import_ui19.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(ControlLabel, null, (0, import_i18n7.__)("Bottom", "elementor"))), /* @__PURE__ */ React24.createElement(import_ui19.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(Control3, { bind: "bottom", startIcon: /* @__PURE__ */ React24.createElement(import_icons4.SideBottomIcon, { fontSize: "tiny" }) }))), /* @__PURE__ */ React24.createElement(import_ui19.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React24.createElement(import_ui19.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(ControlLabel, null, (0, import_i18n7.__)("Left", "elementor"))), /* @__PURE__ */ React24.createElement(import_ui19.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React24.createElement(Control3, { bind: "left", startIcon: /* @__PURE__ */ React24.createElement(import_icons4.SideLeftIcon, { fontSize: "tiny" }) })))));
|
|
1143
1149
|
});
|
|
1144
|
-
var Control3 = ({
|
|
1145
|
-
bind,
|
|
1146
|
-
startIcon,
|
|
1147
|
-
value,
|
|
1148
|
-
setValue
|
|
1149
|
-
}) => /* @__PURE__ */ React22.createElement(BoundPropProvider, { setValue: (newValue) => setValue(bind, newValue), value, bind }, /* @__PURE__ */ React22.createElement(SizeControl, { startIcon }));
|
|
1150
|
+
var Control3 = ({ bind, startIcon }) => /* @__PURE__ */ React24.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React24.createElement(SizeControl, { startIcon }));
|
|
1150
1151
|
|
|
1151
1152
|
// src/controls/font-family-control.tsx
|
|
1152
|
-
var
|
|
1153
|
-
var
|
|
1154
|
-
var
|
|
1155
|
-
var
|
|
1156
|
-
var
|
|
1153
|
+
var import_react10 = require("react");
|
|
1154
|
+
var React25 = __toESM(require("react"));
|
|
1155
|
+
var import_editor_props15 = require("@elementor/editor-props");
|
|
1156
|
+
var import_icons5 = require("@elementor/icons");
|
|
1157
|
+
var import_ui20 = require("@elementor/ui");
|
|
1157
1158
|
var import_i18n9 = require("@wordpress/i18n");
|
|
1158
1159
|
|
|
1159
1160
|
// src/hooks/use-filtered-font-families.ts
|
|
@@ -1189,10 +1190,10 @@ var useFilteredFontFamilies = (fontFamilies, searchValue) => {
|
|
|
1189
1190
|
// src/controls/font-family-control.tsx
|
|
1190
1191
|
var SIZE2 = "tiny";
|
|
1191
1192
|
var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
1192
|
-
const [searchValue, setSearchValue] = (0,
|
|
1193
|
-
const { value: fontFamily, setValue: setFontFamily } = useBoundProp(
|
|
1194
|
-
const popupId = (0,
|
|
1195
|
-
const popoverState = (0,
|
|
1193
|
+
const [searchValue, setSearchValue] = (0, import_react10.useState)("");
|
|
1194
|
+
const { value: fontFamily, setValue: setFontFamily } = useBoundProp(import_editor_props15.stringPropTypeUtil);
|
|
1195
|
+
const popupId = (0, import_react10.useId)();
|
|
1196
|
+
const popoverState = (0, import_ui20.usePopupState)({ variant: "popover", popupId });
|
|
1196
1197
|
const filteredFontFamilies = useFilteredFontFamilies(fontFamilies, searchValue);
|
|
1197
1198
|
if (!filteredFontFamilies) {
|
|
1198
1199
|
return null;
|
|
@@ -1204,26 +1205,26 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1204
1205
|
setSearchValue("");
|
|
1205
1206
|
popoverState.close();
|
|
1206
1207
|
};
|
|
1207
|
-
return /* @__PURE__ */
|
|
1208
|
-
|
|
1208
|
+
return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(
|
|
1209
|
+
import_ui20.UnstableTag,
|
|
1209
1210
|
{
|
|
1210
1211
|
variant: "outlined",
|
|
1211
1212
|
label: fontFamily,
|
|
1212
|
-
endIcon: /* @__PURE__ */
|
|
1213
|
-
...(0,
|
|
1213
|
+
endIcon: /* @__PURE__ */ React25.createElement(import_icons5.ChevronDownIcon, { fontSize: "tiny" }),
|
|
1214
|
+
...(0, import_ui20.bindTrigger)(popoverState),
|
|
1214
1215
|
fullWidth: true
|
|
1215
1216
|
}
|
|
1216
|
-
), /* @__PURE__ */
|
|
1217
|
-
|
|
1217
|
+
), /* @__PURE__ */ React25.createElement(
|
|
1218
|
+
import_ui20.Popover,
|
|
1218
1219
|
{
|
|
1219
1220
|
disablePortal: true,
|
|
1220
1221
|
disableScrollLock: true,
|
|
1221
1222
|
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
1222
|
-
...(0,
|
|
1223
|
+
...(0, import_ui20.bindPopover)(popoverState),
|
|
1223
1224
|
onClose: handleClose
|
|
1224
1225
|
},
|
|
1225
|
-
/* @__PURE__ */
|
|
1226
|
-
|
|
1226
|
+
/* @__PURE__ */ React25.createElement(import_ui20.Stack, null, /* @__PURE__ */ React25.createElement(import_ui20.Stack, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React25.createElement(import_icons5.EditIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React25.createElement(import_ui20.Typography, { variant: "subtitle2" }, (0, import_i18n9.__)("Font Family", "elementor")), /* @__PURE__ */ React25.createElement(import_ui20.IconButton, { size: SIZE2, sx: { ml: "auto" }, onClick: handleClose }, /* @__PURE__ */ React25.createElement(import_icons5.XIcon, { fontSize: SIZE2 }))), /* @__PURE__ */ React25.createElement(import_ui20.Box, { px: 1.5, pb: 1 }, /* @__PURE__ */ React25.createElement(
|
|
1227
|
+
import_ui20.TextField,
|
|
1227
1228
|
{
|
|
1228
1229
|
fullWidth: true,
|
|
1229
1230
|
size: SIZE2,
|
|
@@ -1231,13 +1232,13 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1231
1232
|
placeholder: (0, import_i18n9.__)("Search", "elementor"),
|
|
1232
1233
|
onChange: handleSearch,
|
|
1233
1234
|
InputProps: {
|
|
1234
|
-
startAdornment: /* @__PURE__ */
|
|
1235
|
+
startAdornment: /* @__PURE__ */ React25.createElement(import_ui20.InputAdornment, { position: "start" }, /* @__PURE__ */ React25.createElement(import_icons5.SearchIcon, { fontSize: SIZE2 }))
|
|
1235
1236
|
}
|
|
1236
1237
|
}
|
|
1237
|
-
)), /* @__PURE__ */
|
|
1238
|
+
)), /* @__PURE__ */ React25.createElement(import_ui20.Divider, null), /* @__PURE__ */ React25.createElement(import_ui20.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, filteredFontFamilies.length > 0 ? /* @__PURE__ */ React25.createElement(import_ui20.MenuList, { role: "listbox", tabIndex: 0 }, filteredFontFamilies.map(([category, items], index) => /* @__PURE__ */ React25.createElement(import_react10.Fragment, { key: index }, /* @__PURE__ */ React25.createElement(import_ui20.ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, category), items.map((item) => {
|
|
1238
1239
|
const isSelected = item === fontFamily;
|
|
1239
|
-
return /* @__PURE__ */
|
|
1240
|
-
|
|
1240
|
+
return /* @__PURE__ */ React25.createElement(
|
|
1241
|
+
import_ui20.MenuItem,
|
|
1241
1242
|
{
|
|
1242
1243
|
key: item,
|
|
1243
1244
|
selected: isSelected,
|
|
@@ -1251,8 +1252,8 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1251
1252
|
},
|
|
1252
1253
|
item
|
|
1253
1254
|
);
|
|
1254
|
-
})))) : /* @__PURE__ */
|
|
1255
|
-
|
|
1255
|
+
})))) : /* @__PURE__ */ React25.createElement(import_ui20.Stack, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React25.createElement(import_icons5.PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React25.createElement(import_ui20.Typography, { align: "center", variant: "caption", color: "text.secondary" }, (0, import_i18n9.__)("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React25.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React25.createElement(import_ui20.Typography, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React25.createElement(
|
|
1256
|
+
import_ui20.Link,
|
|
1256
1257
|
{
|
|
1257
1258
|
color: "secondary",
|
|
1258
1259
|
variant: "caption",
|
|
@@ -1265,20 +1266,18 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
|
|
|
1265
1266
|
});
|
|
1266
1267
|
|
|
1267
1268
|
// src/controls/url-control.tsx
|
|
1268
|
-
var
|
|
1269
|
-
var
|
|
1269
|
+
var React26 = __toESM(require("react"));
|
|
1270
|
+
var import_editor_props16 = require("@elementor/editor-props");
|
|
1271
|
+
var import_ui21 = require("@elementor/ui");
|
|
1270
1272
|
var UrlControl = createControl(({ placeholder }) => {
|
|
1271
|
-
const { value, setValue } = useBoundProp();
|
|
1272
|
-
const handleChange = (event) => setValue(
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
});
|
|
1276
|
-
return /* @__PURE__ */ React24.createElement(ControlActions, null, /* @__PURE__ */ React24.createElement(
|
|
1277
|
-
import_ui20.TextField,
|
|
1273
|
+
const { value, setValue } = useBoundProp(import_editor_props16.urlPropTypeUtil);
|
|
1274
|
+
const handleChange = (event) => setValue(event.target.value);
|
|
1275
|
+
return /* @__PURE__ */ React26.createElement(ControlActions, null, /* @__PURE__ */ React26.createElement(
|
|
1276
|
+
import_ui21.TextField,
|
|
1278
1277
|
{
|
|
1279
1278
|
size: "tiny",
|
|
1280
1279
|
fullWidth: true,
|
|
1281
|
-
value: value
|
|
1280
|
+
value: value ?? "",
|
|
1282
1281
|
onChange: handleChange,
|
|
1283
1282
|
placeholder
|
|
1284
1283
|
}
|
|
@@ -1286,36 +1285,29 @@ var UrlControl = createControl(({ placeholder }) => {
|
|
|
1286
1285
|
});
|
|
1287
1286
|
|
|
1288
1287
|
// src/controls/link-control.tsx
|
|
1289
|
-
var
|
|
1290
|
-
var
|
|
1291
|
-
var
|
|
1288
|
+
var React27 = __toESM(require("react"));
|
|
1289
|
+
var import_editor_props17 = require("@elementor/editor-props");
|
|
1290
|
+
var import_icons6 = require("@elementor/icons");
|
|
1291
|
+
var import_session = require("@elementor/session");
|
|
1292
|
+
var import_ui22 = require("@elementor/ui");
|
|
1292
1293
|
var import_i18n10 = require("@wordpress/i18n");
|
|
1293
1294
|
var SIZE3 = "tiny";
|
|
1294
|
-
var
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
const { enabled, href, isTargetBlank } = value?.value || {};
|
|
1308
|
-
const handleOnChange = (key, newValue) => {
|
|
1309
|
-
setValue({
|
|
1310
|
-
$$type: "link",
|
|
1311
|
-
value: {
|
|
1312
|
-
...value?.value ?? DEFAULT_LINK_CONTROL_VALUE.value,
|
|
1313
|
-
[key]: newValue
|
|
1314
|
-
}
|
|
1315
|
-
});
|
|
1295
|
+
var LinkControl = createControl((props) => {
|
|
1296
|
+
const { value, path, setValue, ...propContext } = useBoundProp(import_editor_props17.linkPropTypeUtil);
|
|
1297
|
+
const [linkSessionValue, setLinkSessionValue] = (0, import_session.useSessionStorage)(path.join("/"));
|
|
1298
|
+
const { allowCustomValues = false, options = {}, placeholder } = props || {};
|
|
1299
|
+
const onEnabledChange = () => {
|
|
1300
|
+
const { meta } = linkSessionValue ?? {};
|
|
1301
|
+
const { isEnabled } = meta ?? {};
|
|
1302
|
+
if (isEnabled && value) {
|
|
1303
|
+
setValue(null);
|
|
1304
|
+
} else if (linkSessionValue?.value) {
|
|
1305
|
+
setValue(linkSessionValue?.value ?? null);
|
|
1306
|
+
}
|
|
1307
|
+
setLinkSessionValue({ value, meta: { isEnabled: !isEnabled } });
|
|
1316
1308
|
};
|
|
1317
|
-
return /* @__PURE__ */
|
|
1318
|
-
|
|
1309
|
+
return /* @__PURE__ */ React27.createElement(PropProvider, { ...propContext, value, setValue }, /* @__PURE__ */ React27.createElement(import_ui22.Stack, { gap: 1.5 }, /* @__PURE__ */ React27.createElement(import_ui22.Divider, null), /* @__PURE__ */ React27.createElement(
|
|
1310
|
+
import_ui22.Stack,
|
|
1319
1311
|
{
|
|
1320
1312
|
direction: "row",
|
|
1321
1313
|
sx: {
|
|
@@ -1323,45 +1315,55 @@ var LinkControl = createControl(() => {
|
|
|
1323
1315
|
alignItems: "center"
|
|
1324
1316
|
}
|
|
1325
1317
|
},
|
|
1326
|
-
/* @__PURE__ */
|
|
1327
|
-
/* @__PURE__ */
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
SwitchControl,
|
|
1318
|
+
/* @__PURE__ */ React27.createElement(ControlLabel, null, (0, import_i18n10.__)("Link", "elementor")),
|
|
1319
|
+
/* @__PURE__ */ React27.createElement(
|
|
1320
|
+
ToggleIconControl,
|
|
1321
|
+
{
|
|
1322
|
+
enabled: linkSessionValue?.meta?.isEnabled ?? false,
|
|
1323
|
+
onIconClick: onEnabledChange,
|
|
1324
|
+
label: (0, import_i18n10.__)("Toggle Link", "elementor")
|
|
1325
|
+
}
|
|
1326
|
+
)
|
|
1327
|
+
), /* @__PURE__ */ React27.createElement(import_ui22.Collapse, { in: linkSessionValue?.meta?.isEnabled, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React27.createElement(import_ui22.Stack, { gap: 1.5 }, /* @__PURE__ */ React27.createElement(PropKeyProvider, { bind: "href" }, /* @__PURE__ */ React27.createElement(
|
|
1328
|
+
AutocompleteControl,
|
|
1338
1329
|
{
|
|
1339
|
-
|
|
1340
|
-
|
|
1330
|
+
allowCustomValues: Object.keys(options).length ? allowCustomValues : true,
|
|
1331
|
+
options,
|
|
1332
|
+
propType: import_editor_props17.stringPropTypeUtil,
|
|
1333
|
+
placeholder
|
|
1341
1334
|
}
|
|
1342
|
-
))));
|
|
1335
|
+
)), /* @__PURE__ */ React27.createElement(PropKeyProvider, { bind: "isTargetBlank" }, /* @__PURE__ */ React27.createElement(SwitchControl, null))))));
|
|
1343
1336
|
});
|
|
1344
|
-
var
|
|
1345
|
-
return /* @__PURE__ */
|
|
1337
|
+
var ToggleIconControl = ({ enabled, onIconClick, label }) => {
|
|
1338
|
+
return /* @__PURE__ */ React27.createElement(import_ui22.IconButton, { size: SIZE3, onClick: onIconClick, "aria-label": label }, enabled ? /* @__PURE__ */ React27.createElement(import_icons6.MinusIcon, { fontSize: SIZE3 }) : /* @__PURE__ */ React27.createElement(import_icons6.PlusIcon, { fontSize: SIZE3 }));
|
|
1339
|
+
};
|
|
1340
|
+
var SwitchControl = () => {
|
|
1341
|
+
const { value = false, setValue } = useBoundProp(import_editor_props17.booleanPropTypeUtil);
|
|
1342
|
+
const onChange = () => {
|
|
1343
|
+
setValue(!value);
|
|
1344
|
+
};
|
|
1345
|
+
return /* @__PURE__ */ React27.createElement(import_ui22.Grid, { container: true, alignItems: "center", flexWrap: "nowrap", justifyContent: "space-between" }, /* @__PURE__ */ React27.createElement(import_ui22.Grid, { item: true }, /* @__PURE__ */ React27.createElement(ControlLabel, null, (0, import_i18n10.__)("Open in new tab", "elementor"))), /* @__PURE__ */ React27.createElement(import_ui22.Grid, { item: true }, /* @__PURE__ */ React27.createElement(import_ui22.Switch, { checked: value, onChange })));
|
|
1346
1346
|
};
|
|
1347
1347
|
|
|
1348
1348
|
// src/controls/gap-control.tsx
|
|
1349
|
-
var
|
|
1350
|
-
var
|
|
1351
|
-
var
|
|
1352
|
-
var
|
|
1349
|
+
var React28 = __toESM(require("react"));
|
|
1350
|
+
var import_editor_props18 = require("@elementor/editor-props");
|
|
1351
|
+
var import_icons7 = require("@elementor/icons");
|
|
1352
|
+
var import_ui23 = require("@elementor/ui");
|
|
1353
1353
|
var import_i18n11 = require("@wordpress/i18n");
|
|
1354
1354
|
var GapControl = createControl(({ label }) => {
|
|
1355
|
-
const { value, setValue } = useBoundProp(
|
|
1355
|
+
const { propType, value, setValue } = useBoundProp(import_editor_props18.gapPropTypeUtil);
|
|
1356
1356
|
const { column, row, isLinked = true } = value || {};
|
|
1357
|
-
const setLinkedValue = (
|
|
1358
|
-
|
|
1357
|
+
const setLinkedValue = (newValue, _, meta) => {
|
|
1358
|
+
if (!isLinked) {
|
|
1359
|
+
return setValue(newValue);
|
|
1360
|
+
}
|
|
1361
|
+
const newDimension = newValue[meta?.bind];
|
|
1362
|
+
setValue({
|
|
1359
1363
|
isLinked,
|
|
1360
|
-
column:
|
|
1361
|
-
row:
|
|
1362
|
-
|
|
1363
|
-
};
|
|
1364
|
-
setValue(updatedValue);
|
|
1364
|
+
column: newDimension,
|
|
1365
|
+
row: newDimension
|
|
1366
|
+
});
|
|
1365
1367
|
};
|
|
1366
1368
|
const toggleLinked = () => {
|
|
1367
1369
|
const updatedValue = {
|
|
@@ -1371,9 +1373,9 @@ var GapControl = createControl(({ label }) => {
|
|
|
1371
1373
|
};
|
|
1372
1374
|
setValue(updatedValue);
|
|
1373
1375
|
};
|
|
1374
|
-
const LinkedIcon = isLinked ?
|
|
1375
|
-
return /* @__PURE__ */
|
|
1376
|
-
|
|
1376
|
+
const LinkedIcon = isLinked ? import_icons7.LinkIcon : import_icons7.DetachIcon;
|
|
1377
|
+
return /* @__PURE__ */ React28.createElement(PropProvider, { propType, value, setValue: setLinkedValue }, /* @__PURE__ */ React28.createElement(import_ui23.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React28.createElement(ControlLabel, null, label), /* @__PURE__ */ React28.createElement(
|
|
1378
|
+
import_ui23.ToggleButton,
|
|
1377
1379
|
{
|
|
1378
1380
|
"aria-label": (0, import_i18n11.__)("Link Inputs", "elementor"),
|
|
1379
1381
|
size: "tiny",
|
|
@@ -1382,51 +1384,33 @@ var GapControl = createControl(({ label }) => {
|
|
|
1382
1384
|
sx: { marginLeft: "auto" },
|
|
1383
1385
|
onChange: toggleLinked
|
|
1384
1386
|
},
|
|
1385
|
-
/* @__PURE__ */
|
|
1386
|
-
)), /* @__PURE__ */
|
|
1387
|
-
BoundPropProvider,
|
|
1388
|
-
{
|
|
1389
|
-
setValue: (newValue) => setLinkedValue("column", newValue),
|
|
1390
|
-
value: column,
|
|
1391
|
-
bind: "column"
|
|
1392
|
-
},
|
|
1393
|
-
/* @__PURE__ */ React26.createElement(SizeControl, null)
|
|
1394
|
-
))), /* @__PURE__ */ React26.createElement(import_ui22.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React26.createElement(import_ui22.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React26.createElement(ControlLabel, null, (0, import_i18n11.__)("Row", "elementor"))), /* @__PURE__ */ React26.createElement(import_ui22.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React26.createElement(
|
|
1395
|
-
BoundPropProvider,
|
|
1396
|
-
{
|
|
1397
|
-
setValue: (newValue) => setLinkedValue("row", newValue),
|
|
1398
|
-
value: row,
|
|
1399
|
-
bind: "row"
|
|
1400
|
-
},
|
|
1401
|
-
/* @__PURE__ */ React26.createElement(SizeControl, null)
|
|
1402
|
-
)))));
|
|
1387
|
+
/* @__PURE__ */ React28.createElement(LinkedIcon, { fontSize: "tiny" })
|
|
1388
|
+
)), /* @__PURE__ */ React28.createElement(import_ui23.Stack, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React28.createElement(import_ui23.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React28.createElement(import_ui23.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(ControlLabel, null, (0, import_i18n11.__)("Column", "elementor"))), /* @__PURE__ */ React28.createElement(import_ui23.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(PropKeyProvider, { bind: "column" }, /* @__PURE__ */ React28.createElement(SizeControl, null)))), /* @__PURE__ */ React28.createElement(import_ui23.Grid, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React28.createElement(import_ui23.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(ControlLabel, null, (0, import_i18n11.__)("Row", "elementor"))), /* @__PURE__ */ React28.createElement(import_ui23.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(PropKeyProvider, { bind: "row" }, /* @__PURE__ */ React28.createElement(SizeControl, null))))));
|
|
1403
1389
|
});
|
|
1404
1390
|
|
|
1405
1391
|
// src/controls/background-control/background-control.tsx
|
|
1406
|
-
var
|
|
1407
|
-
var
|
|
1408
|
-
var
|
|
1392
|
+
var React30 = __toESM(require("react"));
|
|
1393
|
+
var import_editor_props20 = require("@elementor/editor-props");
|
|
1394
|
+
var import_ui25 = require("@elementor/ui");
|
|
1409
1395
|
var import_i18n13 = require("@wordpress/i18n");
|
|
1410
1396
|
|
|
1411
1397
|
// src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
|
|
1412
|
-
var
|
|
1413
|
-
var
|
|
1414
|
-
var
|
|
1398
|
+
var React29 = __toESM(require("react"));
|
|
1399
|
+
var import_editor_props19 = require("@elementor/editor-props");
|
|
1400
|
+
var import_ui24 = require("@elementor/ui");
|
|
1401
|
+
var import_wp_media2 = require("@elementor/wp-media");
|
|
1415
1402
|
var import_i18n12 = require("@wordpress/i18n");
|
|
1416
1403
|
var initialBackgroundOverlay = {
|
|
1417
1404
|
$$type: "background-color-overlay",
|
|
1418
1405
|
value: "rgba(0, 0, 0, 0.2)"
|
|
1419
1406
|
};
|
|
1420
1407
|
var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
1421
|
-
const { value: overlayValues, setValue } = useBoundProp(
|
|
1422
|
-
|
|
1423
|
-
setValue(newValue);
|
|
1424
|
-
};
|
|
1425
|
-
return /* @__PURE__ */ React27.createElement(
|
|
1408
|
+
const { propType, value: overlayValues, setValue } = useBoundProp(import_editor_props19.backgroundOverlayPropTypeUtil);
|
|
1409
|
+
return /* @__PURE__ */ React29.createElement(PropProvider, { propType, value: overlayValues, setValue }, /* @__PURE__ */ React29.createElement(
|
|
1426
1410
|
Repeater,
|
|
1427
1411
|
{
|
|
1428
1412
|
values: overlayValues ?? [],
|
|
1429
|
-
setValues:
|
|
1413
|
+
setValues: setValue,
|
|
1430
1414
|
label: (0, import_i18n12.__)("Overlay", "elementor"),
|
|
1431
1415
|
itemSettings: {
|
|
1432
1416
|
Icon: ItemIcon2,
|
|
@@ -1435,63 +1419,43 @@ var BackgroundOverlayRepeaterControl = createControl(() => {
|
|
|
1435
1419
|
initialValues: initialBackgroundOverlay
|
|
1436
1420
|
}
|
|
1437
1421
|
}
|
|
1438
|
-
);
|
|
1439
|
-
});
|
|
1440
|
-
var ItemIcon2 = ({ value }) => /* @__PURE__ */ React27.createElement(import_ui23.UnstableColorIndicator, { size: "inherit", component: "span", value: value.value });
|
|
1441
|
-
var ItemContent2 = ({
|
|
1442
|
-
value,
|
|
1443
|
-
setValue
|
|
1444
|
-
}) => {
|
|
1445
|
-
const setBackgroundColorOverlay = (newValue) => {
|
|
1446
|
-
setValue({
|
|
1447
|
-
$$type: "background-color-overlay",
|
|
1448
|
-
value: newValue.value
|
|
1449
|
-
});
|
|
1450
|
-
};
|
|
1451
|
-
return /* @__PURE__ */ React27.createElement(import_ui23.Stack, { gap: 1.5 }, /* @__PURE__ */ React27.createElement(
|
|
1452
|
-
BoundPropProvider,
|
|
1453
|
-
{
|
|
1454
|
-
bind: "background-color-overlay",
|
|
1455
|
-
value,
|
|
1456
|
-
setValue: setBackgroundColorOverlay
|
|
1457
|
-
},
|
|
1458
|
-
/* @__PURE__ */ React27.createElement(import_ui23.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React27.createElement(import_ui23.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(ControlLabel, null, (0, import_i18n12.__)("Color", "elementor"))), /* @__PURE__ */ React27.createElement(import_ui23.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(ColorControl, null)))
|
|
1459
1422
|
));
|
|
1423
|
+
});
|
|
1424
|
+
var ItemIcon2 = ({ value }) => /* @__PURE__ */ React29.createElement(import_ui24.UnstableColorIndicator, { size: "inherit", component: "span", value: value.value });
|
|
1425
|
+
var ItemContent2 = ({ bind }) => {
|
|
1426
|
+
return /* @__PURE__ */ React29.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React29.createElement(Content2, null));
|
|
1427
|
+
};
|
|
1428
|
+
var Content2 = () => {
|
|
1429
|
+
const propContext = useBoundProp(import_editor_props19.backgroundImageOverlayPropTypeUtil);
|
|
1430
|
+
return /* @__PURE__ */ React29.createElement(import_ui24.Stack, { gap: 1.5 }, /* @__PURE__ */ React29.createElement(import_ui24.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React29.createElement(import_ui24.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React29.createElement(ControlLabel, null, (0, import_i18n12.__)("Color", "elementor"))), /* @__PURE__ */ React29.createElement(import_ui24.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React29.createElement(ColorControl, { propTypeUtil: import_editor_props19.backgroundColorOverlayPropTypeUtil }))), /* @__PURE__ */ React29.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React29.createElement(PropKeyProvider, { bind: "image-src" }, /* @__PURE__ */ React29.createElement(import_ui24.Grid, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React29.createElement(import_ui24.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React29.createElement(ImageMediaControl, null))))));
|
|
1460
1431
|
};
|
|
1461
1432
|
var ItemLabel2 = ({ value }) => {
|
|
1462
|
-
const
|
|
1463
|
-
|
|
1433
|
+
const type = value.$$type;
|
|
1434
|
+
if (type === "background-color-overlay") {
|
|
1435
|
+
return /* @__PURE__ */ React29.createElement(ItemLabelColor, { value });
|
|
1436
|
+
}
|
|
1437
|
+
if (type === "background-image-overlay") {
|
|
1438
|
+
return /* @__PURE__ */ React29.createElement(ItemLabelImage, { value });
|
|
1439
|
+
}
|
|
1440
|
+
};
|
|
1441
|
+
var ItemLabelColor = ({ value }) => {
|
|
1442
|
+
return /* @__PURE__ */ React29.createElement("span", null, value.value);
|
|
1443
|
+
};
|
|
1444
|
+
var ItemLabelImage = ({ value }) => {
|
|
1445
|
+
const { data: attachment } = (0, import_wp_media2.useWpMediaAttachment)(value?.value["image-src"]?.value.id.value || null);
|
|
1446
|
+
const imageTitle = attachment?.title || null;
|
|
1447
|
+
return /* @__PURE__ */ React29.createElement("span", null, imageTitle);
|
|
1464
1448
|
};
|
|
1465
1449
|
|
|
1466
1450
|
// src/controls/background-control/background-control.tsx
|
|
1467
1451
|
var BackgroundControl = createControl(() => {
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
setValue({
|
|
1471
|
-
...value,
|
|
1472
|
-
color: newValue
|
|
1473
|
-
});
|
|
1474
|
-
};
|
|
1475
|
-
const setBackgroundColorOverlay = (newValue) => {
|
|
1476
|
-
setValue({
|
|
1477
|
-
...value,
|
|
1478
|
-
"background-overlay": newValue
|
|
1479
|
-
});
|
|
1480
|
-
};
|
|
1481
|
-
return /* @__PURE__ */ React28.createElement(import_ui24.Stack, { gap: 1.5 }, /* @__PURE__ */ React28.createElement(
|
|
1482
|
-
BoundPropProvider,
|
|
1483
|
-
{
|
|
1484
|
-
bind: "background-overlay",
|
|
1485
|
-
value: value?.["background-overlay"],
|
|
1486
|
-
setValue: setBackgroundColorOverlay
|
|
1487
|
-
},
|
|
1488
|
-
/* @__PURE__ */ React28.createElement(BackgroundOverlayRepeaterControl, null)
|
|
1489
|
-
), /* @__PURE__ */ React28.createElement(BoundPropProvider, { bind: "color", value: value?.color, setValue: setColor }, /* @__PURE__ */ React28.createElement(import_ui24.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React28.createElement(import_ui24.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React28.createElement(ControlLabel, null, (0, import_i18n13.__)("Color", "elementor"))), /* @__PURE__ */ React28.createElement(import_ui24.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React28.createElement(ColorControl, null)))));
|
|
1452
|
+
const propContext = useBoundProp(import_editor_props20.backgroundPropTypeUtil);
|
|
1453
|
+
return /* @__PURE__ */ React30.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React30.createElement(import_ui25.Stack, { gap: 1.5 }, /* @__PURE__ */ React30.createElement(PropKeyProvider, { bind: "background-overlay" }, /* @__PURE__ */ React30.createElement(BackgroundOverlayRepeaterControl, null)), /* @__PURE__ */ React30.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React30.createElement(import_ui25.Grid, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React30.createElement(import_ui25.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React30.createElement(ControlLabel, null, (0, import_i18n13.__)("Color", "elementor"))), /* @__PURE__ */ React30.createElement(import_ui25.Grid, { item: true, xs: 6 }, /* @__PURE__ */ React30.createElement(ColorControl, null))))));
|
|
1490
1454
|
});
|
|
1491
1455
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1492
1456
|
0 && (module.exports = {
|
|
1457
|
+
AutocompleteControl,
|
|
1493
1458
|
BackgroundControl,
|
|
1494
|
-
BoundPropProvider,
|
|
1495
1459
|
BoxShadowRepeaterControl,
|
|
1496
1460
|
ColorControl,
|
|
1497
1461
|
ControlActionsProvider,
|
|
@@ -1505,6 +1469,8 @@ var BackgroundControl = createControl(() => {
|
|
|
1505
1469
|
LinkControl,
|
|
1506
1470
|
LinkedDimensionsControl,
|
|
1507
1471
|
NumberControl,
|
|
1472
|
+
PropKeyProvider,
|
|
1473
|
+
PropProvider,
|
|
1508
1474
|
SelectControl,
|
|
1509
1475
|
SizeControl,
|
|
1510
1476
|
StrokeControl,
|