import { IHtmlDivProps, INativeAccessibilityProps } from "./types"; import { PressableProps } from "react-native"; import { MouseEvent, TouchEvent } from "react"; export * from "./events"; /** * Normalizes props for React Native elements. * * This function takes all the props that can be passed to a React Native component, * and normalizes them into a format that can be passed to the component. * * The following props are normalized: * - `testID` is converted to `testID` (no change) * - `nativeID` is converted to `id` (for accessibility) * - `asHtmlTag` is not passed to the component * * @param props - The props to normalize * @param defaultProps - The default props to use if `props` is undefined * @returns The normalized props */ export declare function normalizeNativeProps = Partial>({ testID, nativeID, asHtmlTag, ...props }: T, defaultProps?: T): Omit, "className"> & { id: string; nativeID: string | undefined; testID: string; className: string; }; /** * Normalizes props for HTML elements. * * This function takes all the props that can be passed to a React Native component, * and converts them into props that can be passed to an equivalent HTML element. * * - `testID` is converted to `data-test-id` * - `ref` is converted to a function that normalizes the ref and calls the original ref function * - `android_ripple` is ignored * - `nativeID` is converted to `id` * - `onPress` is converted to `onClick` if it's a function * - `onPressIn` is converted to `onMouseDown` if it's a function * - `onPressOut` is converted to `onMouseUp` if it's a function * - `style` is flattened using `StyleSheet.flatten` * - `disabled`, `readOnly`, and `readonly` are converted to `disabled` and `readOnly` * - `className` is set to `"cursor-pointer"` if the element is not disabled and has an `onClick`, `onMouseDown`, or `onMouseUp` prop * * @param props The props to normalize * @param defaultProps The default props to normalize * @returns The normalized props */ export declare function normalizeHtmlProps = Partial>({ testID, ref, android_ripple, nativeID, onPress, onPressIn, onPressOut, style, ...props }: T & { android_ripple?: PressableProps["android_ripple"]; }, defaultProps?: T): { style: any; } & Omit, "className"> & { className: string; }, keyof INativeAccessibilityProps> & { ref: any; "data-test-id": string; id: string; onClick: ((event: MouseEvent | TouchEvent) => void) | undefined; onMouseDown: ((event: MouseEvent | TouchEvent) => void) | undefined; onMouseUp: ((event: MouseEvent | TouchEvent) => void) | undefined; }; /** * Converts React Native-style accessibility props to their corresponding DOM accessibility attributes. * * This utility function takes a set of accessibility-related props (commonly used in React Native) * and maps them to appropriate ARIA and DOM attributes for web compatibility. * * @template T - The type extending `IHtmlDivProps` that includes both native and DOM props. * @param props - An object containing accessibility props and other native props. * @param props.accessible - If `false`, sets `aria-hidden="true"` on the DOM element. * @param props.onAccessibilityEscape - Not mapped; included for compatibility. * @param props.accessibilityLanguage - Sets the `lang` attribute if provided. * @param props.accessibilityActions - Not mapped; included for compatibility. * @param props.accessibilityIgnoresInvertColors - Not mapped; included for compatibility. * @param props.accessibilityViewIsModal - Sets `aria-modal` if provided. * @param props.importantForAccessibility - If `"no-hide-descendants"`, sets `aria-hidden="true"`. * @param props.accessibilityElementsHidden - Sets `aria-hidden` based on value. * @param props.role - Sets the `role` attribute, or maps `accessibilityRole` to a DOM role. * @param props.accessibilityLiveRegion - Maps to `aria-live` attribute. * @param props.accessibilityRole - Maps to the corresponding DOM `role` attribute. * @param props.accessibilityLabel - Sets the `aria-label` attribute. * @param props.accessibilityState - Maps state values to ARIA attributes such as `aria-disabled`, `aria-selected`, `aria-checked`, `aria-busy`, and `aria-expanded`. * @param props.accessibilityValue - Maps value props to ARIA attributes such as `aria-valuemin`, `aria-valuemax`, `aria-valuenow`, and `aria-valuetext`. * @param props.accessibilityHint - Sets the `aria-describedby` and `aria-description` attributes. * @param rnProps - Remaining props passed through to the DOM element. * @returns The props object with React Native accessibility props converted to DOM/ARIA attributes, omitting the original native accessibility props. */ export declare function convertAccessibilityPropsToDOM({ accessible, onAccessibilityEscape, accessibilityLanguage, accessibilityActions, accessibilityIgnoresInvertColors, accessibilityViewIsModal, importantForAccessibility, accessibilityElementsHidden, role, accessibilityLiveRegion, accessibilityRole, accessibilityLabel, accessibilityState, accessibilityValue, accessibilityHint, ...rnProps }: T): Omit; /** * Picks and returns only the valid HTML-related properties from the given props object. * * This function creates a shallow copy of the input props, then filters out only the properties * that are relevant for HTML elements (such as accessibility, ARIA, and DOM props). * The returned object is normalized before being returned. * * @typeParam T - The type extending `IHtmlDivProps` from which to pick HTML props. * @param props - The props object to filter. * @param normalize - If `true`, normalizes the returned props object. * @returns A partial object containing only the valid HTML-related properties from the input. */ export declare function pickHtmlProps(props: T, normalize?: boolean): Partial;