@gears-frontx/react 0.1.0 → 0.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,136 +0,0 @@
1
- import * as React from 'react';
2
- import { ReactNode } from 'react';
3
- import { ChildMfeBridge, HAI3Config, HAI3App, RootState, Formatters, Language } from '@gears-frontx/framework';
4
-
5
- /**
6
- * MFE Context Value
7
- * Contains bridge and metadata about the MFE instance.
8
- */
9
- interface MfeContextValue {
10
- /** Child bridge for communication with host */
11
- bridge: ChildMfeBridge;
12
- /** Extension ID */
13
- extensionId: string;
14
- /** Domain ID where MFE is mounted */
15
- domainId: string;
16
- }
17
- /**
18
- * MFE Context
19
- * Holds the MFE bridge and metadata for child components.
20
- */
21
- declare const MfeContext: React.Context<MfeContextValue | null>;
22
- /**
23
- * Use the MFE context.
24
- * Throws if used outside of MFE context.
25
- *
26
- * @returns The MFE context value
27
- */
28
- declare function useMfeContext(): MfeContextValue;
29
-
30
- /**
31
- * @gears-frontx/react - Type Definitions
32
- *
33
- * Core types for HAI3 React bindings.
34
- * Provides type-safe hooks and components.
35
- *
36
- * Now using real imports from @gears-frontx/framework since packages are built together.
37
- */
38
-
39
- type Selector<TResult, TState = RootState> = (state: TState) => TResult;
40
- type TranslationParams = Record<string, string | number | boolean>;
41
- /**
42
- * HAI3 Provider Props
43
- * Props for the main HAI3Provider component.
44
- *
45
- * @example
46
- * ```tsx
47
- * <HAI3Provider config={{ devMode: true }}>
48
- * <App />
49
- * </HAI3Provider>
50
- *
51
- * // With pre-built app
52
- * const app = createHAI3().use(screensets()).use(microfrontends()).build();
53
- * <HAI3Provider app={app}>
54
- * <App />
55
- * </HAI3Provider>
56
- *
57
- * // With MFE bridge (for MFE components)
58
- * <HAI3Provider mfeBridge={{ bridge, extensionId, domainId }}>
59
- * <MyMfeApp />
60
- * </HAI3Provider>
61
- * ```
62
- */
63
- interface HAI3ProviderProps {
64
- /** Child components */
65
- children: ReactNode;
66
- /** HAI3 configuration */
67
- config?: HAI3Config;
68
- /** Pre-built HAI3 app instance (optional) */
69
- app?: HAI3App;
70
- /** MFE bridge context (for MFE components) */
71
- mfeBridge?: MfeContextValue;
72
- }
73
- /**
74
- * useHAI3 Hook Return Type
75
- * Returns the HAI3 app instance from context.
76
- */
77
- type UseHAI3Return = HAI3App;
78
- /**
79
- * useAppSelector Hook
80
- * Type-safe selector hook for Redux state.
81
- *
82
- * @template TResult - The result type of the selector
83
- */
84
- type UseAppSelector = <TResult>(selector: Selector<TResult>) => TResult;
85
- /**
86
- * useAppDispatch Hook Return Type
87
- * Returns the typed dispatch function.
88
- */
89
- type UseAppDispatchReturn = (action: unknown) => unknown;
90
- /**
91
- * useTranslation Hook Return Type
92
- * Translation utilities.
93
- */
94
- interface UseTranslationReturn {
95
- /** Translate a key */
96
- t: (key: string, params?: TranslationParams) => string;
97
- /** Current language */
98
- language: Language | null;
99
- /** Change language */
100
- setLanguage: (language: Language) => void;
101
- /** Check if current language is RTL */
102
- isRTL: boolean;
103
- }
104
- /**
105
- * useScreenTranslations Hook Return Type
106
- * Screen-level translation loading state.
107
- */
108
- interface UseScreenTranslationsReturn {
109
- /** Whether translations are loaded */
110
- isLoaded: boolean;
111
- /** Loading error (if any) */
112
- error: Error | null;
113
- }
114
- /**
115
- * useTheme Hook Return Type
116
- * Theme utilities.
117
- */
118
- interface UseThemeReturn {
119
- /** Current theme ID */
120
- currentTheme: string | undefined;
121
- /** All available themes */
122
- themes: Array<{
123
- id: string;
124
- name: string;
125
- }>;
126
- /** Change theme */
127
- setTheme: (themeId: string) => void;
128
- }
129
- /**
130
- * useFormatters Hook Return Type
131
- * Locale-aware formatters (locale from i18nRegistry.getLanguage()).
132
- * References @gears-frontx/i18n Formatters so signatures stay in sync.
133
- */
134
- type UseFormattersReturn = Formatters;
135
-
136
- export { type HAI3ProviderProps as H, type MfeContextValue as M, type UseTranslationReturn as U, type UseScreenTranslationsReturn as a, type UseFormattersReturn as b, type UseThemeReturn as c, MfeContext as d, type UseAppDispatchReturn as e, type UseAppSelector as f, type UseHAI3Return as g, useMfeContext as u };