@elementor/editor-variables 4.0.0-564 → 4.0.0-591
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 +542 -549
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +399 -416
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
- package/src/components/variables-manager/variables-manager-panel.tsx +53 -5
- package/src/components/ui/stop-sync-confirmation-dialog.tsx +0 -77
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-variables",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-591",
|
|
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": "4.0.0-
|
|
43
|
-
"@elementor/editor-canvas": "4.0.0-
|
|
44
|
-
"@elementor/editor-controls": "4.0.0-
|
|
45
|
-
"@elementor/editor-current-user": "4.0.0-
|
|
46
|
-
"@elementor/editor-mcp": "4.0.0-
|
|
47
|
-
"@elementor/editor-panels": "4.0.0-
|
|
48
|
-
"@elementor/editor-props": "4.0.0-
|
|
49
|
-
"@elementor/editor-ui": "4.0.0-
|
|
50
|
-
"@elementor/editor-v1-adapters": "4.0.0-
|
|
51
|
-
"@elementor/menus": "4.0.0-
|
|
52
|
-
"@elementor/http-client": "4.0.0-
|
|
42
|
+
"@elementor/editor": "4.0.0-591",
|
|
43
|
+
"@elementor/editor-canvas": "4.0.0-591",
|
|
44
|
+
"@elementor/editor-controls": "4.0.0-591",
|
|
45
|
+
"@elementor/editor-current-user": "4.0.0-591",
|
|
46
|
+
"@elementor/editor-mcp": "4.0.0-591",
|
|
47
|
+
"@elementor/editor-panels": "4.0.0-591",
|
|
48
|
+
"@elementor/editor-props": "4.0.0-591",
|
|
49
|
+
"@elementor/editor-ui": "4.0.0-591",
|
|
50
|
+
"@elementor/editor-v1-adapters": "4.0.0-591",
|
|
51
|
+
"@elementor/menus": "4.0.0-591",
|
|
52
|
+
"@elementor/http-client": "4.0.0-591",
|
|
53
53
|
"@elementor/icons": "^1.63.0",
|
|
54
|
-
"@elementor/events": "4.0.0-
|
|
55
|
-
"@elementor/schema": "4.0.0-
|
|
54
|
+
"@elementor/events": "4.0.0-591",
|
|
55
|
+
"@elementor/schema": "4.0.0-591",
|
|
56
56
|
"@elementor/ui": "1.37.2",
|
|
57
|
-
"@elementor/utils": "4.0.0-
|
|
57
|
+
"@elementor/utils": "4.0.0-591",
|
|
58
58
|
"@wordpress/i18n": "^5.13.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { useSuppressedMessage } from '@elementor/editor-current-user';
|
|
3
4
|
import {
|
|
4
5
|
__createPanel as createPanel,
|
|
5
6
|
Panel,
|
|
@@ -8,7 +9,7 @@ import {
|
|
|
8
9
|
PanelHeader,
|
|
9
10
|
PanelHeaderTitle,
|
|
10
11
|
} from '@elementor/editor-panels';
|
|
11
|
-
import { SaveChangesDialog, SearchField, ThemeProvider, useDialog } from '@elementor/editor-ui';
|
|
12
|
+
import { ConfirmationDialog, SaveChangesDialog, SearchField, ThemeProvider, useDialog } from '@elementor/editor-ui';
|
|
12
13
|
import { changeEditMode } from '@elementor/editor-v1-adapters';
|
|
13
14
|
import { AlertTriangleFilledIcon, ColorFilterIcon, TrashIcon } from '@elementor/icons';
|
|
14
15
|
import {
|
|
@@ -30,7 +31,6 @@ import { getMenuActionsForVariable, getVariableType } from '../../variables-regi
|
|
|
30
31
|
import { DeleteConfirmationDialog } from '../ui/delete-confirmation-dialog';
|
|
31
32
|
import { EmptyState } from '../ui/empty-state';
|
|
32
33
|
import { NoSearchResults } from '../ui/no-search-results';
|
|
33
|
-
import { StopSyncConfirmationDialog } from '../ui/stop-sync-confirmation-dialog';
|
|
34
34
|
import { useAutoEdit } from './hooks/use-auto-edit';
|
|
35
35
|
import { useErrorNavigation } from './hooks/use-error-navigation';
|
|
36
36
|
import { useVariablesManagerState } from './hooks/use-variables-manager-state';
|
|
@@ -38,6 +38,13 @@ import { SIZE, VariableManagerCreateMenu } from './variables-manager-create-menu
|
|
|
38
38
|
import { VariablesManagerTable } from './variables-manager-table';
|
|
39
39
|
|
|
40
40
|
const id = 'variables-manager';
|
|
41
|
+
const STOP_SYNC_MESSAGE_KEY = 'stop-sync-variable';
|
|
42
|
+
|
|
43
|
+
type StopSyncConfirmationDialogProps = {
|
|
44
|
+
open: boolean;
|
|
45
|
+
onClose: () => void;
|
|
46
|
+
onConfirm: () => void;
|
|
47
|
+
};
|
|
41
48
|
|
|
42
49
|
export const { panel, usePanelActions } = createPanel( {
|
|
43
50
|
id,
|
|
@@ -55,6 +62,7 @@ export const { panel, usePanelActions } = createPanel( {
|
|
|
55
62
|
export function VariablesManagerPanel() {
|
|
56
63
|
const { close: closePanel } = usePanelActions();
|
|
57
64
|
const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
|
|
65
|
+
const [ isStopSyncSuppressed ] = useSuppressedMessage( STOP_SYNC_MESSAGE_KEY );
|
|
58
66
|
|
|
59
67
|
const createMenuState = usePopupState( {
|
|
60
68
|
variant: 'popover',
|
|
@@ -151,6 +159,17 @@ export function VariablesManagerPanel() {
|
|
|
151
159
|
[ handleStopSync ]
|
|
152
160
|
);
|
|
153
161
|
|
|
162
|
+
const handleShowStopSyncDialog = useCallback(
|
|
163
|
+
( itemId: string ) => {
|
|
164
|
+
if ( ! isStopSyncSuppressed ) {
|
|
165
|
+
setStopSyncConfirmation( itemId );
|
|
166
|
+
} else {
|
|
167
|
+
handleStopSync( itemId );
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
[ isStopSyncSuppressed, handleStopSync ]
|
|
171
|
+
);
|
|
172
|
+
|
|
154
173
|
const buildMenuActions = useCallback(
|
|
155
174
|
( variableId: string ) => {
|
|
156
175
|
const variable = variables[ variableId ];
|
|
@@ -163,7 +182,7 @@ export function VariablesManagerPanel() {
|
|
|
163
182
|
variableId,
|
|
164
183
|
handlers: {
|
|
165
184
|
onStartSync: handleStartSync,
|
|
166
|
-
onStopSync:
|
|
185
|
+
onStopSync: handleShowStopSyncDialog,
|
|
167
186
|
},
|
|
168
187
|
} );
|
|
169
188
|
|
|
@@ -184,7 +203,7 @@ export function VariablesManagerPanel() {
|
|
|
184
203
|
|
|
185
204
|
return [ ...typeActions, deleteAction ];
|
|
186
205
|
},
|
|
187
|
-
[ variables, handleStartSync ]
|
|
206
|
+
[ variables, handleStartSync, handleShowStopSyncDialog ]
|
|
188
207
|
);
|
|
189
208
|
|
|
190
209
|
const hasVariables = Object.keys( variables ).length > 0;
|
|
@@ -348,7 +367,7 @@ export function VariablesManagerPanel() {
|
|
|
348
367
|
{ stopSyncConfirmation && (
|
|
349
368
|
<StopSyncConfirmationDialog
|
|
350
369
|
open
|
|
351
|
-
|
|
370
|
+
onClose={ () => setStopSyncConfirmation( null ) }
|
|
352
371
|
onConfirm={ () => handleStopSyncWithConfirmation( stopSyncConfirmation ) }
|
|
353
372
|
/>
|
|
354
373
|
) }
|
|
@@ -405,3 +424,32 @@ const usePreventUnload = ( isDirty: boolean ) => {
|
|
|
405
424
|
};
|
|
406
425
|
}, [ isDirty ] );
|
|
407
426
|
};
|
|
427
|
+
|
|
428
|
+
const StopSyncConfirmationDialog = ( { open, onClose, onConfirm }: StopSyncConfirmationDialogProps ) => {
|
|
429
|
+
const [ , suppressStopSyncMessage ] = useSuppressedMessage( STOP_SYNC_MESSAGE_KEY );
|
|
430
|
+
|
|
431
|
+
return (
|
|
432
|
+
<ConfirmationDialog open={ open } onClose={ onClose }>
|
|
433
|
+
<ConfirmationDialog.Title icon={ ColorFilterIcon } iconColor="primary">
|
|
434
|
+
{ __( 'Stop syncing variable color', 'elementor' ) }
|
|
435
|
+
</ConfirmationDialog.Title>
|
|
436
|
+
<ConfirmationDialog.Content>
|
|
437
|
+
<ConfirmationDialog.ContentText>
|
|
438
|
+
{ __(
|
|
439
|
+
'This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.',
|
|
440
|
+
'elementor'
|
|
441
|
+
) }
|
|
442
|
+
</ConfirmationDialog.ContentText>
|
|
443
|
+
</ConfirmationDialog.Content>
|
|
444
|
+
<ConfirmationDialog.Actions
|
|
445
|
+
onClose={ onClose }
|
|
446
|
+
onConfirm={ onConfirm }
|
|
447
|
+
cancelLabel={ __( 'Cancel', 'elementor' ) }
|
|
448
|
+
confirmLabel={ __( 'Got it', 'elementor' ) }
|
|
449
|
+
color="primary"
|
|
450
|
+
onSuppressMessage={ suppressStopSyncMessage }
|
|
451
|
+
suppressLabel={ __( "Don't show again", 'elementor' ) }
|
|
452
|
+
/>
|
|
453
|
+
</ConfirmationDialog>
|
|
454
|
+
);
|
|
455
|
+
};
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { BrushIcon } from '@elementor/icons';
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
Checkbox,
|
|
7
|
-
Dialog,
|
|
8
|
-
DialogActions,
|
|
9
|
-
DialogContent,
|
|
10
|
-
DialogContentText,
|
|
11
|
-
DialogTitle,
|
|
12
|
-
FormControlLabel,
|
|
13
|
-
Typography,
|
|
14
|
-
} from '@elementor/ui';
|
|
15
|
-
import { __ } from '@wordpress/i18n';
|
|
16
|
-
|
|
17
|
-
type StopSyncConfirmationDialogProps = {
|
|
18
|
-
open: boolean;
|
|
19
|
-
closeDialog: () => void;
|
|
20
|
-
onConfirm: () => void;
|
|
21
|
-
onSuppressMessage?: () => void;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const StopSyncConfirmationDialog = ( {
|
|
25
|
-
open,
|
|
26
|
-
closeDialog,
|
|
27
|
-
onConfirm,
|
|
28
|
-
onSuppressMessage,
|
|
29
|
-
}: StopSyncConfirmationDialogProps ) => {
|
|
30
|
-
const [ dontShowAgain, setDontShowAgain ] = useState( false );
|
|
31
|
-
|
|
32
|
-
const handleConfirm = () => {
|
|
33
|
-
if ( dontShowAgain ) {
|
|
34
|
-
onSuppressMessage?.();
|
|
35
|
-
}
|
|
36
|
-
onConfirm();
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<Dialog open={ open } onClose={ closeDialog } maxWidth="xs">
|
|
41
|
-
<DialogTitle display="flex" alignItems="center" gap={ 1 }>
|
|
42
|
-
<BrushIcon color="secondary" />
|
|
43
|
-
{ __( 'Stop syncing variable color', 'elementor' ) }
|
|
44
|
-
</DialogTitle>
|
|
45
|
-
<DialogContent>
|
|
46
|
-
<DialogContentText variant="body2" color="textPrimary">
|
|
47
|
-
{ __(
|
|
48
|
-
'This will disconnect the variable color from version 3. Existing uses on your site will automatically switch to a default color.',
|
|
49
|
-
'elementor'
|
|
50
|
-
) }
|
|
51
|
-
</DialogContentText>
|
|
52
|
-
</DialogContent>
|
|
53
|
-
<DialogActions sx={ { justifyContent: 'space-between', alignItems: 'center' } }>
|
|
54
|
-
<FormControlLabel
|
|
55
|
-
control={
|
|
56
|
-
<Checkbox
|
|
57
|
-
checked={ dontShowAgain }
|
|
58
|
-
onChange={ ( event: React.ChangeEvent< HTMLInputElement > ) =>
|
|
59
|
-
setDontShowAgain( event.target.checked )
|
|
60
|
-
}
|
|
61
|
-
size="small"
|
|
62
|
-
/>
|
|
63
|
-
}
|
|
64
|
-
label={ <Typography variant="body2">{ __( "Don't show this again", 'elementor' ) }</Typography> }
|
|
65
|
-
/>
|
|
66
|
-
<div>
|
|
67
|
-
<Button color="secondary" onClick={ closeDialog }>
|
|
68
|
-
{ __( 'Cancel', 'elementor' ) }
|
|
69
|
-
</Button>
|
|
70
|
-
<Button variant="contained" color="secondary" onClick={ handleConfirm } sx={ { ml: 1 } }>
|
|
71
|
-
{ __( 'Got it', 'elementor' ) }
|
|
72
|
-
</Button>
|
|
73
|
-
</div>
|
|
74
|
-
</DialogActions>
|
|
75
|
-
</Dialog>
|
|
76
|
-
);
|
|
77
|
-
};
|