@alfadocs/ui-kit 1.4.9 → 1.4.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfadocs/ui-kit",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "type": "module",
5
5
  "description": "AlfaDocs shared design system — tokens, components, patterns, and translations for platform, booking, and alfascribe.",
6
6
  "license": "BUSL-1.1",
@@ -1,346 +0,0 @@
1
- import { jsxs as n, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as ae, useId as se, useMemo as I, useImperativeHandle as te } from "react";
3
- import { c as h } from "./index-D2ZczOXr.js";
4
- import { useTranslation as re } from "react-i18next";
5
- import { B as H } from "./badge-DCOqV9mI.js";
6
- import { C as f } from "./card-DPmk26CL.js";
7
- import { K as E, a as D } from "./key-value-pair-DGkGlgCF.js";
8
- import { S as P } from "./skeleton-CZbwyJAA.js";
9
- import { a as de, T as ne } from "./tooltip-DvmfrNvB.js";
10
- import { u as ie } from "./registry-DvAUVLHh.js";
11
- import { H as k } from "./heart-pulse-BCppJyN2.js";
12
- const le = {
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
- }, oe = 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
- }), ce = 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
- }), me = h("", {
68
- variants: {
69
- density: {
70
- comfortable: "",
71
- compact: "ds:p-[var(--spacing-sm)] ds:pb-0"
72
- }
73
- },
74
- defaultVariants: { density: "comfortable" }
75
- }), ue = h("", {
76
- variants: {
77
- density: {
78
- comfortable: "",
79
- compact: "ds:p-[var(--spacing-sm)]"
80
- }
81
- },
82
- defaultVariants: { density: "comfortable" }
83
- }), he = h("", {
84
- variants: {
85
- density: {
86
- comfortable: "",
87
- compact: "ds:p-[var(--spacing-sm)] ds:pt-0"
88
- }
89
- },
90
- defaultVariants: { density: "comfortable" }
91
- }), pe = /^(\d{4})-(\d{2})-(\d{2})$/, ge = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?$/, fe = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/;
92
- function ve(r) {
93
- const l = pe.exec(r);
94
- if (l)
95
- return {
96
- date: new Date(Number(l[1]), Number(l[2]) - 1, Number(l[3])),
97
- hasTime: !1
98
- };
99
- const t = ge.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 d = new Date(r);
113
- return Number.isNaN(d.getTime()) ? null : { date: d, hasTime: fe.test(r) };
114
- }
115
- function B(r, l) {
116
- const t = ve(r);
117
- if (!t) return null;
118
- const d = t.hasTime ? { dateStyle: "medium", timeStyle: "short" } : { dateStyle: "medium" };
119
- try {
120
- return new Intl.DateTimeFormat(l, d).format(t.date);
121
- } catch {
122
- return new Intl.DateTimeFormat(void 0, d).format(t.date);
123
- }
124
- }
125
- const be = "ds:rounded-[var(--radius-md)] ds:bg-[color:color-mix(in_srgb,var(--accent)_6%,transparent)] ds:px-[var(--spacing-xs)] ds:-mx-[var(--spacing-xs)]", ye = '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)]", xe = ae(
126
- ({
127
- sections: r,
128
- title: l,
129
- subtitle: t,
130
- unansweredCount: d = 0,
131
- locale: O,
132
- highlightedFirst: y = !0,
133
- highlightedGroup: R = !0,
134
- surface: x = "elevated",
135
- density: o = "comfortable",
136
- loading: p = !1,
137
- actionSlot: N,
138
- id: u,
139
- className: K,
140
- "aria-label": M,
141
- ...z
142
- }, G) => {
143
- const { t: i, i18n: $ } = re(), j = se(), C = O ?? $.language ?? "en", m = I(
144
- () => r.filter((e) => e.answers.length > 0).map((e) => ({
145
- ...e,
146
- answers: y ? [...e.answers].sort(
147
- (s, c) => +!!c.highlighted - +!!s.highlighted
148
- ) : e.answers
149
- })),
150
- [r, y]
151
- ), S = m.reduce(
152
- (e, s) => e + s.answers.length,
153
- 0
154
- ), g = m.reduce(
155
- (e, s) => e + s.answers.filter((c) => c.highlighted).length,
156
- 0
157
- ), T = m.length, A = m.flatMap(
158
- (e) => e.answers.filter((s) => s.highlighted)
159
- ), V = (e) => {
160
- const s = e.reportedAtIso ? B(e.reportedAtIso, C) : null, c = [e.sourceLabel, s].filter(
161
- (ee) => !!ee
162
- );
163
- return c.length > 0 ? c.join(" · ") : null;
164
- }, b = I(
165
- () => ({
166
- getSummary: () => ({
167
- id: u,
168
- sectionCount: T,
169
- answerCount: S,
170
- highlightedCount: g,
171
- unansweredCount: d
172
- })
173
- }),
174
- [u, T, S, g, d]
175
- );
176
- te(G, () => b, [b]), ie(le, b, u);
177
- const F = i("anamnesisSummaryCard.regionLabel", {
178
- defaultValue: "Anamnesis summary"
179
- }), L = l ?? F, q = M ?? L, _ = i("anamnesisSummaryCard.highlighted", {
180
- defaultValue: "Highlighted"
181
- }), U = o === "comfortable" ? "type-title-card" : "type-title-item", w = o === "comfortable" ? "md" : "sm", W = (e) => {
182
- const s = e.reportedAtIso ? B(e.reportedAtIso, C) : null, c = s && e.sourceLabel ? i("anamnesisSummaryCard.reportedOnFrom", {
183
- date: s,
184
- source: e.sourceLabel,
185
- defaultValue: "Highlighted on {{date}} · {{source}}"
186
- }) : s ? i("anamnesisSummaryCard.reportedOn", {
187
- date: s,
188
- defaultValue: "Highlighted on {{date}}"
189
- }) : _;
190
- return /* @__PURE__ */ a(ne, { label: c, side: "top", children: /* @__PURE__ */ a(
191
- "button",
192
- {
193
- type: "button",
194
- className: ye,
195
- "data-highlighted-chip": "",
196
- children: /* @__PURE__ */ a(
197
- H,
198
- {
199
- variant: "accentSoft",
200
- size: "sm",
201
- leading: /* @__PURE__ */ a(k, { "aria-hidden": "true" }),
202
- children: _
203
- }
204
- )
205
- }
206
- ) });
207
- }, Y = /* @__PURE__ */ n("div", { className: "ds:flex ds:flex-wrap ds:items-start ds:gap-[var(--spacing-sm)]", children: [
208
- /* @__PURE__ */ n("div", { className: "ds:flex ds:min-w-0 ds:flex-1 ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
209
- /* @__PURE__ */ a(
210
- "h3",
211
- {
212
- id: j,
213
- className: `ds:m-0 ${U} ds:text-[color:var(--foreground)]`,
214
- children: L
215
- }
216
- ),
217
- t ? /* @__PURE__ */ a("p", { className: v, children: t }) : null
218
- ] }),
219
- !p && g > 0 ? /* @__PURE__ */ a(
220
- H,
221
- {
222
- variant: "accentSoft",
223
- size: "sm",
224
- leading: /* @__PURE__ */ a(k, { "aria-hidden": "true" }),
225
- className: "ds:shrink-0",
226
- children: i("anamnesisSummaryCard.highlightedCount", {
227
- count: g,
228
- defaultValue: "{{count}} highlighted"
229
- })
230
- }
231
- ) : null,
232
- N ? /* @__PURE__ */ a("div", { className: "ds:ms-auto ds:flex ds:shrink-0 ds:items-center ds:gap-[var(--spacing-xs)]", children: N }) : null
233
- ] }), J = /* @__PURE__ */ n("div", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]", children: [
234
- /* @__PURE__ */ a(P, { variant: "text", width: "40%" }),
235
- /* @__PURE__ */ a(P, { variant: "text", lines: 4 })
236
- ] }), Q = /* @__PURE__ */ a("p", { className: v, children: i("anamnesisSummaryCard.empty", {
237
- defaultValue: "No answers recorded yet"
238
- }) }), X = /* @__PURE__ */ n(
239
- "div",
240
- {
241
- role: "group",
242
- "aria-label": i("anamnesisSummaryCard.sectionsLabel", {
243
- defaultValue: "Anamnesis sections"
244
- }),
245
- className: ce({ density: o }),
246
- children: [
247
- R && A.length > 0 ? /* @__PURE__ */ n(
248
- "div",
249
- {
250
- "data-highlighted-group": "",
251
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
252
- children: [
253
- /* @__PURE__ */ a("h4", { className: "ds:m-0 type-eyebrow ds:text-[color:var(--muted-foreground)]", children: i("anamnesisSummaryCard.highlightedGroup", {
254
- defaultValue: "Highlighted answers"
255
- }) }),
256
- /* @__PURE__ */ a("div", { className: "ds:@container/afields", children: /* @__PURE__ */ a(
257
- E,
258
- {
259
- rowGap: w,
260
- className: "ds:@[672px]/afields:grid-cols-[repeat(2,auto_auto_minmax(0,1fr))]",
261
- children: A.map((e) => /* @__PURE__ */ a(
262
- D,
263
- {
264
- "data-answer-id": e.id,
265
- label: e.label,
266
- value: /* @__PURE__ */ n("span", { className: "ds:flex ds:flex-col ds:gap-[var(--spacing-2xs)]", children: [
267
- /* @__PURE__ */ n("span", { className: "ds:inline-flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)]", children: [
268
- /* @__PURE__ */ a("span", { children: e.value }),
269
- e.unit ? /* @__PURE__ */ a("span", { className: "type-body-sm ds:text-[color:var(--muted-foreground)]", children: e.unit }) : null
270
- ] }),
271
- V(e) ? /* @__PURE__ */ a("span", { className: v, children: V(e) }) : null
272
- ] })
273
- },
274
- `highlighted-${e.id}`
275
- ))
276
- }
277
- ) })
278
- ]
279
- }
280
- ) : null,
281
- m.map((e) => /* @__PURE__ */ n(
282
- "div",
283
- {
284
- "data-section-id": e.id,
285
- className: "ds:flex ds:flex-col ds:gap-[var(--spacing-sm)]",
286
- children: [
287
- /* @__PURE__ */ a("h4", { className: "ds:m-0 type-eyebrow ds:text-[color:var(--muted-foreground)]", children: e.heading }),
288
- /* @__PURE__ */ a("div", { className: "ds:@container/afields", children: /* @__PURE__ */ a(
289
- E,
290
- {
291
- rowGap: w,
292
- className: "ds:@[672px]/afields:grid-cols-[repeat(2,auto_auto_minmax(0,1fr))]",
293
- children: e.answers.map((s) => /* @__PURE__ */ a(
294
- D,
295
- {
296
- "data-answer-id": s.id,
297
- "data-highlighted": s.highlighted ? "" : void 0,
298
- label: s.label,
299
- className: s.highlighted ? be : void 0,
300
- value: /* @__PURE__ */ n("span", { className: "ds:inline-flex ds:flex-wrap ds:items-center ds:gap-x-[var(--spacing-xs)] ds:gap-y-[var(--spacing-2xs)]", children: [
301
- /* @__PURE__ */ a("span", { children: s.value }),
302
- s.unit ? /* @__PURE__ */ a("span", { className: "type-body-sm ds:text-[color:var(--muted-foreground)]", children: s.unit }) : null,
303
- s.highlighted ? W(s) : null
304
- ] })
305
- },
306
- s.id
307
- ))
308
- }
309
- ) })
310
- ]
311
- },
312
- e.id
313
- ))
314
- ]
315
- }
316
- ), Z = p ? J : m.length === 0 ? Q : X;
317
- return /* @__PURE__ */ a(
318
- "div",
319
- {
320
- role: "region",
321
- "aria-label": q,
322
- "aria-busy": p || void 0,
323
- "data-component": "anamnesis-summary-card",
324
- "data-component-id": u,
325
- "data-density": o,
326
- id: u,
327
- className: oe({ surface: x, density: o, className: K }),
328
- ...z,
329
- children: /* @__PURE__ */ n(f, { variant: x === "flat" ? "outlined" : "elevated", children: [
330
- /* @__PURE__ */ a(f.Header, { className: me({ density: o }), children: Y }),
331
- /* @__PURE__ */ a(de, { children: /* @__PURE__ */ a(f.Body, { className: ue({ density: o }), children: Z }) }),
332
- !p && d > 0 ? /* @__PURE__ */ a(f.Footer, { className: he({ density: o }), children: /* @__PURE__ */ a("p", { className: v, children: i("anamnesisSummaryCard.unanswered", {
333
- count: d,
334
- defaultValue: "{{count}} questions not answered"
335
- }) }) }) : null
336
- ] })
337
- }
338
- );
339
- }
340
- );
341
- xe.displayName = "AnamnesisSummaryCard";
342
- export {
343
- xe as A,
344
- le as a
345
- };
346
- //# sourceMappingURL=anamnesis-summary-card-FNSkuUMB.js.map