@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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @elementor/editor-variables
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5799919: Add font variable creation ui
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [ab6320c]
12
+ - Updated dependencies [199c99a]
13
+ - Updated dependencies [dac8026]
14
+ - Updated dependencies [2c11540]
15
+ - @elementor/editor-editing-panel@1.45.0
16
+ - @elementor/editor-props@0.13.0
17
+ - @elementor/editor-controls@1.0.0
18
+ - @elementor/editor-canvas@0.23.0
19
+
3
20
  ## 0.12.0
4
21
 
5
22
  ### Minor Changes
package/dist/index.js CHANGED
@@ -39,12 +39,12 @@ var import_editor = require("@elementor/editor");
39
39
 
40
40
  // src/init-color-variables.ts
41
41
  var import_editor_canvas2 = require("@elementor/editor-canvas");
42
- var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
42
+ var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
43
43
 
44
44
  // src/controls/color-variables-selection-control.tsx
45
- var React4 = __toESM(require("react"));
46
- var import_editor_controls3 = require("@elementor/editor-controls");
47
- var import_editor_props2 = require("@elementor/editor-props");
45
+ var React5 = __toESM(require("react"));
46
+ var import_editor_controls4 = require("@elementor/editor-controls");
47
+ var import_editor_props3 = require("@elementor/editor-props");
48
48
 
49
49
  // src/components/color-indicator.tsx
50
50
  var import_ui = require("@elementor/ui");
@@ -380,12 +380,17 @@ var ColorVariablesSelection = ({ onSelect }) => {
380
380
  };
381
381
 
382
382
  // src/components/variables-selection-popover.tsx
383
- var React3 = __toESM(require("react"));
384
- var import_react4 = require("react");
385
- var import_editor_ui2 = require("@elementor/editor-ui");
386
- var import_icons3 = require("@elementor/icons");
387
- var import_ui5 = require("@elementor/ui");
388
- var import_i18n2 = require("@wordpress/i18n");
383
+ var React4 = __toESM(require("react"));
384
+ var import_react5 = require("react");
385
+ var import_editor_ui3 = require("@elementor/editor-ui");
386
+ var import_icons4 = require("@elementor/icons");
387
+ var import_ui6 = require("@elementor/ui");
388
+ var import_i18n3 = require("@wordpress/i18n");
389
+
390
+ // src/prop-types/font-variable-prop-type.ts
391
+ var import_editor_props2 = require("@elementor/editor-props");
392
+ var import_schema2 = require("@elementor/schema");
393
+ var fontVariablePropTypeUtil = (0, import_editor_props2.createPropUtils)("global-font-variable", import_schema2.z.string());
389
394
 
390
395
  // src/components/color-variable-creation.tsx
391
396
  var React2 = __toESM(require("react"));
@@ -396,7 +401,7 @@ var import_icons2 = require("@elementor/icons");
396
401
  var import_ui4 = require("@elementor/ui");
397
402
  var import_i18n = require("@wordpress/i18n");
398
403
  var SIZE = "tiny";
399
- var ColorVariableCreation = ({ popupState }) => {
404
+ var ColorVariableCreation = ({ onClose }) => {
400
405
  const { setValue: setVariable } = (0, import_editor_controls2.useBoundProp)(colorVariablePropTypeUtil);
401
406
  const [color, setColor] = (0, import_react3.useState)("");
402
407
  const [label, setLabel] = (0, import_react3.useState)("");
@@ -407,7 +412,7 @@ var ColorVariableCreation = ({ popupState }) => {
407
412
  };
408
413
  const closePopover = () => {
409
414
  resetFields();
410
- popupState.close();
415
+ onClose();
411
416
  };
412
417
  const handleCreate = () => {
413
418
  createVariable({
@@ -419,148 +424,226 @@ var ColorVariableCreation = ({ popupState }) => {
419
424
  closePopover();
420
425
  });
421
426
  };
422
- const isInValidForm = () => {
427
+ const isFormInvalid = () => {
423
428
  return !color?.trim() || !label?.trim();
424
429
  };
425
- return /* @__PURE__ */ React2.createElement(import_ui4.Box, { ref: anchorRef }, /* @__PURE__ */ React2.createElement(
426
- import_ui4.Popover,
430
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(
431
+ import_editor_ui.PopoverHeader,
432
+ {
433
+ title: (0, import_i18n.__)("Create variable", "elementor"),
434
+ onClose: closePopover,
435
+ icon: /* @__PURE__ */ React2.createElement(import_icons2.BrushIcon, { fontSize: SIZE })
436
+ }
437
+ ), /* @__PURE__ */ React2.createElement(import_ui4.Divider, null), /* @__PURE__ */ React2.createElement(import_ui4.Stack, { p: 1.5, gap: 1.5 }, /* @__PURE__ */ React2.createElement(import_ui4.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React2.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(import_ui4.FormLabel, { size: "small" }, (0, import_i18n.__)("Name", "elementor"))), /* @__PURE__ */ React2.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
438
+ import_ui4.TextField,
439
+ {
440
+ size: "tiny",
441
+ fullWidth: true,
442
+ value: label,
443
+ onChange: (e) => setLabel(e.target.value)
444
+ }
445
+ ))), /* @__PURE__ */ React2.createElement(import_ui4.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React2.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(import_ui4.FormLabel, { size: "small" }, (0, import_i18n.__)("Value", "elementor"))), /* @__PURE__ */ React2.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
446
+ import_ui4.UnstableColorField,
447
+ {
448
+ size: "tiny",
449
+ fullWidth: true,
450
+ value: color,
451
+ onChange: setColor,
452
+ slotProps: {
453
+ colorPicker: {
454
+ anchorEl: anchorRef.current,
455
+ anchorOrigin: { vertical: "top", horizontal: "right" },
456
+ transformOrigin: { vertical: "top", horizontal: -10 }
457
+ }
458
+ }
459
+ }
460
+ )))), /* @__PURE__ */ React2.createElement(import_ui4.CardActions, null, /* @__PURE__ */ React2.createElement(import_ui4.Button, { size: "small", onClick: closePopover, color: "secondary", variant: "text" }, (0, import_i18n.__)("Cancel", "elementor")), /* @__PURE__ */ React2.createElement(import_ui4.Button, { size: "small", variant: "contained", disabled: isFormInvalid(), onClick: handleCreate }, (0, import_i18n.__)("Create", "elementor"))));
461
+ };
462
+
463
+ // src/components/font-variable-creation.tsx
464
+ var React3 = __toESM(require("react"));
465
+ var import_react4 = require("react");
466
+ var import_editor_controls3 = require("@elementor/editor-controls");
467
+ var import_editor_editing_panel = require("@elementor/editor-editing-panel");
468
+ var import_editor_ui2 = require("@elementor/editor-ui");
469
+ var import_icons3 = require("@elementor/icons");
470
+ var import_ui5 = require("@elementor/ui");
471
+ var import_i18n2 = require("@wordpress/i18n");
472
+ var SIZE2 = "tiny";
473
+ var FontVariableCreation = ({ onClose }) => {
474
+ const fontFamilies = (0, import_editor_editing_panel.useFontFamilies)();
475
+ const { setValue: setVariable } = (0, import_editor_controls3.useBoundProp)(fontVariablePropTypeUtil);
476
+ const [fontFamily, setFontFamily] = (0, import_react4.useState)("");
477
+ const [label, setLabel] = (0, import_react4.useState)("");
478
+ const anchorRef = (0, import_react4.useRef)(null);
479
+ const fontPopoverState = (0, import_ui5.usePopupState)({ variant: "popover" });
480
+ const resetFields = () => {
481
+ setFontFamily("");
482
+ setLabel("");
483
+ };
484
+ const closePopover = () => {
485
+ resetFields();
486
+ onClose();
487
+ };
488
+ const handleCreate = () => {
489
+ createVariable({
490
+ value: fontFamily,
491
+ label,
492
+ type: fontVariablePropTypeUtil.key
493
+ }).then((key) => {
494
+ setVariable(key);
495
+ closePopover();
496
+ });
497
+ };
498
+ const isFormInvalid = () => {
499
+ return !fontFamily?.trim() || !label?.trim();
500
+ };
501
+ return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
502
+ import_editor_ui2.PopoverHeader,
503
+ {
504
+ title: (0, import_i18n2.__)("Create variable", "elementor"),
505
+ onClose: closePopover,
506
+ icon: /* @__PURE__ */ React3.createElement(import_icons3.TextIcon, { fontSize: SIZE2 })
507
+ }
508
+ ), /* @__PURE__ */ React3.createElement(import_ui5.Divider, null), /* @__PURE__ */ React3.createElement(import_ui5.Stack, { p: 1.5, gap: 1.5 }, /* @__PURE__ */ React3.createElement(import_ui5.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React3.createElement(import_ui5.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(import_ui5.FormLabel, { size: "small" }, (0, import_i18n2.__)("Name", "elementor"))), /* @__PURE__ */ React3.createElement(import_ui5.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(
509
+ import_ui5.TextField,
427
510
  {
428
- ...(0, import_ui4.bindPopover)(popupState),
511
+ size: "tiny",
512
+ fullWidth: true,
513
+ value: label,
514
+ onChange: (e) => setLabel(e.target.value)
515
+ }
516
+ ))), /* @__PURE__ */ React3.createElement(import_ui5.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React3.createElement(import_ui5.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(import_ui5.FormLabel, { size: "small" }, (0, import_i18n2.__)("Value", "elementor"))), /* @__PURE__ */ React3.createElement(import_ui5.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(
517
+ import_ui5.UnstableTag,
518
+ {
519
+ variant: "outlined",
520
+ label: fontFamily,
521
+ endIcon: /* @__PURE__ */ React3.createElement(import_icons3.ChevronDownIcon, { fontSize: "tiny" }),
522
+ ...(0, import_ui5.bindTrigger)(fontPopoverState),
523
+ fullWidth: true
524
+ }
525
+ ), /* @__PURE__ */ React3.createElement(
526
+ import_ui5.Popover,
527
+ {
528
+ disablePortal: true,
529
+ disableScrollLock: true,
429
530
  anchorEl: anchorRef.current,
430
- anchorOrigin: { vertical: "bottom", horizontal: "right" },
431
- transformOrigin: { vertical: "top", horizontal: "right" }
531
+ anchorOrigin: { vertical: "top", horizontal: "right" },
532
+ transformOrigin: { vertical: "top", horizontal: -20 },
533
+ ...(0, import_ui5.bindPopover)(fontPopoverState)
432
534
  },
433
- /* @__PURE__ */ React2.createElement(
434
- import_editor_ui.PopoverHeader,
435
- {
436
- title: (0, import_i18n.__)("Create variable", "elementor"),
437
- onClose: closePopover,
438
- icon: /* @__PURE__ */ React2.createElement(import_icons2.BrushIcon, { fontSize: SIZE })
439
- }
440
- ),
441
- /* @__PURE__ */ React2.createElement(import_ui4.Divider, null),
442
- /* @__PURE__ */ React2.createElement(import_ui4.Stack, { p: 1.5, gap: 1.5 }, /* @__PURE__ */ React2.createElement(import_ui4.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React2.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(import_ui4.FormLabel, { size: "small" }, (0, import_i18n.__)("Name", "elementor"))), /* @__PURE__ */ React2.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
443
- import_ui4.TextField,
444
- {
445
- size: "tiny",
446
- fullWidth: true,
447
- value: label,
448
- onChange: (e) => setLabel(e.target.value)
449
- }
450
- ))), /* @__PURE__ */ React2.createElement(import_ui4.Grid, { container: true, gap: 0.75, alignItems: "center" }, /* @__PURE__ */ React2.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(import_ui4.FormLabel, { size: "small" }, (0, import_i18n.__)("Value", "elementor"))), /* @__PURE__ */ React2.createElement(import_ui4.Grid, { item: true, xs: 12 }, /* @__PURE__ */ React2.createElement(
451
- import_ui4.UnstableColorField,
535
+ /* @__PURE__ */ React3.createElement(
536
+ import_editor_controls3.FontFamilySelector,
452
537
  {
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
- }
538
+ fontFamilies,
539
+ fontFamily,
540
+ onFontFamilyChange: setFontFamily,
541
+ onClose: fontPopoverState.close
464
542
  }
465
- )))),
466
- /* @__PURE__ */ React2.createElement(import_ui4.CardActions, null, /* @__PURE__ */ React2.createElement(import_ui4.Button, { size: "small", onClick: closePopover, color: "secondary", variant: "text" }, (0, import_i18n.__)("Cancel", "elementor")), /* @__PURE__ */ React2.createElement(import_ui4.Button, { size: "small", variant: "contained", disabled: isInValidForm(), onClick: handleCreate }, (0, import_i18n.__)("Create", "elementor")))
467
- ));
543
+ )
544
+ ))))), /* @__PURE__ */ React3.createElement(import_ui5.CardActions, null, /* @__PURE__ */ React3.createElement(import_ui5.Button, { size: "small", onClick: closePopover, color: "secondary", variant: "text" }, (0, import_i18n2.__)("Cancel", "elementor")), /* @__PURE__ */ React3.createElement(import_ui5.Button, { size: "small", variant: "contained", disabled: isFormInvalid(), onClick: handleCreate }, (0, import_i18n2.__)("Create", "elementor"))));
468
545
  };
469
546
 
470
547
  // src/components/variables-selection-popover.tsx
471
- var SIZE2 = "tiny";
548
+ var SIZE3 = "tiny";
472
549
  var VariablesSelectionPopover = ({
473
550
  selectedVariable,
474
551
  unlinkVariable,
475
552
  startTagAdornment,
476
553
  children
477
554
  }) => {
478
- const id = (0, import_react4.useId)();
479
- const popupState = (0, import_ui5.usePopupState)({ variant: "popover", popupId: `elementor-variables-action-${id}` });
480
- const creationPopupState = (0, import_ui5.usePopupState)({ variant: "popover", popupId: `elementor-variables-creation-${id}` });
555
+ const id = (0, import_react5.useId)();
556
+ const popupState = (0, import_ui6.usePopupState)({ variant: "popover", popupId: `elementor-variables-action-${id}` });
557
+ const creationPopupState = (0, import_ui6.usePopupState)({ variant: "popover", popupId: `elementor-variables-creation-${id}` });
481
558
  const closePopover = () => popupState.close();
482
559
  const handleCreateButtonClick = (event) => {
483
560
  closePopover();
484
- (0, import_ui5.bindTrigger)(creationPopupState).onClick(event);
561
+ (0, import_ui6.bindTrigger)(creationPopupState).onClick(event);
485
562
  };
486
- const anchorRef = (0, import_react4.useRef)(null);
563
+ const anchorRef = (0, import_react5.useRef)(null);
487
564
  const { label } = selectedVariable;
488
565
  const colorCreationEnabled = colorVariablePropTypeUtil.key === selectedVariable.type;
489
- return /* @__PURE__ */ React3.createElement(import_ui5.Box, { ref: anchorRef }, /* @__PURE__ */ React3.createElement(
490
- import_ui5.UnstableTag,
566
+ const fontCreationEnabled = fontVariablePropTypeUtil.key === selectedVariable.type;
567
+ return /* @__PURE__ */ React4.createElement(import_ui6.Box, { ref: anchorRef }, /* @__PURE__ */ React4.createElement(
568
+ import_ui6.UnstableTag,
491
569
  {
492
570
  fullWidth: true,
493
571
  showActionsOnHover: true,
494
- ...(0, import_ui5.bindTrigger)(popupState),
495
- startIcon: /* @__PURE__ */ React3.createElement(import_ui5.Stack, { spacing: 1, direction: "row", alignItems: "center" }, startTagAdornment, /* @__PURE__ */ React3.createElement(import_icons3.ColorFilterIcon, { fontSize: "inherit", sx: { mr: 1 } })),
496
- label: /* @__PURE__ */ React3.createElement(import_ui5.Box, { sx: { display: "inline-grid" } }, /* @__PURE__ */ React3.createElement(import_ui5.Typography, { sx: { textOverflow: "ellipsis", overflowX: "hidden" }, variant: "subtitle2" }, label)),
497
- actions: /* @__PURE__ */ React3.createElement(import_ui5.IconButton, { size: SIZE2, onClick: unlinkVariable, "aria-label": (0, import_i18n2.__)("Unlink", "elementor") }, /* @__PURE__ */ React3.createElement(import_icons3.DetachIcon, { fontSize: SIZE2 }))
572
+ ...(0, import_ui6.bindTrigger)(popupState),
573
+ startIcon: /* @__PURE__ */ React4.createElement(import_ui6.Stack, { spacing: 1, direction: "row", alignItems: "center" }, startTagAdornment, /* @__PURE__ */ React4.createElement(import_icons4.ColorFilterIcon, { fontSize: "inherit", sx: { mr: 1 } })),
574
+ label: /* @__PURE__ */ React4.createElement(import_ui6.Box, { sx: { display: "inline-grid" } }, /* @__PURE__ */ React4.createElement(import_ui6.Typography, { sx: { textOverflow: "ellipsis", overflowX: "hidden" }, variant: "subtitle2" }, label)),
575
+ actions: /* @__PURE__ */ React4.createElement(import_ui6.IconButton, { size: SIZE3, onClick: unlinkVariable, "aria-label": (0, import_i18n3.__)("Unlink", "elementor") }, /* @__PURE__ */ React4.createElement(import_icons4.DetachIcon, { fontSize: SIZE3 }))
498
576
  }
499
- ), /* @__PURE__ */ React3.createElement(
500
- import_ui5.Popover,
577
+ ), /* @__PURE__ */ React4.createElement(
578
+ import_ui6.Popover,
501
579
  {
502
- ...(0, import_ui5.bindPopover)(popupState),
580
+ ...(0, import_ui6.bindPopover)(popupState),
503
581
  disableScrollLock: true,
504
582
  anchorEl: anchorRef.current,
505
583
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
506
584
  transformOrigin: { vertical: "top", horizontal: "right" }
507
585
  },
508
- /* @__PURE__ */ React3.createElement(
509
- import_editor_ui2.PopoverHeader,
586
+ /* @__PURE__ */ React4.createElement(
587
+ import_editor_ui3.PopoverHeader,
510
588
  {
511
- title: (0, import_i18n2.__)("Variables", "elementor"),
589
+ title: (0, import_i18n3.__)("Variables", "elementor"),
512
590
  onClose: closePopover,
513
- icon: /* @__PURE__ */ React3.createElement(import_icons3.ColorFilterIcon, { fontSize: SIZE2 }),
591
+ icon: /* @__PURE__ */ React4.createElement(import_icons4.ColorFilterIcon, { fontSize: SIZE3 }),
514
592
  actions: [
515
- /* @__PURE__ */ React3.createElement(
516
- import_ui5.IconButton,
593
+ /* @__PURE__ */ React4.createElement(
594
+ import_ui6.IconButton,
517
595
  {
518
596
  key: "createVariable",
519
- ...(0, import_ui5.bindTrigger)(creationPopupState),
520
- size: SIZE2,
597
+ ...(0, import_ui6.bindTrigger)(creationPopupState),
598
+ size: SIZE3,
521
599
  onClick: handleCreateButtonClick
522
600
  },
523
- /* @__PURE__ */ React3.createElement(import_icons3.PlusIcon, { fontSize: SIZE2 })
601
+ /* @__PURE__ */ React4.createElement(import_icons4.PlusIcon, { fontSize: SIZE3 })
524
602
  )
525
603
  ]
526
604
  }
527
605
  ),
528
606
  children?.({ closePopover })
529
- ), colorCreationEnabled && /* @__PURE__ */ React3.createElement(ColorVariableCreation, { popupState: creationPopupState }));
607
+ ), /* @__PURE__ */ React4.createElement(import_ui6.Box, { ref: anchorRef }, /* @__PURE__ */ React4.createElement(
608
+ import_ui6.Popover,
609
+ {
610
+ ...(0, import_ui6.bindPopover)(creationPopupState),
611
+ anchorEl: anchorRef.current,
612
+ anchorOrigin: { vertical: "bottom", horizontal: "right" },
613
+ transformOrigin: { vertical: "top", horizontal: "right" }
614
+ },
615
+ colorCreationEnabled && /* @__PURE__ */ React4.createElement(ColorVariableCreation, { onClose: creationPopupState.close }),
616
+ fontCreationEnabled && /* @__PURE__ */ React4.createElement(FontVariableCreation, { onClose: creationPopupState.close })
617
+ )));
530
618
  };
531
619
 
532
620
  // src/controls/color-variables-selection-control.tsx
533
621
  var ColorVariablesSelectionControl = () => {
534
- const { setValue } = (0, import_editor_controls3.useBoundProp)();
535
- const { value: variableValue } = (0, import_editor_controls3.useBoundProp)(colorVariablePropTypeUtil);
622
+ const { setValue } = (0, import_editor_controls4.useBoundProp)();
623
+ const { value: variableValue } = (0, import_editor_controls4.useBoundProp)(colorVariablePropTypeUtil);
536
624
  const selectedVariable = useVariable(variableValue);
537
625
  if (!selectedVariable) {
538
626
  throw new Error(`Global color variable ${variableValue} not found`);
539
627
  }
540
628
  const unlinkVariable = () => {
541
- setValue(import_editor_props2.colorPropTypeUtil.create(selectedVariable.value));
629
+ setValue(import_editor_props3.colorPropTypeUtil.create(selectedVariable.value));
542
630
  };
543
- return /* @__PURE__ */ React4.createElement(
631
+ return /* @__PURE__ */ React5.createElement(
544
632
  VariablesSelectionPopover,
545
633
  {
546
634
  selectedVariable,
547
635
  unlinkVariable,
548
- startTagAdornment: /* @__PURE__ */ React4.createElement(ColorIndicator, { size: "inherit", component: "span", value: selectedVariable.value })
636
+ startTagAdornment: /* @__PURE__ */ React5.createElement(ColorIndicator, { size: "inherit", component: "span", value: selectedVariable.value })
549
637
  },
550
- ({ closePopover }) => /* @__PURE__ */ React4.createElement(ColorVariablesSelection, { onSelect: closePopover })
638
+ ({ closePopover }) => /* @__PURE__ */ React5.createElement(ColorVariablesSelection, { onSelect: closePopover })
551
639
  );
552
640
  };
553
641
 
554
642
  // src/hooks/use-prop-color-variable-action.tsx
555
- var React5 = __toESM(require("react"));
556
- var import_editor_editing_panel = require("@elementor/editor-editing-panel");
557
- var import_icons4 = require("@elementor/icons");
558
- var import_i18n3 = require("@wordpress/i18n");
559
-
560
- // src/prop-types/font-variable-prop-type.ts
561
- var import_editor_props3 = require("@elementor/editor-props");
562
- var import_schema2 = require("@elementor/schema");
563
- var fontVariablePropTypeUtil = (0, import_editor_props3.createPropUtils)("global-font-variable", import_schema2.z.string());
643
+ var React6 = __toESM(require("react"));
644
+ var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
645
+ var import_icons5 = require("@elementor/icons");
646
+ var import_i18n4 = require("@wordpress/i18n");
564
647
 
565
648
  // src/utils.ts
566
649
  var hasAssignedColorVariable = (propValue) => {
@@ -578,13 +661,13 @@ var supportsFontVariables = (propType) => {
578
661
 
579
662
  // src/hooks/use-prop-color-variable-action.tsx
580
663
  var usePropColorVariableAction = () => {
581
- const { propType } = (0, import_editor_editing_panel.useBoundProp)();
664
+ const { propType } = (0, import_editor_editing_panel2.useBoundProp)();
582
665
  const visible = !!propType && supportsColorVariables(propType);
583
666
  return {
584
667
  visible,
585
- icon: import_icons4.ColorFilterIcon,
586
- title: (0, import_i18n3.__)("Variables", "elementor"),
587
- popoverContent: ({ closePopover }) => /* @__PURE__ */ React5.createElement(ColorVariablesSelection, { onSelect: closePopover })
668
+ icon: import_icons5.ColorFilterIcon,
669
+ title: (0, import_i18n4.__)("Variables", "elementor"),
670
+ popoverContent: ({ closePopover }) => /* @__PURE__ */ React6.createElement(ColorVariablesSelection, { onSelect: closePopover })
588
671
  };
589
672
  };
590
673
 
@@ -598,9 +681,9 @@ var variableTransformer = (0, import_editor_canvas.createTransformer)((value) =>
598
681
  });
599
682
 
600
683
  // src/init-color-variables.ts
601
- var { registerPopoverAction } = import_editor_editing_panel2.controlActionsMenu;
684
+ var { registerPopoverAction } = import_editor_editing_panel3.controlActionsMenu;
602
685
  function initColorVariables() {
603
- (0, import_editor_editing_panel2.registerControlReplacement)({
686
+ (0, import_editor_editing_panel3.registerControlReplacement)({
604
687
  component: ColorVariablesSelectionControl,
605
688
  condition: ({ value }) => hasAssignedColorVariable(value)
606
689
  });
@@ -613,36 +696,36 @@ function initColorVariables() {
613
696
 
614
697
  // src/init-font-variables.ts
615
698
  var import_editor_canvas3 = require("@elementor/editor-canvas");
616
- var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
699
+ var import_editor_editing_panel5 = require("@elementor/editor-editing-panel");
617
700
 
618
701
  // src/controls/font-variables-selection-control.tsx
619
- var React7 = __toESM(require("react"));
620
- var import_editor_controls5 = require("@elementor/editor-controls");
702
+ var React8 = __toESM(require("react"));
703
+ var import_editor_controls6 = require("@elementor/editor-controls");
621
704
  var import_editor_props4 = require("@elementor/editor-props");
622
705
 
623
706
  // src/components/font-variables-selection.tsx
624
- var React6 = __toESM(require("react"));
625
- var import_react5 = require("react");
626
- var import_editor_controls4 = require("@elementor/editor-controls");
627
- var import_icons5 = require("@elementor/icons");
628
- var import_ui6 = require("@elementor/ui");
707
+ var React7 = __toESM(require("react"));
708
+ var import_react6 = require("react");
709
+ var import_editor_controls5 = require("@elementor/editor-controls");
710
+ var import_icons6 = require("@elementor/icons");
711
+ var import_ui7 = require("@elementor/ui");
629
712
  var FontVariablesSelection = ({ onSelect }) => {
630
- const { value: variable, setValue: setVariable } = (0, import_editor_controls4.useBoundProp)(fontVariablePropTypeUtil);
713
+ const { value: variable, setValue: setVariable } = (0, import_editor_controls5.useBoundProp)(fontVariablePropTypeUtil);
631
714
  const variables = usePropVariables(fontVariablePropTypeUtil.key);
632
715
  const handleSetVariable = (key) => {
633
716
  setVariable(key);
634
717
  onSelect?.();
635
718
  };
636
- return /* @__PURE__ */ React6.createElement(import_react5.Fragment, null, /* @__PURE__ */ React6.createElement(import_ui6.Divider, null), /* @__PURE__ */ React6.createElement(import_ui6.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, /* @__PURE__ */ React6.createElement(import_ui6.MenuList, { role: "listbox", tabIndex: 0 }, variables.map(({ value, label, key }) => /* @__PURE__ */ React6.createElement(
719
+ return /* @__PURE__ */ React7.createElement(import_react6.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui7.Divider, null), /* @__PURE__ */ React7.createElement(import_ui7.Box, { sx: { overflowY: "auto", height: 260, width: 220 } }, /* @__PURE__ */ React7.createElement(import_ui7.MenuList, { role: "listbox", tabIndex: 0 }, variables.map(({ value, label, key }) => /* @__PURE__ */ React7.createElement(
637
720
  StyledMenuItem,
638
721
  {
639
722
  key,
640
723
  onClick: () => handleSetVariable(key),
641
724
  selected: key === variable
642
725
  },
643
- /* @__PURE__ */ React6.createElement(import_ui6.ListItemIcon, null, /* @__PURE__ */ React6.createElement(import_icons5.TextIcon, null)),
644
- /* @__PURE__ */ React6.createElement(
645
- import_ui6.ListItemText,
726
+ /* @__PURE__ */ React7.createElement(import_ui7.ListItemIcon, null, /* @__PURE__ */ React7.createElement(import_icons6.TextIcon, null)),
727
+ /* @__PURE__ */ React7.createElement(
728
+ import_ui7.ListItemText,
646
729
  {
647
730
  primary: label,
648
731
  secondary: value,
@@ -666,14 +749,14 @@ var FontVariablesSelection = ({ onSelect }) => {
666
749
  sx: { display: "flex", alignItems: "center", gap: 1 }
667
750
  }
668
751
  ),
669
- /* @__PURE__ */ React6.createElement(import_icons5.EditIcon, { color: "action", fontSize: "inherit", sx: { mx: 1, opacity: "0" } })
752
+ /* @__PURE__ */ React7.createElement(import_icons6.EditIcon, { color: "action", fontSize: "inherit", sx: { mx: 1, opacity: "0" } })
670
753
  )))));
671
754
  };
672
755
 
673
756
  // src/controls/font-variables-selection-control.tsx
674
757
  var FontVariablesSelectionControl = () => {
675
- const { setValue: setFontFamily } = (0, import_editor_controls5.useBoundProp)();
676
- const { value: variableValue } = (0, import_editor_controls5.useBoundProp)(fontVariablePropTypeUtil);
758
+ const { setValue: setFontFamily } = (0, import_editor_controls6.useBoundProp)();
759
+ const { value: variableValue } = (0, import_editor_controls6.useBoundProp)(fontVariablePropTypeUtil);
677
760
  const selectedVariable = useVariable(variableValue);
678
761
  if (!selectedVariable) {
679
762
  throw new Error(`Global font variable ${variableValue} not found`);
@@ -681,29 +764,29 @@ var FontVariablesSelectionControl = () => {
681
764
  const unlinkVariable = () => {
682
765
  setFontFamily(import_editor_props4.stringPropTypeUtil.create(selectedVariable.value));
683
766
  };
684
- return /* @__PURE__ */ React7.createElement(VariablesSelectionPopover, { selectedVariable, unlinkVariable }, ({ closePopover }) => /* @__PURE__ */ React7.createElement(FontVariablesSelection, { onSelect: closePopover }));
767
+ return /* @__PURE__ */ React8.createElement(VariablesSelectionPopover, { selectedVariable, unlinkVariable }, ({ closePopover }) => /* @__PURE__ */ React8.createElement(FontVariablesSelection, { onSelect: closePopover }));
685
768
  };
686
769
 
687
770
  // src/hooks/use-prop-font-variable-action.tsx
688
- var React8 = __toESM(require("react"));
689
- var import_editor_editing_panel3 = require("@elementor/editor-editing-panel");
690
- var import_icons6 = require("@elementor/icons");
691
- var import_i18n4 = require("@wordpress/i18n");
771
+ var React9 = __toESM(require("react"));
772
+ var import_editor_editing_panel4 = require("@elementor/editor-editing-panel");
773
+ var import_icons7 = require("@elementor/icons");
774
+ var import_i18n5 = require("@wordpress/i18n");
692
775
  var usePropFontVariableAction = () => {
693
- const { propType } = (0, import_editor_editing_panel3.useBoundProp)();
776
+ const { propType } = (0, import_editor_editing_panel4.useBoundProp)();
694
777
  const visible = !!propType && supportsFontVariables(propType);
695
778
  return {
696
779
  visible,
697
- icon: import_icons6.ColorFilterIcon,
698
- title: (0, import_i18n4.__)("Variables", "elementor"),
699
- popoverContent: ({ closePopover }) => /* @__PURE__ */ React8.createElement(FontVariablesSelection, { onSelect: closePopover })
780
+ icon: import_icons7.ColorFilterIcon,
781
+ title: (0, import_i18n5.__)("Variables", "elementor"),
782
+ popoverContent: ({ closePopover }) => /* @__PURE__ */ React9.createElement(FontVariablesSelection, { onSelect: closePopover })
700
783
  };
701
784
  };
702
785
 
703
786
  // src/init-font-variables.ts
704
- var { registerPopoverAction: registerPopoverAction2 } = import_editor_editing_panel4.controlActionsMenu;
787
+ var { registerPopoverAction: registerPopoverAction2 } = import_editor_editing_panel5.controlActionsMenu;
705
788
  function initFontVariables() {
706
- (0, import_editor_editing_panel4.registerControlReplacement)({
789
+ (0, import_editor_editing_panel5.registerControlReplacement)({
707
790
  component: FontVariablesSelectionControl,
708
791
  condition: ({ value }) => hasAssignedFontVariable(value)
709
792
  });
@@ -715,10 +798,10 @@ function initFontVariables() {
715
798
  }
716
799
 
717
800
  // src/renderers/style-variables-renderer.tsx
718
- var React9 = __toESM(require("react"));
719
- var import_react6 = require("react");
801
+ var React10 = __toESM(require("react"));
802
+ var import_react7 = require("react");
720
803
  var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
721
- var import_ui7 = require("@elementor/ui");
804
+ var import_ui8 = require("@elementor/ui");
722
805
 
723
806
  // src/sync/get-canvas-iframe-document.ts
724
807
  function getCanvasIframeDocument() {
@@ -737,14 +820,14 @@ function StyleVariablesRenderer() {
737
820
  }
738
821
  const cssVariables = convertToCssVariables(styleVariables);
739
822
  const wrappedCss = `${VARIABLES_WRAPPER}{${cssVariables}}`;
740
- return /* @__PURE__ */ React9.createElement(import_ui7.Portal, { container }, /* @__PURE__ */ React9.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
823
+ return /* @__PURE__ */ React10.createElement(import_ui8.Portal, { container }, /* @__PURE__ */ React10.createElement("style", { "data-e-style-id": "e-variables", key: wrappedCss }, wrappedCss));
741
824
  }
742
825
  function usePortalContainer() {
743
826
  return (0, import_editor_v1_adapters.__privateUseListenTo)((0, import_editor_v1_adapters.commandEndEvent)("editor/documents/attach-preview"), () => getCanvasIframeDocument()?.head);
744
827
  }
745
828
  function useStyleVariables() {
746
- const [variables, setVariables] = (0, import_react6.useState)({});
747
- (0, import_react6.useEffect)(() => {
829
+ const [variables, setVariables] = (0, import_react7.useState)({});
830
+ (0, import_react7.useEffect)(() => {
748
831
  const unsubscribe = styleVariablesRepository.subscribe(setVariables);
749
832
  return () => {
750
833
  unsubscribe();