koval-ui
Version:
React components collection with minimalistic design. Supports theming, layout, and input validation.
3 lines (2 loc) • 842 B
JavaScript
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),e=require("react"),o=require("classnames"),q=require("../../internal/hooks/useInternalId.cjs"),l=require("./FormField.module.css.cjs"),a=e.forwardRef(({className:c,children:i,label:u,hint:r,required:m,...p},F)=>{const n=e.Children.only(i).props,s=q.useInternalId(n.id),t=`${s}-hint`,f=e.useMemo(()=>e.cloneElement(e.Children.only(i),{id:s,...r&&{"aria-describedby":t}}),[i,r,t,s]);return d.jsxs("div",{...p,ref:F,className:o(l.default.wrapper,c),children:[d.jsx("label",{className:o(l.default.label,{[l.default.required]:n.required||m}),htmlFor:s,children:u}),f,r&&d.jsx("div",{className:l.default.hint,id:t,children:r})]})});a.displayName="FormField";exports.FormField=a;
//# sourceMappingURL=FormField.cjs.map