@declarion/react 0.57.0 → 0.59.2

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 (166) hide show
  1. package/README.md +0 -2
  2. package/dist-lib/AgentChatPanel.impl-DBH1Ff4G.js +1200 -0
  3. package/dist-lib/DetailAuditStrip-9eJM2Fml.js +288 -0
  4. package/dist-lib/{DraggableChildrenTable-BV5sb8Uo.js → DraggableChildrenTable-4RZC351U.js} +87 -86
  5. package/dist-lib/Grid-CQabaBLx.js +405 -0
  6. package/dist-lib/{LayoutRenderer-C9AH9cXf.js → LayoutRenderer-DGKWZKpW.js} +1000 -1114
  7. package/dist-lib/{ListCardsBody-DXcDg536.js → ListCardsBody-DfGmyNIu.js} +84 -84
  8. package/dist-lib/MarkdownRenderer-BDbzDv_y.js +87 -0
  9. package/dist-lib/{RefreshControl-CNtN8zSl.js → RefreshControl-Bhoib0ZA.js} +126 -155
  10. package/dist-lib/SmartDetailPage.impl-DFjz29Ff.js +1565 -0
  11. package/dist-lib/SmartListPage.impl-BrZLE_Gb.js +3046 -0
  12. package/dist-lib/{SmartRecordListPage.impl-Bkl9aZJ8.js → SmartRecordListPage.impl-C1FJLr80.js} +281 -280
  13. package/dist-lib/SortHeaderMenu-Cijxk4cX.js +107 -0
  14. package/dist-lib/action-dispatch-DY0c8U81.js +1967 -0
  15. package/dist-lib/api/client.d.ts +5 -0
  16. package/dist-lib/api/data.d.ts +2 -4
  17. package/dist-lib/api/entities.d.ts +8 -15
  18. package/dist-lib/api/events.d.ts +3 -3
  19. package/dist-lib/cardProjection-Bkl2SSYz.js +499 -0
  20. package/dist-lib/components/actions/ResponsiveActionBar.d.ts +17 -16
  21. package/dist-lib/components/agents/AgentChatPanel.d.ts +3 -13
  22. package/dist-lib/components/agents/AgentChatPanel.impl.d.ts +14 -0
  23. package/dist-lib/components/agents/AgentPicker.d.ts +1 -2
  24. package/dist-lib/components/chrome/PageShell.d.ts +7 -0
  25. package/dist-lib/components/chrome/RecordHeader.d.ts +1 -2
  26. package/dist-lib/components/chrome/headerActionZone.d.ts +27 -0
  27. package/dist-lib/components/detail-layout/DetailAuditStrip.d.ts +1 -2
  28. package/dist-lib/components/detail-layout/DetailHighlights.d.ts +1 -2
  29. package/dist-lib/components/detail-layout/blockMeta.d.ts +2 -1
  30. package/dist-lib/components/fields/BoolField.d.ts +1 -1
  31. package/dist-lib/components/fields/EnumField.d.ts +1 -1
  32. package/dist-lib/components/fields/IntArrayField.d.ts +1 -1
  33. package/dist-lib/components/fields/MultilangArrayField.d.ts +2 -0
  34. package/dist-lib/components/fields/MultilangField.d.ts +1 -1
  35. package/dist-lib/components/fields/MultilangTextField.d.ts +1 -1
  36. package/dist-lib/components/fields/NumberField.d.ts +1 -1
  37. package/dist-lib/components/fields/PasswordField.d.ts +1 -1
  38. package/dist-lib/components/fields/RefCombobox.d.ts +1 -1
  39. package/dist-lib/components/fields/SecretField.d.ts +1 -1
  40. package/dist-lib/components/fields/StringArrayField.d.ts +1 -1
  41. package/dist-lib/components/fields/TimestampField.d.ts +1 -1
  42. package/dist-lib/components/fields/cells/registry.d.ts +2 -1
  43. package/dist-lib/components/fields/index.d.ts +2 -1
  44. package/dist-lib/components/fields/langMap.d.ts +2 -0
  45. package/dist-lib/components/fields/secretValue.d.ts +2 -0
  46. package/dist-lib/components/file-widgets/UnknownFileWidget.d.ts +3 -0
  47. package/dist-lib/components/file-widgets/UploadFailureText.d.ts +4 -0
  48. package/dist-lib/components/file-widgets/helpers.d.ts +1 -1
  49. package/dist-lib/components/file-widgets/host.d.ts +4 -3
  50. package/dist-lib/components/file-widgets/types.d.ts +1 -0
  51. package/dist-lib/components/file-widgets/upload.d.ts +18 -3
  52. package/dist-lib/components/filters/filter-op-label.d.ts +3 -0
  53. package/dist-lib/components/layout/ImpersonationBanner.d.ts +1 -1
  54. package/dist-lib/components/layout/ImpersonationFrame.d.ts +1 -1
  55. package/dist-lib/components/layout/Layout.d.ts +2 -1
  56. package/dist-lib/components/layout/Sidebar.d.ts +2 -1
  57. package/dist-lib/components/layout/TenantChip.d.ts +1 -1
  58. package/dist-lib/components/list/ViewSwitcher.d.ts +4 -2
  59. package/dist-lib/components/pages/DocumentsMenu.d.ts +1 -2
  60. package/dist-lib/components/pages/ExportMenu.d.ts +3 -5
  61. package/dist-lib/components/pages/RecordDocumentsPanel.d.ts +1 -2
  62. package/dist-lib/components/pages/auth/AuthShell.d.ts +4 -31
  63. package/dist-lib/components/pages/exportRequest.d.ts +4 -6
  64. package/dist-lib/components/pages/list/DeleteViewDialog.d.ts +8 -0
  65. package/dist-lib/components/pages/list/ListCardRow.d.ts +1 -2
  66. package/dist-lib/components/pages/list/ListCardsBody.d.ts +0 -1
  67. package/dist-lib/components/pages/list/ListFloatbar.d.ts +2 -2
  68. package/dist-lib/components/pages/list/ListHeader.d.ts +2 -2
  69. package/dist-lib/components/pages/list/ListNoRows.d.ts +4 -5
  70. package/dist-lib/components/pages/list/ListToolbar.d.ts +3 -2
  71. package/dist-lib/components/pages/list/ListUrlBanner.d.ts +10 -0
  72. package/dist-lib/components/pages/list/RowActionsCell.d.ts +2 -4
  73. package/dist-lib/components/pages/list/RowContextMenu.d.ts +1 -2
  74. package/dist-lib/components/pages/list/columns.d.ts +2 -1
  75. package/dist-lib/components/pages/list/filter-meta.d.ts +2 -1
  76. package/dist-lib/components/pages/list/useActiveView.d.ts +38 -0
  77. package/dist-lib/components/pages/list/useListColumnLayout.d.ts +6 -5
  78. package/dist-lib/components/pages/list/useListQuery.d.ts +4 -4
  79. package/dist-lib/components/pages/list/useListSort.d.ts +5 -4
  80. package/dist-lib/components/pages/list/useListViews.d.ts +18 -8
  81. package/dist-lib/components/pages/list/useRowMenu.d.ts +2 -3
  82. package/dist-lib/components/pages/profile/Profile.d.ts +3 -0
  83. package/dist-lib/components/params/ParamsBlock.d.ts +1 -13
  84. package/dist-lib/components/params/param-editors.d.ts +3 -11
  85. package/dist-lib/components/primitives/ClassifiedFieldLocked.d.ts +1 -2
  86. package/dist-lib/components/shared/DynamicIcon.d.ts +2 -2
  87. package/dist-lib/components/shared/LoadingSkeleton.d.ts +1 -0
  88. package/dist-lib/components/shared/LucideIcon.d.ts +1 -1
  89. package/dist-lib/components/shared/useOwnRefresh.d.ts +1 -1
  90. package/dist-lib/declarion-react.css +1 -1
  91. package/dist-lib/embed/theme.d.ts +1 -1
  92. package/dist-lib/embed/useEmbedNavigate.d.ts +1 -1
  93. package/dist-lib/failure-v-uGSpbX.js +158 -0
  94. package/dist-lib/{field-classification-D6xQYn-h.js → field-classification-C28XE-_P.js} +514 -307
  95. package/dist-lib/format-count-DA4wmmWR.js +1771 -0
  96. package/dist-lib/hooks/useEntityData.d.ts +1 -1
  97. package/dist-lib/hooks/useFilters.d.ts +7 -5
  98. package/dist-lib/hooks/useLanguage.d.ts +4 -0
  99. package/dist-lib/hooks/useParams.d.ts +4 -51
  100. package/dist-lib/hooks/useRegisterScreenTab.d.ts +1 -1
  101. package/dist-lib/hooks/useSSE.d.ts +3 -3
  102. package/dist-lib/hooks/useTabTitle.d.ts +2 -0
  103. package/dist-lib/hooks/useText.d.ts +3 -3
  104. package/dist-lib/hooks/useVersionWatcher.d.ts +1 -1
  105. package/dist-lib/hooks/useViews.d.ts +20 -0
  106. package/dist-lib/index.d.ts +8 -7
  107. package/dist-lib/index.js +2716 -5803
  108. package/dist-lib/lib/action-dispatch.d.ts +2 -1
  109. package/dist-lib/lib/actions.d.ts +30 -42
  110. package/dist-lib/lib/anchor.d.ts +3 -4
  111. package/dist-lib/lib/decimal-text.d.ts +1 -0
  112. package/dist-lib/lib/document-templates.d.ts +1 -2
  113. package/dist-lib/lib/download.d.ts +2 -1
  114. package/dist-lib/lib/evidence-verdict.d.ts +2 -1
  115. package/dist-lib/lib/failure.d.ts +2 -0
  116. package/dist-lib/lib/field-classification.d.ts +3 -3
  117. package/dist-lib/lib/filters.d.ts +18 -2
  118. package/dist-lib/lib/format-count.d.ts +8 -7
  119. package/dist-lib/lib/language.d.ts +19 -0
  120. package/dist-lib/lib/mass-edit.d.ts +2 -1
  121. package/dist-lib/lib/realtime-query-keys.d.ts +1 -1
  122. package/dist-lib/lib/realtime-reconcile.d.ts +3 -4
  123. package/dist-lib/lib/screen-back.d.ts +4 -6
  124. package/dist-lib/lib/sort.d.ts +9 -9
  125. package/dist-lib/lib/timestamp.d.ts +5 -7
  126. package/dist-lib/lib/ui-actions.d.ts +2 -1
  127. package/dist-lib/peekDraftStore-D-cTbiIr.js +199 -0
  128. package/dist-lib/registry-Cb3W-czW.js +1950 -0
  129. package/dist-lib/safe-url-oSJw5pzO.js +34 -0
  130. package/dist-lib/stores/icon-registry.d.ts +2 -2
  131. package/dist-lib/stores/list-layout.d.ts +3 -4
  132. package/dist-lib/stores/realtime.d.ts +1 -1
  133. package/dist-lib/stores/tabs.d.ts +3 -2
  134. package/dist-lib/testing.d.ts +6 -0
  135. package/dist-lib/testing.js +98 -76
  136. package/dist-lib/types/api.d.ts +7 -8
  137. package/dist-lib/types/fieldType.d.ts +1 -1
  138. package/dist-lib/types/files.d.ts +4 -4
  139. package/dist-lib/types/schema.d.ts +44 -50
  140. package/dist-lib/useAgentConversation-D97IqE-J.js +623 -0
  141. package/dist-lib/{useCurrentScreen-CzwzQpoW.js → useCurrentScreen-BL5NZFCw.js} +2777 -3768
  142. package/dist-lib/useListQuery-BG1GyKtJ.js +103 -0
  143. package/dist-lib/useProperties-4Lg3odrt.js +83 -0
  144. package/dist-lib/{useTabSearchMirror-C39U85cg.js → useTabSearchMirror-ZVLlINBX.js} +49 -51
  145. package/dist-lib/useText-BFDCTUSo.js +952 -0
  146. package/dist-lib/{value-Bo8C8WMU.js → value-By1-WJ8J.js} +74 -76
  147. package/dist-lib/vite/fingerprint-plugin.d.ts +2 -3
  148. package/package.json +9 -9
  149. package/dist-lib/Grid-DWgUPuZ3.js +0 -404
  150. package/dist-lib/MarkdownRenderer-CcSFc2N3.js +0 -85
  151. package/dist-lib/RecordIdBadge-CGxPR-8q.js +0 -24
  152. package/dist-lib/SmartDetailPage.impl-lskCd-WG.js +0 -1846
  153. package/dist-lib/SmartListPage.impl-CrGbdzyK.js +0 -2854
  154. package/dist-lib/SortHeaderMenu-SYSAaqQJ.js +0 -106
  155. package/dist-lib/action-dispatch-CR4ajBtT.js +0 -1985
  156. package/dist-lib/cardProjection-CW5RIMko.js +0 -699
  157. package/dist-lib/components/pages/home/HomeStub.d.ts +0 -6
  158. package/dist-lib/components/pages/jobs/Jobs.d.ts +0 -1
  159. package/dist-lib/components/pages/pipeline/Pipeline.d.ts +0 -1
  160. package/dist-lib/format-count-Dobmi-Ji.js +0 -1551
  161. package/dist-lib/hooks/useUserLocale.d.ts +0 -1
  162. package/dist-lib/lib/messages.d.ts +0 -12
  163. package/dist-lib/peekDraftStore-5wQ7lq_V.js +0 -194
  164. package/dist-lib/registry-CjgUaF7C.js +0 -1768
  165. package/dist-lib/useListQuery-D7Hr5WM1.js +0 -96
  166. package/dist-lib/useProperties-CqtCzFCr.js +0 -81
@@ -0,0 +1,405 @@
1
+ import { dt as e, ft as t, ht as n, lt as r, mt as i, pt as a, st as o, ut as s } from "./useCurrentScreen-BL5NZFCw.js";
2
+ import { t as c, u as l } from "./useText-BFDCTUSo.js";
3
+ import { c as u, i as d, l as f, m as p, t as m } from "./value-By1-WJ8J.js";
4
+ import { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
5
+ import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
6
+ import { DndContext as C, PointerSensor as w, closestCenter as T, useSensor as ee, useSensors as te } from "@dnd-kit/core";
7
+ import { SortableContext as ne, arrayMove as E, rectSortingStrategy as D, useSortable as O } from "@dnd-kit/sortable";
8
+ import { CSS as k } from "@dnd-kit/utilities";
9
+ //#region src/components/file-widgets/Grid.tsx
10
+ function A(e, t) {
11
+ return u(e, t);
12
+ }
13
+ function j(e) {
14
+ let { field: u, fieldName: d, value: f, onChange: p, mode: b, disabled: O } = e, k = m(f), [A, j] = y([]), [M, N] = y(/* @__PURE__ */ new Set()), [P, F] = y(null), { register: I, unregister: L, isDraft: R } = o(), z = c(), B = c("errors"), V = v(/* @__PURE__ */ new Set()), H = v([]);
15
+ H.current = A;
16
+ let U = v(k);
17
+ U.current = k, g(() => () => {
18
+ H.current.forEach((e) => e.abort());
19
+ }, []);
20
+ let W = te(ee(w, { activationConstraint: { distance: 5 } })), oe = (u.accepts ?? ["image/*"]).join(","), se = u.display?.reorderable !== !1, ce = u.display?.listable_thumbnail, G = h(async (o) => {
21
+ let c = n(o, u.accepts, u.max_size_bytes), l = `tile-${Math.random().toString(36).slice(2)}-${Date.now()}`, f = new AbortController();
22
+ if (c) {
23
+ j((e) => [...e, {
24
+ localId: l,
25
+ filename: o.name,
26
+ progress: null,
27
+ error: t(z, B, c),
28
+ abort: () => {}
29
+ }]);
30
+ return;
31
+ }
32
+ j((e) => [...e, {
33
+ localId: l,
34
+ filename: o.name,
35
+ progress: {
36
+ loaded: 0,
37
+ total: o.size,
38
+ pct: 0
39
+ },
40
+ error: null,
41
+ abort: () => f.abort()
42
+ }]);
43
+ try {
44
+ let t = await i({
45
+ file: o,
46
+ entityCode: e.entityCode,
47
+ fieldCode: d,
48
+ signal: f.signal,
49
+ onProgress: (e) => j((t) => t.map((t) => t.localId === l ? {
50
+ ...t,
51
+ progress: e
52
+ } : t))
53
+ });
54
+ if (V.current.delete(l)) {
55
+ s(t.id).catch(() => {}), L(t.id);
56
+ return;
57
+ }
58
+ I(t.id, () => s(t.id));
59
+ let n = {
60
+ id: t.id,
61
+ filename: t.filename,
62
+ content_type: t.content_type,
63
+ size_bytes: t.size_bytes,
64
+ sha256: t.sha256,
65
+ width: t.width,
66
+ height: t.height,
67
+ url: t.url,
68
+ metadata: t.metadata
69
+ }, r = [...U.current, n];
70
+ U.current = r, p?.(r), j((e) => e.filter((e) => e.localId !== l));
71
+ } catch (e) {
72
+ if (e instanceof r && e.code === "ABORTED") {
73
+ j((e) => e.filter((e) => e.localId !== l));
74
+ return;
75
+ }
76
+ let t = a(z, B, e);
77
+ j((e) => e.map((e) => e.localId === l ? {
78
+ ...e,
79
+ error: t,
80
+ progress: null,
81
+ abort: () => {}
82
+ } : e));
83
+ }
84
+ }, [
85
+ B,
86
+ z,
87
+ u.accepts,
88
+ u.max_size_bytes,
89
+ d,
90
+ p,
91
+ e.entityCode,
92
+ I,
93
+ L
94
+ ]), K = h((e) => {
95
+ Array.from(e).forEach((e) => void G(e));
96
+ }, [G]), q = v(null), J = h(() => {
97
+ O || q.current?.click();
98
+ }, [O]), le = h((e) => {
99
+ O || (e.preventDefault(), e.dataTransfer.dropEffect = "copy");
100
+ }, [O]), ue = h((e) => {
101
+ if (O) return;
102
+ e.preventDefault();
103
+ let t = e.dataTransfer.files;
104
+ t && t.length > 0 && K(t);
105
+ }, [O, K]), de = h((e) => {
106
+ let t = e.target.files;
107
+ e.target.value = "", t && t.length > 0 && K(t);
108
+ }, [K]), fe = h((e) => {
109
+ R(e) && (s(e).catch(() => {}), L(e));
110
+ let t = k.filter((t) => t.id !== e);
111
+ p?.(t), N((t) => {
112
+ let n = new Set(t);
113
+ return n.delete(e), n;
114
+ });
115
+ }, [
116
+ R,
117
+ k,
118
+ p,
119
+ L
120
+ ]), pe = h(() => {
121
+ M.size !== 0 && (Array.from(M).forEach((e) => {
122
+ R(e) && (s(e).catch(() => {}), L(e));
123
+ }), p?.(k.filter((e) => !M.has(e.id))), N(/* @__PURE__ */ new Set()));
124
+ }, [
125
+ R,
126
+ k,
127
+ M,
128
+ p,
129
+ L
130
+ ]), me = h((e) => {
131
+ let { active: t, over: n } = e;
132
+ if (!n || t.id === n.id) return;
133
+ let r = k.findIndex((e) => e.id === t.id), i = k.findIndex((e) => e.id === n.id);
134
+ r < 0 || i < 0 || p?.(E(k, r, i));
135
+ }, [k, p]), he = h((e) => {
136
+ N((t) => {
137
+ let n = new Set(t);
138
+ return n.has(e) ? n.delete(e) : n.add(e), n;
139
+ });
140
+ }, []), Y = P == null ? null : k[P], X = h(() => {
141
+ F((e) => e == null ? e : Math.min(k.length - 1, e + 1));
142
+ }, [k.length]), Z = h(() => {
143
+ F((e) => e == null ? e : Math.max(0, e - 1));
144
+ }, []), Q = h(() => F(null), []);
145
+ g(() => {
146
+ if (P == null) return;
147
+ let e = (e) => {
148
+ e.key === "Escape" ? Q() : e.key === "ArrowRight" ? X() : e.key === "ArrowLeft" && Z();
149
+ };
150
+ return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
151
+ }, [
152
+ P,
153
+ Q,
154
+ X,
155
+ Z
156
+ ]);
157
+ let ge = h((e) => {
158
+ O || (e.key === "Enter" || e.key === " ") && e.target === e.currentTarget && (e.preventDefault(), J());
159
+ }, [O, J]), $ = b === "display", _e = _(() => k.map((e) => e.id), [k]);
160
+ return /* @__PURE__ */ S("div", {
161
+ "data-testid": `file-widget-${d}`,
162
+ className: "flex flex-col gap-2",
163
+ children: [
164
+ !$ && M.size > 0 && /* @__PURE__ */ S("div", {
165
+ className: "flex items-center gap-2 rounded-md border border-border bg-surface-2 p-2 text-sm",
166
+ role: "toolbar",
167
+ "aria-label": z("file.grid.bulk_actions", "Bulk actions"),
168
+ children: [
169
+ /* @__PURE__ */ x("span", {
170
+ className: "text-foreground",
171
+ children: l(z, "file.grid.selected", M.size, {
172
+ one: "{count} selected",
173
+ other: "{count} selected"
174
+ })
175
+ }),
176
+ /* @__PURE__ */ x("button", {
177
+ type: "button",
178
+ className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-destructive hover:bg-surface-2",
179
+ onClick: pe,
180
+ "data-testid": "bulk-delete",
181
+ children: z("file.delete", "Delete")
182
+ }),
183
+ /* @__PURE__ */ x("button", {
184
+ type: "button",
185
+ className: "rounded-sm border border-border bg-card px-2 py-1 text-xs text-foreground hover:bg-surface-2",
186
+ onClick: () => N(/* @__PURE__ */ new Set()),
187
+ children: z("file.grid.clear_selection", "Clear")
188
+ })
189
+ ]
190
+ }),
191
+ /* @__PURE__ */ x(C, {
192
+ sensors: W,
193
+ collisionDetection: T,
194
+ onDragEnd: me,
195
+ children: /* @__PURE__ */ x(ne, {
196
+ items: _e,
197
+ strategy: D,
198
+ children: /* @__PURE__ */ S("div", {
199
+ className: "grid grid-cols-[repeat(auto-fill,minmax(140px,1fr))] gap-3 rounded-md border border-dashed border-border bg-surface p-3 outline-none focus-visible:outline-2 focus-visible:outline-accent",
200
+ role: "grid",
201
+ "aria-label": d,
202
+ tabIndex: $ || O ? -1 : 0,
203
+ onDragOver: le,
204
+ onDrop: ue,
205
+ onKeyDown: ge,
206
+ "data-testid": "grid-container",
207
+ children: [
208
+ k.map((e, t) => /* @__PURE__ */ x(re, {
209
+ file: e,
210
+ selected: M.has(e.id),
211
+ disabled: O || $,
212
+ reorderable: se && !$,
213
+ preferredThumbnail: ce,
214
+ onSelect: () => he(e.id),
215
+ onRemove: () => fe(e.id),
216
+ onPreview: () => F(t)
217
+ }, e.id)),
218
+ A.map((e) => /* @__PURE__ */ x(ie, {
219
+ tile: e,
220
+ onCancel: () => {
221
+ e.abort(), V.current.add(e.localId), j((t) => t.filter((t) => t.localId !== e.localId));
222
+ },
223
+ onDismiss: () => j((t) => t.filter((t) => t.localId !== e.localId))
224
+ }, e.localId)),
225
+ k.length === 0 && A.length === 0 && /* @__PURE__ */ x("div", {
226
+ className: "col-span-full flex h-24 cursor-pointer items-center justify-center text-sm text-muted-foreground",
227
+ onClick: J,
228
+ "data-testid": "grid-empty",
229
+ children: z(u.display?.placeholder) || z("file.grid.empty", "Drop files here or click to browse")
230
+ })
231
+ ]
232
+ })
233
+ })
234
+ }),
235
+ !$ && /* @__PURE__ */ x("input", {
236
+ ref: q,
237
+ type: "file",
238
+ accept: oe,
239
+ multiple: !0,
240
+ onChange: de,
241
+ style: { display: "none" },
242
+ "data-testid": `file-input-${d}`
243
+ }),
244
+ Y && /* @__PURE__ */ x(ae, {
245
+ file: Y,
246
+ hasPrev: P > 0,
247
+ hasNext: P < k.length - 1,
248
+ onPrev: Z,
249
+ onNext: X,
250
+ onClose: Q
251
+ })
252
+ ]
253
+ });
254
+ }
255
+ function re({ file: e, selected: t, disabled: n, reorderable: r, preferredThumbnail: i, onSelect: a, onRemove: o, onPreview: s }) {
256
+ let { attributes: l, listeners: u, setNodeRef: p, transform: m, transition: h, isDragging: g } = O({
257
+ id: e.id,
258
+ disabled: !r
259
+ }), _ = c(), v = {
260
+ transform: k.Transform.toString(m),
261
+ transition: h,
262
+ opacity: g ? .5 : 1
263
+ }, y = d(e.id, f(e, i), A(e, i));
264
+ return /* @__PURE__ */ S("div", {
265
+ ref: p,
266
+ style: v,
267
+ className: `group relative aspect-square overflow-hidden rounded-md border ${t ? "border-accent" : "border-border"} bg-surface-2`,
268
+ "data-testid": `grid-tile-${e.id}`,
269
+ "data-selected": t || void 0,
270
+ children: [y ? /* @__PURE__ */ x("img", {
271
+ src: y,
272
+ alt: e.filename,
273
+ className: "h-full w-full cursor-pointer object-cover",
274
+ loading: "lazy",
275
+ onClick: s
276
+ }) : /* @__PURE__ */ x("div", {
277
+ className: "flex h-full w-full cursor-pointer items-center justify-center bg-surface-3 text-xs text-muted-foreground",
278
+ onClick: s,
279
+ children: e.filename
280
+ }), !n && /* @__PURE__ */ S(b, { children: [
281
+ /* @__PURE__ */ x("input", {
282
+ type: "checkbox",
283
+ className: "absolute left-1 top-1 h-4 w-4 cursor-pointer",
284
+ checked: t,
285
+ onChange: a,
286
+ "aria-label": _("file.grid.select", "Select {filename}", { filename: e.filename }),
287
+ "data-testid": `select-${e.id}`,
288
+ onClick: (e) => e.stopPropagation()
289
+ }),
290
+ r && /* @__PURE__ */ x("button", {
291
+ type: "button",
292
+ className: "absolute right-1 top-1 cursor-grab rounded-sm border border-border bg-card px-1 text-xs",
293
+ "aria-label": _("file.grid.reorder", "Drag to reorder {filename}", { filename: e.filename }),
294
+ "data-testid": `drag-${e.id}`,
295
+ ...l,
296
+ ...u,
297
+ children: "⋮⋮"
298
+ }),
299
+ /* @__PURE__ */ S("div", {
300
+ className: "absolute inset-x-0 bottom-0 flex items-center justify-end gap-1 bg-black/50 p-1 opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100",
301
+ children: [/* @__PURE__ */ x("button", {
302
+ type: "button",
303
+ className: "rounded-sm border border-border bg-card px-2 py-0.5 text-xs",
304
+ onClick: s,
305
+ children: _("file.view", "View")
306
+ }), /* @__PURE__ */ x("button", {
307
+ type: "button",
308
+ className: "rounded-sm border border-border bg-card px-2 py-0.5 text-xs text-destructive",
309
+ onClick: o,
310
+ "data-testid": `remove-${e.id}`,
311
+ children: _("file.delete", "Delete")
312
+ })]
313
+ })
314
+ ] })]
315
+ });
316
+ }
317
+ function ie({ tile: e, onCancel: t, onDismiss: n }) {
318
+ let r = c();
319
+ return /* @__PURE__ */ S("div", {
320
+ className: `relative flex aspect-square flex-col items-center justify-center rounded-md border ${e.error ? "border-destructive" : "border-border"} bg-surface-2 p-2 text-center text-xs`,
321
+ "data-testid": `pending-tile-${e.localId}`,
322
+ children: [
323
+ /* @__PURE__ */ x("span", {
324
+ className: "truncate",
325
+ title: e.filename,
326
+ children: e.filename
327
+ }),
328
+ e.progress && !e.error && /* @__PURE__ */ S("span", {
329
+ className: "mt-1 text-muted-foreground",
330
+ role: "progressbar",
331
+ "aria-valuenow": e.progress.pct,
332
+ "aria-valuemin": 0,
333
+ "aria-valuemax": 100,
334
+ children: [e.progress.pct, "%"]
335
+ }),
336
+ e.error && /* @__PURE__ */ x("div", {
337
+ role: "alert",
338
+ className: "mt-1 text-destructive",
339
+ children: /* @__PURE__ */ x(p, { failure: e.error })
340
+ }),
341
+ /* @__PURE__ */ x("button", {
342
+ type: "button",
343
+ className: "mt-1 rounded-sm border border-border bg-card px-2 py-0.5",
344
+ onClick: e.error ? n : t,
345
+ children: e.error ? r("file.upload.dismiss", "Dismiss") : r("file.upload.cancel", "Cancel")
346
+ })
347
+ ]
348
+ });
349
+ }
350
+ function ae({ file: t, hasPrev: n, hasNext: r, onPrev: i, onNext: a, onClose: o }) {
351
+ let s = c(), l = d(t.id, "preview", t.presigned_url ?? t.url ?? A(t));
352
+ return /* @__PURE__ */ S("div", {
353
+ className: "fixed inset-0 z-50 flex items-center justify-center bg-black/80",
354
+ role: "dialog",
355
+ "aria-modal": "true",
356
+ "aria-label": t.filename,
357
+ "data-testid": "lightbox",
358
+ onClick: o,
359
+ children: [
360
+ /* @__PURE__ */ x("button", {
361
+ type: "button",
362
+ className: "absolute right-4 top-4 rounded-sm border border-border bg-card px-3 py-1 text-foreground",
363
+ onClick: (e) => {
364
+ e.stopPropagation(), o();
365
+ },
366
+ "data-testid": "lightbox-close",
367
+ children: s("file.lightbox.close", "Close")
368
+ }),
369
+ n && /* @__PURE__ */ x("button", {
370
+ type: "button",
371
+ className: "absolute left-4 rounded-sm border border-border bg-card px-3 py-2 text-foreground",
372
+ onClick: (e) => {
373
+ e.stopPropagation(), i();
374
+ },
375
+ "data-testid": "lightbox-prev",
376
+ children: "‹"
377
+ }),
378
+ r && /* @__PURE__ */ x("button", {
379
+ type: "button",
380
+ className: "absolute right-4 bottom-4 rounded-sm border border-border bg-card px-3 py-2 text-foreground",
381
+ onClick: (e) => {
382
+ e.stopPropagation(), a();
383
+ },
384
+ "data-testid": "lightbox-next",
385
+ children: "›"
386
+ }),
387
+ l ? /* @__PURE__ */ x("img", {
388
+ src: l,
389
+ alt: t.filename,
390
+ className: "max-h-[90vh] max-w-[90vw] object-contain",
391
+ onClick: (e) => e.stopPropagation()
392
+ }) : /* @__PURE__ */ S("div", {
393
+ className: "rounded-md bg-card p-4 text-foreground",
394
+ children: [
395
+ t.filename,
396
+ " (",
397
+ e(t.size_bytes),
398
+ ")"
399
+ ]
400
+ })
401
+ ]
402
+ });
403
+ }
404
+ //#endregion
405
+ export { j as Grid };