UNPKG

@playbooks/ui

Version:

An interface library for Playbooks.

86 lines (85 loc) 2.75 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const require$$0 = require("react/jsx-runtime"); const transforms = require("./transforms-Ca9m4pGF.cjs"); const html = require("./toast-context-kVz4KXNu.cjs"); const RadioWrapper = ({ id, name = "RadioWrapper", active, onClick, tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.radioWrapper({ active }); const classes = transforms.computeTailwind({ ...base, ...props, ...tailwind, className }); return /* @__PURE__ */ require$$0.jsx(transforms.Label, { id, onClick, className: classes, children }); }; const Radio = ({ name = "Radio", title, text, value, onClick, tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.radio(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ require$$0.jsxs(RadioWrapper, { active: value, onClick, ...computed, children: [ /* @__PURE__ */ require$$0.jsx(RadioInput, { value }), /* @__PURE__ */ require$$0.jsxs(html.Div, { space: "space-y-1", children: [ title && /* @__PURE__ */ require$$0.jsx(RadioTitle, { children: title }), text && /* @__PURE__ */ require$$0.jsx(RadioText, { children: text }) ] }) ] }); }; const RadioInput = ({ id, name = "RadioInput", value, tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.radioInput(); const classes = transforms.computeTailwind({ ...base, ...props, ...tailwind, name, className }); return /* @__PURE__ */ require$$0.jsx( transforms.Input, { id, type: "radio", checked: value, "aria-labelledby": "privacy-setting-0-label", "aria-describedby": "privacy-setting-0-description", className: classes, readOnly: true, children } ); }; const RadioTitle = ({ name = "RadioLabel", tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.radioTitle(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ require$$0.jsx(html.P, { ...computed, children }); }; const RadioText = ({ name = "RadioLabel", tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.radioText(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ require$$0.jsx(html.Small, { ...computed, children }); }; exports.Radio = Radio; exports.RadioInput = RadioInput; exports.RadioText = RadioText; exports.RadioTitle = RadioTitle; exports.RadioWrapper = RadioWrapper;