@stratakit/react
Version:
A React component library for StrataKit
62 lines (61 loc) • 1.86 kB
JavaScript
import { jsx, jsxs } from "react/jsx-runtime";
import * as React from "react";
import { Field, TextBox } from "@stratakit/bricks";
import { useCompatProps } from "./~utils.js";
import { InputGrid } from "./InputGrid.js";
import { Label } from "./Label.js";
import { StatusMessage } from "./StatusMessage.js";
const LabeledTextarea = React.forwardRef((props, forwardedRef) => {
const {
status,
// PARTIALLY IMPLEMENTED.
iconProps = {},
// PARTIALLY IMPLEMENTED.
messageContentProps,
// NOT IMPLEMENTED.
label,
message,
wrapperProps,
labelProps,
svgIcon,
displayStyle,
id,
...rest
} = useCompatProps(props);
const {
size: iconSize,
// PARTIALLY IMPLEMENTED
// biome-ignore-start lint/correctness/noUnusedVariables: NOT IMPLEMENTED
fill: iconFill,
padded: iconPadded,
// biome-ignore-end lint/correctness/noUnusedVariables: NOT IMPLEMENTED
...restIconProps
} = iconProps;
return /* @__PURE__ */ jsxs(InputGrid, { labelPlacement: displayStyle, ...wrapperProps, children: [
/* @__PURE__ */ jsx(Label, { ...labelProps, children: label }),
/* @__PURE__ */ jsx(
Field.Control,
{
render: (controlProps) => {
return /* @__PURE__ */ jsxs(TextBox.Root, { children: [
/* @__PURE__ */ jsx(TextBox.Textarea, { ...controlProps, ...rest }),
svgIcon ? /* @__PURE__ */ jsx(
TextBox.Icon,
{
...restIconProps,
render: svgIcon,
size: iconSize === "large" ? "large" : void 0
}
) : null
] });
},
id,
ref: forwardedRef
}
),
message && /* @__PURE__ */ jsx(StatusMessage, { status, contentProps: messageContentProps, children: message })
] });
});
export {
LabeledTextarea
};