@elementor/editor-variables 0.12.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,22 +344,27 @@ 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";
349
- import { PopoverHeader as PopoverHeader2 } from "@elementor/editor-ui";
347
+ import * as React4 from "react";
348
+ import { useId, useRef as useRef3 } from "react";
349
+ import { PopoverHeader as PopoverHeader3 } from "@elementor/editor-ui";
350
350
  import { ColorFilterIcon, DetachIcon, PlusIcon } from "@elementor/icons";
351
351
  import {
352
352
  bindPopover as bindPopover2,
353
- bindTrigger,
354
- Box as Box3,
353
+ bindTrigger as bindTrigger2,
354
+ Box as Box2,
355
355
  IconButton,
356
356
  Popover as Popover2,
357
- Stack as Stack2,
357
+ Stack as Stack3,
358
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";
@@ -367,22 +372,10 @@ import { useRef, useState } from "react";
367
372
  import { useBoundProp as useBoundProp2 } from "@elementor/editor-controls";
368
373
  import { PopoverHeader } from "@elementor/editor-ui";
369
374
  import { BrushIcon } from "@elementor/icons";
370
- import {
371
- bindPopover,
372
- Box as Box2,
373
- Button,
374
- CardActions,
375
- Divider as Divider2,
376
- FormLabel,
377
- Grid,
378
- Popover,
379
- Stack,
380
- TextField,
381
- UnstableColorField
382
- } from "@elementor/ui";
375
+ import { Button, CardActions, Divider as Divider2, FormLabel, Grid, Stack, TextField, UnstableColorField } from "@elementor/ui";
383
376
  import { __ } from "@wordpress/i18n";
384
377
  var SIZE = "tiny";
385
- var ColorVariableCreation = ({ popupState }) => {
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,56 +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(
420
- PopoverHeader,
421
- {
422
- title: __("Create variable", "elementor"),
423
- onClose: closePopover,
424
- icon: /* @__PURE__ */ React2.createElement(BrushIcon, { fontSize: SIZE })
425
- }
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,
522
+ /* @__PURE__ */ React3.createElement(
523
+ FontFamilySelector,
438
524
  {
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
- }
525
+ fontFamilies,
526
+ fontFamily,
527
+ onFontFamilyChange: setFontFamily,
528
+ onClose: fontPopoverState.close
450
529
  }
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
457
- var SIZE2 = "tiny";
535
+ var SIZE3 = "tiny";
458
536
  var VariablesSelectionPopover = ({
459
537
  selectedVariable,
460
538
  unlinkVariable,
@@ -462,27 +540,28 @@ var VariablesSelectionPopover = ({
462
540
  children
463
541
  }) => {
464
542
  const id = useId();
465
- const popupState = usePopupState({ variant: "popover", popupId: `elementor-variables-action-${id}` });
466
- 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}` });
467
545
  const closePopover = () => popupState.close();
468
546
  const handleCreateButtonClick = (event) => {
469
547
  closePopover();
470
- bindTrigger(creationPopupState).onClick(event);
548
+ bindTrigger2(creationPopupState).onClick(event);
471
549
  };
472
- const anchorRef = useRef2(null);
550
+ const anchorRef = useRef3(null);
473
551
  const { label } = selectedVariable;
474
552
  const colorCreationEnabled = colorVariablePropTypeUtil.key === selectedVariable.type;
475
- 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(
476
555
  Tag,
477
556
  {
478
557
  fullWidth: true,
479
558
  showActionsOnHover: true,
480
- ...bindTrigger(popupState),
481
- startIcon: /* @__PURE__ */ React3.createElement(Stack2, { spacing: 1, direction: "row", alignItems: "center" }, startTagAdornment, /* @__PURE__ */ React3.createElement(ColorFilterIcon, { fontSize: "inherit", sx: { mr: 1 } })),
482
- label: /* @__PURE__ */ React3.createElement(Box3, { sx: { display: "inline-grid" } }, /* @__PURE__ */ React3.createElement(Typography, { sx: { textOverflow: "ellipsis", overflowX: "hidden" }, variant: "subtitle2" }, label)),
483
- actions: /* @__PURE__ */ React3.createElement(IconButton, { size: SIZE2, onClick: unlinkVariable, "aria-label": __2("Unlink", "elementor") }, /* @__PURE__ */ React3.createElement(DetachIcon, { fontSize: SIZE2 }))
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 }))
484
563
  }
485
- ), /* @__PURE__ */ React3.createElement(
564
+ ), /* @__PURE__ */ React4.createElement(
486
565
  Popover2,
487
566
  {
488
567
  ...bindPopover2(popupState),
@@ -491,34 +570,44 @@ var VariablesSelectionPopover = ({
491
570
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
492
571
  transformOrigin: { vertical: "top", horizontal: "right" }
493
572
  },
494
- /* @__PURE__ */ React3.createElement(
495
- PopoverHeader2,
573
+ /* @__PURE__ */ React4.createElement(
574
+ PopoverHeader3,
496
575
  {
497
- title: __2("Variables", "elementor"),
576
+ title: __3("Variables", "elementor"),
498
577
  onClose: closePopover,
499
- icon: /* @__PURE__ */ React3.createElement(ColorFilterIcon, { fontSize: SIZE2 }),
578
+ icon: /* @__PURE__ */ React4.createElement(ColorFilterIcon, { fontSize: SIZE3 }),
500
579
  actions: [
501
- /* @__PURE__ */ React3.createElement(
580
+ /* @__PURE__ */ React4.createElement(
502
581
  IconButton,
503
582
  {
504
583
  key: "createVariable",
505
- ...bindTrigger(creationPopupState),
506
- size: SIZE2,
584
+ ...bindTrigger2(creationPopupState),
585
+ size: SIZE3,
507
586
  onClick: handleCreateButtonClick
508
587
  },
509
- /* @__PURE__ */ React3.createElement(PlusIcon, { fontSize: SIZE2 })
588
+ /* @__PURE__ */ React4.createElement(PlusIcon, { fontSize: SIZE3 })
510
589
  )
511
590
  ]
512
591
  }
513
592
  ),
514
593
  children?.({ closePopover })
515
- ), 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
+ )));
516
605
  };
517
606
 
518
607
  // src/controls/color-variables-selection-control.tsx
519
608
  var ColorVariablesSelectionControl = () => {
520
- const { setValue } = useBoundProp3();
521
- const { value: variableValue } = useBoundProp3(colorVariablePropTypeUtil);
609
+ const { setValue } = useBoundProp4();
610
+ const { value: variableValue } = useBoundProp4(colorVariablePropTypeUtil);
522
611
  const selectedVariable = useVariable(variableValue);
523
612
  if (!selectedVariable) {
524
613
  throw new Error(`Global color variable ${variableValue} not found`);
@@ -526,27 +615,22 @@ var ColorVariablesSelectionControl = () => {
526
615
  const unlinkVariable = () => {
527
616
  setValue(colorPropTypeUtil.create(selectedVariable.value));
528
617
  };
529
- return /* @__PURE__ */ React4.createElement(
618
+ return /* @__PURE__ */ React5.createElement(
530
619
  VariablesSelectionPopover,
531
620
  {
532
621
  selectedVariable,
533
622
  unlinkVariable,
534
- 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 })
535
624
  },
536
- ({ closePopover }) => /* @__PURE__ */ React4.createElement(ColorVariablesSelection, { onSelect: closePopover })
625
+ ({ closePopover }) => /* @__PURE__ */ React5.createElement(ColorVariablesSelection, { onSelect: closePopover })
537
626
  );
538
627
  };
539
628
 
540
629
  // src/hooks/use-prop-color-variable-action.tsx
541
- import * as React5 from "react";
542
- 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";
543
632
  import { ColorFilterIcon as ColorFilterIcon2 } from "@elementor/icons";
544
- import { __ as __3 } from "@wordpress/i18n";
545
-
546
- // src/prop-types/font-variable-prop-type.ts
547
- import { createPropUtils as createPropUtils2 } from "@elementor/editor-props";
548
- import { z as z2 } from "@elementor/schema";
549
- var fontVariablePropTypeUtil = createPropUtils2("global-font-variable", z2.string());
633
+ import { __ as __4 } from "@wordpress/i18n";
550
634
 
551
635
  // src/utils.ts
552
636
  var hasAssignedColorVariable = (propValue) => {
@@ -564,13 +648,13 @@ var supportsFontVariables = (propType) => {
564
648
 
565
649
  // src/hooks/use-prop-color-variable-action.tsx
566
650
  var usePropColorVariableAction = () => {
567
- const { propType } = useBoundProp4();
651
+ const { propType } = useBoundProp5();
568
652
  const visible = !!propType && supportsColorVariables(propType);
569
653
  return {
570
654
  visible,
571
655
  icon: ColorFilterIcon2,
572
- title: __3("Variables", "elementor"),
573
- popoverContent: ({ closePopover }) => /* @__PURE__ */ React5.createElement(ColorVariablesSelection, { onSelect: closePopover })
656
+ title: __4("Variables", "elementor"),
657
+ popoverContent: ({ closePopover }) => /* @__PURE__ */ React6.createElement(ColorVariablesSelection, { onSelect: closePopover })
574
658
  };
575
659
  };
576
660
 
@@ -602,32 +686,32 @@ import { styleTransformersRegistry as styleTransformersRegistry2 } from "@elemen
602
686
  import { controlActionsMenu as controlActionsMenu2, registerControlReplacement as registerControlReplacement2 } from "@elementor/editor-editing-panel";
603
687
 
604
688
  // src/controls/font-variables-selection-control.tsx
605
- import * as React7 from "react";
606
- import { useBoundProp as useBoundProp6 } from "@elementor/editor-controls";
689
+ import * as React8 from "react";
690
+ import { useBoundProp as useBoundProp7 } from "@elementor/editor-controls";
607
691
  import { stringPropTypeUtil } from "@elementor/editor-props";
608
692
 
609
693
  // src/components/font-variables-selection.tsx
610
- import * as React6 from "react";
611
- import { Fragment as Fragment2 } from "react";
612
- import { useBoundProp as useBoundProp5 } from "@elementor/editor-controls";
613
- import { EditIcon as EditIcon2, TextIcon } from "@elementor/icons";
614
- 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";
615
699
  var FontVariablesSelection = ({ onSelect }) => {
616
- const { value: variable, setValue: setVariable } = useBoundProp5(fontVariablePropTypeUtil);
700
+ const { value: variable, setValue: setVariable } = useBoundProp6(fontVariablePropTypeUtil);
617
701
  const variables = usePropVariables(fontVariablePropTypeUtil.key);
618
702
  const handleSetVariable = (key) => {
619
703
  setVariable(key);
620
704
  onSelect?.();
621
705
  };
622
- 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(
623
707
  StyledMenuItem,
624
708
  {
625
709
  key,
626
710
  onClick: () => handleSetVariable(key),
627
711
  selected: key === variable
628
712
  },
629
- /* @__PURE__ */ React6.createElement(ListItemIcon2, null, /* @__PURE__ */ React6.createElement(TextIcon, null)),
630
- /* @__PURE__ */ React6.createElement(
713
+ /* @__PURE__ */ React7.createElement(ListItemIcon2, null, /* @__PURE__ */ React7.createElement(TextIcon2, null)),
714
+ /* @__PURE__ */ React7.createElement(
631
715
  ListItemText2,
632
716
  {
633
717
  primary: label,
@@ -652,14 +736,14 @@ var FontVariablesSelection = ({ onSelect }) => {
652
736
  sx: { display: "flex", alignItems: "center", gap: 1 }
653
737
  }
654
738
  ),
655
- /* @__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" } })
656
740
  )))));
657
741
  };
658
742
 
659
743
  // src/controls/font-variables-selection-control.tsx
660
744
  var FontVariablesSelectionControl = () => {
661
- const { setValue: setFontFamily } = useBoundProp6();
662
- const { value: variableValue } = useBoundProp6(fontVariablePropTypeUtil);
745
+ const { setValue: setFontFamily } = useBoundProp7();
746
+ const { value: variableValue } = useBoundProp7(fontVariablePropTypeUtil);
663
747
  const selectedVariable = useVariable(variableValue);
664
748
  if (!selectedVariable) {
665
749
  throw new Error(`Global font variable ${variableValue} not found`);
@@ -667,22 +751,22 @@ var FontVariablesSelectionControl = () => {
667
751
  const unlinkVariable = () => {
668
752
  setFontFamily(stringPropTypeUtil.create(selectedVariable.value));
669
753
  };
670
- 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 }));
671
755
  };
672
756
 
673
757
  // src/hooks/use-prop-font-variable-action.tsx
674
- import * as React8 from "react";
675
- 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";
676
760
  import { ColorFilterIcon as ColorFilterIcon3 } from "@elementor/icons";
677
- import { __ as __4 } from "@wordpress/i18n";
761
+ import { __ as __5 } from "@wordpress/i18n";
678
762
  var usePropFontVariableAction = () => {
679
- const { propType } = useBoundProp7();
763
+ const { propType } = useBoundProp8();
680
764
  const visible = !!propType && supportsFontVariables(propType);
681
765
  return {
682
766
  visible,
683
767
  icon: ColorFilterIcon3,
684
- title: __4("Variables", "elementor"),
685
- popoverContent: ({ closePopover }) => /* @__PURE__ */ React8.createElement(FontVariablesSelection, { onSelect: closePopover })
768
+ title: __5("Variables", "elementor"),
769
+ popoverContent: ({ closePopover }) => /* @__PURE__ */ React9.createElement(FontVariablesSelection, { onSelect: closePopover })
686
770
  };
687
771
  };
688
772
 
@@ -701,8 +785,8 @@ function initFontVariables() {
701
785
  }
702
786
 
703
787
  // src/renderers/style-variables-renderer.tsx
704
- import * as React9 from "react";
705
- import { useEffect, useState as useState2 } from "react";
788
+ import * as React10 from "react";
789
+ import { useEffect, useState as useState3 } from "react";
706
790
  import { __privateUseListenTo as useListenTo, commandEndEvent } from "@elementor/editor-v1-adapters";
707
791
  import { Portal } from "@elementor/ui";
708
792
 
@@ -723,13 +807,13 @@ function StyleVariablesRenderer() {
723
807
  }
724
808
  const cssVariables = convertToCssVariables(styleVariables);
725
809
  const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
726
- 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));
727
811
  }
728
812
  function usePortalContainer() {
729
813
  return useListenTo(commandEndEvent("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
730
814
  }
731
815
  function useStyleVariables() {
732
- const [variables, setVariables] = useState2({});
816
+ const [variables, setVariables] = useState3({});
733
817
  useEffect(() => {
734
818
  const unsubscribe = styleVariablesRepository.subscribe(setVariables);
735
819
  return () => {