UNPKG

@playbooks/ui

Version:

An interface library for Playbooks.

93 lines (92 loc) 3.71 kB
import { jsx } from "react/jsx-runtime"; import { a as computeProps, b as H1$1, d as H2$1, e as H3$1, f as H4$1, g as H5$1, h as H6$1, P as P$1, S as Small$1 } from "./index.es-7ZX4yv7W.js"; import { useUI } from "./context.es.js"; const Font = (props) => { switch (props?.size) { case "h1": return /* @__PURE__ */ jsx(H1, { ...props }); case "h2": return /* @__PURE__ */ jsx(H2, { ...props }); case "h3": return /* @__PURE__ */ jsx(H3, { ...props }); case "h4": return /* @__PURE__ */ jsx(H4, { ...props }); case "h5": return /* @__PURE__ */ jsx(H5, { ...props }); case "h6": return /* @__PURE__ */ jsx(H6, { ...props }); case "p": return /* @__PURE__ */ jsx(P, { ...props }); case "sm": return /* @__PURE__ */ jsx(Small, { ...props }); case "xs": return /* @__PURE__ */ jsx(Small, { fontSize: "text-xs", ...props }); } }; const H1 = ({ name = "H1", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.h1(); const formatted = { ...base, ...props, ...tailwind }; const filtered = computeProps(props); return /* @__PURE__ */ jsx(H1$1, { name, tailwind: formatted, className, ...filtered, children }); }; const H2 = ({ name = "H2", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.h2(); const formatted = { ...base, ...props, ...tailwind }; const filtered = computeProps(props); return /* @__PURE__ */ jsx(H2$1, { name, tailwind: formatted, className, ...filtered, children }); }; const H3 = ({ name = "H3", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.h3(); const formatted = { ...base, ...props, ...tailwind }; const filtered = computeProps(props); return /* @__PURE__ */ jsx(H3$1, { name, tailwind: formatted, className, ...filtered, children }); }; const H4 = ({ name = "H4", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.h4(); const formatted = { ...base, ...props, ...tailwind }; const filtered = computeProps(props); return /* @__PURE__ */ jsx(H4$1, { name, tailwind: formatted, className, ...filtered, children }); }; const H5 = ({ name = "H5", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.h5(); const formatted = { ...base, ...props, ...tailwind }; const filtered = computeProps(props); return /* @__PURE__ */ jsx(H5$1, { name, tailwind: formatted, className, ...filtered, children }); }; const H6 = ({ name = "H6", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.h6(); const formatted = { ...base, ...props, ...tailwind }; const filtered = computeProps(props); return /* @__PURE__ */ jsx(H6$1, { name, tailwind: formatted, className, ...filtered, children }); }; const P = ({ name = "P", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.p(); const formatted = { ...base, ...props, ...tailwind }; const filtered = computeProps(props); return /* @__PURE__ */ jsx(P$1, { name, tailwind: formatted, className, ...filtered, children }); }; const Small = ({ name = "Small", tailwind, className, children, ...props }) => { const context = useUI(); const base = context?.theme?.small(); const formatted = { ...base, ...props, ...tailwind }; const filtered = computeProps(props); return /* @__PURE__ */ jsx(Small$1, { name, tailwind: formatted, className, ...filtered, children }); }; export { Font, H1, H2, H3, H4, H5, H6, P, Small };