@instructure/ui-react-utils
Version:
A React utility library made by Instructure Inc.
28 lines • 1.43 kB
TypeScript
export type GetInteractionOptions = {
props?: {
interaction?: InteractionType | null;
disabled?: boolean | null;
readOnly?: boolean | null;
[key: string]: any;
};
interactionTypes?: InteractionType[];
};
export type InteractionType = 'enabled' | 'disabled' | 'readonly';
/**
* ---
* category: utilities/react
* ---
* Parse the component props for the interaction type. It will return one of 'enabled', 'disabled', or 'readonly'.
* This is useful for form elements where consumers are able to either use the interaction prop as specified or the
* native html disabled or readonly attributes
* @module getInteraction
* @param {Object} args
* @param {Object} args.props - the component props
* @param {string} args.props.interaction - specifies the interaction mode, one of 'enabled', 'disabled', or 'readonly'
* @param {boolean} args.props.disabled - specifies if the component is disabled. Will take precedence over readOnly
* @param {boolean} args.props.readOnly - specifies if the component is readonly
* @param {Array} args.interactionTypes - an array specifying the interaction types available to the component, ['disabled', 'readonly'] by default
* @returns {String} one of 'enabled', 'disabled', or 'readonly'
*/
export declare function getInteraction({ props, interactionTypes }?: GetInteractionOptions): InteractionType;
//# sourceMappingURL=getInteraction.d.ts.map