@elementor/editor-global-classes 3.33.0-118 → 3.33.0-119
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 +38 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -61
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/class-manager/class-manager-button.tsx +1 -1
- package/src/components/class-manager/class-manager-panel.tsx +1 -2
- package/src/components/class-manager/save-changes-dialog.tsx +0 -92
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-global-classes",
|
|
3
|
-
"version": "3.33.0-
|
|
3
|
+
"version": "3.33.0-119",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -39,22 +39,22 @@
|
|
|
39
39
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@elementor/editor": "3.33.0-
|
|
43
|
-
"@elementor/editor-current-user": "3.33.0-
|
|
44
|
-
"@elementor/editor-documents": "3.33.0-
|
|
45
|
-
"@elementor/editor-editing-panel": "3.33.0-
|
|
46
|
-
"@elementor/editor-panels": "3.33.0-
|
|
47
|
-
"@elementor/editor-props": "3.33.0-
|
|
48
|
-
"@elementor/editor-styles": "3.33.0-
|
|
49
|
-
"@elementor/editor-styles-repository": "3.33.0-
|
|
50
|
-
"@elementor/editor-ui": "3.33.0-
|
|
51
|
-
"@elementor/editor-v1-adapters": "3.33.0-
|
|
52
|
-
"@elementor/http-client": "3.33.0-
|
|
42
|
+
"@elementor/editor": "3.33.0-119",
|
|
43
|
+
"@elementor/editor-current-user": "3.33.0-119",
|
|
44
|
+
"@elementor/editor-documents": "3.33.0-119",
|
|
45
|
+
"@elementor/editor-editing-panel": "3.33.0-119",
|
|
46
|
+
"@elementor/editor-panels": "3.33.0-119",
|
|
47
|
+
"@elementor/editor-props": "3.33.0-119",
|
|
48
|
+
"@elementor/editor-styles": "3.33.0-119",
|
|
49
|
+
"@elementor/editor-styles-repository": "3.33.0-119",
|
|
50
|
+
"@elementor/editor-ui": "3.33.0-119",
|
|
51
|
+
"@elementor/editor-v1-adapters": "3.33.0-119",
|
|
52
|
+
"@elementor/http-client": "3.33.0-119",
|
|
53
53
|
"@elementor/icons": "1.46.0",
|
|
54
|
-
"@elementor/query": "3.33.0-
|
|
55
|
-
"@elementor/store": "3.33.0-
|
|
54
|
+
"@elementor/query": "3.33.0-119",
|
|
55
|
+
"@elementor/store": "3.33.0-119",
|
|
56
56
|
"@elementor/ui": "1.36.12",
|
|
57
|
-
"@elementor/utils": "3.33.0-
|
|
57
|
+
"@elementor/utils": "3.33.0-119",
|
|
58
58
|
"@wordpress/i18n": "^5.13.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
__useActiveDocumentActions as useActiveDocumentActions,
|
|
5
5
|
} from '@elementor/editor-documents';
|
|
6
6
|
import { useUserStylesCapability } from '@elementor/editor-styles-repository';
|
|
7
|
+
import { SaveChangesDialog, useDialog } from '@elementor/editor-ui';
|
|
7
8
|
import { IconButton, Tooltip } from '@elementor/ui';
|
|
8
9
|
import { __ } from '@wordpress/i18n';
|
|
9
10
|
|
|
@@ -11,7 +12,6 @@ import { globalClassesStylesProvider } from '../../global-classes-styles-provide
|
|
|
11
12
|
import { usePrefetchCssClassUsage } from '../../hooks/use-prefetch-css-class-usage';
|
|
12
13
|
import { usePanelActions } from './class-manager-panel';
|
|
13
14
|
import { FlippedColorSwatchIcon } from './flipped-color-swatch-icon';
|
|
14
|
-
import { SaveChangesDialog, useDialog } from './save-changes-dialog';
|
|
15
15
|
|
|
16
16
|
export const ClassManagerButton = () => {
|
|
17
17
|
const document = useActiveDocument();
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
PanelHeader,
|
|
10
10
|
PanelHeaderTitle,
|
|
11
11
|
} from '@elementor/editor-panels';
|
|
12
|
-
import { ThemeProvider } from '@elementor/editor-ui';
|
|
12
|
+
import { SaveChangesDialog, ThemeProvider, useDialog } from '@elementor/editor-ui';
|
|
13
13
|
import { changeEditMode } from '@elementor/editor-v1-adapters';
|
|
14
14
|
import { XIcon } from '@elementor/icons';
|
|
15
15
|
import { useMutation } from '@elementor/query';
|
|
@@ -42,7 +42,6 @@ import { hasDeletedItems, onDelete } from './delete-class';
|
|
|
42
42
|
import { FlippedColorSwatchIcon } from './flipped-color-swatch-icon';
|
|
43
43
|
import { GlobalClassesList } from './global-classes-list';
|
|
44
44
|
import { blockPanelInteractions, unblockPanelInteractions } from './panel-interactions';
|
|
45
|
-
import { SaveChangesDialog, useDialog } from './save-changes-dialog';
|
|
46
45
|
|
|
47
46
|
const id = 'global-classes-manager';
|
|
48
47
|
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { AlertTriangleFilledIcon } from '@elementor/icons';
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
Dialog,
|
|
7
|
-
DialogActions,
|
|
8
|
-
DialogContent,
|
|
9
|
-
DialogContentText,
|
|
10
|
-
type DialogContentTextProps,
|
|
11
|
-
type DialogProps,
|
|
12
|
-
DialogTitle,
|
|
13
|
-
} from '@elementor/ui';
|
|
14
|
-
|
|
15
|
-
const TITLE_ID = 'save-changes-dialog';
|
|
16
|
-
|
|
17
|
-
const SaveChangesDialog = ( { children, onClose }: Pick< DialogProps, 'children' | 'onClose' > ) => (
|
|
18
|
-
<Dialog open onClose={ onClose } aria-labelledby={ TITLE_ID } maxWidth="xs">
|
|
19
|
-
{ children }
|
|
20
|
-
</Dialog>
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
const SaveChangesDialogTitle = ( { children }: React.PropsWithChildren ) => (
|
|
24
|
-
<DialogTitle id={ TITLE_ID } display="flex" alignItems="center" gap={ 1 } sx={ { lineHeight: 1 } }>
|
|
25
|
-
<AlertTriangleFilledIcon color="secondary" />
|
|
26
|
-
{ children }
|
|
27
|
-
</DialogTitle>
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
const SaveChangesDialogContent = ( { children }: React.PropsWithChildren ) => (
|
|
31
|
-
<DialogContent>{ children }</DialogContent>
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
const SaveChangesDialogContentText = ( props: DialogContentTextProps ) => (
|
|
35
|
-
<DialogContentText variant="body2" color="textPrimary" display="flex" flexDirection="column" { ...props } />
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
type Action = {
|
|
39
|
-
label: string;
|
|
40
|
-
action: () => void | Promise< void >;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
type ConfirmationDialogActionsProps = {
|
|
44
|
-
actions: {
|
|
45
|
-
cancel?: Action;
|
|
46
|
-
confirm: Action;
|
|
47
|
-
discard?: Action;
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
const SaveChangesDialogActions = ( { actions }: ConfirmationDialogActionsProps ) => {
|
|
51
|
-
const [ isConfirming, setIsConfirming ] = useState( false );
|
|
52
|
-
const { cancel, confirm, discard } = actions;
|
|
53
|
-
|
|
54
|
-
const onConfirm = async () => {
|
|
55
|
-
setIsConfirming( true );
|
|
56
|
-
await confirm.action();
|
|
57
|
-
setIsConfirming( false );
|
|
58
|
-
};
|
|
59
|
-
return (
|
|
60
|
-
<DialogActions>
|
|
61
|
-
{ cancel && (
|
|
62
|
-
<Button variant="text" color="secondary" onClick={ cancel.action }>
|
|
63
|
-
{ cancel.label }
|
|
64
|
-
</Button>
|
|
65
|
-
) }
|
|
66
|
-
{ discard && (
|
|
67
|
-
<Button variant="text" color="secondary" onClick={ discard.action }>
|
|
68
|
-
{ discard.label }
|
|
69
|
-
</Button>
|
|
70
|
-
) }
|
|
71
|
-
<Button variant="contained" color="secondary" onClick={ onConfirm } loading={ isConfirming }>
|
|
72
|
-
{ confirm.label }
|
|
73
|
-
</Button>
|
|
74
|
-
</DialogActions>
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
SaveChangesDialog.Title = SaveChangesDialogTitle;
|
|
79
|
-
SaveChangesDialog.Content = SaveChangesDialogContent;
|
|
80
|
-
SaveChangesDialog.ContentText = SaveChangesDialogContentText;
|
|
81
|
-
SaveChangesDialog.Actions = SaveChangesDialogActions;
|
|
82
|
-
|
|
83
|
-
const useDialog = () => {
|
|
84
|
-
const [ isOpen, setIsOpen ] = useState( false );
|
|
85
|
-
|
|
86
|
-
const open = () => setIsOpen( true );
|
|
87
|
-
const close = () => setIsOpen( false );
|
|
88
|
-
|
|
89
|
-
return { isOpen, open, close };
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export { SaveChangesDialog, useDialog };
|