@ericbutera/kaleido 0.1.12 → 0.2.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.
Files changed (39) hide show
  1. package/dist/{components/admin/AdminLayout.d.ts → admin/components/Layout.d.ts} +1 -1
  2. package/dist/admin/components/Route.d.ts +1 -0
  3. package/dist/{components → admin/components}/tasks/List.d.ts +1 -2
  4. package/dist/admin/components/tasks/Modal.d.ts +7 -0
  5. package/dist/admin/components/users/List.d.ts +7 -0
  6. package/dist/admin/components/users/Modal.d.ts +8 -0
  7. package/dist/admin/components/users/index.d.ts +2 -0
  8. package/dist/admin/index.d.ts +7 -0
  9. package/dist/admin/pages/Dashboard.d.ts +1 -0
  10. package/dist/admin/pages/Users.d.ts +1 -0
  11. package/dist/{lib/params/adminTasksParams.d.ts → admin/params/TasksParams.d.ts} +7 -8
  12. package/dist/admin/params/UsersParams.d.ts +18 -0
  13. package/dist/auth/components/ProtectedRoute.d.ts +3 -0
  14. package/dist/auth/index.d.ts +2 -0
  15. package/dist/auth/lib/useAuth.d.ts +8 -0
  16. package/dist/components/index.d.ts +1 -4
  17. package/dist/configureKaleido.d.ts +26 -0
  18. package/dist/index.d.ts +11 -8
  19. package/dist/index.js +4056 -2684
  20. package/dist/kaleido.d.ts +44 -0
  21. package/dist/lib/apiHelpers.d.ts +15 -0
  22. package/dist/openapi/createKaleidoOpenApiAdapters.d.ts +44 -0
  23. package/dist/openapi/createKaleidoOpenApiAuthClient.d.ts +35 -0
  24. package/dist/openapi/index.d.ts +2 -0
  25. package/dist/tasks/index.d.ts +2 -0
  26. package/dist/tasks/useTasks.d.ts +27 -0
  27. package/dist/users/index.d.ts +2 -0
  28. package/dist/users/useUsers.d.ts +74 -0
  29. package/package.json +3 -1
  30. package/dist/components/admin/tasks/List.d.ts +0 -1
  31. package/dist/components/admin/tasks/Modal.d.ts +0 -1
  32. package/dist/components/tasks/Modal.d.ts +0 -7
  33. package/dist/lib/openapi/react-query/api.d.ts +0 -1
  34. package/dist/lib/queries.d.ts +0 -6
  35. package/dist/lib/tasksApi.d.ts +0 -13
  36. package/dist/pages/index.d.ts +0 -2
  37. /package/dist/{components/admin → admin/components}/adminLayoutConfig.d.ts +0 -0
  38. /package/dist/{pages/admin → admin/pages}/FeatureFlags.d.ts +0 -0
  39. /package/dist/{pages/admin → admin/pages}/Tasks.d.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- export default function AdminLayout({ title, children, }: {
2
+ export default function Layout({ title, children, }: {
3
3
  title?: string;
4
4
  children: ReactNode;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Route(): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,4 @@
1
- import { components } from '../../lib/openapi/react-query/api';
2
- type Task = components["schemas"]["AdminTaskResponse"];
1
+ import { Task } from '../../../tasks/useTasks';
3
2
  interface ListProps {
4
3
  setSelectedTask: (task: Task | null) => void;
5
4
  }
@@ -0,0 +1,7 @@
1
+ import { Task } from '../../../tasks/useTasks';
2
+ interface ModalProps {
3
+ selectedTask: Task | null;
4
+ setSelectedTask: (task: Task | null) => void;
5
+ }
6
+ export default function Modal({ selectedTask, setSelectedTask }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { User } from '../../../users/useUsers';
2
+ interface ListProps {
3
+ onCreateUser: () => void;
4
+ onSelectUser: (user: User) => void;
5
+ }
6
+ export default function List({ onCreateUser, onSelectUser }: ListProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ import { User } from '../../../users/useUsers';
2
+ interface ModalProps {
3
+ mode: "create" | "edit" | null;
4
+ selectedUser: User | null;
5
+ onClose: () => void;
6
+ }
7
+ export default function Modal({ mode, selectedUser, onClose }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as UsersList } from './List';
2
+ export { default as UsersModal } from './Modal';
@@ -0,0 +1,7 @@
1
+ export { configureAdminLayout } from '../admin/components/adminLayoutConfig';
2
+ export { default as Layout } from '../admin/components/Layout';
3
+ export { default as Dashboard } from '../admin/pages/Dashboard';
4
+ export { default as FeatureFlags } from '../admin/pages/FeatureFlags';
5
+ export { default as Tasks } from '../admin/pages/Tasks';
6
+ export { default as Users } from '../admin/pages/Users';
7
+ export { default as Route } from './components/Route';
@@ -0,0 +1 @@
1
+ export default function Dashboard(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Users(): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export declare const adminTasksSchema: z.ZodObject<{
2
+ export declare const TasksSchema: z.ZodObject<{
3
3
  q: z.ZodOptional<z.ZodString>;
4
4
  task_type: z.ZodOptional<z.ZodString>;
5
5
  status: z.ZodOptional<z.ZodString>;
@@ -10,20 +10,19 @@ export declare const adminTasksSchema: z.ZodObject<{
10
10
  }, "strip", z.ZodTypeAny, {
11
11
  page: number;
12
12
  per_page: number;
13
- q?: string | undefined;
14
- status?: string | undefined;
15
13
  task_type?: string | undefined;
14
+ status?: string | undefined;
15
+ q?: string | undefined;
16
16
  from_date?: string | undefined;
17
17
  to_date?: string | undefined;
18
18
  }, {
19
+ task_type?: string | undefined;
20
+ status?: string | undefined;
19
21
  page?: number | undefined;
20
22
  q?: string | undefined;
21
- status?: string | undefined;
22
23
  per_page?: number | undefined;
23
- task_type?: string | undefined;
24
24
  from_date?: string | undefined;
25
25
  to_date?: string | undefined;
26
26
  }>;
27
- export type AdminTasksParams = z.infer<typeof adminTasksSchema>;
28
- export declare function parseAdminTasksParams(searchParams: URLSearchParams): AdminTasksParams;
29
- export declare function toSearchParams(params: Partial<AdminTasksParams>): URLSearchParams;
27
+ export type TasksParams = z.infer<typeof TasksSchema>;
28
+ export declare function toSearchParams(params: Partial<TasksParams>): URLSearchParams;
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ export declare const UsersSchema: z.ZodObject<{
3
+ q: z.ZodOptional<z.ZodString>;
4
+ disabled: z.ZodOptional<z.ZodEnum<["true", "false"]>>;
5
+ page: z.ZodDefault<z.ZodNumber>;
6
+ per_page: z.ZodDefault<z.ZodNumber>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ page: number;
9
+ per_page: number;
10
+ q?: string | undefined;
11
+ disabled?: "true" | "false" | undefined;
12
+ }, {
13
+ page?: number | undefined;
14
+ q?: string | undefined;
15
+ disabled?: "true" | "false" | undefined;
16
+ per_page?: number | undefined;
17
+ }>;
18
+ export type UsersParams = z.infer<typeof UsersSchema>;
@@ -0,0 +1,3 @@
1
+ export default function ProtectedRoute({ children, }: {
2
+ children: React.ReactNode;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,10 @@
1
1
  export { AuthProvider, useAuthApi, useAuthConfig } from './lib/AuthContext';
2
+ export { useAuth } from './lib/useAuth';
2
3
  export type { ApiError, AuthApiClient, AuthConfig, LoginRequest, RegisterRequest, ResendConfirmationRequest, ResetRequest, User, } from './lib/types';
3
4
  export { handleFormError } from './lib/form';
4
5
  export { redirectToOrigin } from './lib/utils';
5
6
  export { default as AuthLayout } from './components/auth/Layout';
7
+ export { default as ProtectedRoute } from './components/ProtectedRoute';
6
8
  export { default as ConfirmEmail } from './pages/auth/ConfirmEmail';
7
9
  export { default as ForgotPassword } from './pages/auth/ForgotPassword';
8
10
  export { default as Login } from './pages/auth/Login';
@@ -0,0 +1,8 @@
1
+ export declare function useAuth(): {
2
+ readonly user: import('./types').User | null;
3
+ readonly isLoading: boolean;
4
+ readonly signIn: (email: string, password: string) => Promise<void>;
5
+ readonly signUp: (email: string, password: string, name?: string) => Promise<void>;
6
+ readonly signOut: () => Promise<void>;
7
+ readonly completeOAuthLogin: (_userData?: unknown) => Promise<boolean>;
8
+ };
@@ -1,9 +1,6 @@
1
- export { default as AdminLayout } from './admin/AdminLayout';
2
1
  export { default as AlertCard } from './common/AlertCard';
3
2
  export { default as GenericFormModal } from './common/GenericFormModal';
4
- export { default as GenericList } from './common/GenericList';
3
+ export { default as GenericList, type Column } from './common/GenericList';
5
4
  export { default as ModalErrors } from './common/ModalErrors';
6
5
  export { default as Pagination } from './common/Pagination';
7
6
  export { default as QRCodeGenerator } from './common/QRCodeGenerator';
8
- export { default as TasksList } from './tasks/List';
9
- export { default as TasksModal } from './tasks/Modal';
@@ -0,0 +1,26 @@
1
+ import { FeatureFlagsConfig } from './featureFlags/useFeatureFlag';
2
+ import { TasksConfig } from './tasks/useTasks';
3
+ import { UsersConfig } from './users/useUsers';
4
+ export type KaleidoFeature = "tasks" | "feature-flags" | "admin-users";
5
+ export interface KaleidoFeatureAdapters {
6
+ tasks?: TasksConfig;
7
+ featureFlags?: FeatureFlagsConfig;
8
+ users?: UsersConfig;
9
+ }
10
+ export interface KaleidoConfig {
11
+ features: KaleidoFeature[];
12
+ adapters: KaleidoFeatureAdapters;
13
+ }
14
+ /**
15
+ * Configure Kaleido by feature, instead of wiring each hook group individually.
16
+ *
17
+ * Example:
18
+ * configureKaleido({
19
+ * features: ["tasks", "feature-flags"],
20
+ * adapters: {
21
+ * tasks: tasksConfig,
22
+ * featureFlags: featureFlagsConfig,
23
+ * },
24
+ * })
25
+ */
26
+ export declare function configureKaleido(config: KaleidoConfig): void;
package/dist/index.d.ts CHANGED
@@ -1,16 +1,19 @@
1
+ export { QueryClientProvider } from '@tanstack/react-query';
2
+ export * as admin from './admin';
1
3
  export * as auth from './auth';
2
4
  export * as components from './components';
3
- export * as pages from './pages';
4
- export { AuthProvider, useAuthApi, useAuthConfig } from './auth';
5
- export { default as AdminLayout } from './components/admin/AdminLayout';
6
5
  export { default as GenericList } from './components/common/GenericList';
6
+ export type { Column, GenericListProps } from './components/common/GenericList';
7
7
  export { default as Pagination } from './components/common/Pagination';
8
8
  export { default as SortHeader } from './components/common/SortHeader';
9
+ export { configureKaleido, type KaleidoConfig, type KaleidoFeature, type KaleidoFeatureAdapters, } from './configureKaleido';
9
10
  export * as featureFlags from './featureFlags';
10
- export { configureAdminLayout } from './components/admin/adminLayoutConfig';
11
- export type { ApiError, AuthApiClient, AuthConfig, LoginRequest, RegisterRequest, ResendConfirmationRequest, ResetRequest, User, } from './auth';
12
- export type { Column, GenericListProps } from './components/common/GenericList';
13
- export { useTasksApi } from './lib/tasksApi';
14
- export type { Task } from './lib/tasksApi';
11
+ export { default, default as kaleido, type KaleidoAppConfig, type KaleidoRuntimeConfig, type KaleidoToggleConfig, } from './kaleido';
12
+ export { createClient, createFetchClient, fetchWithCredentials, handleApiError, newQueryClient, } from './lib/apiHelpers';
13
+ export type { ApiError } from './lib/apiHelpers';
15
14
  export { buildApiQuery, parseParams, toSearchParams, } from './lib/params/paramsUtils';
16
15
  export { validateParams } from './lib/params/validateParams';
16
+ export * from './openapi';
17
+ export * as openapi from './openapi';
18
+ export * as tasks from './tasks';
19
+ export * as users from './users';