UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

11 lines (10 loc) 670 B
import { jsx as _jsx } from "react/jsx-runtime"; import { notNullish } from "../../util/index.js"; import { getFlexClass } from "../style/Flex.js"; import { getClass } from "../util/css.js"; import { INPUT_CLASS, PLACEHOLDER_CLASS } from "./Input.js"; /** Return static "output" styled as an input, based on whether an `onClick` or `href` prop is provided. */ export function OutputInput({ title, placeholder, children = title, ...props }) { const hasChildren = notNullish(children); return (_jsx("output", { ...props, className: getClass(INPUT_CLASS, getFlexClass(props), hasChildren && PLACEHOLDER_CLASS), children: hasChildren ? children : placeholder })); }