UNPKG

@workday/canvas-kit-react

Version:

The parent module that contains all Workday Canvas Kit React components

25 lines (24 loc) 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FormFieldGroupInput = exports.useFormFieldGroupInput = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const common_1 = require("@workday/canvas-kit-react/common"); const canvas_kit_styling_1 = require("@workday/canvas-kit-styling"); const hooks_1 = require("./hooks"); /** * Adds the necessary props to an `Input` component for grouped inputs. */ exports.useFormFieldGroupInput = (0, common_1.createElemPropsHook)(hooks_1.useFormFieldModel)(({ state }) => { return { 'aria-invalid': state.error === 'error' ? true : undefined, 'aria-describedby': state.id ? `hint-${state.id}` : undefined, 'aria-required': state.isRequired ? true : undefined, }; }); exports.FormFieldGroupInput = (0, common_1.createSubcomponent)('input')({ displayName: 'FormField.Input', modelHook: hooks_1.useFormFieldModel, elemPropsHook: exports.useFormFieldGroupInput, })((elemProps, Element) => { return (0, jsx_runtime_1.jsx)(Element, { ...(0, canvas_kit_styling_1.handleCsProp)(elemProps) }); });