UNPKG

@playbooks/ui

Version:

An interface library for Playbooks.

102 lines (101 loc) 3.9 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const require$$0 = require("react/jsx-runtime"); const html = require("./toast-context-kVz4KXNu.cjs"); const Badge = ({ name = "Badge", type = "", size = "sm", tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.badge({ size }); const computed = { ...base, ...props, tailwind, className, name }; switch (type) { case "draft": case "free": return /* @__PURE__ */ require$$0.jsx(DraftBadge, { ...computed, children }); case "info": case "warning": case "scheduled": return /* @__PURE__ */ require$$0.jsx(WarningBadge, { ...computed, children }); case "pending": case "running": case "seed": case "testing": return /* @__PURE__ */ require$$0.jsx(PendingBadge, { ...computed, children }); case "active": case "complete": case "succeeded": case "verified": return /* @__PURE__ */ require$$0.jsx(SuccessBadge, { ...computed, children }); case "closed": case "finished": case "inactive": case "paid": case "won": return /* @__PURE__ */ require$$0.jsx(FinishedBadge, { ...computed, children }); case "canceled": case "denied": case "disabled": case "errored": case "refunded": case "stopped": return /* @__PURE__ */ require$$0.jsx(ErrorBadge, { ...computed, children }); default: return /* @__PURE__ */ require$$0.jsx(DefaultBadge, { ...computed, children }); } }; const DraftBadge = ({ tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.draftBadge(); const computed = { ...base, ...props, tailwind, className }; return /* @__PURE__ */ require$$0.jsx(html.Span, { ...computed, children }); }; const PendingBadge = ({ tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.pendingBadge(); const computed = { ...base, ...props, tailwind, className }; return /* @__PURE__ */ require$$0.jsx(html.Span, { ...computed, children }); }; const WarningBadge = ({ tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.warningBadge(); const computed = { ...base, ...props, tailwind, className }; return /* @__PURE__ */ require$$0.jsx(html.Span, { ...computed, children }); }; const SuccessBadge = ({ tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.successBadge(); const computed = { ...base, ...props, tailwind, className }; return /* @__PURE__ */ require$$0.jsx(html.Span, { ...computed, children }); }; const FinishedBadge = ({ tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.finishedBadge(); const computed = { ...base, ...props, tailwind, className }; return /* @__PURE__ */ require$$0.jsx(html.Span, { ...computed, children }); }; const ErrorBadge = ({ tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.errorBadge(); const computed = { ...base, ...props, tailwind, className }; return /* @__PURE__ */ require$$0.jsx(html.Span, { ...computed, children }); }; const DefaultBadge = ({ tailwind, className, children, ...props }) => { const { theme } = html.useInterface(); const base = theme.outlineBadge(); const computed = { ...base, ...props, tailwind, className }; return /* @__PURE__ */ require$$0.jsx(html.Span, { ...computed, children }); }; exports.Badge = Badge; exports.DefaultBadge = DefaultBadge; exports.DraftBadge = DraftBadge; exports.ErrorBadge = ErrorBadge; exports.FinishedBadge = FinishedBadge; exports.PendingBadge = PendingBadge; exports.SuccessBadge = SuccessBadge; exports.WarningBadge = WarningBadge;