@epam/ai-dial-ui-kit 0.4.0-rc.24 → 0.4.0-rc.25

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,27 +1,26 @@
1
- import { FC, ReactNode } from 'react';
1
+ import { FC } from 'react';
2
2
  import { ColDef } from 'ag-grid-community';
3
- import { DialFile, DialFileNodeType } from '../../models/file';
3
+ import { DialFile } from '../../models/file';
4
4
  import { DialFoldersTreeProps } from './components/FoldersTree/FoldersTree';
5
5
  import { DialFileManagerNavigationPanelProps } from './components/FileManagerNavigationPanel/FileManagerNavigationPanel';
6
6
  import { DialGridProps } from '../Grid/Grid';
7
7
  import { DialFileManagerToolbarProps } from './components/FileManagerToolbar/DialFileManagerToolbar';
8
8
  import { DialFileManagerBulkActionsToolbarProps } from './components/FileManagerBulkActionsToolbar/FileManagerBulkActionsToolbar';
9
- interface GridRow {
10
- id: string;
11
- name: string;
12
- updatedAt?: string;
13
- size?: string;
14
- author?: string;
15
- path: string;
16
- nodeType: DialFileNodeType;
17
- extension?: string;
18
- }
9
+ import { DialFileManagerActions } from '../../types/file-manager';
10
+ import { FileManagerGridRow } from './FileManagerContext';
11
+ type GridRow = FileManagerGridRow;
19
12
  export interface FileTreeOptions extends Omit<DialFoldersTreeProps, 'items' | 'selectedPath' | 'onItemClick'> {
20
13
  width?: number;
21
14
  title?: string;
22
15
  containerCssClass?: string;
23
- additionalButtons?: ReactNode;
16
+ additionalButtons?: React.ReactNode;
24
17
  collapsed?: boolean;
18
+ actionLabels?: {
19
+ [DialFileManagerActions.Copy]?: string;
20
+ [DialFileManagerActions.Cut]?: string;
21
+ [DialFileManagerActions.Paste]?: string;
22
+ [DialFileManagerActions.Rename]?: string;
23
+ };
25
24
  }
26
25
  export type NavigationPanelOptions = Omit<DialFileManagerNavigationPanelProps, 'path' | 'makeHref' | 'onItemClick'>;
27
26
  export interface GridOptions extends Omit<DialGridProps<GridRow>, 'rowData' | 'columnDefs'> {
@@ -41,6 +40,8 @@ export interface DialFileManagerProps {
41
40
  bulkActionsToolbarOptions?: BulkActionsToolbarOptions;
42
41
  onPathChange?: (nextPath?: string) => void;
43
42
  onTableFileClick?: (file: GridRow) => void;
43
+ onCopyFiles?: (files: string[], destination: string) => void;
44
+ onMoveToFiles?: (files: string[], destination: string) => void;
44
45
  }
45
46
  /**
46
47
  * File Manager layout with a collapsible folders tree, breadcrumb/search header, and a data grid.
@@ -50,6 +51,7 @@ export interface DialFileManagerProps {
50
51
  * - The grid shows children of the current folder. When a search query is present, it scans all nested descendants.
51
52
  * - Pluggable tree, navigation panel, and grid behaviors via `treeOptions`, `navigationPanelOptions`, and `gridOptions`.
52
53
  * - Optional filters toggle via `gridOptions.filterable` (default `true`).
54
+ * - Supports bulk actions toolbar when items are selected.
53
55
  *
54
56
  * @example
55
57
  * ```tsx
@@ -74,9 +76,16 @@ export interface DialFileManagerProps {
74
76
  * items={files}
75
77
  * treeOptions={{ width: 300, title: 'Explorer', showFiles: true }}
76
78
  * />
79
+ *
80
+ * // With explicit provider (advanced apps)
81
+ * <FileManagerProvider items={files} path="/All files">
82
+ * <MyCustomHeader />
83
+ * <DialFileManagerView /> // internal view
84
+ * <MyCustomFooter />
85
+ * </FileManagerProvider>
77
86
  * ```
78
87
  *
79
- * @param [path] - Absolute path of the current location (e.g., "/All files/Design/Icons")
88
+ * @param [path] - Absolute path of the current location (e.g. "/All files/Design/Icons")
80
89
  * @param [cssClass] - Additional classes for the root container
81
90
  * @param [items] - Full hierarchical list of files and folders used by both tree and grid
82
91
  *
@@ -88,6 +97,15 @@ export interface DialFileManagerProps {
88
97
  *
89
98
  * @param [onPathChange] - Callback fired when user navigates via tree or breadcrumb
90
99
  * @param [onTableFileClick] - Callback fired when a file row is clicked in the grid
100
+ *
101
+ * @param [onCopyFiles] - Callback fired when files copy-paste
102
+ * @param [onMoveToFiles] - Callback fired when files cut-paste or rename
91
103
  */
92
104
  export declare const DialFileManager: FC<DialFileManagerProps>;
105
+ /**
106
+ * Internal view-only component.
107
+ * Reads all data from FileManagerContext and renders the actual layout.
108
+ * This is what apps can reuse if they want to control the provider manually.
109
+ */
110
+ export declare const DialFileManagerView: FC;
93
111
  export {};
@@ -0,0 +1,50 @@
1
+ import { DialFile, DialFileNodeType } from '../../models/file';
2
+ import { FileTreeOptions, NavigationPanelOptions, GridOptions, ToolbarOptions, BulkActionsToolbarOptions, DialFileManagerProps } from './FileManager';
3
+ export interface FileManagerGridRow {
4
+ id: string;
5
+ name: string;
6
+ updatedAt?: string;
7
+ size?: string;
8
+ author?: string;
9
+ path: string;
10
+ nodeType: DialFileNodeType;
11
+ extension?: string;
12
+ }
13
+ export interface FileManagerContextValue {
14
+ cssClass?: string;
15
+ items: DialFile[];
16
+ treeOptions?: FileTreeOptions;
17
+ navigationPanelOptions?: NavigationPanelOptions;
18
+ gridOptions?: GridOptions;
19
+ toolbarOptions?: ToolbarOptions;
20
+ bulkActionsToolbarOptions?: BulkActionsToolbarOptions;
21
+ currentPath?: string;
22
+ setCurrentPath: (p?: string) => void;
23
+ searchValue: string;
24
+ effectiveSearchValue: string;
25
+ setSearchValue: (v: string) => void;
26
+ areHiddenFilesVisible: boolean;
27
+ toggleHiddenFilesVisibility: () => void;
28
+ isTreeCollapsed: boolean;
29
+ toggleTreeCollapse: () => void;
30
+ selectedIds: Set<string>;
31
+ setSelectedIds: (next: Set<string>) => void;
32
+ clearSelection: () => void;
33
+ currentFolder?: DialFile;
34
+ gridRows: FileManagerGridRow[];
35
+ clipboard: {
36
+ copied: Set<string>;
37
+ cut: Set<string>;
38
+ hasItems: boolean;
39
+ };
40
+ onCopy: (files: string[]) => void;
41
+ onCut: (files: string[]) => void;
42
+ onPaste: () => void;
43
+ handlePathChange: (nextPath?: string) => void;
44
+ handleTreeItemClick: (item: DialFile) => void;
45
+ handleBreadcrumbItemClick: (href?: string) => void;
46
+ handleSearchChange: (value?: string) => void;
47
+ handleTableRowClick: (row: FileManagerGridRow) => void;
48
+ onTableFileClick?: DialFileManagerProps['onTableFileClick'];
49
+ }
50
+ export declare const FileManagerContext: import('react').Context<FileManagerContextValue | undefined>;
@@ -0,0 +1,17 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { DialFileManagerProps } from './FileManager';
3
+ export interface FileManagerProviderProps extends Omit<DialFileManagerProps, 'children'> {
4
+ children: ReactNode;
5
+ }
6
+ /**
7
+ * Provider that encapsulates all File Manager business logic:
8
+ * - path & navigation
9
+ * - search (controlled + uncontrolled)
10
+ * - hidden files toggle
11
+ * - tree collapsed state
12
+ * - selection
13
+ * - clipboard (copy / cut / paste)
14
+ * - computed grid rows
15
+ *
16
+ */
17
+ export declare const FileManagerProvider: FC<FileManagerProviderProps>;
@@ -0,0 +1,16 @@
1
+ export interface UseFileClipboardOptions {
2
+ getDestination: () => string;
3
+ onCopyFiles?: (files: string[], destination: string) => void;
4
+ onMoveToFiles?: (files: string[], destination: string) => void;
5
+ }
6
+ export declare const useFileClipboard: ({ getDestination, onCopyFiles, onMoveToFiles, }: UseFileClipboardOptions) => {
7
+ state: {
8
+ copied: Set<string>;
9
+ cut: Set<string>;
10
+ hasItems: boolean;
11
+ };
12
+ copy: (files: string[]) => void;
13
+ cut: (files: string[]) => void;
14
+ paste: () => void;
15
+ clear: () => void;
16
+ };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Hook to read the File Manager context.
3
+ * Throws if used outside of the provider.
4
+ */
5
+ export declare const useFileManagerContext: () => import('../FileManagerContext').FileManagerContextValue;
@@ -62,8 +62,10 @@ export { TagVariant } from './types/tag';
62
62
  export { TabOrientation } from './types/tab';
63
63
  export type { DialBreadcrumbPathItem } from './models/breadcrumb';
64
64
  export { FormItemOrientation } from './types/form-item';
65
- export { DialFileManagerTabs } from './types/file-manager';
65
+ export { DialFileManagerTabs, DialFileManagerActions, } from './types/file-manager';
66
66
  export { useDialFileManagerTabs } from './components/FileManager/hooks/use-file-manager-tabs';
67
+ export { FileManagerProvider } from './components/FileManager/FileManagerProvider';
68
+ export { useFileManagerContext } from './components/FileManager/hooks/use-file-manager-context';
67
69
  export { StepStatus } from './models/step';
68
70
  export type { Step } from './models/step';
69
71
  export type { RadioButtonWithContent } from './models/radio';
@@ -3,3 +3,9 @@ export declare enum DialFileManagerTabs {
3
3
  Shared = "shared",
4
4
  Organization = "organization"
5
5
  }
6
+ export declare enum DialFileManagerActions {
7
+ Copy = "copy",
8
+ Cut = "cut",
9
+ Paste = "paste",
10
+ Rename = "rename"
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-ui-kit",
3
- "version": "0.4.0-rc.24",
3
+ "version": "0.4.0-rc.25",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "description": "A modern UI kit for building AI DIAL interfaces with React",