UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

72 lines (71 loc) 1.84 kB
import { jsx as o, 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-C6E7PEI7.mjs"; import { C as u } from "./Checkbox-BGzAZBtE.mjs"; import { D as p, b as g, e as D, f, i as b } from "./Dialog-VQXgmvwj.mjs"; import { S as k } from "./SideLabel-JL7Te7Jc.mjs"; import { d as x } from "./Tooltip-GHHPt6Q7.mjs"; import { c as a } from "./index-2NvaPZWc.mjs"; const r = d(null), i = () => { const e = m(r); if (!e) throw new Error( "ConsentDialog components must be used within ConsentDialog" ); return e; }, I = ({ children: e, ...t }) => { const [s, n] = C(!1); return /* @__PURE__ */ o(r.Provider, { value: { isChecked: s, setIsChecked: n }, children: /* @__PURE__ */ o(p, { ...t, children: /* @__PURE__ */ l(g, { children: [ /* @__PURE__ */ o(D, {}), /* @__PURE__ */ o(f, { children: e }) ] }) }) }); }, N = ({ children: e, className: t, ...s }) => /* @__PURE__ */ o( "div", { className: a( "max-h-[60vh] overflow-y-auto rounded-md border p-4", t ), ...s, children: e } ), F = ({ label: e, ...t }) => { const { isChecked: s, setIsChecked: n } = i(); return /* @__PURE__ */ o(k, { label: e, children: /* @__PURE__ */ o( u, { checked: s, onCheckedChange: (c) => n(c), ...t } ) }); }, L = ({ tooltip: e = "Please check the consent to proceed", className: t, ...s }) => { const { isChecked: n } = i(); return /* @__PURE__ */ o(b, { children: /* @__PURE__ */ o(x, { tooltip: e, open: n ? !1 : void 0, children: /* @__PURE__ */ o( h, { disabled: !n, className: a("disabled:pointer-events-auto", t), ...s } ) }) }); }; export { r as C, I as a, N as b, F as c, L as d, i as u };