@elementor/editor-components 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,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-components",
3
3
  "description": "Elementor editor components",
4
- "version": "3.35.0-426",
4
+ "version": "3.35.0-428",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -40,30 +40,30 @@
40
40
  "dev": "tsup --config=../../tsup.dev.ts"
41
41
  },
42
42
  "dependencies": {
43
- "@elementor/editor": "3.35.0-426",
44
- "@elementor/editor-canvas": "3.35.0-426",
45
- "@elementor/editor-controls": "3.35.0-426",
46
- "@elementor/editor-documents": "3.35.0-426",
47
- "@elementor/editor-editing-panel": "3.35.0-426",
48
- "@elementor/editor-elements": "3.35.0-426",
49
- "@elementor/editor-elements-panel": "3.35.0-426",
50
- "@elementor/editor-mcp": "3.35.0-426",
51
- "@elementor/editor-panels": "3.35.0-426",
52
- "@elementor/editor-props": "3.35.0-426",
53
- "@elementor/editor-styles-repository": "3.35.0-426",
54
- "@elementor/editor-ui": "3.35.0-426",
55
- "@elementor/editor-v1-adapters": "3.35.0-426",
56
- "@elementor/http-client": "3.35.0-426",
43
+ "@elementor/editor": "3.35.0-428",
44
+ "@elementor/editor-canvas": "3.35.0-428",
45
+ "@elementor/editor-controls": "3.35.0-428",
46
+ "@elementor/editor-documents": "3.35.0-428",
47
+ "@elementor/editor-editing-panel": "3.35.0-428",
48
+ "@elementor/editor-elements": "3.35.0-428",
49
+ "@elementor/editor-elements-panel": "3.35.0-428",
50
+ "@elementor/editor-mcp": "3.35.0-428",
51
+ "@elementor/editor-panels": "3.35.0-428",
52
+ "@elementor/editor-props": "3.35.0-428",
53
+ "@elementor/editor-styles-repository": "3.35.0-428",
54
+ "@elementor/editor-ui": "3.35.0-428",
55
+ "@elementor/editor-v1-adapters": "3.35.0-428",
56
+ "@elementor/http-client": "3.35.0-428",
57
57
  "@elementor/icons": "^1.63.0",
58
- "@elementor/mixpanel": "3.35.0-426",
59
- "@elementor/query": "3.35.0-426",
60
- "@elementor/schema": "3.35.0-426",
61
- "@elementor/store": "3.35.0-426",
58
+ "@elementor/mixpanel": "3.35.0-428",
59
+ "@elementor/query": "3.35.0-428",
60
+ "@elementor/schema": "3.35.0-428",
61
+ "@elementor/store": "3.35.0-428",
62
62
  "@elementor/ui": "1.36.17",
63
- "@elementor/utils": "3.35.0-426",
63
+ "@elementor/utils": "3.35.0-428",
64
64
  "@wordpress/i18n": "^5.13.0",
65
- "@elementor/editor-notifications": "3.35.0-426",
66
- "@elementor/editor-current-user": "3.35.0-426"
65
+ "@elementor/editor-notifications": "3.35.0-428",
66
+ "@elementor/editor-current-user": "3.35.0-428"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "react": "^18.3.1",
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { useRef } from 'react';
2
+ import { useRef, useState } from 'react';
3
3
  import { endDragElementFromPanel, startDragElementFromPanel } from '@elementor/editor-canvas';
4
4
  import { dropElement, type DropElementParams, type V1ElementData } from '@elementor/editor-elements';
5
5
  import { EditableField, EllipsisWithTooltip, MenuListItem, useEditable, WarningInfotip } from '@elementor/editor-ui';
@@ -26,6 +26,7 @@ import { type Component } from '../../types';
26
26
  import { validateComponentName } from '../../utils/component-name-validation';
27
27
  import { getContainerForNewElement } from '../../utils/get-container-for-new-element';
28
28
  import { createComponentModel } from '../create-component-form/utils/replace-element-with-component';
29
+ import { DeleteConfirmationDialog } from './delete-confirmation-dialog';
29
30
 
30
31
  type ComponentItemProps = {
31
32
  component: Omit< Component, 'id' > & { id?: number };
@@ -34,6 +35,7 @@ type ComponentItemProps = {
34
35
 
35
36
  export const ComponentItem = ( { component, renameComponent }: ComponentItemProps ) => {
36
37
  const itemRef = useRef< HTMLElement >( null );
38
+ const [ isDeleteDialogOpen, setIsDeleteDialogOpen ] = useState( false );
37
39
 
38
40
  const {
39
41
  ref: editableRef,
@@ -63,16 +65,24 @@ export const ComponentItem = ( { component, renameComponent }: ComponentItemProp
63
65
  endDragElementFromPanel();
64
66
  };
65
67
 
66
- const handleArchiveClick = () => {
68
+ const handleDeleteClick = () => {
67
69
  popupState.close();
70
+ setIsDeleteDialogOpen( true );
71
+ };
68
72
 
73
+ const handleDeleteConfirm = () => {
69
74
  if ( ! component.id ) {
70
75
  throw new Error( 'Component ID is required' );
71
76
  }
72
77
 
78
+ setIsDeleteDialogOpen( false );
73
79
  archiveComponent( component.id, component.name );
74
80
  };
75
81
 
82
+ const handleDeleteDialogClose = () => {
83
+ setIsDeleteDialogOpen( false );
84
+ };
85
+
76
86
  return (
77
87
  <Stack>
78
88
  <WarningInfotip
@@ -155,12 +165,17 @@ export const ComponentItem = ( { component, renameComponent }: ComponentItemProp
155
165
  >
156
166
  { __( 'Rename', 'elementor' ) }
157
167
  </MenuListItem>
158
- <MenuListItem sx={ { minWidth: '160px' } } onClick={ handleArchiveClick }>
168
+ <MenuListItem sx={ { minWidth: '160px' } } onClick={ handleDeleteClick }>
159
169
  <Typography variant="caption" sx={ { color: 'error.light' } }>
160
170
  { __( 'Delete', 'elementor' ) }
161
171
  </Typography>
162
172
  </MenuListItem>
163
173
  </Menu>
174
+ <DeleteConfirmationDialog
175
+ open={ isDeleteDialogOpen }
176
+ onClose={ handleDeleteDialogClose }
177
+ onConfirm={ handleDeleteConfirm }
178
+ />
164
179
  </Stack>
165
180
  );
166
181
  };
@@ -0,0 +1,26 @@
1
+ import * as React from 'react';
2
+ import { ConfirmationDialog } from '@elementor/editor-ui';
3
+ import { __ } from '@wordpress/i18n';
4
+
5
+ type DeleteConfirmationDialogProps = {
6
+ open: boolean;
7
+ onClose: () => void;
8
+ onConfirm: () => void;
9
+ };
10
+
11
+ export function DeleteConfirmationDialog( { open, onClose, onConfirm }: DeleteConfirmationDialogProps ) {
12
+ return (
13
+ <ConfirmationDialog open={ open } onClose={ onClose }>
14
+ <ConfirmationDialog.Title>{ __( 'Delete this component?', 'elementor' ) }</ConfirmationDialog.Title>
15
+ <ConfirmationDialog.Content>
16
+ <ConfirmationDialog.ContentText>
17
+ { __(
18
+ 'Existing instances on your pages will remain functional. You will no longer find this component in your list.',
19
+ 'elementor'
20
+ ) }
21
+ </ConfirmationDialog.ContentText>
22
+ </ConfirmationDialog.Content>
23
+ <ConfirmationDialog.Actions onClose={ onClose } onConfirm={ onConfirm } />
24
+ </ConfirmationDialog>
25
+ );
26
+ }