@epam/ai-dial-react-file-manager 0.1.0-dev.13

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 (65) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +144 -0
  3. package/dist/ai-dial-react-file-manager.es.js +5188 -0
  4. package/dist/index.css +1 -0
  5. package/dist/src/components/FileManager/FileManager.d.ts +319 -0
  6. package/dist/src/components/FileManager/FileManagerContext.d.ts +180 -0
  7. package/dist/src/components/FileManager/FileManagerProvider.d.ts +20 -0
  8. package/dist/src/components/FileManager/FileManagerTooltip.d.ts +12 -0
  9. package/dist/src/components/FileManager/components/ConflictResolutionPopup/ConflictResolutionPopup.d.ts +90 -0
  10. package/dist/src/components/FileManager/components/DestinationFolderPopup/DestinationFolderPopup.d.ts +68 -0
  11. package/dist/src/components/FileManager/components/DialFileManagerItemSummaryCell/DialFileManagerItemSummaryCell.d.ts +63 -0
  12. package/dist/src/components/FileManager/components/FileManagerBulkActionsToolbar/FileManagerBulkActionsToolbar.d.ts +56 -0
  13. package/dist/src/components/FileManager/components/FileManagerBulkActionsToolbar/constants.d.ts +3 -0
  14. package/dist/src/components/FileManager/components/FileManagerDeleteConfirmationPopup/FileManagerDeleteConfirmationPopup.d.ts +26 -0
  15. package/dist/src/components/FileManager/components/FileManagerItemIcon/FileManagerItemIcon.d.ts +50 -0
  16. package/dist/src/components/FileManager/components/FileManagerItemName/FileManagerItemName.d.ts +57 -0
  17. package/dist/src/components/FileManager/components/FileManagerItemNameInput/FileManagerItemNameInput.d.ts +71 -0
  18. package/dist/src/components/FileManager/components/FileManagerNavigationPanel/FileManagerNavigationPanel.d.ts +63 -0
  19. package/dist/src/components/FileManager/components/FileManagerNavigationPanel/constants.d.ts +3 -0
  20. package/dist/src/components/FileManager/components/FileManagerToolbar/DialFileManagerToolbar.d.ts +74 -0
  21. package/dist/src/components/FileManager/components/FileMetadataPopup/FileMetadataPopup.d.ts +50 -0
  22. package/dist/src/components/FileManager/components/FileMetadataPopup/constants.d.ts +6 -0
  23. package/dist/src/components/FileManager/components/FoldersTree/FoldersTree.d.ts +132 -0
  24. package/dist/src/components/FileManager/components/FoldersTree/constants.d.ts +6 -0
  25. package/dist/src/components/FileManager/components/FoldersTree/hooks/use-expanded-paths.d.ts +13 -0
  26. package/dist/src/components/FileManager/constants.d.ts +21 -0
  27. package/dist/src/components/FileManager/errors.d.ts +6 -0
  28. package/dist/src/components/FileManager/hooks/use-bulk-actions.d.ts +30 -0
  29. package/dist/src/components/FileManager/hooks/use-collapse-tree.d.ts +9 -0
  30. package/dist/src/components/FileManager/hooks/use-conflict-resolution.d.ts +27 -0
  31. package/dist/src/components/FileManager/hooks/use-current-path.d.ts +13 -0
  32. package/dist/src/components/FileManager/hooks/use-file-clipboard.d.ts +37 -0
  33. package/dist/src/components/FileManager/hooks/use-file-delete.d.ts +13 -0
  34. package/dist/src/components/FileManager/hooks/use-file-download.d.ts +9 -0
  35. package/dist/src/components/FileManager/hooks/use-file-manager-columns.d.ts +43 -0
  36. package/dist/src/components/FileManager/hooks/use-file-manager-context.d.ts +5 -0
  37. package/dist/src/components/FileManager/hooks/use-file-manager-tabs.d.ts +7 -0
  38. package/dist/src/components/FileManager/hooks/use-file-metadata.d.ts +10 -0
  39. package/dist/src/components/FileManager/hooks/use-file-search.d.ts +23 -0
  40. package/dist/src/components/FileManager/hooks/use-file-upload.d.ts +62 -0
  41. package/dist/src/components/FileManager/hooks/use-folder-creation.d.ts +30 -0
  42. package/dist/src/components/FileManager/hooks/use-grid-actions-column.d.ts +15 -0
  43. package/dist/src/components/FileManager/hooks/use-grid-context-menu.d.ts +43 -0
  44. package/dist/src/components/FileManager/hooks/use-item-renaming.d.ts +22 -0
  45. package/dist/src/components/FileManager/hooks/use-new-actions.d.ts +23 -0
  46. package/dist/src/components/FileManager/hooks/use-paths-selection.d.ts +13 -0
  47. package/dist/src/components/FileManager/hooks/use-show-hidden-files.d.ts +9 -0
  48. package/dist/src/components/FileManager/hooks/use-tree-additional-buttons.d.ts +22 -0
  49. package/dist/src/components/FileManager/hooks/use-trigger-view-create-folder.d.ts +26 -0
  50. package/dist/src/components/FileManager/hooks/use-trigger-view-rename.d.ts +20 -0
  51. package/dist/src/components/FileManager/utils.d.ts +58 -0
  52. package/dist/src/constants/file-grid-columns.d.ts +4 -0
  53. package/dist/src/hooks/use-flexible-actions.d.ts +88 -0
  54. package/dist/src/hooks/use-is-mobile-screen.d.ts +15 -0
  55. package/dist/src/hooks/use-width-breakpoint.d.ts +25 -0
  56. package/dist/src/index.d.ts +18 -0
  57. package/dist/src/models/base-entity.d.ts +4 -0
  58. package/dist/src/models/file-manager.d.ts +19 -0
  59. package/dist/src/models/file.d.ts +39 -0
  60. package/dist/src/models/selection-mode.d.ts +4 -0
  61. package/dist/src/types/file-manager.d.ts +59 -0
  62. package/dist/src/types/screen.d.ts +6 -0
  63. package/dist/src/utils/mobile.d.ts +49 -0
  64. package/dist/src/utils/path.d.ts +10 -0
  65. package/package.json +141 -0
@@ -0,0 +1,9 @@
1
+ export interface UseShowHiddenFilesOptions {
2
+ showHiddenFiles?: boolean;
3
+ onShowHiddenFilesChange?: (showHiddenFiles: boolean) => void;
4
+ }
5
+ export declare const useShowHiddenFiles: (options?: UseShowHiddenFilesOptions) => {
6
+ areHiddenFilesVisible: boolean;
7
+ toggleHiddenFilesVisibility: () => void;
8
+ setAreHiddenFilesVisible: (value: boolean) => void;
9
+ };
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from '../../../../node_modules/react';
2
+ interface useTreeAdditionalButtonsOptions {
3
+ additionalButtons?: ReactNode;
4
+ expandedPathsLength: number;
5
+ collapseAll: () => void;
6
+ }
7
+ /**
8
+ * Provides additional action buttons for the tree component, including a
9
+ * built-in "Collapse All" button. The hook memoizes the returned JSX to avoid
10
+ * unnecessary re-renders and applies disabled state automatically based on
11
+ * the number of expanded paths.
12
+ *
13
+ * @param {ReactNode} [additionalButtons] - Optional custom buttons rendered before the Collapse All button.
14
+ * @param {number} expandedPathsLength - Number of currently expanded paths in the tree.
15
+ * @param {() => void} collapseAll - Callback fired when the Collapse All button is clicked.
16
+ *
17
+ * @returns {{ additionalButtons: ReactNode }} - The rendered buttons fragment.
18
+ */
19
+ export declare const useTreeAdditionalButtons: ({ additionalButtons, expandedPathsLength, collapseAll, }: useTreeAdditionalButtonsOptions) => {
20
+ additionalButtons: import("react/jsx-runtime").JSX.Element;
21
+ };
22
+ export {};
@@ -0,0 +1,26 @@
1
+ import { DialFile } from '../../../models/file';
2
+ import { FileManagerCreateFolderTriggerView } from '../../../types/file-manager';
3
+ interface UseTriggerViewCreateFolderOptions {
4
+ onGridAddSibling?: (files: DialFile[]) => void;
5
+ onGridAddChild?: (files: DialFile[]) => void;
6
+ onTreeAddSibling?: (files: DialFile[]) => void;
7
+ onTreeAddChild?: (files: DialFile[]) => void;
8
+ }
9
+ /**
10
+ * Manages which view ("tree" or "grid") triggered a folder creation action.
11
+ *
12
+ * Useful when both TreeView and GridView can initiate folder creation,
13
+ * and the parent needs to know which source triggered it
14
+ * to apply view-specific logic or UI updates.
15
+ *
16
+ * Returns the last folder creation trigger source and four handlers
17
+ * (`onGridCreateSiblingFolder`, `onTreeCreateSiblingFolder`, `onGridCreateChildFolder`, `onTreeCreateChildFolder`) that wrap the provided `onGridAddSibling`, `onTreeAddSibling`, `onGridAddChild` and `onTreeAddChild` callbacks.
18
+ */
19
+ export declare const useTriggerViewCreateFolder: ({ onGridAddSibling, onGridAddChild, onTreeAddSibling, onTreeAddChild, }: UseTriggerViewCreateFolderOptions) => {
20
+ createFolderTriggerView: FileManagerCreateFolderTriggerView;
21
+ onGridCreateSiblingFolder: (files: DialFile[]) => void;
22
+ onTreeCreateSiblingFolder: (files: DialFile[]) => void;
23
+ onGridCreateChildFolder: (files: DialFile[]) => void;
24
+ onTreeCreateChildFolder: (files: DialFile[]) => void;
25
+ };
26
+ export {};
@@ -0,0 +1,20 @@
1
+ import { FileManagerRenameTriggerView } from '../../../types/file-manager';
2
+ interface UseTriggerViewRenameOptions {
3
+ onRename: (path: string) => void;
4
+ }
5
+ /**
6
+ * Manages which view ("tree" or "grid") triggered a rename action.
7
+ *
8
+ * Useful when both TreeView and GridView can initiate renaming,
9
+ * and the parent needs to know which source triggered it
10
+ * to apply view-specific logic or UI updates.
11
+ *
12
+ * Returns the last rename trigger source and two handlers
13
+ * (`onGridRename`, `onTreeRename`) that wrap the provided `onRename` callback.
14
+ */
15
+ export declare const useTriggerViewRename: ({ onRename, }: UseTriggerViewRenameOptions) => {
16
+ renameTriggerView: FileManagerRenameTriggerView;
17
+ onGridRename: (path: string) => void;
18
+ onTreeRename: (path: string) => void;
19
+ };
20
+ export {};
@@ -0,0 +1,58 @@
1
+ import { DialFile } from '../../models/file';
2
+ import { DialFileAcceptType } from '../../models/file-manager';
3
+ import { ReactNode } from '../../../node_modules/react';
4
+ import { FileManagerGridRow } from './FileManagerContext';
5
+ export declare const findNodeByPath: (nodes: DialFile[] | undefined, path: string) => DialFile | undefined;
6
+ export declare const findFolderForPath: (root: DialFile[] | undefined, path?: string) => DialFile | undefined;
7
+ export declare const normalizeToLowerCase: (input?: string) => string;
8
+ export declare const normalizeExtensionWithoutDot: (input?: string) => string;
9
+ export declare const collectAllDescendants: (folder?: DialFile) => DialFile[];
10
+ export declare const isHiddenDotFile: (node: DialFile) => boolean;
11
+ /**
12
+ * Formats bytes into a short, human-readable string.
13
+ *
14
+ * @param bytes - Number of bytes to format
15
+ * @returns Formatted string (e.g., "15.0 MB", "150 KB", "512 bytes")
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * formatBytes(2150) // "2 KB"
20
+ * formatBytes(15728640) // "15.0 MB"
21
+ * formatBytes(512) // "512 bytes"
22
+ * ```
23
+ */
24
+ export declare const formatBytes: (bytes?: number) => string;
25
+ /**
26
+ * Formats date string into a localized date string.
27
+ *
28
+ * @param date - ISO date string or any valid date string
29
+ * @param locale - BCP 47 language tag (e.g., 'en-US', 'ru-RU')
30
+ * @param options - Intl.DateTimeFormat options
31
+ * @returns Formatted date string or original string if formatting fails
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * formatDate('2025-09-05T10:30:00Z', 'en-US', { year: 'numeric', month: 'short', day: '2-digit' })
36
+ * // "Sep 05, 2025"
37
+ *
38
+ * formatDate('2025-09-05T10:30:00Z', 'ru-RU', { year: 'numeric', month: 'long', day: 'numeric' })
39
+ * // "5 сентября 2025 г."
40
+ * ```
41
+ */
42
+ export declare const formatDate: (date?: string, locale?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions) => string;
43
+ export declare function isFileAccepted(allowedFileTypes: DialFileAcceptType[] | undefined, contentType: string, fileName?: string): boolean;
44
+ export declare const formatAllowedFileTypesForTooltip: (allowedFileTypes: DialFileAcceptType[] | undefined) => string;
45
+ export declare const getExtensionsListForMimeType: (mimeType: string) => string[];
46
+ export declare const cleanForbiddenSymbolsRegExp: (forbiddenSymbolsRegExp?: RegExp) => RegExp | undefined;
47
+ export declare function getForbiddenSymbolsTooltip(item: {
48
+ name: string;
49
+ isFolder: boolean;
50
+ }, forbiddenSymbolsRegExp?: RegExp, forbiddenSymbolsTooltip?: ReactNode): ReactNode | undefined;
51
+ export declare const splitPathAndName: (fullPath: string) => {
52
+ parent: string;
53
+ name: string;
54
+ };
55
+ export declare const isFileSelectable: (file: Pick<DialFile, "contentLength" | "contentType" | "name">, allowedFileTypes?: DialFileAcceptType[], maxSelectableFileSize?: number) => boolean;
56
+ export declare const getRowTooltip: (file: FileManagerGridRow, allowedFileTypes?: DialFileAcceptType[], maxSelectableFileSize?: number, unsupportedFileTypeTooltip?: string, fileTooLargeTooltip?: string) => string | undefined;
57
+ export declare const getFolderNestingDepth: (folderPath: string) => number;
58
+ export declare const getNextFolderName: (existingFolders: DialFile[]) => string;
@@ -0,0 +1,4 @@
1
+ import { ColDef } from '../../node_modules/ag-grid-community';
2
+ export declare const NAME_COLUMN: (headerName: string) => (dateLocale: Intl.LocalesArgument, dateOptions: Intl.DateTimeFormatOptions | undefined, isCompactView: boolean) => ColDef;
3
+ export declare const UPDATED_AT_COLUMN: (headerName: string) => (dateLocale: Intl.LocalesArgument, dateOptions: Intl.DateTimeFormatOptions | undefined) => ColDef;
4
+ export declare const SIZE_COLUMN: (headerName: string) => ColDef;
@@ -0,0 +1,88 @@
1
+ import { FlexibleActionsDirection } from '@epam/ai-dial-ui-kit';
2
+ interface UseFlexibleActionsOptions<T> {
3
+ actions: T[];
4
+ direction?: FlexibleActionsDirection;
5
+ moreButtonWidth?: number;
6
+ actionsGap?: number;
7
+ containerPadding?: number;
8
+ dependencies?: unknown[];
9
+ }
10
+ /**
11
+ * A responsive layout hook that automatically determines how many action buttons
12
+ * can fit within a container and moves overflowing ones into a hidden list (e.g. a dropdown).
13
+ *
14
+ * It measures each action's width and dynamically recalculates visible and hidden actions
15
+ * whenever the container resizes or dependencies change. The first fit is computed in
16
+ * `useLayoutEffect` (before paint) so actions do not briefly show inline and then move
17
+ * into overflow after a later frame.
18
+ *
19
+ * This hook is reusable for toolbars or action strips that can have:
20
+ * - a **left fixed section** (e.g., selection info),
21
+ * - a **right fixed section** (e.g., metadata or pagination),
22
+ * - and a **flexible central section** where actions may overflow.
23
+ *
24
+ * @template T - Type of the action item. Each action must have a unique `key` property.
25
+ *
26
+ * @param {Object} options - Hook configuration options.
27
+ * @param {T[]} options.actions - Array of all available actions.
28
+ * @param {FlexibleActionsDirection} [options.direction=FlexibleActionsDirection.Normal] -
29
+ * Defines the fill direction:
30
+ * - `Normal`: Fills actions from left to right.
31
+ * - `Reverse`: Fills actions from right to left (useful when the "More" button is on the right).
32
+ * @param {number} [options.moreButtonWidth=BASE_ICON_SIZE] - Reserved width for the “more” or overflow button.
33
+ * @param {number} [options.actionsGap=8] - Horizontal gap (in pixels) between action buttons.
34
+ * @param {number} [options.containerPadding=8] - Horizontal padding (in pixels) inside the container.
35
+ * @param {unknown[]} [options.dependencies=[]] - Dependency array to trigger recalculation when external layout-affecting
36
+ * values (like screen size or visibility) change.
37
+ *
38
+ * @returns Result object containing the calculated visible and hidden actions and all relevant refs.
39
+ *
40
+ * @property {T[]} visibleActions - Actions that currently fit into the available width.
41
+ * @property {T[]} hiddenActions - Actions that do not fit and should be rendered inside a dropdown.
42
+ *
43
+ * @property {Object} refs - A set of refs used for layout measurement.
44
+ * @property {RefObject<HTMLDivElement>} refs.containerRef - Ref for the outer container. Must wrap the entire toolbar area.
45
+ * @property {RefObject<HTMLDivElement>} refs.measureRef - Ref for a hidden measurement container (used to measure action widths).
46
+ * @property {RefObject<HTMLDivElement>} refs.leftSectionRef - Ref for the left fixed section (optional).
47
+ * @property {RefObject<HTMLDivElement>} refs.rightSectionRef - Ref for the right fixed section (optional).
48
+ *
49
+ * @example
50
+ * // Example usage inside a toolbar component:
51
+ * const { visibleActions, hiddenActions, refs } = useFlexibleActions({
52
+ * actions,
53
+ * direction: FlexibleActionsDirection.Reverse,
54
+ * dependencies: [isMobile],
55
+ * });
56
+ *
57
+ * return (
58
+ * <>
59
+ * <div ref={refs.measureRef} className="invisible absolute top-0 left-0 flex gap-2">
60
+ * {actions.map(a => <ActionButton key={a.key} {...a} />)}
61
+ * </div>
62
+ *
63
+ * <div ref={refs.containerRef} className="flex justify-between items-center">
64
+ * <div ref={refs.leftSectionRef}>Left section</div>
65
+ *
66
+ * <div className="flex gap-2 items-center">
67
+ * {hiddenActions.length > 0 && <MoreMenu items={hiddenActions} />}
68
+ * {visibleActions.map(a => <ActionButton key={a.key} {...a} />)}
69
+ * </div>
70
+ *
71
+ * <div ref={refs.rightSectionRef}>Right section</div>
72
+ * </div>
73
+ * </>
74
+ * );
75
+ */
76
+ export declare function useFlexibleActions<T extends {
77
+ key: string;
78
+ }>({ actions, direction, moreButtonWidth, actionsGap, containerPadding, dependencies, }: UseFlexibleActionsOptions<T>): {
79
+ visibleActions: T[];
80
+ hiddenActions: T[];
81
+ refs: {
82
+ containerRef: import('../../node_modules/react').RefObject<HTMLDivElement | null>;
83
+ measureRef: import('../../node_modules/react').RefObject<HTMLDivElement | null>;
84
+ leftSectionRef: import('../../node_modules/react').RefObject<HTMLDivElement | null>;
85
+ rightSectionRef: import('../../node_modules/react').RefObject<HTMLDivElement | null>;
86
+ };
87
+ };
88
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A React hook that determines whether the current window size matches a mobile screen width.
3
+ *
4
+ * It initializes based on the current screen size using `isSmallScreen()` and updates its value
5
+ * whenever the window is resized.
6
+ *
7
+ * @returns {boolean} `true` if the viewport width matches the mobile breakpoint, otherwise `false`.
8
+ *
9
+ * @example
10
+ * const isMobile = useIsMobileScreen();
11
+ * if (isMobile) {
12
+ * console.log('Mobile layout active');
13
+ * }
14
+ */
15
+ export declare const useIsMobileScreen: () => boolean;
@@ -0,0 +1,25 @@
1
+ import { RefObject } from '../../node_modules/react';
2
+ /**
3
+ * A React hook that tracks the width of a DOM element and determines if it is smaller than a specified breakpoint.
4
+ *
5
+ * This hook returns a `ref` to attach to the element you want to observe and a boolean `isBelowBreakpoint`
6
+ * that becomes `true` when the element's width is less than the given `breakpoint`, and `false` otherwise.
7
+ * The value updates automatically when the element is resized.
8
+ *
9
+ * @param {number} breakpoint - The width in pixels used as the threshold. `isBelowBreakpoint` is true when the element's width is less than this value.
10
+ * @param customBreakpointRef - Custom ref to an element to observe instead of the one returned by this hook. If not provided, the hook will observe the element attached to `containerRef`.
11
+ * @returns {{ containerRef: RefObject<HTMLElement>, isBelowBreakpoint: boolean }} An object containing the ref to attach to your element and the boolean indicating if it is smaller than the breakpoint.
12
+ *
13
+ * @example
14
+ * const { containerRef, isBelowBreakpoint } = useWidthBreakpoint(600);
15
+ *
16
+ * return (
17
+ * <div ref={containerRef}>
18
+ * {isBelowBreakpoint ? 'Compact view' : 'Full view'}
19
+ * </div>
20
+ * );
21
+ */
22
+ export declare function useWidthBreakpoint(breakpoint: number, customBreakpointRef?: RefObject<HTMLElement | null>): {
23
+ containerRef: RefObject<HTMLElement | null>;
24
+ isBelowBreakpoint: boolean;
25
+ };
@@ -0,0 +1,18 @@
1
+ export { DialFileManager } from './components/FileManager/FileManager';
2
+ export type { BulkActionsToolbarOptions, CreateFolderValidationMessages, DeleteConfirmationOptions, DialFileManagerConflictResolutionPopupOptions, DialFileManagerDestinationFolderPopupOptions, DialFileManagerProps, FileMetadataPopupOptions, FileTreeOptions, GridOptions, NavigationPanelOptions, NewAction, ToolbarOptions, } from './components/FileManager/FileManager';
3
+ export { DialDestinationFolderPopup } from './components/FileManager/components/DestinationFolderPopup/DestinationFolderPopup';
4
+ export type { DestinationFolderPopupProps } from './components/FileManager/components/DestinationFolderPopup/DestinationFolderPopup';
5
+ export { DialFoldersTree } from './components/FileManager/components/FoldersTree/FoldersTree';
6
+ export type { DialFoldersTreeProps } from './components/FileManager/components/FoldersTree/FoldersTree';
7
+ export type { FileManagerContextValue, FileManagerGridRow, } from './components/FileManager/FileManagerContext';
8
+ export { FileManagerProvider } from './components/FileManager/FileManagerProvider';
9
+ export type { FileManagerProviderProps } from './components/FileManager/FileManagerProvider';
10
+ export { useFileManagerContext } from './components/FileManager/hooks/use-file-manager-context';
11
+ export { useDialFileManagerTabs } from './components/FileManager/hooks/use-file-manager-tabs';
12
+ export type { DialFile } from './models/file';
13
+ export { DialFileNodeType, DialFilePermission, DialFileResourceType, } from './models/file';
14
+ export type { DialRootFolder } from './models/file';
15
+ export { type DialCopiedItem, type DialDeletedItem, type DialFileAcceptType, type DialFileManagerActionsRef, type DialUploadFileItem, } from './models/file-manager';
16
+ export { GridSelectionMode } from './models/selection-mode';
17
+ export { DestinationFolderMode, DialFileManagerActions, DialFileManagerConflictActions, DialFileManagerConflictStrategies, DialFileManagerTabs, FileManagerColumnKey, FileManagerCreateFolderTriggerView, FileManagerCreateFolderType, FileManagerRenameTriggerView, } from './types/file-manager';
18
+ export { NAME_COLUMN, SIZE_COLUMN, UPDATED_AT_COLUMN, } from './constants/file-grid-columns';
@@ -0,0 +1,4 @@
1
+ export interface DialModifiedEntity {
2
+ createdAt?: string;
3
+ updatedAt?: string;
4
+ }
@@ -0,0 +1,19 @@
1
+ import { DialFileNodeType } from './file';
2
+ export interface DialCopiedItem {
3
+ sourceUrl: string;
4
+ destinationUrl: string;
5
+ overwrite?: boolean;
6
+ nodeType: DialFileNodeType;
7
+ }
8
+ export interface DialDeletedItem {
9
+ sourceUrl: string;
10
+ nodeType: DialFileNodeType;
11
+ }
12
+ export interface DialUploadFileItem {
13
+ fileContent: File;
14
+ name: string;
15
+ }
16
+ export interface DialFileManagerActionsRef {
17
+ createFolder: () => void;
18
+ }
19
+ export type DialFileAcceptType = `${string}/${string}` | `.${string}`;
@@ -0,0 +1,39 @@
1
+ import { DialModifiedEntity } from './base-entity';
2
+ export interface DialFile extends DialModifiedEntity {
3
+ bucket?: string;
4
+ contentLength?: number;
5
+ contentType?: string;
6
+ nodeType: DialFileNodeType;
7
+ parentPath?: string | null;
8
+ resourceType?: DialFileResourceType;
9
+ url?: string;
10
+ items?: DialFile[];
11
+ path: string;
12
+ name: string;
13
+ folderId: string;
14
+ owner?: string;
15
+ author?: string;
16
+ nextToken?: string;
17
+ extension?: string;
18
+ id?: string;
19
+ permissions?: DialFilePermission[];
20
+ }
21
+ export declare enum DialFileNodeType {
22
+ ITEM = "item",
23
+ FOLDER = "folder"
24
+ }
25
+ export declare enum DialFileResourceType {
26
+ FILE = "FILE",
27
+ PROMPT = "PROMPT",
28
+ CONVERSATION = "CONVERSATION",
29
+ APPLICATION = "APPLICATION",
30
+ TOOLSET = "TOOL_SET"
31
+ }
32
+ export declare enum DialFilePermission {
33
+ READ = "READ",
34
+ WRITE = "WRITE",
35
+ SHARE = "SHARE"
36
+ }
37
+ export interface DialRootFolder extends DialFile {
38
+ label: string;
39
+ }
@@ -0,0 +1,4 @@
1
+ export declare enum GridSelectionMode {
2
+ MULTIPLE = "MULTIPLE",
3
+ SINGLE = "SINGLE"
4
+ }
@@ -0,0 +1,59 @@
1
+ export declare enum DialFileManagerTabs {
2
+ MyFiles = "my_files",
3
+ Shared = "shared",
4
+ Organization = "organization",
5
+ Review = "review"
6
+ }
7
+ export declare enum DialFileManagerActions {
8
+ AddSibling = "addSibling",
9
+ AddChild = "addChild",
10
+ Duplicate = "duplicate",
11
+ Copy = "copy",
12
+ Move = "move",
13
+ Download = "download",
14
+ Delete = "delete",
15
+ Rename = "rename",
16
+ Info = "info",
17
+ Unshare = "unshare",
18
+ RemoveAccess = "removeAccess",
19
+ ManagePermissions = "managePermissions",
20
+ Preview = "preview",
21
+ OpenInNewTab = "openInNewTab"
22
+ }
23
+ export declare enum DialFileManagerConflictActions {
24
+ Replace = "replace",
25
+ Duplicate = "duplicate",
26
+ Cancel = "cancel"
27
+ }
28
+ export declare enum DialFileManagerConflictStrategies {
29
+ ReplaceAll = "replaceAll",
30
+ DuplicateAll = "duplicateAll",
31
+ DecideForEach = "decideForEach"
32
+ }
33
+ export declare enum DestinationFolderMode {
34
+ Copy = "copy",
35
+ Move = "move"
36
+ }
37
+ export declare enum FileManagerRenameTriggerView {
38
+ Tree = "tree",
39
+ Grid = "grid"
40
+ }
41
+ export declare enum FileManagerCreateFolderTriggerView {
42
+ Tree = "tree",
43
+ Grid = "grid"
44
+ }
45
+ export declare enum FileManagerCreateFolderType {
46
+ Folder = "folder",
47
+ Child = "child",
48
+ Sibling = "sibling"
49
+ }
50
+ export declare enum FileManagerColumnKey {
51
+ Name = "name",
52
+ UpdatedAt = "updatedAt",
53
+ Size = "size",
54
+ Author = "author",
55
+ Owner = "owner",
56
+ Path = "path",
57
+ Actions = "__actions",
58
+ Version = "version"
59
+ }
@@ -0,0 +1,6 @@
1
+ export declare enum ScreenType {
2
+ Undefined = "undefined",
3
+ Mobile = "mobile",
4
+ Tablet = "tablet",
5
+ Desktop = "desktop"
6
+ }
@@ -0,0 +1,49 @@
1
+ import { ScreenType } from '../types/screen';
2
+ /**
3
+ * Checks if the current viewport width is within the "medium" (tablet) screen range.
4
+ *
5
+ * Specifically, it returns `true` if the window width is less than 1280 pixels.
6
+ * Safely handles server-side rendering by verifying that `window` is defined.
7
+ *
8
+ * @returns {boolean} `true` if the viewport width is less than 1279px, otherwise `false`.
9
+ *
10
+ * @example
11
+ * if (isMediumScreen()) {
12
+ * console.log('Tablet or smaller screen detected');
13
+ * }
14
+ */
15
+ export declare const isMediumScreen: () => boolean;
16
+ /**
17
+ * Checks if the current viewport width is within the "small" (mobile) screen range.
18
+ *
19
+ * Specifically, it returns `true` if the window width is less than 640 pixels.
20
+ * Safely handles server-side rendering by verifying that `window` is defined.
21
+ *
22
+ * @returns {boolean} `true` if the viewport width is less than 640px, otherwise `false`.
23
+ *
24
+ * @example
25
+ * if (isSmallScreen()) {
26
+ * console.log('Mobile screen detected');
27
+ * }
28
+ */
29
+ export declare const isSmallScreen: () => boolean;
30
+ /**
31
+ * Determines the current screen type based on the viewport width.
32
+ *
33
+ * Categorizes the screen into one of three types defined by `ScreenType`:
34
+ * - `ScreenType.Desktop` for widths **≥ 1024px**
35
+ * - `ScreenType.Tablet` for widths **between 640px and 1023px**
36
+ * - `ScreenType.Mobile` for widths **< 640px**
37
+ *
38
+ * If executed in a non-browser environment (where `window` is undefined),
39
+ * it returns `ScreenType.Undefined`.
40
+ *
41
+ * @returns {ScreenType} The detected screen type (`Desktop`, `Tablet`, `Mobile`, or `Undefined`).
42
+ *
43
+ * @example
44
+ * const screenType = getScreenType();
45
+ * if (screenType === ScreenType.Mobile) {
46
+ * console.log('Mobile layout activated');
47
+ * }
48
+ */
49
+ export declare const getScreenType: () => ScreenType;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Splits a path string into normalized, non-empty segments.
3
+ *
4
+ * Trims whitespace from each segment and removes empty values
5
+ * caused by leading, trailing, or repeated slashes.
6
+ *
7
+ * @param path - A path string (e.g. "Org / Design / Assets/")
8
+ * @returns An array of path segments
9
+ */
10
+ export declare const getSegments: (path: string) => string[];
package/package.json ADDED
@@ -0,0 +1,141 @@
1
+ {
2
+ "name": "@epam/ai-dial-react-file-manager",
3
+ "version": "0.1.0-dev.13",
4
+ "type": "module",
5
+ "license": "Apache-2.0",
6
+ "description": "React file manager package for AI DIAL interfaces",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/epam/ai-dial-react-file-manager.git"
10
+ },
11
+ "homepage": "https://github.com/epam/ai-dial-react-file-manager#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/epam/ai-dial-react-file-manager/issues"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public",
17
+ "registry": "https://registry.npmjs.org/",
18
+ "provenance": true
19
+ },
20
+ "keywords": [
21
+ "ai-dial",
22
+ "file-manager",
23
+ "react"
24
+ ],
25
+ "module": "dist/ai-dial-react-file-manager.es.js",
26
+ "types": "dist/src/index.d.ts",
27
+ "engines": {
28
+ "node": ">=22.2.0",
29
+ "npm": ">=10.7.0"
30
+ },
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/src/index.d.ts",
34
+ "import": "./dist/ai-dial-react-file-manager.es.js",
35
+ "default": "./dist/ai-dial-react-file-manager.es.js"
36
+ },
37
+ "./styles.css": {
38
+ "default": "./dist/index.css"
39
+ }
40
+ },
41
+ "files": [
42
+ "dist"
43
+ ],
44
+ "sideEffects": [
45
+ "*.css",
46
+ "*.scss"
47
+ ],
48
+ "scripts": {
49
+ "dev": "vite",
50
+ "build": "vite build && npm run build:css",
51
+ "build:css": "tailwindcss -m -i ./src/styles/tailwind-entry.scss -o ./dist/index.css",
52
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
53
+ "lint:check": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
54
+ "typecheck": "tsc --noEmit",
55
+ "test:run": "vitest run",
56
+ "test:package": "node tools/package-smoke.mjs",
57
+ "verify:agent-hook": "npm run typecheck && npm run lint:check && npm run test:run",
58
+ "test": "vitest --coverage",
59
+ "format": "prettier --check .",
60
+ "format-fix": "prettier --write .",
61
+ "preview": "vite preview",
62
+ "storybook": "concurrently \"npm run storybook:css\" \"storybook dev -p 6006\"",
63
+ "storybook:css": "tailwindcss -w -i ./src/styles/tailwind-entry.scss -o ./src/index.css",
64
+ "build-storybook": "concurrently \"npm run build-storybook:css\" \"storybook build\"",
65
+ "build-storybook:css": "tailwindcss -m -i ./src/styles/tailwind-entry.scss -o ./src/index.css",
66
+ "prepare": "node tools/setup-husky.mjs",
67
+ "publish:npm": "npm publish --access public",
68
+ "publish:dry": "npm publish --access public --dry-run --provenance=false",
69
+ "storybook-docs": "storybook dev --docs",
70
+ "build-storybook-docs": "storybook build --docs",
71
+ "review:check": "node scripts/agent-review-check.mjs",
72
+ "review:check:strict": "node scripts/agent-review-check.mjs --strict"
73
+ },
74
+ "lint-staged": {
75
+ "*.{ts,tsx}": [
76
+ "npm run lint"
77
+ ]
78
+ },
79
+ "dependencies": {
80
+ "classnames": "^2.5.1",
81
+ "mime-types": "^3.0.2"
82
+ },
83
+ "peerDependencies": {
84
+ "@epam/ai-dial-ui-kit": "0.13.0-dev.25",
85
+ "@tabler/icons-react": "^3.41.1",
86
+ "ag-grid-community": "^35.2.1",
87
+ "ag-grid-react": "^35.2.1",
88
+ "react": "^19.2.5",
89
+ "react-dom": "^19.2.5"
90
+ },
91
+ "devDependencies": {
92
+ "@epam/ai-dial-ui-kit": "0.13.0-dev.25",
93
+ "@floating-ui/react": "^0.27.19",
94
+ "@chromatic-com/storybook": "^5.1.2",
95
+ "@eslint/js": "^9.39.2",
96
+ "@storybook/addon-a11y": "^10.3.6",
97
+ "@storybook/addon-docs": "^10.3.6",
98
+ "@storybook/addon-vitest": "^10.3.6",
99
+ "@storybook/react-vite": "^10.3.6",
100
+ "@testing-library/dom": "^10.4.1",
101
+ "@testing-library/jest-dom": "^6.9.1",
102
+ "@testing-library/react": "^16.3.0",
103
+ "@types/mime-types": "^3.0.1",
104
+ "@types/node": "^25.6.0",
105
+ "@types/react": "^19.2.14",
106
+ "@types/react-dom": "^19.2.3",
107
+ "@typescript-eslint/eslint-plugin": "^8.59.1",
108
+ "@typescript-eslint/parser": "^8.59.1",
109
+ "@vitejs/plugin-react": "^4.6.0",
110
+ "@vitest/coverage-v8": "^4.1.10",
111
+ "autoprefixer": "^10.5.0",
112
+ "concurrently": "^9.2.4",
113
+ "eslint": "^9.39.2",
114
+ "eslint-config-prettier": "^10.1.8",
115
+ "eslint-plugin-import": "^2.32.0",
116
+ "eslint-plugin-jsx-a11y": "^6.10.2",
117
+ "eslint-plugin-prettier": "^5.5.5",
118
+ "eslint-plugin-react": "^7.37.5",
119
+ "eslint-plugin-react-hooks": "^7.1.1",
120
+ "eslint-plugin-storybook": "^10.2.17",
121
+ "eslint-plugin-tailwindcss": "^3.18.3",
122
+ "globals": "^16.3.0",
123
+ "husky": "^9.1.7",
124
+ "jsdom": "^26.1.0",
125
+ "lint-staged": "^16.1.2",
126
+ "postcss": "^8.5.25",
127
+ "postcss-import": "^16.1.1",
128
+ "prettier": "^3.8.3",
129
+ "sass": "^1.99.0",
130
+ "sass-embedded": "^1.99.0",
131
+ "storybook": "^10.3.6",
132
+ "storybook-addon-pseudo-states": "^10.3.6",
133
+ "tailwindcss": "^3.4.19",
134
+ "typescript": "~5.9.3",
135
+ "vite": "^7.1.5",
136
+ "vite-plugin-dts": "^4.5.4",
137
+ "vite-plugin-svgr": "^4.5.0",
138
+ "vitest": "^4.1.10",
139
+ "tsx": "^4.20.5"
140
+ }
141
+ }