@elementor/editor-variables 0.11.0 → 0.13.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
@@ -6,8 +6,8 @@ import { styleTransformersRegistry } from "@elementor/editor-canvas";
6
6
  import { controlActionsMenu, registerControlReplacement } from "@elementor/editor-editing-panel";
7
7
 
8
8
  // src/controls/color-variables-selection-control.tsx
9
- import * as React4 from "react";
10
- import { useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
9
+ import * as React5 from "react";
10
+ import { useBoundProp as useBoundProp4 } from "@elementor/editor-controls";
11
11
  import { colorPropTypeUtil } from "@elementor/editor-props";
12
12
 
13
13
  // src/components/color-indicator.tsx
@@ -344,45 +344,38 @@ var ColorVariablesSelection = ({ onSelect }) => {
344
344
  };
345
345
 
346
346
  // src/components/variables-selection-popover.tsx
347
- import * as React3 from "react";
348
- import { useId, useRef as useRef2 } from "react";
347
+ import * as React4 from "react";
348
+ import { useId, useRef as useRef3 } from "react";
349
+ import { PopoverHeader as PopoverHeader3 } from "@elementor/editor-ui";
349
350
  import { ColorFilterIcon, DetachIcon, PlusIcon } from "@elementor/icons";
350
351
  import {
351
352
  bindPopover as bindPopover2,
352
- bindTrigger,
353
- Box as Box3,
354
- CloseButton as CloseButton2,
353
+ bindTrigger as bindTrigger2,
354
+ Box as Box2,
355
355
  IconButton,
356
356
  Popover as Popover2,
357
- Stack as Stack2,
358
- Typography as Typography2,
357
+ Stack as Stack3,
358
+ Typography,
359
359
  UnstableTag as Tag,
360
- usePopupState
360
+ usePopupState as usePopupState2
361
361
  } from "@elementor/ui";
362
- import { __ as __2 } from "@wordpress/i18n";
362
+ import { __ as __3 } from "@wordpress/i18n";
363
+
364
+ // src/prop-types/font-variable-prop-type.ts
365
+ import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
366
+ import { z as z2 } from "@elementor/schema";
367
+ var fontVariablePropTypeUtil = createPropUtils2("global-font-variable", z2.string());
363
368
 
364
369
  // src/components/color-variable-creation.tsx
365
370
  import * as React2 from "react";
366
371
  import { useRef, useState } from "react";
367
372
  import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
373
+ import { PopoverHeader } from "@elementor/editor-ui";
368
374
  import { BrushIcon } from "@elementor/icons";
369
- import {
370
- bindPopover,
371
- Box as Box2,
372
- Button,
373
- CardActions,
374
- CloseButton,
375
- Divider as Divider2,
376
- FormLabel,
377
- Grid,
378
- Popover,
379
- Stack,
380
- TextField,
381
- Typography,
382
- UnstableColorField
383
- } from "@elementor/ui";
375
+ import { Button, CardActions, Divider as Divider2, FormLabel, Grid, Stack, TextField, UnstableColorField } from "@elementor/ui";
384
376
  import { __ } from "@wordpress/i18n";
385
- var ColorVariableCreation = ({ popupState }) => {
377
+ var SIZE = "tiny";
378
+ var ColorVariableCreation = ({ onClose }) => {
386
379
  const { setValue: setVariable } = useBoundProp2(colorVariablePropTypeUtil);
387
380
  const [color, setColor] = useState("");
388
381
  const [label, setLabel] = useState("");
@@ -393,7 +386,7 @@ var ColorVariableCreation = ({ popupState }) => {
393
386
  };
394
387
  const closePopover = () => {
395
388
  resetFields();
396
- popupState.close();
389
+ onClose();
397
390
  };
398
391
  const handleCreate = () => {
399
392
  createVariable({
@@ -405,55 +398,141 @@ var ColorVariableCreation = ({ popupState }) => {
405
398
  closePopover();
406
399
  });
407
400
  };
408
- const isInValidForm = () => {
401
+ const isFormInvalid = () => {
409
402
  return !color?.trim() || !label?.trim();
410
403
  };
411
- return /* @__PURE__ */ React2.createElement(Box2, { ref: anchorRef }, /* @__PURE__ */ React2.createElement(
404
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
405
+ PopoverHeader,
406
+ {
407
+ title: __("Create variable", "elementor"),
408
+ onClose: closePopover,
409
+ icon: /* @__PURE__ */ React2.createElement(BrushIcon, { fontSize: SIZE })
410
+ }
411
+ ), /* @__PURE__ */ React2.createElement(Divider2, null), /* @__PURE__ */ React2.createElement(Stack, { p: 1.5, gap: 1.5 }, /* @__PURE__ */ React2.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React2.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(FormLabel, { size: "small" }, __("Name", "elementor"))), /* @__PURE__ */ React2.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
412
+ TextField,
413
+ {
414
+ size: "tiny",
415
+ fullWidth: true,
416
+ value: label,
417
+ onChange: (e) => setLabel(e.target.value)
418
+ }
419
+ ))), /* @__PURE__ */ React2.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React2.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(FormLabel, { size: "small" }, __("Value", "elementor"))), /* @__PURE__ */ React2.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
420
+ UnstableColorField,
421
+ {
422
+ size: "tiny",
423
+ fullWidth: true,
424
+ value: color,
425
+ onChange: setColor,
426
+ slotProps: {
427
+ colorPicker: {
428
+ anchorEl: anchorRef.current,
429
+ anchorOrigin: { vertical: "top", horizontal: "right" },
430
+ transformOrigin: { vertical: "top", horizontal: -10 }
431
+ }
432
+ }
433
+ }
434
+ )))), /* @__PURE__ */ React2.createElement(CardActions, null, /* @__PURE__ */ React2.createElement(Button, { size: "small", onClick: closePopover, color: "secondary", variant: "text" }, __("Cancel", "elementor")), /* @__PURE__ */ React2.createElement(Button, { size: "small", variant: "contained", disabled: isFormInvalid(), onClick: handleCreate }, __("Create", "elementor"))));
435
+ };
436
+
437
+ // src/components/font-variable-creation.tsx
438
+ import * as React3 from "react";
439
+ import { useRef as useRef2, useState as useState2 } from "react";
440
+ import { FontFamilySelector, useBoundProp as useBoundProp3 } from "@elementor/editor-controls";
441
+ import { useFontFamilies } from "@elementor/editor-editing-panel";
442
+ import { PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
443
+ import { ChevronDownIcon, TextIcon } from "@elementor/icons";
444
+ import {
445
+ bindPopover,
446
+ bindTrigger,
447
+ Button as Button2,
448
+ CardActions as CardActions2,
449
+ Divider as Divider3,
450
+ FormLabel as FormLabel2,
451
+ Grid as Grid2,
452
+ Popover,
453
+ Stack as Stack2,
454
+ TextField as TextField2,
455
+ UnstableTag,
456
+ usePopupState
457
+ } from "@elementor/ui";
458
+ import { __ as __2 } from "@wordpress/i18n";
459
+ var SIZE2 = "tiny";
460
+ var FontVariableCreation = ({ onClose }) => {
461
+ const fontFamilies = useFontFamilies();
462
+ const { setValue: setVariable } = useBoundProp3(fontVariablePropTypeUtil);
463
+ const [fontFamily, setFontFamily] = useState2("");
464
+ const [label, setLabel] = useState2("");
465
+ const anchorRef = useRef2(null);
466
+ const fontPopoverState = usePopupState({ variant: "popover" });
467
+ const resetFields = () => {
468
+ setFontFamily("");
469
+ setLabel("");
470
+ };
471
+ const closePopover = () => {
472
+ resetFields();
473
+ onClose();
474
+ };
475
+ const handleCreate = () => {
476
+ createVariable({
477
+ value: fontFamily,
478
+ label,
479
+ type: fontVariablePropTypeUtil.key
480
+ }).then((key) => {
481
+ setVariable(key);
482
+ closePopover();
483
+ });
484
+ };
485
+ const isFormInvalid = () => {
486
+ return !fontFamily?.trim() || !label?.trim();
487
+ };
488
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
489
+ PopoverHeader2,
490
+ {
491
+ title: __2("Create variable", "elementor"),
492
+ onClose: closePopover,
493
+ icon: /* @__PURE__ */ React3.createElement(TextIcon, { fontSize: SIZE2 })
494
+ }
495
+ ), /* @__PURE__ */ React3.createElement(Divider3, null), /* @__PURE__ */ React3.createElement(Stack2, { p: 1.5, gap: 1.5 }, /* @__PURE__ */ React3.createElement(Grid2, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React3.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(FormLabel2, { size: "small" }, __2("Name", "elementor"))), /* @__PURE__ */ React3.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(
496
+ TextField2,
497
+ {
498
+ size: "tiny",
499
+ fullWidth: true,
500
+ value: label,
501
+ onChange: (e) => setLabel(e.target.value)
502
+ }
503
+ ))), /* @__PURE__ */ React3.createElement(Grid2, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React3.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(FormLabel2, { size: "small" }, __2("Value", "elementor"))), /* @__PURE__ */ React3.createElement(Grid2, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
504
+ UnstableTag,
505
+ {
506
+ variant: "outlined",
507
+ label: fontFamily,
508
+ endIcon: /* @__PURE__ */ React3.createElement(ChevronDownIcon, { fontSize: "tiny" }),
509
+ ...bindTrigger(fontPopoverState),
510
+ fullWidth: true
511
+ }
512
+ ), /* @__PURE__ */ React3.createElement(
412
513
  Popover,
413
514
  {
414
- ...bindPopover(popupState),
515
+ disablePortal: true,
516
+ disableScrollLock: true,
415
517
  anchorEl: anchorRef.current,
416
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
417
- transformOrigin: { vertical: "top", horizontal: "right" }
518
+ anchorOrigin: { vertical: "top", horizontal: "right" },
519
+ transformOrigin: { vertical: "top", horizontal: -20 },
520
+ ...bindPopover(fontPopoverState)
418
521
  },
419
- /* @__PURE__ */ React2.createElement(Stack, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React2.createElement(BrushIcon, { fontSize: "tiny", sx: { mr: 0.5 } }), /* @__PURE__ */ React2.createElement(Typography, { variant: "subtitle2" }, __("Create variable", "elementor")), /* @__PURE__ */ React2.createElement(
420
- CloseButton,
522
+ /* @__PURE__ */ React3.createElement(
523
+ FontFamilySelector,
421
524
  {
422
- slotProps: { icon: { fontSize: "small" } },
423
- sx: { ml: "auto" },
424
- onClick: closePopover
525
+ fontFamilies,
526
+ fontFamily,
527
+ onFontFamilyChange: setFontFamily,
528
+ onClose: fontPopoverState.close
425
529
  }
426
- )),
427
- /* @__PURE__ */ React2.createElement(Divider2, null),
428
- /* @__PURE__ */ React2.createElement(Stack, { p: 1.5, gap: 1.5 }, /* @__PURE__ */ React2.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React2.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(FormLabel, { size: "small" }, __("Name", "elementor"))), /* @__PURE__ */ React2.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
429
- TextField,
430
- {
431
- size: "tiny",
432
- fullWidth: true,
433
- value: label,
434
- onChange: (e) => setLabel(e.target.value)
435
- }
436
- ))), /* @__PURE__ */ React2.createElement(Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React2.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(FormLabel, { size: "small" }, __("Value", "elementor"))), /* @__PURE__ */ React2.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
437
- UnstableColorField,
438
- {
439
- size: "tiny",
440
- fullWidth: true,
441
- value: color,
442
- onChange: setColor,
443
- slotProps: {
444
- colorPicker: {
445
- anchorEl: anchorRef.current,
446
- anchorOrigin: { vertical: "top", horizontal: "right" },
447
- transformOrigin: { vertical: "top", horizontal: -10 }
448
- }
449
- }
450
- }
451
- )))),
452
- /* @__PURE__ */ React2.createElement(CardActions, null, /* @__PURE__ */ React2.createElement(Button, { size: "small", onClick: closePopover, color: "secondary", variant: "text" }, __("Cancel", "elementor")), /* @__PURE__ */ React2.createElement(Button, { size: "small", variant: "contained", disabled: isInValidForm(), onClick: handleCreate }, __("Create", "elementor")))
453
- ));
530
+ )
531
+ ))))), /* @__PURE__ */ React3.createElement(CardActions2, null, /* @__PURE__ */ React3.createElement(Button2, { size: "small", onClick: closePopover, color: "secondary", variant: "text" }, __2("Cancel", "elementor")), /* @__PURE__ */ React3.createElement(Button2, { size: "small", variant: "contained", disabled: isFormInvalid(), onClick: handleCreate }, __2("Create", "elementor"))));
454
532
  };
455
533
 
456
534
  // src/components/variables-selection-popover.tsx
535
+ var SIZE3 = "tiny";
457
536
  var VariablesSelectionPopover = ({
458
537
  selectedVariable,
459
538
  unlinkVariable,
@@ -461,27 +540,28 @@ var VariablesSelectionPopover = ({
461
540
  children
462
541
  }) => {
463
542
  const id = useId();
464
- const popupState = usePopupState({ variant: "popover", popupId: `elementor-variables-action-${id}` });
465
- const creationPopupState = usePopupState({ variant: "popover", popupId: `elementor-variables-creation-${id}` });
543
+ const popupState = usePopupState2({ variant: "popover", popupId: `elementor-variables-action-${id}` });
544
+ const creationPopupState = usePopupState2({ variant: "popover", popupId: `elementor-variables-creation-${id}` });
466
545
  const closePopover = () => popupState.close();
467
546
  const handleCreateButtonClick = (event) => {
468
547
  closePopover();
469
- bindTrigger(creationPopupState).onClick(event);
548
+ bindTrigger2(creationPopupState).onClick(event);
470
549
  };
471
- const anchorRef = useRef2(null);
550
+ const anchorRef = useRef3(null);
472
551
  const { label } = selectedVariable;
473
552
  const colorCreationEnabled = colorVariablePropTypeUtil.key === selectedVariable.type;
474
- return /* @__PURE__ */ React3.createElement(Box3, { ref: anchorRef }, /* @__PURE__ */ React3.createElement(
553
+ const fontCreationEnabled = fontVariablePropTypeUtil.key === selectedVariable.type;
554
+ return /* @__PURE__ */ React4.createElement(Box2, { ref: anchorRef }, /* @__PURE__ */ React4.createElement(
475
555
  Tag,
476
556
  {
477
557
  fullWidth: true,
478
558
  showActionsOnHover: true,
479
- ...bindTrigger(popupState),
480
- startIcon: /* @__PURE__ */ React3.createElement(Stack2, { spacing: 1, direction: "row", alignItems: "center" }, startTagAdornment, /* @__PURE__ */ React3.createElement(ColorFilterIcon, { fontSize: "inherit", sx: { mr: 1 } })),
481
- label: /* @__PURE__ */ React3.createElement(Box3, { sx: { display: "inline-grid" } }, /* @__PURE__ */ React3.createElement(Typography2, { sx: { textOverflow: "ellipsis", overflowX: "hidden" }, variant: "subtitle2" }, label)),
482
- actions: /* @__PURE__ */ React3.createElement(IconButton, { size: "tiny", onClick: unlinkVariable, "aria-label": __2("Unlink", "elementor") }, /* @__PURE__ */ React3.createElement(DetachIcon, { fontSize: "tiny" }))
559
+ ...bindTrigger2(popupState),
560
+ startIcon: /* @__PURE__ */ React4.createElement(Stack3, { spacing: 1, direction: "row", alignItems: "center" }, startTagAdornment, /* @__PURE__ */ React4.createElement(ColorFilterIcon, { fontSize: "inherit", sx: { mr: 1 } })),
561
+ label: /* @__PURE__ */ React4.createElement(Box2, { sx: { display: "inline-grid" } }, /* @__PURE__ */ React4.createElement(Typography, { sx: { textOverflow: "ellipsis", overflowX: "hidden" }, variant: "subtitle2" }, label)),
562
+ actions: /* @__PURE__ */ React4.createElement(IconButton, { size: SIZE3, onClick: unlinkVariable, "aria-label": __3("Unlink", "elementor") }, /* @__PURE__ */ React4.createElement(DetachIcon, { fontSize: SIZE3 }))
483
563
  }
484
- ), /* @__PURE__ */ React3.createElement(
564
+ ), /* @__PURE__ */ React4.createElement(
485
565
  Popover2,
486
566
  {
487
567
  ...bindPopover2(popupState),
@@ -490,23 +570,44 @@ var VariablesSelectionPopover = ({
490
570
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
491
571
  transformOrigin: { vertical: "top", horizontal: "right" }
492
572
  },
493
- /* @__PURE__ */ React3.createElement(Stack2, { direction: "row", alignItems: "center", pl: 1.5, pr: 0.5, py: 1.5 }, /* @__PURE__ */ React3.createElement(ColorFilterIcon, { fontSize: "tiny", sx: { mr: 0.5 } }), /* @__PURE__ */ React3.createElement(Typography2, { variant: "subtitle2" }, __2("Variables", "elementor")), /* @__PURE__ */ React3.createElement(Stack2, { direction: "row", sx: { ml: "auto" } }, colorCreationEnabled && /* @__PURE__ */ React3.createElement(
494
- IconButton,
573
+ /* @__PURE__ */ React4.createElement(
574
+ PopoverHeader3,
495
575
  {
496
- ...bindTrigger(creationPopupState),
497
- size: "tiny",
498
- onClick: handleCreateButtonClick
499
- },
500
- /* @__PURE__ */ React3.createElement(PlusIcon, { fontSize: "tiny" })
501
- ), /* @__PURE__ */ React3.createElement(CloseButton2, { slotProps: { icon: { fontSize: "tiny" } }, onClick: closePopover }))),
576
+ title: __3("Variables", "elementor"),
577
+ onClose: closePopover,
578
+ icon: /* @__PURE__ */ React4.createElement(ColorFilterIcon, { fontSize: SIZE3 }),
579
+ actions: [
580
+ /* @__PURE__ */ React4.createElement(
581
+ IconButton,
582
+ {
583
+ key: "createVariable",
584
+ ...bindTrigger2(creationPopupState),
585
+ size: SIZE3,
586
+ onClick: handleCreateButtonClick
587
+ },
588
+ /* @__PURE__ */ React4.createElement(PlusIcon, { fontSize: SIZE3 })
589
+ )
590
+ ]
591
+ }
592
+ ),
502
593
  children?.({ closePopover })
503
- ), colorCreationEnabled && /* @__PURE__ */ React3.createElement(ColorVariableCreation, { popupState: creationPopupState }));
594
+ ), /* @__PURE__ */ React4.createElement(Box2, { ref: anchorRef }, /* @__PURE__ */ React4.createElement(
595
+ Popover2,
596
+ {
597
+ ...bindPopover2(creationPopupState),
598
+ anchorEl: anchorRef.current,
599
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
600
+ transformOrigin: { vertical: "top", horizontal: "right" }
601
+ },
602
+ colorCreationEnabled && /* @__PURE__ */ React4.createElement(ColorVariableCreation, { onClose: creationPopupState.close }),
603
+ fontCreationEnabled && /* @__PURE__ */ React4.createElement(FontVariableCreation, { onClose: creationPopupState.close })
604
+ )));
504
605
  };
505
606
 
506
607
  // src/controls/color-variables-selection-control.tsx
507
608
  var ColorVariablesSelectionControl = () => {
508
- const { setValue } = useBoundProp3();
509
- const { value: variableValue } = useBoundProp3(colorVariablePropTypeUtil);
609
+ const { setValue } = useBoundProp4();
610
+ const { value: variableValue } = useBoundProp4(colorVariablePropTypeUtil);
510
611
  const selectedVariable = useVariable(variableValue);
511
612
  if (!selectedVariable) {
512
613
  throw new Error(`Global color variable ${variableValue} not found`);
@@ -514,27 +615,22 @@ var ColorVariablesSelectionControl = () => {
514
615
  const unlinkVariable = () => {
515
616
  setValue(colorPropTypeUtil.create(selectedVariable.value));
516
617
  };
517
- return /* @__PURE__ */ React4.createElement(
618
+ return /* @__PURE__ */ React5.createElement(
518
619
  VariablesSelectionPopover,
519
620
  {
520
621
  selectedVariable,
521
622
  unlinkVariable,
522
- startTagAdornment: /* @__PURE__ */ React4.createElement(ColorIndicator, { size: "inherit", component: "span", value: selectedVariable.value })
623
+ startTagAdornment: /* @__PURE__ */ React5.createElement(ColorIndicator, { size: "inherit", component: "span", value: selectedVariable.value })
523
624
  },
524
- ({ closePopover }) => /* @__PURE__ */ React4.createElement(ColorVariablesSelection, { onSelect: closePopover })
625
+ ({ closePopover }) => /* @__PURE__ */ React5.createElement(ColorVariablesSelection, { onSelect: closePopover })
525
626
  );
526
627
  };
527
628
 
528
629
  // src/hooks/use-prop-color-variable-action.tsx
529
- import * as React5 from "react";
530
- import { useBoundProp as useBoundProp4 } from "@elementor/editor-editing-panel";
630
+ import * as React6 from "react";
631
+ import { useBoundProp as useBoundProp5 } from "@elementor/editor-editing-panel";
531
632
  import { ColorFilterIcon as ColorFilterIcon2 } from "@elementor/icons";
532
- import { __ as __3 } from "@wordpress/i18n";
533
-
534
- // src/prop-types/font-variable-prop-type.ts
535
- import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
536
- import { z as z2 } from "@elementor/schema";
537
- var fontVariablePropTypeUtil = createPropUtils2("global-font-variable", z2.string());
633
+ import { __ as __4 } from "@wordpress/i18n";
538
634
 
539
635
  // src/utils.ts
540
636
  var hasAssignedColorVariable = (propValue) => {
@@ -552,13 +648,13 @@ var supportsFontVariables = (propType) => {
552
648
 
553
649
  // src/hooks/use-prop-color-variable-action.tsx
554
650
  var usePropColorVariableAction = () => {
555
- const { propType } = useBoundProp4();
651
+ const { propType } = useBoundProp5();
556
652
  const visible = !!propType && supportsColorVariables(propType);
557
653
  return {
558
654
  visible,
559
655
  icon: ColorFilterIcon2,
560
- title: __3("Variables", "elementor"),
561
- popoverContent: ({ closePopover }) => /* @__PURE__ */ React5.createElement(ColorVariablesSelection, { onSelect: closePopover })
656
+ title: __4("Variables", "elementor"),
657
+ popoverContent: ({ closePopover }) => /* @__PURE__ */ React6.createElement(ColorVariablesSelection, { onSelect: closePopover })
562
658
  };
563
659
  };
564
660
 
@@ -590,32 +686,32 @@ import { styleTransformersRegistry as styleTransformersRegistry2 } from "@elemen
590
686
  import { controlActionsMenu as controlActionsMenu2, registerControlReplacement as registerControlReplacement2 } from "@elementor/editor-editing-panel";
591
687
 
592
688
  // src/controls/font-variables-selection-control.tsx
593
- import * as React7 from "react";
594
- import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
689
+ import * as React8 from "react";
690
+ import { useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
595
691
  import { stringPropTypeUtil } from "@elementor/editor-props";
596
692
 
597
693
  // src/components/font-variables-selection.tsx
598
- import * as React6 from "react";
599
- import { Fragment as Fragment2 } from "react";
600
- import { useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
601
- import { EditIcon as EditIcon2, TextIcon } from "@elementor/icons";
602
- import { Box as Box4, Divider as Divider3, ListItemIcon as ListItemIcon2, ListItemText as ListItemText2, MenuList as MenuList2 } from "@elementor/ui";
694
+ import * as React7 from "react";
695
+ import { Fragment as Fragment4 } from "react";
696
+ import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
697
+ import { EditIcon as EditIcon2, TextIcon as TextIcon2 } from "@elementor/icons";
698
+ import { Box as Box3, Divider as Divider4, ListItemIcon as ListItemIcon2, ListItemText as ListItemText2, MenuList as MenuList2 } from "@elementor/ui";
603
699
  var FontVariablesSelection = ({ onSelect }) => {
604
- const { value: variable, setValue: setVariable } = useBoundProp5(fontVariablePropTypeUtil);
700
+ const { value: variable, setValue: setVariable } = useBoundProp6(fontVariablePropTypeUtil);
605
701
  const variables = usePropVariables(fontVariablePropTypeUtil.key);
606
702
  const handleSetVariable = (key) => {
607
703
  setVariable(key);
608
704
  onSelect?.();
609
705
  };
610
- return /* @__PURE__ */ React6.createElement(Fragment2, null, /* @__PURE__ */ React6.createElement(Divider3, null), /* @__PURE__ */ React6.createElement(Box4, { sx: { overflowY: "auto", height: 260, width: 220 } }, /* @__PURE__ */ React6.createElement(MenuList2, { role: "listbox", tabIndex: 0 }, variables.map(({ value, label, key }) => /* @__PURE__ */ React6.createElement(
706
+ return /* @__PURE__ */ React7.createElement(Fragment4, null, /* @__PURE__ */ React7.createElement(Divider4, null), /* @__PURE__ */ React7.createElement(Box3, { sx: { overflowY: "auto", height: 260, width: 220 } }, /* @__PURE__ */ React7.createElement(MenuList2, { role: "listbox", tabIndex: 0 }, variables.map(({ value, label, key }) => /* @__PURE__ */ React7.createElement(
611
707
  StyledMenuItem,
612
708
  {
613
709
  key,
614
710
  onClick: () => handleSetVariable(key),
615
711
  selected: key === variable
616
712
  },
617
- /* @__PURE__ */ React6.createElement(ListItemIcon2, null, /* @__PURE__ */ React6.createElement(TextIcon, null)),
618
- /* @__PURE__ */ React6.createElement(
713
+ /* @__PURE__ */ React7.createElement(ListItemIcon2, null, /* @__PURE__ */ React7.createElement(TextIcon2, null)),
714
+ /* @__PURE__ */ React7.createElement(
619
715
  ListItemText2,
620
716
  {
621
717
  primary: label,
@@ -640,14 +736,14 @@ var FontVariablesSelection = ({ onSelect }) => {
640
736
  sx: { display: "flex", alignItems: "center", gap: 1 }
641
737
  }
642
738
  ),
643
- /* @__PURE__ */ React6.createElement(EditIcon2, { color: "action", fontSize: "inherit", sx: { mx: 1, opacity: "0" } })
739
+ /* @__PURE__ */ React7.createElement(EditIcon2, { color: "action", fontSize: "inherit", sx: { mx: 1, opacity: "0" } })
644
740
  )))));
645
741
  };
646
742
 
647
743
  // src/controls/font-variables-selection-control.tsx
648
744
  var FontVariablesSelectionControl = () => {
649
- const { setValue: setFontFamily } = useBoundProp6();
650
- const { value: variableValue } = useBoundProp6(fontVariablePropTypeUtil);
745
+ const { setValue: setFontFamily } = useBoundProp7();
746
+ const { value: variableValue } = useBoundProp7(fontVariablePropTypeUtil);
651
747
  const selectedVariable = useVariable(variableValue);
652
748
  if (!selectedVariable) {
653
749
  throw new Error(`Global font variable ${variableValue} not found`);
@@ -655,22 +751,22 @@ var FontVariablesSelectionControl = () => {
655
751
  const unlinkVariable = () => {
656
752
  setFontFamily(stringPropTypeUtil.create(selectedVariable.value));
657
753
  };
658
- return /* @__PURE__ */ React7.createElement(VariablesSelectionPopover, { selectedVariable, unlinkVariable }, ({ closePopover }) => /* @__PURE__ */ React7.createElement(FontVariablesSelection, { onSelect: closePopover }));
754
+ return /* @__PURE__ */ React8.createElement(VariablesSelectionPopover, { selectedVariable, unlinkVariable }, ({ closePopover }) => /* @__PURE__ */ React8.createElement(FontVariablesSelection, { onSelect: closePopover }));
659
755
  };
660
756
 
661
757
  // src/hooks/use-prop-font-variable-action.tsx
662
- import * as React8 from "react";
663
- import { useBoundProp as useBoundProp7 } from "@elementor/editor-editing-panel";
758
+ import * as React9 from "react";
759
+ import { useBoundProp as useBoundProp8 } from "@elementor/editor-editing-panel";
664
760
  import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
665
- import { __ as __4 } from "@wordpress/i18n";
761
+ import { __ as __5 } from "@wordpress/i18n";
666
762
  var usePropFontVariableAction = () => {
667
- const { propType } = useBoundProp7();
763
+ const { propType } = useBoundProp8();
668
764
  const visible = !!propType && supportsFontVariables(propType);
669
765
  return {
670
766
  visible,
671
767
  icon: ColorFilterIcon3,
672
- title: __4("Variables", "elementor"),
673
- popoverContent: ({ closePopover }) => /* @__PURE__ */ React8.createElement(FontVariablesSelection, { onSelect: closePopover })
768
+ title: __5("Variables", "elementor"),
769
+ popoverContent: ({ closePopover }) => /* @__PURE__ */ React9.createElement(FontVariablesSelection, { onSelect: closePopover })
674
770
  };
675
771
  };
676
772
 
@@ -689,8 +785,8 @@ function initFontVariables() {
689
785
  }
690
786
 
691
787
  // src/renderers/style-variables-renderer.tsx
692
- import * as React9 from "react";
693
- import { useEffect, useState as useState2 } from "react";
788
+ import * as React10 from "react";
789
+ import { useEffect, useState as useState3 } from "react";
694
790
  import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
695
791
  import { Portal } from "@elementor/ui";
696
792
 
@@ -711,13 +807,13 @@ function StyleVariablesRenderer() {
711
807
  }
712
808
  const cssVariables = convertToCssVariables(styleVariables);
713
809
  const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
714
- return /* @__PURE__ */ React9.createElement(Portal, { container }, /* @__PURE__ */ React9.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
810
+ return /* @__PURE__ */ React10.createElement(Portal, { container }, /* @__PURE__ */ React10.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
715
811
  }
716
812
  function usePortalContainer() {
717
813
  return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
718
814
  }
719
815
  function useStyleVariables() {
720
- const [variables, setVariables] = useState2({});
816
+ const [variables, setVariables] = useState3({});
721
817
  useEffect(() => {
722
818
  const unsubscribe = styleVariablesRepository.subscribe(setVariables);
723
819
  return () => {