Debian Codegraph @

node/@patternfly/react-core/dist/js/helpers/OUIA/ouia.d.ts

raw
1 type OuiaId = number | string;
2 export interface OUIAProps {
3 ouiaId?: OuiaId;
4 ouiaSafe?: boolean;
5 }
6 /**
7 * Get props to conform to OUIA spec.
8 * For functional components, use the useOUIAProps hook instead.
9 *
10 * @param {string} componentType OUIA component type
11 * @param {number|string} id OUIA component id
12 * @param {boolean} ouiaSafe false if in animation
13 */
14 export declare function getOUIAProps(componentType: string, id: OuiaId, ouiaSafe?: boolean): {
15 'data-ouia-component-type': string;
16 'data-ouia-safe': boolean;
17 'data-ouia-component-id': OuiaId;
18 };
19 /**
20 * Hooks version of the getOUIAProps function with SSR-safe ID generation.
21 * Can only be used in functional components.
22 *
23 * @param {string} componentType OUIA component type
24 * @param {number|string} id OUIA component id
25 * @param {boolean} ouiaSafe false if in animation
26 * @param {string} variant Optional variant to add to the generated ID
27 */
28 export declare const useOUIAProps: (componentType: string, id?: OuiaId, ouiaSafe?: boolean, variant?: string) => {
29 'data-ouia-component-type': string;
30 'data-ouia-safe': boolean;
31 'data-ouia-component-id': OuiaId;
32 };
33 /**
34 * Returns the provided ID or a deterministic SSR-safe generated OUIA ID.
35 * Uses React.useId() under the hood for consistent server/client rendering.
36 *
37 * @param {string} componentType OUIA component type
38 * @param {number|string} id OUIA component id
39 * @param {string} variant Optional variant to add to the generated ID
40 */
41 export declare const useOUIAId: (componentType: string, id?: OuiaId, variant?: string) => OuiaId;
42 /**
43 * Legacy counter-based OUIA ID generator for class components that cannot use hooks.
44 * Prefer useOUIAId or useOUIAProps for functional components.
45 *
46 * @deprecated Use useOUIAId in functional components instead.
47 */
48 export declare function getDefaultOUIAId(componentType: string, variant?: string): string;
49 export {};
50 //# sourceMappingURL=ouia.d.ts.map