@ericbutera/kaleido 0.1.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 (41) hide show
  1. package/dist/auth/components/auth/Layout.d.ts +4 -0
  2. package/dist/auth/index.d.ts +13 -0
  3. package/dist/auth/lib/AuthContext.d.ts +17 -0
  4. package/dist/auth/lib/form.d.ts +6 -0
  5. package/dist/auth/lib/types.d.ts +75 -0
  6. package/dist/auth/lib/utils.d.ts +2 -0
  7. package/dist/auth/pages/auth/ConfirmEmail.d.ts +1 -0
  8. package/dist/auth/pages/auth/ForgotPassword.d.ts +1 -0
  9. package/dist/auth/pages/auth/Login.d.ts +1 -0
  10. package/dist/auth/pages/auth/OAuthCallback.d.ts +1 -0
  11. package/dist/auth/pages/auth/ResendConfirmation.d.ts +1 -0
  12. package/dist/auth/pages/auth/Reset.d.ts +1 -0
  13. package/dist/auth/pages/auth/SignUp.d.ts +1 -0
  14. package/dist/auth/pages/auth/Verify.d.ts +1 -0
  15. package/dist/components/Pagination.d.ts +1 -0
  16. package/dist/components/admin/AdminLayout.d.ts +5 -0
  17. package/dist/components/admin/tasks/List.d.ts +1 -0
  18. package/dist/components/admin/tasks/Modal.d.ts +1 -0
  19. package/dist/components/common/AlertCard.d.ts +7 -0
  20. package/dist/components/common/GenericFormModal.d.ts +20 -0
  21. package/dist/components/common/GenericList.d.ts +23 -0
  22. package/dist/components/common/ModalErrors.d.ts +6 -0
  23. package/dist/components/common/Pagination.d.ts +10 -0
  24. package/dist/components/common/QRCodeGenerator.d.ts +10 -0
  25. package/dist/components/common/SortHeader.d.ts +10 -0
  26. package/dist/components/index.d.ts +9 -0
  27. package/dist/components/tasks/List.d.ts +7 -0
  28. package/dist/components/tasks/Modal.d.ts +7 -0
  29. package/dist/index.d.ts +14 -0
  30. package/dist/index.js +4787 -0
  31. package/dist/lib/date.d.ts +1 -0
  32. package/dist/lib/openapi/react-query/api.d.ts +1 -0
  33. package/dist/lib/paginatedQuery.d.ts +9 -0
  34. package/dist/lib/params/adminTasksParams.d.ts +29 -0
  35. package/dist/lib/params/paramsUtils.d.ts +6 -0
  36. package/dist/lib/params/validateParams.d.ts +8 -0
  37. package/dist/lib/queries.d.ts +6 -0
  38. package/dist/lib/tasksApi.d.ts +13 -0
  39. package/dist/pages/admin/Tasks.d.ts +1 -0
  40. package/dist/pages/index.d.ts +1 -0
  41. package/package.json +73 -0
@@ -0,0 +1,4 @@
1
+ import { ReactNode } from 'react';
2
+ export default function Layout({ children }: {
3
+ children: ReactNode;
4
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ export { AuthProvider, useAuthApi, useAuthConfig } from './lib/AuthContext';
2
+ export type { ApiError, AuthApiClient, AuthConfig, LoginRequest, RegisterRequest, ResendConfirmationRequest, ResetRequest, User, } from './lib/types';
3
+ export { handleFormError } from './lib/form';
4
+ export { redirectToOrigin } from './lib/utils';
5
+ export { default as AuthLayout } from './components/auth/Layout';
6
+ export { default as ConfirmEmail } from './pages/auth/ConfirmEmail';
7
+ export { default as ForgotPassword } from './pages/auth/ForgotPassword';
8
+ export { default as Login } from './pages/auth/Login';
9
+ export { default as OAuthCallback } from './pages/auth/OAuthCallback';
10
+ export { default as ResendConfirmation } from './pages/auth/ResendConfirmation';
11
+ export { default as Reset } from './pages/auth/Reset';
12
+ export { default as SignUp } from './pages/auth/SignUp';
13
+ export { default as Verify } from './pages/auth/Verify';
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ import { AuthApiClient, AuthConfig } from './types';
3
+ export declare function AuthProvider({ client, config, children, }: {
4
+ client: AuthApiClient;
5
+ config?: AuthConfig;
6
+ children: ReactNode;
7
+ }): import("react/jsx-runtime").JSX.Element;
8
+ /**
9
+ * Hook to access the auth API client from anywhere in the component tree.
10
+ * Must be used within an AuthProvider.
11
+ */
12
+ export declare function useAuthApi(): AuthApiClient;
13
+ /**
14
+ * Hook to access the auth configuration.
15
+ * Must be used within an AuthProvider.
16
+ */
17
+ export declare function useAuthConfig(): Required<AuthConfig>;
@@ -0,0 +1,6 @@
1
+ import { FieldValues, UseFormSetError } from 'react-hook-form';
2
+ /**
3
+ * Maps structured API errors to React Hook Form fields.
4
+ * Also shows a generic toast for the main message.
5
+ */
6
+ export declare function handleFormError<T extends FieldValues>(err: unknown, setError: UseFormSetError<T>, fallbackMsg?: string, showToast?: boolean): void;
@@ -0,0 +1,75 @@
1
+ import { UseFormSetError } from 'react-hook-form';
2
+ export interface LoginRequest {
3
+ email: string;
4
+ password: string;
5
+ }
6
+ export interface RegisterRequest {
7
+ email: string;
8
+ password: string;
9
+ name?: string;
10
+ }
11
+ export interface ResetRequest {
12
+ token: string;
13
+ password: string;
14
+ }
15
+ export interface ResendConfirmationRequest {
16
+ email: string;
17
+ }
18
+ export interface User {
19
+ id: string | number;
20
+ email: string;
21
+ name?: string;
22
+ verified?: boolean;
23
+ [key: string]: any;
24
+ }
25
+ export interface ApiError {
26
+ status: "error";
27
+ message: string;
28
+ errors?: Record<string, string[]>;
29
+ }
30
+ export interface AuthConfig {
31
+ oauthEnabled?: boolean;
32
+ registrationEnabled?: boolean;
33
+ OAuthButton?: React.ComponentType<{
34
+ text: string;
35
+ }>;
36
+ }
37
+ export interface AuthApiClient {
38
+ useLoginUser(): {
39
+ mutateAsync: (data: LoginRequest, setError?: UseFormSetError<any>) => Promise<void>;
40
+ isPending: boolean;
41
+ };
42
+ useRegisterUser(): {
43
+ mutateAsync: (data: RegisterRequest, setError?: UseFormSetError<any>) => Promise<void>;
44
+ isPending: boolean;
45
+ };
46
+ useForgotPassword(): {
47
+ mutateAsync: (email: string, setError?: UseFormSetError<any>) => Promise<void>;
48
+ isPending: boolean;
49
+ };
50
+ useResetPassword(): {
51
+ mutateAsync: (data: ResetRequest, setError?: UseFormSetError<any>) => Promise<void>;
52
+ isPending: boolean;
53
+ };
54
+ useVerifyEmail(): {
55
+ mutateAsync: (token: string, setError?: UseFormSetError<any>) => Promise<void>;
56
+ isPending: boolean;
57
+ };
58
+ useResendConfirmationEmail(): {
59
+ mutateAsync: (data: ResendConfirmationRequest, setError?: UseFormSetError<any>) => Promise<void>;
60
+ isPending: boolean;
61
+ };
62
+ useCurrentUser(): {
63
+ user: User | null | undefined;
64
+ isLoading: boolean;
65
+ isError: boolean;
66
+ };
67
+ useLogout(): {
68
+ mutateAsync: () => Promise<void>;
69
+ isPending: boolean;
70
+ };
71
+ useTokenRefresh?(): {
72
+ mutateAsync: () => Promise<void>;
73
+ isPending: boolean;
74
+ };
75
+ }
@@ -0,0 +1,2 @@
1
+ import { Location, NavigateFunction } from 'react-router-dom';
2
+ export declare function redirectToOrigin(navigate: NavigateFunction, location: Location, fallback?: string): void;
@@ -0,0 +1 @@
1
+ export default function ConfirmEmail(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function ForgotPassword(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Login(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function OAuthCallback(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function ResendConfirmation(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Reset(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function SignUp(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function Verify(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default } from './common/Pagination';
@@ -0,0 +1,5 @@
1
+ import { ReactNode } from 'react';
2
+ export default function AdminLayout({ title, children, }: {
3
+ title?: string;
4
+ children: ReactNode;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default } from '../../tasks/List';
@@ -0,0 +1 @@
1
+ export { default } from '../../tasks/Modal';
@@ -0,0 +1,7 @@
1
+ import { IconDefinition } from '@fortawesome/free-solid-svg-icons';
2
+ export default function AlertCard({ icon, title, message, action, }: {
3
+ icon: IconDefinition | null;
4
+ title: string;
5
+ message: string;
6
+ action?: React.ReactNode;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ import { FieldValues, UseFormHandleSubmit } from 'react-hook-form';
3
+ export interface GenericFormModalProps<TFormData extends FieldValues> {
4
+ isOpen: boolean;
5
+ title: string;
6
+ handleSubmit: UseFormHandleSubmit<TFormData>;
7
+ isSubmitting: boolean;
8
+ isSaving?: boolean;
9
+ uploadProgress?: number;
10
+ onSave: (data: TFormData, callbacks: {
11
+ onClose?: () => void;
12
+ }) => Promise<void>;
13
+ onClose: () => void;
14
+ onCancel?: () => void;
15
+ children: ReactNode;
16
+ maxWidth?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
17
+ submitLabel?: string;
18
+ cancelLabel?: string;
19
+ }
20
+ export default function GenericFormModal<TFormData extends FieldValues>({ isOpen, title, handleSubmit, isSubmitting, isSaving, uploadProgress, onSave, onClose, onCancel, children, maxWidth, submitLabel, cancelLabel, }: GenericFormModalProps<TFormData>): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ import { ZodTypeAny } from 'zod';
3
+ import { PaginatedQueryResult } from '../../lib/paginatedQuery';
4
+ export interface Column<T, P = any> {
5
+ key: string;
6
+ header: ReactNode | ((params: P, setFilter: (key: keyof P, value: any) => void, setFilters: (updates: Partial<P>) => void) => ReactNode);
7
+ render?: (item: T) => ReactNode;
8
+ className?: string;
9
+ }
10
+ export interface GenericListProps<T, P extends Record<string, any>> {
11
+ title?: ReactNode;
12
+ actions?: ReactNode;
13
+ paramsSchema: ZodTypeAny;
14
+ useQuery: (params: P) => PaginatedQueryResult<T>;
15
+ renderFilters?: (params: P, setFilter: (key: keyof P, value: any) => void) => ReactNode;
16
+ columns: Column<T, P>[];
17
+ emptyMessage?: string;
18
+ onRowClick?: (item: T) => void;
19
+ paginationType?: "pages" | "simple" | "none";
20
+ }
21
+ export default function GenericList<T extends {
22
+ id?: string | number;
23
+ }, P extends Record<string, any>>({ title, actions, paramsSchema, useQuery, renderFilters, columns, emptyMessage, onRowClick, paginationType, }: GenericListProps<T, P>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ interface ModalErrorsProps {
2
+ errors: string[];
3
+ className?: string;
4
+ }
5
+ export default function ModalErrors({ errors, className, }: ModalErrorsProps): import("react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1,10 @@
1
+ interface PaginationProps {
2
+ page: number;
3
+ perPage: number;
4
+ total: number;
5
+ onPageChange: (page: number) => void;
6
+ className?: string;
7
+ visiblePages?: number;
8
+ }
9
+ export default function Pagination({ page, perPage, total, onPageChange, className, visiblePages, }: PaginationProps): import("react/jsx-runtime").JSX.Element | null;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ interface QRCodeGeneratorProps {
2
+ id?: string;
3
+ value: string;
4
+ size?: number;
5
+ level?: "L" | "M" | "Q" | "H";
6
+ filenameBase?: string;
7
+ showDownloads?: boolean;
8
+ }
9
+ export default function QRCodeGenerator({ id, value, size, level, filenameBase, showDownloads, }: QRCodeGeneratorProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ interface SortHeaderProps<P> {
2
+ label: string;
3
+ field: string;
4
+ params: P;
5
+ setFilter: (key: keyof P, value: any) => void;
6
+ setFilters?: (updates: Partial<P>) => void;
7
+ className?: string;
8
+ }
9
+ export default function SortHeader<P extends Record<string, any>>({ label, field, params, setFilter, setFilters, className, }: SortHeaderProps<P>): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,9 @@
1
+ export { default as AdminLayout } from './admin/AdminLayout';
2
+ export { default as AlertCard } from './common/AlertCard';
3
+ export { default as GenericFormModal } from './common/GenericFormModal';
4
+ export { default as GenericList } from './common/GenericList';
5
+ export { default as ModalErrors } from './common/ModalErrors';
6
+ export { default as Pagination } from './common/Pagination';
7
+ 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,7 @@
1
+ import { components } from '../../lib/openapi/react-query/api';
2
+ type Task = components["schemas"]["AdminTaskResponse"];
3
+ interface ListProps {
4
+ setSelectedTask: (task: Task | null) => void;
5
+ }
6
+ export default function List({ setSelectedTask }: ListProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { components } from '../../lib/openapi/react-query/api';
2
+ interface ModalProps {
3
+ selectedTask: components["schemas"]["AdminTaskResponse"] | null;
4
+ setSelectedTask: (task: components["schemas"]["AdminTaskResponse"] | null) => void;
5
+ }
6
+ export default function Modal({ selectedTask, setSelectedTask }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
7
+ export {};
@@ -0,0 +1,14 @@
1
+ export * as auth from './auth';
2
+ 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
+ export { default as GenericList } from './components/common/GenericList';
7
+ export { default as Pagination } from './components/common/Pagination';
8
+ export { default as SortHeader } from './components/common/SortHeader';
9
+ export type { ApiError, AuthApiClient, AuthConfig, LoginRequest, RegisterRequest, ResendConfirmationRequest, ResetRequest, User, } from './auth';
10
+ export type { Column, GenericListProps } from './components/common/GenericList';
11
+ export { useTasksApi } from './lib/tasksApi';
12
+ export type { Task } from './lib/tasksApi';
13
+ export { buildApiQuery, parseParams, toSearchParams, } from './lib/params/paramsUtils';
14
+ export { validateParams } from './lib/params/validateParams';