@elementor/editor-global-classes 3.35.0-426 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-global-classes",
3
- "version": "3.35.0-426",
3
+ "version": "3.35.0-428",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,28 +39,28 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "3.35.0-426",
43
- "@elementor/editor-current-user": "3.35.0-426",
44
- "@elementor/editor-documents": "3.35.0-426",
45
- "@elementor/editor-editing-panel": "3.35.0-426",
46
- "@elementor/editor-mcp": "3.35.0-426",
47
- "@elementor/editor-panels": "3.35.0-426",
48
- "@elementor/editor-props": "3.35.0-426",
49
- "@elementor/editor-variables": "3.35.0-426",
50
- "@elementor/editor-styles": "3.35.0-426",
51
- "@elementor/editor-canvas": "3.35.0-426",
52
- "@elementor/editor-styles-repository": "3.35.0-426",
53
- "@elementor/editor-ui": "3.35.0-426",
54
- "@elementor/editor-v1-adapters": "3.35.0-426",
55
- "@elementor/http-client": "3.35.0-426",
42
+ "@elementor/editor": "3.35.0-428",
43
+ "@elementor/editor-current-user": "3.35.0-428",
44
+ "@elementor/editor-documents": "3.35.0-428",
45
+ "@elementor/editor-editing-panel": "3.35.0-428",
46
+ "@elementor/editor-mcp": "3.35.0-428",
47
+ "@elementor/editor-panels": "3.35.0-428",
48
+ "@elementor/editor-props": "3.35.0-428",
49
+ "@elementor/editor-variables": "3.35.0-428",
50
+ "@elementor/editor-styles": "3.35.0-428",
51
+ "@elementor/editor-canvas": "3.35.0-428",
52
+ "@elementor/editor-styles-repository": "3.35.0-428",
53
+ "@elementor/editor-ui": "3.35.0-428",
54
+ "@elementor/editor-v1-adapters": "3.35.0-428",
55
+ "@elementor/http-client": "3.35.0-428",
56
56
  "@elementor/icons": "^1.63.0",
57
- "@elementor/query": "3.35.0-426",
58
- "@elementor/schema": "3.35.0-426",
59
- "@elementor/store": "3.35.0-426",
57
+ "@elementor/query": "3.35.0-428",
58
+ "@elementor/schema": "3.35.0-428",
59
+ "@elementor/store": "3.35.0-428",
60
60
  "@elementor/ui": "1.36.17",
61
- "@elementor/utils": "3.35.0-426",
61
+ "@elementor/utils": "3.35.0-428",
62
62
  "@wordpress/i18n": "^5.13.0",
63
- "@elementor/mixpanel": "3.35.0-426"
63
+ "@elementor/mixpanel": "3.35.0-428"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "react": "^18.3.1",
@@ -1,35 +1,27 @@
1
1
  import * as React from 'react';
2
2
  import { createContext, useContext, useState } from 'react';
3
3
  import { type StyleDefinition } from '@elementor/editor-styles';
4
- import { AlertOctagonFilledIcon } from '@elementor/icons';
5
- import {
6
- Button,
7
- Dialog,
8
- DialogActions,
9
- DialogContent,
10
- DialogContentText,
11
- DialogTitle,
12
- Typography,
13
- } from '@elementor/ui';
4
+ import { ConfirmationDialog } from '@elementor/editor-ui';
5
+ import { Typography } from '@elementor/ui';
14
6
  import { __ } from '@wordpress/i18n';
15
7
 
16
8
  import { useCssClassUsageByID } from '../../hooks/use-css-class-usage-by-id';
17
9
  import { deleteClass } from './delete-class';
18
10
 
19
- type DeleteConfirmationDialogProps = Pick< StyleDefinition, 'id' | 'label' >;
11
+ type DeleteClassDialogProps = Pick< StyleDefinition, 'id' | 'label' >;
20
12
 
21
13
  type DeleteConfirmationContext = {
22
- openDialog: ( props: DeleteConfirmationDialogProps ) => void;
14
+ openDialog: ( props: DeleteClassDialogProps ) => void;
23
15
  closeDialog: () => void;
24
- dialogProps: DeleteConfirmationDialogProps | null;
16
+ dialogProps: DeleteClassDialogProps | null;
25
17
  };
26
18
 
27
19
  const context = createContext< DeleteConfirmationContext | null >( null );
28
20
 
29
21
  export const DeleteConfirmationProvider = ( { children }: React.PropsWithChildren ) => {
30
- const [ dialogProps, setDialogProps ] = useState< DeleteConfirmationDialogProps | null >( null );
22
+ const [ dialogProps, setDialogProps ] = useState< DeleteClassDialogProps | null >( null );
31
23
 
32
- const openDialog = ( props: DeleteConfirmationDialogProps ) => {
24
+ const openDialog = ( props: DeleteClassDialogProps ) => {
33
25
  setDialogProps( props );
34
26
  };
35
27
 
@@ -40,23 +32,22 @@ export const DeleteConfirmationProvider = ( { children }: React.PropsWithChildre
40
32
  return (
41
33
  <context.Provider value={ { openDialog, closeDialog, dialogProps } }>
42
34
  { children }
43
- { !! dialogProps && <DeleteConfirmationDialog { ...dialogProps } /> }
35
+ { !! dialogProps && <DeleteClassDialog { ...dialogProps } /> }
44
36
  </context.Provider>
45
37
  );
46
38
  };
47
39
 
48
- const TITLE_ID = 'delete-class-dialog';
49
-
50
- const DeleteConfirmationDialog = ( { label, id }: DeleteConfirmationDialogProps ) => {
40
+ const DeleteClassDialog = ( { label, id }: DeleteClassDialogProps ) => {
51
41
  const { closeDialog } = useDeleteConfirmation();
52
42
  const {
53
43
  data: { total, content },
54
44
  } = useCssClassUsageByID( id );
55
- const onConfirm = () => {
56
- //
45
+
46
+ const handleConfirm = () => {
57
47
  closeDialog();
58
48
  deleteClass( id );
59
49
  };
50
+
60
51
  // translators: %1: total usage count, %2: number of pages
61
52
  const text =
62
53
  total && content.length
@@ -72,36 +63,19 @@ const DeleteConfirmationDialog = ( { label, id }: DeleteConfirmationDialogProps
72
63
  );
73
64
 
74
65
  return (
75
- <Dialog open onClose={ closeDialog } aria-labelledby={ TITLE_ID } maxWidth="xs">
76
- <DialogTitle id={ TITLE_ID } display="flex" alignItems="center" gap={ 1 } sx={ { lineHeight: 1 } }>
77
- <AlertOctagonFilledIcon color="error" />
78
- { __( 'Delete this class?', 'elementor' ) }
79
- </DialogTitle>
80
- <DialogContent>
81
- <DialogContentText variant="body2" color="textPrimary">
66
+ <ConfirmationDialog open onClose={ closeDialog }>
67
+ <ConfirmationDialog.Title>{ __( 'Delete this class?', 'elementor' ) }</ConfirmationDialog.Title>
68
+ <ConfirmationDialog.Content>
69
+ <ConfirmationDialog.ContentText>
82
70
  { __( 'Deleting', 'elementor' ) }
83
71
  <Typography variant="subtitle2" component="span">
84
72
  &nbsp;{ label }&nbsp;
85
73
  </Typography>
86
74
  { text }
87
- </DialogContentText>
88
- </DialogContent>
89
- <DialogActions>
90
- <Button color="secondary" onClick={ closeDialog }>
91
- { __( 'Not now', 'elementor' ) }
92
- </Button>
93
-
94
- <Button
95
- // eslint-disable-next-line jsx-a11y/no-autofocus
96
- autoFocus
97
- variant="contained"
98
- color="error"
99
- onClick={ onConfirm }
100
- >
101
- { __( 'Delete', 'elementor' ) }
102
- </Button>
103
- </DialogActions>
104
- </Dialog>
75
+ </ConfirmationDialog.ContentText>
76
+ </ConfirmationDialog.Content>
77
+ <ConfirmationDialog.Actions onClose={ closeDialog } onConfirm={ handleConfirm } />
78
+ </ConfirmationDialog>
105
79
  );
106
80
  };
107
81