Debian Codegraph @

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

raw
1 import { FunctionComponent, ReactNode } from 'react';
2 /** Configuration for animations throughout PatternFly components */
3 export interface AnimationsConfig {
4 /** Whether animations are enabled globally */
5 hasAnimations?: boolean;
6 }
7 /** Props for the AnimationsProvider component */
8 export interface AnimationsProviderProps {
9 /** Animation configuration settings */
10 config: AnimationsConfig;
11 /** Child components that will have access to the animations context */
12 children: ReactNode;
13 }
14 /**
15 * AnimationsProvider is an application-level provider that provides uniform
16 * animation configuration for all PatternFly React components via the React context API.
17 *
18 * **Usage**: Place this provider at the root of your application to enable global
19 * animation control without requiring manual prop drilling throughout your component tree.
20 *
21 * **Benefits**:
22 * - Centralized animation control for the entire application
23 * - Respects user accessibility preferences (reduced motion)
24 * - Components can still override the global setting when needed
25 * - Works with all PatternFly components that support animations
26 *
27 * @example
28 * ```tsx
29 * // App.tsx - Place at your application root
30 * import { AnimationsProvider } from '@patternfly/react-core';
31 *
32 * const App = () => (
33 * <AnimationsProvider config={{ hasAnimations: true }}>
34 * <MyApplication />
35 * </AnimationsProvider>
36 * );
37 * ```
38 */
39 export declare const AnimationsProvider: FunctionComponent<AnimationsProviderProps>;
40 /**
41 * Hook to access the animations configuration from the nearest AnimationsProvider.
42 *
43 * This hook allows components to check if animations are enabled and override
44 * their local hasAnimations prop accordingly.
45 *
46 * @returns The animations configuration object
47 *
48 * @example
49 * ```tsx
50 * const MyComponent = ({ hasAnimations: hasAnimationsProp, ...props }) => {
51 * const { hasAnimations: contextHasAnimations } = useAnimationsConfig();
52 * const hasAnimations = hasAnimationsProp ?? contextHasAnimations;
53 *
54 * return <div className={hasAnimations ? 'with-animations' : ''} {...props} />;
55 * };
56 * ```
57 */
58 export declare const useAnimationsConfig: () => AnimationsConfig;
59 /**
60 * Utility hook that combines local hasAnimations prop with context configuration.
61 * The local prop takes precedence when explicitly set, otherwise falls back to context.
62 *
63 * @param hasAnimationsProp - The hasAnimations prop passed directly to the component
64 * @returns The resolved hasAnimations value
65 *
66 * @example
67 * ```tsx
68 * const MyComponent = ({ hasAnimations: hasAnimationsProp, ...props }) => {
69 * const hasAnimations = useHasAnimations(hasAnimationsProp);
70 *
71 * return <div className={hasAnimations ? 'animated' : 'static'} {...props} />;
72 * };
73 * ```
74 */
75 export declare const useHasAnimations: (hasAnimationsProp?: boolean) => boolean;
76 //# sourceMappingURL=AnimationsProvider.d.ts.map