@myunisoft/design-system 1.2.9-rev157-6 → 1.2.9-rev157-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,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' | 'isItemReorderable' | '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' | 'isTemporaryItem' | 'onTemporarySectionValidation' | 'onTemporarySectionCancel' | 'onItemLabelChange' | 'hiddenSectionTooltip' | 'visibleIconTooltip' | 'hiddenIconTooltip'> & {
4
4
  apiRef: RichTreeViewProApiRef;
5
5
  onEditingChange?: (itemId: string | null) => void;
6
6
  };
@@ -30,7 +30,6 @@ export type TreeviewProps<T> = {
30
30
  getItemId: (item: T) => string;
31
31
  getItemLabel: (item: T) => string;
32
32
  getItemChildren: (item: T) => T[] | undefined;
33
- isItemReorderable: (itemId: string) => boolean;
34
33
  isSectionDraggable: (itemId: string) => boolean;
35
34
  canMoveItemToNewPosition: (params: ItemPositionParams) => boolean;
36
35
  onItemPositionChange: (params: ItemPositionParams) => void;
@@ -0,0 +1,15 @@
1
+ import { type RefObject } from 'react';
2
+ import type { DocumentSection } from '../types';
3
+ type UseDragVisualFeedbackParams = {
4
+ containerRef: RefObject<HTMLDivElement | null>;
5
+ getSectionById: (sectionId: string) => DocumentSection | null;
6
+ isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null) => boolean;
7
+ };
8
+ /**
9
+ * Provides visual feedback during drag-and-drop by graying out invalid drop targets.
10
+ *
11
+ * Uses direct DOM manipulation instead of React state to avoid re-rendering
12
+ * all tree items on every drag event.
13
+ */
14
+ export declare const useDragVisualFeedback: ({ containerRef, getSectionById, isValidDropTarget }: UseDragVisualFeedbackParams) => void;
15
+ 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: isValidDropTargetCallback }: DocumentComposerProps) => import("react/jsx-runtime").JSX.Element;
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;
6
6
  export default DocumentComposer;
@@ -43,8 +43,9 @@ export type DocumentComposerCustomProps = {
43
43
  * Determines if `targetSection` is a valid drop location for `draggedSection`.
44
44
  * When provided, invalid targets are visually greyed out during drag.
45
45
  * Defaults to () => true (all targets valid).
46
+ * @param targetSection - The parent section where the item would be dropped, or `null` if dropping at root level.
46
47
  */
47
- isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection) => boolean;
48
+ isValidDropTarget?: (draggedSection: DocumentSection, targetSection: DocumentSection | null) => boolean;
48
49
  };
49
50
  export type DocumentComposerCallbacks = {
50
51
  onSectionOrderChange?: (params: ItemPositionParams) => void;