@myunisoft/design-system 1.2.5-rev157 → 1.2.5-rev157.1

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 (23) hide show
  1. package/dist/components/DataGrid/components/toolbar/ActionsMenu/index.d.ts +19 -0
  2. package/dist/components/DataGrid/components/toolbar/CustomGridToolbar.d.ts +4 -1
  3. package/dist/components/DocumentComposer/LoadingSkeleton.d.ts +2 -0
  4. package/dist/components/DocumentComposer/Treeview/CustomTreeItem.d.ts +2 -1
  5. package/dist/components/DocumentComposer/Treeview/hooks/useTreeItemMenu.d.ts +2 -0
  6. package/dist/components/DocumentComposer/Treeview/slots/LabelInputSlot.d.ts +10 -5
  7. package/dist/components/DocumentComposer/Treeview/types.d.ts +22 -15
  8. package/dist/components/DocumentComposer/hooks/useDragValidation.d.ts +14 -0
  9. package/dist/components/DocumentComposer/hooks/useSummaryItemsMap.d.ts +5 -0
  10. package/dist/components/DocumentComposer/hooks/useTemporarySection.d.ts +25 -0
  11. package/dist/components/DocumentComposer/index.d.ts +1 -1
  12. package/dist/components/DocumentComposer/types.d.ts +1 -0
  13. package/dist/components/DocumentComposer/utils/getSummaryItemMenuItems.d.ts +9 -0
  14. package/dist/components/DocumentComposer/utils/summaryHelpers.d.ts +12 -0
  15. package/dist/index.js +3 -3
  16. package/package.json +121 -119
  17. package/dist/components/DataGrid/DataGrid.d.ts +0 -3
  18. package/dist/components/DataGrid/hooks/useSizing.d.ts +0 -5
  19. package/dist/components/DataGrid/hooks/useSizing.test.d.ts +0 -1
  20. package/dist/components/DocumentComposer/Treeview/icons/index.d.ts +0 -1
  21. package/dist/components/DocumentComposer/hooks/useDocumentComposer.d.ts +0 -17
  22. package/dist/components/DocumentComposer/icons/index.d.ts +0 -8
  23. package/dist/components/Modal/components/ModalVariantIcon.d.ts +0 -6
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { GridValidRowModel } from '@mui/x-data-grid-pro';
3
+ export type MenuAction = {
4
+ key: string;
5
+ label: string;
6
+ icon?: ReactNode;
7
+ color?: string;
8
+ disabled?: boolean | ((selectedRows: GridValidRowModel[]) => boolean);
9
+ onClick: (selectedRows: GridValidRowModel[]) => void;
10
+ };
11
+ type ActionsMenuProps = {
12
+ isOpen: boolean;
13
+ anchorEl: HTMLElement | null;
14
+ menuActions: MenuAction[];
15
+ selectedRows: GridValidRowModel[];
16
+ onClose: () => void;
17
+ };
18
+ declare const ActionsMenu: ({ isOpen, anchorEl, menuActions, selectedRows, onClose }: ActionsMenuProps) => import("react/jsx-runtime").JSX.Element;
19
+ export default ActionsMenu;
@@ -7,20 +7,23 @@
7
7
  * Source (MUI v7.x): https://github.com/mui/mui-x/blob/v7.x/packages/x-data-grid/src/components/toolbar/GridToolbar.tsx
8
8
  */
9
9
  import { type GridRowSelectionModel, type GridSlotsComponentsProps, type GridValidRowModel } from '@mui/x-data-grid-pro';
10
+ import { type MenuAction } from './ActionsMenu';
10
11
  import { type IconButtonConfig, type TextButtonConfig } from './ArrayButtons';
11
12
  interface DeleteAction {
12
13
  onDelete: (selectedRowIds: GridRowSelectionModel) => boolean | Promise<boolean>;
13
14
  disabled?: boolean;
14
15
  }
15
16
  interface BulkEditAction {
16
- onBulkEditSave: (selectedIds: GridRowSelectionModel, newRows: GridValidRowModel[]) => boolean | Promise<boolean>;
17
+ onBulkEditSave: (selectedRowIds: GridRowSelectionModel, newRows: GridValidRowModel[]) => boolean | Promise<boolean>;
17
18
  disabled?: boolean;
18
19
  }
19
20
  declare module '@mui/x-data-grid-pro' {
20
21
  interface ToolbarPropsOverrides {
22
+ showSelectedCount?: boolean;
21
23
  customButtons?: CustomToolbarButtonConfig[];
22
24
  deleteAction?: DeleteAction;
23
25
  bulkEditAction?: BulkEditAction;
26
+ menuActions?: MenuAction[];
24
27
  }
25
28
  }
26
29
  interface CustomTextButtonConfig extends Omit<TextButtonConfig, 'onClick'> {
@@ -0,0 +1,2 @@
1
+ export declare const LeftPanelSkeleton: () => import("react/jsx-runtime").JSX.Element;
2
+ export declare const RightPanelSkeleton: () => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,8 @@
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' | 'onItemVisibilityChange'> & {
3
+ type TreeItemCallbacks<T extends Record<string, unknown>> = Pick<TreeviewProps<T>, 'isSectionItem' | 'isVisibleItem' | 'getIconItem' | 'hasItemMenu' | 'getMenuItems' | 'isItemReorderable' | 'onItemVisibilityChange' | 'isTemporaryItem' | 'onTemporarySectionValidation' | 'onTemporarySectionCancel' | 'onItemLabelChange'> & {
4
4
  apiRef: RichTreeViewProApiRef;
5
+ onEditingChange?: (itemId: string | null) => void;
5
6
  };
6
7
  type CustomTreeItemProps<T extends Record<string, unknown>> = TreeItemProps & TreeItemCallbacks<T>;
7
8
  export declare const CustomTreeItem: <T extends Record<string, unknown>>(props: CustomTreeItemProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -7,6 +7,8 @@ export declare const useTreeItemMenu: () => {
7
7
  } | null;
8
8
  handleMenuClick: (event: React.MouseEvent<HTMLElement>) => void;
9
9
  handleMenuClose: () => void;
10
+ scheduleMenuAction: (action: () => void) => void;
11
+ onMenuExited: () => void;
10
12
  createMouseMoveHandler: (isHovered: boolean, onHoverChange?: (isHovered: boolean) => void) => (e: React.MouseEvent<HTMLDivElement>) => void;
11
13
  createMouseLeaveHandler: (onHoverChange?: (isHovered: boolean) => void) => () => void;
12
14
  };
@@ -1,6 +1,11 @@
1
- type LabelInputSlotProps = {
1
+ import type { InputHTMLAttributes } from 'react';
2
+ import type { RichTreeViewProApiRef } from '@mui/x-tree-view-pro';
3
+ export declare const LabelInputSlot: import("react").ForwardRefExoticComponent<InputHTMLAttributes<HTMLInputElement> & {
2
4
  ownerState?: unknown;
3
- [key: string]: unknown;
4
- };
5
- export declare const LabelInputSlot: import("react").ForwardRefExoticComponent<Omit<LabelInputSlotProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
6
- export {};
5
+ itemId?: string;
6
+ isTemporary?: boolean;
7
+ onTemporarySectionValidation?: (label: string) => void;
8
+ onTemporarySectionCancel?: () => void;
9
+ onItemLabelChange?: (itemId: string, newLabel: string) => void;
10
+ apiRef?: RichTreeViewProApiRef;
11
+ } & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,4 +1,5 @@
1
1
  import type { RichTreeViewProApiRef } from '@mui/x-tree-view-pro';
2
+ import type { TemporaryItem } from '../hooks/useTemporarySection';
2
3
  export type ItemPositionParams = {
3
4
  itemId: string;
4
5
  oldPosition: {
@@ -10,27 +11,33 @@ export type ItemPositionParams = {
10
11
  index: number;
11
12
  };
12
13
  };
14
+ export type ScheduleMenuAction = (action: () => void) => void;
13
15
  type CustomTreeviewItemProps<T> = {
14
- hasItemMenu?: (item: T) => boolean;
15
- getMenuItems?: (item: T, apiRef?: RichTreeViewProApiRef) => React.ReactNode[];
16
- isSectionItem?: (item: T) => boolean;
17
- getIconItem?: (item: T) => React.ReactNode;
18
- isItemEditable?: (item: T) => boolean;
19
- isVisibleItem?: (item: T) => boolean;
20
- onItemVisibilityChange?: (itemId: string, visible: boolean) => void;
16
+ hasItemMenu: (item: T) => boolean;
17
+ getMenuItems: (item: T, scheduleMenuAction: ScheduleMenuAction) => React.ReactNode[];
18
+ isSectionItem: (item: T) => boolean;
19
+ getIconItem: (item: T) => React.ReactNode;
20
+ isItemEditable: (item: T) => boolean;
21
+ isVisibleItem: (item: T) => boolean;
22
+ onItemVisibilityChange: (itemId: string, visible: boolean) => void;
21
23
  };
22
24
  export type TreeviewProps<T> = {
25
+ apiRef: RichTreeViewProApiRef;
23
26
  items: readonly T[];
24
- getItemId?: (item: T) => string;
25
- getItemLabel?: (item: T) => string;
26
- getItemChildren?: (item: T) => T[] | undefined;
27
- isItemReorderable?: (itemId: string) => boolean;
28
- canMoveItemToNewPosition?: (params: ItemPositionParams) => boolean;
29
- onItemPositionChange?: (params: ItemPositionParams) => void;
30
- onItemLabelChange?: (itemId: string, newLabel: string) => void;
27
+ getItemId: (item: T) => string;
28
+ getItemLabel: (item: T) => string;
29
+ getItemChildren: (item: T) => T[] | undefined;
30
+ isItemReorderable: (itemId: string) => boolean;
31
+ canMoveItemToNewPosition: (params: ItemPositionParams) => boolean;
32
+ onItemPositionChange: (params: ItemPositionParams) => void;
33
+ onItemLabelChange: (itemId: string, newLabel: string) => void;
34
+ temporaryItem: TemporaryItem | null;
35
+ isTemporaryItem: (itemId: string) => boolean;
36
+ onTemporarySectionValidation: (label: string) => void;
37
+ onTemporarySectionCancel: () => void;
38
+ defaultExpandedItems: string[];
31
39
  checkboxSelection?: boolean;
32
40
  multiSelect?: boolean;
33
- defaultExpandedItems?: string[];
34
41
  } & CustomTreeviewItemProps<T>;
35
42
  export type TreeviewItemProps<T> = {
36
43
  itemId: string;
@@ -0,0 +1,14 @@
1
+ import type { ItemPositionParams } from '../Treeview/types';
2
+ import type { DocumentComposerSummaryItem } from '../types';
3
+ type UseDragValidationParams = {
4
+ getItemById: (itemId: string) => DocumentComposerSummaryItem | null;
5
+ };
6
+ /**
7
+ * Business rule: Items can only be moved within their current parent
8
+ * or into their siblings' children. Moving items to a completely
9
+ * different branch is disabled to maintain document structure integrity.
10
+ */
11
+ export declare const useDragValidation: ({ getItemById }: UseDragValidationParams) => {
12
+ canMoveItemToNewPosition: (params: ItemPositionParams) => boolean;
13
+ };
14
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { DocumentComposerSummaryItem } from '../types';
2
+ export declare const useSummaryItemsMap: (summary: DocumentComposerSummaryItem[] | undefined) => {
3
+ itemsMap: Map<string, DocumentComposerSummaryItem>;
4
+ getItemById: (itemId: string) => DocumentComposerSummaryItem | null;
5
+ };
@@ -0,0 +1,25 @@
1
+ import type { RichTreeViewProApiRef } from '@mui/x-tree-view-pro';
2
+ import type { DocumentComposerSummaryItem } from '../types';
3
+ export type TemporaryItem = Pick<DocumentComposerSummaryItem, 'id' | 'parentId'> & {
4
+ parentVisible: boolean;
5
+ };
6
+ type UseTemporarySectionParams = {
7
+ apiRef: RichTreeViewProApiRef;
8
+ getItemById: (itemId: string) => DocumentComposerSummaryItem | null;
9
+ onItemCreated?: (parentId: string | null, label: string) => string | Promise<string>;
10
+ };
11
+ /**
12
+ * Flow:
13
+ * 1. User triggers `create(parentId)` from context menu
14
+ * 2. A temporary item appears in the tree in edit mode
15
+ * 3. User types a label and presses Enter → `validate()` is called
16
+ * 4. User presses Escape or leaves empty → `cancel()` is called
17
+ */
18
+ export declare const useTemporarySection: ({ apiRef, getItemById, onItemCreated }: UseTemporarySectionParams) => {
19
+ temporaryItem: TemporaryItem | null;
20
+ create: (parentId: string) => void;
21
+ validate: (label: string) => Promise<void>;
22
+ cancel: () => void;
23
+ isTemporary: (itemId: string) => boolean;
24
+ };
25
+ export {};
@@ -2,5 +2,5 @@ import type { DocumentComposerCallbacks, DocumentComposerCustomProps, DocumentCo
2
2
  type DocumentComposerProps = {
3
3
  summary?: DocumentComposerSummaryItem[];
4
4
  } & DocumentComposerCallbacks & DocumentComposerCustomProps;
5
- declare const DocumentComposer: ({ summary, onSummaryItemOrderChange, onSummaryItemLabelChange, onSummaryItemDelete, onSummaryItemVisibilityChange, emptySummaryLabel, isLoading }: DocumentComposerProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const DocumentComposer: ({ summary, onSummaryItemOrderChange, onSummaryItemLabelChange, onSummaryItemDelete, onSummaryItemVisibilityChange, onSummaryItemCreated, emptySummaryLabel, isLoading }: DocumentComposerProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export default DocumentComposer;
@@ -20,4 +20,5 @@ export type DocumentComposerCallbacks = {
20
20
  onSummaryItemLabelChange?: (itemId: string, newLabel: string) => void;
21
21
  onSummaryItemDelete?: (itemId: string) => void;
22
22
  onSummaryItemVisibilityChange?: (itemId: string, visible: boolean) => void;
23
+ onSummaryItemCreated?: (parentId: string | null, label: string) => string | Promise<string>;
23
24
  };
@@ -0,0 +1,9 @@
1
+ import type { ScheduleMenuAction } from '../Treeview/types';
2
+ import type { DocumentComposerSummaryItem } from '../types';
3
+ type MenuItemCallbacks = {
4
+ onRename: (itemId: string) => void;
5
+ onDelete: (itemId: string) => void;
6
+ onCreateSubsection: (parentId: string) => void;
7
+ };
8
+ export declare const getSummaryItemMenuItems: (item: DocumentComposerSummaryItem, callbacks: MenuItemCallbacks, scheduleMenuAction: ScheduleMenuAction) => React.ReactNode[];
9
+ export {};
@@ -0,0 +1,12 @@
1
+ import type { DocumentComposerSummaryItem } from '../types';
2
+ export declare const getAllExpandableItemIds: (items: DocumentComposerSummaryItem[]) => string[];
3
+ export declare const getAllTreeItemsFlat: (items: DocumentComposerSummaryItem[]) => DocumentComposerSummaryItem[];
4
+ export declare const isSummaryItemSection: (item: DocumentComposerSummaryItem) => boolean;
5
+ export declare const hasSummaryItemMenu: (_item: DocumentComposerSummaryItem) => boolean;
6
+ export declare const isSummaryItemVisible: (item: DocumentComposerSummaryItem) => boolean;
7
+ export declare const getItemChildren: (item: DocumentComposerSummaryItem) => DocumentComposerSummaryItem[] | undefined;
8
+ export declare const getItemId: (item: DocumentComposerSummaryItem) => string;
9
+ export declare const getItemLabel: (item: DocumentComposerSummaryItem) => string;
10
+ export declare const isItemEditable: (_item: DocumentComposerSummaryItem) => boolean;
11
+ export declare const isItemReorderable: (_itemId: string) => boolean;
12
+ export declare const getSummaryItemIcon: (item: DocumentComposerSummaryItem) => import("react/jsx-runtime").JSX.Element | null;