@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
73 lines (72 loc) • 1.92 kB
JavaScript
import { jsx as e, jsxs as l } from "react/jsx-runtime";
import { createContext as d, useContext as m, useState as C } from "react";
import { B as h } from "./Button-nH76KtOO.mjs";
import { c as a } from "./index-2NvaPZWc.mjs";
import { C as u } from "./Checkbox-DJfQtvL9.mjs";
import { D as g, i as p, h as D, d as f, f as k } from "./Dialog-Df-tvqUy.mjs";
import { S as x } from "./SideLabel-BKQ9iBHW.mjs";
import { T as b } from "./Tooltip-Rs8aEg_1.mjs";
const r = d(null), i = () => {
const o = m(r);
if (!o)
throw new Error(
"ConsentDialog components must be used within ConsentDialog"
);
return o;
}, I = ({ children: o, ...t }) => {
const [n, s] = C(!1);
return /* @__PURE__ */ e(r.Provider, { value: { isChecked: n, setIsChecked: s }, children: /* @__PURE__ */ e(g, { ...t, children: /* @__PURE__ */ l(p, { children: [
/* @__PURE__ */ e(D, {}),
/* @__PURE__ */ e(f, { "data-slot": "consent-dialog", children: o })
] }) }) });
}, N = ({
children: o,
className: t,
...n
}) => /* @__PURE__ */ e(
"div",
{
"data-slot": "consent-dialog-content",
className: a(
"max-h-[60vh] overflow-y-auto rounded-md border p-4",
t
),
...n,
children: o
}
), T = ({
label: o,
...t
}) => {
const { isChecked: n, setIsChecked: s } = i();
return /* @__PURE__ */ e(x, { label: o, children: /* @__PURE__ */ e(
u,
{
checked: n,
onCheckedChange: (c) => s(c),
...t
}
) });
}, F = ({
tooltip: o = "Please check the consent to proceed",
className: t,
...n
}) => {
const { isChecked: s } = i();
return /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(b, { tooltip: o, open: s ? !1 : void 0, children: /* @__PURE__ */ e(
h,
{
disabled: !s,
className: a("disabled:pointer-events-auto", t),
...n
}
) }) });
};
export {
I as C,
T as a,
N as b,
r as c,
F as d,
i as u
};