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