@niledatabase/react 3.0.0-alpha.9 → 3.0.1-alpha.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.
- package/dist/index.d.mts +355 -0
- package/dist/index.d.ts +355 -11
- package/dist/index.js +3 -8
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +52 -32
- package/dist/GoogleLoginButton/GoogleLoginButton.d.ts +0 -10
- package/dist/GoogleLoginButton/GoogleLoginButton.stories.d.ts +0 -11
- package/dist/GoogleLoginButton/index.d.ts +0 -1
- package/dist/SignInForm/SignInForm.d.ts +0 -3
- package/dist/SignInForm/UserLoginForm.stories.d.ts +0 -5
- package/dist/SignInForm/index.d.ts +0 -1
- package/dist/SignInForm/types.d.ts +0 -16
- package/dist/SignUpForm/NewUserSignUp.stories.d.ts +0 -5
- package/dist/SignUpForm/SignUpForm.d.ts +0 -3
- package/dist/SignUpForm/index.d.ts +0 -1
- package/dist/SignUpForm/types.d.ts +0 -13
- package/dist/UserTenantList/CreateUser.d.ts +0 -8
- package/dist/UserTenantList/UserList.d.ts +0 -17
- package/dist/UserTenantList/UserList.stories.d.ts +0 -5
- package/dist/UserTenantList/UserModal.d.ts +0 -7
- package/dist/UserTenantList/index.d.ts +0 -1
- package/dist/UserTenantList/useDataParser.d.ts +0 -4
- package/dist/context/index.d.ts +0 -9
- package/dist/context/theme.d.ts +0 -7
- package/dist/context/types.d.ts +0 -22
- package/dist/hooks/useResults.d.ts +0 -22
- package/dist/hooks/useTextSizer.d.ts +0 -1
- package/dist/lib/SimpleForm/CheckGroup/index.d.ts +0 -10
- package/dist/lib/SimpleForm/index.d.ts +0 -11
- package/dist/lib/SimpleForm/types.d.ts +0 -37
- package/dist/react.cjs.development.js +0 -943
- package/dist/react.cjs.development.js.map +0 -1
- package/dist/react.cjs.production.min.js +0 -2
- package/dist/react.cjs.production.min.js.map +0 -1
- package/dist/react.esm.d.ts +0 -11
- package/dist/react.esm.js +0 -911
- package/dist/react.esm.js.map +0 -1
- package/dist/utils/getColumnSize.d.ts +0 -2
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
5
|
+
import * as next_auth_react from 'next-auth/react';
|
|
6
|
+
import { SignInOptions, UseSessionOptions, LiteralUnion, ClientSafeProvider, SignInAuthorizationParams, SignInResponse, SignOutParams, SignOutResponse, SessionProviderProps } from 'next-auth/react';
|
|
7
|
+
import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
|
|
8
|
+
import { VariantProps } from 'class-variance-authority';
|
|
9
|
+
import { CreateBasicUserRequest } from '@niledatabase/browser';
|
|
10
|
+
import { BuiltInProviderType, RedirectableProviderType } from 'next-auth/providers/index';
|
|
11
|
+
import { CtxOrReq } from 'next-auth/client/_utils';
|
|
12
|
+
import { Session } from 'next-auth';
|
|
13
|
+
|
|
14
|
+
type EmailSignInInfo = SignInOptions;
|
|
15
|
+
type SignInSuccess = (response: Response) => void;
|
|
16
|
+
type AllowedAny$3 = any;
|
|
17
|
+
interface Props$5 {
|
|
18
|
+
redirect?: boolean;
|
|
19
|
+
onSuccess?: SignInSuccess;
|
|
20
|
+
onError?: (e: Error, info: EmailSignInInfo) => void;
|
|
21
|
+
beforeMutate?: (data: AllowedAny$3) => AllowedAny$3;
|
|
22
|
+
buttonText?: string;
|
|
23
|
+
client?: QueryClient;
|
|
24
|
+
callbackUrl?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare function EmailSigningIn(props: Props$5): React__default.JSX.Element;
|
|
28
|
+
|
|
29
|
+
declare const buttonVariants: (props?: ({
|
|
30
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
31
|
+
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
32
|
+
} & class_variance_authority_dist_types.ClassProp) | undefined) => string;
|
|
33
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
34
|
+
asChild?: boolean;
|
|
35
|
+
loading?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type EmailError = void | {
|
|
39
|
+
error: string;
|
|
40
|
+
ok: boolean;
|
|
41
|
+
status: number;
|
|
42
|
+
url: null | string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* This works when the email identity provider is configured in the admin dashboard.
|
|
46
|
+
* @param props callbackUrl: the url to send the user to from their email
|
|
47
|
+
* @param props redirect: redirect to the default (unbranded) 'check your email' page. default is false
|
|
48
|
+
* @param props email: the email to send to
|
|
49
|
+
* @param props onSent: called if the email was sent
|
|
50
|
+
* @param props onFailure: called if there was a reportable
|
|
51
|
+
* @returns a JSX.Element to render
|
|
52
|
+
*/
|
|
53
|
+
declare const EmailSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
54
|
+
callbackUrl?: string;
|
|
55
|
+
redirect?: boolean;
|
|
56
|
+
email: string;
|
|
57
|
+
onSent?: () => void;
|
|
58
|
+
onFailure?: (error: EmailError) => void;
|
|
59
|
+
buttonText?: string;
|
|
60
|
+
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
61
|
+
|
|
62
|
+
declare function useEmailSignIn(params?: Props$5): _tanstack_react_query.UseMutateFunction<Response, Error, next_auth_react.SignInOptions, unknown>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A component for a Google login button, according to their design language.
|
|
66
|
+
* This works when an identity provider is configured in the admin dashboard.
|
|
67
|
+
* @param props callbackUrl: a string to override the URL provided by the context
|
|
68
|
+
* @returns a JSX.Element to render
|
|
69
|
+
*/
|
|
70
|
+
declare const GoogleSSOButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
71
|
+
callbackUrl?: string;
|
|
72
|
+
buttonText?: string;
|
|
73
|
+
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
74
|
+
|
|
75
|
+
declare const AzureSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
76
|
+
callbackUrl?: string;
|
|
77
|
+
buttonText?: string;
|
|
78
|
+
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
79
|
+
|
|
80
|
+
declare const DiscordSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
81
|
+
callbackUrl?: string;
|
|
82
|
+
buttonText?: string;
|
|
83
|
+
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
84
|
+
|
|
85
|
+
declare const GitHubSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
86
|
+
callbackUrl?: string;
|
|
87
|
+
buttonText?: string;
|
|
88
|
+
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
89
|
+
|
|
90
|
+
declare const HubSpotSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
91
|
+
callbackUrl?: string;
|
|
92
|
+
buttonText?: string;
|
|
93
|
+
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
94
|
+
|
|
95
|
+
declare const LinkedInSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
96
|
+
callbackUrl?: string;
|
|
97
|
+
buttonText?: string;
|
|
98
|
+
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
99
|
+
|
|
100
|
+
declare const SlackSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
101
|
+
callbackUrl?: string;
|
|
102
|
+
buttonText?: string;
|
|
103
|
+
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
104
|
+
|
|
105
|
+
declare const XSignInButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
106
|
+
callbackUrl?: string;
|
|
107
|
+
buttonText?: string;
|
|
108
|
+
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
109
|
+
|
|
110
|
+
type SignUpInfo = CreateBasicUserRequest & {
|
|
111
|
+
tenantId?: string;
|
|
112
|
+
fetchUrl?: string;
|
|
113
|
+
callbackUrl?: string;
|
|
114
|
+
newTenantName?: string;
|
|
115
|
+
};
|
|
116
|
+
type AllowedAny$2 = any;
|
|
117
|
+
interface Props$4 {
|
|
118
|
+
onSuccess?: (response: Response, formValues: SignUpInfo) => void;
|
|
119
|
+
onError?: (e: Error, info: SignUpInfo) => void;
|
|
120
|
+
beforeMutate?: (data: AllowedAny$2) => AllowedAny$2;
|
|
121
|
+
buttonText?: string;
|
|
122
|
+
client?: QueryClient;
|
|
123
|
+
callbackUrl?: string;
|
|
124
|
+
baseUrl?: string;
|
|
125
|
+
createTenant?: string | boolean;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
declare function SigningUp(props: Props$4): React__default.JSX.Element;
|
|
129
|
+
|
|
130
|
+
declare function useSignUp<T extends SignUpInfo>(params: Props$4, client?: QueryClient): _tanstack_react_query.UseMutateFunction<Response, Error, SignUpInfo, unknown>;
|
|
131
|
+
|
|
132
|
+
type AllowedAny$1 = any;
|
|
133
|
+
type LoginInfo = {
|
|
134
|
+
email: string;
|
|
135
|
+
password: string;
|
|
136
|
+
};
|
|
137
|
+
type LoginSuccess = (response: AllowedAny$1, formValues: LoginInfo, ...args: AllowedAny$1) => void;
|
|
138
|
+
interface Props$3 {
|
|
139
|
+
beforeMutate?: (data: AllowedAny$1) => AllowedAny$1;
|
|
140
|
+
onSuccess?: LoginSuccess;
|
|
141
|
+
onError?: (error: Error, data: AllowedAny$1) => void;
|
|
142
|
+
callbackUrl?: string;
|
|
143
|
+
client?: QueryClient;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
declare function SigningIn(props: Props$3): React__default.JSX.Element;
|
|
147
|
+
|
|
148
|
+
declare function useSignIn(params?: Props$3): _tanstack_react_query.UseMutateFunction<next_auth_react.SignInResponse | undefined, Error, LoginInfo, any>;
|
|
149
|
+
|
|
150
|
+
declare const SignOutButton: React__default.ForwardRefExoticComponent<ButtonProps & {
|
|
151
|
+
redirect?: boolean;
|
|
152
|
+
callbackUrl?: string;
|
|
153
|
+
buttonText?: string;
|
|
154
|
+
} & React__default.RefAttributes<HTMLButtonElement>>;
|
|
155
|
+
|
|
156
|
+
type UpdateSession = (data?: any) => Promise<Session | null>;
|
|
157
|
+
type SessionContextValue<R extends boolean = false> = R extends true ? {
|
|
158
|
+
update: UpdateSession;
|
|
159
|
+
data: Session;
|
|
160
|
+
status: 'authenticated';
|
|
161
|
+
} | {
|
|
162
|
+
update: UpdateSession;
|
|
163
|
+
data: null;
|
|
164
|
+
status: 'loading';
|
|
165
|
+
} : {
|
|
166
|
+
update: UpdateSession;
|
|
167
|
+
data: Session;
|
|
168
|
+
status: 'authenticated';
|
|
169
|
+
} | {
|
|
170
|
+
update: UpdateSession;
|
|
171
|
+
data: null;
|
|
172
|
+
status: 'unauthenticated' | 'loading';
|
|
173
|
+
};
|
|
174
|
+
declare const SessionContext: React__default.Context<{
|
|
175
|
+
update: UpdateSession;
|
|
176
|
+
data: Session;
|
|
177
|
+
status: "authenticated";
|
|
178
|
+
} | {
|
|
179
|
+
update: UpdateSession;
|
|
180
|
+
data: null;
|
|
181
|
+
status: "unauthenticated" | "loading";
|
|
182
|
+
} | undefined>;
|
|
183
|
+
/**
|
|
184
|
+
* React Hook that gives you access
|
|
185
|
+
* to the logged in user's session data.
|
|
186
|
+
*
|
|
187
|
+
* [Documentation](https://next-auth.js.org/getting-started/client#usesession)
|
|
188
|
+
*/
|
|
189
|
+
declare function useSession<R extends boolean>(options?: UseSessionOptions<R>): SessionContextValue<R>;
|
|
190
|
+
type GetSessionParams = CtxOrReq & {
|
|
191
|
+
event?: 'storage' | 'timer' | 'hidden' | string;
|
|
192
|
+
triggerEvent?: boolean;
|
|
193
|
+
broadcast?: boolean;
|
|
194
|
+
};
|
|
195
|
+
declare function getSession(params?: GetSessionParams): Promise<Session | null>;
|
|
196
|
+
/**
|
|
197
|
+
* Returns the current Cross Site Request Forgery Token (CSRF Token)
|
|
198
|
+
* required to make POST requests (e.g. for signing in and signing out).
|
|
199
|
+
* You likely only need to use this if you are not using the built-in
|
|
200
|
+
* `signIn()` and `signOut()` methods.
|
|
201
|
+
*
|
|
202
|
+
* [Documentation](https://next-auth.js.org/getting-started/client#getcsrftoken)
|
|
203
|
+
*/
|
|
204
|
+
declare function getCsrfToken(params?: CtxOrReq): Promise<string | undefined>;
|
|
205
|
+
/**
|
|
206
|
+
* It calls `/api/auth/providers` and returns
|
|
207
|
+
* a list of the currently configured authentication providers.
|
|
208
|
+
* It can be useful if you are creating a dynamic custom sign in page.
|
|
209
|
+
*
|
|
210
|
+
* [Documentation](https://next-auth.js.org/getting-started/client#getproviders)
|
|
211
|
+
*/
|
|
212
|
+
declare function getProviders(): Promise<Record<LiteralUnion<BuiltInProviderType>, ClientSafeProvider> | null>;
|
|
213
|
+
/**
|
|
214
|
+
* Client-side method to initiate a signin flow
|
|
215
|
+
* or send the user to the signin page listing all possible providers.
|
|
216
|
+
* Automatically adds the CSRF token to the request.
|
|
217
|
+
*
|
|
218
|
+
* [Documentation](https://next-auth.js.org/getting-started/client#signin)
|
|
219
|
+
*/
|
|
220
|
+
declare function signIn<P extends RedirectableProviderType | undefined = undefined>(provider?: LiteralUnion<P extends RedirectableProviderType ? P | BuiltInProviderType : BuiltInProviderType>, options?: SignInOptions, authorizationParams?: SignInAuthorizationParams): Promise<P extends RedirectableProviderType ? SignInResponse | undefined : undefined>;
|
|
221
|
+
/**
|
|
222
|
+
* Signs the user out, by removing the session cookie.
|
|
223
|
+
* Automatically adds the CSRF token to the request.
|
|
224
|
+
*
|
|
225
|
+
* [Documentation](https://next-auth.js.org/getting-started/client#signout)
|
|
226
|
+
*/
|
|
227
|
+
declare function signOut<R extends boolean = true>(options?: SignOutParams<R>): Promise<R extends true ? undefined : SignOutResponse>;
|
|
228
|
+
/**
|
|
229
|
+
* Provider to wrap the app in to make session data available globally.
|
|
230
|
+
* Can also be used to throttle the number of requests to the endpoint
|
|
231
|
+
* `/api/auth/session`.
|
|
232
|
+
*
|
|
233
|
+
* [Documentation](https://next-auth.js.org/getting-started/client#sessionprovider)
|
|
234
|
+
*/
|
|
235
|
+
declare function SessionProvider(props: SessionProviderProps): React__default.JSX.Element;
|
|
236
|
+
type JWT = {
|
|
237
|
+
email: string;
|
|
238
|
+
sub: string;
|
|
239
|
+
id: string;
|
|
240
|
+
iat: number;
|
|
241
|
+
exp: number;
|
|
242
|
+
jti: string;
|
|
243
|
+
};
|
|
244
|
+
type ActiveSession = {
|
|
245
|
+
id: string;
|
|
246
|
+
email: string;
|
|
247
|
+
expires: string;
|
|
248
|
+
user?: {
|
|
249
|
+
id: string;
|
|
250
|
+
name: string;
|
|
251
|
+
image: string;
|
|
252
|
+
email: string;
|
|
253
|
+
emailVerified: void | Date;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
type NonErrorSession = JWT | ActiveSession | null | undefined;
|
|
257
|
+
type NileSession = Response | NonErrorSession;
|
|
258
|
+
|
|
259
|
+
declare function SignedIn({ children, session: startSession, ...props }: Omit<SessionProviderProps, 'session'> & {
|
|
260
|
+
session?: NileSession;
|
|
261
|
+
className?: string;
|
|
262
|
+
}): React__default.JSX.Element | null;
|
|
263
|
+
|
|
264
|
+
declare function SignedOut({ children, session: startSession, ...props }: Omit<SessionProviderProps, 'session'> & {
|
|
265
|
+
session?: NileSession;
|
|
266
|
+
className?: string;
|
|
267
|
+
}): React__default.JSX.Element | null;
|
|
268
|
+
|
|
269
|
+
type Tenant = {
|
|
270
|
+
id: string;
|
|
271
|
+
name: string;
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
type HookProps = {
|
|
275
|
+
tenants?: Tenant[];
|
|
276
|
+
onError?: (e: Error) => void;
|
|
277
|
+
baseUrl?: string;
|
|
278
|
+
};
|
|
279
|
+
type ComponentProps = HookProps & {
|
|
280
|
+
client?: QueryClient;
|
|
281
|
+
activeTenant?: string;
|
|
282
|
+
useCookie?: boolean;
|
|
283
|
+
className?: string;
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
declare function useTenants(params: HookProps & {
|
|
287
|
+
disableQuery?: boolean;
|
|
288
|
+
}, client?: QueryClient): _tanstack_react_query.UseQueryResult<Tenant[], Error>;
|
|
289
|
+
declare function useTenantId(params?: HookProps & {
|
|
290
|
+
tenant: Tenant;
|
|
291
|
+
}, client?: QueryClient): [string | undefined, (tenant: string) => void];
|
|
292
|
+
|
|
293
|
+
declare function TenantSelector(props: ComponentProps): React__default.JSX.Element;
|
|
294
|
+
|
|
295
|
+
interface User {
|
|
296
|
+
id: string;
|
|
297
|
+
email: string;
|
|
298
|
+
name?: string | null;
|
|
299
|
+
familyName?: string | null;
|
|
300
|
+
givenName?: string | null;
|
|
301
|
+
picture?: string | null;
|
|
302
|
+
created: string;
|
|
303
|
+
updated?: string;
|
|
304
|
+
emailVerified?: string | null;
|
|
305
|
+
tenants: {
|
|
306
|
+
id: string;
|
|
307
|
+
}[];
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
type Props$2 = {
|
|
311
|
+
fetchUrl?: string;
|
|
312
|
+
user?: User | undefined | null;
|
|
313
|
+
};
|
|
314
|
+
declare function useMe(props: Props$2): User | null | undefined;
|
|
315
|
+
|
|
316
|
+
type Props$1 = {
|
|
317
|
+
user?: User | undefined | null;
|
|
318
|
+
fetchUrl?: string;
|
|
319
|
+
profilePicturePlaceholder?: React__default.ReactElement;
|
|
320
|
+
className?: string;
|
|
321
|
+
};
|
|
322
|
+
declare function UserInfo(props: Props$1): React__default.JSX.Element | "Loading...";
|
|
323
|
+
|
|
324
|
+
type Props = Params & {
|
|
325
|
+
client?: QueryClient;
|
|
326
|
+
callbackUrl?: string;
|
|
327
|
+
defaultValues?: MutateFnParams & {
|
|
328
|
+
confirmPassword?: string;
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
type AllowedAny = any;
|
|
332
|
+
interface Params {
|
|
333
|
+
beforeMutate?: (data: AllowedAny) => AllowedAny;
|
|
334
|
+
onSuccess?: (res: Response) => void;
|
|
335
|
+
onError?: (error: Error, data: AllowedAny) => void;
|
|
336
|
+
callbackUrl?: string;
|
|
337
|
+
client?: QueryClient;
|
|
338
|
+
fetchUrl?: string;
|
|
339
|
+
baseUrl?: string;
|
|
340
|
+
}
|
|
341
|
+
type MutateFnParams = {
|
|
342
|
+
email?: string;
|
|
343
|
+
password?: string;
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
declare function ResetPasswordForm$1(props: Props): React__default.JSX.Element;
|
|
347
|
+
|
|
348
|
+
declare function ResetPasswordForm(params: Params): React__default.JSX.Element;
|
|
349
|
+
|
|
350
|
+
declare function useResetPassword(params?: Params): _tanstack_react_query.UseMutateFunction<Response, Error, MutateFnParams, unknown>;
|
|
351
|
+
|
|
352
|
+
declare const Email: () => React.JSX.Element;
|
|
353
|
+
declare const Password: () => React.JSX.Element;
|
|
354
|
+
|
|
355
|
+
export { AzureSignInButton as Azure, DiscordSignInButton as Discord, Email, EmailSigningIn as EmailSignIn, EmailSignInButton, GitHubSignInButton as GitHub, GoogleSSOButton as Google, HubSpotSignInButton as HubSpot, LinkedInSignInButton as LinkedIn, Password, ResetPasswordForm as PasswordResetForm, ResetPasswordForm$1 as PasswordResetRequestForm, SessionContext, SessionProvider, SigningIn as SignInForm, SignOutButton, SigningUp as SignUpForm, SignedIn, SignedOut, SlackSignInButton as Slack, TenantSelector, UserInfo, XSignInButton as X, getCsrfToken, getProviders, getSession, signIn, signOut, useEmailSignIn, useMe, useResetPassword, useSession, useSignIn, useSignUp, useTenantId, useTenants };
|