@elementor/editor-controls 0.4.0 → 0.5.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/dist/index.mjs CHANGED
@@ -1,63 +1,159 @@
1
1
  // src/controls/image-control.tsx
2
- import * as React9 from "react";
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
- var BoundPropContext = createContext(null);
11
- var BoundPropProvider = ({ children, value, setValue, bind }) => {
12
- return /* @__PURE__ */ React.createElement(BoundPropContext.Provider, { value: { value, setValue, bind } }, children);
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(PropContext.Provider, { value: { value, setValue, propType } }, children);
13
35
  };
14
- function useBoundProp(propTypeUtil) {
15
- const boundPropContext = useContext(BoundPropContext);
16
- if (!boundPropContext) {
17
- throw new Error("useBoundProp must be used within a BoundPropProvider");
36
+ var usePropContext = () => {
37
+ const context = useContext(PropContext);
38
+ if (!context) {
39
+ throw new HookOutsideProviderError({
40
+ context: {
41
+ hook: "usePropContext",
42
+ provider: "PropProvider"
43
+ }
44
+ });
18
45
  }
46
+ return context;
47
+ };
48
+
49
+ // src/bound-prop-context/prop-key-context.tsx
50
+ import * as React2 from "react";
51
+ import { createContext as createContext2, useContext as useContext2 } from "react";
52
+ var PropKeyContext = createContext2(null);
53
+ var PropKeyProvider = ({ children, bind }) => {
54
+ const { propType } = usePropContext();
55
+ if (!propType) {
56
+ throw new MissingPropTypeError({ context: { bind } });
57
+ }
58
+ if (propType.kind === "array") {
59
+ return /* @__PURE__ */ React2.createElement(ArrayPropKeyProvider, { bind }, children);
60
+ }
61
+ if (propType.kind === "object") {
62
+ return /* @__PURE__ */ React2.createElement(ObjectPropKeyProvider, { bind }, children);
63
+ }
64
+ throw new UnsupportedParentError({ context: { propType } });
65
+ };
66
+ var ObjectPropKeyProvider = ({ children, bind }) => {
67
+ const context = usePropContext();
68
+ const setValue = (value2, options, meta) => {
69
+ const newValue = {
70
+ ...context.value,
71
+ [bind]: value2
72
+ };
73
+ return context?.setValue(newValue, options, { ...meta, bind });
74
+ };
75
+ const value = context.value?.[bind];
76
+ const propType = context.propType.shape[bind];
77
+ return /* @__PURE__ */ React2.createElement(PropKeyContext.Provider, { value: { ...context, value, setValue, bind, propType } }, children);
78
+ };
79
+ var ArrayPropKeyProvider = ({ children, bind }) => {
80
+ const context = usePropContext();
81
+ const setValue = (value2, options) => {
82
+ const newValue = [...context.value ?? []];
83
+ newValue[Number(bind)] = value2;
84
+ return context?.setValue(newValue, options, { bind });
85
+ };
86
+ const value = context.value?.[Number(bind)];
87
+ const propType = context.propType.item_prop_type;
88
+ return /* @__PURE__ */ React2.createElement(PropKeyContext.Provider, { value: { ...context, value, setValue, bind, propType } }, children);
89
+ };
90
+ var usePropKeyContext = () => {
91
+ const context = useContext2(PropKeyContext);
92
+ if (!context) {
93
+ throw new HookOutsideProviderError({
94
+ context: { hook: "usePropKeyContext", provider: "PropKeyProvider" }
95
+ });
96
+ }
97
+ return context;
98
+ };
99
+
100
+ // src/bound-prop-context/use-bound-prop.ts
101
+ function useBoundProp(propTypeUtil) {
102
+ const propKeyContext = usePropKeyContext();
19
103
  if (!propTypeUtil) {
20
- return boundPropContext;
104
+ return propKeyContext;
21
105
  }
22
- function setValue(value2, options) {
106
+ function setValue(value2, options, meta) {
23
107
  if (value2 === null) {
24
- return boundPropContext.setValue(null);
108
+ return propKeyContext?.setValue(null, options, meta);
25
109
  }
26
- return boundPropContext.setValue(propTypeUtil?.create(value2, options));
110
+ return propKeyContext?.setValue(propTypeUtil?.create(value2, options), {}, meta);
27
111
  }
28
- const value = propTypeUtil.extract(boundPropContext.value);
112
+ const propType = resolveUnionPropType(propKeyContext.propType, propTypeUtil.key);
113
+ const value = propTypeUtil.extract(propKeyContext.value ?? propType.default ?? null);
29
114
  return {
30
- ...boundPropContext,
115
+ ...propKeyContext,
31
116
  setValue,
32
- value
117
+ value,
118
+ propType
33
119
  };
34
120
  }
121
+ var resolveUnionPropType = (propType, key) => {
122
+ let resolvedPropType = propType;
123
+ if (propType.kind === "union") {
124
+ resolvedPropType = propType.prop_types[key];
125
+ }
126
+ if (!resolvedPropType) {
127
+ throw new MissingPropTypeError({ context: { key } });
128
+ }
129
+ return resolvedPropType;
130
+ };
35
131
 
36
132
  // src/components/control-label.tsx
37
- import * as React2 from "react";
133
+ import * as React3 from "react";
38
134
  import { Typography } from "@elementor/ui";
39
135
  var ControlLabel = ({ children }) => {
40
- return /* @__PURE__ */ React2.createElement(Typography, { component: "label", variant: "caption", color: "text.secondary" }, children);
136
+ return /* @__PURE__ */ React3.createElement(Typography, { component: "label", variant: "caption", color: "text.secondary" }, children);
41
137
  };
42
138
 
43
139
  // src/create-control.tsx
44
- import * as React4 from "react";
140
+ import * as React5 from "react";
45
141
  import { ErrorBoundary } from "@elementor/ui";
46
142
 
47
143
  // src/create-control-replacement.tsx
48
- import * as React3 from "react";
49
- import { createContext as createContext2, useContext as useContext2 } from "react";
50
- var ControlReplacementContext = createContext2(void 0);
144
+ import * as React4 from "react";
145
+ import { createContext as createContext3, useContext as useContext3 } from "react";
146
+ var ControlReplacementContext = createContext3(void 0);
51
147
  var ControlReplacementProvider = ({
52
148
  component,
53
149
  condition,
54
150
  children
55
151
  }) => {
56
- return /* @__PURE__ */ React3.createElement(ControlReplacementContext.Provider, { value: { component, condition } }, children);
152
+ return /* @__PURE__ */ React4.createElement(ControlReplacementContext.Provider, { value: { component, condition } }, children);
57
153
  };
58
154
  var useControlReplacement = () => {
59
155
  const { value } = useBoundProp();
60
- const controlReplacement = useContext2(ControlReplacementContext);
156
+ const controlReplacement = useContext3(ControlReplacementContext);
61
157
  let shouldReplace = false;
62
158
  try {
63
159
  shouldReplace = !!controlReplacement?.condition({ value }) && !!controlReplacement.component;
@@ -82,14 +178,14 @@ function createControl(Component, { supportsReplacements = true } = {}) {
82
178
  return (props) => {
83
179
  const ControlReplacement = useControlReplacement();
84
180
  if (ControlReplacement && supportsReplacements) {
85
- return /* @__PURE__ */ React4.createElement(ErrorBoundary, { fallback: null }, /* @__PURE__ */ React4.createElement(ControlReplacement, { ...props }));
181
+ return /* @__PURE__ */ React5.createElement(ErrorBoundary, { fallback: null }, /* @__PURE__ */ React5.createElement(ControlReplacement, { ...props }));
86
182
  }
87
- return /* @__PURE__ */ React4.createElement(ErrorBoundary, { fallback: null }, /* @__PURE__ */ React4.createElement(Component, { ...props }));
183
+ return /* @__PURE__ */ React5.createElement(ErrorBoundary, { fallback: null }, /* @__PURE__ */ React5.createElement(Component, { ...props }));
88
184
  };
89
185
  }
90
186
 
91
187
  // src/controls/image-media-control.tsx
92
- import * as React7 from "react";
188
+ import * as React8 from "react";
93
189
  import { imageSrcPropTypeUtil } from "@elementor/editor-props";
94
190
  import { UploadIcon } from "@elementor/icons";
95
191
  import { Button, Card, CardMedia, CardOverlay, CircularProgress, Stack } from "@elementor/ui";
@@ -97,16 +193,16 @@ import { useWpMediaAttachment, useWpMediaFrame } from "@elementor/wp-media";
97
193
  import { __ } from "@wordpress/i18n";
98
194
 
99
195
  // src/control-actions/control-actions.tsx
100
- import * as React6 from "react";
196
+ import * as React7 from "react";
101
197
  import { styled, UnstableFloatingActionBar } from "@elementor/ui";
102
198
 
103
199
  // src/control-actions/control-actions-context.tsx
104
- import * as React5 from "react";
105
- import { createContext as createContext3, useContext as useContext3 } from "react";
106
- var Context = createContext3(null);
107
- var ControlActionsProvider = ({ children, items }) => /* @__PURE__ */ React5.createElement(Context.Provider, { value: { items } }, children);
200
+ import * as React6 from "react";
201
+ import { createContext as createContext4, useContext as useContext4 } from "react";
202
+ var Context = createContext4(null);
203
+ var ControlActionsProvider = ({ children, items }) => /* @__PURE__ */ React6.createElement(Context.Provider, { value: { items } }, children);
108
204
  var useControlActions = () => {
109
- const context = useContext3(Context);
205
+ const context = useContext4(Context);
110
206
  if (!context) {
111
207
  throw new Error("useControlActions must be used within a ControlActionsProvider");
112
208
  }
@@ -126,8 +222,8 @@ function ControlActions({ children }) {
126
222
  if (items.length === 0) {
127
223
  return children;
128
224
  }
129
- const menuItems = items.map(({ MenuItem: MenuItem4, id }) => /* @__PURE__ */ React6.createElement(MenuItem4, { key: id }));
130
- return /* @__PURE__ */ React6.createElement(FloatingBarContainer, null, /* @__PURE__ */ React6.createElement(UnstableFloatingActionBar, { actions: menuItems }, children));
225
+ const menuItems = items.map(({ MenuItem: MenuItem4, id }) => /* @__PURE__ */ React7.createElement(MenuItem4, { key: id }));
226
+ return /* @__PURE__ */ React7.createElement(FloatingBarContainer, null, /* @__PURE__ */ React7.createElement(UnstableFloatingActionBar, { actions: menuItems }, children));
131
227
  }
132
228
 
133
229
  // src/controls/image-media-control.tsx
@@ -135,7 +231,7 @@ var ImageMediaControl = createControl(() => {
135
231
  const { value, setValue } = useBoundProp(imageSrcPropTypeUtil);
136
232
  const { id, url } = value ?? {};
137
233
  const { data: attachment, isFetching } = useWpMediaAttachment(id?.value || null);
138
- const src = attachment?.url ?? url;
234
+ const src = attachment?.url ?? url?.value ?? null;
139
235
  const { open } = useWpMediaFrame({
140
236
  types: ["image"],
141
237
  multiple: false,
@@ -150,7 +246,7 @@ var ImageMediaControl = createControl(() => {
150
246
  });
151
247
  }
152
248
  });
153
- return /* @__PURE__ */ React7.createElement(Card, { variant: "outlined" }, /* @__PURE__ */ React7.createElement(CardMedia, { image: src, sx: { height: 150 } }, isFetching ? /* @__PURE__ */ React7.createElement(Stack, { justifyContent: "center", alignItems: "center", width: "100%", height: "100%" }, /* @__PURE__ */ React7.createElement(CircularProgress, null)) : null), /* @__PURE__ */ React7.createElement(CardOverlay, null, /* @__PURE__ */ React7.createElement(ControlActions, null, /* @__PURE__ */ React7.createElement(Stack, { gap: 1 }, /* @__PURE__ */ React7.createElement(
249
+ 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
250
  Button,
155
251
  {
156
252
  size: "tiny",
@@ -159,13 +255,13 @@ var ImageMediaControl = createControl(() => {
159
255
  onClick: () => open({ mode: "browse" })
160
256
  },
161
257
  __("Select Image", "elementor")
162
- ), /* @__PURE__ */ React7.createElement(
258
+ ), /* @__PURE__ */ React8.createElement(
163
259
  Button,
164
260
  {
165
261
  size: "tiny",
166
262
  variant: "text",
167
263
  color: "inherit",
168
- startIcon: /* @__PURE__ */ React7.createElement(UploadIcon, null),
264
+ startIcon: /* @__PURE__ */ React8.createElement(UploadIcon, null),
169
265
  onClick: () => open({ mode: "upload" })
170
266
  },
171
267
  __("Upload Image", "elementor")
@@ -173,7 +269,7 @@ var ImageMediaControl = createControl(() => {
173
269
  });
174
270
 
175
271
  // src/controls/select-control.tsx
176
- import * as React8 from "react";
272
+ import * as React9 from "react";
177
273
  import { stringPropTypeUtil } from "@elementor/editor-props";
178
274
  import { MenuItem, Select } from "@elementor/ui";
179
275
  var SelectControl = createControl(({ options, onChange }) => {
@@ -182,36 +278,23 @@ var SelectControl = createControl(({ options, onChange }) => {
182
278
  onChange?.(event.target.value, value);
183
279
  setValue(event.target.value);
184
280
  };
185
- return /* @__PURE__ */ React8.createElement(ControlActions, null, /* @__PURE__ */ React8.createElement(Select, { displayEmpty: true, size: "tiny", value: value ?? "", onChange: handleChange, fullWidth: true }, options.map(({ label, ...props }) => /* @__PURE__ */ React8.createElement(MenuItem, { key: props.value, ...props }, label))));
281
+ 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
282
  });
187
283
 
188
284
  // src/controls/image-control.tsx
189
285
  var ImageControl = createControl((props) => {
190
- const { value, setValue } = useBoundProp(imagePropTypeUtil);
191
- const { src, size } = value || {};
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 })))));
286
+ const propContext = useBoundProp(imagePropTypeUtil);
287
+ 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
288
  });
206
289
 
207
290
  // src/controls/text-control.tsx
208
- import * as React10 from "react";
291
+ import * as React11 from "react";
209
292
  import { stringPropTypeUtil as stringPropTypeUtil2 } from "@elementor/editor-props";
210
293
  import { TextField } from "@elementor/ui";
211
294
  var TextControl = createControl(({ placeholder }) => {
212
295
  const { value, setValue } = useBoundProp(stringPropTypeUtil2);
213
296
  const handleChange = (event) => setValue(event.target.value);
214
- return /* @__PURE__ */ React10.createElement(ControlActions, null, /* @__PURE__ */ React10.createElement(
297
+ return /* @__PURE__ */ React11.createElement(ControlActions, null, /* @__PURE__ */ React11.createElement(
215
298
  TextField,
216
299
  {
217
300
  size: "tiny",
@@ -224,7 +307,7 @@ var TextControl = createControl(({ placeholder }) => {
224
307
  });
225
308
 
226
309
  // src/controls/text-area-control.tsx
227
- import * as React11 from "react";
310
+ import * as React12 from "react";
228
311
  import { stringPropTypeUtil as stringPropTypeUtil3 } from "@elementor/editor-props";
229
312
  import { TextField as TextField2 } from "@elementor/ui";
230
313
  var TextAreaControl = createControl(({ placeholder }) => {
@@ -232,7 +315,7 @@ var TextAreaControl = createControl(({ placeholder }) => {
232
315
  const handleChange = (event) => {
233
316
  setValue(event.target.value);
234
317
  };
235
- return /* @__PURE__ */ React11.createElement(ControlActions, null, /* @__PURE__ */ React11.createElement(
318
+ return /* @__PURE__ */ React12.createElement(ControlActions, null, /* @__PURE__ */ React12.createElement(
236
319
  TextField2,
237
320
  {
238
321
  size: "tiny",
@@ -247,17 +330,17 @@ var TextAreaControl = createControl(({ placeholder }) => {
247
330
  });
248
331
 
249
332
  // src/controls/size-control.tsx
250
- import * as React13 from "react";
333
+ import * as React14 from "react";
251
334
  import { sizePropTypeUtil } from "@elementor/editor-props";
252
335
  import { InputAdornment as InputAdornment2 } from "@elementor/ui";
253
336
 
254
337
  // src/components/text-field-inner-selection.tsx
255
- import * as React12 from "react";
338
+ import * as React13 from "react";
256
339
  import { forwardRef, useId } from "react";
257
340
  import { bindMenu, bindTrigger, Button as Button2, InputAdornment, Menu, MenuItem as MenuItem2, TextField as TextField3, usePopupState } from "@elementor/ui";
258
341
  var TextFieldInnerSelection = forwardRef(
259
342
  ({ placeholder, type, value, onChange, endAdornment, startAdornment }, ref) => {
260
- return /* @__PURE__ */ React12.createElement(
343
+ return /* @__PURE__ */ React13.createElement(
261
344
  TextField3,
262
345
  {
263
346
  size: "tiny",
@@ -288,7 +371,7 @@ var SelectionEndAdornment = ({
288
371
  onClick(options[index]);
289
372
  popupState.close();
290
373
  };
291
- return /* @__PURE__ */ React12.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React12.createElement(
374
+ return /* @__PURE__ */ React13.createElement(InputAdornment, { position: "end" }, /* @__PURE__ */ React13.createElement(
292
375
  Button2,
293
376
  {
294
377
  size: "small",
@@ -297,7 +380,7 @@ var SelectionEndAdornment = ({
297
380
  ...bindTrigger(popupState)
298
381
  },
299
382
  value.toUpperCase()
300
- ), /* @__PURE__ */ React12.createElement(Menu, { MenuListProps: { dense: true }, ...bindMenu(popupState) }, options.map((option, index) => /* @__PURE__ */ React12.createElement(MenuItem2, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
383
+ ), /* @__PURE__ */ React13.createElement(Menu, { MenuListProps: { dense: true }, ...bindMenu(popupState) }, options.map((option, index) => /* @__PURE__ */ React13.createElement(MenuItem2, { key: option, onClick: () => handleMenuItemClick(index) }, option.toUpperCase()))));
301
384
  };
302
385
 
303
386
  // src/hooks/use-sync-external-state.tsx
@@ -358,10 +441,10 @@ var SizeControl = createControl(({ units: units2 = defaultUnits, placeholder, st
358
441
  size: size || size === "0" ? parseFloat(size) : defaultSize
359
442
  }));
360
443
  };
361
- return /* @__PURE__ */ React13.createElement(ControlActions, null, /* @__PURE__ */ React13.createElement(
444
+ return /* @__PURE__ */ React14.createElement(ControlActions, null, /* @__PURE__ */ React14.createElement(
362
445
  TextFieldInnerSelection,
363
446
  {
364
- endAdornment: /* @__PURE__ */ React13.createElement(
447
+ endAdornment: /* @__PURE__ */ React14.createElement(
365
448
  SelectionEndAdornment,
366
449
  {
367
450
  options: units2,
@@ -370,7 +453,7 @@ var SizeControl = createControl(({ units: units2 = defaultUnits, placeholder, st
370
453
  }
371
454
  ),
372
455
  placeholder,
373
- startAdornment: startIcon ?? /* @__PURE__ */ React13.createElement(InputAdornment2, { position: "start" }, startIcon),
456
+ startAdornment: startIcon ?? /* @__PURE__ */ React14.createElement(InputAdornment2, { position: "start" }, startIcon),
374
457
  type: "number",
375
458
  value: Number.isNaN(state?.size) ? "" : state?.size,
376
459
  onChange: handleSizeChange
@@ -379,84 +462,39 @@ var SizeControl = createControl(({ units: units2 = defaultUnits, placeholder, st
379
462
  });
380
463
 
381
464
  // src/controls/stroke-control.tsx
382
- import * as React15 from "react";
465
+ import * as React16 from "react";
383
466
  import { strokePropTypeUtil } from "@elementor/editor-props";
384
467
  import { Grid as Grid2, Stack as Stack3 } from "@elementor/ui";
385
468
  import { __ as __3 } from "@wordpress/i18n";
386
469
 
387
470
  // src/controls/color-control.tsx
388
- import * as React14 from "react";
471
+ import * as React15 from "react";
389
472
  import { colorPropTypeUtil } from "@elementor/editor-props";
390
473
  import { UnstableColorField } from "@elementor/ui";
391
- var ColorControl = createControl(
392
- (props) => {
393
- const { value, setValue } = useBoundProp(colorPropTypeUtil);
394
- const handleChange = (selectedColor) => {
395
- setValue(selectedColor);
396
- };
397
- return /* @__PURE__ */ React14.createElement(ControlActions, null, /* @__PURE__ */ React14.createElement(
398
- UnstableColorField,
399
- {
400
- size: "tiny",
401
- ...props,
402
- value: value ?? "",
403
- onChange: handleChange,
404
- fullWidth: true
405
- }
406
- ));
407
- }
408
- );
474
+ var ColorControl = createControl(({ propTypeUtil = colorPropTypeUtil, ...props }) => {
475
+ const { value, setValue } = useBoundProp(propTypeUtil);
476
+ const handleChange = (selectedColor) => {
477
+ setValue(selectedColor);
478
+ };
479
+ return /* @__PURE__ */ React15.createElement(ControlActions, null, /* @__PURE__ */ React15.createElement(UnstableColorField, { size: "tiny", ...props, value: value ?? "", onChange: handleChange, fullWidth: true }));
480
+ });
409
481
 
410
482
  // src/controls/stroke-control.tsx
411
483
  var units = ["px", "em", "rem"];
412
484
  var StrokeControl = createControl(() => {
413
- const { value, setValue } = useBoundProp(strokePropTypeUtil);
414
- const setStrokeWidth = (newValue) => {
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
- ));
485
+ const propContext = useBoundProp(strokePropTypeUtil);
486
+ return /* @__PURE__ */ React16.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React16.createElement(Stack3, { gap: 1.5 }, /* @__PURE__ */ React16.createElement(Control, { bind: "width", label: __3("Stroke Width", "elementor") }, /* @__PURE__ */ React16.createElement(SizeControl, { units })), /* @__PURE__ */ React16.createElement(Control, { bind: "color", label: __3("Stroke Color", "elementor") }, /* @__PURE__ */ React16.createElement(ColorControl, null))));
447
487
  });
448
- var Control = ({ bind, value, setValue, label, children }) => /* @__PURE__ */ React15.createElement(BoundPropProvider, { bind, value, setValue }, /* @__PURE__ */ React15.createElement(Grid2, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React15.createElement(Grid2, { item: true, xs: 6 }, /* @__PURE__ */ React15.createElement(ControlLabel, null, label)), /* @__PURE__ */ React15.createElement(Grid2, { item: true, xs: 6 }, children)));
488
+ var Control = ({ bind, label, children }) => /* @__PURE__ */ React16.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React16.createElement(Grid2, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React16.createElement(Grid2, { item: true, xs: 6 }, /* @__PURE__ */ React16.createElement(ControlLabel, null, label)), /* @__PURE__ */ React16.createElement(Grid2, { item: true, xs: 6 }, children)));
449
489
 
450
490
  // src/controls/box-shadow-repeater-control.tsx
451
- import * as React17 from "react";
452
- import {
453
- boxShadowPropTypeUtil
454
- } from "@elementor/editor-props";
491
+ import * as React18 from "react";
492
+ import { boxShadowPropTypeUtil, shadowPropTypeUtil } from "@elementor/editor-props";
455
493
  import { Grid as Grid3, Stack as Stack5, Typography as Typography3, UnstableColorIndicator } from "@elementor/ui";
456
494
  import { __ as __5 } from "@wordpress/i18n";
457
495
 
458
496
  // src/components/repeater.tsx
459
- import * as React16 from "react";
497
+ import * as React17 from "react";
460
498
  import { useId as useId2, useRef, useState as useState2 } from "react";
461
499
  import { CopyIcon, EyeIcon, EyeOffIcon, PlusIcon, XIcon } from "@elementor/icons";
462
500
  import {
@@ -503,27 +541,18 @@ var Repeater = ({
503
541
  })
504
542
  );
505
543
  };
506
- return /* @__PURE__ */ React16.createElement(Stack4, null, /* @__PURE__ */ React16.createElement(Stack4, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pb: 1 } }, /* @__PURE__ */ React16.createElement(Typography2, { component: "label", variant: "caption", color: "text.secondary" }, label), /* @__PURE__ */ React16.createElement(IconButton, { size: SIZE, onClick: addRepeaterItem, "aria-label": __4("Add item", "elementor") }, /* @__PURE__ */ React16.createElement(PlusIcon, { fontSize: SIZE }))), /* @__PURE__ */ React16.createElement(Stack4, { gap: 1 }, repeaterValues.map((value, index) => /* @__PURE__ */ React16.createElement(
544
+ return /* @__PURE__ */ React17.createElement(Stack4, null, /* @__PURE__ */ React17.createElement(Stack4, { direction: "row", justifyContent: "space-between", alignItems: "center", sx: { pb: 1 } }, /* @__PURE__ */ React17.createElement(Typography2, { component: "label", variant: "caption", color: "text.secondary" }, label), /* @__PURE__ */ React17.createElement(IconButton, { size: SIZE, onClick: addRepeaterItem, "aria-label": __4("Add item", "elementor") }, /* @__PURE__ */ React17.createElement(PlusIcon, { fontSize: SIZE }))), /* @__PURE__ */ React17.createElement(Stack4, { gap: 1 }, repeaterValues.map((value, index) => /* @__PURE__ */ React17.createElement(
507
545
  RepeaterItem,
508
546
  {
509
547
  key: index,
510
548
  disabled: value.disabled,
511
- label: /* @__PURE__ */ React16.createElement(itemSettings.Label, { value }),
512
- startIcon: /* @__PURE__ */ React16.createElement(itemSettings.Icon, { value }),
549
+ label: /* @__PURE__ */ React17.createElement(itemSettings.Label, { value }),
550
+ startIcon: /* @__PURE__ */ React17.createElement(itemSettings.Icon, { value }),
513
551
  removeItem: () => removeRepeaterItem(index),
514
552
  duplicateItem: () => duplicateRepeaterItem(index),
515
553
  toggleDisableItem: () => toggleDisableRepeaterItem(index)
516
554
  },
517
- (props) => /* @__PURE__ */ React16.createElement(
518
- itemSettings.Content,
519
- {
520
- ...props,
521
- value,
522
- setValue: (newValue) => setRepeaterValues(
523
- repeaterValues.map((item, i) => i === index ? newValue : item)
524
- )
525
- }
526
- )
555
+ (props) => /* @__PURE__ */ React17.createElement(itemSettings.Content, { ...props, bind: String(index) })
527
556
  ))));
528
557
  };
529
558
  var RepeaterItem = ({
@@ -540,7 +569,7 @@ var RepeaterItem = ({
540
569
  const [anchorEl, setAnchorEl] = useState2(null);
541
570
  const popoverState = usePopupState2({ popupId, variant: "popover" });
542
571
  const popoverProps = bindPopover(popoverState);
543
- return /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
572
+ return /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
544
573
  UnstableTag,
545
574
  {
546
575
  label,
@@ -550,33 +579,33 @@ var RepeaterItem = ({
550
579
  "aria-label": __4("Open item", "elementor"),
551
580
  ...bindTrigger2(popoverState),
552
581
  startIcon,
553
- actions: /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(
582
+ actions: /* @__PURE__ */ React17.createElement(React17.Fragment, null, /* @__PURE__ */ React17.createElement(
554
583
  IconButton,
555
584
  {
556
585
  size: SIZE,
557
586
  onClick: duplicateItem,
558
587
  "aria-label": __4("Duplicate item", "elementor")
559
588
  },
560
- /* @__PURE__ */ React16.createElement(CopyIcon, { fontSize: SIZE })
561
- ), /* @__PURE__ */ React16.createElement(
589
+ /* @__PURE__ */ React17.createElement(CopyIcon, { fontSize: SIZE })
590
+ ), /* @__PURE__ */ React17.createElement(
562
591
  IconButton,
563
592
  {
564
593
  size: SIZE,
565
594
  onClick: toggleDisableItem,
566
595
  "aria-label": disabled ? __4("Enable item", "elementor") : __4("Disable item", "elementor")
567
596
  },
568
- disabled ? /* @__PURE__ */ React16.createElement(EyeOffIcon, { fontSize: SIZE }) : /* @__PURE__ */ React16.createElement(EyeIcon, { fontSize: SIZE })
569
- ), /* @__PURE__ */ React16.createElement(
597
+ disabled ? /* @__PURE__ */ React17.createElement(EyeOffIcon, { fontSize: SIZE }) : /* @__PURE__ */ React17.createElement(EyeIcon, { fontSize: SIZE })
598
+ ), /* @__PURE__ */ React17.createElement(
570
599
  IconButton,
571
600
  {
572
601
  size: SIZE,
573
602
  onClick: removeItem,
574
603
  "aria-label": __4("Remove item", "elementor")
575
604
  },
576
- /* @__PURE__ */ React16.createElement(XIcon, { fontSize: SIZE })
605
+ /* @__PURE__ */ React17.createElement(XIcon, { fontSize: SIZE })
577
606
  ))
578
607
  }
579
- ), /* @__PURE__ */ React16.createElement(
608
+ ), /* @__PURE__ */ React17.createElement(
580
609
  Popover,
581
610
  {
582
611
  disablePortal: true,
@@ -589,21 +618,18 @@ var RepeaterItem = ({
589
618
  anchorOrigin: { vertical: "bottom", horizontal: "left" },
590
619
  ...popoverProps
591
620
  },
592
- /* @__PURE__ */ React16.createElement(Box, { p: 0.5 }, children({ anchorEl }))
621
+ /* @__PURE__ */ React17.createElement(Box, { p: 0.5 }, children({ anchorEl }))
593
622
  ));
594
623
  };
595
624
 
596
625
  // src/controls/box-shadow-repeater-control.tsx
597
626
  var BoxShadowRepeaterControl = createControl(() => {
598
- const { value: boxShadowValues, setValue } = useBoundProp(boxShadowPropTypeUtil);
599
- const setBoxShadow = (newValue) => {
600
- setValue(newValue);
601
- };
602
- return /* @__PURE__ */ React17.createElement(
627
+ const { propType, value, setValue } = useBoundProp(boxShadowPropTypeUtil);
628
+ return /* @__PURE__ */ React18.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React18.createElement(
603
629
  Repeater,
604
630
  {
605
- values: boxShadowValues ?? [],
606
- setValues: setBoxShadow,
631
+ values: value ?? [],
632
+ setValues: setValue,
607
633
  label: __5("Box shadow", "elementor"),
608
634
  itemSettings: {
609
635
  Icon: ItemIcon,
@@ -612,108 +638,42 @@ var BoxShadowRepeaterControl = createControl(() => {
612
638
  initialValues: initialShadow
613
639
  }
614
640
  }
615
- );
641
+ ));
616
642
  });
617
- var ItemIcon = ({ value }) => /* @__PURE__ */ React17.createElement(UnstableColorIndicator, { size: "inherit", component: "span", value: value.value.color.value });
618
- var ItemContent = ({
619
- value,
620
- setValue,
621
- anchorEl
622
- }) => {
623
- const setShadow = (newValue) => {
624
- setValue({
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,
643
+ var ItemIcon = ({ value }) => /* @__PURE__ */ React18.createElement(UnstableColorIndicator, { size: "inherit", component: "span", value: value.value.color.value });
644
+ var ItemContent = ({ anchorEl, bind }) => {
645
+ return /* @__PURE__ */ React18.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React18.createElement(Content, { anchorEl }));
646
+ };
647
+ var Content = ({ anchorEl }) => {
648
+ const { propType, value, setValue } = useBoundProp(shadowPropTypeUtil);
649
+ return /* @__PURE__ */ React18.createElement(PropProvider, { propType, value, setValue }, /* @__PURE__ */ React18.createElement(Stack5, { gap: 1.5 }, /* @__PURE__ */ React18.createElement(Grid3, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React18.createElement(Control2, { bind: "color", label: __5("Color", "elementor") }, /* @__PURE__ */ React18.createElement(
650
+ ColorControl,
631
651
  {
632
- bind: "color",
633
- value: value.value.color,
634
- label: __5("Color", "elementor"),
635
- setValue: (v) => setShadow({ ...value.value, color: v })
636
- },
637
- /* @__PURE__ */ React17.createElement(
638
- ColorControl,
639
- {
640
- slotProps: {
641
- colorPicker: {
642
- anchorEl,
643
- anchorOrigin: {
644
- vertical: "top",
645
- horizontal: "right"
646
- },
647
- transformOrigin: {
648
- vertical: "top",
649
- horizontal: -10
650
- }
652
+ slotProps: {
653
+ colorPicker: {
654
+ anchorEl,
655
+ anchorOrigin: {
656
+ vertical: "top",
657
+ horizontal: "right"
658
+ },
659
+ transformOrigin: {
660
+ vertical: "top",
661
+ horizontal: -10
651
662
  }
652
663
  }
653
664
  }
654
- )
655
- ), /* @__PURE__ */ React17.createElement(
656
- Control2,
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,
665
+ }
666
+ )), /* @__PURE__ */ React18.createElement(Control2, { bind: "position", label: __5("Position", "elementor") }, /* @__PURE__ */ React18.createElement(
667
+ SelectControl,
701
668
  {
702
- bind: "spread",
703
- label: __5("Spread", "elementor"),
704
- value: value.value.spread,
705
- setValue: (v) => setShadow({ ...value.value, spread: v })
706
- },
707
- /* @__PURE__ */ React17.createElement(SizeControl, null)
708
- )));
669
+ options: [
670
+ { label: __5("Inset", "elementor"), value: "inset" },
671
+ { label: __5("Outset", "elementor"), value: "" }
672
+ ]
673
+ }
674
+ ))), /* @__PURE__ */ React18.createElement(Grid3, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React18.createElement(Control2, { bind: "hOffset", label: __5("Horizontal", "elementor") }, /* @__PURE__ */ React18.createElement(SizeControl, null)), /* @__PURE__ */ React18.createElement(Control2, { bind: "vOffset", label: __5("Vertical", "elementor") }, /* @__PURE__ */ React18.createElement(SizeControl, null))), /* @__PURE__ */ React18.createElement(Grid3, { container: true, gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React18.createElement(Control2, { bind: "blur", label: __5("Blur", "elementor") }, /* @__PURE__ */ React18.createElement(SizeControl, null)), /* @__PURE__ */ React18.createElement(Control2, { bind: "spread", label: __5("Spread", "elementor") }, /* @__PURE__ */ React18.createElement(SizeControl, null)))));
709
675
  };
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))));
676
+ var Control2 = ({ label, bind, children }) => /* @__PURE__ */ React18.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React18.createElement(Grid3, { item: true, xs: 6 }, /* @__PURE__ */ React18.createElement(Grid3, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React18.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React18.createElement(Typography3, { component: "label", variant: "caption", color: "text.secondary" }, label)), /* @__PURE__ */ React18.createElement(Grid3, { item: true, xs: 12 }, children))));
717
677
  var ItemLabel = ({ value }) => {
718
678
  const { position, hOffset, vOffset, blur, spread } = value.value;
719
679
  const { size: blurSize = "", unit: blurUnit = "" } = blur?.value || {};
@@ -726,7 +686,7 @@ var ItemLabel = ({ value }) => {
726
686
  blurSize + blurUnit,
727
687
  spreadSize + spreadUnit
728
688
  ].join(" ");
729
- return /* @__PURE__ */ React17.createElement("span", { style: { textTransform: "capitalize" } }, position ?? "outset", ": ", sizes);
689
+ return /* @__PURE__ */ React18.createElement("span", { style: { textTransform: "capitalize" } }, position ?? "outset", ": ", sizes);
730
690
  };
731
691
  var initialShadow = {
732
692
  $$type: "shadow",
@@ -756,11 +716,11 @@ var initialShadow = {
756
716
  };
757
717
 
758
718
  // src/controls/toggle-control.tsx
759
- import * as React19 from "react";
719
+ import * as React20 from "react";
760
720
  import { stringPropTypeUtil as stringPropTypeUtil4 } from "@elementor/editor-props";
761
721
 
762
722
  // src/components/control-toggle-button-group.tsx
763
- import * as React18 from "react";
723
+ import * as React19 from "react";
764
724
  import {
765
725
  styled as styled2,
766
726
  ToggleButton,
@@ -784,7 +744,7 @@ var ControlToggleButtonGroup = ({
784
744
  const handleChange = (_, newValue) => {
785
745
  onChange(newValue);
786
746
  };
787
- return /* @__PURE__ */ React18.createElement(
747
+ return /* @__PURE__ */ React19.createElement(
788
748
  StyledToggleButtonGroup,
789
749
  {
790
750
  justify,
@@ -796,7 +756,7 @@ var ControlToggleButtonGroup = ({
796
756
  }
797
757
  },
798
758
  items.map(
799
- ({ label, value: buttonValue, renderContent: Content, showTooltip }) => showTooltip ? /* @__PURE__ */ React18.createElement(Tooltip, { key: buttonValue, title: label, disableFocusListener: true, placement: "top" }, /* @__PURE__ */ React18.createElement(ToggleButton, { value: buttonValue, "aria-label": label, size, fullWidth }, /* @__PURE__ */ React18.createElement(Content, { size }))) : /* @__PURE__ */ React18.createElement(
759
+ ({ label, value: buttonValue, renderContent: Content3, showTooltip }) => showTooltip ? /* @__PURE__ */ React19.createElement(Tooltip, { key: buttonValue, title: label, disableFocusListener: true, placement: "top" }, /* @__PURE__ */ React19.createElement(ToggleButton, { value: buttonValue, "aria-label": label, size, fullWidth }, /* @__PURE__ */ React19.createElement(Content3, { size }))) : /* @__PURE__ */ React19.createElement(
800
760
  ToggleButton,
801
761
  {
802
762
  key: buttonValue,
@@ -805,7 +765,7 @@ var ControlToggleButtonGroup = ({
805
765
  size,
806
766
  fullWidth
807
767
  },
808
- /* @__PURE__ */ React18.createElement(Content, { size })
768
+ /* @__PURE__ */ React19.createElement(Content3, { size })
809
769
  )
810
770
  )
811
771
  );
@@ -818,7 +778,7 @@ var ToggleControl = createControl(
818
778
  const handleToggle = (option) => {
819
779
  setValue(option);
820
780
  };
821
- return /* @__PURE__ */ React19.createElement(
781
+ return /* @__PURE__ */ React20.createElement(
822
782
  ControlToggleButtonGroup,
823
783
  {
824
784
  items: options,
@@ -833,7 +793,7 @@ var ToggleControl = createControl(
833
793
  );
834
794
 
835
795
  // src/controls/number-control.tsx
836
- import * as React20 from "react";
796
+ import * as React21 from "react";
837
797
  import { numberPropTypeUtil } from "@elementor/editor-props";
838
798
  import { TextField as TextField4 } from "@elementor/ui";
839
799
  var isEmptyOrNaN = (value) => value === null || value === void 0 || value === "" || Number.isNaN(Number(value));
@@ -855,7 +815,7 @@ var NumberControl = createControl(
855
815
  const formattedValue = shouldForceInt ? +parseInt(eventValue) : Number(eventValue);
856
816
  setValue(Math.min(Math.max(formattedValue, min), max));
857
817
  };
858
- return /* @__PURE__ */ React20.createElement(ControlActions, null, /* @__PURE__ */ React20.createElement(
818
+ return /* @__PURE__ */ React21.createElement(ControlActions, null, /* @__PURE__ */ React21.createElement(
859
819
  TextField4,
860
820
  {
861
821
  size: "tiny",
@@ -871,20 +831,19 @@ var NumberControl = createControl(
871
831
  );
872
832
 
873
833
  // src/controls/equal-unequal-sizes-control.tsx
874
- import * as React21 from "react";
834
+ import * as React22 from "react";
875
835
  import { useId as useId3, useRef as useRef2 } from "react";
876
- import {
877
- sizePropTypeUtil as sizePropTypeUtil2
878
- } from "@elementor/editor-props";
836
+ import { sizePropTypeUtil as sizePropTypeUtil2 } from "@elementor/editor-props";
879
837
  import { bindPopover as bindPopover2, bindToggle, Grid as Grid4, Popover as Popover2, Stack as Stack6, ToggleButton as ToggleButton2, usePopupState as usePopupState3 } from "@elementor/ui";
880
838
  import { __ as __6 } from "@wordpress/i18n";
881
- var isEqualSizes = (values, items) => {
839
+ var isEqualSizes = (propValue, items) => {
840
+ const values = Object.values(propValue);
882
841
  if (values.length !== items.length) {
883
842
  return false;
884
843
  }
885
844
  const [firstValue, ...restValues] = values;
886
845
  return restValues.every(
887
- (value) => value.value?.size === firstValue.value?.size && value.value?.unit === firstValue.value?.unit
846
+ (value) => value?.value?.size === firstValue?.value?.size && value?.value?.unit === firstValue?.value?.unit
888
847
  );
889
848
  };
890
849
  function EqualUnequalSizesControl({
@@ -896,45 +855,49 @@ function EqualUnequalSizesControl({
896
855
  const popupId = useId3();
897
856
  const controlRef = useRef2(null);
898
857
  const popupState = usePopupState3({ variant: "popover", popupId });
858
+ const {
859
+ propType: multiSizePropType,
860
+ value: multiSizeValue,
861
+ setValue: setMultiSizeValue
862
+ } = useBoundProp(multiSizePropTypeUtil);
899
863
  const { value: sizeValue, setValue: setSizeValue } = useBoundProp(sizePropTypeUtil2);
900
- const { value: multiSizeValue, setValue: setMultiSizeValue } = useBoundProp(multiSizePropTypeUtil);
901
864
  const splitEqualValue = () => {
902
865
  if (!sizeValue) {
903
- return {};
866
+ return null;
904
867
  }
905
- return items.reduce((acc, { bind }) => ({ ...acc, [bind]: sizePropTypeUtil2.create(sizeValue) }), {});
868
+ return items.reduce(
869
+ (acc, { bind }) => ({ ...acc, [bind]: sizePropTypeUtil2.create(sizeValue) }),
870
+ {}
871
+ );
906
872
  };
907
- const setNestedProp = (item, newValue) => {
873
+ const setNestedProp = (newValue) => {
908
874
  const newMappedValues = {
909
875
  ...multiSizeValue ?? splitEqualValue(),
910
- [item.bind]: newValue
876
+ ...newValue
911
877
  };
912
- const isEqual = isEqualSizes(Object.values(newMappedValues), items);
878
+ const isEqual = isEqualSizes(newMappedValues, items);
913
879
  if (isEqual) {
914
- return setSizeValue(newValue?.value);
880
+ return setSizeValue(Object.values(newMappedValues)[0].value);
915
881
  }
916
882
  setMultiSizeValue(newMappedValues);
917
883
  };
918
- return /* @__PURE__ */ React21.createElement(React21.Fragment, null, /* @__PURE__ */ React21.createElement(Grid4, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap", ref: controlRef }, /* @__PURE__ */ React21.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React21.createElement(ControlLabel, null, label)), /* @__PURE__ */ React21.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React21.createElement(
919
- EqualSizeControl,
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
- )
884
+ const getMultiSizeValues = () => {
885
+ if (multiSizeValue) {
886
+ return multiSizeValue;
936
887
  }
937
- ))), /* @__PURE__ */ React21.createElement(
888
+ return splitEqualValue() ?? null;
889
+ };
890
+ return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(Grid4, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap", ref: controlRef }, /* @__PURE__ */ React22.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React22.createElement(ControlLabel, null, label)), /* @__PURE__ */ React22.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React22.createElement(Stack6, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React22.createElement(SizeControl, { placeholder: __6("MIXED", "elementor") }), /* @__PURE__ */ React22.createElement(
891
+ ToggleButton2,
892
+ {
893
+ size: "tiny",
894
+ value: "check",
895
+ sx: { marginLeft: "auto" },
896
+ ...bindToggle(popupState),
897
+ selected: popupState.isOpen
898
+ },
899
+ icon
900
+ )))), /* @__PURE__ */ React22.createElement(
938
901
  Popover2,
939
902
  {
940
903
  disablePortal: true,
@@ -952,97 +915,32 @@ function EqualUnequalSizesControl({
952
915
  paper: { sx: { mt: 0.5, p: 2, pt: 1, width: controlRef.current?.getBoundingClientRect().width } }
953
916
  }
954
917
  },
955
- /* @__PURE__ */ React21.createElement(Stack6, { gap: 1.5 }, /* @__PURE__ */ React21.createElement(Grid4, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React21.createElement(
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
- )))
918
+ /* @__PURE__ */ React22.createElement(PropProvider, { propType: multiSizePropType, value: getMultiSizeValues(), setValue: setNestedProp }, /* @__PURE__ */ React22.createElement(Stack6, { gap: 1.5 }, /* @__PURE__ */ React22.createElement(Grid4, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React22.createElement(MultiSizeValueControl, { item: items[0] }), /* @__PURE__ */ React22.createElement(MultiSizeValueControl, { item: items[1] })), /* @__PURE__ */ React22.createElement(Grid4, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React22.createElement(MultiSizeValueControl, { item: items[3] }), /* @__PURE__ */ React22.createElement(MultiSizeValueControl, { item: items[2] }))))
988
919
  ));
989
920
  }
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
- };
921
+ var MultiSizeValueControl = ({ item }) => /* @__PURE__ */ React22.createElement(PropKeyProvider, { bind: item.bind }, /* @__PURE__ */ React22.createElement(Grid4, { item: true, xs: 6 }, /* @__PURE__ */ React22.createElement(Grid4, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React22.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(ControlLabel, null, item.label)), /* @__PURE__ */ React22.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(SizeControl, { startIcon: item.icon })))));
1026
922
 
1027
923
  // src/controls/linked-dimensions-control.tsx
1028
- import * as React22 from "react";
924
+ import * as React23 from "react";
1029
925
  import { linkedDimensionsPropTypeUtil } from "@elementor/editor-props";
1030
926
  import { DetachIcon, LinkIcon, SideBottomIcon, SideLeftIcon, SideRightIcon, SideTopIcon } from "@elementor/icons";
1031
927
  import { Grid as Grid5, Stack as Stack7, ToggleButton as ToggleButton3 } from "@elementor/ui";
1032
928
  import { __ as __7 } from "@wordpress/i18n";
1033
929
  var LinkedDimensionsControl = createControl(({ label }) => {
1034
- const { value, setValue } = useBoundProp(linkedDimensionsPropTypeUtil);
930
+ const { value, setValue, propType } = useBoundProp(linkedDimensionsPropTypeUtil);
1035
931
  const { top, right, bottom, left, isLinked = true } = value || {};
1036
- const setLinkedValue = (position, newValue) => {
1037
- const updatedValue = {
932
+ const setLinkedValue = (newValue, _, meta) => {
933
+ if (!isLinked) {
934
+ return setValue(newValue);
935
+ }
936
+ const newDimension = newValue[meta?.bind];
937
+ setValue({
1038
938
  isLinked,
1039
- top: isLinked ? newValue : top,
1040
- right: isLinked ? newValue : right,
1041
- bottom: isLinked ? newValue : bottom,
1042
- left: isLinked ? newValue : left,
1043
- [position]: newValue
1044
- };
1045
- setValue(updatedValue);
939
+ top: newDimension,
940
+ right: newDimension,
941
+ bottom: newDimension,
942
+ left: newDimension
943
+ });
1046
944
  };
1047
945
  const toggleLinked = () => {
1048
946
  const updatedValue = {
@@ -1055,7 +953,7 @@ var LinkedDimensionsControl = createControl(({ label }) => {
1055
953
  setValue(updatedValue);
1056
954
  };
1057
955
  const LinkedIcon = isLinked ? LinkIcon : DetachIcon;
1058
- return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(Stack7, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React22.createElement(ControlLabel, null, label), /* @__PURE__ */ React22.createElement(
956
+ return /* @__PURE__ */ React23.createElement(PropProvider, { propType, value, setValue: setLinkedValue }, /* @__PURE__ */ React23.createElement(Stack7, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React23.createElement(ControlLabel, null, label), /* @__PURE__ */ React23.createElement(
1059
957
  ToggleButton3,
1060
958
  {
1061
959
  "aria-label": __7("Link Inputs", "elementor"),
@@ -1065,51 +963,14 @@ var LinkedDimensionsControl = createControl(({ label }) => {
1065
963
  sx: { marginLeft: "auto" },
1066
964
  onChange: toggleLinked
1067
965
  },
1068
- /* @__PURE__ */ React22.createElement(LinkedIcon, { fontSize: "tiny" })
1069
- )), /* @__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("Top", "elementor"))), /* @__PURE__ */ React22.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React22.createElement(
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
- )))));
966
+ /* @__PURE__ */ React23.createElement(LinkedIcon, { fontSize: "tiny" })
967
+ )), /* @__PURE__ */ React23.createElement(Stack7, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React23.createElement(Grid5, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React23.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(ControlLabel, null, __7("Top", "elementor"))), /* @__PURE__ */ React23.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(Control3, { bind: "top", startIcon: /* @__PURE__ */ React23.createElement(SideTopIcon, { fontSize: "tiny" }) }))), /* @__PURE__ */ React23.createElement(Grid5, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React23.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(ControlLabel, null, __7("Right", "elementor"))), /* @__PURE__ */ React23.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(Control3, { bind: "right", startIcon: /* @__PURE__ */ React23.createElement(SideRightIcon, { fontSize: "tiny" }) })))), /* @__PURE__ */ React23.createElement(Stack7, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React23.createElement(Grid5, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React23.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(ControlLabel, null, __7("Bottom", "elementor"))), /* @__PURE__ */ React23.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(Control3, { bind: "bottom", startIcon: /* @__PURE__ */ React23.createElement(SideBottomIcon, { fontSize: "tiny" }) }))), /* @__PURE__ */ React23.createElement(Grid5, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React23.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(ControlLabel, null, __7("Left", "elementor"))), /* @__PURE__ */ React23.createElement(Grid5, { item: true, xs: 12 }, /* @__PURE__ */ React23.createElement(Control3, { bind: "left", startIcon: /* @__PURE__ */ React23.createElement(SideLeftIcon, { fontSize: "tiny" }) })))));
1102
968
  });
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 }));
969
+ var Control3 = ({ bind, startIcon }) => /* @__PURE__ */ React23.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React23.createElement(SizeControl, { startIcon }));
1109
970
 
1110
971
  // src/controls/font-family-control.tsx
1111
- import { Fragment as Fragment4, useId as useId4, useState as useState3 } from "react";
1112
- import * as React23 from "react";
972
+ import { Fragment as Fragment3, useId as useId4, useState as useState3 } from "react";
973
+ import * as React24 from "react";
1113
974
  import { stringPropTypeUtil as stringPropTypeUtil5 } from "@elementor/editor-props";
1114
975
  import { ChevronDownIcon, EditIcon, PhotoIcon, SearchIcon, XIcon as XIcon2 } from "@elementor/icons";
1115
976
  import {
@@ -1180,16 +1041,16 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
1180
1041
  setSearchValue("");
1181
1042
  popoverState.close();
1182
1043
  };
1183
- return /* @__PURE__ */ React23.createElement(React23.Fragment, null, /* @__PURE__ */ React23.createElement(
1044
+ return /* @__PURE__ */ React24.createElement(React24.Fragment, null, /* @__PURE__ */ React24.createElement(
1184
1045
  UnstableTag2,
1185
1046
  {
1186
1047
  variant: "outlined",
1187
1048
  label: fontFamily,
1188
- endIcon: /* @__PURE__ */ React23.createElement(ChevronDownIcon, { fontSize: "tiny" }),
1049
+ endIcon: /* @__PURE__ */ React24.createElement(ChevronDownIcon, { fontSize: "tiny" }),
1189
1050
  ...bindTrigger3(popoverState),
1190
1051
  fullWidth: true
1191
1052
  }
1192
- ), /* @__PURE__ */ React23.createElement(
1053
+ ), /* @__PURE__ */ React24.createElement(
1193
1054
  Popover3,
1194
1055
  {
1195
1056
  disablePortal: true,
@@ -1198,7 +1059,7 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
1198
1059
  ...bindPopover3(popoverState),
1199
1060
  onClose: handleClose
1200
1061
  },
1201
- /* @__PURE__ */ React23.createElement(Stack8, null, /* @__PURE__ */ React23.createElement(Stack8, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React23.createElement(EditIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React23.createElement(Typography4, { variant: "subtitle2" }, __9("Font Family", "elementor")), /* @__PURE__ */ React23.createElement(IconButton2, { size: SIZE2, sx: { ml: "auto" }, onClick: handleClose }, /* @__PURE__ */ React23.createElement(XIcon2, { fontSize: SIZE2 }))), /* @__PURE__ */ React23.createElement(Box2, { px: 1.5, pb: 1 }, /* @__PURE__ */ React23.createElement(
1062
+ /* @__PURE__ */ React24.createElement(Stack8, null, /* @__PURE__ */ React24.createElement(Stack8, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React24.createElement(EditIcon, { fontSize: SIZE2, sx: { mr: 0.5 } }), /* @__PURE__ */ React24.createElement(Typography4, { variant: "subtitle2" }, __9("Font Family", "elementor")), /* @__PURE__ */ React24.createElement(IconButton2, { size: SIZE2, sx: { ml: "auto" }, onClick: handleClose }, /* @__PURE__ */ React24.createElement(XIcon2, { fontSize: SIZE2 }))), /* @__PURE__ */ React24.createElement(Box2, { px: 1.5, pb: 1 }, /* @__PURE__ */ React24.createElement(
1202
1063
  TextField5,
1203
1064
  {
1204
1065
  fullWidth: true,
@@ -1207,12 +1068,12 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
1207
1068
  placeholder: __9("Search", "elementor"),
1208
1069
  onChange: handleSearch,
1209
1070
  InputProps: {
1210
- startAdornment: /* @__PURE__ */ React23.createElement(InputAdornment3, { position: "start" }, /* @__PURE__ */ React23.createElement(SearchIcon, { fontSize: SIZE2 }))
1071
+ startAdornment: /* @__PURE__ */ React24.createElement(InputAdornment3, { position: "start" }, /* @__PURE__ */ React24.createElement(SearchIcon, { fontSize: SIZE2 }))
1211
1072
  }
1212
1073
  }
1213
- )), /* @__PURE__ */ React23.createElement(Divider, null), /* @__PURE__ */ React23.createElement(Box2, { sx: { overflowY: "auto", height: 260, width: 220 } }, filteredFontFamilies.length > 0 ? /* @__PURE__ */ React23.createElement(MenuList, { role: "listbox", tabIndex: 0 }, filteredFontFamilies.map(([category, items], index) => /* @__PURE__ */ React23.createElement(Fragment4, { key: index }, /* @__PURE__ */ React23.createElement(ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, category), items.map((item) => {
1074
+ )), /* @__PURE__ */ React24.createElement(Divider, null), /* @__PURE__ */ React24.createElement(Box2, { sx: { overflowY: "auto", height: 260, width: 220 } }, filteredFontFamilies.length > 0 ? /* @__PURE__ */ React24.createElement(MenuList, { role: "listbox", tabIndex: 0 }, filteredFontFamilies.map(([category, items], index) => /* @__PURE__ */ React24.createElement(Fragment3, { key: index }, /* @__PURE__ */ React24.createElement(ListSubheader, { sx: { typography: "caption", color: "text.tertiary" } }, category), items.map((item) => {
1214
1075
  const isSelected = item === fontFamily;
1215
- return /* @__PURE__ */ React23.createElement(
1076
+ return /* @__PURE__ */ React24.createElement(
1216
1077
  MenuItem3,
1217
1078
  {
1218
1079
  key: item,
@@ -1227,7 +1088,7 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
1227
1088
  },
1228
1089
  item
1229
1090
  );
1230
- })))) : /* @__PURE__ */ React23.createElement(Stack8, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React23.createElement(PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React23.createElement(Typography4, { align: "center", variant: "caption", color: "text.secondary" }, __9("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React23.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React23.createElement(Typography4, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React23.createElement(
1091
+ })))) : /* @__PURE__ */ React24.createElement(Stack8, { alignItems: "center", p: 2.5, gap: 1.5 }, /* @__PURE__ */ React24.createElement(PhotoIcon, { fontSize: "large" }), /* @__PURE__ */ React24.createElement(Typography4, { align: "center", variant: "caption", color: "text.secondary" }, __9("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React24.createElement("br", null), "\u201C", searchValue, "\u201D."), /* @__PURE__ */ React24.createElement(Typography4, { align: "center", variant: "caption", color: "text.secondary" }, /* @__PURE__ */ React24.createElement(
1231
1092
  Link,
1232
1093
  {
1233
1094
  color: "secondary",
@@ -1241,56 +1102,33 @@ var FontFamilyControl = createControl(({ fontFamilies }) => {
1241
1102
  });
1242
1103
 
1243
1104
  // src/controls/url-control.tsx
1244
- import * as React24 from "react";
1105
+ import * as React25 from "react";
1106
+ import { urlPropTypeUtil } from "@elementor/editor-props";
1245
1107
  import { TextField as TextField6 } from "@elementor/ui";
1246
1108
  var UrlControl = createControl(({ placeholder }) => {
1247
- const { value, setValue } = useBoundProp();
1248
- const handleChange = (event) => setValue({
1249
- $$type: "url",
1250
- value: event.target.value
1251
- });
1252
- return /* @__PURE__ */ React24.createElement(ControlActions, null, /* @__PURE__ */ React24.createElement(
1253
- TextField6,
1254
- {
1255
- size: "tiny",
1256
- fullWidth: true,
1257
- value: value?.value,
1258
- onChange: handleChange,
1259
- placeholder
1260
- }
1261
- ));
1109
+ const { value, setValue } = useBoundProp(urlPropTypeUtil);
1110
+ const handleChange = (event) => setValue(event.target.value);
1111
+ return /* @__PURE__ */ React25.createElement(ControlActions, null, /* @__PURE__ */ React25.createElement(TextField6, { size: "tiny", fullWidth: true, value, onChange: handleChange, placeholder }));
1262
1112
  });
1263
1113
 
1264
1114
  // src/controls/link-control.tsx
1265
- import * as React25 from "react";
1115
+ import * as React26 from "react";
1116
+ import { linkPropTypeUtil } from "@elementor/editor-props";
1266
1117
  import { MinusIcon, PlusIcon as PlusIcon2 } from "@elementor/icons";
1267
1118
  import { Collapse, Divider as Divider2, Grid as Grid6, IconButton as IconButton3, Stack as Stack9, Switch } from "@elementor/ui";
1268
1119
  import { __ as __10 } from "@wordpress/i18n";
1269
1120
  var SIZE3 = "tiny";
1270
1121
  var DEFAULT_LINK_CONTROL_VALUE = {
1271
- $$type: "link",
1272
- value: {
1273
- enabled: false,
1274
- href: {
1275
- $$type: "url",
1276
- value: ""
1277
- },
1278
- isTargetBlank: false
1279
- }
1122
+ enabled: false,
1123
+ href: {
1124
+ $$type: "url",
1125
+ value: ""
1126
+ },
1127
+ isTargetBlank: false
1280
1128
  };
1281
1129
  var LinkControl = createControl(() => {
1282
- const { value = DEFAULT_LINK_CONTROL_VALUE, setValue } = useBoundProp();
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
- });
1292
- };
1293
- return /* @__PURE__ */ React25.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React25.createElement(Divider2, null), /* @__PURE__ */ React25.createElement(
1130
+ const { value = DEFAULT_LINK_CONTROL_VALUE, ...propContext } = useBoundProp(linkPropTypeUtil);
1131
+ return /* @__PURE__ */ React26.createElement(PropProvider, { ...propContext, value }, /* @__PURE__ */ React26.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React26.createElement(Divider2, null), /* @__PURE__ */ React26.createElement(
1294
1132
  Stack9,
1295
1133
  {
1296
1134
  direction: "row",
@@ -1299,45 +1137,42 @@ var LinkControl = createControl(() => {
1299
1137
  alignItems: "center"
1300
1138
  }
1301
1139
  },
1302
- /* @__PURE__ */ React25.createElement(ControlLabel, null, __10("Link", "elementor")),
1303
- /* @__PURE__ */ React25.createElement(IconButton3, { size: SIZE3, onClick: () => handleOnChange("enabled", !enabled) }, enabled ? /* @__PURE__ */ React25.createElement(MinusIcon, { fontSize: SIZE3 }) : /* @__PURE__ */ React25.createElement(PlusIcon2, { fontSize: SIZE3 }))
1304
- ), /* @__PURE__ */ React25.createElement(Collapse, { in: enabled, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React25.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React25.createElement(
1305
- BoundPropProvider,
1306
- {
1307
- value: href,
1308
- setValue: (newHref) => handleOnChange("href", newHref),
1309
- bind: "href"
1310
- },
1311
- /* @__PURE__ */ React25.createElement(UrlControl, { placeholder: __10("Paste URL or type", "elementor") })
1312
- ), /* @__PURE__ */ React25.createElement(
1313
- SwitchControl,
1314
- {
1315
- value: isTargetBlank,
1316
- onSwitch: () => handleOnChange("isTargetBlank", !isTargetBlank)
1317
- }
1318
- ))));
1140
+ /* @__PURE__ */ React26.createElement(ControlLabel, null, __10("Link", "elementor")),
1141
+ /* @__PURE__ */ React26.createElement(PropKeyProvider, { bind: "enabled" }, /* @__PURE__ */ React26.createElement(ToggleIconControl, null))
1142
+ ), /* @__PURE__ */ React26.createElement(Collapse, { in: value?.enabled, timeout: "auto", unmountOnExit: true }, /* @__PURE__ */ React26.createElement(Stack9, { gap: 1.5 }, /* @__PURE__ */ React26.createElement(PropKeyProvider, { bind: "href" }, /* @__PURE__ */ React26.createElement(UrlControl, { placeholder: __10("Paste URL or type", "elementor") })), /* @__PURE__ */ React26.createElement(PropKeyProvider, { bind: "isTargetBlank" }, /* @__PURE__ */ React26.createElement(SwitchControl, null))))));
1319
1143
  });
1320
- var SwitchControl = ({ value, onSwitch }) => {
1321
- return /* @__PURE__ */ React25.createElement(Grid6, { container: true, alignItems: "center", flexWrap: "nowrap", justifyContent: "space-between" }, /* @__PURE__ */ React25.createElement(Grid6, { item: true }, /* @__PURE__ */ React25.createElement(ControlLabel, null, __10("Open in new tab", "elementor"))), /* @__PURE__ */ React25.createElement(Grid6, { item: true }, /* @__PURE__ */ React25.createElement(Switch, { checked: value, onChange: onSwitch })));
1144
+ var ToggleIconControl = () => {
1145
+ const { value = false, setValue } = useBoundProp();
1146
+ const handleOnChange = () => setValue(!value);
1147
+ return /* @__PURE__ */ React26.createElement(IconButton3, { size: SIZE3, onClick: handleOnChange }, value ? /* @__PURE__ */ React26.createElement(MinusIcon, { fontSize: SIZE3 }) : /* @__PURE__ */ React26.createElement(PlusIcon2, { fontSize: SIZE3 }));
1148
+ };
1149
+ var SwitchControl = () => {
1150
+ const { value = false, setValue } = useBoundProp();
1151
+ const onChange = () => {
1152
+ setValue(!value);
1153
+ };
1154
+ return /* @__PURE__ */ React26.createElement(Grid6, { container: true, alignItems: "center", flexWrap: "nowrap", justifyContent: "space-between" }, /* @__PURE__ */ React26.createElement(Grid6, { item: true }, /* @__PURE__ */ React26.createElement(ControlLabel, null, __10("Open in new tab", "elementor"))), /* @__PURE__ */ React26.createElement(Grid6, { item: true }, /* @__PURE__ */ React26.createElement(Switch, { checked: value, onChange })));
1322
1155
  };
1323
1156
 
1324
1157
  // src/controls/gap-control.tsx
1325
- import * as React26 from "react";
1158
+ import * as React27 from "react";
1326
1159
  import { gapPropTypeUtil } from "@elementor/editor-props";
1327
1160
  import { DetachIcon as DetachIcon2, LinkIcon as LinkIcon2 } from "@elementor/icons";
1328
1161
  import { Grid as Grid7, Stack as Stack10, ToggleButton as ToggleButton4 } from "@elementor/ui";
1329
1162
  import { __ as __11 } from "@wordpress/i18n";
1330
1163
  var GapControl = createControl(({ label }) => {
1331
- const { value, setValue } = useBoundProp(gapPropTypeUtil);
1164
+ const { propType, value, setValue } = useBoundProp(gapPropTypeUtil);
1332
1165
  const { column, row, isLinked = true } = value || {};
1333
- const setLinkedValue = (gap, newValue) => {
1334
- const updatedValue = {
1166
+ const setLinkedValue = (newValue, _, meta) => {
1167
+ if (!isLinked) {
1168
+ return setValue(newValue);
1169
+ }
1170
+ const newDimension = newValue[meta?.bind];
1171
+ setValue({
1335
1172
  isLinked,
1336
- column: isLinked ? newValue : column,
1337
- row: isLinked ? newValue : row,
1338
- [gap]: newValue
1339
- };
1340
- setValue(updatedValue);
1173
+ column: newDimension,
1174
+ row: newDimension
1175
+ });
1341
1176
  };
1342
1177
  const toggleLinked = () => {
1343
1178
  const updatedValue = {
@@ -1348,7 +1183,7 @@ var GapControl = createControl(({ label }) => {
1348
1183
  setValue(updatedValue);
1349
1184
  };
1350
1185
  const LinkedIcon = isLinked ? LinkIcon2 : DetachIcon2;
1351
- return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(Stack10, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React26.createElement(ControlLabel, null, label), /* @__PURE__ */ React26.createElement(
1186
+ return /* @__PURE__ */ React27.createElement(PropProvider, { propType, value, setValue: setLinkedValue }, /* @__PURE__ */ React27.createElement(Stack10, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React27.createElement(ControlLabel, null, label), /* @__PURE__ */ React27.createElement(
1352
1187
  ToggleButton4,
1353
1188
  {
1354
1189
  "aria-label": __11("Link Inputs", "elementor"),
@@ -1358,37 +1193,20 @@ var GapControl = createControl(({ label }) => {
1358
1193
  sx: { marginLeft: "auto" },
1359
1194
  onChange: toggleLinked
1360
1195
  },
1361
- /* @__PURE__ */ React26.createElement(LinkedIcon, { fontSize: "tiny" })
1362
- )), /* @__PURE__ */ React26.createElement(Stack10, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React26.createElement(Grid7, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React26.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React26.createElement(ControlLabel, null, __11("Column", "elementor"))), /* @__PURE__ */ React26.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React26.createElement(
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
- )))));
1196
+ /* @__PURE__ */ React27.createElement(LinkedIcon, { fontSize: "tiny" })
1197
+ )), /* @__PURE__ */ React27.createElement(Stack10, { direction: "row", gap: 2, flexWrap: "nowrap" }, /* @__PURE__ */ React27.createElement(Grid7, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React27.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(ControlLabel, null, __11("Column", "elementor"))), /* @__PURE__ */ React27.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(PropKeyProvider, { bind: "column" }, /* @__PURE__ */ React27.createElement(SizeControl, null)))), /* @__PURE__ */ React27.createElement(Grid7, { container: true, gap: 1, alignItems: "center" }, /* @__PURE__ */ React27.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(ControlLabel, null, __11("Row", "elementor"))), /* @__PURE__ */ React27.createElement(Grid7, { item: true, xs: 12 }, /* @__PURE__ */ React27.createElement(PropKeyProvider, { bind: "row" }, /* @__PURE__ */ React27.createElement(SizeControl, null))))));
1379
1198
  });
1380
1199
 
1381
1200
  // src/controls/background-control/background-control.tsx
1382
- import * as React28 from "react";
1383
- import {
1384
- backgroundPropTypeUtil
1385
- } from "@elementor/editor-props";
1201
+ import * as React29 from "react";
1202
+ import { backgroundPropTypeUtil } from "@elementor/editor-props";
1386
1203
  import { Grid as Grid9, Stack as Stack12 } from "@elementor/ui";
1387
1204
  import { __ as __13 } from "@wordpress/i18n";
1388
1205
 
1389
1206
  // src/controls/background-control/background-overlay/background-overlay-repeater-control.tsx
1390
- import * as React27 from "react";
1207
+ import * as React28 from "react";
1391
1208
  import {
1209
+ backgroundColorOverlayPropTypeUtil,
1392
1210
  backgroundOverlayPropTypeUtil
1393
1211
  } from "@elementor/editor-props";
1394
1212
  import { Grid as Grid8, Stack as Stack11, UnstableColorIndicator as UnstableColorIndicator2 } from "@elementor/ui";
@@ -1398,15 +1216,12 @@ var initialBackgroundOverlay = {
1398
1216
  value: "rgba(0, 0, 0, 0.2)"
1399
1217
  };
1400
1218
  var BackgroundOverlayRepeaterControl = createControl(() => {
1401
- const { value: overlayValues, setValue } = useBoundProp(backgroundOverlayPropTypeUtil);
1402
- const setColorOverlay = (newValue) => {
1403
- setValue(newValue);
1404
- };
1405
- return /* @__PURE__ */ React27.createElement(
1219
+ const { propType, value: overlayValues, setValue } = useBoundProp(backgroundOverlayPropTypeUtil);
1220
+ return /* @__PURE__ */ React28.createElement(PropProvider, { propType, value: overlayValues, setValue }, /* @__PURE__ */ React28.createElement(
1406
1221
  Repeater,
1407
1222
  {
1408
1223
  values: overlayValues ?? [],
1409
- setValues: setColorOverlay,
1224
+ setValues: setValue,
1410
1225
  label: __12("Overlay", "elementor"),
1411
1226
  itemSettings: {
1412
1227
  Icon: ItemIcon2,
@@ -1415,62 +1230,27 @@ var BackgroundOverlayRepeaterControl = createControl(() => {
1415
1230
  initialValues: initialBackgroundOverlay
1416
1231
  }
1417
1232
  }
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
1233
  ));
1234
+ });
1235
+ var ItemIcon2 = ({ value }) => /* @__PURE__ */ React28.createElement(UnstableColorIndicator2, { size: "inherit", component: "span", value: value.value });
1236
+ var ItemContent2 = ({ bind }) => {
1237
+ return /* @__PURE__ */ React28.createElement(PropKeyProvider, { bind }, /* @__PURE__ */ React28.createElement(Content2, null));
1238
+ };
1239
+ var Content2 = () => {
1240
+ return /* @__PURE__ */ React28.createElement(Stack11, { gap: 1.5 }, /* @__PURE__ */ React28.createElement(Grid8, { container: true, spacing: 1, alignItems: "center" }, /* @__PURE__ */ React28.createElement(Grid8, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(ControlLabel, null, __12("Color", "elementor"))), /* @__PURE__ */ React28.createElement(Grid8, { item: true, xs: 12 }, /* @__PURE__ */ React28.createElement(ColorControl, { propTypeUtil: backgroundColorOverlayPropTypeUtil }))));
1440
1241
  };
1441
1242
  var ItemLabel2 = ({ value }) => {
1442
1243
  const color = value.value;
1443
- return /* @__PURE__ */ React27.createElement("span", null, color);
1244
+ return /* @__PURE__ */ React28.createElement("span", null, color);
1444
1245
  };
1445
1246
 
1446
1247
  // src/controls/background-control/background-control.tsx
1447
1248
  var BackgroundControl = createControl(() => {
1448
- const { value, setValue } = useBoundProp(backgroundPropTypeUtil);
1449
- const setColor = (newValue) => {
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)))));
1249
+ const propContext = useBoundProp(backgroundPropTypeUtil);
1250
+ return /* @__PURE__ */ React29.createElement(PropProvider, { ...propContext }, /* @__PURE__ */ React29.createElement(Stack12, { gap: 1.5 }, /* @__PURE__ */ React29.createElement(PropKeyProvider, { bind: "background-overlay" }, /* @__PURE__ */ React29.createElement(BackgroundOverlayRepeaterControl, null)), /* @__PURE__ */ React29.createElement(PropKeyProvider, { bind: "color" }, /* @__PURE__ */ React29.createElement(Grid9, { container: true, gap: 2, alignItems: "center", flexWrap: "nowrap" }, /* @__PURE__ */ React29.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React29.createElement(ControlLabel, null, __13("Color", "elementor"))), /* @__PURE__ */ React29.createElement(Grid9, { item: true, xs: 6 }, /* @__PURE__ */ React29.createElement(ColorControl, null))))));
1470
1251
  });
1471
1252
  export {
1472
1253
  BackgroundControl,
1473
- BoundPropProvider,
1474
1254
  BoxShadowRepeaterControl,
1475
1255
  ColorControl,
1476
1256
  ControlActionsProvider,
@@ -1484,6 +1264,8 @@ export {
1484
1264
  LinkControl,
1485
1265
  LinkedDimensionsControl,
1486
1266
  NumberControl,
1267
+ PropKeyProvider,
1268
+ PropProvider,
1487
1269
  SelectControl,
1488
1270
  SizeControl,
1489
1271
  StrokeControl,