@alfadocs/ui-kit 1.4.6 → 1.4.8
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/anamnesis-summary-card-BvaSnAbI.js +302 -0
- package/dist/_chunks/{anamnesis-i18n-w9La6dNo.js → anamnesis-summary-rows-Co3BA0ro.js} +2515 -2381
- package/dist/agent-catalog.json +31 -1
- package/dist/agent-i18n/en.json +5 -0
- package/dist/components/anamnesis-summary-card/anamnesis-summary-card.agent.d.ts +4 -0
- package/dist/components/anamnesis-summary-card/anamnesis-summary-card.d.ts +69 -0
- package/dist/components/anamnesis-summary-card/index.d.ts +4 -0
- package/dist/components/anamnesis-summary-card/index.js +6 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/i18n/locales/ar.d.ts +20 -0
- package/dist/i18n/locales/ar.js +20 -0
- package/dist/i18n/locales/de.d.ts +20 -0
- package/dist/i18n/locales/de.js +20 -0
- package/dist/i18n/locales/el.d.ts +20 -0
- package/dist/i18n/locales/el.js +20 -0
- package/dist/i18n/locales/en.d.ts +20 -0
- package/dist/i18n/locales/en.js +20 -0
- package/dist/i18n/locales/es.d.ts +20 -0
- package/dist/i18n/locales/es.js +20 -0
- package/dist/i18n/locales/fr.d.ts +20 -0
- package/dist/i18n/locales/fr.js +20 -0
- package/dist/i18n/locales/hi.d.ts +20 -0
- package/dist/i18n/locales/hi.js +20 -0
- package/dist/i18n/locales/it.d.ts +20 -0
- package/dist/i18n/locales/it.js +20 -0
- package/dist/i18n/locales/ja.d.ts +20 -0
- package/dist/i18n/locales/ja.js +20 -0
- package/dist/i18n/locales/nl.d.ts +20 -0
- package/dist/i18n/locales/nl.js +20 -0
- package/dist/i18n/locales/pl.d.ts +20 -0
- package/dist/i18n/locales/pl.js +20 -0
- package/dist/i18n/locales/pt.d.ts +20 -0
- package/dist/i18n/locales/pt.js +20 -0
- package/dist/i18n/locales/ro.d.ts +20 -0
- package/dist/i18n/locales/ro.js +20 -0
- package/dist/i18n/locales/ru.d.ts +20 -0
- package/dist/i18n/locales/ru.js +20 -0
- package/dist/i18n/locales/sq.d.ts +20 -0
- package/dist/i18n/locales/sq.js +20 -0
- package/dist/i18n/locales/sv.d.ts +20 -0
- package/dist/i18n/locales/sv.js +20 -0
- package/dist/i18n/locales/tr.d.ts +20 -0
- package/dist/i18n/locales/tr.js +20 -0
- package/dist/i18n/locales/zh.d.ts +20 -0
- package/dist/i18n/locales/zh.js +20 -0
- package/dist/index.js +266 -262
- package/dist/locales/ar.json +20 -0
- package/dist/locales/de.json +20 -0
- package/dist/locales/el.json +20 -0
- package/dist/locales/en.json +20 -0
- package/dist/locales/es.json +20 -0
- package/dist/locales/fr.json +20 -0
- package/dist/locales/hi.json +20 -0
- package/dist/locales/it.json +20 -0
- package/dist/locales/ja.json +20 -0
- package/dist/locales/nl.json +20 -0
- package/dist/locales/pl.json +20 -0
- package/dist/locales/pt.json +20 -0
- package/dist/locales/ro.json +20 -0
- package/dist/locales/ru.json +20 -0
- package/dist/locales/sq.json +20 -0
- package/dist/locales/sv.json +20 -0
- package/dist/locales/tr.json +20 -0
- package/dist/locales/zh.json +20 -0
- package/dist/patterns/anamnesis/anamnesis-questionnaire.d.ts +6 -1
- package/dist/patterns/anamnesis/anamnesis-summary-rows.d.ts +32 -0
- package/dist/patterns/anamnesis/anamnesis.d.ts +20 -1
- package/dist/patterns/anamnesis/index.d.ts +2 -1
- package/dist/patterns/anamnesis/index.js +15 -14
- package/dist/tokens.css +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as W, useId as Y, useMemo as L, useImperativeHandle as J } from "react";
|
|
3
|
+
import { c as h } from "./index-D2ZczOXr.js";
|
|
4
|
+
import { useTranslation as Q } from "react-i18next";
|
|
5
|
+
import { B as A } from "./badge-DCOqV9mI.js";
|
|
6
|
+
import { C as f } from "./card-DPmk26CL.js";
|
|
7
|
+
import { K as X, a as Z } from "./key-value-pair-DGkGlgCF.js";
|
|
8
|
+
import { S as w } from "./skeleton-CZbwyJAA.js";
|
|
9
|
+
import { a as ee, T as ae } from "./tooltip-DvmfrNvB.js";
|
|
10
|
+
import { u as se } from "./registry-DvAUVLHh.js";
|
|
11
|
+
import { H as _ } from "./heart-pulse-BCppJyN2.js";
|
|
12
|
+
const te = {
|
|
13
|
+
id: "anamnesis-summary-card",
|
|
14
|
+
// The card is read-only: the only handle method is a getSummary
|
|
15
|
+
// projection, so there is no capability to declare.
|
|
16
|
+
capabilities: [],
|
|
17
|
+
state: {
|
|
18
|
+
summary: {
|
|
19
|
+
type: "{ id?: string; sectionCount: number; answerCount: number; highlightedCount: number; unansweredCount: number }",
|
|
20
|
+
descriptionKey: "ui.agent.anamnesisSummaryCard.state.summary",
|
|
21
|
+
description: "Structural summary of the anamnesis card — section, answer, highlighted and unanswered counts plus the consumer id. Never question labels or answer values.",
|
|
22
|
+
read: (r) => r.getSummary()
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
actions: {},
|
|
26
|
+
domHooks: {
|
|
27
|
+
root: {
|
|
28
|
+
attr: "data-component",
|
|
29
|
+
value: "anamnesis-summary-card",
|
|
30
|
+
description: "Marks the AnamnesisSummaryCard root region."
|
|
31
|
+
},
|
|
32
|
+
instanceId: {
|
|
33
|
+
attr: "data-component-id",
|
|
34
|
+
sourceProp: "id",
|
|
35
|
+
description: "Sourced from the id prop."
|
|
36
|
+
},
|
|
37
|
+
item: {
|
|
38
|
+
attr: "data-answer-id",
|
|
39
|
+
description: "One per answer row (KeyValuePair); the value is the intake field key. Highlighted rows also carry data-highlighted."
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, re = h("ds:w-full ds:text-[color:var(--foreground)]", {
|
|
43
|
+
variants: {
|
|
44
|
+
// Same `surface` vocabulary as PatientSummaryCard / ContactProfileCard.
|
|
45
|
+
// Both surfaces keep the Card chrome — `flat` only drops the shadow.
|
|
46
|
+
surface: {
|
|
47
|
+
flat: "",
|
|
48
|
+
elevated: ""
|
|
49
|
+
},
|
|
50
|
+
density: {
|
|
51
|
+
comfortable: "",
|
|
52
|
+
compact: ""
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
surface: "elevated",
|
|
57
|
+
density: "comfortable"
|
|
58
|
+
}
|
|
59
|
+
}), ne = h("ds:flex ds:flex-col", {
|
|
60
|
+
variants: {
|
|
61
|
+
density: {
|
|
62
|
+
comfortable: "ds:gap-[var(--spacing-lg)]",
|
|
63
|
+
compact: "ds:gap-[var(--spacing-md)]"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
defaultVariants: { density: "comfortable" }
|
|
67
|
+
}), de = h("", {
|
|
68
|
+
variants: {
|
|
69
|
+
density: {
|
|
70
|
+
comfortable: "",
|
|
71
|
+
compact: "ds:p-[var(--spacing-sm)] ds:pb-0"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
defaultVariants: { density: "comfortable" }
|
|
75
|
+
}), ie = h("", {
|
|
76
|
+
variants: {
|
|
77
|
+
density: {
|
|
78
|
+
comfortable: "",
|
|
79
|
+
compact: "ds:p-[var(--spacing-sm)]"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
defaultVariants: { density: "comfortable" }
|
|
83
|
+
}), oe = h("", {
|
|
84
|
+
variants: {
|
|
85
|
+
density: {
|
|
86
|
+
comfortable: "",
|
|
87
|
+
compact: "ds:p-[var(--spacing-sm)] ds:pt-0"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
defaultVariants: { density: "comfortable" }
|
|
91
|
+
}), le = /^(\d{4})-(\d{2})-(\d{2})$/, ce = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?$/, me = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
|
|
92
|
+
function ue(r) {
|
|
93
|
+
const d = le.exec(r);
|
|
94
|
+
if (d)
|
|
95
|
+
return {
|
|
96
|
+
date: new Date(Number(d[1]), Number(d[2]) - 1, Number(d[3])),
|
|
97
|
+
hasTime: !1
|
|
98
|
+
};
|
|
99
|
+
const t = ce.exec(r);
|
|
100
|
+
if (t)
|
|
101
|
+
return {
|
|
102
|
+
date: new Date(
|
|
103
|
+
Number(t[1]),
|
|
104
|
+
Number(t[2]) - 1,
|
|
105
|
+
Number(t[3]),
|
|
106
|
+
Number(t[4]),
|
|
107
|
+
Number(t[5]),
|
|
108
|
+
t[6] ? Number(t[6]) : 0
|
|
109
|
+
),
|
|
110
|
+
hasTime: !0
|
|
111
|
+
};
|
|
112
|
+
const n = new Date(r);
|
|
113
|
+
return Number.isNaN(n.getTime()) ? null : { date: n, hasTime: me.test(r) };
|
|
114
|
+
}
|
|
115
|
+
function he(r, d) {
|
|
116
|
+
const t = ue(r);
|
|
117
|
+
if (!t) return null;
|
|
118
|
+
const n = t.hasTime ? { dateStyle: "medium", timeStyle: "short" } : { dateStyle: "medium" };
|
|
119
|
+
try {
|
|
120
|
+
return new Intl.DateTimeFormat(d, n).format(t.date);
|
|
121
|
+
} catch {
|
|
122
|
+
return new Intl.DateTimeFormat(void 0, n).format(t.date);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const pe = "ds:border-s-2 ds:border-[color:var(--accent)] ds:ps-[var(--spacing-sm)] ds:bg-[color:color-mix(in_srgb,var(--accent)_6%,transparent)]", ge = 'ds:relative ds:inline-flex ds:appearance-none ds:border-0 ds:bg-transparent ds:p-0 ds:m-0 ds:cursor-default ds:rounded-[var(--radius-full)] ds:before:absolute ds:before:content-[""] ds:before:inset-x-[calc((var(--min-target-size)-100%)/-2)] ds:before:inset-y-[calc((var(--min-target-size)-100%)/-2)] ds:sm:before:inset-x-[calc((var(--spacing-lg)-100%)/-2)] ds:sm:before:inset-y-[calc((var(--spacing-lg)-100%)/-2)] ds:focus-visible:outline-[length:var(--focus-ring-width)] ds:focus-visible:outline-solid ds:focus-visible:outline-[var(--ring)] ds:focus-visible:outline-offset-[length:var(--focus-ring-offset)] ds:forced-colors:focus-visible:outline-[CanvasText]', v = "type-body-sm ds:m-0 ds:text-[color:var(--muted-foreground)]", fe = W(
|
|
126
|
+
({
|
|
127
|
+
sections: r,
|
|
128
|
+
title: d,
|
|
129
|
+
subtitle: t,
|
|
130
|
+
unansweredCount: n = 0,
|
|
131
|
+
locale: I,
|
|
132
|
+
highlightedFirst: y = !0,
|
|
133
|
+
surface: N = "elevated",
|
|
134
|
+
density: i = "comfortable",
|
|
135
|
+
loading: p = !1,
|
|
136
|
+
actionSlot: x,
|
|
137
|
+
id: c,
|
|
138
|
+
className: H,
|
|
139
|
+
"aria-label": E,
|
|
140
|
+
...D
|
|
141
|
+
}, P) => {
|
|
142
|
+
const { t: o, i18n: k } = Q(), O = Y(), R = I ?? k.language ?? "en", m = L(
|
|
143
|
+
() => r.filter((s) => s.answers.length > 0).map((s) => ({
|
|
144
|
+
...s,
|
|
145
|
+
answers: y ? [...s.answers].sort(
|
|
146
|
+
(a, u) => +!!u.highlighted - +!!a.highlighted
|
|
147
|
+
) : s.answers
|
|
148
|
+
})),
|
|
149
|
+
[r, y]
|
|
150
|
+
), C = m.reduce(
|
|
151
|
+
(s, a) => s + a.answers.length,
|
|
152
|
+
0
|
|
153
|
+
), g = m.reduce(
|
|
154
|
+
(s, a) => s + a.answers.filter((u) => u.highlighted).length,
|
|
155
|
+
0
|
|
156
|
+
), S = m.length, b = L(
|
|
157
|
+
() => ({
|
|
158
|
+
getSummary: () => ({
|
|
159
|
+
id: c,
|
|
160
|
+
sectionCount: S,
|
|
161
|
+
answerCount: C,
|
|
162
|
+
highlightedCount: g,
|
|
163
|
+
unansweredCount: n
|
|
164
|
+
})
|
|
165
|
+
}),
|
|
166
|
+
[c, S, C, g, n]
|
|
167
|
+
);
|
|
168
|
+
J(P, () => b, [b]), se(te, b, c);
|
|
169
|
+
const B = o("anamnesisSummaryCard.regionLabel", {
|
|
170
|
+
defaultValue: "Anamnesis summary"
|
|
171
|
+
}), T = d ?? B, K = E ?? T, V = o("anamnesisSummaryCard.highlighted", {
|
|
172
|
+
defaultValue: "Highlighted"
|
|
173
|
+
}), M = i === "comfortable" ? "type-title-card" : "type-title-item", $ = i === "comfortable" ? "md" : "sm", z = (s) => {
|
|
174
|
+
const a = s.reportedAtIso ? he(s.reportedAtIso, R) : null, u = a && s.sourceLabel ? o("anamnesisSummaryCard.reportedOnFrom", {
|
|
175
|
+
date: a,
|
|
176
|
+
source: s.sourceLabel,
|
|
177
|
+
defaultValue: "Highlighted on {{date}} · {{source}}"
|
|
178
|
+
}) : a ? o("anamnesisSummaryCard.reportedOn", {
|
|
179
|
+
date: a,
|
|
180
|
+
defaultValue: "Highlighted on {{date}}"
|
|
181
|
+
}) : V;
|
|
182
|
+
return /* @__PURE__ */ e(ae, { label: u, side: "top", children: /* @__PURE__ */ e(
|
|
183
|
+
"button",
|
|
184
|
+
{
|
|
185
|
+
type: "button",
|
|
186
|
+
className: ge,
|
|
187
|
+
"data-highlighted-chip": "",
|
|
188
|
+
children: /* @__PURE__ */ e(
|
|
189
|
+
A,
|
|
190
|
+
{
|
|
191
|
+
variant: "accentSoft",
|
|
192
|
+
size: "sm",
|
|
193
|
+
leading: /* @__PURE__ */ e(_, { "aria-hidden": "true" }),
|
|
194
|
+
children: V
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
}
|
|
198
|
+
) });
|
|
199
|
+
}, F = /* @__PURE__ */ l("div", { className: "ds:flex ds:flex-wrap ds:items-start ds:gap-[var(--spacing-sm)]", children: [
|
|
200
|
+
/* @__PURE__ */ l("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
|
|
201
|
+
/* @__PURE__ */ e(
|
|
202
|
+
"h3",
|
|
203
|
+
{
|
|
204
|
+
id: O,
|
|
205
|
+
className: `ds:m-0 ${M} ds:text-[color:var(--foreground)]`,
|
|
206
|
+
children: T
|
|
207
|
+
}
|
|
208
|
+
),
|
|
209
|
+
t ? /* @__PURE__ */ e("p", { className: v, children: t }) : null
|
|
210
|
+
] }),
|
|
211
|
+
!p && g > 0 ? /* @__PURE__ */ e(
|
|
212
|
+
A,
|
|
213
|
+
{
|
|
214
|
+
variant: "accentSoft",
|
|
215
|
+
size: "sm",
|
|
216
|
+
leading: /* @__PURE__ */ e(_, { "aria-hidden": "true" }),
|
|
217
|
+
className: "ds:shrink-0",
|
|
218
|
+
children: o("anamnesisSummaryCard.highlightedCount", {
|
|
219
|
+
count: g,
|
|
220
|
+
defaultValue: "{{count}} highlighted"
|
|
221
|
+
})
|
|
222
|
+
}
|
|
223
|
+
) : null,
|
|
224
|
+
x ? /* @__PURE__ */ e("div", { className: "ds:ms-auto ds:flex ds:shrink-0 ds:items-center ds:gap-[var(--spacing-xs)]", children: x }) : null
|
|
225
|
+
] }), G = /* @__PURE__ */ l("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
|
|
226
|
+
/* @__PURE__ */ e(w, { variant: "text", width: "40%" }),
|
|
227
|
+
/* @__PURE__ */ e(w, { variant: "text", lines: 4 })
|
|
228
|
+
] }), j = /* @__PURE__ */ e("p", { className: v, children: o("anamnesisSummaryCard.empty", {
|
|
229
|
+
defaultValue: "No answers recorded yet"
|
|
230
|
+
}) }), q = /* @__PURE__ */ e(
|
|
231
|
+
"div",
|
|
232
|
+
{
|
|
233
|
+
role: "group",
|
|
234
|
+
"aria-label": o("anamnesisSummaryCard.sectionsLabel", {
|
|
235
|
+
defaultValue: "Anamnesis sections"
|
|
236
|
+
}),
|
|
237
|
+
className: ne({ density: i }),
|
|
238
|
+
children: m.map((s) => /* @__PURE__ */ l(
|
|
239
|
+
"div",
|
|
240
|
+
{
|
|
241
|
+
"data-section-id": s.id,
|
|
242
|
+
className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
|
|
243
|
+
children: [
|
|
244
|
+
/* @__PURE__ */ e("h4", { className: "ds:m-0 type-eyebrow ds:text-[color:var(--muted-foreground)]", children: s.heading }),
|
|
245
|
+
/* @__PURE__ */ e("div", { className: "ds:@container/afields", children: /* @__PURE__ */ e(
|
|
246
|
+
X,
|
|
247
|
+
{
|
|
248
|
+
rowGap: $,
|
|
249
|
+
className: "ds:@[672px]/afields:grid-cols-[repeat(2,auto_auto_minmax(0,1fr))]",
|
|
250
|
+
children: s.answers.map((a) => /* @__PURE__ */ e(
|
|
251
|
+
Z,
|
|
252
|
+
{
|
|
253
|
+
"data-answer-id": a.id,
|
|
254
|
+
"data-highlighted": a.highlighted ? "" : void 0,
|
|
255
|
+
label: a.sourceLabel ? `${a.label} (${a.sourceLabel})` : a.label,
|
|
256
|
+
className: a.highlighted ? pe : void 0,
|
|
257
|
+
value: /* @__PURE__ */ l("span", { className: "ds:inline-flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] ds:gap-y-[var(--spacing-2xs)]", children: [
|
|
258
|
+
/* @__PURE__ */ e("span", { children: a.value }),
|
|
259
|
+
a.unit ? /* @__PURE__ */ e("span", { className: "type-body-sm ds:text-[color:var(--muted-foreground)]", children: a.unit }) : null,
|
|
260
|
+
a.highlighted ? z(a) : null
|
|
261
|
+
] })
|
|
262
|
+
},
|
|
263
|
+
a.id
|
|
264
|
+
))
|
|
265
|
+
}
|
|
266
|
+
) })
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
s.id
|
|
270
|
+
))
|
|
271
|
+
}
|
|
272
|
+
), U = p ? G : m.length === 0 ? j : q;
|
|
273
|
+
return /* @__PURE__ */ e(
|
|
274
|
+
"div",
|
|
275
|
+
{
|
|
276
|
+
role: "region",
|
|
277
|
+
"aria-label": K,
|
|
278
|
+
"aria-busy": p || void 0,
|
|
279
|
+
"data-component": "anamnesis-summary-card",
|
|
280
|
+
"data-component-id": c,
|
|
281
|
+
"data-density": i,
|
|
282
|
+
id: c,
|
|
283
|
+
className: re({ surface: N, density: i, className: H }),
|
|
284
|
+
...D,
|
|
285
|
+
children: /* @__PURE__ */ l(f, { variant: N === "flat" ? "outlined" : "elevated", children: [
|
|
286
|
+
/* @__PURE__ */ e(f.Header, { className: de({ density: i }), children: F }),
|
|
287
|
+
/* @__PURE__ */ e(ee, { children: /* @__PURE__ */ e(f.Body, { className: ie({ density: i }), children: U }) }),
|
|
288
|
+
!p && n > 0 ? /* @__PURE__ */ e(f.Footer, { className: oe({ density: i }), children: /* @__PURE__ */ e("p", { className: v, children: o("anamnesisSummaryCard.unanswered", {
|
|
289
|
+
count: n,
|
|
290
|
+
defaultValue: "{{count}} questions not answered"
|
|
291
|
+
}) }) }) : null
|
|
292
|
+
] })
|
|
293
|
+
}
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
);
|
|
297
|
+
fe.displayName = "AnamnesisSummaryCard";
|
|
298
|
+
export {
|
|
299
|
+
fe as A,
|
|
300
|
+
te as a
|
|
301
|
+
};
|
|
302
|
+
//# sourceMappingURL=anamnesis-summary-card-BvaSnAbI.js.map
|