@elementor/editor-variables 0.15.0 → 0.16.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
@@ -3,12 +3,51 @@ import { injectIntoTop } from "@elementor/editor";
3
3
 
4
4
  // src/init-color-variables.ts
5
5
  import { styleTransformersRegistry } from "@elementor/editor-canvas";
6
- import { injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel } from "@elementor/editor-controls";
7
6
  import { controlActionsMenu, registerControlReplacement } from "@elementor/editor-editing-panel";
8
- import { backgroundColorOverlayPropTypeUtil, shadowPropTypeUtil } from "@elementor/editor-props";
9
7
 
10
- // src/components/variables-repeater-item-slot.tsx
11
- import * as React from "react";
8
+ // src/controls/color-variable-control.tsx
9
+ import * as React19 from "react";
10
+ import { useBoundProp as useBoundProp8 } from "@elementor/editor-controls";
11
+ import { colorPropTypeUtil } from "@elementor/editor-props";
12
+
13
+ // src/components/ui/color-indicator.tsx
14
+ import { styled, UnstableColorIndicator } from "@elementor/ui";
15
+ var ColorIndicator = styled(UnstableColorIndicator)(({ theme }) => ({
16
+ borderRadius: `${theme.shape.borderRadius / 2}px`,
17
+ marginRight: theme.spacing(0.25)
18
+ }));
19
+
20
+ // src/components/ui/variable/assigned-variable.tsx
21
+ import { useId as useId2, useRef as useRef4 } from "react";
22
+ import * as React16 from "react";
23
+ import { useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
24
+ import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
25
+ import { bindPopover as bindPopover2, bindTrigger as bindTrigger2, Box as Box4, Popover as Popover2, usePopupState as usePopupState2 } from "@elementor/ui";
26
+
27
+ // src/components/variable-selection-popover.tsx
28
+ import * as React14 from "react";
29
+ import { useRef as useRef3, useState as useState10 } from "react";
30
+ import { Box as Box2 } from "@elementor/ui";
31
+
32
+ // src/prop-types/color-variable-prop-type.ts
33
+ import { createPropUtils } from "@elementor/editor-props";
34
+ import { z } from "@elementor/schema";
35
+ var colorVariablePropTypeUtil = createPropUtils("global-color-variable", z.string());
36
+
37
+ // src/prop-types/font-variable-prop-type.ts
38
+ import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
39
+ import { z as z2 } from "@elementor/schema";
40
+ var fontVariablePropTypeUtil = createPropUtils2("global-font-variable", z2.string());
41
+
42
+ // src/components/color-variable-creation.tsx
43
+ import * as React3 from "react";
44
+ import { useState as useState3 } from "react";
45
+ import { PopoverContent, useBoundProp } from "@elementor/editor-controls";
46
+ import { PopoverScrollableContent } from "@elementor/editor-editing-panel";
47
+ import { PopoverHeader } from "@elementor/editor-ui";
48
+ import { ArrowLeftIcon, BrushIcon } from "@elementor/icons";
49
+ import { Button, CardActions, Divider, IconButton } from "@elementor/ui";
50
+ import { __ as __4 } from "@wordpress/i18n";
12
51
 
13
52
  // src/hooks/use-prop-variables.ts
14
53
  import { useMemo } from "react";
@@ -303,99 +342,46 @@ var deleteVariable = (deleteId) => {
303
342
  });
304
343
  };
305
344
 
306
- // src/components/ui/color-indicator.tsx
307
- import { styled, UnstableColorIndicator } from "@elementor/ui";
308
- var ColorIndicator = styled(UnstableColorIndicator)(({ theme }) => ({
309
- borderRadius: `${theme.shape.borderRadius / 2}px`,
310
- marginRight: theme.spacing(0.25)
311
- }));
345
+ // src/components/fields/color-field.tsx
346
+ import * as React from "react";
347
+ import { useRef, useState } from "react";
348
+ import { FormHelperText, FormLabel, Grid, UnstableColorField } from "@elementor/ui";
349
+ import { __ as __2 } from "@wordpress/i18n";
312
350
 
313
- // src/components/variables-repeater-item-slot.tsx
314
- var useColorVariable = (value) => {
315
- const variableId = value?.value?.color?.value;
316
- return useVariable(variableId || "");
317
- };
318
- var BackgroundRepeaterColorIndicator = ({ value }) => {
319
- const colorVariable = useColorVariable(value);
320
- return /* @__PURE__ */ React.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
321
- };
322
- var BackgroundRepeaterLabel = ({ value }) => {
323
- const colorVariable = useColorVariable(value);
324
- return /* @__PURE__ */ React.createElement("span", null, colorVariable?.label);
351
+ // src/utils/validations.ts
352
+ import { __ } from "@wordpress/i18n";
353
+ var VARIABLE_LABEL_MAX_LENGTH = 50;
354
+ var validateLabel = (name) => {
355
+ if (!name.trim()) {
356
+ return __("Missing variable name.", "elementor");
357
+ }
358
+ const allowedChars = /^[a-zA-Z0-9_-]+$/;
359
+ if (!allowedChars.test(name)) {
360
+ return __("Names can only use letters, numbers, dashes (-) and underscores (_).", "elementor");
361
+ }
362
+ const hasAlphanumeric = /[a-zA-Z0-9]/;
363
+ if (!hasAlphanumeric.test(name)) {
364
+ return __("Names have to include at least one non-special character.", "elementor");
365
+ }
366
+ if (VARIABLE_LABEL_MAX_LENGTH < name.length) {
367
+ return __("Variable names can contain up to 50 characters.", "elementor");
368
+ }
369
+ return "";
325
370
  };
326
- var BoxShadowRepeaterColorIndicator = ({ value }) => {
327
- const colorVariable = useColorVariable(value);
328
- return /* @__PURE__ */ React.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
371
+ var labelHint = (name) => {
372
+ const hintThreshold = VARIABLE_LABEL_MAX_LENGTH * 0.8 - 1;
373
+ if (hintThreshold < name.length) {
374
+ return __("Variable names can contain up to 50 characters.", "elementor");
375
+ }
376
+ return "";
329
377
  };
330
-
331
- // src/controls/color-variable-control.tsx
332
- import * as React13 from "react";
333
- import { useId as useId2, useRef as useRef6 } from "react";
334
- import { useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
335
- import { colorPropTypeUtil } from "@elementor/editor-props";
336
- import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
337
- import { bindPopover as bindPopover3, bindTrigger as bindTrigger3, Box as Box4, Popover as Popover3, usePopupState as usePopupState3 } from "@elementor/ui";
338
-
339
- // src/components/ui/variable-tag.tsx
340
- import * as React2 from "react";
341
- import { DetachIcon } from "@elementor/icons";
342
- import { Box, IconButton, Stack, Typography, UnstableTag as Tag } from "@elementor/ui";
343
- import { __ } from "@wordpress/i18n";
344
- var SIZE = "tiny";
345
- var VariableTag = ({ startIcon, label, onUnlink, ...props }) => {
346
- const actions = [];
347
- if (onUnlink) {
348
- actions.push(
349
- /* @__PURE__ */ React2.createElement(IconButton, { key: "unlink", size: SIZE, onClick: onUnlink, "aria-label": __("Unlink", "elementor") }, /* @__PURE__ */ React2.createElement(DetachIcon, { fontSize: SIZE }))
350
- );
378
+ var validateValue = (value) => {
379
+ if (!value.trim()) {
380
+ return __("Missing variable value.", "elementor");
351
381
  }
352
- return /* @__PURE__ */ React2.createElement(
353
- Tag,
354
- {
355
- fullWidth: true,
356
- showActionsOnHover: true,
357
- startIcon: /* @__PURE__ */ React2.createElement(Stack, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
358
- label: /* @__PURE__ */ React2.createElement(Box, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React2.createElement(Typography, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
359
- actions,
360
- ...props
361
- }
362
- );
382
+ return "";
363
383
  };
364
384
 
365
- // src/components/variable-selection-popover.tsx
366
- import * as React12 from "react";
367
- import { useRef as useRef5, useState as useState7 } from "react";
368
- import { Box as Box3 } from "@elementor/ui";
369
-
370
- // src/prop-types/color-variable-prop-type.ts
371
- import { createPropUtils } from "@elementor/editor-props";
372
- import { z } from "@elementor/schema";
373
- var colorVariablePropTypeUtil = createPropUtils("global-color-variable", z.string());
374
-
375
- // src/prop-types/font-variable-prop-type.ts
376
- import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
377
- import { z as z2 } from "@elementor/schema";
378
- var fontVariablePropTypeUtil = createPropUtils2("global-font-variable", z2.string());
379
-
380
- // src/components/color-variable-creation.tsx
381
- import * as React3 from "react";
382
- import { useRef, useState } from "react";
383
- import { PopoverContent, useBoundProp } from "@elementor/editor-controls";
384
- import { PopoverScrollableContent } from "@elementor/editor-editing-panel";
385
- import { PopoverHeader } from "@elementor/editor-ui";
386
- import { ArrowLeftIcon, BrushIcon } from "@elementor/icons";
387
- import {
388
- Button,
389
- CardActions,
390
- Divider,
391
- FormLabel,
392
- Grid,
393
- IconButton as IconButton2,
394
- TextField,
395
- UnstableColorField
396
- } from "@elementor/ui";
397
- import { __ as __2 } from "@wordpress/i18n";
398
-
399
385
  // src/components/variable-selection-popover.context.ts
400
386
  import { createContext, useContext } from "react";
401
387
  var PopoverContentRefContext = createContext(null);
@@ -403,14 +389,75 @@ var usePopoverContentRef = () => {
403
389
  return useContext(PopoverContentRefContext);
404
390
  };
405
391
 
392
+ // src/components/fields/color-field.tsx
393
+ var ColorField = ({ value, onChange }) => {
394
+ const [color, setColor] = useState(value);
395
+ const [errorMessage, setErrorMessage] = useState("");
396
+ const defaultRef = useRef(null);
397
+ const anchorRef = usePopoverContentRef() ?? defaultRef;
398
+ const handleChange = (newValue) => {
399
+ setColor(newValue);
400
+ const errorMsg = validateValue(newValue);
401
+ setErrorMessage(errorMsg);
402
+ onChange(errorMsg ? "" : newValue);
403
+ };
404
+ return /* @__PURE__ */ React.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(FormLabel, { size: "tiny" }, __2("Value", "elementor"))), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(
405
+ UnstableColorField,
406
+ {
407
+ size: "tiny",
408
+ fullWidth: true,
409
+ value: color,
410
+ onChange: handleChange,
411
+ error: errorMessage ?? void 0,
412
+ slotProps: {
413
+ colorPicker: {
414
+ anchorEl: anchorRef.current,
415
+ anchorOrigin: { vertical: "top", horizontal: "right" },
416
+ transformOrigin: { vertical: "top", horizontal: -10 }
417
+ }
418
+ }
419
+ }
420
+ ), errorMessage && /* @__PURE__ */ React.createElement(FormHelperText, { error: true }, errorMessage)));
421
+ };
422
+
423
+ // src/components/fields/label-field.tsx
424
+ import * as React2 from "react";
425
+ import { useId, useState as useState2 } from "react";
426
+ import { FormHelperText as FormHelperText2, FormLabel as FormLabel2, Grid as Grid2, TextField } from "@elementor/ui";
427
+ import { __ as __3 } from "@wordpress/i18n";
428
+ var LabelField = ({ value, onChange }) => {
429
+ const [label, setLabel] = useState2(value);
430
+ const [errorMessage, setErrorMessage] = useState2("");
431
+ const [noticeMessage, setNoticeMessage] = useState2(() => labelHint(value));
432
+ const handleChange = (newValue) => {
433
+ setLabel(newValue);
434
+ const errorMsg = validateLabel(newValue);
435
+ const hintMsg = labelHint(newValue);
436
+ setErrorMessage(errorMsg);
437
+ setNoticeMessage(errorMsg ? "" : hintMsg);
438
+ onChange(errorMsg ? "" : newValue);
439
+ };
440
+ const id = useId();
441
+ return /* @__PURE__ */ React2.createElement(Grid2, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React2.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(FormLabel2, { htmlFor: id, size: "tiny" }, __3("Name", "elementor"))), /* @__PURE__ */ React2.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
442
+ TextField,
443
+ {
444
+ id,
445
+ size: "tiny",
446
+ fullWidth: true,
447
+ value: label,
448
+ error: !!errorMessage,
449
+ onChange: (e) => handleChange(e.target.value),
450
+ inputProps: { maxLength: VARIABLE_LABEL_MAX_LENGTH }
451
+ }
452
+ ), errorMessage && /* @__PURE__ */ React2.createElement(FormHelperText2, { error: true }, errorMessage), noticeMessage && /* @__PURE__ */ React2.createElement(FormHelperText2, null, noticeMessage)));
453
+ };
454
+
406
455
  // src/components/color-variable-creation.tsx
407
- var SIZE2 = "tiny";
456
+ var SIZE = "tiny";
408
457
  var ColorVariableCreation = ({ onGoBack, onClose }) => {
409
458
  const { setValue: setVariable } = useBoundProp(colorVariablePropTypeUtil);
410
- const [color, setColor] = useState("");
411
- const [label, setLabel] = useState("");
412
- const defaultRef = useRef(null);
413
- const anchorRef = usePopoverContentRef() ?? defaultRef;
459
+ const [color, setColor] = useState3("");
460
+ const [label, setLabel] = useState3("");
414
461
  const resetFields = () => {
415
462
  setColor("");
416
463
  setLabel("");
@@ -429,146 +476,161 @@ var ColorVariableCreation = ({ onGoBack, onClose }) => {
429
476
  closePopover();
430
477
  });
431
478
  };
432
- const isFormInvalid = () => {
433
- return !color?.trim() || !label?.trim();
479
+ const hasEmptyValue = () => {
480
+ return "" === color.trim() || "" === label.trim();
434
481
  };
482
+ const isSubmitDisabled = hasEmptyValue();
435
483
  return /* @__PURE__ */ React3.createElement(PopoverScrollableContent, { height: "auto" }, /* @__PURE__ */ React3.createElement(
436
484
  PopoverHeader,
437
485
  {
438
- icon: /* @__PURE__ */ React3.createElement(React3.Fragment, null, onGoBack && /* @__PURE__ */ React3.createElement(IconButton2, { size: SIZE2, "aria-label": __2("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React3.createElement(ArrowLeftIcon, { fontSize: SIZE2 })), /* @__PURE__ */ React3.createElement(BrushIcon, { fontSize: SIZE2 })),
439
- title: __2("Create variable", "elementor"),
486
+ icon: /* @__PURE__ */ React3.createElement(React3.Fragment, null, onGoBack && /* @__PURE__ */ React3.createElement(IconButton, { size: SIZE, "aria-label": __4("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React3.createElement(ArrowLeftIcon, { fontSize: SIZE })), /* @__PURE__ */ React3.createElement(BrushIcon, { fontSize: SIZE })),
487
+ title: __4("Create variable", "elementor"),
440
488
  onClose: closePopover
441
489
  }
442
- ), /* @__PURE__ */ React3.createElement(Divider, null), /* @__PURE__ */ React3.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React3.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React3.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(FormLabel, { size: "tiny" }, __2("Name", "elementor"))), /* @__PURE__ */ React3.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(
443
- TextField,
444
- {
445
- size: "tiny",
446
- fullWidth: true,
447
- value: label,
448
- onChange: (e) => setLabel(e.target.value)
449
- }
450
- ))), /* @__PURE__ */ React3.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React3.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(FormLabel, { size: "tiny" }, __2("Value", "elementor"))), /* @__PURE__ */ React3.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(
451
- UnstableColorField,
452
- {
453
- size: "tiny",
454
- fullWidth: true,
455
- value: color,
456
- onChange: setColor,
457
- slotProps: {
458
- colorPicker: {
459
- anchorEl: anchorRef.current,
460
- anchorOrigin: { vertical: "top", horizontal: "right" },
461
- transformOrigin: { vertical: "top", horizontal: -10 }
462
- }
463
- }
464
- }
465
- )))), /* @__PURE__ */ React3.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React3.createElement(Button, { size: "small", variant: "contained", disabled: isFormInvalid(), onClick: handleCreate }, __2("Create", "elementor"))));
490
+ ), /* @__PURE__ */ React3.createElement(Divider, null), /* @__PURE__ */ React3.createElement(PopoverContent, { p: 2 }, /* @__PURE__ */ React3.createElement(LabelField, { value: label, onChange: setLabel }), /* @__PURE__ */ React3.createElement(ColorField, { value: color, onChange: setColor })), /* @__PURE__ */ React3.createElement(CardActions, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React3.createElement(Button, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleCreate }, __4("Create", "elementor"))));
466
491
  };
467
492
 
468
493
  // src/components/color-variable-edit.tsx
469
- import * as React4 from "react";
470
- import { useRef as useRef2, useState as useState2 } from "react";
471
- import { PopoverContent as PopoverContent2 } from "@elementor/editor-controls";
472
- import { PopoverHeader as PopoverHeader2, PopoverScrollableContent as PopoverScrollableContent2 } from "@elementor/editor-ui";
494
+ import * as React5 from "react";
495
+ import { useState as useState4 } from "react";
496
+ import { PopoverContent as PopoverContent2, useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
497
+ import { PopoverScrollableContent as PopoverScrollableContent2 } from "@elementor/editor-editing-panel";
498
+ import { PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
473
499
  import { ArrowLeftIcon as ArrowLeftIcon2, BrushIcon as BrushIcon2, TrashIcon } from "@elementor/icons";
500
+ import { Button as Button3, CardActions as CardActions2, Divider as Divider2, IconButton as IconButton2 } from "@elementor/ui";
501
+ import { __ as __6 } from "@wordpress/i18n";
502
+
503
+ // src/components/ui/delete-confirmation-dialog.tsx
504
+ import * as React4 from "react";
505
+ import { AlertOctagonFilledIcon } from "@elementor/icons";
474
506
  import {
475
507
  Button as Button2,
476
- CardActions as CardActions2,
477
- Divider as Divider2,
478
- FormLabel as FormLabel2,
479
- Grid as Grid2,
480
- IconButton as IconButton3,
481
- TextField as TextField2,
482
- UnstableColorField as UnstableColorField2
508
+ Dialog,
509
+ DialogActions,
510
+ DialogContent,
511
+ DialogContentText,
512
+ DialogTitle,
513
+ Typography
483
514
  } from "@elementor/ui";
484
- import { __ as __3 } from "@wordpress/i18n";
485
- var SIZE3 = "tiny";
515
+ import { __ as __5 } from "@wordpress/i18n";
516
+ var TITLE_ID = "delete-variable-dialog";
517
+ var DeleteConfirmationDialog = ({
518
+ open,
519
+ label,
520
+ closeDialog,
521
+ onConfirm
522
+ }) => {
523
+ return /* @__PURE__ */ React4.createElement(Dialog, { open, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React4.createElement(DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React4.createElement(AlertOctagonFilledIcon, { color: "error" }), __5("Delete Variable", "elementor")), /* @__PURE__ */ React4.createElement(DialogContent, null, /* @__PURE__ */ React4.createElement(DialogContentText, { variant: "body2", color: "textPrimary" }, __5("You are about to delete", "elementor"), /* @__PURE__ */ React4.createElement(Typography, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), __5(
524
+ "Variable. Note that its value is still being used anywhere on your site where it was connected to the variable.",
525
+ "elementor"
526
+ ))), /* @__PURE__ */ React4.createElement(DialogActions, null, /* @__PURE__ */ React4.createElement(Button2, { color: "secondary", onClick: closeDialog }, __5("Cancel", "elementor")), /* @__PURE__ */ React4.createElement(Button2, { variant: "contained", color: "error", onClick: onConfirm }, __5("Delete", "elementor"))));
527
+ };
528
+
529
+ // src/components/color-variable-edit.tsx
530
+ var SIZE2 = "tiny";
486
531
  var ColorVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
532
+ const { setValue: notifyBoundPropChange, value: assignedValue } = useBoundProp2(colorVariablePropTypeUtil);
533
+ const [deleteConfirmation, setDeleteConfirmation] = useState4(false);
487
534
  const variable = useVariable(editId);
488
535
  if (!variable) {
489
536
  throw new Error(`Global color variable not found`);
490
537
  }
491
- const defaultRef = useRef2(null);
492
- const anchorRef = usePopoverContentRef() ?? defaultRef;
493
- const [color, setColor] = useState2(variable.value);
494
- const [label, setLabel] = useState2(variable.label);
538
+ const [color, setColor] = useState4(variable.value);
539
+ const [label, setLabel] = useState4(variable.label);
495
540
  const handleUpdate = () => {
496
541
  updateVariable(editId, {
497
542
  value: color,
498
543
  label
499
544
  }).then(() => {
545
+ maybeTriggerBoundPropChange();
500
546
  onSubmit?.();
501
547
  });
502
548
  };
503
549
  const handleDelete = () => {
504
550
  deleteVariable(editId).then(() => {
551
+ maybeTriggerBoundPropChange();
505
552
  onSubmit?.();
506
553
  });
507
554
  };
508
- const noValueChanged = () => color === variable.value && label === variable.label;
509
- const hasEmptyValue = () => "" === color.trim() || "" === label.trim();
510
- const isSaveDisabled = () => noValueChanged() || hasEmptyValue();
555
+ const maybeTriggerBoundPropChange = () => {
556
+ if (editId === assignedValue) {
557
+ notifyBoundPropChange(editId);
558
+ }
559
+ };
560
+ const handleDeleteConfirmation = () => {
561
+ setDeleteConfirmation(true);
562
+ };
563
+ const closeDeleteDialog = () => () => {
564
+ setDeleteConfirmation(false);
565
+ };
511
566
  const actions = [];
512
567
  actions.push(
513
- /* @__PURE__ */ React4.createElement(IconButton3, { key: "delete", size: SIZE3, "aria-label": __3("Delete", "elementor"), onClick: handleDelete }, /* @__PURE__ */ React4.createElement(TrashIcon, { fontSize: SIZE3 }))
568
+ /* @__PURE__ */ React5.createElement(
569
+ IconButton2,
570
+ {
571
+ key: "delete",
572
+ size: SIZE2,
573
+ "aria-label": __6("Delete", "elementor"),
574
+ onClick: handleDeleteConfirmation
575
+ },
576
+ /* @__PURE__ */ React5.createElement(TrashIcon, { fontSize: SIZE2 })
577
+ )
514
578
  );
515
- return /* @__PURE__ */ React4.createElement(PopoverScrollableContent2, { height: "auto" }, /* @__PURE__ */ React4.createElement(
579
+ const hasEmptyValues = () => {
580
+ return !color.trim() || !label.trim();
581
+ };
582
+ const noValueChanged = () => {
583
+ return color === variable.value && label === variable.label;
584
+ };
585
+ const isSubmitDisabled = noValueChanged() || hasEmptyValues();
586
+ return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(PopoverScrollableContent2, { height: "auto" }, /* @__PURE__ */ React5.createElement(
516
587
  PopoverHeader2,
517
588
  {
518
- title: __3("Edit variable", "elementor"),
589
+ title: __6("Edit variable", "elementor"),
519
590
  onClose,
520
- icon: /* @__PURE__ */ React4.createElement(React4.Fragment, null, onGoBack && /* @__PURE__ */ React4.createElement(IconButton3, { size: SIZE3, "aria-label": __3("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React4.createElement(ArrowLeftIcon2, { fontSize: SIZE3 })), /* @__PURE__ */ React4.createElement(BrushIcon2, { fontSize: SIZE3 })),
591
+ icon: /* @__PURE__ */ React5.createElement(React5.Fragment, null, onGoBack && /* @__PURE__ */ React5.createElement(
592
+ IconButton2,
593
+ {
594
+ size: SIZE2,
595
+ "aria-label": __6("Go Back", "elementor"),
596
+ onClick: onGoBack
597
+ },
598
+ /* @__PURE__ */ React5.createElement(ArrowLeftIcon2, { fontSize: SIZE2 })
599
+ ), /* @__PURE__ */ React5.createElement(BrushIcon2, { fontSize: SIZE2 })),
521
600
  actions
522
601
  }
523
- ), /* @__PURE__ */ React4.createElement(Divider2, null), /* @__PURE__ */ React4.createElement(PopoverContent2, { p: 2 }, /* @__PURE__ */ React4.createElement(Grid2, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React4.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(FormLabel2, { size: "tiny" }, __3("Name", "elementor"))), /* @__PURE__ */ React4.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(
524
- TextField2,
525
- {
526
- size: "tiny",
527
- fullWidth: true,
528
- value: label,
529
- onChange: (e) => setLabel(e.target.value)
530
- }
531
- ))), /* @__PURE__ */ React4.createElement(Grid2, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React4.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(FormLabel2, { size: "tiny" }, __3("Value", "elementor"))), /* @__PURE__ */ React4.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React4.createElement(
532
- UnstableColorField2,
602
+ ), /* @__PURE__ */ React5.createElement(Divider2, null), /* @__PURE__ */ React5.createElement(PopoverContent2, { p: 2 }, /* @__PURE__ */ React5.createElement(LabelField, { value: label, onChange: setLabel }), /* @__PURE__ */ React5.createElement(ColorField, { value: color, onChange: setColor })), /* @__PURE__ */ React5.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React5.createElement(Button3, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, __6("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React5.createElement(
603
+ DeleteConfirmationDialog,
533
604
  {
534
- size: "tiny",
535
- fullWidth: true,
536
- value: color,
537
- onChange: setColor,
538
- slotProps: {
539
- colorPicker: {
540
- anchorEl: anchorRef.current,
541
- anchorOrigin: { vertical: "top", horizontal: "right" },
542
- transformOrigin: { vertical: "top", horizontal: -10 }
543
- }
544
- }
605
+ open: true,
606
+ label,
607
+ onConfirm: handleDelete,
608
+ closeDialog: closeDeleteDialog()
545
609
  }
546
- )))), /* @__PURE__ */ React4.createElement(CardActions2, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React4.createElement(Button2, { size: "small", variant: "contained", disabled: isSaveDisabled(), onClick: handleUpdate }, __3("Save", "elementor"))));
610
+ ));
547
611
  };
548
612
 
549
613
  // src/components/color-variables-selection.tsx
550
- import * as React8 from "react";
551
- import { useState as useState3 } from "react";
552
- import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
614
+ import * as React9 from "react";
615
+ import { useState as useState5 } from "react";
616
+ import { useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
553
617
  import { PopoverScrollableContent as PopoverScrollableContent3 } from "@elementor/editor-editing-panel";
554
618
  import { PopoverHeader as PopoverHeader3, PopoverMenuList, PopoverSearch } from "@elementor/editor-ui";
555
619
  import { BrushIcon as BrushIcon3, ColorFilterIcon, PlusIcon, SettingsIcon } from "@elementor/icons";
556
- import { Divider as Divider3, IconButton as IconButton5 } from "@elementor/ui";
557
- import { __ as __7 } from "@wordpress/i18n";
620
+ import { Divider as Divider3, IconButton as IconButton4 } from "@elementor/ui";
621
+ import { __ as __10 } from "@wordpress/i18n";
558
622
 
559
623
  // src/components/ui/menu-item-content.tsx
560
- import * as React5 from "react";
624
+ import * as React6 from "react";
561
625
  import { EllipsisWithTooltip } from "@elementor/editor-ui";
562
- import { isExperimentActive } from "@elementor/editor-v1-adapters";
563
626
  import { EditIcon } from "@elementor/icons";
564
- import { Box as Box2, IconButton as IconButton4, ListItemIcon, Typography as Typography2 } from "@elementor/ui";
565
- import { __ as __4 } from "@wordpress/i18n";
566
- var SIZE4 = "tiny";
567
- var isVersion330Active = isExperimentActive("e_v_3_30");
627
+ import { Box, IconButton as IconButton3, ListItemIcon, Typography as Typography2 } from "@elementor/ui";
628
+ import { __ as __7 } from "@wordpress/i18n";
629
+ var SIZE3 = "tiny";
568
630
  var MenuItemContent = ({ item }) => {
569
631
  const onEdit = item.onEdit;
570
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(ListItemIcon, null, item.icon), /* @__PURE__ */ React5.createElement(
571
- Box2,
632
+ return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(ListItemIcon, null, item.icon), /* @__PURE__ */ React6.createElement(
633
+ Box,
572
634
  {
573
635
  sx: {
574
636
  flex: 1,
@@ -578,18 +640,18 @@ var MenuItemContent = ({ item }) => {
578
640
  gap: 1
579
641
  }
580
642
  },
581
- /* @__PURE__ */ React5.createElement(
643
+ /* @__PURE__ */ React6.createElement(
582
644
  EllipsisWithTooltip,
583
645
  {
584
646
  title: item.label || item.value,
585
647
  as: Typography2,
586
- variant: isVersion330Active ? "caption" : "body2",
587
- color: isVersion330Active ? "text.primary" : "text.secondary",
648
+ variant: "caption",
649
+ color: "text.primary",
588
650
  sx: { marginTop: "1px", lineHeight: "2" },
589
651
  maxWidth: "50%"
590
652
  }
591
653
  ),
592
- item.secondaryText && /* @__PURE__ */ React5.createElement(
654
+ item.secondaryText && /* @__PURE__ */ React6.createElement(
593
655
  EllipsisWithTooltip,
594
656
  {
595
657
  title: item.secondaryText,
@@ -600,27 +662,27 @@ var MenuItemContent = ({ item }) => {
600
662
  maxWidth: "50%"
601
663
  }
602
664
  )
603
- ), !!onEdit && /* @__PURE__ */ React5.createElement(
604
- IconButton4,
665
+ ), !!onEdit && /* @__PURE__ */ React6.createElement(
666
+ IconButton3,
605
667
  {
606
668
  sx: { mx: 1, opacity: "0" },
607
669
  onClick: (e) => {
608
670
  e.stopPropagation();
609
671
  onEdit(item.value);
610
672
  },
611
- "aria-label": __4("Edit", "elementor")
673
+ "aria-label": __7("Edit", "elementor")
612
674
  },
613
- /* @__PURE__ */ React5.createElement(EditIcon, { color: "action", fontSize: SIZE4 })
675
+ /* @__PURE__ */ React6.createElement(EditIcon, { color: "action", fontSize: SIZE3 })
614
676
  ));
615
677
  };
616
678
 
617
679
  // src/components/ui/no-search-results.tsx
618
- import * as React6 from "react";
619
- import { Link, Stack as Stack2, Typography as Typography3 } from "@elementor/ui";
620
- import { __ as __5 } from "@wordpress/i18n";
680
+ import * as React7 from "react";
681
+ import { Link, Stack, Typography as Typography3 } from "@elementor/ui";
682
+ import { __ as __8 } from "@wordpress/i18n";
621
683
  var NoSearchResults = ({ searchValue, onClear, icon }) => {
622
- return /* @__PURE__ */ React6.createElement(
623
- Stack2,
684
+ return /* @__PURE__ */ React7.createElement(
685
+ Stack,
624
686
  {
625
687
  gap: 1,
626
688
  alignItems: "center",
@@ -631,17 +693,17 @@ var NoSearchResults = ({ searchValue, onClear, icon }) => {
631
693
  sx: { pb: 3.5 }
632
694
  },
633
695
  icon,
634
- /* @__PURE__ */ React6.createElement(Typography3, { align: "center", variant: "subtitle2" }, __5("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React6.createElement("br", null), "\u201C", searchValue, "\u201D."),
635
- /* @__PURE__ */ React6.createElement(Typography3, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, __5("Try something else.", "elementor"), /* @__PURE__ */ React6.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __5("Clear & try again", "elementor")))
696
+ /* @__PURE__ */ React7.createElement(Typography3, { align: "center", variant: "subtitle2" }, __8("Sorry, nothing matched", "elementor"), /* @__PURE__ */ React7.createElement("br", null), "\u201C", searchValue, "\u201D."),
697
+ /* @__PURE__ */ React7.createElement(Typography3, { align: "center", variant: "caption", sx: { display: "flex", flexDirection: "column" } }, __8("Try something else.", "elementor"), /* @__PURE__ */ React7.createElement(Link, { color: "text.secondary", variant: "caption", component: "button", onClick: onClear }, __8("Clear & try again", "elementor")))
636
698
  );
637
699
  };
638
700
 
639
701
  // src/components/ui/no-variables.tsx
640
- import * as React7 from "react";
641
- import { Button as Button3, Stack as Stack3, Typography as Typography4 } from "@elementor/ui";
642
- import { __ as __6 } from "@wordpress/i18n";
643
- var NoVariables = ({ icon, title, onAdd }) => /* @__PURE__ */ React7.createElement(
644
- Stack3,
702
+ import * as React8 from "react";
703
+ import { Button as Button4, Stack as Stack2, Typography as Typography4 } from "@elementor/ui";
704
+ import { __ as __9 } from "@wordpress/i18n";
705
+ var NoVariables = ({ icon, title, onAdd }) => /* @__PURE__ */ React8.createElement(
706
+ Stack2,
645
707
  {
646
708
  gap: 1,
647
709
  alignItems: "center",
@@ -651,9 +713,9 @@ var NoVariables = ({ icon, title, onAdd }) => /* @__PURE__ */ React7.createEleme
651
713
  sx: { p: 2.5, pb: 5.5 }
652
714
  },
653
715
  icon,
654
- /* @__PURE__ */ React7.createElement(Typography4, { align: "center", variant: "subtitle2" }, title),
655
- /* @__PURE__ */ React7.createElement(Typography4, { align: "center", variant: "caption", maxWidth: "180px" }, __6("Variables are saved attributes that you can apply anywhere on your site.", "elementor")),
656
- onAdd && /* @__PURE__ */ React7.createElement(Button3, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, __6("Create a variable", "elementor"))
716
+ /* @__PURE__ */ React8.createElement(Typography4, { align: "center", variant: "subtitle2" }, title),
717
+ /* @__PURE__ */ React8.createElement(Typography4, { align: "center", variant: "caption", maxWidth: "180px" }, __9("Variables are saved attributes that you can apply anywhere on your site.", "elementor")),
718
+ onAdd && /* @__PURE__ */ React8.createElement(Button4, { variant: "outlined", color: "secondary", size: "small", onClick: onAdd }, __9("Create a variable", "elementor"))
657
719
  );
658
720
 
659
721
  // src/components/ui/styled-menu-list.tsx
@@ -689,10 +751,10 @@ var VariablesStyledMenuList = styled2(MenuList)(({ theme }) => ({
689
751
  }));
690
752
 
691
753
  // src/components/color-variables-selection.tsx
692
- var SIZE5 = "tiny";
754
+ var SIZE4 = "tiny";
693
755
  var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
694
- const { value: variable, setValue: setVariable } = useBoundProp2(colorVariablePropTypeUtil);
695
- const [searchValue, setSearchValue] = useState3("");
756
+ const { value: variable, setValue: setVariable } = useBoundProp3(colorVariablePropTypeUtil);
757
+ const [searchValue, setSearchValue] = useState5("");
696
758
  const {
697
759
  list: variables,
698
760
  hasMatches: hasSearchResults,
@@ -705,19 +767,19 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
705
767
  const actions = [];
706
768
  if (onAdd) {
707
769
  actions.push(
708
- /* @__PURE__ */ React8.createElement(IconButton5, { key: "add", size: SIZE5, onClick: onAdd }, /* @__PURE__ */ React8.createElement(PlusIcon, { fontSize: SIZE5 }))
770
+ /* @__PURE__ */ React9.createElement(IconButton4, { key: "add", size: SIZE4, onClick: onAdd }, /* @__PURE__ */ React9.createElement(PlusIcon, { fontSize: SIZE4 }))
709
771
  );
710
772
  }
711
773
  if (onSettings) {
712
774
  actions.push(
713
- /* @__PURE__ */ React8.createElement(IconButton5, { key: "settings", size: SIZE5, onClick: onSettings }, /* @__PURE__ */ React8.createElement(SettingsIcon, { fontSize: SIZE5 }))
775
+ /* @__PURE__ */ React9.createElement(IconButton4, { key: "settings", size: SIZE4, onClick: onSettings }, /* @__PURE__ */ React9.createElement(SettingsIcon, { fontSize: SIZE4 }))
714
776
  );
715
777
  }
716
778
  const items = variables.map(({ value, label, key }) => ({
717
779
  type: "item",
718
780
  value: key,
719
781
  label,
720
- icon: /* @__PURE__ */ React8.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
782
+ icon: /* @__PURE__ */ React9.createElement(ColorIndicator, { size: "inherit", component: "span", value }),
721
783
  secondaryText: value,
722
784
  onEdit: () => onEdit?.(key)
723
785
  }));
@@ -727,22 +789,22 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
727
789
  const handleClearSearch = () => {
728
790
  setSearchValue("");
729
791
  };
730
- return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement(
792
+ return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
731
793
  PopoverHeader3,
732
794
  {
733
- title: __7("Variables", "elementor"),
734
- icon: /* @__PURE__ */ React8.createElement(ColorFilterIcon, { fontSize: SIZE5 }),
795
+ title: __10("Variables", "elementor"),
796
+ icon: /* @__PURE__ */ React9.createElement(ColorFilterIcon, { fontSize: SIZE4 }),
735
797
  onClose: closePopover,
736
798
  actions
737
799
  }
738
- ), hasVariables && /* @__PURE__ */ React8.createElement(
800
+ ), hasVariables && /* @__PURE__ */ React9.createElement(
739
801
  PopoverSearch,
740
802
  {
741
803
  value: searchValue,
742
804
  onSearch: handleSearch,
743
- placeholder: __7("Search", "elementor")
805
+ placeholder: __10("Search", "elementor")
744
806
  }
745
- ), /* @__PURE__ */ React8.createElement(Divider3, null), /* @__PURE__ */ React8.createElement(PopoverScrollableContent3, null, hasVariables && hasSearchResults && /* @__PURE__ */ React8.createElement(
807
+ ), /* @__PURE__ */ React9.createElement(Divider3, null), /* @__PURE__ */ React9.createElement(PopoverScrollableContent3, null, hasVariables && hasSearchResults && /* @__PURE__ */ React9.createElement(
746
808
  PopoverMenuList,
747
809
  {
748
810
  items,
@@ -752,102 +814,80 @@ var ColorVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
752
814
  selectedValue: variable,
753
815
  "data-testid": "color-variables-list",
754
816
  menuListTemplate: VariablesStyledMenuList,
755
- menuItemContentTemplate: (item) => /* @__PURE__ */ React8.createElement(MenuItemContent, { item })
817
+ menuItemContentTemplate: (item) => /* @__PURE__ */ React9.createElement(MenuItemContent, { item })
756
818
  }
757
- ), !hasSearchResults && hasVariables && /* @__PURE__ */ React8.createElement(
819
+ ), !hasSearchResults && hasVariables && /* @__PURE__ */ React9.createElement(
758
820
  NoSearchResults,
759
821
  {
760
822
  searchValue,
761
823
  onClear: handleClearSearch,
762
- icon: /* @__PURE__ */ React8.createElement(BrushIcon3, { fontSize: "large" })
824
+ icon: /* @__PURE__ */ React9.createElement(BrushIcon3, { fontSize: "large" })
763
825
  }
764
- ), !hasVariables && /* @__PURE__ */ React8.createElement(
826
+ ), !hasVariables && /* @__PURE__ */ React9.createElement(
765
827
  NoVariables,
766
828
  {
767
- title: __7("Create your first color variable", "elementor"),
768
- icon: /* @__PURE__ */ React8.createElement(BrushIcon3, { fontSize: "large" }),
829
+ title: __10("Create your first color variable", "elementor"),
830
+ icon: /* @__PURE__ */ React9.createElement(BrushIcon3, { fontSize: "large" }),
769
831
  onAdd
770
832
  }
771
833
  )));
772
834
  };
773
835
 
774
836
  // src/components/font-variable-creation.tsx
775
- import * as React9 from "react";
776
- import { useRef as useRef3, useState as useState4 } from "react";
777
- import { FontFamilySelector, PopoverContent as PopoverContent3, useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
778
- import { PopoverScrollableContent as PopoverScrollableContent4, useFontFamilies, useSectionWidth } from "@elementor/editor-editing-panel";
837
+ import * as React11 from "react";
838
+ import { useState as useState7 } from "react";
839
+ import { PopoverContent as PopoverContent3, useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
840
+ import { PopoverScrollableContent as PopoverScrollableContent4 } from "@elementor/editor-editing-panel";
779
841
  import { PopoverHeader as PopoverHeader4 } from "@elementor/editor-ui";
780
- import { ArrowLeftIcon as ArrowLeftIcon3, ChevronDownIcon, TextIcon } from "@elementor/icons";
842
+ import { ArrowLeftIcon as ArrowLeftIcon3, TextIcon } from "@elementor/icons";
843
+ import { Button as Button5, CardActions as CardActions3, Divider as Divider4, IconButton as IconButton5 } from "@elementor/ui";
844
+ import { __ as __12 } from "@wordpress/i18n";
845
+
846
+ // src/components/fields/font-field.tsx
847
+ import * as React10 from "react";
848
+ import { useRef as useRef2, useState as useState6 } from "react";
849
+ import { FontFamilySelector } from "@elementor/editor-controls";
850
+ import { useFontFamilies, useSectionWidth } from "@elementor/editor-editing-panel";
851
+ import { ChevronDownIcon } from "@elementor/icons";
781
852
  import {
782
853
  bindPopover,
783
854
  bindTrigger,
784
- Button as Button4,
785
- CardActions as CardActions3,
786
- Divider as Divider4,
855
+ FormHelperText as FormHelperText3,
787
856
  FormLabel as FormLabel3,
788
857
  Grid as Grid3,
789
- IconButton as IconButton6,
790
858
  Popover,
791
- TextField as TextField3,
792
859
  UnstableTag,
793
860
  usePopupState
794
861
  } from "@elementor/ui";
795
- import { __ as __8 } from "@wordpress/i18n";
796
- var SIZE6 = "tiny";
797
- var FontVariableCreation = ({ onClose, onGoBack }) => {
798
- const fontFamilies = useFontFamilies();
799
- const { setValue: setVariable } = useBoundProp3(fontVariablePropTypeUtil);
800
- const [fontFamily, setFontFamily] = useState4("");
801
- const [label, setLabel] = useState4("");
802
- const anchorRef = useRef3(null);
862
+ import { __ as __11 } from "@wordpress/i18n";
863
+ var FontField = ({ value, onChange }) => {
864
+ const [fontFamily, setFontFamily] = useState6(value);
865
+ const [errorMessage, setErrorMessage] = useState6("");
866
+ const defaultRef = useRef2(null);
867
+ const anchorRef = usePopoverContentRef() ?? defaultRef;
803
868
  const fontPopoverState = usePopupState({ variant: "popover" });
804
- const resetFields = () => {
805
- setFontFamily("");
806
- setLabel("");
807
- };
808
- const closePopover = () => {
809
- resetFields();
810
- onClose();
811
- };
812
- const handleCreate = () => {
813
- createVariable({
814
- value: fontFamily,
815
- label,
816
- type: fontVariablePropTypeUtil.key
817
- }).then((key) => {
818
- setVariable(key);
819
- closePopover();
820
- });
869
+ const fontFamilies = useFontFamilies();
870
+ const sectionWidth = useSectionWidth();
871
+ const handleChange = (newValue) => {
872
+ setFontFamily(newValue);
873
+ const errorMsg = validateValue(newValue);
874
+ setErrorMessage(errorMsg);
875
+ onChange(errorMsg ? "" : newValue);
821
876
  };
822
- const isFormInvalid = () => {
823
- return !fontFamily?.trim() || !label?.trim();
877
+ const handleFontFamilyChange = (newFontFamily) => {
878
+ handleChange(newFontFamily);
879
+ fontPopoverState.close();
824
880
  };
825
- const sectionWidth = useSectionWidth();
826
- return /* @__PURE__ */ React9.createElement(PopoverScrollableContent4, { height: "auto" }, /* @__PURE__ */ React9.createElement(
827
- PopoverHeader4,
828
- {
829
- icon: /* @__PURE__ */ React9.createElement(React9.Fragment, null, onGoBack && /* @__PURE__ */ React9.createElement(IconButton6, { size: SIZE6, "aria-label": __8("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React9.createElement(ArrowLeftIcon3, { fontSize: SIZE6 })), /* @__PURE__ */ React9.createElement(TextIcon, { fontSize: SIZE6 })),
830
- title: __8("Create variable", "elementor"),
831
- onClose: closePopover
832
- }
833
- ), /* @__PURE__ */ React9.createElement(Divider4, null), /* @__PURE__ */ React9.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React9.createElement(Grid3, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React9.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(FormLabel3, { size: "tiny" }, __8("Name", "elementor"))), /* @__PURE__ */ React9.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(
834
- TextField3,
835
- {
836
- size: "tiny",
837
- fullWidth: true,
838
- value: label,
839
- onChange: (e) => setLabel(e.target.value)
840
- }
841
- ))), /* @__PURE__ */ React9.createElement(Grid3, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React9.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(FormLabel3, { size: "tiny" }, __8("Value", "elementor"))), /* @__PURE__ */ React9.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
881
+ return /* @__PURE__ */ React10.createElement(Grid3, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React10.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(FormLabel3, { size: "tiny" }, __11("Value", "elementor"))), /* @__PURE__ */ React10.createElement(Grid3, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(
842
882
  UnstableTag,
843
883
  {
844
884
  variant: "outlined",
845
885
  label: fontFamily,
846
- endIcon: /* @__PURE__ */ React9.createElement(ChevronDownIcon, { fontSize: "tiny" }),
886
+ endIcon: /* @__PURE__ */ React10.createElement(ChevronDownIcon, { fontSize: "tiny" }),
847
887
  ...bindTrigger(fontPopoverState),
848
888
  fullWidth: true
849
889
  }
850
- ), /* @__PURE__ */ React9.createElement(
890
+ ), /* @__PURE__ */ React10.createElement(
851
891
  Popover,
852
892
  {
853
893
  disablePortal: true,
@@ -857,138 +897,162 @@ var FontVariableCreation = ({ onClose, onGoBack }) => {
857
897
  transformOrigin: { vertical: "top", horizontal: -20 },
858
898
  ...bindPopover(fontPopoverState)
859
899
  },
860
- /* @__PURE__ */ React9.createElement(
900
+ /* @__PURE__ */ React10.createElement(
861
901
  FontFamilySelector,
862
902
  {
863
903
  fontFamilies,
864
904
  fontFamily,
865
- onFontFamilyChange: setFontFamily,
905
+ onFontFamilyChange: handleFontFamilyChange,
866
906
  onClose: fontPopoverState.close,
867
907
  sectionWidth
868
908
  }
869
909
  )
870
- ))))), /* @__PURE__ */ React9.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React9.createElement(Button4, { size: "small", variant: "contained", disabled: isFormInvalid(), onClick: handleCreate }, __8("Create", "elementor"))));
910
+ ), errorMessage && /* @__PURE__ */ React10.createElement(FormHelperText3, { error: true }, errorMessage)));
911
+ };
912
+
913
+ // src/components/font-variable-creation.tsx
914
+ var SIZE5 = "tiny";
915
+ var FontVariableCreation = ({ onClose, onGoBack }) => {
916
+ const { setValue: setVariable } = useBoundProp4(fontVariablePropTypeUtil);
917
+ const [fontFamily, setFontFamily] = useState7("");
918
+ const [label, setLabel] = useState7("");
919
+ const resetFields = () => {
920
+ setFontFamily("");
921
+ setLabel("");
922
+ };
923
+ const closePopover = () => {
924
+ resetFields();
925
+ onClose();
926
+ };
927
+ const handleCreate = () => {
928
+ createVariable({
929
+ value: fontFamily,
930
+ label,
931
+ type: fontVariablePropTypeUtil.key
932
+ }).then((key) => {
933
+ setVariable(key);
934
+ closePopover();
935
+ });
936
+ };
937
+ const hasEmptyValue = () => {
938
+ return "" === fontFamily.trim() || "" === label.trim();
939
+ };
940
+ const isSubmitDisabled = hasEmptyValue();
941
+ return /* @__PURE__ */ React11.createElement(PopoverScrollableContent4, { height: "auto" }, /* @__PURE__ */ React11.createElement(
942
+ PopoverHeader4,
943
+ {
944
+ icon: /* @__PURE__ */ React11.createElement(React11.Fragment, null, onGoBack && /* @__PURE__ */ React11.createElement(IconButton5, { size: SIZE5, "aria-label": __12("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React11.createElement(ArrowLeftIcon3, { fontSize: SIZE5 })), /* @__PURE__ */ React11.createElement(TextIcon, { fontSize: SIZE5 })),
945
+ title: __12("Create variable", "elementor"),
946
+ onClose: closePopover
947
+ }
948
+ ), /* @__PURE__ */ React11.createElement(Divider4, null), /* @__PURE__ */ React11.createElement(PopoverContent3, { p: 2 }, /* @__PURE__ */ React11.createElement(LabelField, { value: label, onChange: setLabel }), /* @__PURE__ */ React11.createElement(FontField, { value: fontFamily, onChange: setFontFamily })), /* @__PURE__ */ React11.createElement(CardActions3, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React11.createElement(Button5, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleCreate }, __12("Create", "elementor"))));
871
949
  };
872
950
 
873
951
  // src/components/font-variable-edit.tsx
874
- import * as React10 from "react";
875
- import { useId, useRef as useRef4, useState as useState5 } from "react";
876
- import { FontFamilySelector as FontFamilySelector2, PopoverContent as PopoverContent4 } from "@elementor/editor-controls";
877
- import { useFontFamilies as useFontFamilies2, useSectionWidth as useSectionWidth2 } from "@elementor/editor-editing-panel";
878
- import { PopoverHeader as PopoverHeader5, PopoverScrollableContent as PopoverScrollableContent5 } from "@elementor/editor-ui";
879
- import { ArrowLeftIcon as ArrowLeftIcon4, ChevronDownIcon as ChevronDownIcon2, TextIcon as TextIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
880
- import {
881
- bindPopover as bindPopover2,
882
- bindTrigger as bindTrigger2,
883
- Button as Button5,
884
- CardActions as CardActions4,
885
- Divider as Divider5,
886
- FormLabel as FormLabel4,
887
- Grid as Grid4,
888
- IconButton as IconButton7,
889
- Popover as Popover2,
890
- TextField as TextField4,
891
- UnstableTag as UnstableTag2,
892
- usePopupState as usePopupState2
893
- } from "@elementor/ui";
894
- import { __ as __9 } from "@wordpress/i18n";
895
- var SIZE7 = "tiny";
952
+ import * as React12 from "react";
953
+ import { useState as useState8 } from "react";
954
+ import { PopoverContent as PopoverContent4, useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
955
+ import { PopoverScrollableContent as PopoverScrollableContent5 } from "@elementor/editor-editing-panel";
956
+ import { PopoverHeader as PopoverHeader5 } from "@elementor/editor-ui";
957
+ import { ArrowLeftIcon as ArrowLeftIcon4, TextIcon as TextIcon2, TrashIcon as TrashIcon2 } from "@elementor/icons";
958
+ import { Button as Button6, CardActions as CardActions4, Divider as Divider5, IconButton as IconButton6 } from "@elementor/ui";
959
+ import { __ as __13 } from "@wordpress/i18n";
960
+ var SIZE6 = "tiny";
896
961
  var FontVariableEdit = ({ onClose, onGoBack, onSubmit, editId }) => {
962
+ const { setValue: notifyBoundPropChange, value: assignedValue } = useBoundProp5(fontVariablePropTypeUtil);
963
+ const [deleteConfirmation, setDeleteConfirmation] = useState8(false);
897
964
  const variable = useVariable(editId);
898
965
  if (!variable) {
899
966
  throw new Error(`Global font variable "${editId}" not found`);
900
967
  }
901
- const [fontFamily, setFontFamily] = useState5(variable.value);
902
- const [label, setLabel] = useState5(variable.label);
903
- const variableNameId = useId();
904
- const variableValueId = useId();
905
- const anchorRef = useRef4(null);
906
- const fontPopoverState = usePopupState2({ variant: "popover" });
907
- const fontFamilies = useFontFamilies2();
968
+ const [fontFamily, setFontFamily] = useState8(variable.value);
969
+ const [label, setLabel] = useState8(variable.label);
908
970
  const handleUpdate = () => {
909
971
  updateVariable(editId, {
910
972
  value: fontFamily,
911
973
  label
912
974
  }).then(() => {
975
+ maybeTriggerBoundPropChange();
913
976
  onSubmit?.();
914
977
  });
915
978
  };
916
979
  const handleDelete = () => {
917
980
  deleteVariable(editId).then(() => {
981
+ maybeTriggerBoundPropChange();
918
982
  onSubmit?.();
919
983
  });
920
984
  };
921
- const noValueChanged = () => fontFamily === variable.value && label === variable.label;
922
- const hasEmptyValue = () => "" === fontFamily.trim() || "" === label.trim();
923
- const isSaveDisabled = () => noValueChanged() || hasEmptyValue();
924
- const sectionWidth = useSectionWidth2();
985
+ const maybeTriggerBoundPropChange = () => {
986
+ if (editId === assignedValue) {
987
+ notifyBoundPropChange(editId);
988
+ }
989
+ };
990
+ const handleDeleteConfirmation = () => {
991
+ setDeleteConfirmation(true);
992
+ };
993
+ const closeDeleteDialog = () => () => {
994
+ setDeleteConfirmation(false);
995
+ };
996
+ const hasEmptyValue = () => {
997
+ return !fontFamily.trim() || !label.trim();
998
+ };
999
+ const noValueChanged = () => {
1000
+ return fontFamily === variable.value && label === variable.label;
1001
+ };
1002
+ const isSubmitDisabled = noValueChanged() || hasEmptyValue();
925
1003
  const actions = [];
926
1004
  actions.push(
927
- /* @__PURE__ */ React10.createElement(IconButton7, { key: "delete", size: SIZE7, "aria-label": __9("Delete", "elementor"), onClick: handleDelete }, /* @__PURE__ */ React10.createElement(TrashIcon2, { fontSize: SIZE7 }))
1005
+ /* @__PURE__ */ React12.createElement(
1006
+ IconButton6,
1007
+ {
1008
+ key: "delete",
1009
+ size: SIZE6,
1010
+ "aria-label": __13("Delete", "elementor"),
1011
+ onClick: handleDeleteConfirmation
1012
+ },
1013
+ /* @__PURE__ */ React12.createElement(TrashIcon2, { fontSize: SIZE6 })
1014
+ )
928
1015
  );
929
- return /* @__PURE__ */ React10.createElement(PopoverScrollableContent5, { height: "auto" }, /* @__PURE__ */ React10.createElement(
1016
+ return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(PopoverScrollableContent5, { height: "auto" }, /* @__PURE__ */ React12.createElement(
930
1017
  PopoverHeader5,
931
1018
  {
932
- icon: /* @__PURE__ */ React10.createElement(React10.Fragment, null, onGoBack && /* @__PURE__ */ React10.createElement(IconButton7, { size: SIZE7, "aria-label": __9("Go Back", "elementor"), onClick: onGoBack }, /* @__PURE__ */ React10.createElement(ArrowLeftIcon4, { fontSize: SIZE7 })), /* @__PURE__ */ React10.createElement(TextIcon2, { fontSize: SIZE7 })),
933
- title: __9("Edit variable", "elementor"),
1019
+ icon: /* @__PURE__ */ React12.createElement(React12.Fragment, null, onGoBack && /* @__PURE__ */ React12.createElement(
1020
+ IconButton6,
1021
+ {
1022
+ size: SIZE6,
1023
+ "aria-label": __13("Go Back", "elementor"),
1024
+ onClick: onGoBack
1025
+ },
1026
+ /* @__PURE__ */ React12.createElement(ArrowLeftIcon4, { fontSize: SIZE6 })
1027
+ ), /* @__PURE__ */ React12.createElement(TextIcon2, { fontSize: SIZE6 })),
1028
+ title: __13("Edit variable", "elementor"),
934
1029
  onClose,
935
1030
  actions
936
1031
  }
937
- ), /* @__PURE__ */ React10.createElement(Divider5, null), /* @__PURE__ */ React10.createElement(PopoverContent4, { p: 2 }, /* @__PURE__ */ React10.createElement(Grid4, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React10.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(FormLabel4, { htmlFor: variableNameId, size: "tiny" }, __9("Name", "elementor"))), /* @__PURE__ */ React10.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(
938
- TextField4,
1032
+ ), /* @__PURE__ */ React12.createElement(Divider5, null), /* @__PURE__ */ React12.createElement(PopoverContent4, { p: 2 }, /* @__PURE__ */ React12.createElement(LabelField, { value: label, onChange: setLabel }), /* @__PURE__ */ React12.createElement(FontField, { value: fontFamily, onChange: setFontFamily })), /* @__PURE__ */ React12.createElement(CardActions4, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React12.createElement(Button6, { size: "small", variant: "contained", disabled: isSubmitDisabled, onClick: handleUpdate }, __13("Save", "elementor")))), deleteConfirmation && /* @__PURE__ */ React12.createElement(
1033
+ DeleteConfirmationDialog,
939
1034
  {
940
- id: variableNameId,
941
- size: "tiny",
942
- fullWidth: true,
943
- value: label,
944
- onChange: (e) => setLabel(e.target.value)
945
- }
946
- ))), /* @__PURE__ */ React10.createElement(Grid4, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React10.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(FormLabel4, { htmlFor: variableValueId, size: "tiny" }, __9("Value", "elementor"))), /* @__PURE__ */ React10.createElement(Grid4, { item: true, xs: 12 }, /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(
947
- UnstableTag2,
948
- {
949
- id: variableValueId,
950
- variant: "outlined",
951
- label: fontFamily,
952
- endIcon: /* @__PURE__ */ React10.createElement(ChevronDownIcon2, { fontSize: "tiny" }),
953
- ...bindTrigger2(fontPopoverState),
954
- fullWidth: true
1035
+ open: true,
1036
+ label,
1037
+ onConfirm: handleDelete,
1038
+ closeDialog: closeDeleteDialog()
955
1039
  }
956
- ), /* @__PURE__ */ React10.createElement(
957
- Popover2,
958
- {
959
- disablePortal: true,
960
- disableScrollLock: true,
961
- anchorEl: anchorRef.current,
962
- anchorOrigin: { vertical: "top", horizontal: "right" },
963
- transformOrigin: { vertical: "top", horizontal: -20 },
964
- ...bindPopover2(fontPopoverState)
965
- },
966
- /* @__PURE__ */ React10.createElement(
967
- FontFamilySelector2,
968
- {
969
- fontFamilies,
970
- fontFamily,
971
- onFontFamilyChange: setFontFamily,
972
- onClose: fontPopoverState.close,
973
- sectionWidth
974
- }
975
- )
976
- ))))), /* @__PURE__ */ React10.createElement(CardActions4, { sx: { pt: 0.5, pb: 1 } }, /* @__PURE__ */ React10.createElement(Button5, { size: "small", variant: "contained", disabled: isSaveDisabled(), onClick: handleUpdate }, __9("Save", "elementor"))));
1040
+ ));
977
1041
  };
978
1042
 
979
1043
  // src/components/font-variables-selection.tsx
980
- import * as React11 from "react";
981
- import { useState as useState6 } from "react";
982
- import { useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
1044
+ import * as React13 from "react";
1045
+ import { useState as useState9 } from "react";
1046
+ import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
983
1047
  import { PopoverScrollableContent as PopoverScrollableContent6 } from "@elementor/editor-editing-panel";
984
1048
  import { PopoverHeader as PopoverHeader6, PopoverMenuList as PopoverMenuList2, PopoverSearch as PopoverSearch2 } from "@elementor/editor-ui";
985
1049
  import { ColorFilterIcon as ColorFilterIcon2, PlusIcon as PlusIcon2, SettingsIcon as SettingsIcon2, TextIcon as TextIcon3 } from "@elementor/icons";
986
- import { Divider as Divider6, IconButton as IconButton8 } from "@elementor/ui";
987
- import { __ as __10 } from "@wordpress/i18n";
988
- var SIZE8 = "tiny";
1050
+ import { Divider as Divider6, IconButton as IconButton7 } from "@elementor/ui";
1051
+ import { __ as __14 } from "@wordpress/i18n";
1052
+ var SIZE7 = "tiny";
989
1053
  var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
990
- const { value: variable, setValue: setVariable } = useBoundProp4(fontVariablePropTypeUtil);
991
- const [searchValue, setSearchValue] = useState6("");
1054
+ const { value: variable, setValue: setVariable } = useBoundProp6(fontVariablePropTypeUtil);
1055
+ const [searchValue, setSearchValue] = useState9("");
992
1056
  const {
993
1057
  list: variables,
994
1058
  hasMatches: hasSearchResults,
@@ -1001,19 +1065,19 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
1001
1065
  const actions = [];
1002
1066
  if (onAdd) {
1003
1067
  actions.push(
1004
- /* @__PURE__ */ React11.createElement(IconButton8, { key: "add", size: SIZE8, onClick: onAdd }, /* @__PURE__ */ React11.createElement(PlusIcon2, { fontSize: SIZE8 }))
1068
+ /* @__PURE__ */ React13.createElement(IconButton7, { key: "add", size: SIZE7, onClick: onAdd }, /* @__PURE__ */ React13.createElement(PlusIcon2, { fontSize: SIZE7 }))
1005
1069
  );
1006
1070
  }
1007
1071
  if (onSettings) {
1008
1072
  actions.push(
1009
- /* @__PURE__ */ React11.createElement(IconButton8, { key: "settings", size: SIZE8, onClick: onSettings }, /* @__PURE__ */ React11.createElement(SettingsIcon2, { fontSize: SIZE8 }))
1073
+ /* @__PURE__ */ React13.createElement(IconButton7, { key: "settings", size: SIZE7, onClick: onSettings }, /* @__PURE__ */ React13.createElement(SettingsIcon2, { fontSize: SIZE7 }))
1010
1074
  );
1011
1075
  }
1012
1076
  const items = variables.map(({ value, label, key }) => ({
1013
1077
  type: "item",
1014
1078
  value: key,
1015
1079
  label,
1016
- icon: /* @__PURE__ */ React11.createElement(TextIcon3, { fontSize: SIZE8 }),
1080
+ icon: /* @__PURE__ */ React13.createElement(TextIcon3, { fontSize: SIZE7 }),
1017
1081
  secondaryText: value,
1018
1082
  onEdit: () => onEdit?.(key)
1019
1083
  }));
@@ -1023,22 +1087,22 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
1023
1087
  const handleClearSearch = () => {
1024
1088
  setSearchValue("");
1025
1089
  };
1026
- return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
1090
+ return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(
1027
1091
  PopoverHeader6,
1028
1092
  {
1029
- title: __10("Variables", "elementor"),
1093
+ title: __14("Variables", "elementor"),
1030
1094
  onClose: closePopover,
1031
- icon: /* @__PURE__ */ React11.createElement(ColorFilterIcon2, { fontSize: SIZE8 }),
1095
+ icon: /* @__PURE__ */ React13.createElement(ColorFilterIcon2, { fontSize: SIZE7 }),
1032
1096
  actions
1033
1097
  }
1034
- ), hasVariables && /* @__PURE__ */ React11.createElement(
1098
+ ), hasVariables && /* @__PURE__ */ React13.createElement(
1035
1099
  PopoverSearch2,
1036
1100
  {
1037
1101
  value: searchValue,
1038
1102
  onSearch: handleSearch,
1039
- placeholder: __10("Search", "elementor")
1103
+ placeholder: __14("Search", "elementor")
1040
1104
  }
1041
- ), /* @__PURE__ */ React11.createElement(Divider6, null), /* @__PURE__ */ React11.createElement(PopoverScrollableContent6, null, hasVariables && hasSearchResults && /* @__PURE__ */ React11.createElement(
1105
+ ), /* @__PURE__ */ React13.createElement(Divider6, null), /* @__PURE__ */ React13.createElement(PopoverScrollableContent6, null, hasVariables && hasSearchResults && /* @__PURE__ */ React13.createElement(
1042
1106
  PopoverMenuList2,
1043
1107
  {
1044
1108
  items,
@@ -1048,20 +1112,20 @@ var FontVariablesSelection = ({ closePopover, onAdd, onEdit, onSettings }) => {
1048
1112
  selectedValue: variable,
1049
1113
  "data-testid": "font-variables-list",
1050
1114
  menuListTemplate: VariablesStyledMenuList,
1051
- menuItemContentTemplate: (item) => /* @__PURE__ */ React11.createElement(MenuItemContent, { item })
1115
+ menuItemContentTemplate: (item) => /* @__PURE__ */ React13.createElement(MenuItemContent, { item })
1052
1116
  }
1053
- ), !hasSearchResults && hasVariables && /* @__PURE__ */ React11.createElement(
1117
+ ), !hasSearchResults && hasVariables && /* @__PURE__ */ React13.createElement(
1054
1118
  NoSearchResults,
1055
1119
  {
1056
1120
  searchValue,
1057
1121
  onClear: handleClearSearch,
1058
- icon: /* @__PURE__ */ React11.createElement(TextIcon3, { fontSize: "large" })
1122
+ icon: /* @__PURE__ */ React13.createElement(TextIcon3, { fontSize: "large" })
1059
1123
  }
1060
- ), !hasVariables && /* @__PURE__ */ React11.createElement(
1124
+ ), !hasVariables && /* @__PURE__ */ React13.createElement(
1061
1125
  NoVariables,
1062
1126
  {
1063
- title: __10("Create your first font variable", "elementor"),
1064
- icon: /* @__PURE__ */ React11.createElement(TextIcon3, { fontSize: "large" }),
1127
+ title: __14("Create your first font variable", "elementor"),
1128
+ icon: /* @__PURE__ */ React13.createElement(TextIcon3, { fontSize: "large" }),
1065
1129
  onAdd
1066
1130
  }
1067
1131
  )));
@@ -1072,10 +1136,10 @@ var VIEW_LIST = "list";
1072
1136
  var VIEW_ADD = "add";
1073
1137
  var VIEW_EDIT = "edit";
1074
1138
  var VariableSelectionPopover = ({ closePopover, propTypeKey, selectedVariable }) => {
1075
- const [currentView, setCurrentView] = useState7(VIEW_LIST);
1076
- const editIdRef = useRef5("");
1077
- const anchorRef = useRef5(null);
1078
- return /* @__PURE__ */ React12.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React12.createElement(Box3, { ref: anchorRef }, renderStage({
1139
+ const [currentView, setCurrentView] = useState10(VIEW_LIST);
1140
+ const editIdRef = useRef3("");
1141
+ const anchorRef = useRef3(null);
1142
+ return /* @__PURE__ */ React14.createElement(PopoverContentRefContext.Provider, { value: anchorRef }, /* @__PURE__ */ React14.createElement(Box2, { ref: anchorRef }, renderStage({
1079
1143
  propTypeKey,
1080
1144
  currentView,
1081
1145
  selectedVariable,
@@ -1094,7 +1158,7 @@ function renderStage(props) {
1094
1158
  };
1095
1159
  if (fontVariablePropTypeUtil.key === props.propTypeKey) {
1096
1160
  if (VIEW_LIST === props.currentView) {
1097
- return /* @__PURE__ */ React12.createElement(
1161
+ return /* @__PURE__ */ React14.createElement(
1098
1162
  FontVariablesSelection,
1099
1163
  {
1100
1164
  closePopover: props.closePopover,
@@ -1109,7 +1173,7 @@ function renderStage(props) {
1109
1173
  );
1110
1174
  }
1111
1175
  if (VIEW_ADD === props.currentView) {
1112
- return /* @__PURE__ */ React12.createElement(
1176
+ return /* @__PURE__ */ React14.createElement(
1113
1177
  FontVariableCreation,
1114
1178
  {
1115
1179
  onGoBack: () => props.setCurrentView(VIEW_LIST),
@@ -1118,7 +1182,7 @@ function renderStage(props) {
1118
1182
  );
1119
1183
  }
1120
1184
  if (VIEW_EDIT === props.currentView) {
1121
- return /* @__PURE__ */ React12.createElement(
1185
+ return /* @__PURE__ */ React14.createElement(
1122
1186
  FontVariableEdit,
1123
1187
  {
1124
1188
  editId: props.editIdRef.current ?? "",
@@ -1131,7 +1195,7 @@ function renderStage(props) {
1131
1195
  }
1132
1196
  if (colorVariablePropTypeUtil.key === props.propTypeKey) {
1133
1197
  if (VIEW_LIST === props.currentView) {
1134
- return /* @__PURE__ */ React12.createElement(
1198
+ return /* @__PURE__ */ React14.createElement(
1135
1199
  ColorVariablesSelection,
1136
1200
  {
1137
1201
  closePopover: props.closePopover,
@@ -1146,7 +1210,7 @@ function renderStage(props) {
1146
1210
  );
1147
1211
  }
1148
1212
  if (VIEW_ADD === props.currentView) {
1149
- return /* @__PURE__ */ React12.createElement(
1213
+ return /* @__PURE__ */ React14.createElement(
1150
1214
  ColorVariableCreation,
1151
1215
  {
1152
1216
  onGoBack: () => props.setCurrentView(VIEW_LIST),
@@ -1155,7 +1219,7 @@ function renderStage(props) {
1155
1219
  );
1156
1220
  }
1157
1221
  if (VIEW_EDIT === props.currentView) {
1158
- return /* @__PURE__ */ React12.createElement(
1222
+ return /* @__PURE__ */ React14.createElement(
1159
1223
  ColorVariableEdit,
1160
1224
  {
1161
1225
  editId: props.editIdRef.current ?? "",
@@ -1169,33 +1233,59 @@ function renderStage(props) {
1169
1233
  return null;
1170
1234
  }
1171
1235
 
1172
- // src/controls/color-variable-control.tsx
1173
- var ColorVariableControl = () => {
1174
- const { setValue: setColor } = useBoundProp5();
1175
- const { value: variableValue } = useBoundProp5(colorVariablePropTypeUtil);
1176
- const anchorRef = useRef6(null);
1236
+ // src/components/ui/tags/assigned-tag.tsx
1237
+ import * as React15 from "react";
1238
+ import { DetachIcon } from "@elementor/icons";
1239
+ import { Box as Box3, IconButton as IconButton8, Stack as Stack3, Typography as Typography5, UnstableTag as Tag } from "@elementor/ui";
1240
+ import { __ as __15 } from "@wordpress/i18n";
1241
+ var SIZE8 = "tiny";
1242
+ var AssignedTag = ({ startIcon, label, onUnlink, ...props }) => {
1243
+ const actions = [];
1244
+ if (onUnlink) {
1245
+ actions.push(
1246
+ /* @__PURE__ */ React15.createElement(IconButton8, { key: "unlink", size: SIZE8, onClick: onUnlink, "aria-label": __15("Unlink", "elementor") }, /* @__PURE__ */ React15.createElement(DetachIcon, { fontSize: SIZE8 }))
1247
+ );
1248
+ }
1249
+ return /* @__PURE__ */ React15.createElement(
1250
+ Tag,
1251
+ {
1252
+ fullWidth: true,
1253
+ showActionsOnHover: true,
1254
+ startIcon: /* @__PURE__ */ React15.createElement(Stack3, { gap: 0.5, direction: "row", alignItems: "center" }, startIcon),
1255
+ label: /* @__PURE__ */ React15.createElement(Box3, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React15.createElement(Typography5, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
1256
+ actions,
1257
+ ...props
1258
+ }
1259
+ );
1260
+ };
1261
+
1262
+ // src/components/ui/variable/assigned-variable.tsx
1263
+ var AssignedVariable = ({
1264
+ variable,
1265
+ variablePropTypeUtil,
1266
+ fallbackPropTypeUtil,
1267
+ additionalStartIcon
1268
+ }) => {
1269
+ const { setValue } = useBoundProp7();
1270
+ const anchorRef = useRef4(null);
1177
1271
  const popupId = useId2();
1178
- const popupState = usePopupState3({
1272
+ const popupState = usePopupState2({
1179
1273
  variant: "popover",
1180
1274
  popupId: `elementor-variables-list-${popupId}`
1181
1275
  });
1182
- const selectedVariable = useVariable(variableValue);
1183
- if (!selectedVariable) {
1184
- throw new Error(`Global color variable ${variableValue} not found`);
1185
- }
1186
1276
  const unlinkVariable = () => {
1187
- setColor(colorPropTypeUtil.create(selectedVariable.value));
1277
+ setValue(fallbackPropTypeUtil.create(variable.value));
1188
1278
  };
1189
- return /* @__PURE__ */ React13.createElement(Box4, { ref: anchorRef }, /* @__PURE__ */ React13.createElement(
1190
- VariableTag,
1279
+ return /* @__PURE__ */ React16.createElement(Box4, { ref: anchorRef }, /* @__PURE__ */ React16.createElement(
1280
+ AssignedTag,
1191
1281
  {
1192
- label: selectedVariable.label,
1193
- startIcon: /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(ColorFilterIcon3, { fontSize: SIZE }), /* @__PURE__ */ React13.createElement(ColorIndicator, { size: "inherit", value: selectedVariable.value, component: "span" })),
1282
+ label: variable.label,
1283
+ startIcon: /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(ColorFilterIcon3, { fontSize: SIZE8 }), additionalStartIcon),
1194
1284
  onUnlink: unlinkVariable,
1195
- ...bindTrigger3(popupState)
1285
+ ...bindTrigger2(popupState)
1196
1286
  }
1197
- ), /* @__PURE__ */ React13.createElement(
1198
- Popover3,
1287
+ ), /* @__PURE__ */ React16.createElement(
1288
+ Popover2,
1199
1289
  {
1200
1290
  disableScrollLock: true,
1201
1291
  anchorEl: anchorRef.current,
@@ -1204,24 +1294,75 @@ var ColorVariableControl = () => {
1204
1294
  PaperProps: {
1205
1295
  sx: { my: 1 }
1206
1296
  },
1207
- ...bindPopover3(popupState)
1297
+ ...bindPopover2(popupState)
1208
1298
  },
1209
- /* @__PURE__ */ React13.createElement(
1299
+ /* @__PURE__ */ React16.createElement(
1210
1300
  VariableSelectionPopover,
1211
1301
  {
1212
- selectedVariable,
1302
+ selectedVariable: variable,
1213
1303
  closePopover: popupState.close,
1214
- propTypeKey: colorVariablePropTypeUtil.key
1304
+ propTypeKey: variablePropTypeUtil.key
1215
1305
  }
1216
1306
  )
1217
1307
  ));
1218
1308
  };
1219
1309
 
1220
- // src/hooks/use-prop-color-variable-action.tsx
1221
- import * as React14 from "react";
1222
- import { useBoundProp as useBoundProp6 } from "@elementor/editor-editing-panel";
1310
+ // src/components/ui/variable/deleted-variable.tsx
1311
+ import * as React18 from "react";
1312
+ import { useRef as useRef5 } from "react";
1313
+ import { Box as Box6 } from "@elementor/ui";
1314
+
1315
+ // src/components/ui/tags/deleted-tag.tsx
1316
+ import * as React17 from "react";
1223
1317
  import { ColorFilterIcon as ColorFilterIcon4 } from "@elementor/icons";
1224
- import { __ as __11 } from "@wordpress/i18n";
1318
+ import { Box as Box5, Typography as Typography6, UnstableTag as Tag2 } from "@elementor/ui";
1319
+ import { __ as __16 } from "@wordpress/i18n";
1320
+ var DeletedTag = ({ label }) => {
1321
+ return /* @__PURE__ */ React17.createElement(
1322
+ Tag2,
1323
+ {
1324
+ showActionsOnHover: true,
1325
+ fullWidth: true,
1326
+ label: /* @__PURE__ */ React17.createElement(Box5, { sx: { display: "inline-grid", minWidth: 0 } }, /* @__PURE__ */ React17.createElement(Typography6, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, label)),
1327
+ startIcon: /* @__PURE__ */ React17.createElement(ColorFilterIcon4, { fontSize: "tiny" }),
1328
+ endAdornment: /* @__PURE__ */ React17.createElement(Typography6, { sx: { lineHeight: 1.34 }, variant: "caption", noWrap: true }, "(", __16("deleted", "elementor"), ")")
1329
+ }
1330
+ );
1331
+ };
1332
+
1333
+ // src/components/ui/variable/deleted-variable.tsx
1334
+ var DeletedVariable = ({ variable }) => {
1335
+ const anchorRef = useRef5(null);
1336
+ return /* @__PURE__ */ React18.createElement(Box6, { ref: anchorRef }, /* @__PURE__ */ React18.createElement(DeletedTag, { label: variable.label }));
1337
+ };
1338
+
1339
+ // src/controls/color-variable-control.tsx
1340
+ var ColorVariableControl = () => {
1341
+ const { value: variableValue } = useBoundProp8(colorVariablePropTypeUtil);
1342
+ const assignedVariable = useVariable(variableValue);
1343
+ if (!assignedVariable) {
1344
+ throw new Error(`Global color variable ${variableValue} not found`);
1345
+ }
1346
+ const isVariableDeleted = assignedVariable?.deleted;
1347
+ if (isVariableDeleted) {
1348
+ return /* @__PURE__ */ React19.createElement(DeletedVariable, { variable: assignedVariable });
1349
+ }
1350
+ return /* @__PURE__ */ React19.createElement(
1351
+ AssignedVariable,
1352
+ {
1353
+ variable: assignedVariable,
1354
+ variablePropTypeUtil: colorVariablePropTypeUtil,
1355
+ fallbackPropTypeUtil: colorPropTypeUtil,
1356
+ additionalStartIcon: /* @__PURE__ */ React19.createElement(ColorIndicator, { size: "inherit", value: assignedVariable.value, component: "span" })
1357
+ }
1358
+ );
1359
+ };
1360
+
1361
+ // src/hooks/use-prop-color-variable-action.tsx
1362
+ import * as React20 from "react";
1363
+ import { useBoundProp as useBoundProp9 } from "@elementor/editor-editing-panel";
1364
+ import { ColorFilterIcon as ColorFilterIcon5 } from "@elementor/icons";
1365
+ import { __ as __17 } from "@wordpress/i18n";
1225
1366
 
1226
1367
  // src/utils.ts
1227
1368
  var hasAssignedColorVariable = (propValue) => {
@@ -1239,18 +1380,66 @@ var supportsFontVariables = (propType) => {
1239
1380
 
1240
1381
  // src/hooks/use-prop-color-variable-action.tsx
1241
1382
  var usePropColorVariableAction = () => {
1242
- const { propType } = useBoundProp6();
1383
+ const { propType } = useBoundProp9();
1243
1384
  const visible = !!propType && supportsColorVariables(propType);
1244
1385
  return {
1245
1386
  visible,
1246
- icon: ColorFilterIcon4,
1247
- title: __11("Variables", "elementor"),
1387
+ icon: ColorFilterIcon5,
1388
+ title: __17("Variables", "elementor"),
1248
1389
  content: ({ close: closePopover }) => {
1249
- return /* @__PURE__ */ React14.createElement(VariableSelectionPopover, { closePopover, propTypeKey: colorVariablePropTypeUtil.key });
1390
+ return /* @__PURE__ */ React20.createElement(VariableSelectionPopover, { closePopover, propTypeKey: colorVariablePropTypeUtil.key });
1250
1391
  }
1251
1392
  };
1252
1393
  };
1253
1394
 
1395
+ // src/repeater-injections.ts
1396
+ import { injectIntoRepeaterItemIcon, injectIntoRepeaterItemLabel } from "@elementor/editor-controls";
1397
+ import { backgroundColorOverlayPropTypeUtil, shadowPropTypeUtil } from "@elementor/editor-props";
1398
+
1399
+ // src/components/variables-repeater-item-slot.tsx
1400
+ import * as React21 from "react";
1401
+ var useColorVariable = (value) => {
1402
+ const variableId = value?.value?.color?.value;
1403
+ return useVariable(variableId || "");
1404
+ };
1405
+ var BackgroundRepeaterColorIndicator = ({ value }) => {
1406
+ const colorVariable = useColorVariable(value);
1407
+ return /* @__PURE__ */ React21.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
1408
+ };
1409
+ var BackgroundRepeaterLabel = ({ value }) => {
1410
+ const colorVariable = useColorVariable(value);
1411
+ return /* @__PURE__ */ React21.createElement("span", null, colorVariable?.label);
1412
+ };
1413
+ var BoxShadowRepeaterColorIndicator = ({ value }) => {
1414
+ const colorVariable = useColorVariable(value);
1415
+ return /* @__PURE__ */ React21.createElement(ColorIndicator, { component: "span", size: "inherit", value: colorVariable?.value });
1416
+ };
1417
+
1418
+ // src/repeater-injections.ts
1419
+ function registerRepeaterInjections() {
1420
+ injectIntoRepeaterItemIcon({
1421
+ id: "color-variables-background-icon",
1422
+ component: BackgroundRepeaterColorIndicator,
1423
+ condition: ({ value: prop }) => {
1424
+ return hasAssignedColorVariable(backgroundColorOverlayPropTypeUtil.extract(prop)?.color);
1425
+ }
1426
+ });
1427
+ injectIntoRepeaterItemIcon({
1428
+ id: "color-variables-icon",
1429
+ component: BoxShadowRepeaterColorIndicator,
1430
+ condition: ({ value: prop }) => {
1431
+ return hasAssignedColorVariable(shadowPropTypeUtil.extract(prop)?.color);
1432
+ }
1433
+ });
1434
+ injectIntoRepeaterItemLabel({
1435
+ id: "color-variables-label",
1436
+ component: BackgroundRepeaterLabel,
1437
+ condition: ({ value: prop }) => {
1438
+ return hasAssignedColorVariable(backgroundColorOverlayPropTypeUtil.extract(prop)?.color);
1439
+ }
1440
+ });
1441
+ }
1442
+
1254
1443
  // src/transformers/variable-transformer.ts
1255
1444
  import { createTransformer } from "@elementor/editor-canvas";
1256
1445
  var variableTransformer = createTransformer((value) => {
@@ -1262,15 +1451,7 @@ var variableTransformer = createTransformer((value) => {
1262
1451
 
1263
1452
  // src/init-color-variables.ts
1264
1453
  var { registerPopoverAction } = controlActionsMenu;
1265
- var conditions = {
1266
- backgroundOverlay: ({ value: prop }) => {
1267
- return hasAssignedColorVariable(backgroundColorOverlayPropTypeUtil.extract(prop)?.color);
1268
- },
1269
- boxShadow: ({ value: prop }) => {
1270
- return hasAssignedColorVariable(shadowPropTypeUtil.extract(prop)?.color);
1271
- }
1272
- };
1273
- function registerControlsAndActions() {
1454
+ function initColorVariables() {
1274
1455
  registerControlReplacement({
1275
1456
  component: ColorVariableControl,
1276
1457
  condition: ({ value }) => hasAssignedColorVariable(value)
@@ -1279,34 +1460,8 @@ function registerControlsAndActions() {
1279
1460
  id: "color-variables",
1280
1461
  useProps: usePropColorVariableAction
1281
1462
  });
1282
- }
1283
- function registerRepeaterItemIcons() {
1284
- injectIntoRepeaterItemIcon({
1285
- id: "color-variables-background-icon",
1286
- component: BackgroundRepeaterColorIndicator,
1287
- condition: conditions.backgroundOverlay
1288
- });
1289
- injectIntoRepeaterItemIcon({
1290
- id: "color-variables-icon",
1291
- component: BoxShadowRepeaterColorIndicator,
1292
- condition: conditions.boxShadow
1293
- });
1294
- }
1295
- function registerRepeaterItemLabels() {
1296
- injectIntoRepeaterItemLabel({
1297
- id: "color-variables-label",
1298
- component: BackgroundRepeaterLabel,
1299
- condition: conditions.backgroundOverlay
1300
- });
1301
- }
1302
- function registerStyleTransformers() {
1303
1463
  styleTransformersRegistry.register(colorVariablePropTypeUtil.key, variableTransformer);
1304
- }
1305
- function initColorVariables() {
1306
- registerControlsAndActions();
1307
- registerRepeaterItemIcons();
1308
- registerRepeaterItemLabels();
1309
- registerStyleTransformers();
1464
+ registerRepeaterInjections();
1310
1465
  }
1311
1466
 
1312
1467
  // src/init-font-variables.ts
@@ -1314,73 +1469,43 @@ import { styleTransformersRegistry as styleTransformersRegistry2 } from "@elemen
1314
1469
  import { controlActionsMenu as controlActionsMenu2, registerControlReplacement as registerControlReplacement2 } from "@elementor/editor-editing-panel";
1315
1470
 
1316
1471
  // src/controls/font-variable-control.tsx
1317
- import * as React15 from "react";
1318
- import { useId as useId3, useRef as useRef7 } from "react";
1319
- import { useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
1472
+ import * as React22 from "react";
1473
+ import { useBoundProp as useBoundProp10 } from "@elementor/editor-controls";
1320
1474
  import { stringPropTypeUtil } from "@elementor/editor-props";
1321
- import { ColorFilterIcon as ColorFilterIcon5 } from "@elementor/icons";
1322
- import { bindPopover as bindPopover4, bindTrigger as bindTrigger4, Box as Box5, Popover as Popover4, usePopupState as usePopupState4 } from "@elementor/ui";
1323
1475
  var FontVariableControl = () => {
1324
- const { setValue: setFontFamily } = useBoundProp7();
1325
- const { value: variableValue } = useBoundProp7(fontVariablePropTypeUtil);
1326
- const anchorRef = useRef7(null);
1327
- const popupId = useId3();
1328
- const popupState = usePopupState4({
1329
- variant: "popover",
1330
- popupId: `elementor-variables-list-${popupId}`
1331
- });
1332
- const selectedVariable = useVariable(variableValue);
1333
- if (!selectedVariable) {
1476
+ const { value: variableValue } = useBoundProp10(fontVariablePropTypeUtil);
1477
+ const assignedVariable = useVariable(variableValue);
1478
+ if (!assignedVariable) {
1334
1479
  throw new Error(`Global font variable ${variableValue} not found`);
1335
1480
  }
1336
- const unlinkVariable = () => {
1337
- setFontFamily(stringPropTypeUtil.create(selectedVariable.value));
1338
- };
1339
- return /* @__PURE__ */ React15.createElement(Box5, { ref: anchorRef }, /* @__PURE__ */ React15.createElement(
1340
- VariableTag,
1481
+ const isVariableDeleted = assignedVariable?.deleted;
1482
+ if (isVariableDeleted) {
1483
+ return /* @__PURE__ */ React22.createElement(DeletedVariable, { variable: assignedVariable });
1484
+ }
1485
+ return /* @__PURE__ */ React22.createElement(
1486
+ AssignedVariable,
1341
1487
  {
1342
- label: selectedVariable.label,
1343
- startIcon: /* @__PURE__ */ React15.createElement(ColorFilterIcon5, { fontSize: SIZE }),
1344
- onUnlink: unlinkVariable,
1345
- ...bindTrigger4(popupState)
1488
+ variable: assignedVariable,
1489
+ variablePropTypeUtil: fontVariablePropTypeUtil,
1490
+ fallbackPropTypeUtil: stringPropTypeUtil
1346
1491
  }
1347
- ), /* @__PURE__ */ React15.createElement(
1348
- Popover4,
1349
- {
1350
- disableScrollLock: true,
1351
- anchorEl: anchorRef.current,
1352
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
1353
- transformOrigin: { vertical: "top", horizontal: "right" },
1354
- PaperProps: {
1355
- sx: { my: 1 }
1356
- },
1357
- ...bindPopover4(popupState)
1358
- },
1359
- /* @__PURE__ */ React15.createElement(
1360
- VariableSelectionPopover,
1361
- {
1362
- selectedVariable,
1363
- closePopover: popupState.close,
1364
- propTypeKey: fontVariablePropTypeUtil.key
1365
- }
1366
- )
1367
- ));
1492
+ );
1368
1493
  };
1369
1494
 
1370
1495
  // src/hooks/use-prop-font-variable-action.tsx
1371
- import * as React16 from "react";
1372
- import { useBoundProp as useBoundProp8 } from "@elementor/editor-editing-panel";
1496
+ import * as React23 from "react";
1497
+ import { useBoundProp as useBoundProp11 } from "@elementor/editor-editing-panel";
1373
1498
  import { ColorFilterIcon as ColorFilterIcon6 } from "@elementor/icons";
1374
- import { __ as __12 } from "@wordpress/i18n";
1499
+ import { __ as __18 } from "@wordpress/i18n";
1375
1500
  var usePropFontVariableAction = () => {
1376
- const { propType } = useBoundProp8();
1501
+ const { propType } = useBoundProp11();
1377
1502
  const visible = !!propType && supportsFontVariables(propType);
1378
1503
  return {
1379
1504
  visible,
1380
1505
  icon: ColorFilterIcon6,
1381
- title: __12("Variables", "elementor"),
1506
+ title: __18("Variables", "elementor"),
1382
1507
  content: ({ close: closePopover }) => {
1383
- return /* @__PURE__ */ React16.createElement(VariableSelectionPopover, { closePopover, propTypeKey: fontVariablePropTypeUtil.key });
1508
+ return /* @__PURE__ */ React23.createElement(VariableSelectionPopover, { closePopover, propTypeKey: fontVariablePropTypeUtil.key });
1384
1509
  }
1385
1510
  };
1386
1511
  };
@@ -1400,8 +1525,8 @@ function initFontVariables() {
1400
1525
  }
1401
1526
 
1402
1527
  // src/renderers/style-variables-renderer.tsx
1403
- import * as React17 from "react";
1404
- import { useEffect, useState as useState8 } from "react";
1528
+ import * as React24 from "react";
1529
+ import { useEffect, useState as useState11 } from "react";
1405
1530
  import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
1406
1531
  import { Portal } from "@elementor/ui";
1407
1532
 
@@ -1422,13 +1547,13 @@ function StyleVariablesRenderer() {
1422
1547
  }
1423
1548
  const cssVariables = convertToCssVariables(styleVariables);
1424
1549
  const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
1425
- return /* @__PURE__ */ React17.createElement(Portal, { container }, /* @__PURE__ */ React17.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
1550
+ return /* @__PURE__ */ React24.createElement(Portal, { container }, /* @__PURE__ */ React24.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
1426
1551
  }
1427
1552
  function usePortalContainer() {
1428
1553
  return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
1429
1554
  }
1430
1555
  function useStyleVariables() {
1431
- const [variables, setVariables] = useState8({});
1556
+ const [variables, setVariables] = useState11({});
1432
1557
  useEffect(() => {
1433
1558
  const unsubscribe = styleVariablesRepository.subscribe(setVariables);
1434
1559
  return () => {