@elementor/editor-ui 3.35.3 → 3.35.5

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.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _emotion_styled from '@emotion/styled';
2
2
  import * as _mui_system from '@mui/system';
3
3
  import * as React$1 from 'react';
4
- import { ReactNode, PropsWithChildren, ReactElement } from 'react';
4
+ import { ReactNode, PropsWithChildren, ReactElement, MouseEvent as MouseEvent$1 } from 'react';
5
5
  import * as _mui_material from '@mui/material';
6
6
  import { MenuItemProps, MenuItemTextProps, TypographyProps, AlertProps, InfotipProps, BoxProps, ButtonProps, MenuList, DialogProps, DialogContentTextProps } from '@elementor/ui';
7
7
 
@@ -114,7 +114,7 @@ type PromotionPopoverCardProps = {
114
114
  content: string;
115
115
  ctaUrl: string;
116
116
  ctaText?: string;
117
- onClose: () => void;
117
+ onClose: (e: MouseEvent$1) => void;
118
118
  };
119
119
  type PromotionPopoverProps = React$1.PropsWithChildren<PromotionPopoverCardProps & {
120
120
  open: boolean;
@@ -125,6 +125,12 @@ declare const PromotionPopover: ({ children, open, placement, slotProps, ...card
125
125
 
126
126
  declare const PromotionChip: React$1.ForwardRefExoticComponent<React$1.RefAttributes<HTMLDivElement>>;
127
127
 
128
+ type PromotionAlertProps = {
129
+ message: string;
130
+ upgradeUrl: string;
131
+ };
132
+ declare const PromotionAlert: ({ message, upgradeUrl }: PromotionAlertProps) => React$1.JSX.Element;
133
+
128
134
  type PopoverBodyProps = PropsWithChildren<{
129
135
  height?: number | 'auto';
130
136
  width?: number;
@@ -235,4 +241,6 @@ declare const useEditable: ({ value, onSubmit, validation, onClick, onError }: U
235
241
  };
236
242
  };
237
243
 
238
- export { CollapseIcon, ConfirmationDialog, CtaButton, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, PromotionChip, PromotionInfotip, PromotionPopover, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
244
+ declare const useCanvasClickHandler: (isActive: boolean, onClickAway: (e: MouseEvent) => void) => void;
245
+
246
+ export { CollapseIcon, ConfirmationDialog, CtaButton, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, PromotionAlert, PromotionChip, PromotionInfotip, PromotionPopover, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useCanvasClickHandler, useDialog, useEditable };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _emotion_styled from '@emotion/styled';
2
2
  import * as _mui_system from '@mui/system';
3
3
  import * as React$1 from 'react';
4
- import { ReactNode, PropsWithChildren, ReactElement } from 'react';
4
+ import { ReactNode, PropsWithChildren, ReactElement, MouseEvent as MouseEvent$1 } from 'react';
5
5
  import * as _mui_material from '@mui/material';
6
6
  import { MenuItemProps, MenuItemTextProps, TypographyProps, AlertProps, InfotipProps, BoxProps, ButtonProps, MenuList, DialogProps, DialogContentTextProps } from '@elementor/ui';
7
7
 
@@ -114,7 +114,7 @@ type PromotionPopoverCardProps = {
114
114
  content: string;
115
115
  ctaUrl: string;
116
116
  ctaText?: string;
117
- onClose: () => void;
117
+ onClose: (e: MouseEvent$1) => void;
118
118
  };
119
119
  type PromotionPopoverProps = React$1.PropsWithChildren<PromotionPopoverCardProps & {
120
120
  open: boolean;
@@ -125,6 +125,12 @@ declare const PromotionPopover: ({ children, open, placement, slotProps, ...card
125
125
 
126
126
  declare const PromotionChip: React$1.ForwardRefExoticComponent<React$1.RefAttributes<HTMLDivElement>>;
127
127
 
128
+ type PromotionAlertProps = {
129
+ message: string;
130
+ upgradeUrl: string;
131
+ };
132
+ declare const PromotionAlert: ({ message, upgradeUrl }: PromotionAlertProps) => React$1.JSX.Element;
133
+
128
134
  type PopoverBodyProps = PropsWithChildren<{
129
135
  height?: number | 'auto';
130
136
  width?: number;
@@ -235,4 +241,6 @@ declare const useEditable: ({ value, onSubmit, validation, onClick, onError }: U
235
241
  };
236
242
  };
237
243
 
238
- export { CollapseIcon, ConfirmationDialog, CtaButton, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, PromotionChip, PromotionInfotip, PromotionPopover, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
244
+ declare const useCanvasClickHandler: (isActive: boolean, onClickAway: (e: MouseEvent) => void) => void;
245
+
246
+ export { CollapseIcon, ConfirmationDialog, CtaButton, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, PromotionAlert, PromotionChip, PromotionInfotip, PromotionPopover, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useCanvasClickHandler, useDialog, useEditable };
package/dist/index.js CHANGED
@@ -46,6 +46,7 @@ __export(index_exports, {
46
46
  PopoverBody: () => PopoverBody,
47
47
  PopoverHeader: () => PopoverHeader,
48
48
  PopoverMenuList: () => PopoverMenuList,
49
+ PromotionAlert: () => PromotionAlert,
49
50
  PromotionChip: () => PromotionChip,
50
51
  PromotionInfotip: () => PromotionInfotip,
51
52
  PromotionPopover: () => PromotionPopover,
@@ -56,6 +57,7 @@ __export(index_exports, {
56
57
  WarningInfotip: () => WarningInfotip,
57
58
  closeDialog: () => closeDialog,
58
59
  openDialog: () => openDialog,
60
+ useCanvasClickHandler: () => useCanvasClickHandler,
59
61
  useDialog: () => useDialog,
60
62
  useEditable: () => useEditable
61
63
  });
@@ -446,20 +448,63 @@ var CtaButton = ({ href, children, showIcon = true, ...props }) => /* @__PURE__
446
448
  children ?? (0, import_i18n3.__)("Upgrade Now", "elementor")
447
449
  );
448
450
 
449
- // src/components/promotion-infotip.tsx
451
+ // src/components/promotions/promotion-infotip.tsx
450
452
  var React13 = __toESM(require("react"));
451
- var import_react10 = require("react");
452
- var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
453
453
  var import_ui13 = require("@elementor/ui");
454
- var PromotionInfotip = ({ children, open, onClose, ...cardProps }) => {
454
+
455
+ // src/hooks/use-scroll-to-selected.ts
456
+ var import_react10 = require("react");
457
+ var useScrollToSelected = ({
458
+ selectedValue,
459
+ items,
460
+ virtualizer
461
+ }) => {
455
462
  (0, import_react10.useEffect)(() => {
456
- const canvasDocument = open ? (0, import_editor_v1_adapters2.getCanvasIframeDocument)() : null;
463
+ if (!selectedValue || items.length === 0) {
464
+ return;
465
+ }
466
+ const selectedIndex = items.findIndex((item) => item.value === selectedValue);
467
+ if (selectedIndex !== -1) {
468
+ virtualizer.scrollToIndex(selectedIndex, { align: "center" });
469
+ }
470
+ }, [selectedValue, items, virtualizer]);
471
+ };
472
+
473
+ // src/hooks/use-scroll-top.ts
474
+ var import_react11 = require("react");
475
+ var useScrollTop = ({ containerRef }) => {
476
+ const [scrollTop, setScrollTop] = (0, import_react11.useState)(0);
477
+ (0, import_react11.useEffect)(() => {
478
+ const container = containerRef.current;
479
+ if (!container) {
480
+ return;
481
+ }
482
+ const handleScroll = () => {
483
+ setScrollTop(container.scrollTop);
484
+ };
485
+ container.addEventListener("scroll", handleScroll);
486
+ return () => container.removeEventListener("scroll", handleScroll);
487
+ }, [containerRef]);
488
+ return scrollTop;
489
+ };
490
+
491
+ // src/hooks/use-canvas-click-handler.tsx
492
+ var import_react12 = require("react");
493
+ var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
494
+ var useCanvasClickHandler = (isActive, onClickAway) => {
495
+ (0, import_react12.useEffect)(() => {
496
+ const canvasDocument = isActive ? (0, import_editor_v1_adapters2.getCanvasIframeDocument)() : null;
457
497
  if (!canvasDocument) {
458
498
  return;
459
499
  }
460
- canvasDocument.addEventListener("mousedown", onClose);
461
- return () => canvasDocument.removeEventListener("mousedown", onClose);
462
- }, [open, onClose]);
500
+ canvasDocument.addEventListener("mousedown", onClickAway);
501
+ return () => canvasDocument.removeEventListener("mousedown", onClickAway);
502
+ }, [isActive, onClickAway]);
503
+ };
504
+
505
+ // src/components/promotions/promotion-infotip.tsx
506
+ var PromotionInfotip = ({ children, open, onClose, ...cardProps }) => {
507
+ useCanvasClickHandler(!!open, onClose);
463
508
  return /* @__PURE__ */ React13.createElement(import_ui13.Infotip, { placement: "right", content: /* @__PURE__ */ React13.createElement(InfotipCard, { onClose, ...cardProps }), open }, children);
464
509
  };
465
510
  function InfotipCard({ title, content, assetUrl, ctaUrl, onClose }) {
@@ -481,7 +526,7 @@ function InfotipCard({ title, content, assetUrl, ctaUrl, onClose }) {
481
526
  );
482
527
  }
483
528
 
484
- // src/components/promotion-popover.tsx
529
+ // src/components/promotions/promotion-popover.tsx
485
530
  var React14 = __toESM(require("react"));
486
531
  var import_icons5 = require("@elementor/icons");
487
532
  var import_ui14 = require("@elementor/ui");
@@ -552,7 +597,7 @@ function PopoverAlert({ title, content, ctaUrl, ctaText, onClose }) {
552
597
  );
553
598
  }
554
599
 
555
- // src/components/promotion-chip.tsx
600
+ // src/components/promotions/promotion-chip.tsx
556
601
  var React15 = __toESM(require("react"));
557
602
  var import_icons6 = require("@elementor/icons");
558
603
  var import_ui15 = require("@elementor/ui");
@@ -578,15 +623,47 @@ var PromotionChip = React15.forwardRef(({ ...props }, ref) => {
578
623
  );
579
624
  });
580
625
 
581
- // src/components/popover/body.tsx
626
+ // src/components/promotions/promotion-alert.tsx
582
627
  var React16 = __toESM(require("react"));
628
+ var import_icons7 = require("@elementor/icons");
583
629
  var import_ui16 = require("@elementor/ui");
630
+ var import_i18n4 = require("@wordpress/i18n");
631
+ var PromotionAlert = ({ message, upgradeUrl }) => /* @__PURE__ */ React16.createElement(
632
+ import_ui16.Alert,
633
+ {
634
+ variant: "standard",
635
+ color: "promotion",
636
+ icon: false,
637
+ role: "dialog",
638
+ "aria-label": "promotion-alert",
639
+ size: "small",
640
+ sx: { m: 2, mt: 1, pt: 0.5, pb: 0.5 }
641
+ },
642
+ message,
643
+ /* @__PURE__ */ React16.createElement(
644
+ import_ui16.Button,
645
+ {
646
+ size: "tiny",
647
+ variant: "text",
648
+ color: "promotion",
649
+ target: "_blank",
650
+ href: upgradeUrl,
651
+ rel: "noopener noreferrer",
652
+ startIcon: /* @__PURE__ */ React16.createElement(import_icons7.CrownFilledIcon, { fontSize: "tiny" })
653
+ },
654
+ (0, import_i18n4.__)("Upgrade now", "elementor")
655
+ )
656
+ );
657
+
658
+ // src/components/popover/body.tsx
659
+ var React17 = __toESM(require("react"));
660
+ var import_ui17 = require("@elementor/ui");
584
661
  var SECTION_PADDING_INLINE = 32;
585
662
  var DEFAULT_POPOVER_HEIGHT = 348;
586
663
  var FALLBACK_POPOVER_WIDTH = 220;
587
664
  var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) => {
588
- return /* @__PURE__ */ React16.createElement(
589
- import_ui16.Box,
665
+ return /* @__PURE__ */ React17.createElement(
666
+ import_ui17.Box,
590
667
  {
591
668
  display: "flex",
592
669
  flexDirection: "column",
@@ -603,8 +680,8 @@ var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) =>
603
680
  };
604
681
 
605
682
  // src/components/popover/header.tsx
606
- var React17 = __toESM(require("react"));
607
- var import_ui17 = require("@elementor/ui");
683
+ var React18 = __toESM(require("react"));
684
+ var import_ui18 = require("@elementor/ui");
608
685
  var SIZE2 = "tiny";
609
686
  var PopoverHeader = ({ title, onClose, icon, actions }) => {
610
687
  const paddingAndSizing = {
@@ -613,52 +690,14 @@ var PopoverHeader = ({ title, onClose, icon, actions }) => {
613
690
  py: 1.5,
614
691
  maxHeight: 36
615
692
  };
616
- return /* @__PURE__ */ React17.createElement(import_ui17.Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React17.createElement(import_ui17.Typography, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React17.createElement(import_ui17.Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React17.createElement(import_ui17.CloseButton, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
693
+ return /* @__PURE__ */ React18.createElement(import_ui18.Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React18.createElement(import_ui18.Typography, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React18.createElement(import_ui18.Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React18.createElement(import_ui18.CloseButton, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
617
694
  };
618
695
 
619
696
  // src/components/popover/menu-list.tsx
620
- var React18 = __toESM(require("react"));
697
+ var React19 = __toESM(require("react"));
621
698
  var import_react13 = require("react");
622
- var import_ui18 = require("@elementor/ui");
699
+ var import_ui19 = require("@elementor/ui");
623
700
  var import_react_virtual = require("@tanstack/react-virtual");
624
-
625
- // src/hooks/use-scroll-to-selected.ts
626
- var import_react11 = require("react");
627
- var useScrollToSelected = ({
628
- selectedValue,
629
- items,
630
- virtualizer
631
- }) => {
632
- (0, import_react11.useEffect)(() => {
633
- if (!selectedValue || items.length === 0) {
634
- return;
635
- }
636
- const selectedIndex = items.findIndex((item) => item.value === selectedValue);
637
- if (selectedIndex !== -1) {
638
- virtualizer.scrollToIndex(selectedIndex, { align: "center" });
639
- }
640
- }, [selectedValue, items, virtualizer]);
641
- };
642
-
643
- // src/hooks/use-scroll-top.ts
644
- var import_react12 = require("react");
645
- var useScrollTop = ({ containerRef }) => {
646
- const [scrollTop, setScrollTop] = (0, import_react12.useState)(0);
647
- (0, import_react12.useEffect)(() => {
648
- const container = containerRef.current;
649
- if (!container) {
650
- return;
651
- }
652
- const handleScroll = () => {
653
- setScrollTop(container.scrollTop);
654
- };
655
- container.addEventListener("scroll", handleScroll);
656
- return () => container.removeEventListener("scroll", handleScroll);
657
- }, [containerRef]);
658
- return scrollTop;
659
- };
660
-
661
- // src/components/popover/menu-list.tsx
662
701
  var ITEM_HEIGHT = 32;
663
702
  var LIST_ITEMS_BUFFER = 6;
664
703
  var MENU_LIST_PADDING_TOP = 8;
@@ -686,7 +725,7 @@ var PopoverMenuList = ({
686
725
  }) => {
687
726
  const containerRef = (0, import_react13.useRef)(null);
688
727
  const scrollTop = useScrollTop({ containerRef });
689
- const theme = (0, import_ui18.useTheme)();
728
+ const theme = (0, import_ui19.useTheme)();
690
729
  const MenuListComponent = CustomMenuList || StyledMenuList;
691
730
  const stickyIndices = (0, import_react13.useMemo)(
692
731
  () => items.reduce((categoryIndices, item, index) => {
@@ -727,7 +766,7 @@ var PopoverMenuList = ({
727
766
  }, [items]);
728
767
  useScrollToSelected({ selectedValue, items, virtualizer });
729
768
  const virtualItems = virtualizer.getVirtualItems();
730
- return /* @__PURE__ */ React18.createElement(import_ui18.Box, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React18.createElement(
769
+ return /* @__PURE__ */ React19.createElement(import_ui19.Box, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React19.createElement(
731
770
  MenuListComponent,
732
771
  {
733
772
  role: "listbox",
@@ -745,8 +784,8 @@ var PopoverMenuList = ({
745
784
  }
746
785
  if (item.type === "category") {
747
786
  const shouldStick = virtualRow.start + MENU_LIST_PADDING_TOP <= scrollTop;
748
- return /* @__PURE__ */ React18.createElement(
749
- import_ui18.MenuSubheader,
787
+ return /* @__PURE__ */ React19.createElement(
788
+ import_ui19.MenuSubheader,
750
789
  {
751
790
  key: virtualRow.key,
752
791
  style: shouldStick ? {} : menuSubHeaderAbsoluteStyling(virtualRow.start),
@@ -756,8 +795,8 @@ var PopoverMenuList = ({
756
795
  );
757
796
  }
758
797
  const isDisabled = item.disabled;
759
- return /* @__PURE__ */ React18.createElement(
760
- import_ui18.ListItem,
798
+ return /* @__PURE__ */ React19.createElement(
799
+ import_ui19.ListItem,
761
800
  {
762
801
  key: virtualRow.key,
763
802
  role: "option",
@@ -796,7 +835,7 @@ var PopoverMenuList = ({
796
835
  })
797
836
  ));
798
837
  };
799
- var StyledMenuList = (0, import_ui18.styled)(import_ui18.MenuList)(({ theme }) => ({
838
+ var StyledMenuList = (0, import_ui19.styled)(import_ui19.MenuList)(({ theme }) => ({
800
839
  "& > li": {
801
840
  height: ITEM_HEIGHT,
802
841
  width: "100%",
@@ -826,14 +865,14 @@ var StyledMenuList = (0, import_ui18.styled)(import_ui18.MenuList)(({ theme }) =
826
865
  }));
827
866
 
828
867
  // src/components/save-changes-dialog.tsx
829
- var React19 = __toESM(require("react"));
868
+ var React20 = __toESM(require("react"));
830
869
  var import_react14 = require("react");
831
- var import_icons7 = require("@elementor/icons");
832
- var import_ui19 = require("@elementor/ui");
870
+ var import_icons8 = require("@elementor/icons");
871
+ var import_ui20 = require("@elementor/ui");
833
872
  var TITLE_ID = "save-changes-dialog";
834
- var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React19.createElement(import_ui19.Dialog, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
835
- var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React19.createElement(
836
- import_ui19.DialogTitle,
873
+ var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React20.createElement(import_ui20.Dialog, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
874
+ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React20.createElement(
875
+ import_ui20.DialogTitle,
837
876
  {
838
877
  id: TITLE_ID,
839
878
  display: "flex",
@@ -841,11 +880,11 @@ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React19.
841
880
  gap: 1,
842
881
  sx: { lineHeight: 1, justifyContent: "space-between" }
843
882
  },
844
- /* @__PURE__ */ React19.createElement(import_ui19.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React19.createElement(import_icons7.AlertTriangleFilledIcon, { color: "secondary" }), children),
845
- onClose && /* @__PURE__ */ React19.createElement(import_ui19.IconButton, { onClick: onClose, size: "small" }, /* @__PURE__ */ React19.createElement(import_icons7.XIcon, null))
883
+ /* @__PURE__ */ React20.createElement(import_ui20.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React20.createElement(import_icons8.AlertTriangleFilledIcon, { color: "secondary" }), children),
884
+ onClose && /* @__PURE__ */ React20.createElement(import_ui20.IconButton, { onClick: onClose, size: "small" }, /* @__PURE__ */ React20.createElement(import_icons8.XIcon, null))
846
885
  );
847
- var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React19.createElement(import_ui19.DialogContent, null, children);
848
- var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React19.createElement(import_ui19.DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
886
+ var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React20.createElement(import_ui20.DialogContent, null, children);
887
+ var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React20.createElement(import_ui20.DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
849
888
  var SaveChangesDialogActions = ({ actions }) => {
850
889
  const [isConfirming, setIsConfirming] = (0, import_react14.useState)(false);
851
890
  const { cancel, confirm, discard } = actions;
@@ -854,7 +893,7 @@ var SaveChangesDialogActions = ({ actions }) => {
854
893
  await confirm.action();
855
894
  setIsConfirming(false);
856
895
  };
857
- return /* @__PURE__ */ React19.createElement(import_ui19.DialogActions, null, cancel && /* @__PURE__ */ React19.createElement(import_ui19.Button, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React19.createElement(import_ui19.Button, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React19.createElement(import_ui19.Button, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
896
+ return /* @__PURE__ */ React20.createElement(import_ui20.DialogActions, null, cancel && /* @__PURE__ */ React20.createElement(import_ui20.Button, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React20.createElement(import_ui20.Button, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React20.createElement(import_ui20.Button, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
858
897
  };
859
898
  SaveChangesDialog.Title = SaveChangesDialogTitle;
860
899
  SaveChangesDialog.Content = SaveChangesDialogContent;
@@ -868,21 +907,21 @@ var useDialog = () => {
868
907
  };
869
908
 
870
909
  // src/components/confirmation-dialog.tsx
871
- var React20 = __toESM(require("react"));
872
- var import_icons8 = require("@elementor/icons");
873
- var import_ui20 = require("@elementor/ui");
874
- var import_i18n4 = require("@wordpress/i18n");
910
+ var React21 = __toESM(require("react"));
911
+ var import_icons9 = require("@elementor/icons");
912
+ var import_ui21 = require("@elementor/ui");
913
+ var import_i18n5 = require("@wordpress/i18n");
875
914
  var TITLE_ID2 = "confirmation-dialog";
876
- var ConfirmationDialog = ({ open, onClose, children }) => /* @__PURE__ */ React20.createElement(import_ui20.Dialog, { open, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "xs" }, children);
877
- var ConfirmationDialogTitle = ({ children }) => /* @__PURE__ */ React20.createElement(import_ui20.DialogTitle, { id: TITLE_ID2, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React20.createElement(import_icons8.AlertOctagonFilledIcon, { color: "error" }), children);
878
- var ConfirmationDialogContent = ({ children }) => /* @__PURE__ */ React20.createElement(import_ui20.DialogContent, null, children);
879
- var ConfirmationDialogContentText = (props) => /* @__PURE__ */ React20.createElement(import_ui20.DialogContentText, { variant: "body2", color: "textPrimary", ...props });
915
+ var ConfirmationDialog = ({ open, onClose, children }) => /* @__PURE__ */ React21.createElement(import_ui21.Dialog, { open, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "xs" }, children);
916
+ var ConfirmationDialogTitle = ({ children }) => /* @__PURE__ */ React21.createElement(import_ui21.DialogTitle, { id: TITLE_ID2, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React21.createElement(import_icons9.AlertOctagonFilledIcon, { color: "error" }), children);
917
+ var ConfirmationDialogContent = ({ children }) => /* @__PURE__ */ React21.createElement(import_ui21.DialogContent, null, children);
918
+ var ConfirmationDialogContentText = (props) => /* @__PURE__ */ React21.createElement(import_ui21.DialogContentText, { variant: "body2", color: "textPrimary", ...props });
880
919
  var ConfirmationDialogActions = ({
881
920
  onClose,
882
921
  onConfirm,
883
922
  cancelLabel,
884
923
  confirmLabel
885
- }) => /* @__PURE__ */ React20.createElement(import_ui20.DialogActions, null, /* @__PURE__ */ React20.createElement(import_ui20.Button, { color: "secondary", onClick: onClose }, cancelLabel ?? (0, import_i18n4.__)("Not now", "elementor")), /* @__PURE__ */ React20.createElement(import_ui20.Button, { autoFocus: true, variant: "contained", color: "error", onClick: onConfirm }, confirmLabel ?? (0, import_i18n4.__)("Delete", "elementor")));
924
+ }) => /* @__PURE__ */ React21.createElement(import_ui21.DialogActions, null, /* @__PURE__ */ React21.createElement(import_ui21.Button, { color: "secondary", onClick: onClose }, cancelLabel ?? (0, import_i18n5.__)("Not now", "elementor")), /* @__PURE__ */ React21.createElement(import_ui21.Button, { autoFocus: true, variant: "contained", color: "error", onClick: onConfirm }, confirmLabel ?? (0, import_i18n5.__)("Delete", "elementor")));
886
925
  ConfirmationDialog.Title = ConfirmationDialogTitle;
887
926
  ConfirmationDialog.Content = ConfirmationDialogContent;
888
927
  ConfirmationDialog.ContentText = ConfirmationDialogContentText;
@@ -1010,6 +1049,7 @@ var selectAll = (el) => {
1010
1049
  PopoverBody,
1011
1050
  PopoverHeader,
1012
1051
  PopoverMenuList,
1052
+ PromotionAlert,
1013
1053
  PromotionChip,
1014
1054
  PromotionInfotip,
1015
1055
  PromotionPopover,
@@ -1020,6 +1060,7 @@ var selectAll = (el) => {
1020
1060
  WarningInfotip,
1021
1061
  closeDialog,
1022
1062
  openDialog,
1063
+ useCanvasClickHandler,
1023
1064
  useDialog,
1024
1065
  useEditable
1025
1066
  });
package/dist/index.mjs CHANGED
@@ -401,10 +401,8 @@ var CtaButton = ({ href, children, showIcon = true, ...props }) => /* @__PURE__
401
401
  children ?? __3("Upgrade Now", "elementor")
402
402
  );
403
403
 
404
- // src/components/promotion-infotip.tsx
404
+ // src/components/promotions/promotion-infotip.tsx
405
405
  import * as React13 from "react";
406
- import { useEffect as useEffect4 } from "react";
407
- import { getCanvasIframeDocument } from "@elementor/editor-v1-adapters";
408
406
  import {
409
407
  Card as Card2,
410
408
  CardActions as CardActions2,
@@ -416,15 +414,60 @@ import {
416
414
  Infotip as Infotip3,
417
415
  Typography as Typography3
418
416
  } from "@elementor/ui";
419
- var PromotionInfotip = ({ children, open, onClose, ...cardProps }) => {
417
+
418
+ // src/hooks/use-scroll-to-selected.ts
419
+ import { useEffect as useEffect4 } from "react";
420
+ var useScrollToSelected = ({
421
+ selectedValue,
422
+ items,
423
+ virtualizer
424
+ }) => {
420
425
  useEffect4(() => {
421
- const canvasDocument = open ? getCanvasIframeDocument() : null;
426
+ if (!selectedValue || items.length === 0) {
427
+ return;
428
+ }
429
+ const selectedIndex = items.findIndex((item) => item.value === selectedValue);
430
+ if (selectedIndex !== -1) {
431
+ virtualizer.scrollToIndex(selectedIndex, { align: "center" });
432
+ }
433
+ }, [selectedValue, items, virtualizer]);
434
+ };
435
+
436
+ // src/hooks/use-scroll-top.ts
437
+ import { useEffect as useEffect5, useState as useState5 } from "react";
438
+ var useScrollTop = ({ containerRef }) => {
439
+ const [scrollTop, setScrollTop] = useState5(0);
440
+ useEffect5(() => {
441
+ const container = containerRef.current;
442
+ if (!container) {
443
+ return;
444
+ }
445
+ const handleScroll = () => {
446
+ setScrollTop(container.scrollTop);
447
+ };
448
+ container.addEventListener("scroll", handleScroll);
449
+ return () => container.removeEventListener("scroll", handleScroll);
450
+ }, [containerRef]);
451
+ return scrollTop;
452
+ };
453
+
454
+ // src/hooks/use-canvas-click-handler.tsx
455
+ import { useEffect as useEffect6 } from "react";
456
+ import { getCanvasIframeDocument } from "@elementor/editor-v1-adapters";
457
+ var useCanvasClickHandler = (isActive, onClickAway) => {
458
+ useEffect6(() => {
459
+ const canvasDocument = isActive ? getCanvasIframeDocument() : null;
422
460
  if (!canvasDocument) {
423
461
  return;
424
462
  }
425
- canvasDocument.addEventListener("mousedown", onClose);
426
- return () => canvasDocument.removeEventListener("mousedown", onClose);
427
- }, [open, onClose]);
463
+ canvasDocument.addEventListener("mousedown", onClickAway);
464
+ return () => canvasDocument.removeEventListener("mousedown", onClickAway);
465
+ }, [isActive, onClickAway]);
466
+ };
467
+
468
+ // src/components/promotions/promotion-infotip.tsx
469
+ var PromotionInfotip = ({ children, open, onClose, ...cardProps }) => {
470
+ useCanvasClickHandler(!!open, onClose);
428
471
  return /* @__PURE__ */ React13.createElement(Infotip3, { placement: "right", content: /* @__PURE__ */ React13.createElement(InfotipCard, { onClose, ...cardProps }), open }, children);
429
472
  };
430
473
  function InfotipCard({ title, content, assetUrl, ctaUrl, onClose }) {
@@ -446,7 +489,7 @@ function InfotipCard({ title, content, assetUrl, ctaUrl, onClose }) {
446
489
  );
447
490
  }
448
491
 
449
- // src/components/promotion-popover.tsx
492
+ // src/components/promotions/promotion-popover.tsx
450
493
  import * as React14 from "react";
451
494
  import { CrownFilledIcon as CrownFilledIcon2 } from "@elementor/icons";
452
495
  import {
@@ -525,7 +568,7 @@ function PopoverAlert({ title, content, ctaUrl, ctaText, onClose }) {
525
568
  );
526
569
  }
527
570
 
528
- // src/components/promotion-chip.tsx
571
+ // src/components/promotions/promotion-chip.tsx
529
572
  import * as React15 from "react";
530
573
  import { CrownFilledIcon as CrownFilledIcon3 } from "@elementor/icons";
531
574
  import { Chip } from "@elementor/ui";
@@ -551,14 +594,46 @@ var PromotionChip = React15.forwardRef(({ ...props }, ref) => {
551
594
  );
552
595
  });
553
596
 
554
- // src/components/popover/body.tsx
597
+ // src/components/promotions/promotion-alert.tsx
555
598
  import * as React16 from "react";
599
+ import { CrownFilledIcon as CrownFilledIcon4 } from "@elementor/icons";
600
+ import { Alert as Alert4, Button as Button4 } from "@elementor/ui";
601
+ import { __ as __4 } from "@wordpress/i18n";
602
+ var PromotionAlert = ({ message, upgradeUrl }) => /* @__PURE__ */ React16.createElement(
603
+ Alert4,
604
+ {
605
+ variant: "standard",
606
+ color: "promotion",
607
+ icon: false,
608
+ role: "dialog",
609
+ "aria-label": "promotion-alert",
610
+ size: "small",
611
+ sx: { m: 2, mt: 1, pt: 0.5, pb: 0.5 }
612
+ },
613
+ message,
614
+ /* @__PURE__ */ React16.createElement(
615
+ Button4,
616
+ {
617
+ size: "tiny",
618
+ variant: "text",
619
+ color: "promotion",
620
+ target: "_blank",
621
+ href: upgradeUrl,
622
+ rel: "noopener noreferrer",
623
+ startIcon: /* @__PURE__ */ React16.createElement(CrownFilledIcon4, { fontSize: "tiny" })
624
+ },
625
+ __4("Upgrade now", "elementor")
626
+ )
627
+ );
628
+
629
+ // src/components/popover/body.tsx
630
+ import * as React17 from "react";
556
631
  import { Box as Box6 } from "@elementor/ui";
557
632
  var SECTION_PADDING_INLINE = 32;
558
633
  var DEFAULT_POPOVER_HEIGHT = 348;
559
634
  var FALLBACK_POPOVER_WIDTH = 220;
560
635
  var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) => {
561
- return /* @__PURE__ */ React16.createElement(
636
+ return /* @__PURE__ */ React17.createElement(
562
637
  Box6,
563
638
  {
564
639
  display: "flex",
@@ -576,7 +651,7 @@ var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) =>
576
651
  };
577
652
 
578
653
  // src/components/popover/header.tsx
579
- import * as React17 from "react";
654
+ import * as React18 from "react";
580
655
  import { CloseButton as CloseButton2, Stack, Typography as Typography5 } from "@elementor/ui";
581
656
  var SIZE2 = "tiny";
582
657
  var PopoverHeader = ({ title, onClose, icon, actions }) => {
@@ -586,52 +661,14 @@ var PopoverHeader = ({ title, onClose, icon, actions }) => {
586
661
  py: 1.5,
587
662
  maxHeight: 36
588
663
  };
589
- return /* @__PURE__ */ React17.createElement(Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React17.createElement(Typography5, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React17.createElement(Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React17.createElement(CloseButton2, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
664
+ return /* @__PURE__ */ React18.createElement(Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React18.createElement(Typography5, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React18.createElement(Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React18.createElement(CloseButton2, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
590
665
  };
591
666
 
592
667
  // src/components/popover/menu-list.tsx
593
- import * as React18 from "react";
668
+ import * as React19 from "react";
594
669
  import { useEffect as useEffect7, useMemo, useRef as useRef3 } from "react";
595
670
  import { Box as Box7, ListItem, MenuList, MenuSubheader, styled as styled3, useTheme } from "@elementor/ui";
596
671
  import { useVirtualizer } from "@tanstack/react-virtual";
597
-
598
- // src/hooks/use-scroll-to-selected.ts
599
- import { useEffect as useEffect5 } from "react";
600
- var useScrollToSelected = ({
601
- selectedValue,
602
- items,
603
- virtualizer
604
- }) => {
605
- useEffect5(() => {
606
- if (!selectedValue || items.length === 0) {
607
- return;
608
- }
609
- const selectedIndex = items.findIndex((item) => item.value === selectedValue);
610
- if (selectedIndex !== -1) {
611
- virtualizer.scrollToIndex(selectedIndex, { align: "center" });
612
- }
613
- }, [selectedValue, items, virtualizer]);
614
- };
615
-
616
- // src/hooks/use-scroll-top.ts
617
- import { useEffect as useEffect6, useState as useState5 } from "react";
618
- var useScrollTop = ({ containerRef }) => {
619
- const [scrollTop, setScrollTop] = useState5(0);
620
- useEffect6(() => {
621
- const container = containerRef.current;
622
- if (!container) {
623
- return;
624
- }
625
- const handleScroll = () => {
626
- setScrollTop(container.scrollTop);
627
- };
628
- container.addEventListener("scroll", handleScroll);
629
- return () => container.removeEventListener("scroll", handleScroll);
630
- }, [containerRef]);
631
- return scrollTop;
632
- };
633
-
634
- // src/components/popover/menu-list.tsx
635
672
  var ITEM_HEIGHT = 32;
636
673
  var LIST_ITEMS_BUFFER = 6;
637
674
  var MENU_LIST_PADDING_TOP = 8;
@@ -700,7 +737,7 @@ var PopoverMenuList = ({
700
737
  }, [items]);
701
738
  useScrollToSelected({ selectedValue, items, virtualizer });
702
739
  const virtualItems = virtualizer.getVirtualItems();
703
- return /* @__PURE__ */ React18.createElement(Box7, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React18.createElement(
740
+ return /* @__PURE__ */ React19.createElement(Box7, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React19.createElement(
704
741
  MenuListComponent,
705
742
  {
706
743
  role: "listbox",
@@ -718,7 +755,7 @@ var PopoverMenuList = ({
718
755
  }
719
756
  if (item.type === "category") {
720
757
  const shouldStick = virtualRow.start + MENU_LIST_PADDING_TOP <= scrollTop;
721
- return /* @__PURE__ */ React18.createElement(
758
+ return /* @__PURE__ */ React19.createElement(
722
759
  MenuSubheader,
723
760
  {
724
761
  key: virtualRow.key,
@@ -729,7 +766,7 @@ var PopoverMenuList = ({
729
766
  );
730
767
  }
731
768
  const isDisabled = item.disabled;
732
- return /* @__PURE__ */ React18.createElement(
769
+ return /* @__PURE__ */ React19.createElement(
733
770
  ListItem,
734
771
  {
735
772
  key: virtualRow.key,
@@ -799,11 +836,11 @@ var StyledMenuList = styled3(MenuList)(({ theme }) => ({
799
836
  }));
800
837
 
801
838
  // src/components/save-changes-dialog.tsx
802
- import * as React19 from "react";
839
+ import * as React20 from "react";
803
840
  import { useState as useState6 } from "react";
804
841
  import { AlertTriangleFilledIcon, XIcon as XIcon2 } from "@elementor/icons";
805
842
  import {
806
- Button as Button4,
843
+ Button as Button5,
807
844
  Dialog as Dialog3,
808
845
  DialogActions as DialogActions2,
809
846
  DialogContent,
@@ -813,8 +850,8 @@ import {
813
850
  Stack as Stack2
814
851
  } from "@elementor/ui";
815
852
  var TITLE_ID = "save-changes-dialog";
816
- var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React19.createElement(Dialog3, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
817
- var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React19.createElement(
853
+ var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React20.createElement(Dialog3, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
854
+ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React20.createElement(
818
855
  DialogTitle2,
819
856
  {
820
857
  id: TITLE_ID,
@@ -823,11 +860,11 @@ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React19.
823
860
  gap: 1,
824
861
  sx: { lineHeight: 1, justifyContent: "space-between" }
825
862
  },
826
- /* @__PURE__ */ React19.createElement(Stack2, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React19.createElement(AlertTriangleFilledIcon, { color: "secondary" }), children),
827
- onClose && /* @__PURE__ */ React19.createElement(IconButton2, { onClick: onClose, size: "small" }, /* @__PURE__ */ React19.createElement(XIcon2, null))
863
+ /* @__PURE__ */ React20.createElement(Stack2, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React20.createElement(AlertTriangleFilledIcon, { color: "secondary" }), children),
864
+ onClose && /* @__PURE__ */ React20.createElement(IconButton2, { onClick: onClose, size: "small" }, /* @__PURE__ */ React20.createElement(XIcon2, null))
828
865
  );
829
- var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React19.createElement(DialogContent, null, children);
830
- var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React19.createElement(DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
866
+ var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React20.createElement(DialogContent, null, children);
867
+ var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React20.createElement(DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
831
868
  var SaveChangesDialogActions = ({ actions }) => {
832
869
  const [isConfirming, setIsConfirming] = useState6(false);
833
870
  const { cancel, confirm, discard } = actions;
@@ -836,7 +873,7 @@ var SaveChangesDialogActions = ({ actions }) => {
836
873
  await confirm.action();
837
874
  setIsConfirming(false);
838
875
  };
839
- return /* @__PURE__ */ React19.createElement(DialogActions2, null, cancel && /* @__PURE__ */ React19.createElement(Button4, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React19.createElement(Button4, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React19.createElement(Button4, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
876
+ return /* @__PURE__ */ React20.createElement(DialogActions2, null, cancel && /* @__PURE__ */ React20.createElement(Button5, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React20.createElement(Button5, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React20.createElement(Button5, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
840
877
  };
841
878
  SaveChangesDialog.Title = SaveChangesDialogTitle;
842
879
  SaveChangesDialog.Content = SaveChangesDialogContent;
@@ -850,28 +887,28 @@ var useDialog = () => {
850
887
  };
851
888
 
852
889
  // src/components/confirmation-dialog.tsx
853
- import * as React20 from "react";
890
+ import * as React21 from "react";
854
891
  import { AlertOctagonFilledIcon } from "@elementor/icons";
855
892
  import {
856
- Button as Button5,
893
+ Button as Button6,
857
894
  Dialog as Dialog4,
858
895
  DialogActions as DialogActions3,
859
896
  DialogContent as DialogContent2,
860
897
  DialogContentText as DialogContentText2,
861
898
  DialogTitle as DialogTitle3
862
899
  } from "@elementor/ui";
863
- import { __ as __4 } from "@wordpress/i18n";
900
+ import { __ as __5 } from "@wordpress/i18n";
864
901
  var TITLE_ID2 = "confirmation-dialog";
865
- var ConfirmationDialog = ({ open, onClose, children }) => /* @__PURE__ */ React20.createElement(Dialog4, { open, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "xs" }, children);
866
- var ConfirmationDialogTitle = ({ children }) => /* @__PURE__ */ React20.createElement(DialogTitle3, { id: TITLE_ID2, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React20.createElement(AlertOctagonFilledIcon, { color: "error" }), children);
867
- var ConfirmationDialogContent = ({ children }) => /* @__PURE__ */ React20.createElement(DialogContent2, null, children);
868
- var ConfirmationDialogContentText = (props) => /* @__PURE__ */ React20.createElement(DialogContentText2, { variant: "body2", color: "textPrimary", ...props });
902
+ var ConfirmationDialog = ({ open, onClose, children }) => /* @__PURE__ */ React21.createElement(Dialog4, { open, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "xs" }, children);
903
+ var ConfirmationDialogTitle = ({ children }) => /* @__PURE__ */ React21.createElement(DialogTitle3, { id: TITLE_ID2, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React21.createElement(AlertOctagonFilledIcon, { color: "error" }), children);
904
+ var ConfirmationDialogContent = ({ children }) => /* @__PURE__ */ React21.createElement(DialogContent2, null, children);
905
+ var ConfirmationDialogContentText = (props) => /* @__PURE__ */ React21.createElement(DialogContentText2, { variant: "body2", color: "textPrimary", ...props });
869
906
  var ConfirmationDialogActions = ({
870
907
  onClose,
871
908
  onConfirm,
872
909
  cancelLabel,
873
910
  confirmLabel
874
- }) => /* @__PURE__ */ React20.createElement(DialogActions3, null, /* @__PURE__ */ React20.createElement(Button5, { color: "secondary", onClick: onClose }, cancelLabel ?? __4("Not now", "elementor")), /* @__PURE__ */ React20.createElement(Button5, { autoFocus: true, variant: "contained", color: "error", onClick: onConfirm }, confirmLabel ?? __4("Delete", "elementor")));
911
+ }) => /* @__PURE__ */ React21.createElement(DialogActions3, null, /* @__PURE__ */ React21.createElement(Button6, { color: "secondary", onClick: onClose }, cancelLabel ?? __5("Not now", "elementor")), /* @__PURE__ */ React21.createElement(Button6, { autoFocus: true, variant: "contained", color: "error", onClick: onConfirm }, confirmLabel ?? __5("Delete", "elementor")));
875
912
  ConfirmationDialog.Title = ConfirmationDialogTitle;
876
913
  ConfirmationDialog.Content = ConfirmationDialogContent;
877
914
  ConfirmationDialog.ContentText = ConfirmationDialogContentText;
@@ -998,6 +1035,7 @@ export {
998
1035
  PopoverBody,
999
1036
  PopoverHeader,
1000
1037
  PopoverMenuList,
1038
+ PromotionAlert,
1001
1039
  PromotionChip,
1002
1040
  PromotionInfotip,
1003
1041
  PromotionPopover,
@@ -1008,6 +1046,7 @@ export {
1008
1046
  WarningInfotip,
1009
1047
  closeDialog,
1010
1048
  openDialog,
1049
+ useCanvasClickHandler,
1011
1050
  useDialog,
1012
1051
  useEditable
1013
1052
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-ui",
3
3
  "description": "Elementor Editor UI",
4
- "version": "3.35.3",
4
+ "version": "3.35.5",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -37,7 +37,7 @@
37
37
  "react-dom": "^18.3.1"
38
38
  },
39
39
  "dependencies": {
40
- "@elementor/editor-v1-adapters": "3.35.3",
40
+ "@elementor/editor-v1-adapters": "3.35.5",
41
41
  "@elementor/icons": "^1.63.0",
42
42
  "@elementor/ui": "1.36.17",
43
43
  "@tanstack/react-virtual": "^3.13.3",
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+ import { CrownFilledIcon } from '@elementor/icons';
3
+ import { Alert, Button } from '@elementor/ui';
4
+ import { __ } from '@wordpress/i18n';
5
+
6
+ type PromotionAlertProps = {
7
+ message: string;
8
+ upgradeUrl: string;
9
+ };
10
+
11
+ export const PromotionAlert = ( { message, upgradeUrl }: PromotionAlertProps ) => (
12
+ <Alert
13
+ variant="standard"
14
+ color="promotion"
15
+ icon={ false }
16
+ role="dialog"
17
+ aria-label="promotion-alert"
18
+ size="small"
19
+ sx={ { m: 2, mt: 1, pt: 0.5, pb: 0.5 } }
20
+ >
21
+ { message }
22
+ <Button
23
+ size={ 'tiny' }
24
+ variant={ 'text' }
25
+ color={ 'promotion' }
26
+ target="_blank"
27
+ href={ upgradeUrl }
28
+ rel="noopener noreferrer"
29
+ startIcon={ <CrownFilledIcon fontSize="tiny" /> }
30
+ >
31
+ { __( 'Upgrade now', 'elementor' ) }
32
+ </Button>
33
+ </Alert>
34
+ );
@@ -1,6 +1,4 @@
1
1
  import * as React from 'react';
2
- import { useEffect } from 'react';
3
- import { getCanvasIframeDocument } from '@elementor/editor-v1-adapters';
4
2
  import {
5
3
  Card,
6
4
  CardActions,
@@ -13,7 +11,8 @@ import {
13
11
  Typography,
14
12
  } from '@elementor/ui';
15
13
 
16
- import { CtaButton } from './cta-button';
14
+ import { useCanvasClickHandler } from '../../hooks';
15
+ import { CtaButton } from '../cta-button';
17
16
 
18
17
  type InfotipCardProps = {
19
18
  title: string;
@@ -30,17 +29,7 @@ type PromotionInfotipProps = React.PropsWithChildren<
30
29
  >;
31
30
 
32
31
  export const PromotionInfotip = ( { children, open, onClose, ...cardProps }: PromotionInfotipProps ) => {
33
- useEffect( () => {
34
- const canvasDocument = open ? getCanvasIframeDocument() : null;
35
-
36
- if ( ! canvasDocument ) {
37
- return;
38
- }
39
-
40
- canvasDocument.addEventListener( 'mousedown', onClose );
41
-
42
- return () => canvasDocument.removeEventListener( 'mousedown', onClose );
43
- }, [ open, onClose ] );
32
+ useCanvasClickHandler( !! open, onClose );
44
33
 
45
34
  return (
46
35
  <Infotip placement="right" content={ <InfotipCard onClose={ onClose } { ...cardProps } /> } open={ open }>
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { type MouseEvent } from 'react';
2
3
  import { CrownFilledIcon } from '@elementor/icons';
3
4
  import {
4
5
  Alert,
@@ -16,7 +17,7 @@ type PromotionPopoverCardProps = {
16
17
  content: string;
17
18
  ctaUrl: string;
18
19
  ctaText?: string;
19
- onClose: () => void;
20
+ onClose: ( e: MouseEvent ) => void;
20
21
  };
21
22
 
22
23
  type PromotionPopoverProps = React.PropsWithChildren<
@@ -1,2 +1,3 @@
1
1
  export { useScrollToSelected } from './use-scroll-to-selected';
2
2
  export { useScrollTop } from './use-scroll-top';
3
+ export { useCanvasClickHandler } from './use-canvas-click-handler';
@@ -0,0 +1,16 @@
1
+ import { useEffect } from 'react';
2
+ import { getCanvasIframeDocument } from '@elementor/editor-v1-adapters';
3
+
4
+ export const useCanvasClickHandler = ( isActive: boolean, onClickAway: ( e: MouseEvent ) => void ) => {
5
+ useEffect( () => {
6
+ const canvasDocument = isActive ? getCanvasIframeDocument() : null;
7
+
8
+ if ( ! canvasDocument ) {
9
+ return;
10
+ }
11
+
12
+ canvasDocument.addEventListener( 'mousedown', onClickAway );
13
+
14
+ return () => canvasDocument.removeEventListener( 'mousedown', onClickAway );
15
+ }, [ isActive, onClickAway ] );
16
+ };
package/src/index.ts CHANGED
@@ -12,9 +12,10 @@ export { GlobalDialog, openDialog, closeDialog } from './components/global-dialo
12
12
  export { SearchField } from './components/search-field';
13
13
  export { Form } from './components/form';
14
14
  export { CtaButton } from './components/cta-button';
15
- export { PromotionInfotip } from './components/promotion-infotip';
16
- export { PromotionPopover } from './components/promotion-popover';
17
- export { PromotionChip } from './components/promotion-chip';
15
+ export { PromotionInfotip } from './components/promotions/promotion-infotip';
16
+ export { PromotionPopover } from './components/promotions/promotion-popover';
17
+ export { PromotionChip } from './components/promotions/promotion-chip';
18
+ export { PromotionAlert } from './components/promotions/promotion-alert';
18
19
 
19
20
  export * from './components/popover';
20
21
  export * from './components/save-changes-dialog';
@@ -22,3 +23,4 @@ export { ConfirmationDialog } from './components/confirmation-dialog';
22
23
 
23
24
  // hooks
24
25
  export { useEditable } from './hooks/use-editable';
26
+ export { useCanvasClickHandler } from './hooks/use-canvas-click-handler';