@eka-care/medassist-widget 0.1.83 → 0.1.84

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.
@@ -0,0 +1,90 @@
1
+ import { d as l, A as d, y as N, _ as R, u as r, i as z } from "./medassist-widget.js";
2
+ import { C as A, a as M } from "./medassist-widget-chevron-right-CKYbGWbY.js";
3
+ const v = 12, T = 0.76, I = 3;
4
+ function k({ count: s, renderItem: h, className: u }) {
5
+ const [n, x] = l(0), [i, m] = l(0), [y, g] = l(() => Math.min(I, s)), b = d(null), f = d(0), p = d(0);
6
+ if (N(() => {
7
+ g((t) => Math.max(t, Math.min(n + 2, s)));
8
+ }, [n, s]), R(() => {
9
+ const t = b.current;
10
+ if (!t) return;
11
+ m(t.clientWidth);
12
+ const e = new ResizeObserver(([a]) => m(a.contentRect.width));
13
+ return e.observe(t), () => e.disconnect();
14
+ }, []), s === 0) return null;
15
+ const o = (t) => x(Math.max(0, Math.min(s - 1, t)));
16
+ if (s === 1)
17
+ return /* @__PURE__ */ r("div", { className: u ?? "mt-3", children: h(0, !0) });
18
+ const c = i * T, C = (i - c) / 2, w = i > 0 ? C - n * (c + v) : 0;
19
+ return /* @__PURE__ */ r("div", { ref: b, className: z("mt-3 w-full", u), children: i > 0 && /* Relative wrapper so buttons sit outside overflow but share the same stacking context */
20
+ /* @__PURE__ */ r("div", { className: "relative w-full", children: [
21
+ /* @__PURE__ */ r(
22
+ "div",
23
+ {
24
+ className: "w-full overflow-hidden py-3",
25
+ onTouchStart: (t) => {
26
+ f.current = t.touches[0].clientX, p.current = t.touches[0].clientY;
27
+ },
28
+ onTouchEnd: (t) => {
29
+ const e = t.changedTouches[0].clientX - f.current, a = t.changedTouches[0].clientY - p.current;
30
+ Math.abs(e) > Math.abs(a) && Math.abs(e) > 50 && o(n + (e < 0 ? 1 : -1));
31
+ },
32
+ children: /* @__PURE__ */ r(
33
+ "div",
34
+ {
35
+ className: "flex items-stretch",
36
+ style: {
37
+ transform: `translateX(${w}px)`,
38
+ transition: "transform 400ms cubic-bezier(0.4, 0, 0.2, 1)",
39
+ gap: `${v}px`
40
+ },
41
+ "aria-live": "polite",
42
+ children: Array.from({ length: y }, (t, e) => {
43
+ const a = e === n;
44
+ return /* @__PURE__ */ r(
45
+ "div",
46
+ {
47
+ "aria-hidden": !a,
48
+ style: {
49
+ flex: `0 0 ${c}px`,
50
+ position: "relative",
51
+ opacity: a ? 1 : 0.6,
52
+ transform: a ? "scale(1.05)" : "scale(0.9)",
53
+ zIndex: a ? 20 : 10,
54
+ transition: "all 400ms cubic-bezier(0.4, 0, 0.2, 1)",
55
+ borderRadius: 12
56
+ },
57
+ children: h(e, a)
58
+ },
59
+ e
60
+ );
61
+ })
62
+ }
63
+ )
64
+ }
65
+ ),
66
+ n > 0 && /* @__PURE__ */ r(
67
+ "button",
68
+ {
69
+ type: "button",
70
+ "aria-label": "Previous",
71
+ onClick: () => o(n - 1),
72
+ className: "absolute left-0 top-1/2 -translate-y-1/2 z-10 h-10 w-10 p-2 flex items-center justify-center rounded-full bg-background/90 shadow-md border border-primary text-primary hover:bg-muted transition-colors",
73
+ children: /* @__PURE__ */ r(A, { size: 18 })
74
+ }
75
+ ),
76
+ n < s - 1 && /* @__PURE__ */ r(
77
+ "button",
78
+ {
79
+ type: "button",
80
+ "aria-label": "Next",
81
+ onClick: () => o(n + 1),
82
+ className: "absolute right-0 top-1/2 -translate-y-1/2 z-10 h-10 w-10 p-2 flex items-center justify-center rounded-full bg-background/90 shadow-md border border-primary text-primary hover:bg-muted transition-colors",
83
+ children: /* @__PURE__ */ r(M, { size: 18 })
84
+ }
85
+ )
86
+ ] }) });
87
+ }
88
+ export {
89
+ k as FocusCarousel
90
+ };
@@ -0,0 +1,85 @@
1
+ import { c as m, A as u, u as e, t as h, r as f, S as p, B as g } from "./medassist-widget.js";
2
+ const x = [
3
+ [
4
+ "path",
5
+ {
6
+ d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",
7
+ key: "18u6gg"
8
+ }
9
+ ],
10
+ ["circle", { cx: "12", cy: "13", r: "3", key: "1vg3eu" }]
11
+ ], w = m("camera", x);
12
+ const b = [
13
+ ["path", { d: "M12 15V3", key: "m9g1x1" }],
14
+ ["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
15
+ ["path", { d: "m7 10 5 5 5-5", key: "brsn70" }]
16
+ ], v = m("download", b);
17
+ function i(a) {
18
+ return a.toLowerCase().endsWith(".pdf");
19
+ }
20
+ function y(a) {
21
+ const n = document?.createElement("a");
22
+ n.href = a, n.download = a.split("/").pop() ?? "download.pdf", n.target = "_blank", n.click(), document?.body?.removeChild(n);
23
+ }
24
+ async function N(a) {
25
+ if (!a.current) return;
26
+ const n = (await import("./medassist-widget-html2canvas.esm-CphxV6YW.js")).default, o = await n(a.current, { useCORS: !0 }), t = document.createElement("a");
27
+ t.href = o.toDataURL("image/png"), t.download = "card.png", t.click();
28
+ }
29
+ async function k(a) {
30
+ if (!a.current) return;
31
+ const n = (await import("./medassist-widget-html2canvas.esm-CphxV6YW.js")).default, o = await n(a.current, { useCORS: !0 }), t = document.createElement("a");
32
+ t.href = o.toDataURL("image/png"), t.download = `screenshot-${Date.now()}.png`, t.click();
33
+ }
34
+ function _({ card: a }) {
35
+ const { title: n, description: o, tags_text: t, banner_text: l, action: c, link: r } = a, s = u(null), d = r && !i(r);
36
+ return /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: [
37
+ /* @__PURE__ */ e(
38
+ h,
39
+ {
40
+ ref: s,
41
+ className: "overflow-hidden rounded-xl border border-border bg-elicitationBg text-card-foreground shadow-sm",
42
+ children: /* @__PURE__ */ e(f, { className: "p-3 space-y-2", children: [
43
+ /* @__PURE__ */ e("div", { className: `flex items-start gap-3 ${d ? "justify-between" : "justify-center"}`, children: [
44
+ /* @__PURE__ */ e("div", { className: `space-y-2 ${d ? "min-w-0 flex-1" : "flex flex-col items-center"}`, children: [
45
+ n && /* @__PURE__ */ e("span", { className: "inline-block rounded-full px-3 py-1 text-sm font-semibold bg-primary text-primary-foreground", children: n }),
46
+ o && /* @__PURE__ */ e("p", { className: `text-sm text-foreground leading-snug ${d ? "" : "text-center"}`, children: o }),
47
+ l && /* @__PURE__ */ e("span", { className: "inline-block rounded-full px-3 py-1 text-xs font-semibold bg-green-600 text-white", children: l })
48
+ ] }),
49
+ d && /* @__PURE__ */ e("div", { className: "shrink-0 h-24 w-24 rounded-lg overflow-hidden border border-border", children: /* @__PURE__ */ e(
50
+ "img",
51
+ {
52
+ src: r,
53
+ alt: n ?? "media",
54
+ className: "h-full w-full object-cover"
55
+ }
56
+ ) })
57
+ ] }),
58
+ t && /* @__PURE__ */ e(p, { children: [
59
+ /* @__PURE__ */ e("div", { className: "border-t border-border" }),
60
+ /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: t })
61
+ ] })
62
+ ] })
63
+ }
64
+ ),
65
+ c && /* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ e(
66
+ g,
67
+ {
68
+ type: "button",
69
+ variant: "outline",
70
+ size: "sm",
71
+ className: "rounded-md px-5 gap-1.5",
72
+ onClick: () => {
73
+ c === "screenshot" ? k(s) : c === "download" && (r && i(r) ? y(r) : N(s));
74
+ },
75
+ children: [
76
+ c === "screenshot" ? /* @__PURE__ */ e(w, { className: "h-4 w-4" }) : /* @__PURE__ */ e(v, { className: "h-4 w-4" }),
77
+ c === "screenshot" ? "Screenshot" : "Download"
78
+ ]
79
+ }
80
+ ) })
81
+ ] });
82
+ }
83
+ export {
84
+ _ as MediaCard
85
+ };
@@ -0,0 +1,414 @@
1
+ import { A as x, y as E, q as X, d as _, R as j, b as O, T as Y, D as y, e as J, u as l, P as S, f as Q, S as D, g as T, h as M, i as N } from "./medassist-widget.js";
2
+ import { C as Z } from "./medassist-widget-check-BaHLRs-2.js";
3
+ var V = j[" useInsertionEffect ".trim().toString()] || O;
4
+ function ee({
5
+ prop: e,
6
+ defaultProp: r,
7
+ onChange: c = () => {
8
+ },
9
+ caller: a
10
+ }) {
11
+ const [s, o, i] = re({
12
+ defaultProp: r,
13
+ onChange: c
14
+ }), d = e !== void 0, t = d ? e : s;
15
+ {
16
+ const b = x(e !== void 0);
17
+ E(() => {
18
+ const h = b.current;
19
+ if (h !== d) {
20
+ const p = h ? "controlled" : "uncontrolled", g = d ? "controlled" : "uncontrolled";
21
+ }
22
+ b.current = d;
23
+ }, [d, a]);
24
+ }
25
+ const v = X(
26
+ (b) => {
27
+ if (d) {
28
+ const h = te(b) ? b(e) : b;
29
+ h !== e && i.current?.(h);
30
+ } else
31
+ o(b);
32
+ },
33
+ [d, e, o, i]
34
+ );
35
+ return [t, v];
36
+ }
37
+ function re({
38
+ defaultProp: e,
39
+ onChange: r
40
+ }) {
41
+ const [c, a] = _(e), s = x(c), o = x(r);
42
+ return V(() => {
43
+ o.current = r;
44
+ }, [r]), E(() => {
45
+ s.current !== c && (o.current?.(c), s.current = c);
46
+ }, [c, s]), [c, a, o];
47
+ }
48
+ function te(e) {
49
+ return typeof e == "function";
50
+ }
51
+ function ne(e) {
52
+ const r = x({ value: e, previous: e });
53
+ return Y(() => (r.current.value !== e && (r.current.previous = r.current.value, r.current.value = e), r.current.previous), [e]);
54
+ }
55
+ function oe(e) {
56
+ const [r, c] = _(void 0);
57
+ return O(() => {
58
+ if (e) {
59
+ c({ width: e.offsetWidth, height: e.offsetHeight });
60
+ const a = new ResizeObserver((s) => {
61
+ if (!Array.isArray(s) || !s.length)
62
+ return;
63
+ const o = s[0];
64
+ let i, d;
65
+ if ("borderBoxSize" in o) {
66
+ const t = o.borderBoxSize, v = Array.isArray(t) ? t[0] : t;
67
+ i = v.inlineSize, d = v.blockSize;
68
+ } else
69
+ i = e.offsetWidth, d = e.offsetHeight;
70
+ c({ width: i, height: d });
71
+ });
72
+ return a.observe(e, { box: "border-box" }), () => a.unobserve(e);
73
+ } else
74
+ c(void 0);
75
+ }, [e]), r;
76
+ }
77
+ var P = "Checkbox", [ce] = J(P), [se, z] = ce(P);
78
+ function ie(e) {
79
+ const {
80
+ __scopeCheckbox: r,
81
+ checked: c,
82
+ children: a,
83
+ defaultChecked: s,
84
+ disabled: o,
85
+ form: i,
86
+ name: d,
87
+ onCheckedChange: t,
88
+ required: v,
89
+ value: b = "on",
90
+ // @ts-expect-error
91
+ internal_do_not_use_render: h
92
+ } = e, [p, g] = ee({
93
+ prop: c,
94
+ defaultProp: s ?? !1,
95
+ onChange: t,
96
+ caller: P
97
+ }), [C, n] = _(null), [m, u] = _(null), f = x(!1), w = C ? !!i || !!C.closest("form") : (
98
+ // We set this to true by default so that events bubble to forms without JS (SSR)
99
+ !0
100
+ ), I = {
101
+ checked: p,
102
+ disabled: o,
103
+ setChecked: g,
104
+ control: C,
105
+ setControl: n,
106
+ name: d,
107
+ form: i,
108
+ value: b,
109
+ hasConsumerStoppedPropagationRef: f,
110
+ required: v,
111
+ defaultChecked: k(s) ? !1 : s,
112
+ isFormControl: w,
113
+ bubbleInput: m,
114
+ setBubbleInput: u
115
+ };
116
+ return /* @__PURE__ */ l(
117
+ se,
118
+ {
119
+ scope: r,
120
+ ...I,
121
+ children: ae(h) ? h(I) : a
122
+ }
123
+ );
124
+ }
125
+ var $ = "CheckboxTrigger", q = y(
126
+ ({ __scopeCheckbox: e, onKeyDown: r, onClick: c, ...a }, s) => {
127
+ const {
128
+ control: o,
129
+ value: i,
130
+ disabled: d,
131
+ checked: t,
132
+ required: v,
133
+ setControl: b,
134
+ setChecked: h,
135
+ hasConsumerStoppedPropagationRef: p,
136
+ isFormControl: g,
137
+ bubbleInput: C
138
+ } = z($, e), n = T(s, b), m = x(t);
139
+ return E(() => {
140
+ const u = o?.form;
141
+ if (u) {
142
+ const f = () => h(m.current);
143
+ return u.addEventListener("reset", f), () => u.removeEventListener("reset", f);
144
+ }
145
+ }, [o, h]), /* @__PURE__ */ l(
146
+ S.button,
147
+ {
148
+ type: "button",
149
+ role: "checkbox",
150
+ "aria-checked": k(t) ? "mixed" : t,
151
+ "aria-required": v,
152
+ "data-state": G(t),
153
+ "data-disabled": d ? "" : void 0,
154
+ disabled: d,
155
+ value: i,
156
+ ...a,
157
+ ref: n,
158
+ onKeyDown: M(r, (u) => {
159
+ u.key === "Enter" && u.preventDefault();
160
+ }),
161
+ onClick: M(c, (u) => {
162
+ h((f) => k(f) ? !0 : !f), C && g && (p.current = u.isPropagationStopped(), p.current || u.stopPropagation());
163
+ })
164
+ }
165
+ );
166
+ }
167
+ );
168
+ q.displayName = $;
169
+ var A = y(
170
+ (e, r) => {
171
+ const {
172
+ __scopeCheckbox: c,
173
+ name: a,
174
+ checked: s,
175
+ defaultChecked: o,
176
+ required: i,
177
+ disabled: d,
178
+ value: t,
179
+ onCheckedChange: v,
180
+ form: b,
181
+ ...h
182
+ } = e;
183
+ return /* @__PURE__ */ l(
184
+ ie,
185
+ {
186
+ __scopeCheckbox: c,
187
+ checked: s,
188
+ defaultChecked: o,
189
+ disabled: d,
190
+ required: i,
191
+ onCheckedChange: v,
192
+ name: a,
193
+ form: b,
194
+ value: t,
195
+ internal_do_not_use_render: ({ isFormControl: p }) => /* @__PURE__ */ l(D, { children: [
196
+ /* @__PURE__ */ l(
197
+ q,
198
+ {
199
+ ...h,
200
+ ref: r,
201
+ __scopeCheckbox: c
202
+ }
203
+ ),
204
+ p && /* @__PURE__ */ l(
205
+ U,
206
+ {
207
+ __scopeCheckbox: c
208
+ }
209
+ )
210
+ ] })
211
+ }
212
+ );
213
+ }
214
+ );
215
+ A.displayName = P;
216
+ var F = "CheckboxIndicator", H = y(
217
+ (e, r) => {
218
+ const { __scopeCheckbox: c, forceMount: a, ...s } = e, o = z(F, c);
219
+ return /* @__PURE__ */ l(
220
+ Q,
221
+ {
222
+ present: a || k(o.checked) || o.checked === !0,
223
+ children: /* @__PURE__ */ l(
224
+ S.span,
225
+ {
226
+ "data-state": G(o.checked),
227
+ "data-disabled": o.disabled ? "" : void 0,
228
+ ...s,
229
+ ref: r,
230
+ style: { pointerEvents: "none", ...e.style }
231
+ }
232
+ )
233
+ }
234
+ );
235
+ }
236
+ );
237
+ H.displayName = F;
238
+ var L = "CheckboxBubbleInput", U = y(
239
+ ({ __scopeCheckbox: e, ...r }, c) => {
240
+ const {
241
+ control: a,
242
+ hasConsumerStoppedPropagationRef: s,
243
+ checked: o,
244
+ defaultChecked: i,
245
+ required: d,
246
+ disabled: t,
247
+ name: v,
248
+ value: b,
249
+ form: h,
250
+ bubbleInput: p,
251
+ setBubbleInput: g
252
+ } = z(L, e), C = T(c, g), n = ne(o), m = oe(a);
253
+ E(() => {
254
+ const f = p;
255
+ if (!f) return;
256
+ const w = window.HTMLInputElement.prototype, B = Object.getOwnPropertyDescriptor(
257
+ w,
258
+ "checked"
259
+ ).set, K = !s.current;
260
+ if (n !== o && B) {
261
+ const W = new Event("click", { bubbles: K });
262
+ f.indeterminate = k(o), B.call(f, k(o) ? !1 : o), f.dispatchEvent(W);
263
+ }
264
+ }, [p, n, o, s]);
265
+ const u = x(k(o) ? !1 : o);
266
+ return /* @__PURE__ */ l(
267
+ S.input,
268
+ {
269
+ type: "checkbox",
270
+ "aria-hidden": !0,
271
+ defaultChecked: i ?? u.current,
272
+ required: d,
273
+ disabled: t,
274
+ name: v,
275
+ value: b,
276
+ form: h,
277
+ ...r,
278
+ tabIndex: -1,
279
+ ref: C,
280
+ style: {
281
+ ...r.style,
282
+ ...m,
283
+ position: "absolute",
284
+ pointerEvents: "none",
285
+ opacity: 0,
286
+ margin: 0,
287
+ // We transform because the input is absolutely positioned but we have
288
+ // rendered it **after** the button. This pulls it back to sit on top
289
+ // of the button.
290
+ transform: "translateX(-100%)"
291
+ }
292
+ }
293
+ );
294
+ }
295
+ );
296
+ U.displayName = L;
297
+ function ae(e) {
298
+ return typeof e == "function";
299
+ }
300
+ function k(e) {
301
+ return e === "indeterminate";
302
+ }
303
+ function G(e) {
304
+ return k(e) ? "indeterminate" : e ? "checked" : "unchecked";
305
+ }
306
+ const R = y(({ className: e, ...r }, c) => /* @__PURE__ */ l(
307
+ A,
308
+ {
309
+ ref: c,
310
+ className: N(
311
+ "grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
312
+ e
313
+ ),
314
+ ...r,
315
+ children: /* @__PURE__ */ l(
316
+ H,
317
+ {
318
+ className: N("grid place-content-center text-current"),
319
+ children: /* @__PURE__ */ l(Z, { className: "h-4 w-4" })
320
+ }
321
+ )
322
+ }
323
+ ));
324
+ R.displayName = A.displayName;
325
+ function ue({
326
+ options: e,
327
+ selectedValues: r,
328
+ onSelectionChange: c,
329
+ additionalOption: a,
330
+ className: s,
331
+ required: o = !0,
332
+ maxSelections: i,
333
+ // error,
334
+ disabled: d
335
+ }) {
336
+ const t = a ? {
337
+ id: `extra-${a}`,
338
+ label: a === "all_of_the_above" ? "All of the above" : "None of the above",
339
+ value: a === "all_of_the_above" ? "All of the above" : "None of the above"
340
+ } : null, v = (n) => t ? n.filter((m) => m !== t.value) : n, b = (n) => t ? a === "none_of_the_above" ? n ? [t.value] : [] : a === "all_of_the_above" ? n ? [...e.map((m) => m.value), t.value] : v(r) : n ? [...r, t.value] : v(r) : r, h = (n, m) => {
341
+ const u = t ? v(r) : r;
342
+ return m ? i && u.length >= i ? null : [...u, n] : u.filter((f) => f !== n);
343
+ }, p = (n) => !(o && n.length === 0 && r.length === 1), g = (n, m) => {
344
+ const f = t && n === t.value ? b(m) : h(n, m);
345
+ f !== null && p(f) && c(f);
346
+ }, C = t ? r.filter((n) => n !== t.value).length : r.length;
347
+ return e.length ? /* @__PURE__ */ l(
348
+ "div",
349
+ {
350
+ className: N(
351
+ s
352
+ ),
353
+ children: [
354
+ /* @__PURE__ */ l("div", { className: "space-y-3", children: [
355
+ e.map((n) => {
356
+ const m = d || i && C >= i && !r.includes(n.value);
357
+ let u = r.includes(n.value);
358
+ return /* @__PURE__ */ l("div", { className: "flex items-center space-x-3", children: [
359
+ /* @__PURE__ */ l(
360
+ R,
361
+ {
362
+ id: n.id,
363
+ checked: u,
364
+ disabled: !!m,
365
+ onCheckedChange: (f) => g(n.value, !!f),
366
+ className: "mt-0.5 border border-muted-foreground text-primary-foreground"
367
+ }
368
+ ),
369
+ /* @__PURE__ */ l(
370
+ "label",
371
+ {
372
+ htmlFor: n.id,
373
+ className: N(
374
+ // Using the same muted color scheme as your other components
375
+ "text-sm font-normal leading-4 cursor-pointer",
376
+ m ? "text-muted-foreground cursor-not-allowed" : u ? "text-primary" : "text-secondary-foreground"
377
+ // Dark grey like other components
378
+ ),
379
+ children: n.label
380
+ }
381
+ )
382
+ ] }, n.id);
383
+ }),
384
+ t && /* @__PURE__ */ l(D, { children: [
385
+ /* @__PURE__ */ l("div", { className: "border-t border-border-medium my-3" }),
386
+ /* @__PURE__ */ l("div", { className: "flex items-center space-x-3", children: [
387
+ /* @__PURE__ */ l(
388
+ R,
389
+ {
390
+ id: t.id,
391
+ checked: r.includes(t.value),
392
+ onCheckedChange: (n) => g(t.value, n),
393
+ className: "mt-0.5 border border-muted-foreground"
394
+ }
395
+ ),
396
+ /* @__PURE__ */ l(
397
+ "label",
398
+ {
399
+ htmlFor: t.id,
400
+ className: "text-sm font-medium leading-none cursor-pointer text-secondary-foreground",
401
+ children: t.label
402
+ }
403
+ )
404
+ ] })
405
+ ] })
406
+ ] }),
407
+ i && C >= i && /* @__PURE__ */ l("p", { className: "text-sm text-blue-600 mt-3", children: i === 1 ? "You can select only 1 option" : `Maximum ${i} selections allowed` })
408
+ ]
409
+ }
410
+ ) : null;
411
+ }
412
+ export {
413
+ ue as MultiSelectGroup
414
+ };