@eka-care/medassist-widget 0.1.124-dev.5 → 0.1.125-dev.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/medassist-widget-CardList-ST569rut.js +1 -0
- package/dist/medassist-widget-DoctorCard-B_xw-xWd.js +1 -0
- package/dist/medassist-widget-ElicitationInput-DKEz5EVH.js +1 -0
- package/dist/medassist-widget-FocusCarousel-af7aMXWo.js +1 -0
- package/dist/medassist-widget-MediaCard-CLipu6gc.js +1 -0
- package/dist/medassist-widget-MultiSelect-zx2GZY3z.js +1 -0
- package/dist/medassist-widget-VoiceAgentScreen-BK0p37RC.js +3 -380
- package/dist/medassist-widget-check-BaHLRs-2.js +1 -5
- package/dist/medassist-widget-chevron-right-CKYbGWbY.js +1 -7
- package/dist/medassist-widget-html2canvas.esm-CphxV6YW.js +3 -4833
- package/dist/medassist-widget-map-pin-Bx-5lPdC.js +1 -14
- package/dist/medassist-widget-mood-angry-BQqxy8gg.js +1 -10
- package/dist/medassist-widget-mood-bad-BBDRkdRc.js +1 -10
- package/dist/medassist-widget-mood-happy-oLG7NUhq.js +1 -9
- package/dist/medassist-widget-mood-neutral-CbcKAQbC.js +1 -10
- package/dist/medassist-widget-mood-poor-t4w5iE4B.js +1 -10
- package/dist/medassist-widget.css +1 -1
- package/dist/medassist-widget.js +15 -14720
- package/package.json +4 -4
- package/dist/medassist-widget-CardList-Dx2bzaVC.js +0 -222
- package/dist/medassist-widget-DoctorCard-Cn_E83qL.js +0 -552
- package/dist/medassist-widget-FocusCarousel-C8sm1Tm0.js +0 -99
- package/dist/medassist-widget-MediaCard-yhz2Z0ZQ.js +0 -179
- package/dist/medassist-widget-MultiSelect-BnExX-Ty.js +0 -414
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { c as d, A as v, d as x, y as C, u as e, t as L, p as P, F as _, S as j, B as D } from "./medassist-widget.js";
|
|
2
|
-
const R = [
|
|
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
|
-
], F = d("camera", R);
|
|
12
|
-
const $ = [
|
|
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
|
-
], M = d("download", $);
|
|
17
|
-
const U = [
|
|
18
|
-
["line", { x1: "2", x2: "22", y1: "2", y2: "22", key: "a6p6uj" }],
|
|
19
|
-
["path", { d: "M10.41 10.41a2 2 0 1 1-2.83-2.83", key: "1bzlo9" }],
|
|
20
|
-
["line", { x1: "13.5", x2: "6", y1: "13.5", y2: "21", key: "1q0aeu" }],
|
|
21
|
-
["line", { x1: "18", x2: "21", y1: "12", y2: "15", key: "5mozeu" }],
|
|
22
|
-
[
|
|
23
|
-
"path",
|
|
24
|
-
{
|
|
25
|
-
d: "M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",
|
|
26
|
-
key: "mmje98"
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
["path", { d: "M21 15V5a2 2 0 0 0-2-2H9", key: "43el77" }]
|
|
30
|
-
], T = d("image-off", U);
|
|
31
|
-
const z = [
|
|
32
|
-
["rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2", key: "1w4ew1" }],
|
|
33
|
-
["path", { d: "M7 11V7a5 5 0 0 1 10 0v4", key: "fwvmzm" }]
|
|
34
|
-
], A = d("lock", z);
|
|
35
|
-
function u(a) {
|
|
36
|
-
try {
|
|
37
|
-
return new URL(a, window.location.href).pathname.toLowerCase().endsWith(".pdf");
|
|
38
|
-
} catch {
|
|
39
|
-
return a.toLowerCase().split("?")[0].endsWith(".pdf");
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function E(a, n = "download.pdf") {
|
|
43
|
-
try {
|
|
44
|
-
const t = new URL(a, window.location.href).pathname.split("/").pop();
|
|
45
|
-
return t ? decodeURIComponent(t) : n;
|
|
46
|
-
} catch {
|
|
47
|
-
return a.split("?")[0].split("/").pop() || n;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
async function H(a) {
|
|
51
|
-
try {
|
|
52
|
-
const n = await fetch(a, { headers: { Range: "bytes=-4096" } });
|
|
53
|
-
if (!n.ok && n.status !== 206) return "error";
|
|
54
|
-
const t = await n.arrayBuffer();
|
|
55
|
-
return new TextDecoder("latin1").decode(t.slice(-4096)).includes("/Encrypt") ? "protected" : "ok";
|
|
56
|
-
} catch {
|
|
57
|
-
return "unknown";
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function y(a, n) {
|
|
61
|
-
const t = document.createElement("a");
|
|
62
|
-
t.href = a, t.download = n, document.body.appendChild(t), t.click(), t.remove();
|
|
63
|
-
}
|
|
64
|
-
async function I(a) {
|
|
65
|
-
const n = E(a);
|
|
66
|
-
try {
|
|
67
|
-
const t = await fetch(a);
|
|
68
|
-
if (!t.ok) throw new Error(`HTTP ${t.status}`);
|
|
69
|
-
const o = URL.createObjectURL(await t.blob());
|
|
70
|
-
y(o, n), URL.revokeObjectURL(o);
|
|
71
|
-
} catch {
|
|
72
|
-
const t = document.createElement("a");
|
|
73
|
-
t.href = a, t.download = n, t.target = "_blank", t.rel = "noopener", document.body.appendChild(t), t.click(), t.remove();
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async function g(a, n) {
|
|
77
|
-
if (a.current)
|
|
78
|
-
try {
|
|
79
|
-
const t = (await import("./medassist-widget-html2canvas.esm-CphxV6YW.js")).default, o = await t(a.current, { useCORS: !0 });
|
|
80
|
-
y(o.toDataURL("image/png"), n);
|
|
81
|
-
} catch {
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function S({ card: a }) {
|
|
85
|
-
const { title: n, description: t, tags_text: o, banner_text: m, action: s, link: r } = a, i = v(null), [b, f] = x(!1), [c, h] = x(
|
|
86
|
-
"loading"
|
|
87
|
-
), p = !!r && u(r), l = !!r && !u(r);
|
|
88
|
-
C(() => {
|
|
89
|
-
if (f(!1), !r || !u(r)) return;
|
|
90
|
-
let w = !1;
|
|
91
|
-
return h("loading"), H(r).then((k) => {
|
|
92
|
-
w || h(k);
|
|
93
|
-
}), () => {
|
|
94
|
-
w = !0;
|
|
95
|
-
};
|
|
96
|
-
}, [r]);
|
|
97
|
-
const N = () => {
|
|
98
|
-
s === "screenshot" ? g(i, `screenshot-${Date.now()}.png`) : s === "download" && (p && r ? I(r) : g(i, "card.png"));
|
|
99
|
-
};
|
|
100
|
-
return /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: [
|
|
101
|
-
/* @__PURE__ */ e(
|
|
102
|
-
L,
|
|
103
|
-
{
|
|
104
|
-
ref: i,
|
|
105
|
-
className: "overflow-hidden rounded-xl border border-border bg-elicitationBg text-card-foreground shadow-sm",
|
|
106
|
-
children: /* @__PURE__ */ e(P, { className: "p-3 space-y-2", children: [
|
|
107
|
-
/* @__PURE__ */ e("div", { className: `flex items-start gap-3 ${l ? "justify-between" : "justify-center"}`, children: [
|
|
108
|
-
/* @__PURE__ */ e("div", { className: `space-y-2 ${l ? "min-w-0 flex-1" : "flex flex-col items-center"}`, children: [
|
|
109
|
-
n && /* @__PURE__ */ e("span", { className: "inline-block rounded-full px-3 py-1 text-sm font-semibold bg-primary text-primary-foreground", children: n }),
|
|
110
|
-
t && /* @__PURE__ */ e("p", { className: `text-sm text-foreground leading-snug ${l ? "" : "text-center"}`, children: t }),
|
|
111
|
-
m && /* @__PURE__ */ e("span", { className: "inline-block rounded-full px-3 py-1 text-xs font-semibold bg-green-600 text-white", children: m })
|
|
112
|
-
] }),
|
|
113
|
-
l && /* @__PURE__ */ e("div", { className: "shrink-0 h-24 w-24 rounded-lg overflow-hidden border border-border", children: b ? /* @__PURE__ */ e("div", { className: "flex h-full w-full items-center justify-center bg-muted text-muted-foreground", children: /* @__PURE__ */ e(T, { className: "h-6 w-6" }) }) : /* @__PURE__ */ e(
|
|
114
|
-
"img",
|
|
115
|
-
{
|
|
116
|
-
src: r,
|
|
117
|
-
alt: n ?? "media",
|
|
118
|
-
className: "h-full w-full object-cover",
|
|
119
|
-
onError: () => f(!0)
|
|
120
|
-
}
|
|
121
|
-
) })
|
|
122
|
-
] }),
|
|
123
|
-
p && /* @__PURE__ */ e(
|
|
124
|
-
"button",
|
|
125
|
-
{
|
|
126
|
-
type: "button",
|
|
127
|
-
onClick: () => window.open(r, "_blank", "noopener,noreferrer"),
|
|
128
|
-
className: "relative w-full h-48 sm:h-72 md:h-80 max-h-[70vh] rounded-lg border border-border overflow-hidden cursor-pointer p-0 bg-transparent",
|
|
129
|
-
"aria-label": `Open ${n ?? "PDF"}`,
|
|
130
|
-
children: [
|
|
131
|
-
c === "loading" && /* @__PURE__ */ e("div", { className: "h-full w-full animate-pulse bg-muted" }),
|
|
132
|
-
(c === "ok" || c === "unknown") && /* @__PURE__ */ e(
|
|
133
|
-
"iframe",
|
|
134
|
-
{
|
|
135
|
-
src: r,
|
|
136
|
-
title: n ?? "PDF preview",
|
|
137
|
-
className: "w-full h-full pointer-events-none"
|
|
138
|
-
}
|
|
139
|
-
),
|
|
140
|
-
c === "protected" && /* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col items-center justify-center gap-2 bg-muted/50 text-muted-foreground", children: [
|
|
141
|
-
/* @__PURE__ */ e(A, { className: "h-8 w-8" }),
|
|
142
|
-
/* @__PURE__ */ e("span", { className: "text-sm font-medium text-foreground", children: "Password-protected PDF" }),
|
|
143
|
-
/* @__PURE__ */ e("span", { className: "text-xs", children: "Tap to open and unlock" })
|
|
144
|
-
] }),
|
|
145
|
-
c === "error" && /* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col items-center justify-center gap-2 bg-muted/50 text-muted-foreground", children: [
|
|
146
|
-
/* @__PURE__ */ e(_, { className: "h-8 w-8" }),
|
|
147
|
-
/* @__PURE__ */ e("span", { className: "text-sm font-medium text-foreground", children: "PDF" }),
|
|
148
|
-
/* @__PURE__ */ e("span", { className: "text-xs", children: "Tap to open" })
|
|
149
|
-
] }),
|
|
150
|
-
/* @__PURE__ */ e("span", { className: "absolute inset-0", "aria-hidden": "true" })
|
|
151
|
-
]
|
|
152
|
-
}
|
|
153
|
-
),
|
|
154
|
-
o && /* @__PURE__ */ e(j, { children: [
|
|
155
|
-
/* @__PURE__ */ e("div", { className: "border-t border-border" }),
|
|
156
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: o })
|
|
157
|
-
] })
|
|
158
|
-
] })
|
|
159
|
-
}
|
|
160
|
-
),
|
|
161
|
-
s && /* @__PURE__ */ e("div", { className: "flex justify-end", children: /* @__PURE__ */ e(
|
|
162
|
-
D,
|
|
163
|
-
{
|
|
164
|
-
type: "button",
|
|
165
|
-
variant: "outline",
|
|
166
|
-
size: "sm",
|
|
167
|
-
className: "rounded-md px-5 gap-1.5",
|
|
168
|
-
onClick: N,
|
|
169
|
-
children: [
|
|
170
|
-
s === "screenshot" ? /* @__PURE__ */ e(F, { className: "h-4 w-4" }) : /* @__PURE__ */ e(M, { className: "h-4 w-4" }),
|
|
171
|
-
s === "screenshot" ? "Screenshot" : "Download"
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
) })
|
|
175
|
-
] });
|
|
176
|
-
}
|
|
177
|
-
export {
|
|
178
|
-
S as MediaCard
|
|
179
|
-
};
|
|
@@ -1,414 +0,0 @@
|
|
|
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
|
-
};
|