@elementor/editor-ui 3.35.0-375 → 3.35.0-377

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
@@ -7,6 +7,7 @@ import { MenuItemProps, MenuItemTextProps, TypographyProps, AlertProps, InfotipP
7
7
 
8
8
  declare const CollapseIcon: _emotion_styled.StyledComponent<Omit<_mui_material.SvgIconProps, "ref"> & React$1.RefAttributes<SVGSVGElement> & _mui_system.MUIStyledCommonProps<_mui_material.Theme> & {
9
9
  open: boolean;
10
+ disabled?: boolean;
10
11
  }, {}, {}>;
11
12
 
12
13
  type EllipsisWithTooltipProps<T extends React$1.ElementType> = {
@@ -90,10 +91,20 @@ type Props = PropsWithChildren<{
90
91
  }>;
91
92
  declare const Form: ({ children, onSubmit }: Props) => React$1.JSX.Element;
92
93
 
93
- type UpgradeButtonProps = {
94
+ type CtaButtonProps = {
94
95
  href: string;
95
96
  } & Omit<ButtonProps, 'href' | 'target' | 'startIcon' | 'color' | 'variant'>;
96
- declare const UpgradeButton: ({ href, children, ...props }: UpgradeButtonProps) => React$1.JSX.Element;
97
+ declare const CtaButton: ({ href, children, ...props }: CtaButtonProps) => React$1.JSX.Element;
98
+
99
+ type PromotionInfotipProps = React$1.PropsWithChildren<{
100
+ title: string;
101
+ content: string;
102
+ assetUrl: string;
103
+ ctaUrl: string;
104
+ open?: boolean;
105
+ setOpen: (open: boolean) => void;
106
+ }>;
107
+ declare const PromotionInfotip: ({ children, ...props }: PromotionInfotipProps) => React$1.JSX.Element;
97
108
 
98
109
  type PopoverBodyProps = PropsWithChildren<{
99
110
  height?: number | 'auto';
@@ -191,4 +202,4 @@ declare const useEditable: ({ value, onSubmit, validation, onClick, onError }: U
191
202
  };
192
203
  };
193
204
 
194
- export { CollapseIcon, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, UpgradeButton, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
205
+ export { CollapseIcon, CtaButton, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, PromotionInfotip, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import { MenuItemProps, MenuItemTextProps, TypographyProps, AlertProps, InfotipP
7
7
 
8
8
  declare const CollapseIcon: _emotion_styled.StyledComponent<Omit<_mui_material.SvgIconProps, "ref"> & React$1.RefAttributes<SVGSVGElement> & _mui_system.MUIStyledCommonProps<_mui_material.Theme> & {
9
9
  open: boolean;
10
+ disabled?: boolean;
10
11
  }, {}, {}>;
11
12
 
12
13
  type EllipsisWithTooltipProps<T extends React$1.ElementType> = {
@@ -90,10 +91,20 @@ type Props = PropsWithChildren<{
90
91
  }>;
91
92
  declare const Form: ({ children, onSubmit }: Props) => React$1.JSX.Element;
92
93
 
93
- type UpgradeButtonProps = {
94
+ type CtaButtonProps = {
94
95
  href: string;
95
96
  } & Omit<ButtonProps, 'href' | 'target' | 'startIcon' | 'color' | 'variant'>;
96
- declare const UpgradeButton: ({ href, children, ...props }: UpgradeButtonProps) => React$1.JSX.Element;
97
+ declare const CtaButton: ({ href, children, ...props }: CtaButtonProps) => React$1.JSX.Element;
98
+
99
+ type PromotionInfotipProps = React$1.PropsWithChildren<{
100
+ title: string;
101
+ content: string;
102
+ assetUrl: string;
103
+ ctaUrl: string;
104
+ open?: boolean;
105
+ setOpen: (open: boolean) => void;
106
+ }>;
107
+ declare const PromotionInfotip: ({ children, ...props }: PromotionInfotipProps) => React$1.JSX.Element;
97
108
 
98
109
  type PopoverBodyProps = PropsWithChildren<{
99
110
  height?: number | 'auto';
@@ -191,4 +202,4 @@ declare const useEditable: ({ value, onSubmit, validation, onClick, onError }: U
191
202
  };
192
203
  };
193
204
 
194
- export { CollapseIcon, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, UpgradeButton, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
205
+ export { CollapseIcon, CtaButton, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, PromotionInfotip, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
package/dist/index.js CHANGED
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  CollapseIcon: () => CollapseIcon,
34
+ CtaButton: () => CtaButton,
34
35
  EditableField: () => EditableField,
35
36
  EllipsisWithTooltip: () => EllipsisWithTooltip,
36
37
  Form: () => Form,
@@ -44,11 +45,11 @@ __export(index_exports, {
44
45
  PopoverBody: () => PopoverBody,
45
46
  PopoverHeader: () => PopoverHeader,
46
47
  PopoverMenuList: () => PopoverMenuList,
48
+ PromotionInfotip: () => PromotionInfotip,
47
49
  SaveChangesDialog: () => SaveChangesDialog,
48
50
  SearchField: () => SearchField,
49
51
  StyledMenuList: () => StyledMenuList,
50
52
  ThemeProvider: () => ThemeProvider,
51
- UpgradeButton: () => UpgradeButton,
52
53
  WarningInfotip: () => WarningInfotip,
53
54
  closeDialog: () => closeDialog,
54
55
  openDialog: () => openDialog,
@@ -61,12 +62,13 @@ module.exports = __toCommonJS(index_exports);
61
62
  var import_icons = require("@elementor/icons");
62
63
  var import_ui = require("@elementor/ui");
63
64
  var CollapseIcon = (0, import_ui.styled)(import_icons.ChevronDownIcon, {
64
- shouldForwardProp: (prop) => prop !== "open"
65
- })(({ theme, open }) => ({
65
+ shouldForwardProp: (prop) => prop !== "open" && prop !== "disabled"
66
+ })(({ theme, open, disabled = false }) => ({
66
67
  transform: open ? "rotate(180deg)" : "rotate(0deg)",
67
68
  transition: theme.transitions.create("transform", {
68
69
  duration: theme.transitions.duration.standard
69
- })
70
+ }),
71
+ opacity: disabled ? 0.4 : 1
70
72
  }));
71
73
 
72
74
  // src/components/ellipsis-with-tooltip.tsx
@@ -422,12 +424,12 @@ var Form = ({ children, onSubmit }) => {
422
424
  );
423
425
  };
424
426
 
425
- // src/components/upgrade-button.tsx
427
+ // src/components/cta-button.tsx
426
428
  var React12 = __toESM(require("react"));
427
429
  var import_icons4 = require("@elementor/icons");
428
430
  var import_ui12 = require("@elementor/ui");
429
431
  var import_i18n3 = require("@wordpress/i18n");
430
- var UpgradeButton = ({ href, children, ...props }) => /* @__PURE__ */ React12.createElement(
432
+ var CtaButton = ({ href, children, ...props }) => /* @__PURE__ */ React12.createElement(
431
433
  import_ui12.Button,
432
434
  {
433
435
  variant: "contained",
@@ -440,15 +442,50 @@ var UpgradeButton = ({ href, children, ...props }) => /* @__PURE__ */ React12.cr
440
442
  children ?? (0, import_i18n3.__)("Upgrade Now", "elementor")
441
443
  );
442
444
 
443
- // src/components/popover/body.tsx
445
+ // src/components/promotion-infotip.tsx
444
446
  var React13 = __toESM(require("react"));
445
447
  var import_ui13 = require("@elementor/ui");
448
+ var PromotionInfotip = ({ children, ...props }) => {
449
+ return /* @__PURE__ */ React13.createElement(
450
+ import_ui13.Infotip,
451
+ {
452
+ placement: "right",
453
+ ...props,
454
+ content: /* @__PURE__ */ React13.createElement(
455
+ InfotipCard,
456
+ {
457
+ title: props.title,
458
+ content: props.content,
459
+ assetUrl: props.assetUrl,
460
+ ctaUrl: props.ctaUrl,
461
+ setOpen: props.setOpen
462
+ }
463
+ ),
464
+ open: props.open
465
+ },
466
+ children
467
+ );
468
+ };
469
+ function InfotipCard({ ...props }) {
470
+ const { title, content, assetUrl, ctaUrl, setOpen } = props;
471
+ return /* @__PURE__ */ React13.createElement(import_ui13.Card, { elevation: 0, sx: { maxWidth: 296 } }, /* @__PURE__ */ React13.createElement(
472
+ import_ui13.CardHeader,
473
+ {
474
+ title,
475
+ action: /* @__PURE__ */ React13.createElement(import_ui13.CloseButton, { slotProps: { icon: { fontSize: "tiny" } }, onClick: () => setOpen(false) })
476
+ }
477
+ ), /* @__PURE__ */ React13.createElement(import_ui13.CardMedia, { component: "img", image: assetUrl, alt: "", sx: { width: "100%", aspectRatio: "16 / 9" } }), /* @__PURE__ */ React13.createElement(import_ui13.CardContent, null, /* @__PURE__ */ React13.createElement(import_ui13.Typography, { variant: "body2", color: "text.secondary" }, content)), /* @__PURE__ */ React13.createElement(import_ui13.CardActions, { sx: { justifyContent: "flex-start" } }, /* @__PURE__ */ React13.createElement(CtaButton, { href: ctaUrl })));
478
+ }
479
+
480
+ // src/components/popover/body.tsx
481
+ var React14 = __toESM(require("react"));
482
+ var import_ui14 = require("@elementor/ui");
446
483
  var SECTION_PADDING_INLINE = 32;
447
484
  var DEFAULT_POPOVER_HEIGHT = 348;
448
485
  var FALLBACK_POPOVER_WIDTH = 220;
449
486
  var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) => {
450
- return /* @__PURE__ */ React13.createElement(
451
- import_ui13.Box,
487
+ return /* @__PURE__ */ React14.createElement(
488
+ import_ui14.Box,
452
489
  {
453
490
  display: "flex",
454
491
  flexDirection: "column",
@@ -465,8 +502,8 @@ var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) =>
465
502
  };
466
503
 
467
504
  // src/components/popover/header.tsx
468
- var React14 = __toESM(require("react"));
469
- var import_ui14 = require("@elementor/ui");
505
+ var React15 = __toESM(require("react"));
506
+ var import_ui15 = require("@elementor/ui");
470
507
  var SIZE2 = "tiny";
471
508
  var PopoverHeader = ({ title, onClose, icon, actions }) => {
472
509
  const paddingAndSizing = {
@@ -475,13 +512,13 @@ var PopoverHeader = ({ title, onClose, icon, actions }) => {
475
512
  py: 1.5,
476
513
  maxHeight: 36
477
514
  };
478
- return /* @__PURE__ */ React14.createElement(import_ui14.Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React14.createElement(import_ui14.Typography, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React14.createElement(import_ui14.Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React14.createElement(import_ui14.CloseButton, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
515
+ return /* @__PURE__ */ React15.createElement(import_ui15.Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React15.createElement(import_ui15.Typography, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React15.createElement(import_ui15.Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React15.createElement(import_ui15.CloseButton, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
479
516
  };
480
517
 
481
518
  // src/components/popover/menu-list.tsx
482
- var React15 = __toESM(require("react"));
519
+ var React16 = __toESM(require("react"));
483
520
  var import_react12 = require("react");
484
- var import_ui15 = require("@elementor/ui");
521
+ var import_ui16 = require("@elementor/ui");
485
522
  var import_react_virtual = require("@tanstack/react-virtual");
486
523
 
487
524
  // src/hooks/use-scroll-to-selected.ts
@@ -580,7 +617,7 @@ var PopoverMenuList = ({
580
617
  });
581
618
  useScrollToSelected({ selectedValue, items, virtualizer });
582
619
  const virtualItems = virtualizer.getVirtualItems();
583
- return /* @__PURE__ */ React15.createElement(import_ui15.Box, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React15.createElement(
620
+ return /* @__PURE__ */ React16.createElement(import_ui16.Box, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React16.createElement(
584
621
  MenuListComponent,
585
622
  {
586
623
  role: "listbox",
@@ -598,8 +635,8 @@ var PopoverMenuList = ({
598
635
  }
599
636
  if (item.type === "category") {
600
637
  const shouldStick = virtualRow.start + MENU_LIST_PADDING_TOP <= scrollTop;
601
- return /* @__PURE__ */ React15.createElement(
602
- import_ui15.MenuSubheader,
638
+ return /* @__PURE__ */ React16.createElement(
639
+ import_ui16.MenuSubheader,
603
640
  {
604
641
  key: virtualRow.key,
605
642
  style: shouldStick ? {} : menuSubHeaderAbsoluteStyling(virtualRow.start),
@@ -609,8 +646,8 @@ var PopoverMenuList = ({
609
646
  );
610
647
  }
611
648
  const isDisabled = item.disabled;
612
- return /* @__PURE__ */ React15.createElement(
613
- import_ui15.ListItem,
649
+ return /* @__PURE__ */ React16.createElement(
650
+ import_ui16.ListItem,
614
651
  {
615
652
  key: virtualRow.key,
616
653
  role: "option",
@@ -648,7 +685,7 @@ var PopoverMenuList = ({
648
685
  })
649
686
  ));
650
687
  };
651
- var StyledMenuList = (0, import_ui15.styled)(import_ui15.MenuList)(({ theme }) => ({
688
+ var StyledMenuList = (0, import_ui16.styled)(import_ui16.MenuList)(({ theme }) => ({
652
689
  "& > li": {
653
690
  height: ITEM_HEIGHT,
654
691
  width: "100%",
@@ -679,14 +716,14 @@ var StyledMenuList = (0, import_ui15.styled)(import_ui15.MenuList)(({ theme }) =
679
716
  }));
680
717
 
681
718
  // src/components/save-changes-dialog.tsx
682
- var React16 = __toESM(require("react"));
719
+ var React17 = __toESM(require("react"));
683
720
  var import_react13 = require("react");
684
721
  var import_icons5 = require("@elementor/icons");
685
- var import_ui16 = require("@elementor/ui");
722
+ var import_ui17 = require("@elementor/ui");
686
723
  var TITLE_ID = "save-changes-dialog";
687
- var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React16.createElement(import_ui16.Dialog, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
688
- var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React16.createElement(
689
- import_ui16.DialogTitle,
724
+ var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React17.createElement(import_ui17.Dialog, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
725
+ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React17.createElement(
726
+ import_ui17.DialogTitle,
690
727
  {
691
728
  id: TITLE_ID,
692
729
  display: "flex",
@@ -694,11 +731,11 @@ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React16.
694
731
  gap: 1,
695
732
  sx: { lineHeight: 1, justifyContent: "space-between" }
696
733
  },
697
- /* @__PURE__ */ React16.createElement(import_ui16.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React16.createElement(import_icons5.AlertTriangleFilledIcon, { color: "secondary" }), children),
698
- onClose && /* @__PURE__ */ React16.createElement(import_ui16.IconButton, { onClick: onClose, size: "small" }, /* @__PURE__ */ React16.createElement(import_icons5.XIcon, null))
734
+ /* @__PURE__ */ React17.createElement(import_ui17.Stack, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React17.createElement(import_icons5.AlertTriangleFilledIcon, { color: "secondary" }), children),
735
+ onClose && /* @__PURE__ */ React17.createElement(import_ui17.IconButton, { onClick: onClose, size: "small" }, /* @__PURE__ */ React17.createElement(import_icons5.XIcon, null))
699
736
  );
700
- var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React16.createElement(import_ui16.DialogContent, null, children);
701
- var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React16.createElement(import_ui16.DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
737
+ var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React17.createElement(import_ui17.DialogContent, null, children);
738
+ var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React17.createElement(import_ui17.DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
702
739
  var SaveChangesDialogActions = ({ actions }) => {
703
740
  const [isConfirming, setIsConfirming] = (0, import_react13.useState)(false);
704
741
  const { cancel, confirm, discard } = actions;
@@ -707,7 +744,7 @@ var SaveChangesDialogActions = ({ actions }) => {
707
744
  await confirm.action();
708
745
  setIsConfirming(false);
709
746
  };
710
- return /* @__PURE__ */ React16.createElement(import_ui16.DialogActions, null, cancel && /* @__PURE__ */ React16.createElement(import_ui16.Button, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React16.createElement(import_ui16.Button, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React16.createElement(import_ui16.Button, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
747
+ return /* @__PURE__ */ React17.createElement(import_ui17.DialogActions, null, cancel && /* @__PURE__ */ React17.createElement(import_ui17.Button, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React17.createElement(import_ui17.Button, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React17.createElement(import_ui17.Button, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
711
748
  };
712
749
  SaveChangesDialog.Title = SaveChangesDialogTitle;
713
750
  SaveChangesDialog.Content = SaveChangesDialogContent;
@@ -827,6 +864,7 @@ var selectAll = (el) => {
827
864
  // Annotate the CommonJS export names for ESM import in node:
828
865
  0 && (module.exports = {
829
866
  CollapseIcon,
867
+ CtaButton,
830
868
  EditableField,
831
869
  EllipsisWithTooltip,
832
870
  Form,
@@ -840,11 +878,11 @@ var selectAll = (el) => {
840
878
  PopoverBody,
841
879
  PopoverHeader,
842
880
  PopoverMenuList,
881
+ PromotionInfotip,
843
882
  SaveChangesDialog,
844
883
  SearchField,
845
884
  StyledMenuList,
846
885
  ThemeProvider,
847
- UpgradeButton,
848
886
  WarningInfotip,
849
887
  closeDialog,
850
888
  openDialog,
package/dist/index.mjs CHANGED
@@ -2,12 +2,13 @@
2
2
  import { ChevronDownIcon } from "@elementor/icons";
3
3
  import { styled } from "@elementor/ui";
4
4
  var CollapseIcon = styled(ChevronDownIcon, {
5
- shouldForwardProp: (prop) => prop !== "open"
6
- })(({ theme, open }) => ({
5
+ shouldForwardProp: (prop) => prop !== "open" && prop !== "disabled"
6
+ })(({ theme, open, disabled = false }) => ({
7
7
  transform: open ? "rotate(180deg)" : "rotate(0deg)",
8
8
  transition: theme.transitions.create("transform", {
9
9
  duration: theme.transitions.duration.standard
10
- })
10
+ }),
11
+ opacity: disabled ? 0.4 : 1
11
12
  }));
12
13
 
13
14
  // src/components/ellipsis-with-tooltip.tsx
@@ -381,12 +382,12 @@ var Form = ({ children, onSubmit }) => {
381
382
  );
382
383
  };
383
384
 
384
- // src/components/upgrade-button.tsx
385
+ // src/components/cta-button.tsx
385
386
  import * as React12 from "react";
386
387
  import { CrownFilledIcon } from "@elementor/icons";
387
388
  import { Button as Button3 } from "@elementor/ui";
388
389
  import { __ as __3 } from "@wordpress/i18n";
389
- var UpgradeButton = ({ href, children, ...props }) => /* @__PURE__ */ React12.createElement(
390
+ var CtaButton = ({ href, children, ...props }) => /* @__PURE__ */ React12.createElement(
390
391
  Button3,
391
392
  {
392
393
  variant: "contained",
@@ -399,14 +400,49 @@ var UpgradeButton = ({ href, children, ...props }) => /* @__PURE__ */ React12.cr
399
400
  children ?? __3("Upgrade Now", "elementor")
400
401
  );
401
402
 
402
- // src/components/popover/body.tsx
403
+ // src/components/promotion-infotip.tsx
403
404
  import * as React13 from "react";
405
+ import { Card as Card2, CardActions as CardActions2, CardContent as CardContent2, CardHeader, CardMedia, CloseButton, Infotip as Infotip3, Typography as Typography3 } from "@elementor/ui";
406
+ var PromotionInfotip = ({ children, ...props }) => {
407
+ return /* @__PURE__ */ React13.createElement(
408
+ Infotip3,
409
+ {
410
+ placement: "right",
411
+ ...props,
412
+ content: /* @__PURE__ */ React13.createElement(
413
+ InfotipCard,
414
+ {
415
+ title: props.title,
416
+ content: props.content,
417
+ assetUrl: props.assetUrl,
418
+ ctaUrl: props.ctaUrl,
419
+ setOpen: props.setOpen
420
+ }
421
+ ),
422
+ open: props.open
423
+ },
424
+ children
425
+ );
426
+ };
427
+ function InfotipCard({ ...props }) {
428
+ const { title, content, assetUrl, ctaUrl, setOpen } = props;
429
+ return /* @__PURE__ */ React13.createElement(Card2, { elevation: 0, sx: { maxWidth: 296 } }, /* @__PURE__ */ React13.createElement(
430
+ CardHeader,
431
+ {
432
+ title,
433
+ action: /* @__PURE__ */ React13.createElement(CloseButton, { slotProps: { icon: { fontSize: "tiny" } }, onClick: () => setOpen(false) })
434
+ }
435
+ ), /* @__PURE__ */ React13.createElement(CardMedia, { component: "img", image: assetUrl, alt: "", sx: { width: "100%", aspectRatio: "16 / 9" } }), /* @__PURE__ */ React13.createElement(CardContent2, null, /* @__PURE__ */ React13.createElement(Typography3, { variant: "body2", color: "text.secondary" }, content)), /* @__PURE__ */ React13.createElement(CardActions2, { sx: { justifyContent: "flex-start" } }, /* @__PURE__ */ React13.createElement(CtaButton, { href: ctaUrl })));
436
+ }
437
+
438
+ // src/components/popover/body.tsx
439
+ import * as React14 from "react";
404
440
  import { Box as Box5 } from "@elementor/ui";
405
441
  var SECTION_PADDING_INLINE = 32;
406
442
  var DEFAULT_POPOVER_HEIGHT = 348;
407
443
  var FALLBACK_POPOVER_WIDTH = 220;
408
444
  var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) => {
409
- return /* @__PURE__ */ React13.createElement(
445
+ return /* @__PURE__ */ React14.createElement(
410
446
  Box5,
411
447
  {
412
448
  display: "flex",
@@ -424,8 +460,8 @@ var PopoverBody = ({ children, height = DEFAULT_POPOVER_HEIGHT, width, id }) =>
424
460
  };
425
461
 
426
462
  // src/components/popover/header.tsx
427
- import * as React14 from "react";
428
- import { CloseButton, Stack, Typography as Typography3 } from "@elementor/ui";
463
+ import * as React15 from "react";
464
+ import { CloseButton as CloseButton2, Stack, Typography as Typography4 } from "@elementor/ui";
429
465
  var SIZE2 = "tiny";
430
466
  var PopoverHeader = ({ title, onClose, icon, actions }) => {
431
467
  const paddingAndSizing = {
@@ -434,11 +470,11 @@ var PopoverHeader = ({ title, onClose, icon, actions }) => {
434
470
  py: 1.5,
435
471
  maxHeight: 36
436
472
  };
437
- return /* @__PURE__ */ React14.createElement(Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React14.createElement(Typography3, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React14.createElement(Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React14.createElement(CloseButton, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
473
+ return /* @__PURE__ */ React15.createElement(Stack, { direction: "row", alignItems: "center", ...paddingAndSizing, sx: { columnGap: 0.5 } }, icon, /* @__PURE__ */ React15.createElement(Typography4, { variant: "subtitle2", sx: { fontSize: "12px", mt: 0.25 } }, title), /* @__PURE__ */ React15.createElement(Stack, { direction: "row", sx: { ml: "auto" } }, actions, /* @__PURE__ */ React15.createElement(CloseButton2, { slotProps: { icon: { fontSize: SIZE2 } }, sx: { ml: "auto" }, onClick: onClose })));
438
474
  };
439
475
 
440
476
  // src/components/popover/menu-list.tsx
441
- import * as React15 from "react";
477
+ import * as React16 from "react";
442
478
  import { useMemo, useRef as useRef3 } from "react";
443
479
  import { Box as Box6, ListItem, MenuList, MenuSubheader, styled as styled3 } from "@elementor/ui";
444
480
  import { useVirtualizer } from "@tanstack/react-virtual";
@@ -539,7 +575,7 @@ var PopoverMenuList = ({
539
575
  });
540
576
  useScrollToSelected({ selectedValue, items, virtualizer });
541
577
  const virtualItems = virtualizer.getVirtualItems();
542
- return /* @__PURE__ */ React15.createElement(Box6, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React15.createElement(
578
+ return /* @__PURE__ */ React16.createElement(Box6, { ref: containerRef, sx: { height: "100%", overflowY: "auto" } }, items.length === 0 && noResultsComponent ? noResultsComponent : /* @__PURE__ */ React16.createElement(
543
579
  MenuListComponent,
544
580
  {
545
581
  role: "listbox",
@@ -557,7 +593,7 @@ var PopoverMenuList = ({
557
593
  }
558
594
  if (item.type === "category") {
559
595
  const shouldStick = virtualRow.start + MENU_LIST_PADDING_TOP <= scrollTop;
560
- return /* @__PURE__ */ React15.createElement(
596
+ return /* @__PURE__ */ React16.createElement(
561
597
  MenuSubheader,
562
598
  {
563
599
  key: virtualRow.key,
@@ -568,7 +604,7 @@ var PopoverMenuList = ({
568
604
  );
569
605
  }
570
606
  const isDisabled = item.disabled;
571
- return /* @__PURE__ */ React15.createElement(
607
+ return /* @__PURE__ */ React16.createElement(
572
608
  ListItem,
573
609
  {
574
610
  key: virtualRow.key,
@@ -638,7 +674,7 @@ var StyledMenuList = styled3(MenuList)(({ theme }) => ({
638
674
  }));
639
675
 
640
676
  // src/components/save-changes-dialog.tsx
641
- import * as React16 from "react";
677
+ import * as React17 from "react";
642
678
  import { useState as useState6 } from "react";
643
679
  import { AlertTriangleFilledIcon, XIcon as XIcon2 } from "@elementor/icons";
644
680
  import {
@@ -652,8 +688,8 @@ import {
652
688
  Stack as Stack2
653
689
  } from "@elementor/ui";
654
690
  var TITLE_ID = "save-changes-dialog";
655
- var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React16.createElement(Dialog3, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
656
- var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React16.createElement(
691
+ var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React17.createElement(Dialog3, { open: true, onClose, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, children);
692
+ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React17.createElement(
657
693
  DialogTitle2,
658
694
  {
659
695
  id: TITLE_ID,
@@ -662,11 +698,11 @@ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React16.
662
698
  gap: 1,
663
699
  sx: { lineHeight: 1, justifyContent: "space-between" }
664
700
  },
665
- /* @__PURE__ */ React16.createElement(Stack2, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React16.createElement(AlertTriangleFilledIcon, { color: "secondary" }), children),
666
- onClose && /* @__PURE__ */ React16.createElement(IconButton2, { onClick: onClose, size: "small" }, /* @__PURE__ */ React16.createElement(XIcon2, null))
701
+ /* @__PURE__ */ React17.createElement(Stack2, { direction: "row", alignItems: "center", gap: 1 }, /* @__PURE__ */ React17.createElement(AlertTriangleFilledIcon, { color: "secondary" }), children),
702
+ onClose && /* @__PURE__ */ React17.createElement(IconButton2, { onClick: onClose, size: "small" }, /* @__PURE__ */ React17.createElement(XIcon2, null))
667
703
  );
668
- var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React16.createElement(DialogContent, null, children);
669
- var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React16.createElement(DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
704
+ var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React17.createElement(DialogContent, null, children);
705
+ var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React17.createElement(DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
670
706
  var SaveChangesDialogActions = ({ actions }) => {
671
707
  const [isConfirming, setIsConfirming] = useState6(false);
672
708
  const { cancel, confirm, discard } = actions;
@@ -675,7 +711,7 @@ var SaveChangesDialogActions = ({ actions }) => {
675
711
  await confirm.action();
676
712
  setIsConfirming(false);
677
713
  };
678
- return /* @__PURE__ */ React16.createElement(DialogActions2, null, cancel && /* @__PURE__ */ React16.createElement(Button4, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React16.createElement(Button4, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React16.createElement(Button4, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
714
+ return /* @__PURE__ */ React17.createElement(DialogActions2, null, cancel && /* @__PURE__ */ React17.createElement(Button4, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React17.createElement(Button4, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React17.createElement(Button4, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
679
715
  };
680
716
  SaveChangesDialog.Title = SaveChangesDialogTitle;
681
717
  SaveChangesDialog.Content = SaveChangesDialogContent;
@@ -794,6 +830,7 @@ var selectAll = (el) => {
794
830
  };
795
831
  export {
796
832
  CollapseIcon,
833
+ CtaButton,
797
834
  EditableField,
798
835
  EllipsisWithTooltip,
799
836
  Form,
@@ -807,11 +844,11 @@ export {
807
844
  PopoverBody,
808
845
  PopoverHeader,
809
846
  PopoverMenuList,
847
+ PromotionInfotip,
810
848
  SaveChangesDialog,
811
849
  SearchField,
812
850
  StyledMenuList,
813
851
  ThemeProvider,
814
- UpgradeButton,
815
852
  WarningInfotip,
816
853
  closeDialog,
817
854
  openDialog,
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-375",
4
+ "version": "3.35.0-377",
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-375",
40
+ "@elementor/editor-v1-adapters": "3.35.0-377",
41
41
  "@elementor/icons": "^1.63.0",
42
42
  "@elementor/ui": "1.36.17",
43
43
  "@tanstack/react-virtual": "^3.13.3",
@@ -3,10 +3,12 @@ import { styled } from '@elementor/ui';
3
3
 
4
4
  // TODO: Replace this with future Rotate component that will be implemented in elementor-ui
5
5
  export const CollapseIcon = styled( ChevronDownIcon, {
6
- shouldForwardProp: ( prop ) => prop !== 'open',
7
- } )< { open: boolean } >( ( { theme, open } ) => ( {
6
+ shouldForwardProp: ( prop ) => prop !== 'open' && prop !== 'disabled',
7
+ } )< { open: boolean; disabled?: boolean } >( ( { theme, open, disabled = false } ) => ( {
8
8
  transform: open ? 'rotate(180deg)' : 'rotate(0deg)',
9
9
  transition: theme.transitions.create( 'transform', {
10
10
  duration: theme.transitions.duration.standard,
11
11
  } ),
12
+
13
+ opacity: disabled ? 0.4 : 1,
12
14
  } ) );
@@ -3,11 +3,11 @@ import { CrownFilledIcon } from '@elementor/icons';
3
3
  import { Button, type ButtonProps } from '@elementor/ui';
4
4
  import { __ } from '@wordpress/i18n';
5
5
 
6
- type UpgradeButtonProps = {
6
+ type CtaButtonProps = {
7
7
  href: string;
8
8
  } & Omit< ButtonProps, 'href' | 'target' | 'startIcon' | 'color' | 'variant' >;
9
9
 
10
- export const UpgradeButton = ( { href, children, ...props }: UpgradeButtonProps ) => (
10
+ export const CtaButton = ( { href, children, ...props }: CtaButtonProps ) => (
11
11
  <Button
12
12
  variant="contained"
13
13
  color="promotion"
@@ -0,0 +1,58 @@
1
+ import * as React from 'react';
2
+ import { Card, CardActions, CardContent, CardHeader, CardMedia, CloseButton, Infotip, Typography } from '@elementor/ui';
3
+
4
+ import { CtaButton } from './cta-button';
5
+
6
+ type PromotionInfotipProps = React.PropsWithChildren< {
7
+ title: string;
8
+ content: string;
9
+ assetUrl: string;
10
+ ctaUrl: string;
11
+ open?: boolean;
12
+ setOpen: ( open: boolean ) => void;
13
+ } >;
14
+
15
+ export const PromotionInfotip = ( { children, ...props }: PromotionInfotipProps ) => {
16
+ return (
17
+ <Infotip
18
+ placement="right"
19
+ { ...props }
20
+ content={
21
+ <InfotipCard
22
+ title={ props.title }
23
+ content={ props.content }
24
+ assetUrl={ props.assetUrl }
25
+ ctaUrl={ props.ctaUrl }
26
+ setOpen={ props.setOpen }
27
+ />
28
+ }
29
+ open={ props.open }
30
+ >
31
+ { children }
32
+ </Infotip>
33
+ );
34
+ };
35
+
36
+ function InfotipCard( { ...props }: PromotionInfotipProps ) {
37
+ const { title, content, assetUrl, ctaUrl, setOpen } = props;
38
+
39
+ return (
40
+ <Card elevation={ 0 } sx={ { maxWidth: 296 } }>
41
+ <CardHeader
42
+ title={ title }
43
+ action={
44
+ <CloseButton slotProps={ { icon: { fontSize: 'tiny' } } } onClick={ () => setOpen( false ) } />
45
+ }
46
+ />
47
+ <CardMedia component="img" image={ assetUrl } alt="" sx={ { width: '100%', aspectRatio: '16 / 9' } } />
48
+ <CardContent>
49
+ <Typography variant="body2" color="text.secondary">
50
+ { content }
51
+ </Typography>
52
+ </CardContent>
53
+ <CardActions sx={ { justifyContent: 'flex-start' } }>
54
+ <CtaButton href={ ctaUrl } />
55
+ </CardActions>
56
+ </Card>
57
+ );
58
+ }
package/src/index.ts CHANGED
@@ -11,7 +11,8 @@ export { WarningInfotip } from './components/warning-infotip';
11
11
  export { GlobalDialog, openDialog, closeDialog } from './components/global-dialog';
12
12
  export { SearchField } from './components/search-field';
13
13
  export { Form } from './components/form';
14
- export { UpgradeButton } from './components/upgrade-button';
14
+ export { CtaButton } from './components/cta-button';
15
+ export { PromotionInfotip } from './components/promotion-infotip';
15
16
 
16
17
  export * from './components/popover';
17
18
  export * from './components/save-changes-dialog';