@elementor/editor-ui 3.35.0-427 → 3.35.0-428

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
@@ -176,13 +176,13 @@ declare const SaveChangesDialog: {
176
176
  }) => React$1.JSX.Element;
177
177
  Content: ({ children }: React$1.PropsWithChildren) => React$1.JSX.Element;
178
178
  ContentText: (props: DialogContentTextProps) => React$1.JSX.Element;
179
- Actions: ({ actions }: ConfirmationDialogActionsProps) => React$1.JSX.Element;
179
+ Actions: ({ actions }: ConfirmationDialogActionsProps$1) => React$1.JSX.Element;
180
180
  };
181
181
  type Action = {
182
182
  label: string;
183
183
  action: () => void | Promise<void>;
184
184
  };
185
- type ConfirmationDialogActionsProps = {
185
+ type ConfirmationDialogActionsProps$1 = {
186
186
  actions: {
187
187
  cancel?: Action;
188
188
  confirm: Action;
@@ -195,6 +195,21 @@ declare const useDialog: () => {
195
195
  close: () => void;
196
196
  };
197
197
 
198
+ type ConfirmationDialogProps = Pick<DialogProps, 'open' | 'onClose' | 'children'>;
199
+ declare const ConfirmationDialog: {
200
+ ({ open, onClose, children }: ConfirmationDialogProps): React$1.JSX.Element;
201
+ Title: ({ children }: React$1.PropsWithChildren) => React$1.JSX.Element;
202
+ Content: ({ children }: React$1.PropsWithChildren) => React$1.JSX.Element;
203
+ ContentText: (props: DialogContentTextProps) => React$1.JSX.Element;
204
+ Actions: ({ onClose, onConfirm, cancelLabel, confirmLabel, }: ConfirmationDialogActionsProps) => React$1.JSX.Element;
205
+ };
206
+ type ConfirmationDialogActionsProps = {
207
+ onClose: () => void;
208
+ onConfirm: () => void;
209
+ cancelLabel?: string;
210
+ confirmLabel?: string;
211
+ };
212
+
198
213
  type UseEditableParams = {
199
214
  value: string;
200
215
  onSubmit: (value: string) => unknown;
@@ -221,4 +236,4 @@ declare const useEditable: ({ value, onSubmit, validation, onClick, onError }: U
221
236
  };
222
237
  };
223
238
 
224
- 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 };
239
+ export { CollapseIcon, ConfirmationDialog, CtaButton, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, PromotionChip, PromotionInfotip, PromotionPopover, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
package/dist/index.d.ts CHANGED
@@ -176,13 +176,13 @@ declare const SaveChangesDialog: {
176
176
  }) => React$1.JSX.Element;
177
177
  Content: ({ children }: React$1.PropsWithChildren) => React$1.JSX.Element;
178
178
  ContentText: (props: DialogContentTextProps) => React$1.JSX.Element;
179
- Actions: ({ actions }: ConfirmationDialogActionsProps) => React$1.JSX.Element;
179
+ Actions: ({ actions }: ConfirmationDialogActionsProps$1) => React$1.JSX.Element;
180
180
  };
181
181
  type Action = {
182
182
  label: string;
183
183
  action: () => void | Promise<void>;
184
184
  };
185
- type ConfirmationDialogActionsProps = {
185
+ type ConfirmationDialogActionsProps$1 = {
186
186
  actions: {
187
187
  cancel?: Action;
188
188
  confirm: Action;
@@ -195,6 +195,21 @@ declare const useDialog: () => {
195
195
  close: () => void;
196
196
  };
197
197
 
198
+ type ConfirmationDialogProps = Pick<DialogProps, 'open' | 'onClose' | 'children'>;
199
+ declare const ConfirmationDialog: {
200
+ ({ open, onClose, children }: ConfirmationDialogProps): React$1.JSX.Element;
201
+ Title: ({ children }: React$1.PropsWithChildren) => React$1.JSX.Element;
202
+ Content: ({ children }: React$1.PropsWithChildren) => React$1.JSX.Element;
203
+ ContentText: (props: DialogContentTextProps) => React$1.JSX.Element;
204
+ Actions: ({ onClose, onConfirm, cancelLabel, confirmLabel, }: ConfirmationDialogActionsProps) => React$1.JSX.Element;
205
+ };
206
+ type ConfirmationDialogActionsProps = {
207
+ onClose: () => void;
208
+ onConfirm: () => void;
209
+ cancelLabel?: string;
210
+ confirmLabel?: string;
211
+ };
212
+
198
213
  type UseEditableParams = {
199
214
  value: string;
200
215
  onSubmit: (value: string) => unknown;
@@ -221,4 +236,4 @@ declare const useEditable: ({ value, onSubmit, validation, onClick, onError }: U
221
236
  };
222
237
  };
223
238
 
224
- 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 };
239
+ export { CollapseIcon, ConfirmationDialog, CtaButton, EditableField, EllipsisWithTooltip, Form, GlobalDialog, ITEM_HEIGHT, InfoAlert, InfoTipCard, IntroductionModal, MenuItemInfotip, MenuListItem, PopoverBody, PopoverHeader, PopoverMenuList, type PopoverMenuListProps, PromotionChip, PromotionInfotip, PromotionPopover, SaveChangesDialog, SearchField, StyledMenuList, ThemeProvider, type VirtualizedItem, WarningInfotip, closeDialog, openDialog, useDialog, useEditable };
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
+ ConfirmationDialog: () => ConfirmationDialog,
34
35
  CtaButton: () => CtaButton,
35
36
  EditableField: () => EditableField,
36
37
  EllipsisWithTooltip: () => EllipsisWithTooltip,
@@ -857,6 +858,27 @@ var useDialog = () => {
857
858
  return { isOpen, open, close };
858
859
  };
859
860
 
861
+ // src/components/confirmation-dialog.tsx
862
+ var React20 = __toESM(require("react"));
863
+ var import_icons8 = require("@elementor/icons");
864
+ var import_ui20 = require("@elementor/ui");
865
+ var import_i18n4 = require("@wordpress/i18n");
866
+ var TITLE_ID2 = "confirmation-dialog";
867
+ var ConfirmationDialog = ({ open, onClose, children }) => /* @__PURE__ */ React20.createElement(import_ui20.Dialog, { open, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "xs" }, children);
868
+ var ConfirmationDialogTitle = ({ children }) => /* @__PURE__ */ React20.createElement(import_ui20.DialogTitle, { id: TITLE_ID2, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React20.createElement(import_icons8.AlertOctagonFilledIcon, { color: "error" }), children);
869
+ var ConfirmationDialogContent = ({ children }) => /* @__PURE__ */ React20.createElement(import_ui20.DialogContent, null, children);
870
+ var ConfirmationDialogContentText = (props) => /* @__PURE__ */ React20.createElement(import_ui20.DialogContentText, { variant: "body2", color: "textPrimary", ...props });
871
+ var ConfirmationDialogActions = ({
872
+ onClose,
873
+ onConfirm,
874
+ cancelLabel,
875
+ confirmLabel
876
+ }) => /* @__PURE__ */ React20.createElement(import_ui20.DialogActions, null, /* @__PURE__ */ React20.createElement(import_ui20.Button, { color: "secondary", onClick: onClose }, cancelLabel ?? (0, import_i18n4.__)("Not now", "elementor")), /* @__PURE__ */ React20.createElement(import_ui20.Button, { autoFocus: true, variant: "contained", color: "error", onClick: onConfirm }, confirmLabel ?? (0, import_i18n4.__)("Delete", "elementor")));
877
+ ConfirmationDialog.Title = ConfirmationDialogTitle;
878
+ ConfirmationDialog.Content = ConfirmationDialogContent;
879
+ ConfirmationDialog.ContentText = ConfirmationDialogContentText;
880
+ ConfirmationDialog.Actions = ConfirmationDialogActions;
881
+
860
882
  // src/hooks/use-editable.ts
861
883
  var import_react14 = require("react");
862
884
  var useEditable = ({ value, onSubmit, validation, onClick, onError }) => {
@@ -964,6 +986,7 @@ var selectAll = (el) => {
964
986
  // Annotate the CommonJS export names for ESM import in node:
965
987
  0 && (module.exports = {
966
988
  CollapseIcon,
989
+ ConfirmationDialog,
967
990
  CtaButton,
968
991
  EditableField,
969
992
  EllipsisWithTooltip,
package/dist/index.mjs CHANGED
@@ -840,6 +840,34 @@ var useDialog = () => {
840
840
  return { isOpen, open, close };
841
841
  };
842
842
 
843
+ // src/components/confirmation-dialog.tsx
844
+ import * as React20 from "react";
845
+ import { AlertOctagonFilledIcon } from "@elementor/icons";
846
+ import {
847
+ Button as Button5,
848
+ Dialog as Dialog4,
849
+ DialogActions as DialogActions3,
850
+ DialogContent as DialogContent2,
851
+ DialogContentText as DialogContentText2,
852
+ DialogTitle as DialogTitle3
853
+ } from "@elementor/ui";
854
+ import { __ as __4 } from "@wordpress/i18n";
855
+ var TITLE_ID2 = "confirmation-dialog";
856
+ var ConfirmationDialog = ({ open, onClose, children }) => /* @__PURE__ */ React20.createElement(Dialog4, { open, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "xs" }, children);
857
+ var ConfirmationDialogTitle = ({ children }) => /* @__PURE__ */ React20.createElement(DialogTitle3, { id: TITLE_ID2, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React20.createElement(AlertOctagonFilledIcon, { color: "error" }), children);
858
+ var ConfirmationDialogContent = ({ children }) => /* @__PURE__ */ React20.createElement(DialogContent2, null, children);
859
+ var ConfirmationDialogContentText = (props) => /* @__PURE__ */ React20.createElement(DialogContentText2, { variant: "body2", color: "textPrimary", ...props });
860
+ var ConfirmationDialogActions = ({
861
+ onClose,
862
+ onConfirm,
863
+ cancelLabel,
864
+ confirmLabel
865
+ }) => /* @__PURE__ */ React20.createElement(DialogActions3, null, /* @__PURE__ */ React20.createElement(Button5, { color: "secondary", onClick: onClose }, cancelLabel ?? __4("Not now", "elementor")), /* @__PURE__ */ React20.createElement(Button5, { autoFocus: true, variant: "contained", color: "error", onClick: onConfirm }, confirmLabel ?? __4("Delete", "elementor")));
866
+ ConfirmationDialog.Title = ConfirmationDialogTitle;
867
+ ConfirmationDialog.Content = ConfirmationDialogContent;
868
+ ConfirmationDialog.ContentText = ConfirmationDialogContentText;
869
+ ConfirmationDialog.Actions = ConfirmationDialogActions;
870
+
843
871
  // src/hooks/use-editable.ts
844
872
  import { useEffect as useEffect7, useRef as useRef4, useState as useState7 } from "react";
845
873
  var useEditable = ({ value, onSubmit, validation, onClick, onError }) => {
@@ -946,6 +974,7 @@ var selectAll = (el) => {
946
974
  };
947
975
  export {
948
976
  CollapseIcon,
977
+ ConfirmationDialog,
949
978
  CtaButton,
950
979
  EditableField,
951
980
  EllipsisWithTooltip,
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-427",
4
+ "version": "3.35.0-428",
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-427",
40
+ "@elementor/editor-v1-adapters": "3.35.0-428",
41
41
  "@elementor/icons": "^1.63.0",
42
42
  "@elementor/ui": "1.36.17",
43
43
  "@tanstack/react-virtual": "^3.13.3",
@@ -0,0 +1,67 @@
1
+ import * as React from 'react';
2
+ import { AlertOctagonFilledIcon } from '@elementor/icons';
3
+ import {
4
+ Button,
5
+ Dialog,
6
+ DialogActions,
7
+ DialogContent,
8
+ DialogContentText,
9
+ type DialogContentTextProps,
10
+ type DialogProps,
11
+ DialogTitle,
12
+ } from '@elementor/ui';
13
+ import { __ } from '@wordpress/i18n';
14
+
15
+ const TITLE_ID = 'confirmation-dialog';
16
+
17
+ type ConfirmationDialogProps = Pick< DialogProps, 'open' | 'onClose' | 'children' >;
18
+
19
+ export const ConfirmationDialog = ( { open, onClose, children }: ConfirmationDialogProps ) => (
20
+ <Dialog open={ open } onClose={ onClose } aria-labelledby={ TITLE_ID } maxWidth="xs">
21
+ { children }
22
+ </Dialog>
23
+ );
24
+
25
+ const ConfirmationDialogTitle = ( { children }: React.PropsWithChildren ) => (
26
+ <DialogTitle id={ TITLE_ID } display="flex" alignItems="center" gap={ 1 } sx={ { lineHeight: 1 } }>
27
+ <AlertOctagonFilledIcon color="error" />
28
+ { children }
29
+ </DialogTitle>
30
+ );
31
+
32
+ const ConfirmationDialogContent = ( { children }: React.PropsWithChildren ) => (
33
+ <DialogContent>{ children }</DialogContent>
34
+ );
35
+
36
+ const ConfirmationDialogContentText = ( props: DialogContentTextProps ) => (
37
+ <DialogContentText variant="body2" color="textPrimary" { ...props } />
38
+ );
39
+
40
+ type ConfirmationDialogActionsProps = {
41
+ onClose: () => void;
42
+ onConfirm: () => void;
43
+ cancelLabel?: string;
44
+ confirmLabel?: string;
45
+ };
46
+
47
+ const ConfirmationDialogActions = ( {
48
+ onClose,
49
+ onConfirm,
50
+ cancelLabel,
51
+ confirmLabel,
52
+ }: ConfirmationDialogActionsProps ) => (
53
+ <DialogActions>
54
+ <Button color="secondary" onClick={ onClose }>
55
+ { cancelLabel ?? __( 'Not now', 'elementor' ) }
56
+ </Button>
57
+ { /* eslint-disable-next-line jsx-a11y/no-autofocus */ }
58
+ <Button autoFocus variant="contained" color="error" onClick={ onConfirm }>
59
+ { confirmLabel ?? __( 'Delete', 'elementor' ) }
60
+ </Button>
61
+ </DialogActions>
62
+ );
63
+
64
+ ConfirmationDialog.Title = ConfirmationDialogTitle;
65
+ ConfirmationDialog.Content = ConfirmationDialogContent;
66
+ ConfirmationDialog.ContentText = ConfirmationDialogContentText;
67
+ ConfirmationDialog.Actions = ConfirmationDialogActions;
package/src/index.ts CHANGED
@@ -18,6 +18,7 @@ export { PromotionChip } from './components/promotion-chip';
18
18
 
19
19
  export * from './components/popover';
20
20
  export * from './components/save-changes-dialog';
21
+ export { ConfirmationDialog } from './components/confirmation-dialog';
21
22
 
22
23
  // hooks
23
24
  export { useEditable } from './hooks/use-editable';