@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/dist/index.js +33 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/components/class-manager/delete-confirmation-dialog.tsx +20 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-global-classes",
|
|
3
|
-
"version": "3.35.0-
|
|
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-
|
|
43
|
-
"@elementor/editor-current-user": "3.35.0-
|
|
44
|
-
"@elementor/editor-documents": "3.35.0-
|
|
45
|
-
"@elementor/editor-editing-panel": "3.35.0-
|
|
46
|
-
"@elementor/editor-mcp": "3.35.0-
|
|
47
|
-
"@elementor/editor-panels": "3.35.0-
|
|
48
|
-
"@elementor/editor-props": "3.35.0-
|
|
49
|
-
"@elementor/editor-variables": "3.35.0-
|
|
50
|
-
"@elementor/editor-styles": "3.35.0-
|
|
51
|
-
"@elementor/editor-canvas": "3.35.0-
|
|
52
|
-
"@elementor/editor-styles-repository": "3.35.0-
|
|
53
|
-
"@elementor/editor-ui": "3.35.0-
|
|
54
|
-
"@elementor/editor-v1-adapters": "3.35.0-
|
|
55
|
-
"@elementor/http-client": "3.35.0-
|
|
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-
|
|
58
|
-
"@elementor/schema": "3.35.0-
|
|
59
|
-
"@elementor/store": "3.35.0-
|
|
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-
|
|
61
|
+
"@elementor/utils": "3.35.0-428",
|
|
62
62
|
"@wordpress/i18n": "^5.13.0",
|
|
63
|
-
"@elementor/mixpanel": "3.35.0-
|
|
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 {
|
|
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
|
|
11
|
+
type DeleteClassDialogProps = Pick< StyleDefinition, 'id' | 'label' >;
|
|
20
12
|
|
|
21
13
|
type DeleteConfirmationContext = {
|
|
22
|
-
openDialog: ( props:
|
|
14
|
+
openDialog: ( props: DeleteClassDialogProps ) => void;
|
|
23
15
|
closeDialog: () => void;
|
|
24
|
-
dialogProps:
|
|
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<
|
|
22
|
+
const [ dialogProps, setDialogProps ] = useState< DeleteClassDialogProps | null >( null );
|
|
31
23
|
|
|
32
|
-
const openDialog = ( props:
|
|
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 && <
|
|
35
|
+
{ !! dialogProps && <DeleteClassDialog { ...dialogProps } /> }
|
|
44
36
|
</context.Provider>
|
|
45
37
|
);
|
|
46
38
|
};
|
|
47
39
|
|
|
48
|
-
const
|
|
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
|
-
|
|
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
|
-
<
|
|
76
|
-
<
|
|
77
|
-
|
|
78
|
-
|
|
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
|
{ label }
|
|
85
73
|
</Typography>
|
|
86
74
|
{ text }
|
|
87
|
-
</
|
|
88
|
-
</
|
|
89
|
-
<
|
|
90
|
-
|
|
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
|
|