@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.
- package/LICENSE +201 -0
- package/README.md +144 -0
- package/dist/ai-dial-react-file-manager.es.js +5188 -0
- package/dist/index.css +1 -0
- package/dist/src/components/FileManager/FileManager.d.ts +319 -0
- package/dist/src/components/FileManager/FileManagerContext.d.ts +180 -0
- package/dist/src/components/FileManager/FileManagerProvider.d.ts +20 -0
- package/dist/src/components/FileManager/FileManagerTooltip.d.ts +12 -0
- package/dist/src/components/FileManager/components/ConflictResolutionPopup/ConflictResolutionPopup.d.ts +90 -0
- package/dist/src/components/FileManager/components/DestinationFolderPopup/DestinationFolderPopup.d.ts +68 -0
- package/dist/src/components/FileManager/components/DialFileManagerItemSummaryCell/DialFileManagerItemSummaryCell.d.ts +63 -0
- package/dist/src/components/FileManager/components/FileManagerBulkActionsToolbar/FileManagerBulkActionsToolbar.d.ts +56 -0
- package/dist/src/components/FileManager/components/FileManagerBulkActionsToolbar/constants.d.ts +3 -0
- package/dist/src/components/FileManager/components/FileManagerDeleteConfirmationPopup/FileManagerDeleteConfirmationPopup.d.ts +26 -0
- package/dist/src/components/FileManager/components/FileManagerItemIcon/FileManagerItemIcon.d.ts +50 -0
- package/dist/src/components/FileManager/components/FileManagerItemName/FileManagerItemName.d.ts +57 -0
- package/dist/src/components/FileManager/components/FileManagerItemNameInput/FileManagerItemNameInput.d.ts +71 -0
- package/dist/src/components/FileManager/components/FileManagerNavigationPanel/FileManagerNavigationPanel.d.ts +63 -0
- package/dist/src/components/FileManager/components/FileManagerNavigationPanel/constants.d.ts +3 -0
- package/dist/src/components/FileManager/components/FileManagerToolbar/DialFileManagerToolbar.d.ts +74 -0
- package/dist/src/components/FileManager/components/FileMetadataPopup/FileMetadataPopup.d.ts +50 -0
- package/dist/src/components/FileManager/components/FileMetadataPopup/constants.d.ts +6 -0
- package/dist/src/components/FileManager/components/FoldersTree/FoldersTree.d.ts +132 -0
- package/dist/src/components/FileManager/components/FoldersTree/constants.d.ts +6 -0
- package/dist/src/components/FileManager/components/FoldersTree/hooks/use-expanded-paths.d.ts +13 -0
- package/dist/src/components/FileManager/constants.d.ts +21 -0
- package/dist/src/components/FileManager/errors.d.ts +6 -0
- package/dist/src/components/FileManager/hooks/use-bulk-actions.d.ts +30 -0
- package/dist/src/components/FileManager/hooks/use-collapse-tree.d.ts +9 -0
- package/dist/src/components/FileManager/hooks/use-conflict-resolution.d.ts +27 -0
- package/dist/src/components/FileManager/hooks/use-current-path.d.ts +13 -0
- package/dist/src/components/FileManager/hooks/use-file-clipboard.d.ts +37 -0
- package/dist/src/components/FileManager/hooks/use-file-delete.d.ts +13 -0
- package/dist/src/components/FileManager/hooks/use-file-download.d.ts +9 -0
- package/dist/src/components/FileManager/hooks/use-file-manager-columns.d.ts +43 -0
- package/dist/src/components/FileManager/hooks/use-file-manager-context.d.ts +5 -0
- package/dist/src/components/FileManager/hooks/use-file-manager-tabs.d.ts +7 -0
- package/dist/src/components/FileManager/hooks/use-file-metadata.d.ts +10 -0
- package/dist/src/components/FileManager/hooks/use-file-search.d.ts +23 -0
- package/dist/src/components/FileManager/hooks/use-file-upload.d.ts +62 -0
- package/dist/src/components/FileManager/hooks/use-folder-creation.d.ts +30 -0
- package/dist/src/components/FileManager/hooks/use-grid-actions-column.d.ts +15 -0
- package/dist/src/components/FileManager/hooks/use-grid-context-menu.d.ts +43 -0
- package/dist/src/components/FileManager/hooks/use-item-renaming.d.ts +22 -0
- package/dist/src/components/FileManager/hooks/use-new-actions.d.ts +23 -0
- package/dist/src/components/FileManager/hooks/use-paths-selection.d.ts +13 -0
- package/dist/src/components/FileManager/hooks/use-show-hidden-files.d.ts +9 -0
- package/dist/src/components/FileManager/hooks/use-tree-additional-buttons.d.ts +22 -0
- package/dist/src/components/FileManager/hooks/use-trigger-view-create-folder.d.ts +26 -0
- package/dist/src/components/FileManager/hooks/use-trigger-view-rename.d.ts +20 -0
- package/dist/src/components/FileManager/utils.d.ts +58 -0
- package/dist/src/constants/file-grid-columns.d.ts +4 -0
- package/dist/src/hooks/use-flexible-actions.d.ts +88 -0
- package/dist/src/hooks/use-is-mobile-screen.d.ts +15 -0
- package/dist/src/hooks/use-width-breakpoint.d.ts +25 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/models/base-entity.d.ts +4 -0
- package/dist/src/models/file-manager.d.ts +19 -0
- package/dist/src/models/file.d.ts +39 -0
- package/dist/src/models/selection-mode.d.ts +4 -0
- package/dist/src/types/file-manager.d.ts +59 -0
- package/dist/src/types/screen.d.ts +6 -0
- package/dist/src/utils/mobile.d.ts +49 -0
- package/dist/src/utils/path.d.ts +10 -0
- package/package.json +141 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { DialNotificationProps } from '@epam/ai-dial-ui-kit';
|
|
2
|
+
import { DialFileManagerProps } from '../../FileManager';
|
|
3
|
+
import { FC, ReactNode } from '../../../../../node_modules/react';
|
|
4
|
+
export interface DestinationFolderPopupProps extends DialFileManagerProps {
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onConfirm?: () => void;
|
|
7
|
+
open: boolean;
|
|
8
|
+
setDestinationFolderPath?: (path?: string) => void;
|
|
9
|
+
destinationFolderPath?: string;
|
|
10
|
+
copyLabel?: string;
|
|
11
|
+
moveLabel?: string;
|
|
12
|
+
addFolderLabel?: string;
|
|
13
|
+
showHiddenFileSwitcher?: boolean;
|
|
14
|
+
showCreateFolderButton?: boolean;
|
|
15
|
+
hiddenFilesSwitcherLabel?: string;
|
|
16
|
+
mode?: 'copy' | 'move';
|
|
17
|
+
header?: ReactNode;
|
|
18
|
+
sourceFolder?: string;
|
|
19
|
+
disabledPathTooltip?: string;
|
|
20
|
+
collapsedFileTree?: boolean;
|
|
21
|
+
alertProps?: DialNotificationProps;
|
|
22
|
+
onFolderPopupPathChange?: (newPath?: string) => void;
|
|
23
|
+
processDestinationFolderPath?: (path: string) => string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* DestinationFolderPopup
|
|
27
|
+
* aliases: FolderSelector|PathChooser
|
|
28
|
+
*
|
|
29
|
+
* A popup dialog for selecting a destination folder when copying or moving files.
|
|
30
|
+
* Displays a File Manager interface with a footer containing action buttons and
|
|
31
|
+
* a toggle for showing hidden files.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <DestinationFolderPopup
|
|
36
|
+
* open={isOpen}
|
|
37
|
+
* onClose={handleClose}
|
|
38
|
+
* onConfirm={handleConfirm}
|
|
39
|
+
* mode="copy"
|
|
40
|
+
* title="Copy 3 files"
|
|
41
|
+
* items={files}
|
|
42
|
+
* rootItem={rootFolder}
|
|
43
|
+
* path={currentPath}
|
|
44
|
+
* onPathChange={setCurrentPath}
|
|
45
|
+
* />
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @param open - Whether the popup is visible
|
|
49
|
+
* @param onClose - Callback fired when the popup is closed
|
|
50
|
+
* @param [onConfirm] - Callback fired when the confirm button is clicked
|
|
51
|
+
* @param [mode=DestinationFolderMode.Copy] - Operation mode: 'copy' or 'move'
|
|
52
|
+
* @param [copyLabel="Copy"] - Label for the copy button
|
|
53
|
+
* @param [moveLabel="Move"] - Label for the move button
|
|
54
|
+
* @param [addFolderLabel="Add folder"] - Label for the add folder button
|
|
55
|
+
* @param [hiddenFilesSwitcherLabel="Show hidden files"] - Label for the hidden files toggle
|
|
56
|
+
* @param [title] - Custom title for the popup header
|
|
57
|
+
* @param items - Array of files to display in the File Manager
|
|
58
|
+
* @param rootItem - Root folder item
|
|
59
|
+
* @param path - Current path in the File Manager
|
|
60
|
+
* @param onPathChange - Callback fired when the path changes
|
|
61
|
+
* @param [sourceFolder] - The source folder path for move operations
|
|
62
|
+
* @param [disabledPathTooltip="Unavailable for the original path. Please select another folder"] - Tooltip text when destination is disabled
|
|
63
|
+
* @param [collapsedFileTree=false] - Whether the file tree should be initially collapsed
|
|
64
|
+
* @param [processDestinationFolderPath] - Optional function to process the destination folder path before setting it
|
|
65
|
+
*
|
|
66
|
+
* @returns A React component for the destination folder selection popup
|
|
67
|
+
*/
|
|
68
|
+
export declare const DialDestinationFolderPopup: FC<DestinationFolderPopupProps>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { FC, ReactNode } from '../../../../../node_modules/react';
|
|
2
|
+
import { DialFileNodeType } from '../../../../models/file';
|
|
3
|
+
interface DialFileManagerItemSummaryCellProps {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
nodeType: DialFileNodeType;
|
|
7
|
+
size?: number;
|
|
8
|
+
updatedAt?: string;
|
|
9
|
+
shared?: boolean;
|
|
10
|
+
dateLocale?: Intl.LocalesArgument;
|
|
11
|
+
dateOptions?: Intl.DateTimeFormatOptions;
|
|
12
|
+
sharedIndicatorClassName?: string;
|
|
13
|
+
hideTooltip?: boolean;
|
|
14
|
+
forbiddenSymbolsRegExp?: RegExp;
|
|
15
|
+
forbiddenSymbolsTooltip?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Renders file or folder details inside the File Manager list/grid item.
|
|
19
|
+
*
|
|
20
|
+
* Displays the item name with an icon (via `DialFileManagerItemName`),
|
|
21
|
+
* followed by a small details row:
|
|
22
|
+
*
|
|
23
|
+
* - File size (e.g., `"15 KB"`)
|
|
24
|
+
* - A separator dot
|
|
25
|
+
* - Formatted update date (via `DialDateCellRenderer`)
|
|
26
|
+
*
|
|
27
|
+
* The component automatically determines whether to show a **file** or **folder**
|
|
28
|
+
* icon based on `nodeType`.
|
|
29
|
+
*
|
|
30
|
+
* ### Example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* <DialFileManagerItemSummaryCell
|
|
33
|
+
* id="42"
|
|
34
|
+
* name="Report.pdf"
|
|
35
|
+
* nodeType={DialFileNodeType.ITEM}
|
|
36
|
+
* size={225280}
|
|
37
|
+
* updatedAt="2025-07-20T00:00:00Z"
|
|
38
|
+
* dateLocale="en-US"
|
|
39
|
+
* dateOptions={{ timeZone: 'UTC' }}
|
|
40
|
+
* />
|
|
41
|
+
*
|
|
42
|
+
* <DialFileManagerItemSummaryCell
|
|
43
|
+
* id="folder-1"
|
|
44
|
+
* name="Projects"
|
|
45
|
+
* nodeType={DialFileNodeType.FOLDER}
|
|
46
|
+
* updatedAt={undefined}
|
|
47
|
+
* />
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @param id - Unique identifier passed to `DialFileManagerItemName` as `elementId`.
|
|
51
|
+
* @param name - File or folder display name.
|
|
52
|
+
* @param nodeType - Determines whether the item renders as a **File** or **Folder**.
|
|
53
|
+
* @param size - File size in bytes; formatted with {@link formatBytes}. Omit for folders.
|
|
54
|
+
* @param updatedAt - Date or timestamp passed to `DialDateCellRenderer`. If invalid or missing, renders `"—"`.
|
|
55
|
+
* @param dateLocale - Optional locale override for date formatting (e.g., `"fr-FR"`).
|
|
56
|
+
* @param dateOptions - Optional `Intl.DateTimeFormat` configuration (e.g., `{ timeZone: 'UTC' }`).
|
|
57
|
+
* @params sharedIndicatorClassName - Optional CSS classes for the shared indicator.
|
|
58
|
+
* @param hideTooltip - If `true`, disables tooltips on the name and date, even if truncated.
|
|
59
|
+
* @param forbiddenSymbolsRegExp - Optional RegExp to validate the name for forbidden symbols.
|
|
60
|
+
* @param forbiddenSymbolsTooltip - Custom tooltip content when the name contains forbidden symbols; defaults to a standard message.
|
|
61
|
+
*/
|
|
62
|
+
export declare const DialFileManagerItemSummaryCell: FC<DialFileManagerItemSummaryCellProps>;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { FC } from '../../../../../node_modules/react';
|
|
2
|
+
import { DropdownItem } from '@epam/ai-dial-ui-kit';
|
|
3
|
+
export interface DialActionDropdownItem extends DropdownItem {
|
|
4
|
+
title: string;
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface DialFileManagerBulkActionsToolbarProps {
|
|
8
|
+
getSelectionLabel: (selectedCount: number) => string;
|
|
9
|
+
onClearSelection: () => void;
|
|
10
|
+
actions: DialActionDropdownItem[];
|
|
11
|
+
selectedCount: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* A responsive toolbar component displayed when files or items are selected
|
|
15
|
+
* in the file manager. It shows a label with the number or name of selected
|
|
16
|
+
* items and provides contextual action buttons.
|
|
17
|
+
*
|
|
18
|
+
* On smaller screens or when there’s not enough horizontal space,
|
|
19
|
+
* some action buttons are automatically moved into a dropdown menu.
|
|
20
|
+
*
|
|
21
|
+
* **Key Features:**
|
|
22
|
+
* - Dynamically measures available container width to determine how many actions
|
|
23
|
+
* can fit inline.
|
|
24
|
+
* - Uses a hidden measurement container to precisely calculate button widths.
|
|
25
|
+
* - Automatically moves overflow actions into a "More" dropdown (`IconDotsVertical`).
|
|
26
|
+
* - Responsive design with support for mobile layout via `useIsMobileScreen`.
|
|
27
|
+
*
|
|
28
|
+
* **Layout logic:**
|
|
29
|
+
* - `measureRef`: hidden element used to measure the width of each button.
|
|
30
|
+
* - `containerRef`: visible container where the toolbar is rendered.
|
|
31
|
+
* - `leftSectionRef`: left section containing the "selected items" button.
|
|
32
|
+
* - `visibleCount`: dynamically updated number of visible actions.
|
|
33
|
+
* - Uses `ResizeObserver` + `requestAnimationFrame` to update layout on resize.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```tsx
|
|
37
|
+
* <DialFileManagerSelectionToolbar
|
|
38
|
+
* getSelectionLabel={(count) => `${count} files selected`}
|
|
39
|
+
* onClearSelection={() => console.log('Cleared')}
|
|
40
|
+
* actions={[
|
|
41
|
+
* { key: 'download', title: 'Download', icon: <IconDownload />, onClick: () => {} },
|
|
42
|
+
* { key: 'delete', title: 'Delete', icon: <IconTrash />, onClick: () => {} },
|
|
43
|
+
* ]}
|
|
44
|
+
* />
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @param {object} props
|
|
48
|
+
* @param {() => string} props.getSelectionLabel - Function to get the label showing current selection status (e.g., "3 files selected").
|
|
49
|
+
* @param {() => void} props.onClearSelection - Callback invoked when the clear selection button is clicked.
|
|
50
|
+
* @param {DialActionDropdownItem[]} props.actions - List of available toolbar actions.
|
|
51
|
+
* Each action defines a title, icon, key, and optional click handler.
|
|
52
|
+
* @param {number} [props.selectedCount] - Count of currently selected items.
|
|
53
|
+
*
|
|
54
|
+
* @returns {JSX.Element} A responsive toolbar that adjusts visible actions based on available width.
|
|
55
|
+
*/
|
|
56
|
+
export declare const DialFileManagerBulkActionsToolbar: FC<DialFileManagerBulkActionsToolbarProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FC, ReactNode } from '../../../../../node_modules/react';
|
|
2
|
+
import { DialFile } from '../../../../models/file';
|
|
3
|
+
export interface FileManagerDeleteConfirmationPopupProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
itemsToDelete: DialFile[];
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
onConfirm: () => void;
|
|
8
|
+
cancelLabel?: string;
|
|
9
|
+
confirmLabel?: string;
|
|
10
|
+
titleRenderer?: (fileNames: string[]) => ReactNode;
|
|
11
|
+
contentRenderer?: (fileNames: string[]) => ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Confirmation popup for deleting files in FileManager.
|
|
15
|
+
* Shows a list of files to be deleted with customizable title and content.
|
|
16
|
+
*
|
|
17
|
+
* @param open - Controls visibility of the popup
|
|
18
|
+
* @param itemsToDelete - Array of files to be deleted
|
|
19
|
+
* @param onClose - Callback when popup is closed
|
|
20
|
+
* @param onConfirm - Callback when delete is confirmed
|
|
21
|
+
* @param [cancelLabel='Cancel'] - Label for cancel button
|
|
22
|
+
* @param [confirmLabel='Delete'] - Label for confirm button
|
|
23
|
+
* @param [titleRenderer] - Custom title renderer function
|
|
24
|
+
* @param [contentRenderer] - Custom content renderer function
|
|
25
|
+
*/
|
|
26
|
+
export declare const FileManagerDeleteConfirmationPopup: FC<FileManagerDeleteConfirmationPopupProps>;
|
package/dist/src/components/FileManager/components/FileManagerItemIcon/FileManagerItemIcon.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FC, ReactNode } from '../../../../../node_modules/react';
|
|
2
|
+
import { DialItemType, DialFileIconProps } from '@epam/ai-dial-ui-kit';
|
|
3
|
+
export interface DialFileManagerItemIconProps extends Omit<DialFileIconProps, 'extension'> {
|
|
4
|
+
type: DialItemType;
|
|
5
|
+
name: string;
|
|
6
|
+
shared?: boolean;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
sharedIndicatorClassName?: string;
|
|
9
|
+
sharedIndicatorTooltip?: ReactNode;
|
|
10
|
+
fileExtension?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Renders an icon representing either a file or folder entity in the Dial system.
|
|
14
|
+
*
|
|
15
|
+
* Displays:
|
|
16
|
+
* - A file icon based on its extension (via `DialFileIcon`)
|
|
17
|
+
* - A folder icon (via `IconFolder`)
|
|
18
|
+
* - A loading spinner if `loading` is true
|
|
19
|
+
* - A shared indicator if the entity is marked as shared
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <DialFileManagerItemIcon
|
|
24
|
+
* name="document.pdf"
|
|
25
|
+
* type={DialItemType.File}
|
|
26
|
+
* shared
|
|
27
|
+
* />
|
|
28
|
+
*
|
|
29
|
+
* <DialFileManagerItemIcon
|
|
30
|
+
* name="My Folder"
|
|
31
|
+
* type={DialItemType.Folder}
|
|
32
|
+
* loading
|
|
33
|
+
* />
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param {Object} props
|
|
37
|
+
* @param {string} props.name - The name of the file or folder (used to determine extension for files).
|
|
38
|
+
* @param {DialItemType} props.type - The type of the item (`file` or `folder`).
|
|
39
|
+
* @param {boolean} [props.shared=false] - Whether the item is shared.
|
|
40
|
+
* @param {boolean} [props.loading=false] - Whether to display the loading state.
|
|
41
|
+
* @param {number} [props.size] - Optional icon size override.
|
|
42
|
+
* @param {number} [props.stroke] - Optional icon stroke width override.
|
|
43
|
+
* @param {string} [props.className] - Optional CSS class for styling.
|
|
44
|
+
* @param {boolean} [props.decorative] - Whether the icon is decorative (for accessibility).
|
|
45
|
+
* @param {string} [props.label] - Accessible label for screen readers.
|
|
46
|
+
* @param {ReactNode} [props.indicator] - Optional indicator to display over the icon.
|
|
47
|
+
* @param {string} [props.sharedIndicatorClassName] - Optional CSS class for the shared indicator.
|
|
48
|
+
* @param [sharedIndicatorTooltip] - Custom tooltip content for the shared indicator; defaults to "Shared"
|
|
49
|
+
*/
|
|
50
|
+
export declare const DialFileManagerItemIcon: FC<DialFileManagerItemIconProps>;
|
package/dist/src/components/FileManager/components/FileManagerItemName/FileManagerItemName.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { FC, ReactNode } from '../../../../../node_modules/react';
|
|
2
|
+
import { DialFileManagerItemNameInputProps } from '../FileManagerItemNameInput/FileManagerItemNameInput';
|
|
3
|
+
import { DialItemType } from '@epam/ai-dial-ui-kit';
|
|
4
|
+
export interface DialFileManagerItemNameProps extends DialFileManagerItemNameInputProps {
|
|
5
|
+
name: string;
|
|
6
|
+
type: DialItemType;
|
|
7
|
+
elementId: string;
|
|
8
|
+
editing?: boolean;
|
|
9
|
+
loading?: boolean;
|
|
10
|
+
creating?: boolean;
|
|
11
|
+
shared?: boolean;
|
|
12
|
+
details?: ReactNode;
|
|
13
|
+
sharedIndicatorTooltip?: ReactNode;
|
|
14
|
+
fileExtension?: string;
|
|
15
|
+
validate?: (value: string) => string | null;
|
|
16
|
+
onSave?: (value: string) => void;
|
|
17
|
+
onCancel?: () => void;
|
|
18
|
+
onCreateFolderSave?: (value: string) => void;
|
|
19
|
+
onCreateFolderCancel?: () => void;
|
|
20
|
+
hideTooltip?: boolean;
|
|
21
|
+
forbiddenSymbolsRegExp?: RegExp;
|
|
22
|
+
forbiddenSymbolsTooltip?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A component that renders a file or folder name with optional edit mode.
|
|
26
|
+
*
|
|
27
|
+
* When `editing` is `false`, it displays a read-only name via:
|
|
28
|
+
* - `DialFolderName` for folders
|
|
29
|
+
* - `DialFileName` for files
|
|
30
|
+
*
|
|
31
|
+
* When `editing` is `true`, it renders an editable input using `DialItemNameInput`,
|
|
32
|
+
* driven by validation and change logic from the `useEditableItem` hook.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* import { DialFileManagerItemName } from '@epam/ai-dial-react-file-manager';
|
|
37
|
+
* import { DialItemType } from '@epam/ai-dial-ui-kit';
|
|
38
|
+
*
|
|
39
|
+
* function Example() {
|
|
40
|
+
* return (
|
|
41
|
+
* <DialFileManagerItemName
|
|
42
|
+
* name="Project"
|
|
43
|
+
* type={DialItemType.Folder}
|
|
44
|
+
* elementId="folder-123"
|
|
45
|
+
* editing={true}
|
|
46
|
+
* validate={(value) => (value.trim() ? null : 'Name cannot be empty')}
|
|
47
|
+
* onSave={(newName) => console.log('Saved:', newName)}
|
|
48
|
+
* onCancel={() => console.log('Canceled')}
|
|
49
|
+
* />
|
|
50
|
+
* );
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @param props - Component props.
|
|
55
|
+
* @returns Rendered file or folder name element (editable or static).
|
|
56
|
+
*/
|
|
57
|
+
export declare const DialFileManagerItemName: FC<DialFileManagerItemNameProps>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { FC, ReactNode, Ref } from '../../../../../node_modules/react';
|
|
2
|
+
import { DialItemType } from '@epam/ai-dial-ui-kit';
|
|
3
|
+
export interface DialFileManagerItemNameInputProps {
|
|
4
|
+
type: DialItemType;
|
|
5
|
+
name: string;
|
|
6
|
+
shared?: boolean;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
elementId: string;
|
|
9
|
+
iconSize?: number;
|
|
10
|
+
iconStroke?: number;
|
|
11
|
+
iconClassName?: string;
|
|
12
|
+
iconLabel?: string;
|
|
13
|
+
iconIndicator?: ReactNode;
|
|
14
|
+
inputInvalid?: boolean;
|
|
15
|
+
inputInvalidMessage?: string;
|
|
16
|
+
inputContainerClassName?: string;
|
|
17
|
+
inputIconAfter?: ReactNode;
|
|
18
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
19
|
+
onChange?: (value?: string) => void;
|
|
20
|
+
sharedIndicatorClassName?: string;
|
|
21
|
+
sharedIndicatorTooltip?: ReactNode;
|
|
22
|
+
fileExtension?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Combines a file/folder icon with an editable text input.
|
|
26
|
+
*
|
|
27
|
+
* Used for renaming or labeling file/folder entities within the File Manager.
|
|
28
|
+
* Displays:
|
|
29
|
+
* - The item icon (with optional loading/shared state)
|
|
30
|
+
* - An inline text input
|
|
31
|
+
* - A validation tooltip when `inputInvalid` is `true`
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* <DialFileManagerItemNameInput
|
|
36
|
+
* type={DialItemType.File}
|
|
37
|
+
* name="report.pdf"
|
|
38
|
+
* elementId="file-input-1"
|
|
39
|
+
* shared
|
|
40
|
+
* onChange={(value) => console.log('New name:', value)}
|
|
41
|
+
* />
|
|
42
|
+
*
|
|
43
|
+
* <DialFileManagerItemNameInput
|
|
44
|
+
* type={DialItemType.Folder}
|
|
45
|
+
* name="Project A"
|
|
46
|
+
* elementId="folder-input-2"
|
|
47
|
+
* inputInvalid
|
|
48
|
+
* inputInvalidMessage="Invalid name"
|
|
49
|
+
* />
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @param {Object} props
|
|
53
|
+
* @param {DialItemType} props.type - The type of item (file or folder).
|
|
54
|
+
* @param {string} props.name - Current name of the entity.
|
|
55
|
+
* @param {string} props.elementId - Unique ID for the input element.
|
|
56
|
+
* @param {boolean} [props.shared=false] - Whether the entity is shared.
|
|
57
|
+
* @param {boolean} [props.loading=false] - Whether the icon is loading.
|
|
58
|
+
* @param {number} [props.iconSize] - Optional size override for the icon.
|
|
59
|
+
* @param {number} [props.iconStroke] - Optional stroke width override for the icon.
|
|
60
|
+
* @param {string} [props.iconClassName] - Optional CSS class for the icon.
|
|
61
|
+
* @param {string} [props.iconLabel] - Optional accessible label for the icon.
|
|
62
|
+
* @param {ReactNode} [props.iconIndicator] - Optional indicator to render over the icon.
|
|
63
|
+
* @param {boolean} [props.inputInvalid=false] - Marks the input as invalid.
|
|
64
|
+
* @param {string} [props.inputInvalidMessage] - Tooltip message shown when invalid.
|
|
65
|
+
* @param {ReactNode} [props.inputIconAfter] - Optional icon shown after the input (defaults to an error icon).
|
|
66
|
+
* @param {string} [props.inputContainerClassName] - Additional CSS classes applied to the input container.
|
|
67
|
+
* @param {Ref<HTMLInputElement>} [props.inputRef] - Ref to access the underlying input element.
|
|
68
|
+
* @param {(value: string) => void} [props.onChange] - Callback fired when input value changes.
|
|
69
|
+
* @param {string} [props.sharedIndicatorClassName] - Additional CSS classes for the shared indicator.
|
|
70
|
+
*/
|
|
71
|
+
export declare const DialFileManagerItemNameInput: FC<DialFileManagerItemNameInputProps>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { FC } from '../../../../../node_modules/react';
|
|
2
|
+
import { DialBreadcrumbProps, DialSearchProps } from '@epam/ai-dial-ui-kit';
|
|
3
|
+
export interface DialFileManagerNavigationPanelProps extends Omit<DialBreadcrumbProps, 'pathItems' | 'children' | 'className' | 'separator'>, Omit<DialSearchProps, 'onChange' | 'elementId' | 'value' | 'className' | 'containerClassName' | 'placeholder' | 'size'> {
|
|
4
|
+
path?: string;
|
|
5
|
+
makeHref?: (segments: string[], index: number) => string | undefined;
|
|
6
|
+
className?: string;
|
|
7
|
+
breadcrumbClassName?: string;
|
|
8
|
+
onItemClick?: (href?: string) => void;
|
|
9
|
+
rootItemPath?: string;
|
|
10
|
+
rootItemLabel?: string;
|
|
11
|
+
breadcrumbsHiddenPathPart?: string;
|
|
12
|
+
searchable?: boolean;
|
|
13
|
+
value?: string | number | null;
|
|
14
|
+
elementId?: string;
|
|
15
|
+
onSearchChange?: (value: string) => void;
|
|
16
|
+
searchClassName?: string;
|
|
17
|
+
searchContainerClassName?: string;
|
|
18
|
+
isCompactView?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* FileManagerNavigationPanel
|
|
22
|
+
*
|
|
23
|
+
* A navigation header for the File Manager that displays a breadcrumb trail on the left
|
|
24
|
+
* and an optional, controlled Search on the right.
|
|
25
|
+
*
|
|
26
|
+
* Uses the shared {@link DialBreadcrumb} for navigation and the shared {@link DialSearch}
|
|
27
|
+
* for the controlled search input.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <FileManagerNavigationPanel
|
|
32
|
+
* path="Organization/Folder 4"
|
|
33
|
+
* searchable
|
|
34
|
+
* elementId="file-manager-search"
|
|
35
|
+
* value={query}
|
|
36
|
+
* onSearchChange={(val) => setQuery(val)}
|
|
37
|
+
* />
|
|
38
|
+
*
|
|
39
|
+
* // With clickable parents
|
|
40
|
+
* <FileManagerNavigationPanel
|
|
41
|
+
* path="Org/Design/Assets"
|
|
42
|
+
* makeHref={(segments, i) => '#' + segments.slice(0, i + 1).join('/')}
|
|
43
|
+
* />
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @param [ariaLabel="Breadcrumb"] - Aria label for the breadcrumb `<nav>`
|
|
47
|
+
* @param [labelClassName] - Extra classes for breadcrumb titles
|
|
48
|
+
* @param [path] - A full path string that will be split into breadcrumb items
|
|
49
|
+
* @param [makeHref] - Factory to create hrefs for segments
|
|
50
|
+
* @param [onItemClick] - Callback fired when a breadcrumb item is clicked
|
|
51
|
+
* @param [className] - Additional classes for the panel container
|
|
52
|
+
* @param [breadcrumbClassName] - ClassName forwarded to inner `DialBreadcrumb`
|
|
53
|
+
* @param [breadcrumbsHiddenPathPart] - A slash-separated path fragment whose segments will be omitted from the rendered breadcrumb trail.
|
|
54
|
+
* @param [searchable=true] - Whether to render the search control
|
|
55
|
+
* @param [value] - Controlled value for the search input (parent-managed)
|
|
56
|
+
* @param [elementId="file-manager-search"] - DOM id for the internal DialSearch input
|
|
57
|
+
* @param [size=ElementSize.Standard] - Size of the search input (from DialSearchProps)
|
|
58
|
+
* @param [onSearchChange] - Callback fired when the search value changes
|
|
59
|
+
* @param [searchClassName] - Extra classes for the search input element
|
|
60
|
+
* @param [searchContainerClassName] - Extra classes for the search container
|
|
61
|
+
* @param [isCompactView=false] - Whether the component should render in compact mode
|
|
62
|
+
*/
|
|
63
|
+
export declare const DialFileManagerNavigationPanel: FC<DialFileManagerNavigationPanelProps>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const panelBaseClassName = "w-full flex items-center justify-between gap-4";
|
|
2
|
+
export declare const breadcrumbContainerClassName = "min-w-0 h-[38px] flex-1 overflow-hidden bg-layer-3 px-3 flex items-center rounded";
|
|
3
|
+
export declare const searchContainerWrapperClassName = "w-[260px]";
|
package/dist/src/components/FileManager/components/FileManagerToolbar/DialFileManagerToolbar.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ButtonVariant, DropdownItem, TabModel } from '@epam/ai-dial-ui-kit';
|
|
2
|
+
import { DialFileManagerTabs } from '../../../../types/file-manager';
|
|
3
|
+
import { FC } from '../../../../../node_modules/react';
|
|
4
|
+
export interface DialFileManagerToolbarProps {
|
|
5
|
+
tabs?: TabModel[];
|
|
6
|
+
activeTab?: string;
|
|
7
|
+
areHiddenFilesVisible: boolean;
|
|
8
|
+
hiddenFilesSwitcherLabel?: string;
|
|
9
|
+
showHiddenFilesLabel?: string;
|
|
10
|
+
hideHiddenFilesLabel?: string;
|
|
11
|
+
isNewButtonVisible?: boolean;
|
|
12
|
+
isNewButtonDisabled?: boolean;
|
|
13
|
+
newButtonVariant?: ButtonVariant;
|
|
14
|
+
newButtonDropdownItems?: DropdownItem[];
|
|
15
|
+
newButtonLabel?: string;
|
|
16
|
+
showHiddenFilesToggle?: boolean;
|
|
17
|
+
onTabChange?: (id: DialFileManagerTabs) => void;
|
|
18
|
+
onToggleHiddenFiles?: (value: boolean) => void;
|
|
19
|
+
disabledNewButtonTooltip?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* DialFileManagerToolbar — A configurable, responsive toolbar component for file management views.
|
|
23
|
+
*
|
|
24
|
+
* Provides a flexible toolbar interface for file managers or similar UIs, supporting:
|
|
25
|
+
* - Tab navigation for switching between file sections or views
|
|
26
|
+
* - A toggle for showing or hiding hidden files
|
|
27
|
+
* - A refresh button for reloading content
|
|
28
|
+
* - An optional "New" button or dropdown for creating new files or folders
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```tsx
|
|
32
|
+
* const tabs: TabModel[] = [
|
|
33
|
+
* { id: 'all', name: 'All Files' },
|
|
34
|
+
* { id: 'favorites', name: 'Favorites' },
|
|
35
|
+
* ];
|
|
36
|
+
*
|
|
37
|
+
* <DialFileManagerToolbar
|
|
38
|
+
* tabs={tabs}
|
|
39
|
+
* activeTab="all"
|
|
40
|
+
* areHiddenFilesVisible={false}
|
|
41
|
+
* onTabChange={(id) => console.log('Switched to tab:', id)}
|
|
42
|
+
* onToggleHiddenFiles={(visible) => console.log('Hidden files visible:', visible)}
|
|
43
|
+
* onRefresh={() => console.log('Refreshed')}
|
|
44
|
+
* isNewButtonVisible
|
|
45
|
+
* newButtonDropdownItems={[
|
|
46
|
+
* { key: 'folder', label: 'New Folder' },
|
|
47
|
+
* { key: 'file', label: 'Upload File' },
|
|
48
|
+
* ]}
|
|
49
|
+
* />
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* @param [tabs] - List of tab definitions to display, each represented by a `TabModel` containing `id` and `name`.
|
|
53
|
+
* @param [activeTab] - The ID of the currently active tab.
|
|
54
|
+
* @param areHiddenFilesVisible - Whether hidden files are currently visible.
|
|
55
|
+
* @param [hiddenFilesSwitcherLabel='Hidden files'] - Label for the hidden files toggle control.
|
|
56
|
+
* @param [showHiddenFilesLabel='Show hidden'] - Label shown when hidden files are not visible.
|
|
57
|
+
* @param [hideHiddenFilesLabel='Hide hidden'] - Label shown when hidden files are visible.
|
|
58
|
+
* @param [onTabChange] - Callback fired when the user switches between tabs. Receives the selected tab ID.
|
|
59
|
+
* @param [onToggleHiddenFiles] - Callback fired when the hidden files visibility is toggled. Receives the new visibility state.
|
|
60
|
+
* @param [isNewButtonVisible] - Whether the "New" button or dropdown should be displayed.
|
|
61
|
+
* @param [isNewButtonDisabled] - Whether the "New" button is disabled.
|
|
62
|
+
* @param [newButtonVariant=ButtonVariant.Primary] - Visual style variant for the new button.
|
|
63
|
+
* @param [newButtonDropdownItems=[]] - Dropdown items available under the new button. If empty, a single new button is shown instead.
|
|
64
|
+
* @param [newButtonLabel='New'] - Label text for the new button.
|
|
65
|
+
* @param [disabledNewButtonTooltip] - Tooltip text to show when the new button is disabled.
|
|
66
|
+
*
|
|
67
|
+
* @remarks
|
|
68
|
+
* - Tabs are rendered via `DialTabs`.
|
|
69
|
+
* - The hidden files toggle uses `DialSwitch`.
|
|
70
|
+
* - The refresh and new actions use `DialButton` or dropdown variants for consistency.
|
|
71
|
+
* - The toolbar automatically adapts its layout for different screen sizes.
|
|
72
|
+
* - When `newButtonDropdownItems` is provided, the new button becomes a dropdown menu.
|
|
73
|
+
*/
|
|
74
|
+
export declare const DialFileManagerToolbar: FC<DialFileManagerToolbarProps>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { FC, ReactNode } from '../../../../../node_modules/react';
|
|
2
|
+
import { DialFile } from '../../../../models/file';
|
|
3
|
+
export interface FileMetadataPopupProps {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
fileMetadata?: DialFile;
|
|
7
|
+
loading?: boolean;
|
|
8
|
+
header?: ReactNode;
|
|
9
|
+
nameLabel?: string;
|
|
10
|
+
pathLabel?: string;
|
|
11
|
+
modifiedDateLabel?: string;
|
|
12
|
+
sizeLabel?: string;
|
|
13
|
+
authorLabel?: string;
|
|
14
|
+
dateLocale?: Intl.LocalesArgument;
|
|
15
|
+
dateOptions?: Intl.DateTimeFormatOptions;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* FileMetadataPopup
|
|
19
|
+
*
|
|
20
|
+
* A popup dialog for displaying file metadata information.
|
|
21
|
+
* Shows file details like name, path, modified date, size, and author.
|
|
22
|
+
* Displays a loading skeleton while metadata is being fetched.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <FileMetadataPopup
|
|
27
|
+
* open={isOpen}
|
|
28
|
+
* onClose={handleClose}
|
|
29
|
+
* fileMetadata={file}
|
|
30
|
+
* loading={isLoading}
|
|
31
|
+
* title="Information"
|
|
32
|
+
* dateLocale="en-US"
|
|
33
|
+
* dateOptions={{ year: 'numeric', month: 'short', day: '2-digit' }}
|
|
34
|
+
* />
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @param open - Whether the popup is visible
|
|
38
|
+
* @param onClose - Callback fired when the popup is closed
|
|
39
|
+
* @param [fileMetadata] - File metadata to display
|
|
40
|
+
* @param [loading] - Whether metadata is being loaded
|
|
41
|
+
* @param [title="Information"] - Title of the popup
|
|
42
|
+
* @param [nameLabel="Name:"] - Label for the name field
|
|
43
|
+
* @param [pathLabel="Path:"] - Label for the path field
|
|
44
|
+
* @param [modifiedDateLabel="Modified Date:"] - Label for the modified date field
|
|
45
|
+
* @param [sizeLabel="Size:"] - Label for the size field
|
|
46
|
+
* @param [authorLabel="Author:"] - Label for the author field
|
|
47
|
+
* @param [dateLocale="en-US"] - Locale for date formatting
|
|
48
|
+
* @param [dateOptions] - Options for date formatting
|
|
49
|
+
*/
|
|
50
|
+
export declare const FileMetadataPopup: FC<FileMetadataPopupProps>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const LABEL_COLUMN_WIDTH = 100;
|
|
2
|
+
export declare const SKELETON_HEIGHT = 16;
|
|
3
|
+
export declare const LABEL_CLASS = "text-secondary";
|
|
4
|
+
export declare const VALUE_CLASS = "text-primary min-w-0";
|
|
5
|
+
export declare const PATH_CLASS = "text-primary break-words min-w-0";
|
|
6
|
+
export declare const SKELETON_CLASS = "bg-layer-2";
|