@myunisoft/design-system 1.3.1 → 1.3.2

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.
Files changed (27) hide show
  1. package/dist/assets/I18n/locales/en.d.ts +16 -0
  2. package/dist/assets/I18n/locales/fr.d.ts +16 -0
  3. package/dist/components/AnchoredPopper/index.d.ts +14 -0
  4. package/dist/components/DataGrid/components/toolbar/buttons/AddButton.d.ts +6 -0
  5. package/dist/components/DataGrid/components/toolbar/buttons/ExportButton.d.ts +9 -0
  6. package/dist/components/DataGrid/types/index.d.ts +428 -0
  7. package/dist/components/DocumentComposer/Treeview/CustomTreeItem.d.ts +1 -1
  8. package/dist/components/DocumentComposer/Treeview/slots/LabelInputSlot.d.ts +1 -1
  9. package/dist/components/DocumentComposer/Treeview/types.d.ts +1 -1
  10. package/dist/components/DocumentComposer/components/SectionEditorPanel.d.ts +7 -0
  11. package/dist/components/DocumentComposer/components/index.d.ts +1 -0
  12. package/dist/components/DocumentComposer/hooks/useDeleteConfirmation.d.ts +12 -0
  13. package/dist/components/DocumentComposer/hooks/useDragVisualFeedback.d.ts +1 -1
  14. package/dist/components/DocumentComposer/hooks/useTemporarySection.d.ts +7 -2
  15. package/dist/components/DocumentComposer/hooks/useUnsavedChangesGuard.d.ts +19 -0
  16. package/dist/components/DocumentComposer/index.d.ts +1 -1
  17. package/dist/components/DocumentComposer/types/index.d.ts +2 -0
  18. package/dist/components/DocumentComposer/types/props.d.ts +69 -0
  19. package/dist/components/DocumentComposer/types/section.d.ts +33 -0
  20. package/dist/components/DocumentComposer/utils/sectionHelpers.d.ts +0 -1
  21. package/dist/components/Export/index.d.ts +3 -0
  22. package/dist/components/Export/style/index.d.ts +9 -0
  23. package/dist/components/Export/types/index.d.ts +30 -0
  24. package/dist/index.d.ts +3 -0
  25. package/dist/index.js +5 -3
  26. package/dist/locale/index.d.ts +7 -0
  27. package/package.json +8 -10
@@ -35,6 +35,22 @@ declare const _default: {
35
35
  addColumn: string;
36
36
  restoreInitial: string;
37
37
  };
38
+ documentComposer: {
39
+ createSection: string;
40
+ deleteSection: {
41
+ title: string;
42
+ content: string;
43
+ cancel: string;
44
+ confirm: string;
45
+ };
46
+ unsavedChanges: {
47
+ title: string;
48
+ content: string;
49
+ saveAndQuit: string;
50
+ cancel: string;
51
+ quitWithoutSaving: string;
52
+ };
53
+ };
38
54
  dashboard: {
39
55
  ba: {
40
56
  linkTo: string;
@@ -35,6 +35,22 @@ declare const _default: {
35
35
  addColumn: string;
36
36
  restoreInitial: string;
37
37
  };
38
+ documentComposer: {
39
+ createSection: string;
40
+ deleteSection: {
41
+ title: string;
42
+ content: string;
43
+ cancel: string;
44
+ confirm: string;
45
+ };
46
+ unsavedChanges: {
47
+ title: string;
48
+ content: string;
49
+ saveAndQuit: string;
50
+ cancel: string;
51
+ quitWithoutSaving: string;
52
+ };
53
+ };
38
54
  dashboard: {
39
55
  ba: {
40
56
  linkTo: string;
@@ -0,0 +1,14 @@
1
+ import type { ReactNode, RefObject } from 'react';
2
+ import { PopperPlacementType } from '@mui/material';
3
+ type AnchoredPopperProps = {
4
+ open: boolean;
5
+ anchorRef: RefObject<HTMLElement | null>;
6
+ onClose: () => void;
7
+ placement?: PopperPlacementType;
8
+ children: ReactNode;
9
+ minWidth?: number | string;
10
+ zIndex?: number;
11
+ elevation?: number;
12
+ };
13
+ declare const AnchoredPopper: ({ open, anchorRef, onClose, placement, children, minWidth, zIndex, elevation }: AnchoredPopperProps) => import("react/jsx-runtime").JSX.Element;
14
+ export default AnchoredPopper;
@@ -0,0 +1,6 @@
1
+ type AddButtonProps = {
2
+ onClick: () => void;
3
+ disabled?: boolean;
4
+ };
5
+ declare const AddButton: ({ onClick, disabled }: AddButtonProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default AddButton;
@@ -0,0 +1,9 @@
1
+ import { GridExportFormat } from '@mui/x-data-grid-pro';
2
+ type ExportButtonProps = {
3
+ exportAction?: {
4
+ onExport: (format: GridExportFormat) => void;
5
+ exportFormats: GridExportFormat[];
6
+ };
7
+ };
8
+ declare const ExportButton: ({ exportAction }: ExportButtonProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default ExportButton;
@@ -0,0 +1,428 @@
1
+ import type { ReactNode, RefObject, ComponentType, Dispatch, SetStateAction } from 'react';
2
+ import type { ButtonProps } from '@mui/material';
3
+ import type { DataGridProProps, GridApiPro, GridColDef as MuiGridColDef, GridRowSelectionModel, GridValidRowModel } from '@mui/x-data-grid-pro';
4
+ /**
5
+ * Extended GridColDef with custom export-related properties
6
+ */
7
+ export type GridColDef<R extends GridValidRowModel = any, V = any, F = V> = MuiGridColDef<R, V, F> & {
8
+ /**
9
+ * Custom formatter function for export operations
10
+ * @param params - Object containing the value and row data
11
+ * @returns Formatted value for export
12
+ */
13
+ exportFormatter?: (params: {
14
+ value: V;
15
+ row: R;
16
+ }) => any;
17
+ /**
18
+ * If true, this column will be excluded from export operations
19
+ */
20
+ ignoreExport?: boolean;
21
+ };
22
+ /**
23
+ * Props for the DataGridDS component
24
+ * Extends MUI DataGridProProps with custom row context menu functionality
25
+ */
26
+ export interface DataGridDSProps extends DataGridProProps {
27
+ /**
28
+ * Configuration for row context menu (right-click menu)
29
+ */
30
+ rowContextMenu?: RowContextMenuConfig;
31
+ }
32
+ /**
33
+ * Configuration for row context menu
34
+ */
35
+ export interface RowContextMenuConfig {
36
+ /**
37
+ * Array of actions available in the context menu
38
+ */
39
+ actions: RowMenuAction[];
40
+ /**
41
+ * Optional function to determine if the menu can be opened
42
+ * @param selectedRows - Currently selected rows
43
+ * @returns true if menu can be opened, false otherwise
44
+ */
45
+ canOpen?: (selectedRows: GridValidRowModel[]) => boolean;
46
+ }
47
+ /**
48
+ * Action definition for row context menu
49
+ */
50
+ export type RowMenuAction = {
51
+ /**
52
+ * Unique identifier for the action
53
+ */
54
+ key: string;
55
+ /**
56
+ * Display label for the action
57
+ */
58
+ label: string;
59
+ /**
60
+ * Callback function executed when action is clicked
61
+ * @param selectedRows - Array of selected row models
62
+ */
63
+ onClick: (selectedRows: GridValidRowModel[]) => void;
64
+ /**
65
+ * Whether the action is disabled
66
+ * Can be a boolean or a function that determines disabled state based on selected rows
67
+ */
68
+ disabled?: boolean | ((selectedRows: GridValidRowModel[]) => boolean);
69
+ };
70
+ /**
71
+ * Props for RowMenu component
72
+ */
73
+ export interface RowMenuProps {
74
+ /**
75
+ * Whether the menu is currently open
76
+ */
77
+ isOpen: boolean;
78
+ /**
79
+ * Callback to close the menu
80
+ */
81
+ onClose: () => void;
82
+ /**
83
+ * X coordinate for menu positioning
84
+ */
85
+ mouseX: number;
86
+ /**
87
+ * Y coordinate for menu positioning
88
+ */
89
+ mouseY: number;
90
+ /**
91
+ * Array of actions to display in the menu
92
+ */
93
+ rowMenuActions: RowMenuAction[];
94
+ /**
95
+ * Currently selected rows
96
+ */
97
+ selectedRows: GridValidRowModel[];
98
+ }
99
+ /**
100
+ * State for row menu hook
101
+ */
102
+ export interface RowMenuState {
103
+ /**
104
+ * Whether the menu is open
105
+ */
106
+ isOpen: boolean;
107
+ /**
108
+ * Mouse X coordinate
109
+ */
110
+ mouseX: number;
111
+ /**
112
+ * Mouse Y coordinate
113
+ */
114
+ mouseY: number;
115
+ }
116
+ /**
117
+ * Return type for useRowMenu hook
118
+ */
119
+ export interface UseRowMenuReturn {
120
+ /**
121
+ * Current menu state
122
+ */
123
+ rowMenuState: RowMenuState;
124
+ /**
125
+ * Function to open the menu at specified coordinates
126
+ */
127
+ openRowMenu: (mouseX: number, mouseY: number) => void;
128
+ /**
129
+ * Function to close the menu
130
+ */
131
+ closeRowMenu: () => void;
132
+ }
133
+ /**
134
+ * Base configuration for toolbar buttons
135
+ */
136
+ interface BaseButtonConfig {
137
+ /**
138
+ * Unique identifier for the button
139
+ */
140
+ key: ButtonKey;
141
+ /**
142
+ * Button color theme
143
+ */
144
+ color?: ButtonProps['color'];
145
+ /**
146
+ * Whether the button is disabled
147
+ */
148
+ disabled?: boolean;
149
+ /**
150
+ * Whether the button is in loading state
151
+ */
152
+ isLoading?: boolean;
153
+ }
154
+ /**
155
+ * Configuration for text-based toolbar button
156
+ */
157
+ export interface TextButtonConfig extends BaseButtonConfig {
158
+ type: 'text';
159
+ /**
160
+ * Button text label
161
+ */
162
+ text: string;
163
+ /**
164
+ * Click handler
165
+ */
166
+ onClick: ButtonProps['onClick'];
167
+ }
168
+ /**
169
+ * Configuration for icon-based toolbar button
170
+ */
171
+ export interface IconButtonConfig extends BaseButtonConfig {
172
+ type: 'icon';
173
+ /**
174
+ * Icon element to display
175
+ */
176
+ icon: ReactNode;
177
+ /**
178
+ * Click handler
179
+ */
180
+ onClick: ButtonProps['onClick'];
181
+ }
182
+ /**
183
+ * Union type for all button configurations
184
+ */
185
+ export type ButtonConfig = TextButtonConfig | IconButtonConfig;
186
+ /**
187
+ * Type for button keys
188
+ */
189
+ export type ButtonKey = string | number;
190
+ /**
191
+ * Props for ArrayButtons component
192
+ */
193
+ export interface ArrayButtonsProps {
194
+ /**
195
+ * Array of button configurations to render
196
+ */
197
+ buttons: ButtonConfig[];
198
+ }
199
+ /**
200
+ * Custom text button configuration with enhanced onClick signature
201
+ */
202
+ export interface CustomTextButtonConfig extends Omit<TextButtonConfig, 'onClick'> {
203
+ /**
204
+ * Enhanced onClick handler that receives selected row information
205
+ * @param selectedRowIds - Array of selected row IDs
206
+ * @param selectedRows - Array of selected row models
207
+ */
208
+ onClick: (selectedRowIds: GridRowSelectionModel, selectedRows: GridValidRowModel[]) => void | Promise<void>;
209
+ }
210
+ /**
211
+ * Custom icon button configuration with enhanced onClick signature
212
+ */
213
+ export interface CustomIconButtonConfig extends Omit<IconButtonConfig, 'onClick'> {
214
+ /**
215
+ * Enhanced onClick handler that receives selected row information
216
+ * @param selectedRowIds - Array of selected row IDs
217
+ * @param selectedRows - Array of selected row models
218
+ */
219
+ onClick: (selectedRowIds: GridRowSelectionModel, selectedRows: GridValidRowModel[]) => void | Promise<void>;
220
+ }
221
+ /**
222
+ * Union type for custom toolbar button configurations
223
+ */
224
+ export type CustomToolbarButtonConfig = CustomTextButtonConfig | CustomIconButtonConfig;
225
+ /**
226
+ * Configuration for delete action in toolbar
227
+ */
228
+ export interface DeleteAction {
229
+ /**
230
+ * Handler function for delete operation
231
+ * @param selectedRowIds - Array of selected row IDs to delete
232
+ * @returns Promise or boolean indicating success
233
+ */
234
+ onDelete: (selectedRowIds: GridRowSelectionModel) => boolean | Promise<boolean>;
235
+ /**
236
+ * Whether the delete action is disabled
237
+ */
238
+ disabled?: boolean;
239
+ }
240
+ /**
241
+ * Configuration for bulk edit action in toolbar
242
+ */
243
+ export interface BulkEditAction {
244
+ /**
245
+ * Handler function for bulk edit save operation
246
+ * @param selectedRowIds - Array of selected row IDs
247
+ * @param newRows - Array of modified row models
248
+ * @returns Promise or boolean indicating success
249
+ */
250
+ onBulkEditSave: (selectedRowIds: GridRowSelectionModel, newRows: GridValidRowModel[]) => boolean | Promise<boolean>;
251
+ /**
252
+ * Whether the bulk edit action is disabled
253
+ */
254
+ disabled?: boolean;
255
+ }
256
+ /**
257
+ * Configuration for add action in toolbar
258
+ */
259
+ export interface AddAction {
260
+ /**
261
+ * Handler function for add operation
262
+ */
263
+ onClick: () => void;
264
+ /**
265
+ * Whether the add action is disabled
266
+ */
267
+ disabled?: boolean;
268
+ }
269
+ /**
270
+ * Configuration for content component to be displayed in AnchoredPopper
271
+ * Note: This type matches the contentComponentConfig from AnchoredPopper
272
+ * for use within DataGrid components
273
+ */
274
+ export type ContentComponentConfig = {
275
+ /**
276
+ * Name identifier for the component (useful for debugging/analytics)
277
+ */
278
+ name: string;
279
+ /**
280
+ * React component to render
281
+ */
282
+ component: ComponentType<any>;
283
+ /**
284
+ * Props to pass to the component
285
+ */
286
+ props: Record<string, any>;
287
+ };
288
+ /**
289
+ * Action definition for actions menu (toolbar menu)
290
+ */
291
+ export type MenuAction = {
292
+ /**
293
+ * Unique identifier for the action
294
+ */
295
+ key: string;
296
+ /**
297
+ * Display label for the action
298
+ */
299
+ label: string;
300
+ /**
301
+ * Optional icon to display before the label
302
+ */
303
+ icon?: ReactNode;
304
+ /**
305
+ * Optional color for the menu item text
306
+ */
307
+ color?: string;
308
+ /**
309
+ * Whether the action is disabled
310
+ * Can be a boolean or a function that determines disabled state based on selected rows
311
+ */
312
+ disabled?: boolean | ((selectedRows: GridValidRowModel[]) => boolean);
313
+ /**
314
+ * Optional click handler for simple actions
315
+ * @param selectedRows - Array of selected row models
316
+ */
317
+ onClick?: (selectedRows: GridValidRowModel[]) => void;
318
+ /**
319
+ * Optional configuration for displaying a popper with custom content
320
+ * When provided, clicking the action will open an AnchoredPopper with the specified component
321
+ */
322
+ contentConfig?: ContentComponentConfig | null;
323
+ };
324
+ /**
325
+ * Props for ActionsMenu component
326
+ */
327
+ export interface ActionsMenuProps {
328
+ /**
329
+ * Whether the menu is currently open
330
+ */
331
+ isOpen: boolean;
332
+ /**
333
+ * Anchor element for the menu
334
+ */
335
+ anchorEl: HTMLElement | null;
336
+ /**
337
+ * Array of menu actions to display
338
+ */
339
+ menuActions: MenuAction[];
340
+ /**
341
+ * Currently selected rows
342
+ */
343
+ selectedRows: GridValidRowModel[];
344
+ /**
345
+ * Callback to close the menu
346
+ */
347
+ onClose: () => void;
348
+ /**
349
+ * Reference to the element that should anchor the popper
350
+ */
351
+ popperAnchorRef: RefObject<HTMLElement | null>;
352
+ }
353
+ /**
354
+ * Type for EditContext value
355
+ */
356
+ export interface EditContextType {
357
+ /**
358
+ * Whether bulk editing mode is active
359
+ */
360
+ isBulkEditing: boolean;
361
+ /**
362
+ * Whether an edit save operation is in progress
363
+ */
364
+ isEditSaving: boolean;
365
+ /**
366
+ * Function to set bulk editing state
367
+ */
368
+ setIsBulkEditing: Dispatch<SetStateAction<boolean>>;
369
+ /**
370
+ * Function to set edit saving state
371
+ */
372
+ setIsEditSaving: Dispatch<SetStateAction<boolean>>;
373
+ }
374
+ /**
375
+ * Props for EditProvider component
376
+ */
377
+ export interface EditProviderProps {
378
+ /**
379
+ * Child components
380
+ */
381
+ children: ReactNode;
382
+ }
383
+ /**
384
+ * Function type for exporting grid data to Excel
385
+ */
386
+ export type ExportGridApiToExcelFn = (apiRef: RefObject<GridApiPro>, fileName: string, sheetName?: string) => Promise<void>;
387
+ /**
388
+ * Function type for attaching Excel export functionality to grid API
389
+ */
390
+ export type AttachExcelExportToApiFn = (apiRef: RefObject<GridApiPro>, fileName?: string) => void;
391
+ /**
392
+ * Function type for getting selected rows from grid API
393
+ */
394
+ export type GetSelectedRowsFn = (apiRef: RefObject<GridApiPro>) => GridValidRowModel[];
395
+ /**
396
+ * Augmentation for MUI DataGridPro ToolbarPropsOverrides
397
+ * Adds custom toolbar props to the DataGridPro component
398
+ */
399
+ declare module '@mui/x-data-grid-pro' {
400
+ interface ToolbarPropsOverrides {
401
+ /**
402
+ * Whether to show the selected row count
403
+ * @default true
404
+ */
405
+ showSelectedCount?: boolean;
406
+ /**
407
+ * Array of custom button configurations
408
+ */
409
+ customButtons?: CustomToolbarButtonConfig[];
410
+ /**
411
+ * Configuration for delete action
412
+ */
413
+ deleteAction?: DeleteAction;
414
+ /**
415
+ * Configuration for bulk edit action
416
+ */
417
+ bulkEditAction?: BulkEditAction;
418
+ /**
419
+ * Array of menu actions for the actions menu
420
+ */
421
+ menuActions?: MenuAction[];
422
+ /**
423
+ * Configuration for add action
424
+ */
425
+ addAction?: AddAction;
426
+ }
427
+ }
428
+ export {};
@@ -1,6 +1,6 @@
1
1
  import type { RichTreeViewProApiRef, TreeItemProps } from '@mui/x-tree-view-pro';
2
2
  import type { TreeviewProps } from './types';
3
- type TreeItemCallbacks<T extends Record<string, unknown>> = Pick<TreeviewProps<T>, 'isSectionItem' | 'isVisibleItem' | 'getIconItem' | 'hasItemMenu' | 'getMenuItems' | 'isSectionDraggable' | 'onItemVisibilityChange' | 'isTemporaryItem' | 'onTemporarySectionValidation' | 'onTemporarySectionCancel' | 'onItemLabelChange' | 'hiddenSectionTooltip' | 'visibleIconTooltip' | 'hiddenIconTooltip'> & {
3
+ type TreeItemCallbacks<T extends Record<string, unknown>> = Pick<TreeviewProps<T>, 'isSectionItem' | 'isVisibleItem' | 'getIconItem' | 'hasItemMenu' | 'getMenuItems' | 'isSectionDraggable' | 'onItemVisibilityChange' | 'temporaryItem' | 'isTemporaryItem' | 'onTemporarySectionValidation' | 'onTemporarySectionCancel' | 'onItemLabelChange' | 'hiddenSectionTooltip' | 'visibleIconTooltip' | 'hiddenIconTooltip'> & {
4
4
  apiRef: RichTreeViewProApiRef;
5
5
  onEditingChange?: (itemId: string | null) => void;
6
6
  };
@@ -3,7 +3,7 @@ import type { RichTreeViewProApiRef } from '@mui/x-tree-view-pro';
3
3
  export declare const LabelInputSlot: import("react").ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & {
4
4
  ownerState?: unknown;
5
5
  itemId?: string;
6
- isTemporary?: boolean;
6
+ isEditing?: boolean;
7
7
  onTemporarySectionValidation?: (label: string) => void;
8
8
  onTemporarySectionCancel?: () => void;
9
9
  onItemLabelChange?: (itemId: string, newLabel: string) => void;
@@ -40,7 +40,7 @@ export type TreeviewProps<T> = {
40
40
  onTemporarySectionCancel: () => void;
41
41
  defaultExpandedItems: string[];
42
42
  checkboxSelection?: boolean;
43
- multiSelect?: boolean;
43
+ onItemSelect?: (itemId: string | null) => void;
44
44
  } & CustomTreeviewItemProps<T>;
45
45
  export type TreeviewItemProps<T> = {
46
46
  itemId: string;
@@ -0,0 +1,7 @@
1
+ import type { SectionContent } from '../types';
2
+ type SectionEditorPanelProps = {
3
+ content: SectionContent;
4
+ onChange: (content: SectionContent) => void;
5
+ };
6
+ export declare const SectionEditorPanel: ({ content, onChange }: SectionEditorPanelProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1 @@
1
+ export { SectionEditorPanel } from './SectionEditorPanel';
@@ -0,0 +1,12 @@
1
+ type UseDeleteConfirmationParams = {
2
+ onSectionDelete?: (sectionId: string) => void;
3
+ /** When true, delete immediately without showing confirmation */
4
+ skipConfirmation?: boolean;
5
+ };
6
+ export declare const useDeleteConfirmation: ({ onSectionDelete, skipConfirmation }: UseDeleteConfirmationParams) => {
7
+ deleteItemId: string | null;
8
+ requestDelete: (sectionId: string) => void;
9
+ confirmDelete: () => void;
10
+ cancelDelete: () => void;
11
+ };
12
+ export {};
@@ -3,7 +3,7 @@ import type { DocumentSection } from '../types';
3
3
  type UseDragVisualFeedbackParams = {
4
4
  containerRef: RefObject<HTMLDivElement | null>;
5
5
  getSectionById: (sectionId: string) => DocumentSection | null;
6
- isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null) => boolean;
6
+ isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null, newIndex: number, isNesting: boolean) => boolean;
7
7
  };
8
8
  /**
9
9
  * Provides visual feedback during drag-and-drop by graying out invalid drop targets.
@@ -2,6 +2,8 @@ import type { RichTreeViewProApiRef } from '@mui/x-tree-view-pro';
2
2
  import type { DocumentSection } from '../types';
3
3
  export type TemporarySection = Pick<DocumentSection, 'id' | 'parentId'> & {
4
4
  parentVisible: boolean;
5
+ /** When undefined = editing mode (input), when defined = optimistic mode (waiting for server) */
6
+ title?: string;
5
7
  };
6
8
  type UseTemporarySectionParams = {
7
9
  apiRef: RichTreeViewProApiRef;
@@ -12,14 +14,17 @@ type UseTemporarySectionParams = {
12
14
  /**
13
15
  * Flow:
14
16
  * 1. User triggers `create(parentId)` from context menu
15
- * 2. A temporary section appears in the tree in edit mode
17
+ * 2. A temporary section appears in the tree in edit mode (title = undefined)
16
18
  * 3. User types a title and presses Enter → `validate()` is called
19
+ * - The section transitions to optimistic mode (title = defined)
20
+ * - Server creation is called in background
17
21
  * 4. User presses Escape or leaves empty → `cancel()` is called
22
+ * 5. Server responds → temporary section is cleared, real section replaces it
18
23
  */
19
24
  export declare const useTemporarySection: ({ apiRef, getSectionById, onSectionCreate, scrollToBottom }: UseTemporarySectionParams) => {
20
25
  temporarySection: TemporarySection | null;
21
26
  create: (parentId?: string | null) => void;
22
- validate: (title: string) => Promise<void>;
27
+ validate: (title: string) => void;
23
28
  cancel: () => void;
24
29
  isTemporary: (sectionId: string) => boolean;
25
30
  };
@@ -0,0 +1,19 @@
1
+ type UseUnsavedChangesGuardParams = {
2
+ isDirty: boolean;
3
+ selectedSectionId?: string | null;
4
+ onSectionSelect?: (sectionId: string | null) => void;
5
+ onSave?: () => Promise<void>;
6
+ onDirtyReset?: () => void;
7
+ /** When true, navigate immediately without showing confirmation (discards changes) */
8
+ skipConfirmation?: boolean;
9
+ };
10
+ export declare const useUnsavedChangesGuard: ({ isDirty, selectedSectionId, onSectionSelect, onSave, onDirtyReset, skipConfirmation }: UseUnsavedChangesGuardParams) => {
11
+ pendingSectionId: string | null;
12
+ isModalOpen: boolean;
13
+ isSaving: boolean;
14
+ guardedSelect: (sectionId: string | null) => void;
15
+ saveAndQuit: () => Promise<void>;
16
+ quitWithoutSaving: () => void;
17
+ cancelNavigation: () => void;
18
+ };
19
+ export {};
@@ -2,5 +2,5 @@ import type { DocumentComposerCallbacks, DocumentComposerCustomProps, DocumentSe
2
2
  type DocumentComposerProps = {
3
3
  sections?: DocumentSection[];
4
4
  } & DocumentComposerCallbacks & DocumentComposerCustomProps;
5
- declare const DocumentComposer: ({ sections, onSectionOrderChange, onSectionTitleChange, onSectionDelete, onSectionVisibilityChange, onSectionCreate, noSectionsPlaceholder, isLoading, getSectionTitleChangePermission, getSectionDeletePermission, getSectionOrderChangePermission, getSectionCreatePermission, getSectionVisibilityChangePermission, hiddenSectionTooltip, visibleIconTooltip, hiddenIconTooltip, isValidDropTarget }: DocumentComposerProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const DocumentComposer: ({ sections, isLoadingSections, onSectionOrderChange, onSectionTitleChange, onSectionDelete, onSectionVisibilityChange, onSectionCreate, onSectionSelect, onSectionContentSave, noSectionsPlaceholder, getSectionTitleChangePermission, getSectionDeletePermission, getSectionOrderChangePermission, getSectionCreatePermission, getSectionVisibilityChangePermission, hiddenSectionTooltip, visibleIconTooltip, hiddenIconTooltip, renderSectionIcon, isValidDropTarget, sectionContent, isLoadingSectionContent, selectedSectionId, renderDeleteConfirmation, renderUnsavedChangesConfirmation }: DocumentComposerProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default DocumentComposer;
@@ -0,0 +1,2 @@
1
+ export * from './props';
2
+ export * from './section';