UNPKG

@rjsf/utils

Version:
62 lines (61 loc) 3.36 kB
import { FieldPathId } from './types.js'; /** Return a consistent `id` for the field description element * * @param id - Either simple string id or an FieldPathId from which to extract it * @returns - The consistent id for the field description element from the given `id` */ export declare function descriptionId(id: FieldPathId | string): string; /** Return a consistent `id` for the field error element * * @param id - Either simple string id or an FieldPathId from which to extract it * @returns - The consistent id for the field error element from the given `id` */ export declare function errorId(id: FieldPathId | string): string; /** Return a consistent `id` for the field examples element * * @param id - Either simple string id or an FieldPathId from which to extract it * @returns - The consistent id for the field examples element from the given `id` */ export declare function examplesId(id: FieldPathId | string): string; /** Return a consistent `id` for the field help element * * @param id - Either simple string id or an FieldPathId from which to extract it * @returns - The consistent id for the field help element from the given `id` */ export declare function helpId(id: FieldPathId | string): string; /** Return a consistent `id` for the field title element * * @param id - Either simple string id or an FieldPathId from which to extract it * @returns - The consistent id for the field title element from the given `id` */ export declare function titleId(id: FieldPathId | string): string; /** Return a list of element ids that contain additional information about the field that can be used to as the aria * description of the field. This is correctly omitting `titleId` which would be "labeling" rather than "describing" the * element. * * @param id - Either simple string id or an FieldPathId from which to extract it * @param [includeExamples=false] - Optional flag, if true, will add the `examplesId` into the list * @returns - The string containing the list of ids for use in an `aria-describedBy` attribute */ export declare function ariaDescribedByIds(id: FieldPathId | string, includeExamples?: boolean): string; /** Return a consistent `id` for the `optionIndex`s of a `Radio` or `Checkboxes` widget * * @param id - The id of the parent component for the option * @param optionIndex - The index of the option for which the id is desired * @returns - An id for the option index based on the parent `id` */ export declare function optionId(id: string, optionIndex: number): string; /** Return a consistent `id` for the `btn` button element * * @param id - The id of the parent component for the option * @param btn - The button type for which to generate the id * @returns - The consistent id for the button from the given `id` and `btn` type */ export declare function buttonId(id: FieldPathId | string, btn: 'add' | 'copy' | 'moveDown' | 'moveUp' | 'remove'): string; /** Return a consistent `id` for the optional data controls `element` * * @param id - The id of the parent component for the option * @param element - The element type for which to generate the id * @returns - The consistent id for the optional data controls element from the given `id` and `element` type */ export declare function optionalControlsId(id: FieldPathId | string, element: 'Add' | 'Msg' | 'Remove'): string;