@arbidocs/blocks 0.4.154 → 0.4.155

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/chunk-6HMCF4AJ.js +1720 -0
  2. package/dist/chunk-6HMCF4AJ.js.map +1 -0
  3. package/dist/{chunk-BDA3RHYD.cjs → chunk-MUDEL7UL.cjs} +25 -884
  4. package/dist/chunk-MUDEL7UL.cjs.map +1 -0
  5. package/dist/{chunk-RE7NULEY.js → chunk-W7CWGURO.js} +28 -873
  6. package/dist/chunk-W7CWGURO.js.map +1 -0
  7. package/dist/chunk-WV4TD2HZ.cjs +1785 -0
  8. package/dist/chunk-WV4TD2HZ.cjs.map +1 -0
  9. package/dist/connect/index.cjs +1178 -16
  10. package/dist/connect/index.cjs.map +1 -1
  11. package/dist/connect/index.d.ts +1 -0
  12. package/dist/connect/index.js +1160 -12
  13. package/dist/connect/index.js.map +1 -1
  14. package/dist/connect/viewer.cjs +40 -44
  15. package/dist/connect/viewer.cjs.map +1 -1
  16. package/dist/connect/viewer.js +2 -6
  17. package/dist/connect/viewer.js.map +1 -1
  18. package/dist/connection/files/DocumentSyncGlyph.d.ts +28 -0
  19. package/dist/connection/files/explorer/ConnectedFilesExplorer.d.ts +56 -0
  20. package/dist/connection/files/explorer/FileTiles.d.ts +87 -0
  21. package/dist/connection/files/index.d.ts +5 -0
  22. package/dist/connection/files/store.d.ts +27 -0
  23. package/dist/connection/files/support.d.ts +38 -0
  24. package/dist/files/DocStatusIcon.d.ts +5 -4
  25. package/dist/files/FailedStageIcon.d.ts +26 -0
  26. package/dist/files/folders/FolderProviderIcon.d.ts +29 -0
  27. package/dist/files/folders/folderPaths.d.ts +86 -0
  28. package/dist/files/folders/index.d.ts +2 -0
  29. package/dist/files/index.cjs +326 -238
  30. package/dist/files/index.d.ts +5 -0
  31. package/dist/files/index.js +2 -2
  32. package/dist/files/permissions.d.ts +28 -0
  33. package/dist/files/recently-deleted.d.ts +7 -0
  34. package/dist/files/visibility.d.ts +31 -0
  35. package/dist/index.cjs +38 -38
  36. package/dist/index.js +2 -2
  37. package/node_modules/@arbidocs/coedit/package.json +1 -1
  38. package/package.json +6 -5
  39. package/dist/chunk-BDA3RHYD.cjs.map +0 -1
  40. package/dist/chunk-JGOST4IL.js +0 -648
  41. package/dist/chunk-JGOST4IL.js.map +0 -1
  42. package/dist/chunk-RE7NULEY.js.map +0 -1
  43. package/dist/chunk-YAEXSCUW.cjs +0 -677
  44. package/dist/chunk-YAEXSCUW.cjs.map +0 -1
@@ -1,648 +0,0 @@
1
- "use client";
2
- import { LabelPickerList, DEFAULT_LABEL_MULTI_SELECT_LABELS } from './chunk-SDOEHEJP.js';
3
- import { testIdOr } from './chunk-7F6CBP3Z.js';
4
- import { BookMarked, ListChevronsUpDown, FolderOpen, ChevronsUpDown, Check, Minus, Plus, X, ChevronDown, FolderPlus } from 'lucide-react';
5
- import { cn, Button, Tooltip, TooltipTrigger, Slider, TooltipContent, Popover, PopoverTrigger, PopoverContent, Command, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem } from '@arbidocs/react/ui';
6
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
- import { useMemo, useState, useRef, useEffect, useCallback } from 'react';
8
-
9
- function FilesFilterBar({ className, ...props }) {
10
- return /* @__PURE__ */ jsx(
11
- "div",
12
- {
13
- "data-slot": "files-filter-bar",
14
- className: cn("flex min-w-0 flex-1 flex-nowrap items-center gap-2", className),
15
- ...props
16
- }
17
- );
18
- }
19
- function FilesTagsButton({
20
- onClick,
21
- label = "Tags",
22
- className,
23
- testId
24
- }) {
25
- return /* @__PURE__ */ jsxs(
26
- Button,
27
- {
28
- variant: "ghost",
29
- size: "sm",
30
- className: cn("h-8 shrink-0 gap-1.5 px-2 font-normal pointer-coarse:h-11", className),
31
- onClick,
32
- "data-testid": testIdOr(testId, { testId: "filter-bar-tags-button" }),
33
- children: [
34
- /* @__PURE__ */ jsx(BookMarked, { className: "h-3.5 w-3.5" }),
35
- /* @__PURE__ */ jsx("span", { className: "text-sm max-[480px]:sr-only", children: label })
36
- ]
37
- }
38
- );
39
- }
40
- function FilesViewCenter({ className, ...props }) {
41
- return /* @__PURE__ */ jsx(
42
- "div",
43
- {
44
- "data-slot": "files-view-center",
45
- className: cn("@container flex min-w-[9.5rem] flex-1 items-center gap-2", className),
46
- ...props
47
- }
48
- );
49
- }
50
- function FilesModalFooter({ children, className }) {
51
- return /* @__PURE__ */ jsx(
52
- "div",
53
- {
54
- "data-slot": "files-modal-footer",
55
- className: cn(
56
- // Sticks to the bottom of the modal's scrolling body so Close is always reachable.
57
- "sticky bottom-0 z-40 flex justify-end gap-2 border-t border-border bg-background px-4 py-3 sm:px-6",
58
- className
59
- ),
60
- children
61
- }
62
- );
63
- }
64
-
65
- // src/files/grid/row-density.ts
66
- var LINE_PX = 14 * 1.35;
67
- var CHROME = 18;
68
- var MIN_LINES = 1;
69
- var MAX_LINES = 10;
70
- var rowHeightForLines = (lines) => Math.ceil(lines * LINE_PX + CHROME);
71
- var linesForRowHeight = (height) => Math.max(MIN_LINES, Math.min(MAX_LINES, Math.floor((height - CHROME) / LINE_PX)));
72
- var ROW_MIN = rowHeightForLines(MIN_LINES);
73
- function RowDensityControl({
74
- rowHeight,
75
- onRowHeightChange,
76
- testId = "documents-density"
77
- }) {
78
- const lines = linesForRowHeight(rowHeight);
79
- const setLines = (next) => onRowHeightChange(rowHeightForLines(Math.max(MIN_LINES, Math.min(MAX_LINES, next))));
80
- return /* @__PURE__ */ jsxs(Tooltip, { delayDuration: 300, children: [
81
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "flex h-7 items-center gap-1.5 rounded-md border border-input px-2 pointer-coarse:h-11", children: [
82
- /* @__PURE__ */ jsx("span", { className: "hidden text-xs text-muted-foreground md:inline", children: "Rows" }),
83
- /* @__PURE__ */ jsx(
84
- "button",
85
- {
86
- type: "button",
87
- "aria-label": "Shorter rows",
88
- "data-testid": `${testId}-out`,
89
- onClick: () => setLines(lines - 1),
90
- disabled: lines <= MIN_LINES,
91
- className: "flex items-center justify-center text-muted-foreground hover:text-foreground disabled:opacity-40 pointer-coarse:size-11",
92
- children: /* @__PURE__ */ jsx(ListChevronsUpDown, { className: "h-4 w-4" })
93
- }
94
- ),
95
- /* @__PURE__ */ jsx(
96
- Slider,
97
- {
98
- value: [lines],
99
- min: MIN_LINES,
100
- max: MAX_LINES,
101
- step: 1,
102
- onValueChange: ([value]) => setLines(value),
103
- "aria-label": "Row height",
104
- "data-testid": testId,
105
- className: "w-20"
106
- }
107
- )
108
- ] }) }),
109
- /* @__PURE__ */ jsxs(TooltipContent, { children: [
110
- "Row height: ",
111
- lines,
112
- " line",
113
- lines === 1 ? "" : "s"
114
- ] })
115
- ] });
116
- }
117
- function FolderBreadcrumb({
118
- segments,
119
- size = "xs"
120
- }) {
121
- const text = size === "sm" ? "text-sm" : "text-xs";
122
- return /* @__PURE__ */ jsx("span", { "data-slot": "folder-breadcrumb", className: "min-w-0 truncate", children: segments.map((part, i, arr) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
123
- i > 0 && /* @__PURE__ */ jsx("span", { className: `mx-0.5 ${text} text-muted-foreground/50`, children: "/" }),
124
- /* @__PURE__ */ jsx("span", { className: i < arr.length - 1 ? `${text} text-muted-foreground` : "", children: part })
125
- ] }, i)) });
126
- }
127
- function FolderCell({
128
- folder,
129
- segments,
130
- icon,
131
- isEditable,
132
- picker,
133
- className
134
- }) {
135
- const display = folder ? /* @__PURE__ */ jsxs(Fragment, { children: [
136
- icon ?? /* @__PURE__ */ jsx(FolderOpen, { className: "h-3.5 w-3.5 flex-none shrink-0 text-muted-foreground" }),
137
- /* @__PURE__ */ jsx(FolderBreadcrumb, { segments })
138
- ] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u2014" });
139
- const title = folder || void 0;
140
- if (!isEditable) {
141
- return /* @__PURE__ */ jsx(
142
- "div",
143
- {
144
- "data-slot": "folder-cell",
145
- title,
146
- className: cn("flex h-full w-full min-w-0 items-center gap-1.5 text-sm", className),
147
- children: display
148
- }
149
- );
150
- }
151
- return /* @__PURE__ */ jsxs(Popover, { children: [
152
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
153
- "button",
154
- {
155
- type: "button",
156
- "data-slot": "folder-cell",
157
- title,
158
- className: cn(
159
- "flex h-full w-full min-w-0 cursor-pointer items-center gap-1.5 text-left text-sm hover:text-primary",
160
- className
161
- ),
162
- children: display
163
- }
164
- ) }),
165
- /* @__PURE__ */ jsx(
166
- PopoverContent,
167
- {
168
- className: "w-max min-w-[220px] max-w-[min(640px,92vw)] p-0",
169
- align: "start",
170
- side: "bottom",
171
- sideOffset: 4,
172
- children: picker
173
- }
174
- )
175
- ] });
176
- }
177
- var FIELD_SURFACE = "rounded-md border border-input bg-muted/40 text-sm transition-colors hover:bg-background";
178
- function FieldValue({ tone = "default", isMono, isTruncated, children }) {
179
- return /* @__PURE__ */ jsx(
180
- "span",
181
- {
182
- "data-slot": "field-value",
183
- className: cn(
184
- "text-sm",
185
- tone === "strong" && "font-semibold",
186
- tone === "muted" && "text-muted-foreground",
187
- isMono && "font-mono",
188
- isTruncated && "truncate"
189
- ),
190
- children
191
- }
192
- );
193
- }
194
- function FieldFolderSelect({ folder, picker }) {
195
- return /* @__PURE__ */ jsxs(Popover, { children: [
196
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
197
- "button",
198
- {
199
- type: "button",
200
- "data-slot": "field-folder-select",
201
- className: cn(
202
- FIELD_SURFACE,
203
- "flex h-9 w-full min-w-0 items-center gap-1.5 px-3 text-left hover:text-primary pointer-coarse:h-11"
204
- ),
205
- children: [
206
- folder ? /* @__PURE__ */ jsxs(Fragment, { children: [
207
- /* @__PURE__ */ jsx(FolderOpen, { className: "size-3.5 flex-none shrink-0 text-yellow-600" }),
208
- /* @__PURE__ */ jsx(FolderBreadcrumb, { segments: folder.split("/"), size: "sm" })
209
- ] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u2014" }),
210
- /* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-auto size-3.5 shrink-0 opacity-50" })
211
- ]
212
- }
213
- ) }),
214
- /* @__PURE__ */ jsx(
215
- PopoverContent,
216
- {
217
- className: "w-max min-w-[var(--radix-popover-trigger-width)] max-w-[min(640px,92vw)] p-0",
218
- align: "start",
219
- side: "bottom",
220
- sideOffset: 4,
221
- children: picker
222
- }
223
- )
224
- ] });
225
- }
226
- function FieldFolderValue({ folder }) {
227
- return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1.5 text-sm", children: folder ? /* @__PURE__ */ jsxs(Fragment, { children: [
228
- /* @__PURE__ */ jsx(FolderOpen, { className: "size-3.5 shrink-0 text-yellow-600" }),
229
- /* @__PURE__ */ jsx("span", { children: folder })
230
- ] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\u2014" }) });
231
- }
232
- function FieldLabelsSelect({
233
- options,
234
- appliedIds,
235
- displayedIds = appliedIds,
236
- onToggle,
237
- onCreate,
238
- emptyText = "Click to add",
239
- labels
240
- }) {
241
- const applied = useMemo(
242
- () => options.filter((o) => displayedIds.has(o.id)),
243
- [options, displayedIds]
244
- );
245
- return /* @__PURE__ */ jsxs(Popover, { children: [
246
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
247
- "button",
248
- {
249
- type: "button",
250
- "data-slot": "field-labels-select",
251
- className: cn(
252
- FIELD_SURFACE,
253
- "flex min-h-9 w-full cursor-pointer items-center px-3 py-1.5 text-left pointer-coarse:min-h-11"
254
- ),
255
- children: /* @__PURE__ */ jsxs("div", { className: "flex min-h-[28px] flex-wrap items-center gap-1.5", children: [
256
- applied.length === 0 && /* @__PURE__ */ jsx("span", { className: "text-sm italic text-muted-foreground", children: emptyText }),
257
- applied.map((o) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-sm font-medium", children: [
258
- /* @__PURE__ */ jsx(
259
- "span",
260
- {
261
- className: "flex size-4 shrink-0 items-center justify-center rounded border-2",
262
- style: { borderColor: o.color, backgroundColor: o.color },
263
- children: /* @__PURE__ */ jsx(Check, { className: "size-3 text-white", strokeWidth: 3 })
264
- }
265
- ),
266
- /* @__PURE__ */ jsx("span", { className: "max-w-[280px] truncate", children: o.name })
267
- ] }, o.id))
268
- ] })
269
- }
270
- ) }),
271
- /* @__PURE__ */ jsx(PopoverContent, { className: "w-[360px] p-0", align: "start", side: "bottom", sideOffset: 4, children: /* @__PURE__ */ jsx(
272
- LabelPickerList,
273
- {
274
- options,
275
- appliedIds,
276
- onToggle,
277
- onCreate,
278
- labels: { ...DEFAULT_LABEL_MULTI_SELECT_LABELS, ...labels }
279
- }
280
- ) })
281
- ] });
282
- }
283
- function FieldNativeSelect({
284
- value,
285
- options,
286
- onChange,
287
- emptyLabel = "--",
288
- ariaLabel
289
- }) {
290
- return /* @__PURE__ */ jsxs(
291
- "select",
292
- {
293
- value,
294
- "aria-label": ariaLabel,
295
- onChange: (e) => onChange(e.target.value),
296
- className: "h-9 w-full rounded-md border border-input bg-muted/40 px-3 text-sm transition-colors focus:bg-background focus:outline-none focus:ring-1 focus:ring-ring pointer-coarse:h-11",
297
- children: [
298
- /* @__PURE__ */ jsx("option", { value: "", children: emptyLabel }),
299
- options.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt))
300
- ]
301
- }
302
- );
303
- }
304
- function FieldAttribution({ avatar, date, lines }) {
305
- return /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1", "data-slot": "field-attribution", children: /* @__PURE__ */ jsxs(Tooltip, { children: [
306
- /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
307
- avatar,
308
- /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: date })
309
- ] }) }),
310
- /* @__PURE__ */ jsx(TooltipContent, { side: "bottom", children: lines.map((line, i) => /* @__PURE__ */ jsx("p", { className: "text-sm", children: line }, i)) })
311
- ] }) });
312
- }
313
- function FieldWithAttribution({
314
- attribution,
315
- children
316
- }) {
317
- return /* @__PURE__ */ jsxs("div", { className: "group/doctag relative", "data-slot": "field-with-attribution", children: [
318
- children,
319
- /* @__PURE__ */ jsx("div", { className: "absolute right-0 top-0 bg-background/90 pl-2 opacity-0 transition-opacity group-focus-within/doctag:opacity-100 group-hover/doctag:opacity-100 pointer-coarse:opacity-100", children: attribution })
320
- ] });
321
- }
322
- var FilterButton = ({ params, colId }) => {
323
- const [isFilterActive, setIsFilterActive] = useState(false);
324
- const btnRef = useRef(null);
325
- useEffect(() => {
326
- const check = () => setIsFilterActive(!!params.api.getFilterModel()[colId]);
327
- check();
328
- params.api.addEventListener("filterChanged", check);
329
- return () => {
330
- if (!params.api.isDestroyed()) params.api.removeEventListener("filterChanged", check);
331
- };
332
- }, [params.api, colId]);
333
- return /* @__PURE__ */ jsx(
334
- "span",
335
- {
336
- ref: btnRef,
337
- role: "button",
338
- "aria-label": "Filter",
339
- onClick: (e) => {
340
- e.stopPropagation();
341
- if (btnRef.current) params.showFilter(btnRef.current);
342
- },
343
- className: `ag-header-icon ag-header-cell-filter-button ag-header-label-icon ${isFilterActive ? "ag-filter-active" : ""}`,
344
- "aria-hidden": "false",
345
- children: /* @__PURE__ */ jsx("span", { className: "ag-icon ag-icon-filter" })
346
- }
347
- );
348
- };
349
- var DEFAULT_FOLDER_PICKER_LABELS = {
350
- none: "None",
351
- removeFromFolder: "Remove from folder",
352
- searchOrCreate: "Search or create...",
353
- noFolders: "No folders yet",
354
- create: (name) => `Create \u201C${name}\u201D`
355
- };
356
- function FolderPickerRow({
357
- label,
358
- icon,
359
- count,
360
- depth,
361
- isActive,
362
- muted,
363
- checkbox,
364
- indeterminate,
365
- testId,
366
- onClick
367
- }) {
368
- return /* @__PURE__ */ jsxs(
369
- "button",
370
- {
371
- type: "button",
372
- "data-testid": testId,
373
- onClick,
374
- role: checkbox ? "checkbox" : void 0,
375
- "aria-checked": checkbox ? indeterminate ? "mixed" : isActive : void 0,
376
- style: { paddingLeft: `${4 + depth * 14}px` },
377
- className: cn(
378
- // `[&:hover]:`, not `hover:`: the latter compiles behind `@media (hover: hover)`, so on a
379
- // touchscreen whose PRIMARY pointer reports `hover: none` the row would never highlight
380
- // even with a real mouse attached. The arbitrary selector has no media gate.
381
- "flex w-full items-center gap-1 rounded-sm py-1 pr-2 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&:hover]:bg-accent pointer-coarse:min-h-11",
382
- isActive && "bg-primary/10",
383
- muted && !isActive && "text-muted-foreground"
384
- ),
385
- children: [
386
- /* @__PURE__ */ jsx("span", { className: "flex w-4 shrink-0 items-center justify-center", children: checkbox ? /* @__PURE__ */ jsx(
387
- "span",
388
- {
389
- className: cn(
390
- "flex size-3.5 items-center justify-center rounded-[3px] border transition-colors",
391
- isActive || indeterminate ? "border-primary bg-primary text-primary-foreground" : "border-muted-foreground/40"
392
- ),
393
- children: indeterminate ? /* @__PURE__ */ jsx(Minus, { className: "size-2.5" }) : isActive && /* @__PURE__ */ jsx(Check, { className: "size-2.5" })
394
- }
395
- ) : isActive && /* @__PURE__ */ jsx(Check, { className: "size-3.5 text-primary" }) }),
396
- icon,
397
- label !== "" && /* @__PURE__ */ jsx("span", { className: cn("min-w-0 truncate", isActive && "font-semibold text-primary"), children: label }),
398
- count !== void 0 && /* @__PURE__ */ jsx("span", { className: "ml-auto pl-2 text-sm font-semibold text-muted-foreground", children: count })
399
- ]
400
- }
401
- );
402
- }
403
- function FolderTree({
404
- nodes,
405
- unfiledCount,
406
- value,
407
- onChange,
408
- showUnfiledAlways,
409
- labels
410
- }) {
411
- const l = { ...DEFAULT_FOLDER_PICKER_LABELS, ...labels };
412
- return /* @__PURE__ */ jsxs("div", { className: "max-h-[240px] overflow-y-auto", children: [
413
- nodes.map((node) => /* @__PURE__ */ jsx(
414
- FolderPickerRow,
415
- {
416
- label: node.label,
417
- icon: node.icon,
418
- count: node.count,
419
- depth: node.depth,
420
- isActive: value === node.path,
421
- onClick: () => onChange(node.path)
422
- },
423
- node.path
424
- )),
425
- (unfiledCount > 0 || showUnfiledAlways) && /* @__PURE__ */ jsxs(Fragment, { children: [
426
- nodes.length > 0 && /* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
427
- /* @__PURE__ */ jsx(
428
- FolderPickerRow,
429
- {
430
- label: l.none,
431
- count: unfiledCount,
432
- depth: 0,
433
- isActive: value === null,
434
- muted: true,
435
- onClick: () => onChange(null)
436
- }
437
- )
438
- ] })
439
- ] });
440
- }
441
- function FolderBreadcrumb2({ folder }) {
442
- const parts = folder.split("/");
443
- return /* @__PURE__ */ jsx("span", { className: "whitespace-nowrap", children: parts.map((part, i) => /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-0.5", children: [
444
- i > 0 && /* @__PURE__ */ jsx("span", { className: "mx-0.5 text-sm text-muted-foreground/50", children: "/" }),
445
- /* @__PURE__ */ jsx("span", { className: i < parts.length - 1 ? "text-sm text-muted-foreground" : "", children: part })
446
- ] }, i)) });
447
- }
448
- function FolderCommandList({
449
- folders,
450
- value,
451
- onSelect,
452
- showRemove = false,
453
- removeLabel,
454
- placeholder,
455
- autoFocus = true,
456
- labels,
457
- testIds
458
- }) {
459
- const l = { ...DEFAULT_FOLDER_PICKER_LABELS, ...labels };
460
- const [search, setSearch] = useState("");
461
- const trimmed = search.trim();
462
- const matchesExisting = folders.some((f) => f.toLowerCase() === trimmed.toLowerCase());
463
- const handleCreate = useCallback(
464
- (name) => {
465
- const next = name.trim();
466
- if (!next) return;
467
- onSelect(next);
468
- setSearch("");
469
- },
470
- [onSelect]
471
- );
472
- return /* @__PURE__ */ jsxs(Command, { shouldFilter: true, children: [
473
- /* @__PURE__ */ jsx(
474
- CommandInput,
475
- {
476
- placeholder: placeholder ?? l.searchOrCreate,
477
- value: search,
478
- onValueChange: setSearch,
479
- autoFocus,
480
- onKeyDown: (e) => {
481
- if (e.key === "Enter" && trimmed && !matchesExisting) {
482
- e.preventDefault();
483
- handleCreate(search);
484
- }
485
- }
486
- }
487
- ),
488
- /* @__PURE__ */ jsxs(CommandList, { children: [
489
- /* @__PURE__ */ jsx(CommandEmpty, { children: trimmed ? /* @__PURE__ */ jsxs(
490
- "button",
491
- {
492
- type: "button",
493
- "data-testid": testIdOr(testIds?.create, { testId: "folder-picker-create" }),
494
- onClick: () => handleCreate(search),
495
- onPointerDown: (e) => e.preventDefault(),
496
- className: "flex w-full cursor-pointer items-center gap-1.5 rounded px-2 py-1.5 text-left text-sm text-primary hover:bg-accent pointer-coarse:min-h-11",
497
- children: [
498
- /* @__PURE__ */ jsx(Plus, { className: "size-3.5 shrink-0" }),
499
- l.create(trimmed)
500
- ]
501
- }
502
- ) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: l.noFolders }) }),
503
- /* @__PURE__ */ jsx(CommandGroup, { children: folders.map((folder) => /* @__PURE__ */ jsxs(
504
- CommandItem,
505
- {
506
- value: folder,
507
- "data-testid": testIdOr(testIds?.option?.(folder), {
508
- testId: `folder-picker-option-${folder}`
509
- }),
510
- onSelect: () => onSelect(folder),
511
- onPointerDown: (e) => e.preventDefault(),
512
- className: "cursor-pointer text-sm",
513
- children: [
514
- /* @__PURE__ */ jsx(FolderOpen, { className: "mr-1.5 size-3.5 flex-none shrink-0 text-yellow-text" }),
515
- /* @__PURE__ */ jsx(FolderBreadcrumb2, { folder }),
516
- value === folder && /* @__PURE__ */ jsx("span", { className: "ml-auto flex-none text-sm text-primary", children: "\u2713" })
517
- ]
518
- },
519
- folder
520
- )) }),
521
- trimmed && !matchesExisting && folders.length > 0 && /* @__PURE__ */ jsx(CommandGroup, { children: /* @__PURE__ */ jsxs(
522
- CommandItem,
523
- {
524
- value: `__create__${trimmed}`,
525
- "data-testid": testIdOr(testIds?.createOption, {
526
- testId: "folder-picker-create-option"
527
- }),
528
- onSelect: () => handleCreate(search),
529
- onPointerDown: (e) => e.preventDefault(),
530
- className: "cursor-pointer text-sm text-primary",
531
- children: [
532
- /* @__PURE__ */ jsx(Plus, { className: "mr-1.5 size-3.5 shrink-0" }),
533
- /* @__PURE__ */ jsx("span", { children: l.create(trimmed) })
534
- ]
535
- }
536
- ) }),
537
- showRemove && /* @__PURE__ */ jsx(CommandGroup, { children: /* @__PURE__ */ jsxs(
538
- CommandItem,
539
- {
540
- value: "__none__",
541
- "data-testid": testIdOr(testIds?.remove, { testId: "folder-picker-remove" }),
542
- onSelect: () => onSelect(null),
543
- onPointerDown: (e) => e.preventDefault(),
544
- className: "cursor-pointer text-sm text-muted-foreground",
545
- children: [
546
- /* @__PURE__ */ jsx(X, { className: "mr-1 size-3.5 shrink-0" }),
547
- /* @__PURE__ */ jsx("span", { children: removeLabel ?? l.removeFromFolder }),
548
- value === null && /* @__PURE__ */ jsx("span", { className: "ml-auto flex-none text-sm text-primary", children: "\u2713" })
549
- ]
550
- }
551
- ) })
552
- ] })
553
- ] });
554
- }
555
- var DEFAULT_FOLDER_FILTER_LABELS = {
556
- all: "All",
557
- newFolder: "New folder"
558
- };
559
- function FolderFilterButton({
560
- label,
561
- icon,
562
- isActive,
563
- open,
564
- onOpenChange,
565
- allCount,
566
- onSelectAll,
567
- onNewFolder,
568
- children,
569
- className,
570
- labels,
571
- testId,
572
- newFolderTestId
573
- }) {
574
- const l = { ...DEFAULT_FOLDER_FILTER_LABELS, ...labels };
575
- return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange, children: [
576
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
577
- Button,
578
- {
579
- variant: "ghost",
580
- size: "sm",
581
- "data-slot": "folder-filter-button",
582
- "data-testid": testId,
583
- className: cn(
584
- "h-7 shrink-0 gap-1.5 px-2 text-sm font-normal pointer-coarse:h-10",
585
- isActive && "bg-accent font-medium text-accent-foreground",
586
- className
587
- ),
588
- children: [
589
- icon ?? /* @__PURE__ */ jsx(
590
- FolderOpen,
591
- {
592
- className: cn(
593
- "h-3.5 w-3.5 shrink-0 text-muted-foreground",
594
- isActive && "fill-muted-foreground/30"
595
- )
596
- }
597
- ),
598
- /* @__PURE__ */ jsx("span", { className: "max-w-[280px] truncate", children: label }),
599
- /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4 text-foreground", strokeWidth: 2.5 })
600
- ]
601
- }
602
- ) }),
603
- /* @__PURE__ */ jsxs(
604
- PopoverContent,
605
- {
606
- className: "w-max min-w-56 max-w-[480px] p-1 shadow-lg",
607
- align: "start",
608
- sideOffset: 4,
609
- children: [
610
- onSelectAll && /* @__PURE__ */ jsxs(Fragment, { children: [
611
- /* @__PURE__ */ jsx(
612
- FolderPickerRow,
613
- {
614
- label: l.all,
615
- count: allCount,
616
- depth: 0,
617
- isActive: !isActive,
618
- onClick: onSelectAll
619
- }
620
- ),
621
- /* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" })
622
- ] }),
623
- children,
624
- onNewFolder && /* @__PURE__ */ jsxs(Fragment, { children: [
625
- /* @__PURE__ */ jsx("div", { className: "my-1 border-t border-border" }),
626
- /* @__PURE__ */ jsxs(
627
- "button",
628
- {
629
- type: "button",
630
- onClick: onNewFolder,
631
- "data-testid": testIdOr(newFolderTestId, { testId: "explorer-new-folder" }),
632
- className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground pointer-coarse:min-h-11",
633
- children: [
634
- /* @__PURE__ */ jsx(FolderPlus, { className: "h-3.5 w-3.5" }),
635
- l.newFolder
636
- ]
637
- }
638
- )
639
- ] })
640
- ]
641
- }
642
- )
643
- ] });
644
- }
645
-
646
- export { CHROME, DEFAULT_FOLDER_FILTER_LABELS, DEFAULT_FOLDER_PICKER_LABELS, FieldAttribution, FieldFolderSelect, FieldFolderValue, FieldLabelsSelect, FieldNativeSelect, FieldValue, FieldWithAttribution, FilesFilterBar, FilesModalFooter, FilesTagsButton, FilesViewCenter, FilterButton, FolderBreadcrumb, FolderCell, FolderCommandList, FolderFilterButton, FolderPickerRow, FolderTree, LINE_PX, MAX_LINES, MIN_LINES, ROW_MIN, RowDensityControl, linesForRowHeight, rowHeightForLines };
647
- //# sourceMappingURL=chunk-JGOST4IL.js.map
648
- //# sourceMappingURL=chunk-JGOST4IL.js.map