@idealyst/navigation 1.0.82 → 1.0.84

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.
Files changed (36) hide show
  1. package/package.json +23 -10
  2. package/src/context/NavigatorContext.native.tsx +37 -6
  3. package/src/context/NavigatorContext.web.tsx +5 -3
  4. package/src/context/types.ts +2 -0
  5. package/src/examples/CustomStackLayout.tsx +1 -3
  6. package/src/examples/CustomTabLayout.tsx +6 -5
  7. package/src/examples/ExampleNavigationRouter.tsx +111 -0
  8. package/src/examples/ExampleSearchDialog.tsx +134 -0
  9. package/src/examples/ExampleSidebar.tsx +134 -0
  10. package/src/examples/ExampleWebLayout.tsx +107 -0
  11. package/src/examples/HeaderRight.tsx +27 -0
  12. package/src/examples/index.ts +3 -5
  13. package/src/examples/unistyles.ts +6 -12
  14. package/src/hooks/useParams.web.ts +1 -1
  15. package/src/index.native.ts +4 -1
  16. package/src/index.web.ts +2 -2
  17. package/src/layouts/DefaultStackLayout.tsx +6 -5
  18. package/src/layouts/DefaultTabLayout.tsx +11 -6
  19. package/src/router/index.native.ts +17 -0
  20. package/src/router/index.ts +3 -0
  21. package/src/router/index.web.ts +6 -0
  22. package/src/routing/DrawerContentWrapper.native.tsx +25 -0
  23. package/src/routing/HeaderWrapper.native.tsx +19 -0
  24. package/src/routing/index.native.tsx +0 -4
  25. package/src/routing/index.web.tsx +1 -3
  26. package/src/routing/router.native.tsx +133 -23
  27. package/src/routing/router.web.tsx +2 -3
  28. package/src/routing/types.ts +40 -12
  29. package/CLAUDE.md +0 -417
  30. package/LLM-ACCESS-GUIDE.md +0 -166
  31. package/src/examples/ExampleDrawerRouter.tsx +0 -196
  32. package/src/examples/ExampleHybridRouter.tsx +0 -62
  33. package/src/examples/ExampleStackRouter.tsx +0 -266
  34. package/src/examples/ExampleTabRouter.tsx +0 -318
  35. package/src/examples/README.md +0 -394
  36. package/src/examples/highContrastThemes.ts +0 -583
@@ -1,394 +0,0 @@
1
- # Navigation Examples
2
-
3
- Pre-built, production-ready router examples that showcase the @idealyst/navigation system and serve as quick-start templates for your applications.
4
-
5
- ## Features
6
-
7
- - ✅ Complete, working router implementations
8
- - ✅ Integration with @idealyst/components examples
9
- - ✅ Theme system demonstrations
10
- - ✅ Multiple layout patterns (Stack, Tab, Drawer)
11
- - ✅ Cross-platform compatibility
12
- - ✅ Ready for customization and extension
13
-
14
- ## Available Examples
15
-
16
- ### ExampleStackRouter
17
-
18
- A stack-based navigation router with header and collapsible sidebar, perfect for desktop/web applications.
19
-
20
- ```tsx
21
- import { ExampleStackRouter } from '@idealyst/navigation/examples';
22
- import { NavigatorProvider } from '@idealyst/navigation';
23
-
24
- export default function App() {
25
- return (
26
- <NavigatorProvider route={ExampleStackRouter}>
27
- {/* Stack navigation with sidebar */}
28
- </NavigatorProvider>
29
- );
30
- }
31
- ```
32
-
33
- **Features:**
34
- - Header with app title
35
- - Collapsible left sidebar with home navigation
36
- - Theme controls (cycle themes, toggle high contrast)
37
- - All component examples integrated
38
- - Responsive design for desktop/web
39
-
40
- **Use Cases:**
41
- - Admin dashboards
42
- - Desktop applications
43
- - Content management systems
44
- - Developer tools
45
-
46
- ### ExampleTabRouter
47
-
48
- A tab-based navigation router ideal for mobile applications and content browsing.
49
-
50
- ```tsx
51
- import { ExampleTabRouter } from '@idealyst/navigation/examples';
52
- import { NavigatorProvider } from '@idealyst/navigation';
53
-
54
- export default function App() {
55
- return (
56
- <NavigatorProvider route={ExampleTabRouter}>
57
- {/* Tab navigation for component browsing */}
58
- </NavigatorProvider>
59
- );
60
- }
61
- ```
62
-
63
- **Features:**
64
- - Bottom tab navigation (mobile) / top tabs (web)
65
- - Home screen with theme controls
66
- - Individual tabs for each component example
67
- - Clean, focused component demonstrations
68
- - Mobile-optimized user experience
69
-
70
- **Use Cases:**
71
- - Mobile applications
72
- - Component galleries
73
- - Content exploration apps
74
- - Multi-section interfaces
75
-
76
- ### ExampleDrawerRouter
77
-
78
- A drawer-based navigation router optimized for desktop interfaces with extensive navigation needs.
79
-
80
- ```tsx
81
- import { ExampleDrawerRouter } from '@idealyst/navigation/examples';
82
- import { NavigatorProvider } from '@idealyst/navigation';
83
-
84
- export default function App() {
85
- return (
86
- <NavigatorProvider route={ExampleDrawerRouter}>
87
- {/* Drawer navigation with slide-out menu */}
88
- </NavigatorProvider>
89
- );
90
- }
91
- ```
92
-
93
- **Features:**
94
- - Slide-out drawer navigation
95
- - Organized menu structure
96
- - Desktop-optimized layout
97
- - Gesture support for drawer open/close
98
- - Scalable navigation for large apps
99
-
100
- **Use Cases:**
101
- - Enterprise applications
102
- - Complex desktop interfaces
103
- - Multi-module systems
104
- - Admin interfaces with many sections
105
-
106
- ## Router Structure
107
-
108
- ### Stack Router Implementation
109
-
110
- ```tsx
111
- // Simplified structure of ExampleStackRouter
112
- const StackRouter: RouteParam = {
113
- path: "/",
114
- component: HomeScreen, // Main dashboard screen
115
- layout: {
116
- type: "stack",
117
- component: WrappedGeneralLayout, // Custom layout with header/sidebar
118
- },
119
- routes: [
120
- { path: "avatar", component: AvatarExamples },
121
- { path: "button", component: ButtonExamples },
122
- { path: "card", component: CardExamples },
123
- // ... all component examples
124
- { path: "theme-extension", component: ThemeExtensionExamples },
125
- ],
126
- };
127
- ```
128
-
129
- ### Tab Router Implementation
130
-
131
- ```tsx
132
- // Simplified structure of ExampleTabRouter
133
- const TabRouter: RouteParam = {
134
- path: "/",
135
- component: HomeTabScreen, // Welcome screen with theme controls
136
- layout: {
137
- type: "tab", // Tab layout
138
- },
139
- routes: [
140
- { path: "avatar", component: AvatarTabScreen },
141
- { path: "button", component: ButtonTabScreen },
142
- { path: "card", component: CardTabScreen },
143
- // ... component tabs
144
- ],
145
- };
146
- ```
147
-
148
- ## Theme Integration
149
-
150
- All example routers include comprehensive theme system demonstrations:
151
-
152
- ### Theme Controls
153
-
154
- ```tsx
155
- // Available in all example routers
156
- const ThemeControls = () => {
157
- const currentTheme = UnistylesRuntime.themeName || 'light';
158
-
159
- const cycleTheme = () => {
160
- const nextTheme = getNextTheme(currentTheme);
161
- UnistylesRuntime.setTheme(nextTheme);
162
- };
163
-
164
- const toggleHighContrast = () => {
165
- // Toggle between standard and high contrast variants
166
- const newTheme = isHighContrastTheme(currentTheme)
167
- ? getStandardVariant(currentTheme)
168
- : getHighContrastVariant(currentTheme);
169
- UnistylesRuntime.setTheme(newTheme);
170
- };
171
-
172
- return (
173
- <View>
174
- <Button onPress={cycleTheme}>Cycle Theme</Button>
175
- <Button onPress={toggleHighContrast}>Toggle High Contrast</Button>
176
- </View>
177
- );
178
- };
179
- ```
180
-
181
- ### Available Themes
182
-
183
- - **light**: Standard light theme
184
- - **dark**: Standard dark theme
185
- - **lightHighContrast**: High contrast light theme
186
- - **darkHighContrast**: High contrast dark theme
187
-
188
- ### Theme Utilities
189
-
190
- ```tsx
191
- import {
192
- getNextTheme,
193
- getThemeDisplayName,
194
- isHighContrastTheme
195
- } from '@idealyst/navigation/examples/unistyles';
196
-
197
- // Cycle through all available themes
198
- const nextTheme = getNextTheme('light'); // Returns 'dark'
199
-
200
- // Get human-readable theme name
201
- const displayName = getThemeDisplayName('lightHighContrast'); // "Light High Contrast"
202
-
203
- // Check if theme is high contrast variant
204
- const isHighContrast = isHighContrastTheme('darkHighContrast'); // true
205
- ```
206
-
207
- ## Component Integration
208
-
209
- All example routers showcase the complete @idealyst/components library:
210
-
211
- ### Integrated Components
212
-
213
- | Component | Example Content |
214
- |-----------|----------------|
215
- | Avatar | Profile pictures, fallbacks, sizes |
216
- | Badge | Notification counts, status indicators |
217
- | Button | Variants, intents, interactions |
218
- | Card | Content containers, clickable cards |
219
- | Checkbox | Form inputs, validation states |
220
- | Divider | Content separation, spacing |
221
- | Icon | Icon library, sizes, colors |
222
- | Input | Text inputs, validation, forms |
223
- | Screen | Full-screen layouts, backgrounds |
224
- | Text | Typography, sizes, weights |
225
- | View | Layout containers, spacing |
226
-
227
- ### Example Screen Structure
228
-
229
- ```tsx
230
- // Typical component example screen
231
- const ButtonExamples = () => (
232
- <Screen>
233
- <View spacing="lg">
234
- <Text size="xlarge" weight="bold">Button Component</Text>
235
-
236
- <View spacing="md">
237
- <Text size="large" weight="semibold">Variants</Text>
238
- <Button variant="contained">Contained</Button>
239
- <Button variant="outlined">Outlined</Button>
240
- <Button variant="text">Text</Button>
241
- </View>
242
-
243
- <View spacing="md">
244
- <Text size="large" weight="semibold">Intents</Text>
245
- <Button intent="primary">Primary</Button>
246
- <Button intent="success">Success</Button>
247
- <Button intent="error">Error</Button>
248
- </View>
249
- </View>
250
- </Screen>
251
- );
252
- ```
253
-
254
- ## Customization
255
-
256
- Use the example routers as starting points for your own applications:
257
-
258
- ### Extending Routes
259
-
260
- ```tsx
261
- import { ExampleStackRouter } from '@idealyst/navigation/examples';
262
-
263
- // Add your own routes to an example router
264
- const CustomRouter: RouteParam = {
265
- ...ExampleStackRouter,
266
- routes: [
267
- ...ExampleStackRouter.routes,
268
- { path: "my-screen", component: MyCustomScreen },
269
- { path: "another-screen", component: AnotherScreen },
270
- ],
271
- };
272
- ```
273
-
274
- ### Custom Layout
275
-
276
- ```tsx
277
- import { GeneralLayout } from '@idealyst/navigation';
278
-
279
- const MyCustomLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) => (
280
- <GeneralLayout
281
- header={{
282
- content: <Text>My Custom App</Text>,
283
- }}
284
- sidebar={{
285
- enabled: true,
286
- content: <MyNavigation />,
287
- }}
288
- >
289
- {children}
290
- </GeneralLayout>
291
- );
292
-
293
- const CustomRouter: RouteParam = {
294
- path: "/",
295
- component: HomeScreen,
296
- layout: {
297
- type: "stack",
298
- component: MyCustomLayout,
299
- },
300
- routes: [
301
- // Your routes here
302
- ],
303
- };
304
- ```
305
-
306
- ### Replacing Example Components
307
-
308
- ```tsx
309
- // Replace example components with your own
310
- const ProductionRouter: RouteParam = {
311
- path: "/",
312
- component: DashboardScreen, // Your main screen
313
- layout: { type: "stack" },
314
- routes: [
315
- { path: "users", component: UserManagement },
316
- { path: "products", component: ProductCatalog },
317
- { path: "orders", component: OrderTracking },
318
- ],
319
- };
320
- ```
321
-
322
- ## Development and Testing
323
-
324
- The example routers serve as excellent development and testing environments:
325
-
326
- ### Component Development
327
-
328
- ```tsx
329
- // Use examples to develop and test new components
330
- import { ExampleStackRouter } from '@idealyst/navigation/examples';
331
-
332
- // Add your component to the router for testing
333
- const DevelopmentRouter: RouteParam = {
334
- ...ExampleStackRouter,
335
- routes: [
336
- ...ExampleStackRouter.routes,
337
- { path: "my-new-component", component: MyNewComponentExamples },
338
- ],
339
- };
340
- ```
341
-
342
- ### Theme Testing
343
-
344
- ```tsx
345
- // Test components across all themes using the built-in theme controls
346
- const TestScreen = () => {
347
- return (
348
- <Screen>
349
- <ThemeControls />
350
- <MyComponentToTest />
351
- </Screen>
352
- );
353
- };
354
- ```
355
-
356
- ## Best Practices
357
-
358
- 1. **Start with Examples**: Use example routers as starting points for new projects
359
- 2. **Customize Gradually**: Modify examples incrementally to avoid breaking functionality
360
- 3. **Keep Theme Controls**: Maintain theme switching for development and accessibility
361
- 4. **Test All Layouts**: Try your content in all three layout types (stack, tab, drawer)
362
- 5. **Cross-Platform Testing**: Test examples on both React Native and Web
363
- 6. **Component Integration**: Use the component examples as reference implementations
364
-
365
- ## File Structure
366
-
367
- ```
368
- src/examples/
369
- ├── ExampleStackRouter.tsx # Stack navigation with sidebar
370
- ├── ExampleTabRouter.tsx # Tab navigation for mobile
371
- ├── ExampleDrawerRouter.tsx # Drawer navigation for desktop
372
- ├── unistyles.ts # Theme utilities and helpers
373
- ├── highContrastThemes.ts # High contrast theme definitions
374
- └── index.ts # Export all examples
375
- ```
376
-
377
- ## Import Patterns
378
-
379
- ```tsx
380
- // Import specific example routers
381
- import { ExampleStackRouter } from '@idealyst/navigation/examples';
382
- import { ExampleTabRouter } from '@idealyst/navigation/examples';
383
- import { ExampleDrawerRouter } from '@idealyst/navigation/examples';
384
-
385
- // Import theme utilities
386
- import {
387
- getNextTheme,
388
- getThemeDisplayName,
389
- isHighContrastTheme
390
- } from '@idealyst/navigation/examples/unistyles';
391
-
392
- // Import all examples
393
- import * as NavigationExamples from '@idealyst/navigation/examples';
394
- ```