@visns-studio/visns-components 5.12.7 → 5.12.9

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.
@@ -1,6 +1,8 @@
1
1
  import Swal from 'sweetalert2';
2
2
  import '../styles/SweetAlert.module.css';
3
3
 
4
+
5
+
4
6
  /**
5
7
  * A utility function that replaces react-confirm-alert with SweetAlert2
6
8
  * while maintaining a similar look and feel.
@@ -133,17 +135,9 @@ export const confirmDialog = (options) => {
133
135
 
134
136
  // Show SweetAlert2 dialog
135
137
  Swal.fire(swalOptions).then((result) => {
136
- if (
137
- result.isConfirmed &&
138
- yesButton &&
139
- typeof yesButton.onClick === 'function'
140
- ) {
138
+ if (result.isConfirmed && yesButton && typeof yesButton.onClick === 'function') {
141
139
  yesButton.onClick();
142
- } else if (
143
- result.dismiss === Swal.DismissReason.cancel &&
144
- noButton &&
145
- typeof noButton.onClick === 'function'
146
- ) {
140
+ } else if (result.dismiss === Swal.DismissReason.cancel && noButton && typeof noButton.onClick === 'function') {
147
141
  noButton.onClick();
148
142
  }
149
143
  });
package/src/index.js CHANGED
@@ -1,8 +1,13 @@
1
1
  /** CMS Components */
2
2
  import DataGrid from './components/DataGrid';
3
3
  import DropZone from './components/DropZone';
4
+ import CategorizedDropZone from './components/CategorizedDropZone';
4
5
  import SortableList from './components/sorting/List';
5
6
 
7
+ /** Utility Components */
8
+ import { confirmDialog } from './components/utils/ConfirmDialog';
9
+ import { showConfirmDialog } from './components/generic/ConfirmationDialog';
10
+
6
11
  /** CRM Components */
7
12
  import AsyncSelect from './components/AsyncSelect';
8
13
  import AssociationManager from './components/AssociationManager';
@@ -94,12 +99,14 @@ export {
94
99
  CmsDetail,
95
100
  CmsIndex,
96
101
  CmsSort,
102
+ confirmDialog,
97
103
  CustomFetch,
98
104
  DataGrid,
99
105
  DataGridSearch,
100
106
  DatePickerPortal,
101
107
  Download,
102
108
  DropZone,
109
+ CategorizedDropZone,
103
110
  Field,
104
111
  Form,
105
112
  GalleryModal,
@@ -131,6 +138,7 @@ export {
131
138
  SectionTypeSelector,
132
139
  SelectList,
133
140
  Select,
141
+ showConfirmDialog,
134
142
  SortableList,
135
143
  StagePopupModal,
136
144
  Table,
@@ -1,67 +1,13 @@
1
- import { toast } from 'react-toastify';
2
-
3
1
  /**
4
- * A simple confirmation dialog using toast notifications
5
- * @param {Object} options - Configuration options
6
- * @param {string} options.title - Dialog title
7
- * @param {string} options.message - Dialog message
8
- * @param {string} options.confirmLabel - Label for the confirm button
9
- * @param {string} options.cancelLabel - Label for the cancel button
10
- * @param {Function} options.onConfirm - Function to call when confirmed
11
- * @param {Function} options.onCancel - Function to call when cancelled
2
+ * @deprecated This confirmDialog implementation using react-toastify is deprecated.
3
+ * Use the SweetAlert2 version from './components/utils/ConfirmDialog' instead.
4
+ *
5
+ * Import path should be: import { confirmDialog } from './components/utils/ConfirmDialog';
6
+ *
7
+ * This file exists only for backward compatibility and will be removed in a future version.
12
8
  */
13
- export const confirmDialog = ({
14
- title = 'Confirm',
15
- message = 'Are you sure?',
16
- confirmLabel = 'Yes',
17
- cancelLabel = 'No',
18
- onConfirm = () => {},
19
- onCancel = () => {}
20
- }) => {
21
- // Create a custom toast with buttons
22
- toast.info(
23
- <div>
24
- <div style={{ fontWeight: 'bold', marginBottom: '8px' }}>{title}</div>
25
- <div style={{ marginBottom: '16px' }}>{message}</div>
26
- <div style={{ display: 'flex', justifyContent: 'flex-end', gap: '8px' }}>
27
- <button
28
- onClick={() => {
29
- toast.dismiss();
30
- onCancel();
31
- }}
32
- style={{
33
- padding: '6px 12px',
34
- background: '#f5f5f5',
35
- border: '1px solid #ddd',
36
- borderRadius: '4px',
37
- cursor: 'pointer'
38
- }}
39
- >
40
- {cancelLabel}
41
- </button>
42
- <button
43
- onClick={() => {
44
- toast.dismiss();
45
- onConfirm();
46
- }}
47
- style={{
48
- padding: '6px 12px',
49
- background: '#2563eb',
50
- color: 'white',
51
- border: 'none',
52
- borderRadius: '4px',
53
- cursor: 'pointer'
54
- }}
55
- >
56
- {confirmLabel}
57
- </button>
58
- </div>
59
- </div>,
60
- {
61
- autoClose: false,
62
- closeButton: false,
63
- closeOnClick: false,
64
- draggable: false
65
- }
66
- );
67
- };
9
+
10
+ console.warn('DEPRECATED: You are importing confirmDialog from utils/ConfirmDialog.jsx (toastify version). Please update your import to use ./components/utils/ConfirmDialog (SweetAlert2 version) instead.');
11
+
12
+ // Re-export the correct SweetAlert2 version
13
+ export { confirmDialog } from '../components/utils/ConfirmDialog';