UNPKG

@cerberus-design/react

Version:

The Cerberus Design React component library.

19 lines (16 loc) 606 B
import { jsx } from 'react/jsx-runtime'; import { TagRoot } from './primitives.js'; import { ClosableTag } from './closable.js'; function isClosableTag(props) { return "onClick" in props && typeof props.onClick !== "undefined"; } function Tag(props) { const { children } = props; if (isClosableTag(props)) { const { onClick, ...rootProps2 } = props; return /* @__PURE__ */ jsx(ClosableTag, { onClick, ...rootProps2, children }); } const rootProps = props; return /* @__PURE__ */ jsx(TagRoot, { "data-palette": rootProps.palette ?? "page", ...rootProps, children }); } export { Tag };