@elementor/editor-ui 3.35.0-404 → 3.35.0-405

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
@@ -93,8 +93,9 @@ declare const Form: ({ children, onSubmit }: Props) => React$1.JSX.Element;
93
93
 
94
94
  type CtaButtonProps = {
95
95
  href: string;
96
+ showIcon?: boolean;
96
97
  } & Omit<ButtonProps, 'href' | 'target' | 'startIcon' | 'color' | 'variant'>;
97
- declare const CtaButton: ({ href, children, ...props }: CtaButtonProps) => React$1.JSX.Element;
98
+ declare const CtaButton: ({ href, children, showIcon, ...props }: CtaButtonProps) => React$1.JSX.Element;
98
99
 
99
100
  type InfotipCardProps = {
100
101
  title: string;
@@ -108,6 +109,20 @@ type PromotionInfotipProps = React$1.PropsWithChildren<InfotipCardProps & {
108
109
  }>;
109
110
  declare const PromotionInfotip: ({ children, open, ...cardProps }: PromotionInfotipProps) => React$1.JSX.Element;
110
111
 
112
+ type PromotionPopoverCardProps = {
113
+ title: string;
114
+ content: string;
115
+ ctaUrl: string;
116
+ ctaText?: string;
117
+ onClose: () => void;
118
+ };
119
+ type PromotionPopoverProps = React$1.PropsWithChildren<PromotionPopoverCardProps & {
120
+ open: boolean;
121
+ placement?: InfotipProps['placement'];
122
+ slotProps?: InfotipProps['slotProps'];
123
+ }>;
124
+ declare const PromotionPopover: ({ children, open, placement, slotProps, ...cardProps }: PromotionPopoverProps) => React$1.JSX.Element;
125
+
111
126
  declare const PromotionChip: React$1.ForwardRefExoticComponent<{
112
127
  onClick: () => void;
113
128
  } & React$1.RefAttributes<HTMLDivElement>>;
@@ -208,4 +223,4 @@ declare const useEditable: ({ value, onSubmit, validation, onClick, onError }: U
208
223
  };
209
224
  };
210
225
 
211
- export { CollapseIcon, CtaButton, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, PromotionChip, PromotionInfotip, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
226
+ export { CollapseIcon, 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 };
package/dist/index.d.ts CHANGED
@@ -93,8 +93,9 @@ declare const Form: ({ children, onSubmit }: Props) => React$1.JSX.Element;
93
93
 
94
94
  type CtaButtonProps = {
95
95
  href: string;
96
+ showIcon?: boolean;
96
97
  } & Omit<ButtonProps, 'href' | 'target' | 'startIcon' | 'color' | 'variant'>;
97
- declare const CtaButton: ({ href, children, ...props }: CtaButtonProps) => React$1.JSX.Element;
98
+ declare const CtaButton: ({ href, children, showIcon, ...props }: CtaButtonProps) => React$1.JSX.Element;
98
99
 
99
100
  type InfotipCardProps = {
100
101
  title: string;
@@ -108,6 +109,20 @@ type PromotionInfotipProps = React$1.PropsWithChildren<InfotipCardProps & {
108
109
  }>;
109
110
  declare const PromotionInfotip: ({ children, open, ...cardProps }: PromotionInfotipProps) => React$1.JSX.Element;
110
111
 
112
+ type PromotionPopoverCardProps = {
113
+ title: string;
114
+ content: string;
115
+ ctaUrl: string;
116
+ ctaText?: string;
117
+ onClose: () => void;
118
+ };
119
+ type PromotionPopoverProps = React$1.PropsWithChildren<PromotionPopoverCardProps & {
120
+ open: boolean;
121
+ placement?: InfotipProps['placement'];
122
+ slotProps?: InfotipProps['slotProps'];
123
+ }>;
124
+ declare const PromotionPopover: ({ children, open, placement, slotProps, ...cardProps }: PromotionPopoverProps) => React$1.JSX.Element;
125
+
111
126
  declare const PromotionChip: React$1.ForwardRefExoticComponent<{
112
127
  onClick: () => void;
113
128
  } & React$1.RefAttributes<HTMLDivElement>>;
@@ -208,4 +223,4 @@ declare const useEditable: ({ value, onSubmit, validation, onClick, onError }: U
208
223
  };
209
224
  };
210
225
 
211
- export { CollapseIcon, CtaButton, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, PromotionChip, PromotionInfotip, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
226
+ export { CollapseIcon, 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 };
package/dist/index.js CHANGED
@@ -47,6 +47,7 @@ __export(index_exports, {
47
47
  PopoverMenuList: () => PopoverMenuList,
48
48
  PromotionChip: () => PromotionChip,
49
49
  PromotionInfotip: () => PromotionInfotip,
50
+ PromotionPopover: () => PromotionPopover,
50
51
  SaveChangesDialog: () => SaveChangesDialog,
51
52
  SearchField: () => SearchField,
52
53
  StyledMenuList: () => StyledMenuList,
@@ -430,14 +431,14 @@ var React12 = __toESM(require("react"));
430
431
  var import_icons4 = require("@elementor/icons");
431
432
  var import_ui12 = require("@elementor/ui");
432
433
  var import_i18n3 = require("@wordpress/i18n");
433
- var CtaButton = ({ href, children, ...props }) => /* @__PURE__ */ React12.createElement(
434
+ var CtaButton = ({ href, children, showIcon = true, ...props }) => /* @__PURE__ */ React12.createElement(
434
435
  import_ui12.Button,
435
436
  {
436
437
  variant: "contained",
437
438
  color: "promotion",
438
439
  href,
439
440
  target: "_blank",
440
- startIcon: /* @__PURE__ */ React12.createElement(import_icons4.CrownFilledIcon, null),
441
+ startIcon: showIcon ? /* @__PURE__ */ React12.createElement(import_icons4.CrownFilledIcon, null) : void 0,
441
442
  ...props
442
443
  },
443
444
  children ?? (0, import_i18n3.__)("Upgrade Now", "elementor")
@@ -468,39 +469,115 @@ function InfotipCard({ title, content, assetUrl, ctaUrl, setOpen }) {
468
469
  );
469
470
  }
470
471
 
471
- // src/components/promotion-chip.tsx
472
+ // src/components/promotion-popover.tsx
472
473
  var React14 = __toESM(require("react"));
473
474
  var import_icons5 = require("@elementor/icons");
474
475
  var import_ui14 = require("@elementor/ui");
475
- var PromotionChip = React14.forwardRef(({ onClick }, ref) => {
476
+ var PromotionPopover = ({
477
+ children,
478
+ open,
479
+ placement = "right",
480
+ slotProps,
481
+ ...cardProps
482
+ }) => {
483
+ const defaultSlotProps = {
484
+ popper: {
485
+ modifiers: [
486
+ {
487
+ name: "offset",
488
+ options: {
489
+ offset: [0, 10]
490
+ }
491
+ }
492
+ ]
493
+ }
494
+ };
476
495
  return /* @__PURE__ */ React14.createElement(
477
- import_ui14.Chip,
496
+ import_ui14.Infotip,
478
497
  {
479
- ref,
480
- size: "tiny",
481
- color: "promotion",
482
- variant: "standard",
483
- icon: /* @__PURE__ */ React14.createElement(import_icons5.CrownFilledIcon, null),
484
- sx: {
485
- ml: 1,
486
- "& .MuiChip-label": {
487
- display: "none"
488
- }
498
+ placement,
499
+ arrow: false,
500
+ content: /* @__PURE__ */ React14.createElement(PopoverAlert, { ...cardProps }),
501
+ open,
502
+ slotProps: slotProps || defaultSlotProps
503
+ },
504
+ children
505
+ );
506
+ };
507
+ function PopoverAlert({ title, content, ctaUrl, ctaText, onClose }) {
508
+ return /* @__PURE__ */ React14.createElement(
509
+ import_ui14.ClickAwayListener,
510
+ {
511
+ disableReactTree: true,
512
+ mouseEvent: "onMouseDown",
513
+ touchEvent: "onTouchStart",
514
+ onClickAway: onClose
515
+ },
516
+ /* @__PURE__ */ React14.createElement(
517
+ import_ui14.Alert,
518
+ {
519
+ variant: "standard",
520
+ color: "promotion",
521
+ icon: /* @__PURE__ */ React14.createElement(import_icons5.CrownFilledIcon, { fontSize: "tiny" }),
522
+ onClose,
523
+ role: "dialog",
524
+ "aria-label": "promotion-popover-title",
525
+ onKeyDown: (e) => e.key === "Escape" && onClose(),
526
+ action: /* @__PURE__ */ React14.createElement(
527
+ import_ui14.AlertAction,
528
+ {
529
+ variant: "contained",
530
+ color: "promotion",
531
+ href: ctaUrl,
532
+ target: "_blank",
533
+ rel: "noopener noreferrer"
534
+ },
535
+ ctaText
536
+ ),
537
+ sx: { maxWidth: 296 }
489
538
  },
490
- onClick
491
- }
539
+ /* @__PURE__ */ React14.createElement(import_ui14.Box, { sx: { gap: 0.5, display: "flex", flexDirection: "column" } }, /* @__PURE__ */ React14.createElement(import_ui14.AlertTitle, null, title), /* @__PURE__ */ React14.createElement(import_ui14.Typography, { variant: "body2" }, content))
540
+ )
492
541
  );
493
- });
542
+ }
494
543
 
495
- // src/components/popover/body.tsx
544
+ // src/components/promotion-chip.tsx
496
545
  var React15 = __toESM(require("react"));
546
+ var import_icons6 = require("@elementor/icons");
497
547
  var import_ui15 = require("@elementor/ui");
548
+ var PromotionChip = React15.forwardRef(
549
+ ({ onClick, ...props }, ref) => {
550
+ return /* @__PURE__ */ React15.createElement(
551
+ import_ui15.Chip,
552
+ {
553
+ ref,
554
+ size: "tiny",
555
+ color: "promotion",
556
+ variant: "standard",
557
+ icon: /* @__PURE__ */ React15.createElement(import_icons6.CrownFilledIcon, null),
558
+ sx: {
559
+ ml: 1,
560
+ width: "20px",
561
+ "& .MuiChip-label": {
562
+ display: "none"
563
+ }
564
+ },
565
+ onClick,
566
+ ...props
567
+ }
568
+ );
569
+ }
570
+ );
571
+
572
+ // src/components/popover/body.tsx
573
+ var React16 = __toESM(require("react"));
574
+ var import_ui16 = require("@elementor/ui");
498
575
  var SECTION_PADDING_INLINE = 32;
499
576
  var DEFAULT_POPOVER_HEIGHT = 348;
500
577
  var FALLBACK_POPOVER_WIDTH = 220;
501
578
  var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) => {
502
- return /* @__PURE__ */ React15.createElement(
503
- import_ui15.Box,
579
+ return /* @__PURE__ */ React16.createElement(
580
+ import_ui16.Box,
504
581
  {
505
582
  display: "flex",
506
583
  flexDirection: "column",
@@ -517,8 +594,8 @@ var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) =>
517
594
  };
518
595
 
519
596
  // src/components/popover/header.tsx
520
- var React16 = __toESM(require("react"));
521
- var import_ui16 = require("@elementor/ui");
597
+ var React17 = __toESM(require("react"));
598
+ var import_ui17 = require("@elementor/ui");
522
599
  var SIZE2 = "tiny";
523
600
  var PopoverHeader = ({ title, onClose, icon, actions }) => {
524
601
  const paddingAndSizing = {
@@ -527,13 +604,13 @@ var PopoverHeader = ({ title, onClose, icon, actions }) => {
527
604
  py: 1.5,
528
605
  maxHeight: 36
529
606
  };
530
- return /* @__PURE__ */ React16.createElement(import_ui16.Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React16.createElement(import_ui16.Typography, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React16.createElement(import_ui16.Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React16.createElement(import_ui16.CloseButton, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
607
+ 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 })));
531
608
  };
532
609
 
533
610
  // src/components/popover/menu-list.tsx
534
- var React17 = __toESM(require("react"));
611
+ var React18 = __toESM(require("react"));
535
612
  var import_react12 = require("react");
536
- var import_ui17 = require("@elementor/ui");
613
+ var import_ui18 = require("@elementor/ui");
537
614
  var import_react_virtual = require("@tanstack/react-virtual");
538
615
 
539
616
  // src/hooks/use-scroll-to-selected.ts
@@ -632,7 +709,7 @@ var PopoverMenuList = ({
632
709
  });
633
710
  useScrollToSelected({ selectedValue, items, virtualizer });
634
711
  const virtualItems = virtualizer.getVirtualItems();
635
- return /* @__PURE__ */ React17.createElement(import_ui17.Box, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React17.createElement(
712
+ return /* @__PURE__ */ React18.createElement(import_ui18.Box, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React18.createElement(
636
713
  MenuListComponent,
637
714
  {
638
715
  role: "listbox",
@@ -650,8 +727,8 @@ var PopoverMenuList = ({
650
727
  }
651
728
  if (item.type === "category") {
652
729
  const shouldStick = virtualRow.start + MENU_LIST_PADDING_TOP <= scrollTop;
653
- return /* @__PURE__ */ React17.createElement(
654
- import_ui17.MenuSubheader,
730
+ return /* @__PURE__ */ React18.createElement(
731
+ import_ui18.MenuSubheader,
655
732
  {
656
733
  key: virtualRow.key,
657
734
  style: shouldStick ? {} : menuSubHeaderAbsoluteStyling(virtualRow.start),
@@ -661,8 +738,8 @@ var PopoverMenuList = ({
661
738
  );
662
739
  }
663
740
  const isDisabled = item.disabled;
664
- return /* @__PURE__ */ React17.createElement(
665
- import_ui17.ListItem,
741
+ return /* @__PURE__ */ React18.createElement(
742
+ import_ui18.ListItem,
666
743
  {
667
744
  key: virtualRow.key,
668
745
  role: "option",
@@ -700,7 +777,7 @@ var PopoverMenuList = ({
700
777
  })
701
778
  ));
702
779
  };
703
- var StyledMenuList = (0, import_ui17.styled)(import_ui17.MenuList)(({ theme }) => ({
780
+ var StyledMenuList = (0, import_ui18.styled)(import_ui18.MenuList)(({ theme }) => ({
704
781
  "& > li": {
705
782
  height: ITEM_HEIGHT,
706
783
  width: "100%",
@@ -731,14 +808,14 @@ var StyledMenuList = (0, import_ui17.styled)(import_ui17.MenuList)(({ theme }) =
731
808
  }));
732
809
 
733
810
  // src/components/save-changes-dialog.tsx
734
- var React18 = __toESM(require("react"));
811
+ var React19 = __toESM(require("react"));
735
812
  var import_react13 = require("react");
736
- var import_icons6 = require("@elementor/icons");
737
- var import_ui18 = require("@elementor/ui");
813
+ var import_icons7 = require("@elementor/icons");
814
+ var import_ui19 = require("@elementor/ui");
738
815
  var TITLE_ID = "save-changes-dialog";
739
- var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React18.createElement(import_ui18.Dialog, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
740
- var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React18.createElement(
741
- import_ui18.DialogTitle,
816
+ var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React19.createElement(import_ui19.Dialog, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
817
+ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React19.createElement(
818
+ import_ui19.DialogTitle,
742
819
  {
743
820
  id: TITLE_ID,
744
821
  display: "flex",
@@ -746,11 +823,11 @@ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React18.
746
823
  gap: 1,
747
824
  sx: { lineHeight: 1, justifyContent: "space-between" }
748
825
  },
749
- /* @__PURE__ */ React18.createElement(import_ui18.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React18.createElement(import_icons6.AlertTriangleFilledIcon, { color: "secondary" }), children),
750
- onClose && /* @__PURE__ */ React18.createElement(import_ui18.IconButton, { onClick: onClose, size: "small" }, /* @__PURE__ */ React18.createElement(import_icons6.XIcon, null))
826
+ /* @__PURE__ */ React19.createElement(import_ui19.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React19.createElement(import_icons7.AlertTriangleFilledIcon, { color: "secondary" }), children),
827
+ onClose && /* @__PURE__ */ React19.createElement(import_ui19.IconButton, { onClick: onClose, size: "small" }, /* @__PURE__ */ React19.createElement(import_icons7.XIcon, null))
751
828
  );
752
- var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React18.createElement(import_ui18.DialogContent, null, children);
753
- var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React18.createElement(import_ui18.DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
829
+ var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React19.createElement(import_ui19.DialogContent, null, children);
830
+ var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React19.createElement(import_ui19.DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
754
831
  var SaveChangesDialogActions = ({ actions }) => {
755
832
  const [isConfirming, setIsConfirming] = (0, import_react13.useState)(false);
756
833
  const { cancel, confirm, discard } = actions;
@@ -759,7 +836,7 @@ var SaveChangesDialogActions = ({ actions }) => {
759
836
  await confirm.action();
760
837
  setIsConfirming(false);
761
838
  };
762
- return /* @__PURE__ */ React18.createElement(import_ui18.DialogActions, null, cancel && /* @__PURE__ */ React18.createElement(import_ui18.Button, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React18.createElement(import_ui18.Button, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React18.createElement(import_ui18.Button, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
839
+ 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));
763
840
  };
764
841
  SaveChangesDialog.Title = SaveChangesDialogTitle;
765
842
  SaveChangesDialog.Content = SaveChangesDialogContent;
@@ -895,6 +972,7 @@ var selectAll = (el) => {
895
972
  PopoverMenuList,
896
973
  PromotionChip,
897
974
  PromotionInfotip,
975
+ PromotionPopover,
898
976
  SaveChangesDialog,
899
977
  SearchField,
900
978
  StyledMenuList,
package/dist/index.mjs CHANGED
@@ -387,14 +387,14 @@ import * as React12 from "react";
387
387
  import { CrownFilledIcon } from "@elementor/icons";
388
388
  import { Button as Button3 } from "@elementor/ui";
389
389
  import { __ as __3 } from "@wordpress/i18n";
390
- var CtaButton = ({ href, children, ...props }) => /* @__PURE__ */ React12.createElement(
390
+ var CtaButton = ({ href, children, showIcon = true, ...props }) => /* @__PURE__ */ React12.createElement(
391
391
  Button3,
392
392
  {
393
393
  variant: "contained",
394
394
  color: "promotion",
395
395
  href,
396
396
  target: "_blank",
397
- startIcon: /* @__PURE__ */ React12.createElement(CrownFilledIcon, null),
397
+ startIcon: showIcon ? /* @__PURE__ */ React12.createElement(CrownFilledIcon, null) : void 0,
398
398
  ...props
399
399
  },
400
400
  children ?? __3("Upgrade Now", "elementor")
@@ -435,39 +435,123 @@ function InfotipCard({ title, content, assetUrl, ctaUrl, setOpen }) {
435
435
  );
436
436
  }
437
437
 
438
- // src/components/promotion-chip.tsx
438
+ // src/components/promotion-popover.tsx
439
439
  import * as React14 from "react";
440
440
  import { CrownFilledIcon as CrownFilledIcon2 } from "@elementor/icons";
441
- import { Chip } from "@elementor/ui";
442
- var PromotionChip = React14.forwardRef(({ onClick }, ref) => {
441
+ import {
442
+ Alert as Alert3,
443
+ AlertAction,
444
+ AlertTitle as AlertTitle2,
445
+ Box as Box5,
446
+ ClickAwayListener as ClickAwayListener2,
447
+ Infotip as Infotip4,
448
+ Typography as Typography4
449
+ } from "@elementor/ui";
450
+ var PromotionPopover = ({
451
+ children,
452
+ open,
453
+ placement = "right",
454
+ slotProps,
455
+ ...cardProps
456
+ }) => {
457
+ const defaultSlotProps = {
458
+ popper: {
459
+ modifiers: [
460
+ {
461
+ name: "offset",
462
+ options: {
463
+ offset: [0, 10]
464
+ }
465
+ }
466
+ ]
467
+ }
468
+ };
443
469
  return /* @__PURE__ */ React14.createElement(
444
- Chip,
470
+ Infotip4,
445
471
  {
446
- ref,
447
- size: "tiny",
448
- color: "promotion",
449
- variant: "standard",
450
- icon: /* @__PURE__ */ React14.createElement(CrownFilledIcon2, null),
451
- sx: {
452
- ml: 1,
453
- "& .MuiChip-label": {
454
- display: "none"
455
- }
472
+ placement,
473
+ arrow: false,
474
+ content: /* @__PURE__ */ React14.createElement(PopoverAlert, { ...cardProps }),
475
+ open,
476
+ slotProps: slotProps || defaultSlotProps
477
+ },
478
+ children
479
+ );
480
+ };
481
+ function PopoverAlert({ title, content, ctaUrl, ctaText, onClose }) {
482
+ return /* @__PURE__ */ React14.createElement(
483
+ ClickAwayListener2,
484
+ {
485
+ disableReactTree: true,
486
+ mouseEvent: "onMouseDown",
487
+ touchEvent: "onTouchStart",
488
+ onClickAway: onClose
489
+ },
490
+ /* @__PURE__ */ React14.createElement(
491
+ Alert3,
492
+ {
493
+ variant: "standard",
494
+ color: "promotion",
495
+ icon: /* @__PURE__ */ React14.createElement(CrownFilledIcon2, { fontSize: "tiny" }),
496
+ onClose,
497
+ role: "dialog",
498
+ "aria-label": "promotion-popover-title",
499
+ onKeyDown: (e) => e.key === "Escape" && onClose(),
500
+ action: /* @__PURE__ */ React14.createElement(
501
+ AlertAction,
502
+ {
503
+ variant: "contained",
504
+ color: "promotion",
505
+ href: ctaUrl,
506
+ target: "_blank",
507
+ rel: "noopener noreferrer"
508
+ },
509
+ ctaText
510
+ ),
511
+ sx: { maxWidth: 296 }
456
512
  },
457
- onClick
458
- }
513
+ /* @__PURE__ */ React14.createElement(Box5, { sx: { gap: 0.5, display: "flex", flexDirection: "column" } }, /* @__PURE__ */ React14.createElement(AlertTitle2, null, title), /* @__PURE__ */ React14.createElement(Typography4, { variant: "body2" }, content))
514
+ )
459
515
  );
460
- });
516
+ }
461
517
 
462
- // src/components/popover/body.tsx
518
+ // src/components/promotion-chip.tsx
463
519
  import * as React15 from "react";
464
- import { Box as Box5 } from "@elementor/ui";
520
+ import { CrownFilledIcon as CrownFilledIcon3 } from "@elementor/icons";
521
+ import { Chip } from "@elementor/ui";
522
+ var PromotionChip = React15.forwardRef(
523
+ ({ onClick, ...props }, ref) => {
524
+ return /* @__PURE__ */ React15.createElement(
525
+ Chip,
526
+ {
527
+ ref,
528
+ size: "tiny",
529
+ color: "promotion",
530
+ variant: "standard",
531
+ icon: /* @__PURE__ */ React15.createElement(CrownFilledIcon3, null),
532
+ sx: {
533
+ ml: 1,
534
+ width: "20px",
535
+ "& .MuiChip-label": {
536
+ display: "none"
537
+ }
538
+ },
539
+ onClick,
540
+ ...props
541
+ }
542
+ );
543
+ }
544
+ );
545
+
546
+ // src/components/popover/body.tsx
547
+ import * as React16 from "react";
548
+ import { Box as Box6 } from "@elementor/ui";
465
549
  var SECTION_PADDING_INLINE = 32;
466
550
  var DEFAULT_POPOVER_HEIGHT = 348;
467
551
  var FALLBACK_POPOVER_WIDTH = 220;
468
552
  var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) => {
469
- return /* @__PURE__ */ React15.createElement(
470
- Box5,
553
+ return /* @__PURE__ */ React16.createElement(
554
+ Box6,
471
555
  {
472
556
  display: "flex",
473
557
  flexDirection: "column",
@@ -484,8 +568,8 @@ var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) =>
484
568
  };
485
569
 
486
570
  // src/components/popover/header.tsx
487
- import * as React16 from "react";
488
- import { CloseButton as CloseButton2, Stack, Typography as Typography4 } from "@elementor/ui";
571
+ import * as React17 from "react";
572
+ import { CloseButton as CloseButton2, Stack, Typography as Typography5 } from "@elementor/ui";
489
573
  var SIZE2 = "tiny";
490
574
  var PopoverHeader = ({ title, onClose, icon, actions }) => {
491
575
  const paddingAndSizing = {
@@ -494,13 +578,13 @@ var PopoverHeader = ({ title, onClose, icon, actions }) => {
494
578
  py: 1.5,
495
579
  maxHeight: 36
496
580
  };
497
- return /* @__PURE__ */ React16.createElement(Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React16.createElement(Typography4, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React16.createElement(Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React16.createElement(CloseButton2, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
581
+ 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 })));
498
582
  };
499
583
 
500
584
  // src/components/popover/menu-list.tsx
501
- import * as React17 from "react";
585
+ import * as React18 from "react";
502
586
  import { useMemo, useRef as useRef3 } from "react";
503
- import { Box as Box6, ListItem, MenuList, MenuSubheader, styled as styled3 } from "@elementor/ui";
587
+ import { Box as Box7, ListItem, MenuList, MenuSubheader, styled as styled3 } from "@elementor/ui";
504
588
  import { useVirtualizer } from "@tanstack/react-virtual";
505
589
 
506
590
  // src/hooks/use-scroll-to-selected.ts
@@ -599,7 +683,7 @@ var PopoverMenuList = ({
599
683
  });
600
684
  useScrollToSelected({ selectedValue, items, virtualizer });
601
685
  const virtualItems = virtualizer.getVirtualItems();
602
- return /* @__PURE__ */ React17.createElement(Box6, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React17.createElement(
686
+ return /* @__PURE__ */ React18.createElement(Box7, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React18.createElement(
603
687
  MenuListComponent,
604
688
  {
605
689
  role: "listbox",
@@ -617,7 +701,7 @@ var PopoverMenuList = ({
617
701
  }
618
702
  if (item.type === "category") {
619
703
  const shouldStick = virtualRow.start + MENU_LIST_PADDING_TOP <= scrollTop;
620
- return /* @__PURE__ */ React17.createElement(
704
+ return /* @__PURE__ */ React18.createElement(
621
705
  MenuSubheader,
622
706
  {
623
707
  key: virtualRow.key,
@@ -628,7 +712,7 @@ var PopoverMenuList = ({
628
712
  );
629
713
  }
630
714
  const isDisabled = item.disabled;
631
- return /* @__PURE__ */ React17.createElement(
715
+ return /* @__PURE__ */ React18.createElement(
632
716
  ListItem,
633
717
  {
634
718
  key: virtualRow.key,
@@ -698,7 +782,7 @@ var StyledMenuList = styled3(MenuList)(({ theme }) => ({
698
782
  }));
699
783
 
700
784
  // src/components/save-changes-dialog.tsx
701
- import * as React18 from "react";
785
+ import * as React19 from "react";
702
786
  import { useState as useState6 } from "react";
703
787
  import { AlertTriangleFilledIcon, XIcon as XIcon2 } from "@elementor/icons";
704
788
  import {
@@ -712,8 +796,8 @@ import {
712
796
  Stack as Stack2
713
797
  } from "@elementor/ui";
714
798
  var TITLE_ID = "save-changes-dialog";
715
- var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React18.createElement(Dialog3, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
716
- var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React18.createElement(
799
+ var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React19.createElement(Dialog3, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
800
+ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React19.createElement(
717
801
  DialogTitle2,
718
802
  {
719
803
  id: TITLE_ID,
@@ -722,11 +806,11 @@ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React18.
722
806
  gap: 1,
723
807
  sx: { lineHeight: 1, justifyContent: "space-between" }
724
808
  },
725
- /* @__PURE__ */ React18.createElement(Stack2, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React18.createElement(AlertTriangleFilledIcon, { color: "secondary" }), children),
726
- onClose && /* @__PURE__ */ React18.createElement(IconButton2, { onClick: onClose, size: "small" }, /* @__PURE__ */ React18.createElement(XIcon2, null))
809
+ /* @__PURE__ */ React19.createElement(Stack2, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React19.createElement(AlertTriangleFilledIcon, { color: "secondary" }), children),
810
+ onClose && /* @__PURE__ */ React19.createElement(IconButton2, { onClick: onClose, size: "small" }, /* @__PURE__ */ React19.createElement(XIcon2, null))
727
811
  );
728
- var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React18.createElement(DialogContent, null, children);
729
- var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React18.createElement(DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
812
+ var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React19.createElement(DialogContent, null, children);
813
+ var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React19.createElement(DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
730
814
  var SaveChangesDialogActions = ({ actions }) => {
731
815
  const [isConfirming, setIsConfirming] = useState6(false);
732
816
  const { cancel, confirm, discard } = actions;
@@ -735,7 +819,7 @@ var SaveChangesDialogActions = ({ actions }) => {
735
819
  await confirm.action();
736
820
  setIsConfirming(false);
737
821
  };
738
- return /* @__PURE__ */ React18.createElement(DialogActions2, null, cancel && /* @__PURE__ */ React18.createElement(Button4, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React18.createElement(Button4, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React18.createElement(Button4, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
822
+ 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));
739
823
  };
740
824
  SaveChangesDialog.Title = SaveChangesDialogTitle;
741
825
  SaveChangesDialog.Content = SaveChangesDialogContent;
@@ -870,6 +954,7 @@ export {
870
954
  PopoverMenuList,
871
955
  PromotionChip,
872
956
  PromotionInfotip,
957
+ PromotionPopover,
873
958
  SaveChangesDialog,
874
959
  SearchField,
875
960
  StyledMenuList,
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.0-404",
4
+ "version": "3.35.0-405",
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.0-404",
40
+ "@elementor/editor-v1-adapters": "3.35.0-405",
41
41
  "@elementor/icons": "^1.63.0",
42
42
  "@elementor/ui": "1.36.17",
43
43
  "@tanstack/react-virtual": "^3.13.3",
@@ -5,15 +5,16 @@ import { __ } from '@wordpress/i18n';
5
5
 
6
6
  type CtaButtonProps = {
7
7
  href: string;
8
+ showIcon?: boolean;
8
9
  } & Omit< ButtonProps, 'href' | 'target' | 'startIcon' | 'color' | 'variant' >;
9
10
 
10
- export const CtaButton = ( { href, children, ...props }: CtaButtonProps ) => (
11
+ export const CtaButton = ( { href, children, showIcon = true, ...props }: CtaButtonProps ) => (
11
12
  <Button
12
13
  variant="contained"
13
14
  color="promotion"
14
15
  href={ href }
15
16
  target="_blank"
16
- startIcon={ <CrownFilledIcon /> }
17
+ startIcon={ showIcon ? <CrownFilledIcon /> : undefined }
17
18
  { ...props }
18
19
  >
19
20
  { children ?? __( 'Upgrade Now', 'elementor' ) }
@@ -2,21 +2,25 @@ import * as React from 'react';
2
2
  import { CrownFilledIcon } from '@elementor/icons';
3
3
  import { Chip } from '@elementor/ui';
4
4
 
5
- export const PromotionChip = React.forwardRef< HTMLDivElement, { onClick: () => void } >( ( { onClick }, ref ) => {
6
- return (
7
- <Chip
8
- ref={ ref }
9
- size="tiny"
10
- color="promotion"
11
- variant="standard"
12
- icon={ <CrownFilledIcon /> }
13
- sx={ {
14
- ml: 1,
15
- '& .MuiChip-label': {
16
- display: 'none',
17
- },
18
- } }
19
- onClick={ onClick }
20
- />
21
- );
22
- } );
5
+ export const PromotionChip = React.forwardRef< HTMLDivElement, { onClick: () => void } >(
6
+ ( { onClick, ...props }, ref ) => {
7
+ return (
8
+ <Chip
9
+ ref={ ref }
10
+ size="tiny"
11
+ color="promotion"
12
+ variant="standard"
13
+ icon={ <CrownFilledIcon /> }
14
+ sx={ {
15
+ ml: 1,
16
+ width: '20px',
17
+ '& .MuiChip-label': {
18
+ display: 'none',
19
+ },
20
+ } }
21
+ onClick={ onClick }
22
+ { ...props }
23
+ />
24
+ );
25
+ }
26
+ );
@@ -0,0 +1,100 @@
1
+ import * as React from 'react';
2
+ import type { KeyboardEvent } from 'react';
3
+ import { CrownFilledIcon } from '@elementor/icons';
4
+ import {
5
+ Alert,
6
+ AlertAction,
7
+ AlertTitle,
8
+ Box,
9
+ ClickAwayListener,
10
+ Infotip,
11
+ type InfotipProps,
12
+ Typography,
13
+ } from '@elementor/ui';
14
+
15
+ type PromotionPopoverCardProps = {
16
+ title: string;
17
+ content: string;
18
+ ctaUrl: string;
19
+ ctaText?: string;
20
+ onClose: () => void;
21
+ };
22
+
23
+ type PromotionPopoverProps = React.PropsWithChildren<
24
+ PromotionPopoverCardProps & {
25
+ open: boolean;
26
+ placement?: InfotipProps[ 'placement' ];
27
+ slotProps?: InfotipProps[ 'slotProps' ];
28
+ }
29
+ >;
30
+
31
+ export const PromotionPopover = ( {
32
+ children,
33
+ open,
34
+ placement = 'right',
35
+ slotProps,
36
+ ...cardProps
37
+ }: PromotionPopoverProps ) => {
38
+ const defaultSlotProps: InfotipProps[ 'slotProps' ] = {
39
+ popper: {
40
+ modifiers: [
41
+ {
42
+ name: 'offset',
43
+ options: {
44
+ offset: [ 0, 10 ],
45
+ },
46
+ },
47
+ ],
48
+ },
49
+ };
50
+
51
+ return (
52
+ <Infotip
53
+ placement={ placement }
54
+ arrow={ false }
55
+ content={ <PopoverAlert { ...cardProps } /> }
56
+ open={ open }
57
+ slotProps={ slotProps || defaultSlotProps }
58
+ >
59
+ { children }
60
+ </Infotip>
61
+ );
62
+ };
63
+
64
+ function PopoverAlert( { title, content, ctaUrl, ctaText, onClose }: PromotionPopoverCardProps ) {
65
+ return (
66
+ <ClickAwayListener
67
+ disableReactTree={ true }
68
+ mouseEvent="onMouseDown"
69
+ touchEvent="onTouchStart"
70
+ onClickAway={ onClose }
71
+ >
72
+ <Alert
73
+ variant="standard"
74
+ color="promotion"
75
+ icon={ <CrownFilledIcon fontSize="tiny" /> }
76
+ onClose={ onClose }
77
+ role="dialog"
78
+ aria-label="promotion-popover-title"
79
+ onKeyDown={ ( e: KeyboardEvent ) => e.key === 'Escape' && onClose() }
80
+ action={
81
+ <AlertAction
82
+ variant="contained"
83
+ color="promotion"
84
+ href={ ctaUrl }
85
+ target="_blank"
86
+ rel="noopener noreferrer"
87
+ >
88
+ { ctaText }
89
+ </AlertAction>
90
+ }
91
+ sx={ { maxWidth: 296 } }
92
+ >
93
+ <Box sx={ { gap: 0.5, display: 'flex', flexDirection: 'column' } }>
94
+ <AlertTitle>{ title }</AlertTitle>
95
+ <Typography variant="body2">{ content }</Typography>
96
+ </Box>
97
+ </Alert>
98
+ </ClickAwayListener>
99
+ );
100
+ }
package/src/index.ts CHANGED
@@ -13,6 +13,7 @@ export { SearchField } from './components/search-field';
13
13
  export { Form } from './components/form';
14
14
  export { CtaButton } from './components/cta-button';
15
15
  export { PromotionInfotip } from './components/promotion-infotip';
16
+ export { PromotionPopover } from './components/promotion-popover';
16
17
  export { PromotionChip } from './components/promotion-chip';
17
18
 
18
19
  export * from './components/popover';