/** * Copyright Zendesk, Inc. * * Use of this source code is governed under the Apache License, Version 2.0 * found at http://www.apache.org/licenses/LICENSE-2.0. */ import { HTMLProps, ReactNode } from 'react'; export interface IUseFieldProps { /** Prefixes IDs for field elements */ idPrefix?: string; /** Indicates the field has a hint */ hasHint?: boolean; /** Indicates the field has a message */ hasMessage?: boolean; } export interface IUseFieldReturnValue { getLabelProps: (props?: HTMLProps) => HTMLProps; getHintProps: (props?: HTMLProps) => HTMLProps; getInputProps: (props?: HTMLProps) => HTMLProps; getMessageProps: (props?: Omit, 'role'> & { role?: 'alert' | null; }) => HTMLProps; } export interface IFieldContainerProps extends IUseFieldProps { /** * Provides field render prop functions * * @param {function} [options.getLabelProps] Field label props getter * @param {function} [options.getHintProps] Field hint props getter * @param {function} [options.getInputProps] Field input props getter * @param {function} [options.getMessageProps] Field message getter */ render?: (options: { getLabelProps: IUseFieldReturnValue['getLabelProps']; getHintProps: IUseFieldReturnValue['getHintProps']; getInputProps: IUseFieldReturnValue['getInputProps']; getMessageProps: IUseFieldReturnValue['getMessageProps']; }) => ReactNode; /** @ignore */ children?: (options: IUseFieldReturnValue) => ReactNode; }