@greatapps/greatauth-ui 0.3.7 → 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 +110 -1
- package/dist/index.js +943 -5
- package/dist/index.js.map +1 -1
- package/package.json +10 -7
- package/src/components/users/data-table.tsx +185 -0
- package/src/components/users/user-form-dialog.tsx +169 -0
- package/src/components/users/user-profile-badge.tsx +31 -0
- package/src/components/users/users-page.tsx +273 -0
- package/src/hooks/use-users.ts +82 -0
- package/src/index.ts +16 -0
- package/src/types/users.ts +46 -0
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';
|
|
@@ -1105,4 +1107,111 @@ interface ImageCropUploadProps {
|
|
|
1105
1107
|
}
|
|
1106
1108
|
declare function ImageCropUpload({ value, onChange, onRemove, entityType, entityId, idAccount, name, disabled, }: ImageCropUploadProps): react_jsx_runtime.JSX.Element;
|
|
1107
1109
|
|
|
1108
|
-
|
|
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 };
|