@widgetic/file-browser 0.5.35 → 0.5.36
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 +7 -7
- 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 -150
- 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/stores/fileStore.d.ts +2 -2
- package/dist/stores/navigationStore.d.ts +1 -1
- package/dist/stores/persistentSelectStore.d.ts +1 -1
- package/dist/utils/gridLayout.d.ts +2 -0
- package/dist/utils/gridLayout.js +10 -0
- package/package.json +3 -4
|
@@ -1,103 +1,57 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Figma "Selection Bar" (271:1178): summary, clear, batch actions, optional primary confirm.
|
|
4
|
+
*/
|
|
5
|
+
import { Button, IconButton } from '@widgetic/design-system/components';
|
|
6
|
+
import {
|
|
7
|
+
IconArrowsMove,
|
|
8
|
+
IconCheck,
|
|
9
|
+
IconDownload,
|
|
10
|
+
IconPencil,
|
|
7
11
|
IconTrash,
|
|
8
|
-
|
|
9
|
-
IconCircleArrowDown
|
|
12
|
+
IconX
|
|
10
13
|
} from '@widgetic/design-system/icons';
|
|
11
14
|
import type { FileSystemItem } from '../../types';
|
|
12
15
|
import type { FileFilterType } from '../../utils/fileTypes';
|
|
13
16
|
import { persistentSelectStore } from '../../stores/persistentSelectStore';
|
|
14
17
|
import { createEventDispatcher } from 'svelte';
|
|
15
18
|
import { toast } from '@widgetic/design-system/components';
|
|
16
|
-
import { getFileIcon } from '../../utils/fileUtils';
|
|
17
|
-
import { getFileTypeOf } from '../../utils/fileKinds';
|
|
18
|
-
import { toSafeFontFamilyName } from '../../utils/safeText';
|
|
19
|
-
import { fade } from 'svelte/transition';
|
|
20
|
-
import { selectedFiles as storeSelectedFiles } from '../../stores/fileStore';
|
|
21
19
|
import { useMediaLibraryContext } from '../../mediaLibrary/context';
|
|
22
20
|
import { useI18n } from '../../i18n';
|
|
23
21
|
|
|
24
22
|
const { t } = useI18n();
|
|
25
|
-
|
|
26
|
-
// Which actions the media library allows. Everything, when the File Browser works from its own settings.
|
|
27
23
|
const { capabilities } = useMediaLibraryContext();
|
|
28
24
|
|
|
29
25
|
export let selectedFiles: FileSystemItem[] = [];
|
|
30
26
|
export let currentFilter: FileFilterType;
|
|
31
27
|
export let showAddToEditor = true;
|
|
32
|
-
/** Singular label for the primary confirm action (pluralized when count > 1). Left out, the File Browser's own ("Add to Editor", or the page's language's). */
|
|
33
28
|
export let addToEditorLabel: string | undefined = undefined;
|
|
29
|
+
// svelte-ignore export_let_unused
|
|
34
30
|
export let allowSelecting = false;
|
|
31
|
+
// svelte-ignore export_let_unused
|
|
35
32
|
export let filter: FileFilterType = 'all';
|
|
36
|
-
/** When true, toolbar uses icon-only / shorter labels (narrow file-browser panel). */
|
|
37
33
|
export let compact = false;
|
|
38
34
|
export let maxSelections: number | null = null;
|
|
39
35
|
export let activeFileId: string | null = null;
|
|
40
|
-
|
|
41
|
-
const dispatch = createEventDispatcher();
|
|
42
|
-
let isWideViewport = true;
|
|
43
|
-
let previousSelection = new Set<string>();
|
|
44
|
-
let newlyAddedId: string | null = null;
|
|
45
|
-
|
|
46
|
-
// Track changes to selection
|
|
47
|
-
$: {
|
|
48
|
-
const currentSelection = new Set(selectedFiles.map(f => f.id));
|
|
49
|
-
// Find the newly added ID (if any)
|
|
50
|
-
newlyAddedId = [...currentSelection].find(id => !previousSelection.has(id)) || null;
|
|
51
|
-
previousSelection = currentSelection;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Track loaded state for each image
|
|
55
|
-
let loadedImages = new Set<string>();
|
|
56
|
-
|
|
57
|
-
function handleImageLoad(id: string) {
|
|
58
|
-
loadedImages.add(id);
|
|
59
|
-
loadedImages = loadedImages; // trigger reactivity
|
|
60
|
-
}
|
|
61
36
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
// Function to get thumbnail or icon for a file
|
|
65
|
-
function getFilePreview(file: FileSystemItem): string {
|
|
66
|
-
const fileType = getFileTypeOf(file);
|
|
67
|
-
|
|
68
|
-
if (fileType === 'font') {
|
|
69
|
-
return 'font';
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (fileType === 'video' && file.url) {
|
|
73
|
-
// For video files, construct the thumbnail path by replacing the video extension with .png
|
|
74
|
-
return file.url.replace(/\.[^/.]+$/, '.png');
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if ((fileType === 'image' || fileType === 'svg') && file.url) {
|
|
78
|
-
return file.thumbnail || file.url;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return getFileIcon(file.name);
|
|
82
|
-
}
|
|
37
|
+
const dispatch = createEventDispatcher();
|
|
83
38
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
39
|
+
$: confirmAddLabel =
|
|
40
|
+
selectedFiles.length <= 1
|
|
41
|
+
? (addToEditorLabel ?? $t('action.addToEditor'))
|
|
42
|
+
: $t('selectedFiles.confirmMany', { count: selectedFiles.length });
|
|
43
|
+
$: confirmAddDisabled =
|
|
44
|
+
maxSelections === 1 &&
|
|
45
|
+
!!activeFileId &&
|
|
46
|
+
selectedFiles.length === 1 &&
|
|
47
|
+
selectedFiles[0].id === activeFileId;
|
|
48
|
+
$: isSingle = selectedFiles.length === 1;
|
|
49
|
+
$: summaryLabel = $t('selectedFiles.count', { count: selectedFiles.length });
|
|
87
50
|
|
|
88
51
|
function handleSendToEditor() {
|
|
89
|
-
// Get the selected files with their paths
|
|
90
|
-
const selectedFilesWithPaths = selectedFiles.map(file => ({
|
|
91
|
-
id: file.id,
|
|
92
|
-
path: [] // Path will be handled by the parent
|
|
93
|
-
}));
|
|
94
|
-
|
|
95
|
-
// Show sonar toast instead of alert
|
|
96
52
|
toast.success($t('toast.filesAdded'), {
|
|
97
53
|
description: $t('toast.filesAddedDetail', { count: selectedFiles.length })
|
|
98
54
|
});
|
|
99
|
-
|
|
100
|
-
// Clear selections and dispatch event
|
|
101
55
|
persistentSelectStore.clearSelections(currentFilter);
|
|
102
56
|
dispatch('send');
|
|
103
57
|
}
|
|
@@ -121,244 +75,115 @@
|
|
|
121
75
|
function handleDownload() {
|
|
122
76
|
const file = selectedFiles[0];
|
|
123
77
|
if (file.url) {
|
|
124
|
-
// noopener/noreferrer: the opened page gets no handle on this page (the file's host is not trusted).
|
|
125
78
|
window.open(file.url, '_blank', 'noopener,noreferrer');
|
|
126
79
|
}
|
|
127
80
|
}
|
|
128
|
-
|
|
129
|
-
// Update selected count reactively when filter changes
|
|
130
|
-
$: selectedItemsCount = allowSelecting ? persistentSelectStore.getSelected(filter).length : 0;
|
|
131
|
-
$: confirmAddLabel =
|
|
132
|
-
selectedFiles.length <= 1
|
|
133
|
-
? (addToEditorLabel ?? $t('action.addToEditor'))
|
|
134
|
-
: $t('selectedFiles.confirmMany', { count: selectedFiles.length });
|
|
135
|
-
$: confirmAddDisabled =
|
|
136
|
-
maxSelections === 1 &&
|
|
137
|
-
!!activeFileId &&
|
|
138
|
-
selectedFiles.length === 1 &&
|
|
139
|
-
selectedFiles[0].id === activeFileId;
|
|
140
81
|
</script>
|
|
141
82
|
|
|
142
|
-
<div
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
on:click={handlePreviewClick}
|
|
149
|
-
on:keydown={(e) => e.key === 'Enter' && handlePreviewClick()}
|
|
150
|
-
role="button"
|
|
151
|
-
tabindex="0"
|
|
152
|
-
>
|
|
153
|
-
<div class="relative h-6 flex items-center">
|
|
154
|
-
<div
|
|
155
|
-
class="w-6 h-6 rounded-[var(--radius-small)] border border-gray-200 bg-white overflow-hidden"
|
|
156
|
-
>
|
|
157
|
-
{#if getFilePreview(selectedFiles[0]) === 'font'}
|
|
158
|
-
<div class="w-6 h-6 flex items-center justify-center bg-gray-100">
|
|
159
|
-
<span style="font-family: '{toSafeFontFamilyName(selectedFiles[0].name)}', sans-serif;" class="text-xs text-gray-700">
|
|
160
|
-
aA
|
|
161
|
-
</span>
|
|
162
|
-
</div>
|
|
163
|
-
{:else}
|
|
164
|
-
<img
|
|
165
|
-
src={getFilePreview(selectedFiles[0])}
|
|
166
|
-
alt={selectedFiles[0].name}
|
|
167
|
-
class="w-6 h-6 object-cover"
|
|
168
|
-
class:opacity-0={selectedFiles[0].id === newlyAddedId}
|
|
169
|
-
style="transition: opacity 200ms ease-in"
|
|
170
|
-
on:load={(e) => {
|
|
171
|
-
const img = e.currentTarget as HTMLImageElement;
|
|
172
|
-
if (selectedFiles[0].id === newlyAddedId) {
|
|
173
|
-
setTimeout(() => {
|
|
174
|
-
img.style.opacity = '1';
|
|
175
|
-
}, 50);
|
|
176
|
-
} else {
|
|
177
|
-
img.style.opacity = '1';
|
|
178
|
-
}
|
|
179
|
-
}}
|
|
180
|
-
/>
|
|
181
|
-
{/if}
|
|
182
|
-
</div>
|
|
183
|
-
</div>
|
|
184
|
-
</div>
|
|
185
|
-
{/if}
|
|
83
|
+
<div
|
|
84
|
+
class="control-toolbar flex h-11 w-full min-w-0 items-center gap-1 rounded-xl bg-muted py-1.5 ps-3 pe-1.5"
|
|
85
|
+
>
|
|
86
|
+
<!-- Summary and clear (Figma: plain text, the "Selected files" dialog opens from the header button) -->
|
|
87
|
+
<div class="flex shrink-0 items-center gap-1">
|
|
88
|
+
<span class="text-body-medium text-foreground">{summaryLabel}</span>
|
|
186
89
|
|
|
187
|
-
|
|
188
|
-
<Button
|
|
189
|
-
variant="ghost"
|
|
190
|
-
size="sm"
|
|
191
|
-
class="text-[hsl(var(--grey5))] {compact ? 'text-xs px-1.5' : 'text-sm'} font-semibold flex items-center gap-1.5 [&_svg]:size-5 hover:text-[hsl(var(--grey7))] hover:bg-[hsl(var(--grey1))] transition-colors duration-200"
|
|
192
|
-
onclick={handleSendToEditor}
|
|
193
|
-
aria-label={confirmAddLabel}
|
|
194
|
-
disabled={confirmAddDisabled}
|
|
195
|
-
>
|
|
196
|
-
<IconCirclePlusFilled class="w-4 h-4 shrink-0" />
|
|
197
|
-
{confirmAddLabel}
|
|
198
|
-
</Button>
|
|
199
|
-
{/if}
|
|
200
|
-
{#if capabilities.rename}
|
|
201
|
-
<Button
|
|
90
|
+
<IconButton
|
|
202
91
|
variant="ghost"
|
|
203
|
-
size="
|
|
204
|
-
|
|
205
|
-
onclick={
|
|
206
|
-
aria-label={$t('action.rename')}
|
|
92
|
+
size="default"
|
|
93
|
+
label={$t('action.clearItems')}
|
|
94
|
+
onclick={handleClearItems}
|
|
207
95
|
>
|
|
208
|
-
<
|
|
209
|
-
|
|
210
|
-
|
|
96
|
+
<IconX class="size-4 stroke-[1.333]" aria-hidden="true" />
|
|
97
|
+
</IconButton>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div class="min-w-2 flex-1" aria-hidden="true"></div>
|
|
101
|
+
|
|
102
|
+
{#if isSingle}
|
|
103
|
+
{#if capabilities.rename}
|
|
104
|
+
{#if compact}
|
|
105
|
+
<IconButton variant="ghost" size="default" label={$t('action.rename')} onclick={handleRename}>
|
|
106
|
+
<IconPencil class="size-4 stroke-[1.333]" aria-hidden="true" />
|
|
107
|
+
</IconButton>
|
|
108
|
+
{:else}
|
|
109
|
+
<Button variant="ghost" size="sm" onclick={handleRename} aria-label={$t('action.rename')}>
|
|
110
|
+
<IconPencil class="size-4 shrink-0 stroke-[1.333]" aria-hidden="true" />
|
|
111
|
+
{$t('action.rename')}
|
|
112
|
+
</Button>
|
|
113
|
+
{/if}
|
|
211
114
|
{/if}
|
|
212
115
|
{#if capabilities.download}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
{/if}
|
|
224
|
-
{#if capabilities.folders}
|
|
225
|
-
<Button
|
|
226
|
-
variant="ghost"
|
|
227
|
-
size="sm"
|
|
228
|
-
class="text-[hsl(var(--grey5))] {compact ? 'text-xs px-1.5' : 'text-sm'} font-semibold flex items-center gap-1.5 [&_svg]:size-5 hover:text-[hsl(var(--grey7))] hover:bg-[hsl(var(--grey1))] transition-colors duration-200"
|
|
229
|
-
onclick={handleMove}
|
|
230
|
-
aria-label={$t('action.move')}
|
|
231
|
-
>
|
|
232
|
-
<IconArrowBounce class="w-4 h-4 shrink-0 rtl:-scale-x-100" />
|
|
233
|
-
{#if !compact}{$t('action.move')}{/if}
|
|
234
|
-
</Button>
|
|
116
|
+
{#if compact}
|
|
117
|
+
<IconButton variant="ghost" size="default" label={$t('action.download')} onclick={handleDownload}>
|
|
118
|
+
<IconDownload class="size-4 stroke-[1.333]" aria-hidden="true" />
|
|
119
|
+
</IconButton>
|
|
120
|
+
{:else}
|
|
121
|
+
<Button variant="ghost" size="sm" onclick={handleDownload} aria-label={$t('action.download')}>
|
|
122
|
+
<IconDownload class="size-4 shrink-0 stroke-[1.333]" aria-hidden="true" />
|
|
123
|
+
{$t('action.download')}
|
|
124
|
+
</Button>
|
|
125
|
+
{/if}
|
|
235
126
|
{/if}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
on:keydown={(e) => e.key === 'Enter' && handlePreviewClick()}
|
|
255
|
-
role="button"
|
|
256
|
-
tabindex="0"
|
|
127
|
+
{/if}
|
|
128
|
+
|
|
129
|
+
{#if capabilities.folders}
|
|
130
|
+
{#if compact}
|
|
131
|
+
<IconButton
|
|
132
|
+
variant="ghost"
|
|
133
|
+
size="default"
|
|
134
|
+
label={isSingle ? $t('action.move') : $t('toolbar.moveMany', { count: selectedFiles.length })}
|
|
135
|
+
onclick={handleMove}
|
|
136
|
+
>
|
|
137
|
+
<IconArrowsMove class="size-4 stroke-[1.333]" aria-hidden="true" />
|
|
138
|
+
</IconButton>
|
|
139
|
+
{:else}
|
|
140
|
+
<Button
|
|
141
|
+
variant="ghost"
|
|
142
|
+
size="sm"
|
|
143
|
+
onclick={handleMove}
|
|
144
|
+
aria-label={isSingle ? $t('action.move') : $t('toolbar.moveMany', { count: selectedFiles.length })}
|
|
257
145
|
>
|
|
258
|
-
<
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
<div
|
|
262
|
-
class="w-6 h-6 rounded-[var(--radius-small)] border border-gray-200 bg-white overflow-hidden absolute widgetic-radius"
|
|
263
|
-
style="inset-inline-start: {i * 12}px; z-index: {2 - i};"
|
|
264
|
-
>
|
|
265
|
-
{#if getFilePreview(file) === 'font'}
|
|
266
|
-
<div class="w-6 h-6 flex items-center justify-center bg-gray-100">
|
|
267
|
-
<span style="font-family: '{toSafeFontFamilyName(file.name)}', sans-serif;" class="text-xs text-gray-700">
|
|
268
|
-
aA
|
|
269
|
-
</span>
|
|
270
|
-
</div>
|
|
271
|
-
{:else}
|
|
272
|
-
<img
|
|
273
|
-
src={getFilePreview(file)}
|
|
274
|
-
alt={file.name}
|
|
275
|
-
class="w-6 h-6 object-cover"
|
|
276
|
-
class:opacity-0={file.id === newlyAddedId}
|
|
277
|
-
style="transition: opacity 200ms ease-in"
|
|
278
|
-
on:load={(e) => {
|
|
279
|
-
const img = e.currentTarget as HTMLImageElement;
|
|
280
|
-
if (file.id === newlyAddedId) {
|
|
281
|
-
setTimeout(() => {
|
|
282
|
-
img.style.opacity = '1';
|
|
283
|
-
}, 50);
|
|
284
|
-
} else {
|
|
285
|
-
img.style.opacity = '1';
|
|
286
|
-
}
|
|
287
|
-
}}
|
|
288
|
-
/>
|
|
289
|
-
{/if}
|
|
290
|
-
</div>
|
|
291
|
-
{/each}
|
|
292
|
-
{#if selectedFiles.length > 2}
|
|
293
|
-
<div class="ms-[32px] ps-2 caption text-[hsl(var(--grey5))] widgetic-colors group-hover:text-[hsl(var(--grey7))] transition-colors duration-200">
|
|
294
|
-
{$t('toolbar.more', { count: selectedFiles.length - 2 })}
|
|
295
|
-
</div>
|
|
296
|
-
{:else if selectedFiles.length === 2}
|
|
297
|
-
<div class="w-[32px]"></div>
|
|
298
|
-
{/if}
|
|
299
|
-
{/if}
|
|
300
|
-
</div>
|
|
301
|
-
</div>
|
|
146
|
+
<IconArrowsMove class="size-4 shrink-0 stroke-[1.333] rtl:-scale-x-100" aria-hidden="true" />
|
|
147
|
+
{isSingle ? $t('action.move') : $t('toolbar.moveMany', { count: selectedFiles.length })}
|
|
148
|
+
</Button>
|
|
302
149
|
{/if}
|
|
150
|
+
{/if}
|
|
303
151
|
|
|
304
|
-
|
|
305
|
-
|
|
152
|
+
{#if capabilities.delete}
|
|
153
|
+
{#if compact}
|
|
154
|
+
<IconButton
|
|
155
|
+
variant="ghost"
|
|
156
|
+
size="default"
|
|
157
|
+
label={isSingle ? $t('action.delete') : $t('toolbar.deleteMany', { count: selectedFiles.length })}
|
|
158
|
+
onclick={handleDelete}
|
|
159
|
+
class="text-destructive hover:text-destructive"
|
|
160
|
+
>
|
|
161
|
+
<IconTrash class="size-4 stroke-[1.333]" aria-hidden="true" />
|
|
162
|
+
</IconButton>
|
|
163
|
+
{:else}
|
|
164
|
+
<Button
|
|
306
165
|
variant="ghost"
|
|
307
166
|
size="sm"
|
|
308
|
-
class="text-
|
|
309
|
-
onclick={
|
|
310
|
-
aria-label={
|
|
311
|
-
disabled={confirmAddDisabled}
|
|
167
|
+
class="text-destructive hover:bg-destructive/10 hover:text-destructive"
|
|
168
|
+
onclick={handleDelete}
|
|
169
|
+
aria-label={isSingle ? $t('action.delete') : $t('toolbar.deleteMany', { count: selectedFiles.length })}
|
|
312
170
|
>
|
|
313
|
-
<
|
|
314
|
-
{
|
|
171
|
+
<IconTrash class="size-4 shrink-0 stroke-[1.333]" aria-hidden="true" />
|
|
172
|
+
{isSingle ? $t('action.delete') : $t('toolbar.deleteMany', { count: selectedFiles.length })}
|
|
315
173
|
</Button>
|
|
316
174
|
{/if}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
onclick={handleMove}
|
|
323
|
-
>
|
|
324
|
-
<IconArrowBounce class="w-4 h-4 rtl:-scale-x-100" />
|
|
325
|
-
{$t('toolbar.moveMany', { count: selectedFiles.length })}
|
|
326
|
-
</Button>
|
|
327
|
-
{/if}
|
|
328
|
-
{#if capabilities.delete}
|
|
329
|
-
<Button
|
|
330
|
-
variant="ghost"
|
|
331
|
-
size="sm"
|
|
332
|
-
class="text-[hsl(var(--grey5))] h6 flex items-center gap-2 [&_svg]:size-5 widgetic-colors hover:text-[hsl(var(--grey7))] hover:bg-[hsl(var(--grey1))] transition-colors duration-200"
|
|
333
|
-
onclick={handleDelete}
|
|
334
|
-
>
|
|
335
|
-
<IconTrash class="w-4 h-4" />
|
|
336
|
-
{$t('toolbar.deleteMany', { count: selectedFiles.length })}
|
|
337
|
-
</Button>
|
|
338
|
-
{/if}
|
|
339
|
-
<Button
|
|
340
|
-
variant="ghost"
|
|
175
|
+
{/if}
|
|
176
|
+
|
|
177
|
+
{#if showAddToEditor}
|
|
178
|
+
<Button
|
|
179
|
+
variant="default"
|
|
341
180
|
size="sm"
|
|
342
|
-
|
|
343
|
-
|
|
181
|
+
onclick={handleSendToEditor}
|
|
182
|
+
aria-label={confirmAddLabel}
|
|
183
|
+
disabled={confirmAddDisabled}
|
|
344
184
|
>
|
|
345
|
-
<
|
|
346
|
-
{
|
|
185
|
+
<IconCheck class="size-4 shrink-0 stroke-[1.333]" aria-hidden="true" />
|
|
186
|
+
{confirmAddLabel}
|
|
347
187
|
</Button>
|
|
348
188
|
{/if}
|
|
349
|
-
</div>
|
|
350
|
-
|
|
351
|
-
<style>
|
|
352
|
-
/* Remove focus outline and ring from buttons */
|
|
353
|
-
:global(.control-toolbar button) {
|
|
354
|
-
outline: none !important;
|
|
355
|
-
--tw-ring-offset-width: 0 !important;
|
|
356
|
-
--tw-ring-width: 0 !important;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
:global(.control-toolbar button:focus-visible) {
|
|
360
|
-
outline: none !important;
|
|
361
|
-
--tw-ring-offset-width: 0 !important;
|
|
362
|
-
--tw-ring-width: 0 !important;
|
|
363
|
-
}
|
|
364
|
-
</style>
|
|
189
|
+
</div>
|
|
@@ -17,14 +17,13 @@ declare const ControlToolbar: $$__sveltets_2_IsomorphicComponent<{
|
|
|
17
17
|
selectedFiles?: FileSystemItem[];
|
|
18
18
|
currentFilter: FileFilterType;
|
|
19
19
|
showAddToEditor?: boolean;
|
|
20
|
-
|
|
20
|
+
addToEditorLabel?: string | undefined;
|
|
21
21
|
allowSelecting?: boolean;
|
|
22
22
|
filter?: FileFilterType;
|
|
23
|
-
|
|
23
|
+
compact?: boolean;
|
|
24
24
|
maxSelections?: number | null;
|
|
25
25
|
activeFileId?: string | null;
|
|
26
26
|
}, {
|
|
27
|
-
toggleSelectedFiles: CustomEvent<any>;
|
|
28
27
|
send: CustomEvent<any>;
|
|
29
28
|
move: CustomEvent<any>;
|
|
30
29
|
delete: CustomEvent<any>;
|