@greatapps/greatauth-ui 0.3.6 → 0.3.8

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.
package/dist/index.d.ts CHANGED
@@ -5,6 +5,8 @@ import * as better_auth from 'better-auth';
5
5
  export { AuthMiddlewareConfig, authMiddlewareConfig, createAuthMiddleware } from './middleware.js';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
7
  export { S as SidebarInset, a as SidebarProvider, b as SidebarTrigger, T as TooltipProvider, c as cn, u as useSidebar } from './utils-DPybL8ti.js';
8
+ import * as _tanstack_react_query from '@tanstack/react-query';
9
+ import { ColumnDef } from '@tanstack/react-table';
8
10
  import 'next/server';
9
11
  import 'class-variance-authority/types';
10
12
  import 'class-variance-authority';
@@ -1078,4 +1080,138 @@ declare function LoginForm({ config }: LoginFormProps): react_jsx_runtime.JSX.El
1078
1080
 
1079
1081
  declare function ThemeToggle(): react_jsx_runtime.JSX.Element;
1080
1082
 
1081
- export { AppHeader, AppShell, type AppShellConfig, AppSidebar, type HeaderConfig, LoginForm, type LoginFormConfig, type MenuGroup, type MenuItem, ThemeToggle, authClient, createUseAuth, signIn, signOut, signUp, useSession };
1083
+ declare const SIZE_MAP: {
1084
+ readonly xs: "h-5 w-5 text-[9px]";
1085
+ readonly sm: "h-6 w-6 text-[10px]";
1086
+ readonly md: "h-8 w-8 text-xs";
1087
+ readonly lg: "h-10 w-10 text-sm";
1088
+ readonly xl: "h-16 w-16 text-lg";
1089
+ };
1090
+ interface EntityAvatarProps {
1091
+ photo?: string | null;
1092
+ name: string | null;
1093
+ size?: keyof typeof SIZE_MAP;
1094
+ className?: string;
1095
+ }
1096
+ declare function EntityAvatar({ photo, name, size, className, }: EntityAvatarProps): react_jsx_runtime.JSX.Element;
1097
+
1098
+ interface ImageCropUploadProps {
1099
+ value?: string | null;
1100
+ onChange: (url: string) => void;
1101
+ onRemove?: () => void;
1102
+ entityType: string;
1103
+ entityId?: number | string;
1104
+ idAccount: number;
1105
+ name?: string | null;
1106
+ disabled?: boolean;
1107
+ }
1108
+ declare function ImageCropUpload({ value, onChange, onRemove, entityType, entityId, idAccount, name, disabled, }: ImageCropUploadProps): react_jsx_runtime.JSX.Element;
1109
+
1110
+ type UserProfile = "viewer" | "collaborator" | "admin" | "owner" | "attendant";
1111
+ type PhoneLabel = "celular" | "comercial" | "residencial" | "outro";
1112
+ interface GauthUser {
1113
+ id: number;
1114
+ id_account: number;
1115
+ name: string;
1116
+ last_name: string;
1117
+ email: string;
1118
+ profile: UserProfile;
1119
+ photo: string | null;
1120
+ last_login: string | null;
1121
+ deleted: number;
1122
+ datetime_add: string;
1123
+ datetime_alt: string | null;
1124
+ datetime_del: string | null;
1125
+ }
1126
+ interface UserPhone {
1127
+ id: number;
1128
+ id_account: number;
1129
+ id_user: number;
1130
+ phone_number: string;
1131
+ label: PhoneLabel;
1132
+ is_primary: number;
1133
+ deleted: number;
1134
+ datetime_add: string;
1135
+ datetime_alt: string | null;
1136
+ datetime_del: string | null;
1137
+ }
1138
+ interface GauthUserHookConfig {
1139
+ token: string | null;
1140
+ accountId: number | string | null;
1141
+ gauthApiUrl: string;
1142
+ language?: string;
1143
+ idWl?: string | number;
1144
+ }
1145
+ interface ApiResponse<T = unknown> {
1146
+ status: 0 | 1;
1147
+ message: string;
1148
+ data: T;
1149
+ total?: number;
1150
+ }
1151
+
1152
+ declare function useUsers(config: GauthUserHookConfig, params?: Record<string, string>): _tanstack_react_query.UseQueryResult<{
1153
+ data: GauthUser[];
1154
+ total: number;
1155
+ }, Error>;
1156
+ declare function useCreateUser(config: GauthUserHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<GauthUser>, Error, {
1157
+ name: string;
1158
+ last_name?: string;
1159
+ email: string;
1160
+ password?: string;
1161
+ profile?: string;
1162
+ photo?: string | null;
1163
+ }, unknown>;
1164
+ declare function useUpdateUser(config: GauthUserHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<GauthUser>, Error, {
1165
+ id: number;
1166
+ body: Record<string, unknown>;
1167
+ }, unknown>;
1168
+ declare function useDeleteUser(config: GauthUserHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<void>, Error, number, unknown>;
1169
+ declare function useResetPassword(config: GauthUserHookConfig): _tanstack_react_query.UseMutationResult<ApiResponse<{
1170
+ message: string;
1171
+ }>, Error, number, unknown>;
1172
+
1173
+ interface UsersPageProps {
1174
+ config: GauthUserHookConfig;
1175
+ profileOptions?: {
1176
+ value: string;
1177
+ label: string;
1178
+ }[];
1179
+ renderPhones?: (idUser: number) => React.ReactNode;
1180
+ }
1181
+ declare function UsersPage({ config, profileOptions, renderPhones }: UsersPageProps): react_jsx_runtime.JSX.Element;
1182
+
1183
+ interface UserFormDialogProps {
1184
+ open: boolean;
1185
+ onOpenChange: (open: boolean) => void;
1186
+ user?: GauthUser;
1187
+ config: GauthUserHookConfig;
1188
+ profileOptions?: {
1189
+ value: string;
1190
+ label: string;
1191
+ }[];
1192
+ renderPhones?: (idUser: number) => React.ReactNode;
1193
+ }
1194
+ declare function UserFormDialog({ open, onOpenChange, user, config, profileOptions, renderPhones, }: UserFormDialogProps): react_jsx_runtime.JSX.Element;
1195
+
1196
+ interface UserProfileBadgeProps {
1197
+ profile: UserProfile | string;
1198
+ }
1199
+ declare function UserProfileBadge({ profile }: UserProfileBadgeProps): react_jsx_runtime.JSX.Element;
1200
+
1201
+ interface DataTableProps<TData, TValue> {
1202
+ columns: ColumnDef<TData, TValue>[];
1203
+ data: TData[];
1204
+ isLoading?: boolean;
1205
+ emptyMessage?: string;
1206
+ total?: number;
1207
+ page?: number;
1208
+ onPageChange?: (page: number) => void;
1209
+ pageSize?: number;
1210
+ onRowClick?: (row: TData) => void;
1211
+ selectedRowId?: string | number | null;
1212
+ getRowId?: (row: TData) => string | number;
1213
+ compact?: boolean;
1214
+ }
1215
+ declare function DataTable<TData, TValue>({ columns, data, isLoading, emptyMessage, total, page, onPageChange, pageSize, onRowClick, selectedRowId, getRowId, compact, }: DataTableProps<TData, TValue>): react_jsx_runtime.JSX.Element;
1216
+
1217
+ export { AppHeader, AppShell, type AppShellConfig, AppSidebar, DataTable, type DataTableProps, EntityAvatar, type EntityAvatarProps, type GauthUser, type GauthUserHookConfig, type HeaderConfig, ImageCropUpload, type ImageCropUploadProps, LoginForm, type LoginFormConfig, type MenuGroup, type MenuItem, type PhoneLabel, ThemeToggle, UserFormDialog, type UserFormDialogProps, type UserPhone, type UserProfile, UserProfileBadge, type UserProfileBadgeProps, UsersPage, type UsersPageProps, authClient, createUseAuth, signIn, signOut, signUp, useCreateUser, useDeleteUser, useResetPassword, useSession, useUpdateUser, useUsers };