izen-react-starter 2.2.5 → 2.2.7

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,5 +1,7 @@
1
1
  export { RequiredAuth } from './RequiredAuth';
2
2
  export type { RequiredAuthProps } from './RequiredAuth';
3
+ export { useAppRouter } from './useAppRouter';
4
+ export type { AppRouterConfig } from './useAppRouter';
3
5
  export { usePathname, useRouter } from './hooks';
4
6
  export type { Router } from './hooks';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjD,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjD,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { RouteObject } from 'react-router-dom';
2
+ export interface AppRouterConfig {
3
+ /**
4
+ * Dashboard child routes - these will be wrapped in RequiredAuth and DashboardLayout
5
+ * Example: [{ path: 'users', element: <UsersPage /> }, ...]
6
+ */
7
+ dashboardChildren?: RouteObject[];
8
+ /**
9
+ * Custom DashboardLayout wrapper component
10
+ * If provided, replaces the default layout
11
+ */
12
+ DashboardLayout?: React.ComponentType<{
13
+ children: React.ReactNode;
14
+ }>;
15
+ /**
16
+ * Public routes to merge (HomePage, LoginPage, 404, etc.)
17
+ * These will be added as-is to the route config
18
+ */
19
+ publicRoutes?: RouteObject[];
20
+ /**
21
+ * Whether to include default 404 handling
22
+ * @default true
23
+ */
24
+ includeDefaultNotFound?: boolean;
25
+ }
26
+ /**
27
+ * Hook to build app routes with authentication and layout wrapping
28
+ *
29
+ * Developers provide their dashboard children routes and public routes,
30
+ * the hook handles RequiredAuth wrapping and DashboardLayout injection
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * import { useAppRouter } from 'izen-react-starter';
35
+ * import { Outlet, Suspense } from 'react';
36
+ * import DashboardLayout from '@/components/layout/dashboard-layout';
37
+ *
38
+ * export default function AppRouter() {
39
+ * const routes = useAppRouter({
40
+ * DashboardLayout,
41
+ * dashboardChildren: [
42
+ * { path: 'users', element: <UsersPage /> },
43
+ * { path: 'clients', element: <ClientsPage /> },
44
+ * { path: 'preferences', element: <PreferencesPage /> }
45
+ * ],
46
+ * publicRoutes: [
47
+ * { path: '/', element: <HomePage />, index: true },
48
+ * { path: '/login', element: <LoginPage /> },
49
+ * { path: '/404', element: <NotFoundPage /> }
50
+ * ]
51
+ * });
52
+ *
53
+ * return routes;
54
+ * }
55
+ * ```
56
+ */
57
+ export declare function useAppRouter(config: AppRouterConfig): import('react').ReactElement<any, string | import('react').JSXElementConstructor<any>> | null;
58
+ //# sourceMappingURL=useAppRouter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAppRouter.d.ts","sourceRoot":"","sources":["../../src/routes/useAppRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAa,MAAM,kBAAkB,CAAC;AAG1D,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,WAAW,EAAE,CAAC;IAElC;;;OAGG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,CAAC,CAAC;IAErE;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,EAAE,CAAC;IAE7B;;;OAGG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,iGAgDnD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "izen-react-starter",
3
- "version": "2.2.5",
3
+ "version": "2.2.7",
4
4
  "description": "A React component library with UI components, layout context, and data fetching",
5
5
  "type": "module",
6
6
  "main": "./dist/react-starter.umd.cjs",