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