@elementor/editor-ui 3.35.0-439 → 3.35.0-441
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 +3 -5
- package/dist/index.d.ts +3 -5
- package/dist/index.js +52 -46
- package/dist/index.mjs +43 -37
- package/package.json +2 -2
- package/src/components/promotion-chip.tsx +19 -22
- package/src/components/promotion-infotip.tsx +20 -8
- package/src/components/promotion-popover.tsx +0 -2
package/dist/index.d.mts
CHANGED
|
@@ -102,12 +102,12 @@ type InfotipCardProps = {
|
|
|
102
102
|
content: string;
|
|
103
103
|
assetUrl: string;
|
|
104
104
|
ctaUrl: string;
|
|
105
|
-
|
|
105
|
+
onClose: () => void;
|
|
106
106
|
};
|
|
107
107
|
type PromotionInfotipProps = React$1.PropsWithChildren<InfotipCardProps & {
|
|
108
108
|
open?: boolean;
|
|
109
109
|
}>;
|
|
110
|
-
declare const PromotionInfotip: ({ children, open, ...cardProps }: PromotionInfotipProps) => React$1.JSX.Element;
|
|
110
|
+
declare const PromotionInfotip: ({ children, open, onClose, ...cardProps }: PromotionInfotipProps) => React$1.JSX.Element;
|
|
111
111
|
|
|
112
112
|
type PromotionPopoverCardProps = {
|
|
113
113
|
title: string;
|
|
@@ -123,9 +123,7 @@ type PromotionPopoverProps = React$1.PropsWithChildren<PromotionPopoverCardProps
|
|
|
123
123
|
}>;
|
|
124
124
|
declare const PromotionPopover: ({ children, open, placement, slotProps, ...cardProps }: PromotionPopoverProps) => React$1.JSX.Element;
|
|
125
125
|
|
|
126
|
-
declare const PromotionChip: React$1.ForwardRefExoticComponent<
|
|
127
|
-
onClick: () => void;
|
|
128
|
-
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
126
|
+
declare const PromotionChip: React$1.ForwardRefExoticComponent<React$1.RefAttributes<HTMLDivElement>>;
|
|
129
127
|
|
|
130
128
|
type PopoverBodyProps = PropsWithChildren<{
|
|
131
129
|
height?: number | 'auto';
|
package/dist/index.d.ts
CHANGED
|
@@ -102,12 +102,12 @@ type InfotipCardProps = {
|
|
|
102
102
|
content: string;
|
|
103
103
|
assetUrl: string;
|
|
104
104
|
ctaUrl: string;
|
|
105
|
-
|
|
105
|
+
onClose: () => void;
|
|
106
106
|
};
|
|
107
107
|
type PromotionInfotipProps = React$1.PropsWithChildren<InfotipCardProps & {
|
|
108
108
|
open?: boolean;
|
|
109
109
|
}>;
|
|
110
|
-
declare const PromotionInfotip: ({ children, open, ...cardProps }: PromotionInfotipProps) => React$1.JSX.Element;
|
|
110
|
+
declare const PromotionInfotip: ({ children, open, onClose, ...cardProps }: PromotionInfotipProps) => React$1.JSX.Element;
|
|
111
111
|
|
|
112
112
|
type PromotionPopoverCardProps = {
|
|
113
113
|
title: string;
|
|
@@ -123,9 +123,7 @@ type PromotionPopoverProps = React$1.PropsWithChildren<PromotionPopoverCardProps
|
|
|
123
123
|
}>;
|
|
124
124
|
declare const PromotionPopover: ({ children, open, placement, slotProps, ...cardProps }: PromotionPopoverProps) => React$1.JSX.Element;
|
|
125
125
|
|
|
126
|
-
declare const PromotionChip: React$1.ForwardRefExoticComponent<
|
|
127
|
-
onClick: () => void;
|
|
128
|
-
} & React$1.RefAttributes<HTMLDivElement>>;
|
|
126
|
+
declare const PromotionChip: React$1.ForwardRefExoticComponent<React$1.RefAttributes<HTMLDivElement>>;
|
|
129
127
|
|
|
130
128
|
type PopoverBodyProps = PropsWithChildren<{
|
|
131
129
|
height?: number | 'auto';
|
package/dist/index.js
CHANGED
|
@@ -447,24 +447,34 @@ var CtaButton = ({ href, children, showIcon = true, ...props }) => /* @__PURE__
|
|
|
447
447
|
|
|
448
448
|
// src/components/promotion-infotip.tsx
|
|
449
449
|
var React13 = __toESM(require("react"));
|
|
450
|
+
var import_react10 = require("react");
|
|
451
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
450
452
|
var import_ui13 = require("@elementor/ui");
|
|
451
|
-
var PromotionInfotip = ({ children, open, ...cardProps }) => {
|
|
452
|
-
|
|
453
|
+
var PromotionInfotip = ({ children, open, onClose, ...cardProps }) => {
|
|
454
|
+
(0, import_react10.useEffect)(() => {
|
|
455
|
+
const canvasDocument = open ? (0, import_editor_v1_adapters2.getCanvasIframeDocument)() : null;
|
|
456
|
+
if (!canvasDocument) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
canvasDocument.addEventListener("mousedown", onClose);
|
|
460
|
+
return () => canvasDocument.removeEventListener("mousedown", onClose);
|
|
461
|
+
}, [open, onClose]);
|
|
462
|
+
return /* @__PURE__ */ React13.createElement(import_ui13.Infotip, { placement: "right", content: /* @__PURE__ */ React13.createElement(InfotipCard, { onClose, ...cardProps }), open }, children);
|
|
453
463
|
};
|
|
454
|
-
function InfotipCard({ title, content, assetUrl, ctaUrl,
|
|
464
|
+
function InfotipCard({ title, content, assetUrl, ctaUrl, onClose }) {
|
|
455
465
|
return /* @__PURE__ */ React13.createElement(
|
|
456
466
|
import_ui13.ClickAwayListener,
|
|
457
467
|
{
|
|
458
468
|
disableReactTree: true,
|
|
459
469
|
mouseEvent: "onMouseDown",
|
|
460
470
|
touchEvent: "onTouchStart",
|
|
461
|
-
onClickAway:
|
|
471
|
+
onClickAway: onClose
|
|
462
472
|
},
|
|
463
473
|
/* @__PURE__ */ React13.createElement(import_ui13.Card, { elevation: 0, sx: { maxWidth: 296 } }, /* @__PURE__ */ React13.createElement(
|
|
464
474
|
import_ui13.CardHeader,
|
|
465
475
|
{
|
|
466
476
|
title,
|
|
467
|
-
action: /* @__PURE__ */ React13.createElement(import_ui13.CloseButton, { slotProps: { icon: { fontSize: "tiny" } }, onClick:
|
|
477
|
+
action: /* @__PURE__ */ React13.createElement(import_ui13.CloseButton, { slotProps: { icon: { fontSize: "tiny" } }, onClick: onClose })
|
|
468
478
|
}
|
|
469
479
|
), /* @__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 })))
|
|
470
480
|
);
|
|
@@ -523,7 +533,6 @@ function PopoverAlert({ title, content, ctaUrl, ctaText, onClose }) {
|
|
|
523
533
|
onClose,
|
|
524
534
|
role: "dialog",
|
|
525
535
|
"aria-label": "promotion-popover-title",
|
|
526
|
-
onKeyDown: (e) => e.key === "Escape" && onClose(),
|
|
527
536
|
action: /* @__PURE__ */ React14.createElement(
|
|
528
537
|
import_ui14.AlertAction,
|
|
529
538
|
{
|
|
@@ -546,29 +555,26 @@ function PopoverAlert({ title, content, ctaUrl, ctaText, onClose }) {
|
|
|
546
555
|
var React15 = __toESM(require("react"));
|
|
547
556
|
var import_icons6 = require("@elementor/icons");
|
|
548
557
|
var import_ui15 = require("@elementor/ui");
|
|
549
|
-
var PromotionChip = React15.forwardRef(
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
);
|
|
570
|
-
}
|
|
571
|
-
);
|
|
558
|
+
var PromotionChip = React15.forwardRef(({ ...props }, ref) => {
|
|
559
|
+
return /* @__PURE__ */ React15.createElement(
|
|
560
|
+
import_ui15.Chip,
|
|
561
|
+
{
|
|
562
|
+
ref,
|
|
563
|
+
size: "tiny",
|
|
564
|
+
color: "promotion",
|
|
565
|
+
variant: "standard",
|
|
566
|
+
icon: /* @__PURE__ */ React15.createElement(import_icons6.CrownFilledIcon, null),
|
|
567
|
+
sx: {
|
|
568
|
+
ml: 1,
|
|
569
|
+
width: "20px",
|
|
570
|
+
"& .MuiChip-label": {
|
|
571
|
+
display: "none"
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
...props
|
|
575
|
+
}
|
|
576
|
+
);
|
|
577
|
+
});
|
|
572
578
|
|
|
573
579
|
// src/components/popover/body.tsx
|
|
574
580
|
var React16 = __toESM(require("react"));
|
|
@@ -610,18 +616,18 @@ var PopoverHeader = ({ title, onClose, icon, actions }) => {
|
|
|
610
616
|
|
|
611
617
|
// src/components/popover/menu-list.tsx
|
|
612
618
|
var React18 = __toESM(require("react"));
|
|
613
|
-
var
|
|
619
|
+
var import_react13 = require("react");
|
|
614
620
|
var import_ui18 = require("@elementor/ui");
|
|
615
621
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
616
622
|
|
|
617
623
|
// src/hooks/use-scroll-to-selected.ts
|
|
618
|
-
var
|
|
624
|
+
var import_react11 = require("react");
|
|
619
625
|
var useScrollToSelected = ({
|
|
620
626
|
selectedValue,
|
|
621
627
|
items,
|
|
622
628
|
virtualizer
|
|
623
629
|
}) => {
|
|
624
|
-
(0,
|
|
630
|
+
(0, import_react11.useEffect)(() => {
|
|
625
631
|
if (!selectedValue || items.length === 0) {
|
|
626
632
|
return;
|
|
627
633
|
}
|
|
@@ -633,10 +639,10 @@ var useScrollToSelected = ({
|
|
|
633
639
|
};
|
|
634
640
|
|
|
635
641
|
// src/hooks/use-scroll-top.ts
|
|
636
|
-
var
|
|
642
|
+
var import_react12 = require("react");
|
|
637
643
|
var useScrollTop = ({ containerRef }) => {
|
|
638
|
-
const [scrollTop, setScrollTop] = (0,
|
|
639
|
-
(0,
|
|
644
|
+
const [scrollTop, setScrollTop] = (0, import_react12.useState)(0);
|
|
645
|
+
(0, import_react12.useEffect)(() => {
|
|
640
646
|
const container = containerRef.current;
|
|
641
647
|
if (!container) {
|
|
642
648
|
return;
|
|
@@ -675,11 +681,11 @@ var PopoverMenuList = ({
|
|
|
675
681
|
noResultsComponent,
|
|
676
682
|
menuListTemplate: CustomMenuList
|
|
677
683
|
}) => {
|
|
678
|
-
const containerRef = (0,
|
|
684
|
+
const containerRef = (0, import_react13.useRef)(null);
|
|
679
685
|
const scrollTop = useScrollTop({ containerRef });
|
|
680
686
|
const theme = (0, import_ui18.useTheme)();
|
|
681
687
|
const MenuListComponent = CustomMenuList || StyledMenuList;
|
|
682
|
-
const stickyIndices = (0,
|
|
688
|
+
const stickyIndices = (0, import_react13.useMemo)(
|
|
683
689
|
() => items.reduce((categoryIndices, item, index) => {
|
|
684
690
|
if (item.type === "category") {
|
|
685
691
|
categoryIndices.push(index);
|
|
@@ -713,7 +719,7 @@ var PopoverMenuList = ({
|
|
|
713
719
|
rangeExtractor: getActiveItemIndices,
|
|
714
720
|
onChange: onChangeCallback
|
|
715
721
|
});
|
|
716
|
-
(0,
|
|
722
|
+
(0, import_react13.useEffect)(() => {
|
|
717
723
|
onChangeCallback(virtualizer);
|
|
718
724
|
}, [items]);
|
|
719
725
|
useScrollToSelected({ selectedValue, items, virtualizer });
|
|
@@ -818,7 +824,7 @@ var StyledMenuList = (0, import_ui18.styled)(import_ui18.MenuList)(({ theme }) =
|
|
|
818
824
|
|
|
819
825
|
// src/components/save-changes-dialog.tsx
|
|
820
826
|
var React19 = __toESM(require("react"));
|
|
821
|
-
var
|
|
827
|
+
var import_react14 = require("react");
|
|
822
828
|
var import_icons7 = require("@elementor/icons");
|
|
823
829
|
var import_ui19 = require("@elementor/ui");
|
|
824
830
|
var TITLE_ID = "save-changes-dialog";
|
|
@@ -838,7 +844,7 @@ var SaveChangesDialogTitle = ({ children, onClose }) => /* @__PURE__ */ React19.
|
|
|
838
844
|
var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React19.createElement(import_ui19.DialogContent, null, children);
|
|
839
845
|
var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React19.createElement(import_ui19.DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
|
|
840
846
|
var SaveChangesDialogActions = ({ actions }) => {
|
|
841
|
-
const [isConfirming, setIsConfirming] = (0,
|
|
847
|
+
const [isConfirming, setIsConfirming] = (0, import_react14.useState)(false);
|
|
842
848
|
const { cancel, confirm, discard } = actions;
|
|
843
849
|
const onConfirm = async () => {
|
|
844
850
|
setIsConfirming(true);
|
|
@@ -852,7 +858,7 @@ SaveChangesDialog.Content = SaveChangesDialogContent;
|
|
|
852
858
|
SaveChangesDialog.ContentText = SaveChangesDialogContentText;
|
|
853
859
|
SaveChangesDialog.Actions = SaveChangesDialogActions;
|
|
854
860
|
var useDialog = () => {
|
|
855
|
-
const [isOpen, setIsOpen] = (0,
|
|
861
|
+
const [isOpen, setIsOpen] = (0, import_react14.useState)(false);
|
|
856
862
|
const open = () => setIsOpen(true);
|
|
857
863
|
const close = () => setIsOpen(false);
|
|
858
864
|
return { isOpen, open, close };
|
|
@@ -880,10 +886,10 @@ ConfirmationDialog.ContentText = ConfirmationDialogContentText;
|
|
|
880
886
|
ConfirmationDialog.Actions = ConfirmationDialogActions;
|
|
881
887
|
|
|
882
888
|
// src/hooks/use-editable.ts
|
|
883
|
-
var
|
|
889
|
+
var import_react15 = require("react");
|
|
884
890
|
var useEditable = ({ value, onSubmit, validation, onClick, onError }) => {
|
|
885
|
-
const [isEditing, setIsEditing] = (0,
|
|
886
|
-
const [error, setError] = (0,
|
|
891
|
+
const [isEditing, setIsEditing] = (0, import_react15.useState)(false);
|
|
892
|
+
const [error, setError] = (0, import_react15.useState)(null);
|
|
887
893
|
const ref = useSelection(isEditing);
|
|
888
894
|
const isDirty = (newValue) => newValue !== value;
|
|
889
895
|
const openEditMode = () => {
|
|
@@ -965,8 +971,8 @@ var useEditable = ({ value, onSubmit, validation, onClick, onError }) => {
|
|
|
965
971
|
};
|
|
966
972
|
};
|
|
967
973
|
var useSelection = (isEditing) => {
|
|
968
|
-
const ref = (0,
|
|
969
|
-
(0,
|
|
974
|
+
const ref = (0, import_react15.useRef)(null);
|
|
975
|
+
(0, import_react15.useEffect)(() => {
|
|
970
976
|
if (isEditing) {
|
|
971
977
|
selectAll(ref.current);
|
|
972
978
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -402,6 +402,8 @@ var CtaButton = ({ href, children, showIcon = true, ...props }) => /* @__PURE__
|
|
|
402
402
|
|
|
403
403
|
// src/components/promotion-infotip.tsx
|
|
404
404
|
import * as React13 from "react";
|
|
405
|
+
import { useEffect as useEffect4 } from "react";
|
|
406
|
+
import { getCanvasIframeDocument } from "@elementor/editor-v1-adapters";
|
|
405
407
|
import {
|
|
406
408
|
Card as Card2,
|
|
407
409
|
CardActions as CardActions2,
|
|
@@ -413,23 +415,31 @@ import {
|
|
|
413
415
|
Infotip as Infotip3,
|
|
414
416
|
Typography as Typography3
|
|
415
417
|
} from "@elementor/ui";
|
|
416
|
-
var PromotionInfotip = ({ children, open, ...cardProps }) => {
|
|
417
|
-
|
|
418
|
+
var PromotionInfotip = ({ children, open, onClose, ...cardProps }) => {
|
|
419
|
+
useEffect4(() => {
|
|
420
|
+
const canvasDocument = open ? getCanvasIframeDocument() : null;
|
|
421
|
+
if (!canvasDocument) {
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
canvasDocument.addEventListener("mousedown", onClose);
|
|
425
|
+
return () => canvasDocument.removeEventListener("mousedown", onClose);
|
|
426
|
+
}, [open, onClose]);
|
|
427
|
+
return /* @__PURE__ */ React13.createElement(Infotip3, { placement: "right", content: /* @__PURE__ */ React13.createElement(InfotipCard, { onClose, ...cardProps }), open }, children);
|
|
418
428
|
};
|
|
419
|
-
function InfotipCard({ title, content, assetUrl, ctaUrl,
|
|
429
|
+
function InfotipCard({ title, content, assetUrl, ctaUrl, onClose }) {
|
|
420
430
|
return /* @__PURE__ */ React13.createElement(
|
|
421
431
|
ClickAwayListener,
|
|
422
432
|
{
|
|
423
433
|
disableReactTree: true,
|
|
424
434
|
mouseEvent: "onMouseDown",
|
|
425
435
|
touchEvent: "onTouchStart",
|
|
426
|
-
onClickAway:
|
|
436
|
+
onClickAway: onClose
|
|
427
437
|
},
|
|
428
438
|
/* @__PURE__ */ React13.createElement(Card2, { elevation: 0, sx: { maxWidth: 296 } }, /* @__PURE__ */ React13.createElement(
|
|
429
439
|
CardHeader,
|
|
430
440
|
{
|
|
431
441
|
title,
|
|
432
|
-
action: /* @__PURE__ */ React13.createElement(CloseButton, { slotProps: { icon: { fontSize: "tiny" } }, onClick:
|
|
442
|
+
action: /* @__PURE__ */ React13.createElement(CloseButton, { slotProps: { icon: { fontSize: "tiny" } }, onClick: onClose })
|
|
433
443
|
}
|
|
434
444
|
), /* @__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 })))
|
|
435
445
|
);
|
|
@@ -496,7 +506,6 @@ function PopoverAlert({ title, content, ctaUrl, ctaText, onClose }) {
|
|
|
496
506
|
onClose,
|
|
497
507
|
role: "dialog",
|
|
498
508
|
"aria-label": "promotion-popover-title",
|
|
499
|
-
onKeyDown: (e) => e.key === "Escape" && onClose(),
|
|
500
509
|
action: /* @__PURE__ */ React14.createElement(
|
|
501
510
|
AlertAction,
|
|
502
511
|
{
|
|
@@ -519,29 +528,26 @@ function PopoverAlert({ title, content, ctaUrl, ctaText, onClose }) {
|
|
|
519
528
|
import * as React15 from "react";
|
|
520
529
|
import { CrownFilledIcon as CrownFilledIcon3 } from "@elementor/icons";
|
|
521
530
|
import { Chip } from "@elementor/ui";
|
|
522
|
-
var PromotionChip = React15.forwardRef(
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
);
|
|
543
|
-
}
|
|
544
|
-
);
|
|
531
|
+
var PromotionChip = React15.forwardRef(({ ...props }, ref) => {
|
|
532
|
+
return /* @__PURE__ */ React15.createElement(
|
|
533
|
+
Chip,
|
|
534
|
+
{
|
|
535
|
+
ref,
|
|
536
|
+
size: "tiny",
|
|
537
|
+
color: "promotion",
|
|
538
|
+
variant: "standard",
|
|
539
|
+
icon: /* @__PURE__ */ React15.createElement(CrownFilledIcon3, null),
|
|
540
|
+
sx: {
|
|
541
|
+
ml: 1,
|
|
542
|
+
width: "20px",
|
|
543
|
+
"& .MuiChip-label": {
|
|
544
|
+
display: "none"
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
...props
|
|
548
|
+
}
|
|
549
|
+
);
|
|
550
|
+
});
|
|
545
551
|
|
|
546
552
|
// src/components/popover/body.tsx
|
|
547
553
|
import * as React16 from "react";
|
|
@@ -583,18 +589,18 @@ var PopoverHeader = ({ title, onClose, icon, actions }) => {
|
|
|
583
589
|
|
|
584
590
|
// src/components/popover/menu-list.tsx
|
|
585
591
|
import * as React18 from "react";
|
|
586
|
-
import { useEffect as
|
|
592
|
+
import { useEffect as useEffect7, useMemo, useRef as useRef3 } from "react";
|
|
587
593
|
import { Box as Box7, ListItem, MenuList, MenuSubheader, styled as styled3, useTheme } from "@elementor/ui";
|
|
588
594
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
589
595
|
|
|
590
596
|
// src/hooks/use-scroll-to-selected.ts
|
|
591
|
-
import { useEffect as
|
|
597
|
+
import { useEffect as useEffect5 } from "react";
|
|
592
598
|
var useScrollToSelected = ({
|
|
593
599
|
selectedValue,
|
|
594
600
|
items,
|
|
595
601
|
virtualizer
|
|
596
602
|
}) => {
|
|
597
|
-
|
|
603
|
+
useEffect5(() => {
|
|
598
604
|
if (!selectedValue || items.length === 0) {
|
|
599
605
|
return;
|
|
600
606
|
}
|
|
@@ -606,10 +612,10 @@ var useScrollToSelected = ({
|
|
|
606
612
|
};
|
|
607
613
|
|
|
608
614
|
// src/hooks/use-scroll-top.ts
|
|
609
|
-
import { useEffect as
|
|
615
|
+
import { useEffect as useEffect6, useState as useState5 } from "react";
|
|
610
616
|
var useScrollTop = ({ containerRef }) => {
|
|
611
617
|
const [scrollTop, setScrollTop] = useState5(0);
|
|
612
|
-
|
|
618
|
+
useEffect6(() => {
|
|
613
619
|
const container = containerRef.current;
|
|
614
620
|
if (!container) {
|
|
615
621
|
return;
|
|
@@ -686,7 +692,7 @@ var PopoverMenuList = ({
|
|
|
686
692
|
rangeExtractor: getActiveItemIndices,
|
|
687
693
|
onChange: onChangeCallback
|
|
688
694
|
});
|
|
689
|
-
|
|
695
|
+
useEffect7(() => {
|
|
690
696
|
onChangeCallback(virtualizer);
|
|
691
697
|
}, [items]);
|
|
692
698
|
useScrollToSelected({ selectedValue, items, virtualizer });
|
|
@@ -869,7 +875,7 @@ ConfirmationDialog.ContentText = ConfirmationDialogContentText;
|
|
|
869
875
|
ConfirmationDialog.Actions = ConfirmationDialogActions;
|
|
870
876
|
|
|
871
877
|
// src/hooks/use-editable.ts
|
|
872
|
-
import { useEffect as
|
|
878
|
+
import { useEffect as useEffect8, useRef as useRef4, useState as useState7 } from "react";
|
|
873
879
|
var useEditable = ({ value, onSubmit, validation, onClick, onError }) => {
|
|
874
880
|
const [isEditing, setIsEditing] = useState7(false);
|
|
875
881
|
const [error, setError] = useState7(null);
|
|
@@ -955,7 +961,7 @@ var useEditable = ({ value, onSubmit, validation, onClick, onError }) => {
|
|
|
955
961
|
};
|
|
956
962
|
var useSelection = (isEditing) => {
|
|
957
963
|
const ref = useRef4(null);
|
|
958
|
-
|
|
964
|
+
useEffect8(() => {
|
|
959
965
|
if (isEditing) {
|
|
960
966
|
selectAll(ref.current);
|
|
961
967
|
}
|
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-
|
|
4
|
+
"version": "3.35.0-441",
|
|
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-
|
|
40
|
+
"@elementor/editor-v1-adapters": "3.35.0-441",
|
|
41
41
|
"@elementor/icons": "^1.63.0",
|
|
42
42
|
"@elementor/ui": "1.36.17",
|
|
43
43
|
"@tanstack/react-virtual": "^3.13.3",
|
|
@@ -2,25 +2,22 @@ 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
|
|
6
|
-
(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
);
|
|
5
|
+
export const PromotionChip = React.forwardRef< HTMLDivElement >( ( { ...props }, 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
|
+
width: '20px',
|
|
16
|
+
'& .MuiChip-label': {
|
|
17
|
+
display: 'none',
|
|
18
|
+
},
|
|
19
|
+
} }
|
|
20
|
+
{ ...props }
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
} );
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { getCanvasIframeDocument } from '@elementor/editor-v1-adapters';
|
|
2
4
|
import {
|
|
3
5
|
Card,
|
|
4
6
|
CardActions,
|
|
@@ -18,7 +20,7 @@ type InfotipCardProps = {
|
|
|
18
20
|
content: string;
|
|
19
21
|
assetUrl: string;
|
|
20
22
|
ctaUrl: string;
|
|
21
|
-
|
|
23
|
+
onClose: () => void;
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
type PromotionInfotipProps = React.PropsWithChildren<
|
|
@@ -27,28 +29,38 @@ type PromotionInfotipProps = React.PropsWithChildren<
|
|
|
27
29
|
}
|
|
28
30
|
>;
|
|
29
31
|
|
|
30
|
-
export const PromotionInfotip = ( { children, open, ...cardProps }: PromotionInfotipProps ) => {
|
|
32
|
+
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 ] );
|
|
44
|
+
|
|
31
45
|
return (
|
|
32
|
-
<Infotip placement="right" content={ <InfotipCard { ...cardProps } /> } open={ open }>
|
|
46
|
+
<Infotip placement="right" content={ <InfotipCard onClose={ onClose } { ...cardProps } /> } open={ open }>
|
|
33
47
|
{ children }
|
|
34
48
|
</Infotip>
|
|
35
49
|
);
|
|
36
50
|
};
|
|
37
51
|
|
|
38
|
-
function InfotipCard( { title, content, assetUrl, ctaUrl,
|
|
52
|
+
function InfotipCard( { title, content, assetUrl, ctaUrl, onClose }: InfotipCardProps ) {
|
|
39
53
|
return (
|
|
40
54
|
<ClickAwayListener
|
|
41
55
|
disableReactTree={ true }
|
|
42
56
|
mouseEvent="onMouseDown"
|
|
43
57
|
touchEvent="onTouchStart"
|
|
44
|
-
onClickAway={
|
|
58
|
+
onClickAway={ onClose }
|
|
45
59
|
>
|
|
46
60
|
<Card elevation={ 0 } sx={ { maxWidth: 296 } }>
|
|
47
61
|
<CardHeader
|
|
48
62
|
title={ title }
|
|
49
|
-
action={
|
|
50
|
-
<CloseButton slotProps={ { icon: { fontSize: 'tiny' } } } onClick={ () => setOpen( false ) } />
|
|
51
|
-
}
|
|
63
|
+
action={ <CloseButton slotProps={ { icon: { fontSize: 'tiny' } } } onClick={ onClose } /> }
|
|
52
64
|
/>
|
|
53
65
|
<CardMedia component="img" image={ assetUrl } alt="" sx={ { width: '100%', aspectRatio: '16 / 9' } } />
|
|
54
66
|
<CardContent>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { KeyboardEvent } from 'react';
|
|
3
2
|
import { CrownFilledIcon } from '@elementor/icons';
|
|
4
3
|
import {
|
|
5
4
|
Alert,
|
|
@@ -76,7 +75,6 @@ function PopoverAlert( { title, content, ctaUrl, ctaText, onClose }: PromotionPo
|
|
|
76
75
|
onClose={ onClose }
|
|
77
76
|
role="dialog"
|
|
78
77
|
aria-label="promotion-popover-title"
|
|
79
|
-
onKeyDown={ ( e: KeyboardEvent ) => e.key === 'Escape' && onClose() }
|
|
80
78
|
action={
|
|
81
79
|
<AlertAction
|
|
82
80
|
variant="contained"
|