@widgetic/file-browser 0.5.35 → 0.5.37
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/README.md +1 -0
- package/dist/components/FolderTree.svelte +46 -97
- package/dist/components/FolderTree.svelte.d.ts +5 -1
- package/dist/components/core/Dropzone.svelte +127 -0
- package/dist/components/core/Dropzone.svelte.d.ts +15 -0
- package/dist/components/core/FileBrowser.css +11 -79
- package/dist/components/core/FileBrowser.svelte +277 -149
- package/dist/components/core/FileBrowser.svelte.d.ts +0 -1
- package/dist/components/core/FileUploader.svelte +204 -418
- package/dist/components/core/FileUploader.svelte.d.ts +1 -0
- package/dist/components/core/Header.svelte +51 -68
- package/dist/components/core/Header.svelte.d.ts +1 -0
- package/dist/components/core/RecentFiles.svelte +135 -562
- package/dist/components/core/RecentFiles.svelte.d.ts +2 -4
- package/dist/components/core/UploadPanel.svelte +169 -0
- package/dist/components/core/UploadPanel.svelte.d.ts +40 -0
- package/dist/components/core/UploadRow.svelte +90 -0
- package/dist/components/core/UploadRow.svelte.d.ts +21 -0
- package/dist/components/core/UploadStatus.svelte +34 -128
- package/dist/components/core/UploadStatus.svelte.d.ts +0 -1
- package/dist/components/core/UploadStatusList.svelte +61 -77
- package/dist/components/items/FileItem.svelte +190 -532
- package/dist/components/items/FileItem.svelte.d.ts +1 -1
- package/dist/components/items/FolderItem.svelte +46 -36
- package/dist/components/items/FolderItem.svelte.d.ts +1 -1
- package/dist/components/modals/MoveDialog.svelte +142 -281
- package/dist/components/modals/NewFolderButton.svelte +13 -14
- package/dist/components/modals/SearchModal.svelte +112 -264
- package/dist/components/modals/SearchModal.svelte.d.ts +0 -1
- package/dist/components/modals/SelectedFilesModal.svelte +91 -167
- package/dist/components/previews/AudioPlayer.svelte +75 -58
- package/dist/components/previews/ErrorPreview.svelte +9 -6
- package/dist/components/previews/FilePreview.svelte +173 -53
- package/dist/components/previews/FontPreview.svelte +37 -54
- package/dist/components/previews/ImagePreview.svelte +9 -2
- package/dist/components/previews/ImagePreview.svelte.d.ts +1 -0
- package/dist/components/previews/PreviewHeaderBar.svelte +70 -0
- package/dist/components/previews/PreviewHeaderBar.svelte.d.ts +32 -0
- package/dist/components/previews/TextPreview.svelte +32 -40
- package/dist/components/previews/VideoPlayer.svelte +124 -149
- package/dist/components/previews/WaveformVisualizer.svelte +42 -222
- package/dist/components/previews/WaveformVisualizer.svelte.d.ts +1 -1
- package/dist/components/ui/ControlToolbar.svelte +113 -288
- package/dist/components/ui/ControlToolbar.svelte.d.ts +2 -3
- package/dist/components/ui/DragSelect.svelte +41 -248
- package/dist/components/ui/DropdownMenu.svelte +56 -55
- package/dist/components/ui/DropdownMenu.svelte.d.ts +1 -1
- package/dist/components/ui/FileIcon.svelte +168 -51
- package/dist/components/ui/FileIcon.svelte.d.ts +13 -20
- package/dist/components/ui/FileMetadata.svelte +20 -9
- package/dist/components/ui/LoadingSkeleton.svelte +5 -20
- package/dist/components/ui/SearchResults.svelte +50 -26
- package/dist/components/ui/SearchResults.svelte.d.ts +4 -0
- package/dist/components/ui/SelectedBadge.svelte +25 -0
- package/dist/components/ui/SelectedBadge.svelte.d.ts +9 -0
- package/dist/components/ui/TileSkeleton.svelte +15 -0
- package/dist/components/ui/TileSkeleton.svelte.d.ts +18 -0
- package/dist/components/ui/VirtualList.svelte +3 -0
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/i18n/messages.d.ts +38 -25
- package/dist/i18n/messages.js +39 -26
- package/dist/utils/gridLayout.d.ts +2 -0
- package/dist/utils/gridLayout.js +10 -0
- package/package.json +3 -4
|
@@ -14,15 +14,31 @@
|
|
|
14
14
|
const dispatch = createEventDispatcher();
|
|
15
15
|
|
|
16
16
|
// CSS IMPORTS
|
|
17
|
-
//
|
|
18
|
-
import
|
|
17
|
+
// The theme tokens come from the design system. `FileBrowser.css` is kept (comment-only) for host apps
|
|
18
|
+
// that import it by path, so it is no longer imported here.
|
|
19
19
|
|
|
20
20
|
// Design System Style import
|
|
21
21
|
import '@widgetic/design-system/styles';
|
|
22
22
|
|
|
23
23
|
// Design system components
|
|
24
|
-
import { Button, DebugGrid, WScrollArea, EmptyState, ActionModal, SearchInput, DropdownMenu, Tooltip } from '@widgetic/design-system/components';
|
|
25
|
-
import {
|
|
24
|
+
import { Alert, Button, DebugGrid, WScrollArea, EmptyState, ErrorState, ActionModal, SearchInput, DropdownMenu, Tooltip, IconButton } from '@widgetic/design-system/components';
|
|
25
|
+
import {
|
|
26
|
+
IconCheck,
|
|
27
|
+
IconPhoto,
|
|
28
|
+
IconVideo,
|
|
29
|
+
IconFileText,
|
|
30
|
+
IconMusic,
|
|
31
|
+
IconTypography,
|
|
32
|
+
IconFileVector,
|
|
33
|
+
IconFiles,
|
|
34
|
+
IconFolderOpen,
|
|
35
|
+
IconFileUnknown,
|
|
36
|
+
IconInfoCircle,
|
|
37
|
+
IconArrowUp,
|
|
38
|
+
IconArrowDown,
|
|
39
|
+
IconChevronDown,
|
|
40
|
+
IconChevronUp
|
|
41
|
+
} from '@widgetic/design-system/icons';
|
|
26
42
|
|
|
27
43
|
// LOCAL COMPONENT IMPORTS
|
|
28
44
|
import { NewFolderButton } from '../modals';
|
|
@@ -31,7 +47,9 @@
|
|
|
31
47
|
import { SelectedFilesModal, SearchModal, RenameDialog, MoveDialog } from '../modals';
|
|
32
48
|
import { NewItemDialog } from '@widgetic/design-system/components';
|
|
33
49
|
import { FileItem, FolderItem } from '../items';
|
|
34
|
-
import { VirtualList,
|
|
50
|
+
import { VirtualList, DragSelect, ControlToolbar } from '../ui';
|
|
51
|
+
import TileSkeleton from '../ui/TileSkeleton.svelte';
|
|
52
|
+
import { gridColumnsForWidth } from '../../utils/gridLayout';
|
|
35
53
|
|
|
36
54
|
// TYPE IMPORTS
|
|
37
55
|
import type { FileSystemItem, FolderItemWithCount } from '../../types';
|
|
@@ -274,7 +292,19 @@
|
|
|
274
292
|
let rootContainerClass = 'file-browser-module';
|
|
275
293
|
// demo content settings
|
|
276
294
|
let demoContentKey = 'file-browser-demo-data';
|
|
277
|
-
const GRID_ITEM_HEIGHT =
|
|
295
|
+
const GRID_ITEM_HEIGHT = 64;
|
|
296
|
+
const COMPACT_LAYOUT_BREAKPOINT = 700;
|
|
297
|
+
|
|
298
|
+
/** Literal catalog keys (tests/i18n/catalogUsage.test.ts). */
|
|
299
|
+
const FILTER_NAME_MESSAGE_KEYS: Record<FileFilterType, string> = {
|
|
300
|
+
all: 'filterName.all',
|
|
301
|
+
image: 'filterName.image',
|
|
302
|
+
audio: 'filterName.audio',
|
|
303
|
+
video: 'filterName.video',
|
|
304
|
+
document: 'filterName.document',
|
|
305
|
+
font: 'filterName.font',
|
|
306
|
+
svg: 'filterName.svg'
|
|
307
|
+
};
|
|
278
308
|
let demoContent = demoContentData;
|
|
279
309
|
|
|
280
310
|
// Initialize instance-specific navigation store
|
|
@@ -315,6 +345,11 @@
|
|
|
315
345
|
let filteredFiles: FileSystemItem[] = []; // Files filtered by type
|
|
316
346
|
let sortedFilteredFiles: FileSystemItem[] = []; // Final sorted and filtered files
|
|
317
347
|
let isEmpty = false; // Empty folder indicator
|
|
348
|
+
// A filter that no file matches while the folders stay listed: the message is shown under the folders.
|
|
349
|
+
let hasNoMatchingFiles = false;
|
|
350
|
+
// The height of the scroll area. An empty view uses it to centre its message in the room under the "New folder" tile.
|
|
351
|
+
let scrollAreaHeight = 0;
|
|
352
|
+
let scrollAreaResizeObserver: ResizeObserver | null = null;
|
|
318
353
|
let allowedUploadTypes: string[] = []; // Allowed file extensions for upload
|
|
319
354
|
let recentFiles: FileSystemItem[] = []; // Recently modified files
|
|
320
355
|
let previewFile: FileSystemItem | null = null; // Currently previewed file
|
|
@@ -352,6 +387,8 @@
|
|
|
352
387
|
|
|
353
388
|
// Add to script section at the top with other variables
|
|
354
389
|
let mainContainer: HTMLElement;
|
|
390
|
+
// The footer (selection bar and dropzone): the upload panel floats just above it
|
|
391
|
+
let footerElement: HTMLElement;
|
|
355
392
|
|
|
356
393
|
// Add near the top with other state variables
|
|
357
394
|
let isMobile = false;
|
|
@@ -361,8 +398,21 @@
|
|
|
361
398
|
/**
|
|
362
399
|
* REACTIVE STATEMENTS
|
|
363
400
|
*/
|
|
364
|
-
|
|
365
|
-
$:
|
|
401
|
+
$: isCompactLayout = mainContainerWidth > 0 && mainContainerWidth < COMPACT_LAYOUT_BREAKPOINT;
|
|
402
|
+
$: isMobileLayout = mainContainerWidth > 0 && mainContainerWidth <= mobileBreakpoint;
|
|
403
|
+
$: gridColumns = mainContainerWidth > 0 ? gridColumnsForWidth(mainContainerWidth) : 4;
|
|
404
|
+
$: gridGap = isCompactLayout ? 8 : 16;
|
|
405
|
+
// Figma insets: the header, the controls and the footer share one inset (32 on a page, 16 when compact), the grid
|
|
406
|
+
// of tiles sits 8px further in (24, 8) so the tiles line up with the text of those rows.
|
|
407
|
+
$: edgePaddingClass = isCompactLayout ? 'px-4' : 'px-8';
|
|
408
|
+
$: contentPaddingClass = isCompactLayout ? 'px-2' : 'px-6';
|
|
409
|
+
// The footer (selection bar and dropzone) only draws its divider and spacing when it has something to show.
|
|
410
|
+
$: hasFooterContent = (allowSelecting && allSelectedFiles.length > 0) || (!isLoading && libraryCapabilities.upload);
|
|
411
|
+
$: footerClass = hasFooterContent
|
|
412
|
+
? `border-t border-border bg-background gap-3 ${isCompactLayout ? 'pb-4 pt-3' : 'pb-6 pt-4'}`
|
|
413
|
+
: '';
|
|
414
|
+
// Three rows of placeholder tiles (Figma "Files / Loading"), and never fewer than six on a one column screen
|
|
415
|
+
$: skeletonCount = Math.max(gridColumns * 3, 6);
|
|
366
416
|
|
|
367
417
|
|
|
368
418
|
/**
|
|
@@ -399,6 +449,9 @@
|
|
|
399
449
|
let showDeleteConfirmation = false; // Delete confirmation
|
|
400
450
|
let showNewFolderDialog = false; // New folder creation
|
|
401
451
|
let selectedItem: FileSystemItem | null = null; // Item for modal operations
|
|
452
|
+
// What the delete dialog asks about: the folder or file of an item menu, or the whole selection (selection bar).
|
|
453
|
+
// It is set when the dialog opens, so the dialog names (and deletes) exactly what the visitor pointed at.
|
|
454
|
+
let itemsPendingDeletion: FileSystemItem[] = [];
|
|
402
455
|
|
|
403
456
|
// UI state calculations
|
|
404
457
|
// let controlsVisible: boolean;
|
|
@@ -850,6 +903,7 @@
|
|
|
850
903
|
// this File Browser is gone must not be written into the list of the next one.
|
|
851
904
|
libraryLoadController?.abort();
|
|
852
905
|
libraryActionsController.abort();
|
|
906
|
+
scrollAreaResizeObserver?.disconnect();
|
|
853
907
|
|
|
854
908
|
// check if browser environment is available
|
|
855
909
|
if (!isBrowser) return;
|
|
@@ -1052,6 +1106,44 @@
|
|
|
1052
1106
|
}, 0) ?? 0;
|
|
1053
1107
|
}
|
|
1054
1108
|
|
|
1109
|
+
/**
|
|
1110
|
+
* Keeps scrollAreaHeight equal to the height of the scroll area, so that an empty view can centre its message.
|
|
1111
|
+
* @param element The root element of the scroll area (null while the list is not shown)
|
|
1112
|
+
*/
|
|
1113
|
+
function observeScrollAreaHeight(element: HTMLElement | null) {
|
|
1114
|
+
scrollAreaResizeObserver?.disconnect();
|
|
1115
|
+
scrollAreaResizeObserver = null;
|
|
1116
|
+
if (!element || typeof ResizeObserver === 'undefined') return;
|
|
1117
|
+
try {
|
|
1118
|
+
const measureScrollArea = () => {
|
|
1119
|
+
scrollAreaHeight = element.clientHeight;
|
|
1120
|
+
};
|
|
1121
|
+
measureScrollArea();
|
|
1122
|
+
scrollAreaResizeObserver = new ResizeObserver(measureScrollArea);
|
|
1123
|
+
scrollAreaResizeObserver.observe(element);
|
|
1124
|
+
} catch (error) {
|
|
1125
|
+
console.error('FileBrowser: the height of the scroll area could not be observed:', error);
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
$: observeScrollAreaHeight(scrollContainer);
|
|
1129
|
+
|
|
1130
|
+
// An empty view is as tall as the scroll area (less the 24px of padding under the content), so that its message
|
|
1131
|
+
// is centred in the room that is left. Anything else is as tall as its content.
|
|
1132
|
+
$: emptyViewMinHeightStyle =
|
|
1133
|
+
(isEmpty || hasNoMatchingFiles) && scrollAreaHeight > 0
|
|
1134
|
+
? `min-height: ${Math.max(0, scrollAreaHeight - 24)}px;`
|
|
1135
|
+
: '';
|
|
1136
|
+
|
|
1137
|
+
// What an empty view says, and with which icon: a type filter that matches nothing, an empty media library,
|
|
1138
|
+
// or an empty folder (Figma "Files / No matching files", "Empty library" and "Empty folder").
|
|
1139
|
+
$: emptyViewMessage =
|
|
1140
|
+
filter !== 'all'
|
|
1141
|
+
? $t('empty.libraryFiltered')
|
|
1142
|
+
: libraryMode
|
|
1143
|
+
? $t('empty.library')
|
|
1144
|
+
: $t('empty.folder');
|
|
1145
|
+
$: emptyViewIcon = filter !== 'all' ? IconFileUnknown : libraryMode ? IconFiles : IconFolderOpen;
|
|
1146
|
+
|
|
1055
1147
|
/**
|
|
1056
1148
|
* Reactive Statements Section
|
|
1057
1149
|
* Handles automatic updates of derived state
|
|
@@ -1120,6 +1212,14 @@
|
|
|
1120
1212
|
|
|
1121
1213
|
sortedFilteredFiles = sortFiles(filteredFiles);
|
|
1122
1214
|
isEmpty = !isLoading && sortedFilteredFiles.length === 0;
|
|
1215
|
+
// Folders always stay on the page, so a filter that matches no file leaves only folders: say so under them.
|
|
1216
|
+
// Matching recent files (the whole library, not only this folder) are shown instead of the message.
|
|
1217
|
+
hasNoMatchingFiles =
|
|
1218
|
+
!isLoading &&
|
|
1219
|
+
!isEmpty &&
|
|
1220
|
+
filter !== 'all' &&
|
|
1221
|
+
recentFiles.length === 0 &&
|
|
1222
|
+
!sortedFilteredFiles.some((item: FileSystemItem) => item.type !== 'folder');
|
|
1123
1223
|
// Footer FileUploader requires this flag; empty folders never mount VirtualList.
|
|
1124
1224
|
if (!isLoading && isEmpty && !isVirtualListInitialized) {
|
|
1125
1225
|
isVirtualListInitialized = true;
|
|
@@ -1393,12 +1493,18 @@
|
|
|
1393
1493
|
if (item.type === 'folder') {
|
|
1394
1494
|
selectedItem = item;
|
|
1395
1495
|
selectedFiles.set([]);
|
|
1496
|
+
itemsPendingDeletion = [item];
|
|
1396
1497
|
} else {
|
|
1397
1498
|
selectedItem = null;
|
|
1398
1499
|
// Only set selected files if they're not already set
|
|
1399
1500
|
if ($selectedFiles.length === 0) {
|
|
1400
1501
|
selectedFiles.set([item]);
|
|
1401
1502
|
}
|
|
1503
|
+
// A file that is part of the selection takes the whole selection with it (as Move does);
|
|
1504
|
+
// any other file is deleted alone, never the files that happen to be selected elsewhere.
|
|
1505
|
+
itemsPendingDeletion = validSelectedFiles.some((selectedFile) => selectedFile.id === item.id)
|
|
1506
|
+
? [...validSelectedFiles]
|
|
1507
|
+
: [item];
|
|
1402
1508
|
}
|
|
1403
1509
|
showDeleteConfirmation = true;
|
|
1404
1510
|
}
|
|
@@ -1466,11 +1572,13 @@
|
|
|
1466
1572
|
// Check if we received multiple items in the event
|
|
1467
1573
|
const eventItems = event.detail.items || (event.detail.item ? [event.detail.item] : []);
|
|
1468
1574
|
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1575
|
+
// The event names what to delete (the dialog hands over the items it asked about); without one, the item of the
|
|
1576
|
+
// dialog, or else everything selected
|
|
1577
|
+
const itemsToDelete = eventItems.length > 0
|
|
1578
|
+
? eventItems
|
|
1579
|
+
: selectedItem
|
|
1580
|
+
? [selectedItem]
|
|
1581
|
+
: allSelectedFiles;
|
|
1474
1582
|
|
|
1475
1583
|
// Clear items from persistent selection store
|
|
1476
1584
|
itemsToDelete.forEach(item => {
|
|
@@ -1480,6 +1588,7 @@
|
|
|
1480
1588
|
// Clear selected files and selectedItem immediately to allow UI to continue
|
|
1481
1589
|
selectedFiles.set([]);
|
|
1482
1590
|
selectedItem = null;
|
|
1591
|
+
itemsPendingDeletion = [];
|
|
1483
1592
|
showDeleteConfirmation = false;
|
|
1484
1593
|
|
|
1485
1594
|
// Show initial toast notification
|
|
@@ -2423,15 +2532,21 @@
|
|
|
2423
2532
|
|
|
2424
2533
|
// Add in script section after other filter-related code
|
|
2425
2534
|
// Filter options for the dropdown
|
|
2426
|
-
|
|
2535
|
+
type FilterOptionRow = {
|
|
2536
|
+
value: FileFilterType;
|
|
2537
|
+
label: string;
|
|
2538
|
+
icon: typeof IconFiles;
|
|
2539
|
+
};
|
|
2540
|
+
|
|
2541
|
+
let filterOptions: FilterOptionRow[] = [];
|
|
2427
2542
|
$: filterOptions = [
|
|
2428
|
-
{ value: 'all', label: $t('filterOption.all') },
|
|
2429
|
-
{ value: 'image', label: $t('filterOption.image') },
|
|
2430
|
-
{ value: 'video', label: $t('filterOption.video') },
|
|
2431
|
-
{ value: 'document', label: $t('filterOption.document') },
|
|
2432
|
-
{ value: 'audio', label: $t('filterOption.audio') },
|
|
2433
|
-
{ value: 'font', label: $t('filterOption.font') },
|
|
2434
|
-
{ value: 'svg', label: $t('filterOption.svg') }
|
|
2543
|
+
{ value: 'all', label: $t('filterOption.all'), icon: IconFiles },
|
|
2544
|
+
{ value: 'image', label: $t('filterOption.image'), icon: IconPhoto },
|
|
2545
|
+
{ value: 'video', label: $t('filterOption.video'), icon: IconVideo },
|
|
2546
|
+
{ value: 'document', label: $t('filterOption.document'), icon: IconFileText },
|
|
2547
|
+
{ value: 'audio', label: $t('filterOption.audio'), icon: IconMusic },
|
|
2548
|
+
{ value: 'font', label: $t('filterOption.font'), icon: IconTypography },
|
|
2549
|
+
{ value: 'svg', label: $t('filterOption.svg'), icon: IconFileVector }
|
|
2435
2550
|
];
|
|
2436
2551
|
|
|
2437
2552
|
// Add these state variables
|
|
@@ -2662,15 +2777,15 @@ mainGridClass="app-main-grid"
|
|
|
2662
2777
|
<div
|
|
2663
2778
|
bind:this={mainContainer}
|
|
2664
2779
|
bind:clientWidth={mainContainerWidth}
|
|
2665
|
-
class="{rootContainerClass} {className ? className + ' ' : ''}
|
|
2780
|
+
class="{rootContainerClass} {className ? className + ' ' : ''}flex h-full w-full flex-col overflow-hidden bg-background relative {
|
|
2666
2781
|
dragActive
|
|
2667
2782
|
? (dragInvalid
|
|
2668
|
-
? 'ring-1 ring-
|
|
2783
|
+
? 'ring-1 ring-destructive/30'
|
|
2669
2784
|
: hasValidFiles
|
|
2670
|
-
? 'ring-1 ring-
|
|
2671
|
-
: 'ring-1 ring-
|
|
2785
|
+
? 'ring-1 ring-brand/30'
|
|
2786
|
+
: 'ring-1 ring-border')
|
|
2672
2787
|
: ''
|
|
2673
|
-
} transition-all duration-
|
|
2788
|
+
} transition-all duration-base focus:outline-none"
|
|
2674
2789
|
style="{style ? style + ' ' : ''}height:100%;"
|
|
2675
2790
|
ondragenter={!$isModalOpen ? handleDragEnter : null}
|
|
2676
2791
|
ondragleave={!$isModalOpen ? handleDragLeave : null}
|
|
@@ -2686,6 +2801,7 @@ mainGridClass="app-main-grid"
|
|
|
2686
2801
|
<Header bind:this={headerEl}
|
|
2687
2802
|
class="file-browser-header"
|
|
2688
2803
|
style="display: {showHeader ? 'flex' : 'none'};"
|
|
2804
|
+
compact={isCompactLayout}
|
|
2689
2805
|
{currentPath}
|
|
2690
2806
|
{currentPathNames}
|
|
2691
2807
|
selectedFilesCount={allSelectedFiles.length}
|
|
@@ -2701,9 +2817,9 @@ mainGridClass="app-main-grid"
|
|
|
2701
2817
|
title={libraryMode ? (resolvedMediaLibrary?.hasOwnLabel ? resolvedMediaLibrary.label : $t('library.defaultLabel')) : ''}
|
|
2702
2818
|
/>
|
|
2703
2819
|
|
|
2704
|
-
<!-- FILE BROWSER CONTROLS -->
|
|
2705
|
-
|
|
2706
|
-
|
|
2820
|
+
<!-- FILE BROWSER CONTROLS (Search Field + filter/sort triggers) -->
|
|
2821
|
+
<!-- One row at every width: the search shrinks beside the filter and sort. With no header, this row carries the top inset. -->
|
|
2822
|
+
<div class="file-browser-controls flex min-w-0 shrink-0 flex-nowrap items-center gap-2 pb-4 {edgePaddingClass} {!showHeader ? 'pt-6' : ''}">
|
|
2707
2823
|
<div class="search-bar-container flex min-w-0 flex-1 items-center">
|
|
2708
2824
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
2709
2825
|
<div onclick={handleSearch} class="w-full cursor-pointer">
|
|
@@ -2719,37 +2835,39 @@ mainGridClass="app-main-grid"
|
|
|
2719
2835
|
</div>
|
|
2720
2836
|
</div>
|
|
2721
2837
|
|
|
2722
|
-
<!-- Controls stay on narrow widths. The search field shrinks instead. -->
|
|
2723
2838
|
{#if showFilters || showSorting}
|
|
2724
|
-
<div class="controls-container flex shrink-0 items-center gap-
|
|
2839
|
+
<div class="controls-container flex shrink-0 items-center gap-2 whitespace-nowrap">
|
|
2725
2840
|
|
|
2726
|
-
<!-- Filter Controls Container -->
|
|
2727
2841
|
{#if showFilters}
|
|
2728
|
-
<div class="filter-controls-container
|
|
2842
|
+
<div class="filter-controls-container relative z-10 flex items-center">
|
|
2729
2843
|
{#key filterMenuKey}
|
|
2730
2844
|
<DropdownMenu.Root onOpenChange={setFilterMenuOpen}>
|
|
2731
2845
|
<DropdownMenu.Trigger
|
|
2732
|
-
class="filter-button group flex items-center gap-
|
|
2846
|
+
class="filter-button group flex h-9 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-lg border border-input bg-background px-3 text-start transition-colors duration-fast hover:bg-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
2733
2847
|
>
|
|
2734
|
-
<span class="whitespace-nowrap">{$t('filter.by', { type: '\u0001' }).split('\u0001')[0].trim()}</span>
|
|
2735
|
-
<span class="
|
|
2736
|
-
<span class="
|
|
2737
|
-
|
|
2738
|
-
<span class="col-start-1 row-start-1 whitespace-nowrap">{$t(`filterOption.${filter}`)}</span>
|
|
2739
|
-
</span>
|
|
2740
|
-
<svg class="h-3 w-3 shrink-0" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 4.5 L6 8.5 L10 4.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" /></svg>
|
|
2848
|
+
<span class="text-body text-muted-foreground whitespace-nowrap">{$t('filter.by', { type: '\u0001' }).split('\u0001')[0].trim()}</span>
|
|
2849
|
+
<span class="relative inline-grid">
|
|
2850
|
+
<span class="invisible col-start-1 row-start-1 whitespace-nowrap text-body-medium">{widestFilterLabel}</span>
|
|
2851
|
+
<span class="col-start-1 row-start-1 whitespace-nowrap text-body-medium text-foreground">{$t(`filterOption.${filter}`)}</span>
|
|
2741
2852
|
</span>
|
|
2853
|
+
<IconChevronDown class="size-4 shrink-0 stroke-[1.333] opacity-50 group-data-[state=open]:hidden" aria-hidden="true" />
|
|
2854
|
+
<IconChevronUp class="hidden size-4 shrink-0 stroke-[1.333] opacity-50 group-data-[state=open]:block" aria-hidden="true" />
|
|
2742
2855
|
</DropdownMenu.Trigger>
|
|
2743
|
-
<DropdownMenu.Content side="bottom" align="
|
|
2856
|
+
<DropdownMenu.Content side="bottom" align="start" class="filter-dropdown w-[12.5rem] min-w-0">
|
|
2744
2857
|
{#each filterOptions as option}
|
|
2858
|
+
{@const OptionIcon = option.icon}
|
|
2745
2859
|
<DropdownMenu.Item
|
|
2746
|
-
class="filter-dropdown-item flex w-full items-center
|
|
2860
|
+
class="filter-dropdown-item relative flex w-full items-center gap-2 rounded-lg px-2 py-1.5 ps-8 {filter === option.value ? 'bg-brand-subtle' : ''} data-highlighted:bg-accent"
|
|
2747
2861
|
onclick={() => handleFilterChange(option.value as FileFilterType)}
|
|
2748
2862
|
>
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2863
|
+
<!-- The check slot: only the chosen option shows the check -->
|
|
2864
|
+
<span class="absolute start-2 flex size-4 items-center justify-center">
|
|
2865
|
+
{#if filter === option.value}
|
|
2866
|
+
<IconCheck class="size-4 stroke-[1.333] text-foreground" aria-hidden="true" />
|
|
2867
|
+
{/if}
|
|
2868
|
+
</span>
|
|
2869
|
+
<OptionIcon class="size-4 shrink-0 stroke-[1.333]" aria-hidden="true" />
|
|
2870
|
+
<span class="text-body min-w-0 flex-1 truncate">{option.label}</span>
|
|
2753
2871
|
</DropdownMenu.Item>
|
|
2754
2872
|
{/each}
|
|
2755
2873
|
</DropdownMenu.Content>
|
|
@@ -2758,54 +2876,72 @@ mainGridClass="app-main-grid"
|
|
|
2758
2876
|
</div>
|
|
2759
2877
|
{/if}
|
|
2760
2878
|
|
|
2761
|
-
<!-- Sort Controls Container -->
|
|
2762
2879
|
{#if showSorting}
|
|
2763
2880
|
<div class="sort-controls-container flex items-center gap-2">
|
|
2764
2881
|
{#key sortMenuKey}
|
|
2765
2882
|
<DropdownMenu.Root onOpenChange={setSortMenuOpen}>
|
|
2766
2883
|
<DropdownMenu.Trigger
|
|
2767
|
-
class="sort-button flex items-center gap-
|
|
2884
|
+
class="sort-button group flex h-9 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-lg border border-input bg-background px-3 text-start transition-colors duration-fast hover:bg-accent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
2768
2885
|
>
|
|
2769
|
-
<span class="whitespace-nowrap">{$t('sort.by')}</span>
|
|
2770
|
-
<span class="
|
|
2771
|
-
<span class="
|
|
2772
|
-
|
|
2773
|
-
<span class="col-start-1 row-start-1 whitespace-nowrap">{$t(`sort.${$sortCriteria}`)}</span>
|
|
2774
|
-
</span>
|
|
2775
|
-
<svg class="h-3 w-3 shrink-0" viewBox="0 0 12 12" aria-hidden="true"><path d="M2 4.5 L6 8.5 L10 4.5" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" /></svg>
|
|
2886
|
+
<span class="text-body text-muted-foreground whitespace-nowrap">{$t('sort.by')}</span>
|
|
2887
|
+
<span class="relative inline-grid">
|
|
2888
|
+
<span class="invisible col-start-1 row-start-1 whitespace-nowrap text-body-medium">{widestSortLabel}</span>
|
|
2889
|
+
<span class="col-start-1 row-start-1 whitespace-nowrap text-body-medium text-foreground">{$t(`sort.${$sortCriteria}`)}</span>
|
|
2776
2890
|
</span>
|
|
2891
|
+
<IconChevronDown class="size-4 shrink-0 stroke-[1.333] opacity-50 group-data-[state=open]:hidden" aria-hidden="true" />
|
|
2892
|
+
<IconChevronUp class="hidden size-4 shrink-0 stroke-[1.333] opacity-50 group-data-[state=open]:block" aria-hidden="true" />
|
|
2777
2893
|
</DropdownMenu.Trigger>
|
|
2778
|
-
<DropdownMenu.Content side="bottom" align="
|
|
2894
|
+
<DropdownMenu.Content side="bottom" align="start" class="sort-dropdown w-40 min-w-0">
|
|
2779
2895
|
{#each sortOptions as option}
|
|
2780
2896
|
<DropdownMenu.Item
|
|
2781
|
-
class="sort-dropdown-item flex w-full items-center
|
|
2897
|
+
class="sort-dropdown-item relative flex w-full items-center gap-2 rounded-lg px-2 py-1.5 ps-8 {$sortCriteria === option.value ? 'bg-brand-subtle' : ''} data-highlighted:bg-accent"
|
|
2782
2898
|
onclick={() => sortCriteria.set(option.value)}
|
|
2783
2899
|
>
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2900
|
+
<!-- The check slot: only the chosen option shows the check -->
|
|
2901
|
+
<span class="absolute start-2 flex size-4 items-center justify-center">
|
|
2902
|
+
{#if $sortCriteria === option.value}
|
|
2903
|
+
<IconCheck class="size-4 stroke-[1.333] text-foreground" aria-hidden="true" />
|
|
2904
|
+
{/if}
|
|
2905
|
+
</span>
|
|
2906
|
+
<span class="text-body">{$t(option.labelKey)}</span>
|
|
2788
2907
|
</DropdownMenu.Item>
|
|
2789
2908
|
{/each}
|
|
2790
2909
|
</DropdownMenu.Content>
|
|
2791
2910
|
</DropdownMenu.Root>
|
|
2792
2911
|
{/key}
|
|
2793
2912
|
|
|
2794
|
-
<!-- Sort Direction Button -->
|
|
2795
2913
|
<Tooltip.Provider delayDuration={200}>
|
|
2796
2914
|
<Tooltip.Root>
|
|
2797
|
-
<Tooltip.Trigger
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2915
|
+
<Tooltip.Trigger class="inline-flex">
|
|
2916
|
+
<!-- The trigger hands its props to the button itself: a button inside the trigger's own button is not valid HTML -->
|
|
2917
|
+
{#snippet child({ props }: { props: Record<string, unknown> })}
|
|
2918
|
+
<IconButton
|
|
2919
|
+
{...props}
|
|
2920
|
+
variant="outline"
|
|
2921
|
+
size="default"
|
|
2922
|
+
class="sort-order-button size-9"
|
|
2923
|
+
label={$sortDirection === 'asc' ? $t('sort.orderDescending') : $t('sort.orderAscending')}
|
|
2924
|
+
onclick={(event: MouseEvent) => {
|
|
2925
|
+
// The trigger's own click handler closes the tooltip, so it runs too
|
|
2926
|
+
(props.onclick as ((event: MouseEvent) => void) | undefined)?.(event);
|
|
2927
|
+
toggleSortDirection();
|
|
2928
|
+
}}
|
|
2929
|
+
>
|
|
2930
|
+
{#if $sortDirection === 'asc'}
|
|
2931
|
+
<IconArrowUp class="size-4 stroke-[1.333]" aria-hidden="true" />
|
|
2932
|
+
{:else}
|
|
2933
|
+
<IconArrowDown class="size-4 stroke-[1.333]" aria-hidden="true" />
|
|
2934
|
+
{/if}
|
|
2935
|
+
</IconButton>
|
|
2936
|
+
{/snippet}
|
|
2802
2937
|
</Tooltip.Trigger>
|
|
2803
2938
|
<Tooltip.Portal>
|
|
2939
|
+
<!-- Opens above the button. The page portal paints it over the module box. -->
|
|
2804
2940
|
<Tooltip.Content
|
|
2805
2941
|
side="top"
|
|
2806
2942
|
align="end"
|
|
2807
2943
|
sideOffset={8}
|
|
2808
|
-
class="sort-order-tooltip whitespace-pre-line
|
|
2944
|
+
class="sort-order-tooltip bg-foreground text-background z-[99999] whitespace-pre-line rounded-lg px-2 py-1 text-center text-caption"
|
|
2809
2945
|
>
|
|
2810
2946
|
{$sortDirection === 'asc' ? $t('sort.orderDescending') : $t('sort.orderAscending')}
|
|
2811
2947
|
</Tooltip.Content>
|
|
@@ -2819,44 +2955,45 @@ mainGridClass="app-main-grid"
|
|
|
2819
2955
|
</div>
|
|
2820
2956
|
|
|
2821
2957
|
<!-- FILE BROWSER CONTENT -->
|
|
2822
|
-
<div class="file-browser-content flex min-h-0 flex-col
|
|
2823
|
-
<!-- Media library notice: the list on screen is not the whole library -->
|
|
2958
|
+
<div class="file-browser-content relative flex min-h-0 grow flex-col overflow-hidden">
|
|
2824
2959
|
{#if libraryNotice}
|
|
2825
|
-
|
|
2826
|
-
|
|
2960
|
+
<!-- Figma "Files / Some files failed to load": an Alert with the message as its title and "Try again" under it -->
|
|
2961
|
+
<Alert.Root class="library-notice mb-6 w-auto shrink-0 {isCompactLayout ? 'mx-2' : 'mx-6'}">
|
|
2962
|
+
<IconInfoCircle aria-hidden="true" />
|
|
2963
|
+
<Alert.Title>{libraryNotice.text}</Alert.Title>
|
|
2827
2964
|
{#if libraryNotice.canRetry}
|
|
2828
|
-
<
|
|
2965
|
+
<div class="col-start-2 row-start-2 pt-2">
|
|
2966
|
+
<Button variant="outline" size="sm" onclick={reloadLibrary}>{$t('action.tryAgain')}</Button>
|
|
2967
|
+
</div>
|
|
2829
2968
|
{/if}
|
|
2830
|
-
</
|
|
2969
|
+
</Alert.Root>
|
|
2831
2970
|
{/if}
|
|
2832
2971
|
|
|
2833
|
-
<!-- Loader Container -->
|
|
2834
2972
|
{#if isLoading}
|
|
2835
|
-
<div class="loader-container
|
|
2836
|
-
<div
|
|
2973
|
+
<div class="loader-container {contentPaddingClass}">
|
|
2974
|
+
<div
|
|
2975
|
+
class="grid w-full"
|
|
2976
|
+
style="grid-template-columns: repeat({gridColumns}, minmax(0, 1fr)); gap: {gridGap}px;"
|
|
2977
|
+
>
|
|
2837
2978
|
{#each Array(skeletonCount) as _}
|
|
2838
|
-
<
|
|
2839
|
-
<LoadingSkeleton width="62px" height="54px" className="me-4" />
|
|
2840
|
-
<div class="grow">
|
|
2841
|
-
<LoadingSkeleton width="100%" height="20px" className="mb-2" />
|
|
2842
|
-
<LoadingSkeleton width="60%" height="16px" />
|
|
2843
|
-
</div>
|
|
2844
|
-
</div>
|
|
2979
|
+
<TileSkeleton />
|
|
2845
2980
|
{/each}
|
|
2846
2981
|
</div>
|
|
2847
2982
|
</div>
|
|
2848
2983
|
|
|
2849
|
-
<!-- Media library error: it cannot be used, or its first page could not be read -->
|
|
2850
2984
|
{:else if libraryErrorMessage}
|
|
2851
2985
|
<div class="library-error-container relative min-h-0 flex-1" role="alert">
|
|
2852
|
-
<div class="
|
|
2853
|
-
<
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2986
|
+
<div class="absolute inset-0 z-10 flex w-full items-center justify-center">
|
|
2987
|
+
<ErrorState
|
|
2988
|
+
class="py-8"
|
|
2989
|
+
messages={{
|
|
2990
|
+
title: $t('libraryError.loadFailed'),
|
|
2991
|
+
description: libraryErrorMessage,
|
|
2992
|
+
retryLabel: $t('action.tryAgain'),
|
|
2993
|
+
supportLabel: ''
|
|
2994
|
+
}}
|
|
2995
|
+
onRetry={!libraryConfigError ? reloadLibrary : undefined}
|
|
2996
|
+
/>
|
|
2860
2997
|
</div>
|
|
2861
2998
|
</div>
|
|
2862
2999
|
|
|
@@ -2864,7 +3001,8 @@ mainGridClass="app-main-grid"
|
|
|
2864
3001
|
{:else}
|
|
2865
3002
|
<!-- Main content container with Files Inside --> <!-- {!showAddToEditor ? 'overflow-y-auto px-6' : ''} -->
|
|
2866
3003
|
<WScrollArea class="scroll-area-container min-h-0 flex-1" bind:element={scrollContainer} type="always">
|
|
2867
|
-
|
|
3004
|
+
<!-- The padding is the same on both sides (Figma 24): the scrollbar sits in the end gutter, not on the tiles. -->
|
|
3005
|
+
<div class="main-content-container flex flex-col pb-6 {contentPaddingClass}" style={emptyViewMinHeightStyle} bind:this={contentContainer}>
|
|
2868
3006
|
|
|
2869
3007
|
<!-- Drag Select for selecting files -->
|
|
2870
3008
|
{#if allowSelecting}
|
|
@@ -2900,13 +3038,12 @@ mainGridClass="app-main-grid"
|
|
|
2900
3038
|
|
|
2901
3039
|
{#if !isEmpty}
|
|
2902
3040
|
<!-- Files GRID List(VirtualList) -->
|
|
2903
|
-
<VirtualList class="content-container
|
|
3041
|
+
<VirtualList class="content-container"
|
|
2904
3042
|
{scrollContainer}
|
|
2905
3043
|
items={libraryCapabilities.folders ? [{ type: 'new-folder' }, ...sortedFilteredFiles] : sortedFilteredFiles}
|
|
2906
3044
|
itemHeight={GRID_ITEM_HEIGHT}
|
|
2907
|
-
columns={
|
|
2908
|
-
|
|
2909
|
-
gap={isTablet ? 24 : 26}
|
|
3045
|
+
columns={gridColumns}
|
|
3046
|
+
gap={gridGap}
|
|
2910
3047
|
let:item
|
|
2911
3048
|
on:rangechange={() => {
|
|
2912
3049
|
if (!isVirtualListInitialized) {
|
|
@@ -2916,8 +3053,10 @@ mainGridClass="app-main-grid"
|
|
|
2916
3053
|
}}
|
|
2917
3054
|
>
|
|
2918
3055
|
<!-- Item content -->
|
|
2919
|
-
<div
|
|
2920
|
-
|
|
3056
|
+
<div
|
|
3057
|
+
data-item-id={item.id}
|
|
3058
|
+
class="item-container"
|
|
3059
|
+
data-selected={allowSelecting && currentSelections.some(f => f.id === item.id) ? 'true' : undefined}
|
|
2921
3060
|
>
|
|
2922
3061
|
{#if item.type === 'new-folder'}
|
|
2923
3062
|
<NewFolderButton on:click={handleNewFolderClick} />
|
|
@@ -2944,6 +3083,13 @@ mainGridClass="app-main-grid"
|
|
|
2944
3083
|
</div>
|
|
2945
3084
|
</VirtualList>
|
|
2946
3085
|
|
|
3086
|
+
{#if hasNoMatchingFiles}
|
|
3087
|
+
<!-- The folders stay on the page when a filter matches no file: the message is centred in the room under them -->
|
|
3088
|
+
<div class="no-matching-files-container flex min-h-0 w-full flex-1 items-center justify-center">
|
|
3089
|
+
<EmptyState message={emptyViewMessage} icon={emptyViewIcon} showActions={false} height="auto" />
|
|
3090
|
+
</div>
|
|
3091
|
+
{/if}
|
|
3092
|
+
|
|
2947
3093
|
<!-- Recent Files (a media library is one flat list, so they would only repeat the grid) -->
|
|
2948
3094
|
{#if !libraryMode && currentPath.length === 0 && recentFiles.length > 0 && mainContainerWidth > tabletBreakpoint}
|
|
2949
3095
|
<RecentFiles class="recent-files-container"
|
|
@@ -2959,23 +3105,22 @@ mainGridClass="app-main-grid"
|
|
|
2959
3105
|
{/if}
|
|
2960
3106
|
|
|
2961
3107
|
{:else}
|
|
2962
|
-
<!-- Empty
|
|
2963
|
-
<div class="empty-content-container">
|
|
3108
|
+
<!-- Empty view (Figma "Files / Empty folder" and "Empty library"): the "New folder" tile, then the message centred in the room that is left -->
|
|
3109
|
+
<div class="empty-content-container flex min-h-0 w-full flex-1 flex-col gap-3">
|
|
2964
3110
|
|
|
2965
3111
|
<!-- New Folder Button -->
|
|
2966
3112
|
{#if libraryCapabilities.folders}
|
|
2967
|
-
<div
|
|
3113
|
+
<div
|
|
3114
|
+
class="grid w-full"
|
|
3115
|
+
style="grid-template-columns: repeat({gridColumns}, minmax(0, 1fr)); gap: {gridGap}px;"
|
|
3116
|
+
>
|
|
2968
3117
|
<NewFolderButton on:click={handleNewFolderClick} />
|
|
2969
3118
|
</div>
|
|
2970
3119
|
{/if}
|
|
2971
3120
|
|
|
2972
3121
|
<!-- Empty State Container -->
|
|
2973
|
-
<div class="empty-state-wrapper w-full flex
|
|
2974
|
-
<EmptyState
|
|
2975
|
-
message={libraryMode ? (filter === 'all' ? $t('empty.library') : $t('empty.libraryFiltered')) : $t('empty.folder')}
|
|
2976
|
-
height="auto"
|
|
2977
|
-
>
|
|
2978
|
-
</EmptyState>
|
|
3122
|
+
<div class="empty-state-wrapper flex min-h-0 w-full flex-1 items-center justify-center">
|
|
3123
|
+
<EmptyState message={emptyViewMessage} icon={emptyViewIcon} showActions={false} height="auto" />
|
|
2979
3124
|
</div>
|
|
2980
3125
|
</div>
|
|
2981
3126
|
{/if}
|
|
@@ -2985,11 +3130,14 @@ mainGridClass="app-main-grid"
|
|
|
2985
3130
|
{/if}
|
|
2986
3131
|
</div>
|
|
2987
3132
|
|
|
2988
|
-
<!-- FILE BROWSER FOOTER -->
|
|
2989
|
-
<div
|
|
3133
|
+
<!-- FILE BROWSER FOOTER (Figma: a divider, then the selection bar over the dropzone, 12px apart) -->
|
|
3134
|
+
<div
|
|
3135
|
+
class="file-browser-footer relative z-20 flex shrink-0 flex-col {footerClass} {edgePaddingClass}"
|
|
3136
|
+
bind:this={footerElement}
|
|
3137
|
+
>
|
|
2990
3138
|
{#if allowSelecting && allSelectedFiles.length > 0}
|
|
2991
|
-
<div class="control-toolbar-row flex
|
|
2992
|
-
<div class="control-toolbar-wrapper
|
|
3139
|
+
<div class="control-toolbar-row flex w-full">
|
|
3140
|
+
<div class="control-toolbar-wrapper w-full min-w-0 overflow-x-auto">
|
|
2993
3141
|
<ControlToolbar
|
|
2994
3142
|
selectedFiles={allSelectedFiles}
|
|
2995
3143
|
currentFilter={filter}
|
|
@@ -2999,12 +3147,13 @@ mainGridClass="app-main-grid"
|
|
|
2999
3147
|
addToEditorLabel={addToEditorText}
|
|
3000
3148
|
{activeFileId}
|
|
3001
3149
|
{maxSelections}
|
|
3002
|
-
compact={
|
|
3003
|
-
on:toggleSelectedFiles={toggleModal}
|
|
3150
|
+
compact={isCompactLayout}
|
|
3004
3151
|
on:send={sendToEditor}
|
|
3005
3152
|
on:move={(e : any) => handleItemAction(new CustomEvent('action', { detail: { action: 'move', item: e.detail.items[0] } }))}
|
|
3006
3153
|
on:delete={(e : any) => {
|
|
3007
3154
|
selectedItem = null;
|
|
3155
|
+
// The selection bar acts on everything selected
|
|
3156
|
+
itemsPendingDeletion = [...allSelectedFiles];
|
|
3008
3157
|
showDeleteConfirmation = true;
|
|
3009
3158
|
}}
|
|
3010
3159
|
on:rename={(e : any) => handleItemAction(new CustomEvent('action', { detail: { action: 'rename', item: e.detail.item } }))}
|
|
@@ -3015,13 +3164,14 @@ mainGridClass="app-main-grid"
|
|
|
3015
3164
|
|
|
3016
3165
|
<!-- FILE UPLOADER (a media library without upload has nothing to upload to) -->
|
|
3017
3166
|
{#if !isLoading && libraryCapabilities.upload}
|
|
3018
|
-
<div class="file-uploader-container shrink-0
|
|
3167
|
+
<div class="file-uploader-container shrink-0">
|
|
3019
3168
|
<FileUploader
|
|
3020
3169
|
bind:this={fileUploaderComponent}
|
|
3021
3170
|
allowedTypes={allowedUploadTypes}
|
|
3022
3171
|
currentPath={currentPath}
|
|
3023
3172
|
{filter}
|
|
3024
|
-
portalTarget={
|
|
3173
|
+
portalTarget={footerElement}
|
|
3174
|
+
compact={isCompactLayout}
|
|
3025
3175
|
on:fileUploaded={handleFileUploaded}
|
|
3026
3176
|
on:error={handleUploadError}
|
|
3027
3177
|
bind:dragActive
|
|
@@ -3080,6 +3230,7 @@ mainGridClass="app-main-grid"
|
|
|
3080
3230
|
itemName={selectedItem?.name ?? ''}
|
|
3081
3231
|
itemType={selectedItem?.type === 'folder' ? 'folder' : 'file'}
|
|
3082
3232
|
itemId={selectedItem?.id ?? ''}
|
|
3233
|
+
title={$t('dialog.rename.title')}
|
|
3083
3234
|
placeholder={selectedItem?.type === 'folder' ? $t('dialog.rename.folderPlaceholder') : $t('dialog.rename.filePlaceholder')}
|
|
3084
3235
|
confirmLabel={$t('action.rename')}
|
|
3085
3236
|
cancelLabel={$t('action.cancel')}
|
|
@@ -3158,19 +3309,20 @@ mainGridClass="app-main-grid"
|
|
|
3158
3309
|
{#if showDeleteConfirmation}
|
|
3159
3310
|
<ActionModal
|
|
3160
3311
|
bind:isOpen={showDeleteConfirmation}
|
|
3161
|
-
title={selectedItem?.type === 'folder' ? $t('dialog.delete.folderTitle') : (
|
|
3312
|
+
title={selectedItem?.type === 'folder' ? $t('dialog.delete.folderTitle') : (itemsPendingDeletion.length > 1 ? $t('dialog.delete.itemsTitle') : $t('dialog.delete.fileTitle'))}
|
|
3162
3313
|
message={selectedItem?.type === 'folder'
|
|
3163
3314
|
? $t('dialog.delete.folderMessage', { name: selectedItem?.name ?? '' })
|
|
3164
|
-
: (
|
|
3165
|
-
? $t('dialog.delete.itemsMessage', { count:
|
|
3166
|
-
: $t('dialog.delete.fileMessage', { name:
|
|
3167
|
-
items={
|
|
3315
|
+
: (itemsPendingDeletion.length > 1
|
|
3316
|
+
? $t('dialog.delete.itemsMessage', { count: itemsPendingDeletion.length })
|
|
3317
|
+
: $t('dialog.delete.fileMessage', { name: itemsPendingDeletion[0]?.name ?? '' }))}
|
|
3318
|
+
items={itemsPendingDeletion}
|
|
3168
3319
|
target={rootContainerClass}
|
|
3169
3320
|
on:confirm={handleDelete}
|
|
3170
3321
|
on:cancel={() => {
|
|
3171
3322
|
showDeleteConfirmation = false;
|
|
3323
|
+
itemsPendingDeletion = [];
|
|
3172
3324
|
}}
|
|
3173
|
-
confirmLabel={$t('action.
|
|
3325
|
+
confirmLabel={$t('action.delete')}
|
|
3174
3326
|
cancelLabel={$t('action.cancel')}
|
|
3175
3327
|
closeLabel={$t('dialog.close')}
|
|
3176
3328
|
actionType="delete"
|
|
@@ -3188,7 +3340,7 @@ mainGridClass="app-main-grid"
|
|
|
3188
3340
|
target={rootContainerClass}
|
|
3189
3341
|
{currentPath}
|
|
3190
3342
|
{currentPathNames}
|
|
3191
|
-
|
|
3343
|
+
title={$t('dialog.newFolder.title')}
|
|
3192
3344
|
confirmLabel={$t('action.create')}
|
|
3193
3345
|
cancelLabel={$t('action.cancel')}
|
|
3194
3346
|
closeLabel={$t('dialog.close')}
|
|
@@ -3248,29 +3400,5 @@ mainGridClass="app-main-grid"
|
|
|
3248
3400
|
pointer-events: all !important;
|
|
3249
3401
|
user-select: none !important;
|
|
3250
3402
|
}
|
|
3251
|
-
|
|
3252
|
-
/* Prevent scrolling when showing empty state */
|
|
3253
|
-
.empty-state-wrapper {
|
|
3254
|
-
position: absolute;
|
|
3255
|
-
top: 0;
|
|
3256
|
-
left: 0;
|
|
3257
|
-
right: 0;
|
|
3258
|
-
bottom: 0;
|
|
3259
|
-
display: flex;
|
|
3260
|
-
flex-direction: column;
|
|
3261
|
-
align-items: center;
|
|
3262
|
-
justify-content: center;
|
|
3263
|
-
overflow: hidden;
|
|
3264
|
-
padding-top: 80px;
|
|
3265
|
-
padding-bottom: 80px;
|
|
3266
|
-
z-index: 10;
|
|
3267
|
-
}
|
|
3268
|
-
|
|
3269
|
-
/* Ensure the empty-content-container doesn't block interactions */
|
|
3270
|
-
.empty-content-container {
|
|
3271
|
-
position: relative;
|
|
3272
|
-
width: 100%;
|
|
3273
|
-
height: 100%;
|
|
3274
|
-
}
|
|
3275
3403
|
</style>
|
|
3276
3404
|
</div>
|