UNPKG

@snups/rjsf-utils

Version:
55 lines (54 loc) 3 kB
import { IdSchema } from './types.js'; /** Return a consistent `id` for the field description element * * @param id - Either simple string id or an IdSchema from which to extract it * @returns - The consistent id for the field description element from the given `id` */ export declare function descriptionId<T = any>(id: IdSchema<T> | string): string; /** Return a consistent `id` for the field error element * * @param id - Either simple string id or an IdSchema from which to extract it * @returns - The consistent id for the field error element from the given `id` */ export declare function errorId<T = any>(id: IdSchema<T> | string): string; /** Return a consistent `id` for the field examples element * * @param id - Either simple string id or an IdSchema from which to extract it * @returns - The consistent id for the field examples element from the given `id` */ export declare function examplesId<T = any>(id: IdSchema<T> | string): string; /** Return a consistent `id` for the field help element * * @param id - Either simple string id or an IdSchema from which to extract it * @returns - The consistent id for the field help element from the given `id` */ export declare function helpId<T = any>(id: IdSchema<T> | string): string; /** Return a consistent `id` for the field title element * * @param id - Either simple string id or an IdSchema from which to extract it * @returns - The consistent id for the field title element from the given `id` */ export declare function titleId<T = any>(id: IdSchema<T> | 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 IdSchema 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<T = any>(id: IdSchema<T> | 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 - Either simple string id or an IdSchema from which to extract it * @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<T = any>(id: IdSchema<T> | string, btn: 'add' | 'copy' | 'moveDown' | 'moveUp' | 'remove'): string;