UNPKG

@konstructio/ui

Version:

A set of reusable and customizable React components built for konstruct.io

40 lines (39 loc) 1.02 kB
import { jsxs as d, jsx as o } from "react/jsx-runtime"; import { forwardRef as h, useId as u } from "react"; import { cn as p } from "../../utils/index.js"; import { textAreaVariants as v } from "./TextArea.variants.js"; import { useTheme as N } from "../../contexts/theme.hook.js"; const w = h( ({ initialValue: a, label: e, name: s, placeholder: l, rows: c = 3, theme: n, className: i, ...r }, f) => { const t = u(), { theme: x } = N(), m = s ? `${t}-name` : t; return /* @__PURE__ */ d("div", { className: "flex flex-col gap-2", children: [ e ? /* @__PURE__ */ o("label", { htmlFor: m, className: "cursor-pointer", children: e }) : null, /* @__PURE__ */ o( "textarea", { id: m, ref: f, className: p( v({ className: i, theme: n ?? x }) ), rows: c, placeholder: l, value: a ?? r.value, ...r } ) ] }); } ); export { w as TextArea };