UNPKG

@playbooks/ui

Version:

An interface library for Playbooks.

70 lines (69 loc) 2.16 kB
import { jsx } from "react/jsx-runtime"; import { useUI } from "./context.es.js"; import { Font, P } from "./fonts.es.js"; import { Div } from "./html.es.js"; import { Icon } from "./icons.es.js"; const Alert = ({ type = "info", name = "Alert", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.alert({ type }); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(Div, { ...computed, children }); }; const AlertIcon = ({ type = "fad", name = "AlertIcon", icon = "exclamation-circle", tailwind, className, ...props }) => { const context = useUI(); const base = context?.theme?.alertIcon(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(Icon, { type, icon, ...computed }); }; const AlertBody = ({ name = "AlertBody", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.alertBody(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(Div, { ...computed, children }); }; const AlertTitle = ({ name = "AlertTitle", size = "h6", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.alertTitle(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(Font, { size, ...computed, children }); }; const AlertText = ({ name = "AlertText", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.alertText(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(P, { ...computed, children }); }; const AlertActions = ({ name = "AlertActions", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.alertActions(); const computed = { ...base, ...props, tailwind, className, name }; return /* @__PURE__ */ jsx(Div, { ...computed, children }); }; export { Alert, AlertActions, AlertBody, AlertIcon, AlertText, AlertTitle };