@alfadocs/ui-kit 0.77.0 → 0.78.0
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/dist/_chunks/document-preview-nwfulDEs.js +290 -0
- package/dist/agent-catalog.json +1 -1
- package/dist/components/document-preview/document-preview.d.ts +10 -0
- package/dist/components/document-preview/index.js +1 -1
- package/dist/i18n/locales/ar.d.ts +6 -0
- package/dist/i18n/locales/ar.js +6 -0
- package/dist/i18n/locales/de.d.ts +6 -0
- package/dist/i18n/locales/de.js +6 -0
- package/dist/i18n/locales/el.d.ts +6 -0
- package/dist/i18n/locales/el.js +6 -0
- package/dist/i18n/locales/en.d.ts +6 -0
- package/dist/i18n/locales/en.js +6 -0
- package/dist/i18n/locales/es.d.ts +6 -0
- package/dist/i18n/locales/es.js +6 -0
- package/dist/i18n/locales/fr.d.ts +6 -0
- package/dist/i18n/locales/fr.js +6 -0
- package/dist/i18n/locales/hi.d.ts +6 -0
- package/dist/i18n/locales/hi.js +6 -0
- package/dist/i18n/locales/it.d.ts +6 -0
- package/dist/i18n/locales/it.js +6 -0
- package/dist/i18n/locales/ja.d.ts +6 -0
- package/dist/i18n/locales/ja.js +6 -0
- package/dist/i18n/locales/nl.d.ts +6 -0
- package/dist/i18n/locales/nl.js +6 -0
- package/dist/i18n/locales/pl.d.ts +6 -0
- package/dist/i18n/locales/pl.js +6 -0
- package/dist/i18n/locales/pt.d.ts +6 -0
- package/dist/i18n/locales/pt.js +6 -0
- package/dist/i18n/locales/ro.d.ts +6 -0
- package/dist/i18n/locales/ro.js +6 -0
- package/dist/i18n/locales/ru.d.ts +6 -0
- package/dist/i18n/locales/ru.js +6 -0
- package/dist/i18n/locales/sq.d.ts +6 -0
- package/dist/i18n/locales/sq.js +6 -0
- package/dist/i18n/locales/sv.d.ts +6 -0
- package/dist/i18n/locales/sv.js +6 -0
- package/dist/i18n/locales/tr.d.ts +6 -0
- package/dist/i18n/locales/tr.js +6 -0
- package/dist/i18n/locales/zh.d.ts +6 -0
- package/dist/i18n/locales/zh.js +6 -0
- package/dist/index.js +1 -1
- package/dist/locales/ar.json +6 -0
- package/dist/locales/de.json +6 -0
- package/dist/locales/el.json +6 -0
- package/dist/locales/en.json +6 -0
- package/dist/locales/es.json +6 -0
- package/dist/locales/fr.json +6 -0
- package/dist/locales/hi.json +6 -0
- package/dist/locales/it.json +6 -0
- package/dist/locales/ja.json +6 -0
- package/dist/locales/nl.json +6 -0
- package/dist/locales/pl.json +6 -0
- package/dist/locales/pt.json +6 -0
- package/dist/locales/ro.json +6 -0
- package/dist/locales/ru.json +6 -0
- package/dist/locales/sq.json +6 -0
- package/dist/locales/sv.json +6 -0
- package/dist/locales/tr.json +6 -0
- package/dist/locales/zh.json +6 -0
- package/dist/tokens.css +1 -0
- package/package.json +1 -1
- package/dist/_chunks/document-preview-CvHnHf6T.js +0 -243
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
import { jsxs as d, Fragment as g, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as j, useMemo as S, useState as C, useImperativeHandle as W } from "react";
|
|
3
|
-
import { c as U } from "./index-D2ZczOXr.js";
|
|
4
|
-
import { useTranslation as $ } from "react-i18next";
|
|
5
|
-
import { B as h } from "./badge-DCOqV9mI.js";
|
|
6
|
-
import { E as G } from "./empty-state-CrLsi0XI.js";
|
|
7
|
-
import { P as Y } from "./panel-header-D313n_9-.js";
|
|
8
|
-
import { P as q } from "./pdf-viewer-DF3VMaPo.js";
|
|
9
|
-
import { T as J, b as O, c as Q, a as X } from "./tabs-CVTukWRD.js";
|
|
10
|
-
import { u as Z } from "./registry-DvAUVLHh.js";
|
|
11
|
-
import { F as ee, a as te } from "./file-Cwe9VC1A.js";
|
|
12
|
-
import { F as ae } from "./file-text-5yv6r2ls.js";
|
|
13
|
-
import { c as ie } from "./createLucideIcon-DhHxpK9K.js";
|
|
14
|
-
/**
|
|
15
|
-
* @license lucide-react v1.22.0 - ISC
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the ISC license.
|
|
18
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/
|
|
20
|
-
const ne = [
|
|
21
|
-
["path", { d: "M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8", key: "14sh0y" }],
|
|
22
|
-
[
|
|
23
|
-
"path",
|
|
24
|
-
{
|
|
25
|
-
d: "M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",
|
|
26
|
-
key: "1970lx"
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
["path", { d: "M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1", key: "l4dndm" }]
|
|
30
|
-
], se = ie("files", ne), re = {
|
|
31
|
-
id: "document-preview",
|
|
32
|
-
capabilities: [],
|
|
33
|
-
state: {
|
|
34
|
-
kind: {
|
|
35
|
-
type: "'pdf' | 'image' | 'metadata' | 'empty'",
|
|
36
|
-
descriptionKey: "ui.agent.documentPreview.state.kind",
|
|
37
|
-
description: "Which render branch is active: pdf, image, metadata (no inline preview), or empty (no document). Structural — never the document name.",
|
|
38
|
-
read: (i) => i.getKind()
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
actions: {
|
|
42
|
-
get_name: {
|
|
43
|
-
// phi (not read): resolves the document display name, which can identify
|
|
44
|
-
// patients. PRS §26 — phi outranks read so the host gates it behind
|
|
45
|
-
// stricter confirm + audit. The always-on kind slot stays name-free.
|
|
46
|
-
safety: "phi",
|
|
47
|
-
returns: "string | undefined",
|
|
48
|
-
returnsSchema: { type: ["string", "null"] },
|
|
49
|
-
idempotent: !0,
|
|
50
|
-
descriptionKey: "ui.agent.documentPreview.actions.getName",
|
|
51
|
-
description: "Read the display name of the previewed document. May identify a patient (PHI).",
|
|
52
|
-
invoke: (i) => i.getName()
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
domHooks: {
|
|
56
|
-
root: {
|
|
57
|
-
attr: "data-component",
|
|
58
|
-
value: "document-preview",
|
|
59
|
-
description: "Marks the DocumentPreview region."
|
|
60
|
-
},
|
|
61
|
-
instanceId: {
|
|
62
|
-
attr: "data-component-id",
|
|
63
|
-
sourceProp: "id",
|
|
64
|
-
description: "Sourced from the id prop."
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, de = U(
|
|
68
|
-
[
|
|
69
|
-
"ds:flex ds:h-full ds:min-h-0 ds:min-w-0 ds:flex-col ds:overflow-auto",
|
|
70
|
-
"ds:focus-visible:outline-[length:var(--focus-ring-width)]",
|
|
71
|
-
"ds:focus-visible:outline-solid",
|
|
72
|
-
"ds:focus-visible:outline-ring"
|
|
73
|
-
].join(" ")
|
|
74
|
-
), me = {
|
|
75
|
-
signed: "success",
|
|
76
|
-
pending: "warning"
|
|
77
|
-
};
|
|
78
|
-
function k(i, n, l) {
|
|
79
|
-
if (!i) return "empty";
|
|
80
|
-
const r = n ?? "";
|
|
81
|
-
return r === "application/pdf" && l ? "pdf" : r.startsWith("image/") && l ? "image" : "metadata";
|
|
82
|
-
}
|
|
83
|
-
function B(i) {
|
|
84
|
-
const n = i ?? "";
|
|
85
|
-
return n.startsWith("image/") ? ee : n === "application/pdf" || n.startsWith("text/") || n.includes("word") ? ae : te;
|
|
86
|
-
}
|
|
87
|
-
const oe = [
|
|
88
|
-
"documentPreview.units.bytes",
|
|
89
|
-
"documentPreview.units.kilobytes",
|
|
90
|
-
"documentPreview.units.megabytes",
|
|
91
|
-
"documentPreview.units.gigabytes"
|
|
92
|
-
], M = ["B", "KB", "MB", "GB"];
|
|
93
|
-
function le(i, n, l) {
|
|
94
|
-
let r = i, m = 0;
|
|
95
|
-
for (; r >= 1024 && m < M.length - 1; )
|
|
96
|
-
r /= 1024, m++;
|
|
97
|
-
return `${new Intl.NumberFormat(n, {
|
|
98
|
-
maximumFractionDigits: m === 0 ? 0 : 1
|
|
99
|
-
}).format(r)} ${l(oe[m], M[m])}`;
|
|
100
|
-
}
|
|
101
|
-
const ce = j(({ id: i, name: n, mimeType: l, src: r, metadata: m, documents: u, className: K }, D) => {
|
|
102
|
-
const { t: s, i18n: v } = $(), o = S(() => u && u.length > 0 ? u : n ? [{ id: i ?? n, name: n, mimeType: l, src: r, metadata: m }] : [], [u, i, n, l, r, m]), w = o.length > 1, [L, _] = C(void 0), a = o.find((e) => e.id === L) ?? o[0], y = S(
|
|
103
|
-
() => ({
|
|
104
|
-
getKind: () => a ? k(a.name, a.mimeType, a.src) : "empty",
|
|
105
|
-
getName: () => a == null ? void 0 : a.name
|
|
106
|
-
}),
|
|
107
|
-
[a]
|
|
108
|
-
);
|
|
109
|
-
W(D, () => y, [y]), Z(re, y, i);
|
|
110
|
-
const b = (e) => {
|
|
111
|
-
var N, P, x, T, I, z, A, F;
|
|
112
|
-
const f = k(e.name, e.mimeType, e.src);
|
|
113
|
-
if (f === "pdf" && e.src)
|
|
114
|
-
return /* @__PURE__ */ t(
|
|
115
|
-
q,
|
|
116
|
-
{
|
|
117
|
-
src: e.src,
|
|
118
|
-
toolbarVariant: "minimal",
|
|
119
|
-
ariaLabel: e.name,
|
|
120
|
-
className: "ds:h-full"
|
|
121
|
-
}
|
|
122
|
-
);
|
|
123
|
-
if (f === "image" && e.src)
|
|
124
|
-
return /* @__PURE__ */ t(
|
|
125
|
-
"img",
|
|
126
|
-
{
|
|
127
|
-
src: e.src,
|
|
128
|
-
alt: s("documentPreview.imageAlt", "Preview of {{name}}", {
|
|
129
|
-
name: e.name
|
|
130
|
-
}),
|
|
131
|
-
className: "ds:max-h-full ds:max-w-full ds:ms-auto ds:me-auto ds:object-contain"
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
const c = (N = e.metadata) == null ? void 0 : N.signatureStatus, R = !!((P = e.metadata) != null && P.documentType) || !!((x = e.metadata) != null && x.clinical) || c !== void 0 && c !== "none";
|
|
135
|
-
return /* @__PURE__ */ d("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-md)] ds:p-[var(--spacing-md)]", children: [
|
|
136
|
-
R && /* @__PURE__ */ d("span", { className: "ds:flex ds:flex-wrap ds:items-center ds:gap-[var(--spacing-sm)]", children: [
|
|
137
|
-
((T = e.metadata) == null ? void 0 : T.documentType) && /* @__PURE__ */ t(h, { variant: "neutral", size: "sm", children: e.metadata.documentType }),
|
|
138
|
-
((I = e.metadata) == null ? void 0 : I.clinical) && /* @__PURE__ */ t(h, { variant: "info", size: "sm", children: s("documentPreview.clinical", "Clinical") }),
|
|
139
|
-
c && c !== "none" && /* @__PURE__ */ t(h, { variant: me[c], size: "sm", withDot: !0, children: s(`documentPreview.signature.${c}`, c) })
|
|
140
|
-
] }),
|
|
141
|
-
/* @__PURE__ */ d("dl", { className: "ds:grid ds:grid-cols-[auto_1fr] ds:gap-x-[var(--spacing-md)] ds:gap-y-[var(--spacing-xs)] type-body-sm", children: [
|
|
142
|
-
((z = e.metadata) == null ? void 0 : z.size) !== void 0 && /* @__PURE__ */ d(g, { children: [
|
|
143
|
-
/* @__PURE__ */ t("dt", { className: "ds:text-muted-foreground", children: s("documentPreview.fields.size", "Size") }),
|
|
144
|
-
/* @__PURE__ */ t("dd", { className: "ds:m-0", children: le(e.metadata.size, v.language, s) })
|
|
145
|
-
] }),
|
|
146
|
-
((A = e.metadata) == null ? void 0 : A.updatedAt) && /* @__PURE__ */ d(g, { children: [
|
|
147
|
-
/* @__PURE__ */ t("dt", { className: "ds:text-muted-foreground", children: s("documentPreview.fields.modified", "Modified") }),
|
|
148
|
-
/* @__PURE__ */ t("dd", { className: "ds:m-0", children: new Intl.DateTimeFormat(v.language, {
|
|
149
|
-
dateStyle: "medium"
|
|
150
|
-
}).format(new Date(e.metadata.updatedAt)) })
|
|
151
|
-
] }),
|
|
152
|
-
((F = e.metadata) == null ? void 0 : F.expiresAt) && /* @__PURE__ */ d(g, { children: [
|
|
153
|
-
/* @__PURE__ */ t("dt", { className: "ds:text-muted-foreground", children: s("documentPreview.fields.expires", "Expires") }),
|
|
154
|
-
/* @__PURE__ */ t("dd", { className: "ds:m-0", children: new Intl.DateTimeFormat(v.language, {
|
|
155
|
-
dateStyle: "medium"
|
|
156
|
-
}).format(new Date(e.metadata.expiresAt)) })
|
|
157
|
-
] })
|
|
158
|
-
] }),
|
|
159
|
-
/* @__PURE__ */ t("p", { className: "type-body-sm ds:m-0 ds:text-muted-foreground", children: s("documentPreview.noPreview", "No preview available.") })
|
|
160
|
-
] });
|
|
161
|
-
}, V = B(a == null ? void 0 : a.mimeType), E = w ? /* @__PURE__ */ t(se, { "aria-hidden": "true" }) : /* @__PURE__ */ t(V, { "aria-hidden": "true" }), H = w ? /* @__PURE__ */ d(g, { children: [
|
|
162
|
-
s("documentPreview.multiTitle", "Documents"),
|
|
163
|
-
/* @__PURE__ */ t(h, { variant: "neutral", size: "sm", children: o.length })
|
|
164
|
-
] }) : a == null ? void 0 : a.name;
|
|
165
|
-
let p;
|
|
166
|
-
return o.length === 0 ? p = /* @__PURE__ */ t(
|
|
167
|
-
G,
|
|
168
|
-
{
|
|
169
|
-
variant: "first-use",
|
|
170
|
-
size: "sm",
|
|
171
|
-
title: s("documentPreview.emptyTitle", "No document selected"),
|
|
172
|
-
description: s(
|
|
173
|
-
"documentPreview.emptyDescription",
|
|
174
|
-
"Select a document to preview it here."
|
|
175
|
-
)
|
|
176
|
-
}
|
|
177
|
-
) : w ? p = /* @__PURE__ */ d(
|
|
178
|
-
J,
|
|
179
|
-
{
|
|
180
|
-
value: (a == null ? void 0 : a.id) ?? "",
|
|
181
|
-
onValueChange: _,
|
|
182
|
-
variant: "underlined",
|
|
183
|
-
size: "sm",
|
|
184
|
-
className: "ds:min-h-0 ds:flex-1 ds:pt-[var(--spacing-sm)]",
|
|
185
|
-
children: [
|
|
186
|
-
/* @__PURE__ */ t(
|
|
187
|
-
O,
|
|
188
|
-
{
|
|
189
|
-
"aria-label": s("documentPreview.tabsLabel", "Selected documents"),
|
|
190
|
-
className: "ds:gap-[var(--spacing-sm)]",
|
|
191
|
-
children: o.map((e) => {
|
|
192
|
-
const f = B(e.mimeType);
|
|
193
|
-
return /* @__PURE__ */ t(
|
|
194
|
-
Q,
|
|
195
|
-
{
|
|
196
|
-
value: e.id,
|
|
197
|
-
icon: /* @__PURE__ */ t(
|
|
198
|
-
f,
|
|
199
|
-
{
|
|
200
|
-
"aria-hidden": "true",
|
|
201
|
-
className: "ds:size-4 ds:text-[color:var(--accent)]"
|
|
202
|
-
}
|
|
203
|
-
),
|
|
204
|
-
className: "ds:[min-inline-size:0]",
|
|
205
|
-
children: /* @__PURE__ */ t("span", { className: "ds:block ds:truncate ds:[min-inline-size:0]", children: e.name })
|
|
206
|
-
},
|
|
207
|
-
e.id
|
|
208
|
-
);
|
|
209
|
-
})
|
|
210
|
-
}
|
|
211
|
-
),
|
|
212
|
-
o.map((e) => /* @__PURE__ */ t(
|
|
213
|
-
X,
|
|
214
|
-
{
|
|
215
|
-
value: e.id,
|
|
216
|
-
className: "ds:min-h-0 ds:flex-1",
|
|
217
|
-
children: b(e)
|
|
218
|
-
},
|
|
219
|
-
e.id
|
|
220
|
-
))
|
|
221
|
-
]
|
|
222
|
-
}
|
|
223
|
-
) : p = b(a), /* @__PURE__ */ d(
|
|
224
|
-
"section",
|
|
225
|
-
{
|
|
226
|
-
"data-component": "document-preview",
|
|
227
|
-
"data-component-id": i,
|
|
228
|
-
tabIndex: 0,
|
|
229
|
-
"aria-label": s("documentPreview.regionLabel", "Document preview"),
|
|
230
|
-
className: de({ className: K }),
|
|
231
|
-
children: [
|
|
232
|
-
o.length > 0 && /* @__PURE__ */ t(Y, { sticky: !0, icon: E, title: H }),
|
|
233
|
-
p
|
|
234
|
-
]
|
|
235
|
-
}
|
|
236
|
-
);
|
|
237
|
-
});
|
|
238
|
-
ce.displayName = "DocumentPreview";
|
|
239
|
-
export {
|
|
240
|
-
ce as D,
|
|
241
|
-
re as d
|
|
242
|
-
};
|
|
243
|
-
//# sourceMappingURL=document-preview-CvHnHf6T.js.map
|