@pol-studios/ui 1.0.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.
@@ -0,0 +1,588 @@
1
+ "use client";
2
+
3
+ // src/auth/LoginForm.tsx
4
+ import { Link, useNavigate } from "@tanstack/react-router";
5
+ import { useState } from "react";
6
+ import { cn as cn5 } from "@pol-studios/utils";
7
+
8
+ // src/primitives/button.tsx
9
+ import * as React from "react";
10
+ import { Slot } from "@radix-ui/react-slot";
11
+ import { cva } from "class-variance-authority";
12
+ import { cn } from "@pol-studios/utils";
13
+ import { jsx } from "react/jsx-runtime";
14
+ var buttonVariants = cva(
15
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
16
+ {
17
+ variants: {
18
+ variant: {
19
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
20
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
21
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
22
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
23
+ ghost: "hover:bg-accent hover:text-accent-foreground",
24
+ link: "text-primary underline-offset-4 hover:underline"
25
+ },
26
+ size: {
27
+ default: "h-10 px-4 py-2",
28
+ sm: "h-9 rounded-md px-3",
29
+ lg: "h-11 rounded-md px-8",
30
+ icon: "h-10 w-10"
31
+ }
32
+ },
33
+ defaultVariants: {
34
+ variant: "default",
35
+ size: "default"
36
+ }
37
+ }
38
+ );
39
+ var Button = React.forwardRef(
40
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
41
+ const Comp = asChild ? Slot : "button";
42
+ return /* @__PURE__ */ jsx(
43
+ Comp,
44
+ {
45
+ className: cn(buttonVariants({ variant, size, className })),
46
+ ref,
47
+ ...props
48
+ }
49
+ );
50
+ }
51
+ );
52
+ Button.displayName = "Button";
53
+
54
+ // src/primitives/card.tsx
55
+ import * as React2 from "react";
56
+ import { cn as cn2 } from "@pol-studios/utils";
57
+ import { jsx as jsx2 } from "react/jsx-runtime";
58
+ var Card = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
59
+ "div",
60
+ {
61
+ ref,
62
+ className: cn2(
63
+ "rounded-lg border bg-card text-card-foreground shadow-sm",
64
+ className
65
+ ),
66
+ ...props
67
+ }
68
+ ));
69
+ Card.displayName = "Card";
70
+ var CardHeader = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
71
+ "div",
72
+ {
73
+ ref,
74
+ className: cn2("flex flex-col space-y-1.5 p-6", className),
75
+ ...props
76
+ }
77
+ ));
78
+ CardHeader.displayName = "CardHeader";
79
+ var CardTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
80
+ "div",
81
+ {
82
+ ref,
83
+ className: cn2(
84
+ "text-2xl font-semibold leading-none tracking-tight",
85
+ className
86
+ ),
87
+ ...props
88
+ }
89
+ ));
90
+ CardTitle.displayName = "CardTitle";
91
+ var CardDescription = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
92
+ "div",
93
+ {
94
+ ref,
95
+ className: cn2("text-sm text-muted-foreground", className),
96
+ ...props
97
+ }
98
+ ));
99
+ CardDescription.displayName = "CardDescription";
100
+ var CardContent = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2("div", { ref, className: cn2("p-6 pt-0", className), ...props }));
101
+ CardContent.displayName = "CardContent";
102
+ var CardFooter = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx2(
103
+ "div",
104
+ {
105
+ ref,
106
+ className: cn2("flex items-center p-6 pt-0", className),
107
+ ...props
108
+ }
109
+ ));
110
+ CardFooter.displayName = "CardFooter";
111
+
112
+ // src/primitives/input.tsx
113
+ import * as React3 from "react";
114
+ import { cn as cn3 } from "@pol-studios/utils";
115
+ import { jsx as jsx3 } from "react/jsx-runtime";
116
+ var Input = React3.forwardRef(
117
+ ({ className, type, ...props }, ref) => {
118
+ return /* @__PURE__ */ jsx3(
119
+ "input",
120
+ {
121
+ type,
122
+ "data-slot": "input",
123
+ className: cn3(
124
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base shadow-xs",
125
+ "ring-offset-background transition-shadow",
126
+ "file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground",
127
+ "placeholder:text-muted-foreground",
128
+ "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
129
+ "disabled:cursor-not-allowed disabled:opacity-50",
130
+ "md:text-sm",
131
+ className
132
+ ),
133
+ ref,
134
+ ...props
135
+ }
136
+ );
137
+ }
138
+ );
139
+ Input.displayName = "Input";
140
+
141
+ // src/primitives/label.tsx
142
+ import * as React4 from "react";
143
+ import * as LabelPrimitive from "@radix-ui/react-label";
144
+ import { cva as cva2 } from "class-variance-authority";
145
+ import { cn as cn4 } from "@pol-studios/utils";
146
+ import { jsx as jsx4 } from "react/jsx-runtime";
147
+ var labelVariants = cva2(
148
+ "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
149
+ );
150
+ var Label = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx4(
151
+ LabelPrimitive.Root,
152
+ {
153
+ ref,
154
+ className: cn4(labelVariants(), className),
155
+ ...props
156
+ }
157
+ ));
158
+ Label.displayName = LabelPrimitive.Root.displayName;
159
+
160
+ // src/auth/LoginForm.tsx
161
+ import { jsx as jsx5, jsxs } from "react/jsx-runtime";
162
+ function LoginForm({
163
+ className,
164
+ onLogin,
165
+ forgotPasswordRoute = "/forgot-password",
166
+ signUpRoute = "/sign-up",
167
+ redirectTo = "/",
168
+ ...props
169
+ }) {
170
+ const [email, setEmail] = useState("");
171
+ const [password, setPassword] = useState("");
172
+ const [error, setError] = useState(null);
173
+ const [isLoading, setIsLoading] = useState(false);
174
+ const navigate = useNavigate();
175
+ const handleLogin = async (e) => {
176
+ e.preventDefault();
177
+ setIsLoading(true);
178
+ setError(null);
179
+ try {
180
+ if (onLogin) {
181
+ await onLogin(email, password);
182
+ }
183
+ await navigate({ to: redirectTo, reloadDocument: true });
184
+ } catch (error2) {
185
+ setError(error2 instanceof Error ? error2.message : "An error occurred");
186
+ } finally {
187
+ setIsLoading(false);
188
+ }
189
+ };
190
+ return /* @__PURE__ */ jsx5("div", { className: cn5("flex flex-col gap-6", className), ...props, children: /* @__PURE__ */ jsxs(Card, { children: [
191
+ /* @__PURE__ */ jsx5(CardHeader, { children: /* @__PURE__ */ jsx5(CardTitle, { className: "text-2xl text-center", children: "Login" }) }),
192
+ /* @__PURE__ */ jsx5(CardContent, { children: /* @__PURE__ */ jsxs("form", { onSubmit: handleLogin, children: [
193
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
194
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
195
+ /* @__PURE__ */ jsx5(Label, { htmlFor: "email", children: "Email" }),
196
+ /* @__PURE__ */ jsx5(
197
+ Input,
198
+ {
199
+ "data-testid": "email",
200
+ id: "email",
201
+ type: "email",
202
+ placeholder: "m@example.com",
203
+ value: email,
204
+ onChange: (e) => setEmail(e.target.value),
205
+ required: true
206
+ }
207
+ )
208
+ ] }),
209
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
210
+ /* @__PURE__ */ jsx5(Label, { htmlFor: "password", children: "Password" }),
211
+ /* @__PURE__ */ jsx5(
212
+ Input,
213
+ {
214
+ "data-testid": "password",
215
+ id: "password",
216
+ type: "password",
217
+ value: password,
218
+ onChange: (e) => setPassword(e.target.value),
219
+ required: true
220
+ }
221
+ ),
222
+ /* @__PURE__ */ jsx5("div", { className: "flex items-center", children: /* @__PURE__ */ jsx5(
223
+ Link,
224
+ {
225
+ to: forgotPasswordRoute,
226
+ className: "ml-auto inline-block text-sm underline-offset-4 hover:underline",
227
+ children: "Forgot your password?"
228
+ }
229
+ ) })
230
+ ] }),
231
+ error && /* @__PURE__ */ jsx5("p", { className: "text-sm text-red-500", children: error }),
232
+ /* @__PURE__ */ jsx5(
233
+ Button,
234
+ {
235
+ type: "submit",
236
+ className: "w-full",
237
+ disabled: isLoading,
238
+ "data-testid": "loginButton",
239
+ children: isLoading ? "Logging in..." : "Login"
240
+ }
241
+ )
242
+ ] }),
243
+ /* @__PURE__ */ jsxs("div", { className: "mt-4 text-center text-sm", children: [
244
+ "Don't have an account?",
245
+ " ",
246
+ /* @__PURE__ */ jsx5(Link, { to: signUpRoute, className: "underline underline-offset-4", children: "Sign up" })
247
+ ] })
248
+ ] }) })
249
+ ] }) });
250
+ }
251
+ var LoginForm_default = LoginForm;
252
+
253
+ // src/auth/SignUpForm.tsx
254
+ import { Link as Link2, useNavigate as useNavigate2 } from "@tanstack/react-router";
255
+ import { useState as useState2 } from "react";
256
+ import { cn as cn6 } from "@pol-studios/utils";
257
+ import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
258
+ function SignUpForm({
259
+ className,
260
+ onSignUp,
261
+ loginRoute = "/login",
262
+ successRoute = "/sign-up-success",
263
+ ...props
264
+ }) {
265
+ const [email, setEmail] = useState2("");
266
+ const [password, setPassword] = useState2("");
267
+ const [repeatPassword, setRepeatPassword] = useState2("");
268
+ const [error, setError] = useState2(null);
269
+ const [isLoading, setIsLoading] = useState2(false);
270
+ const navigate = useNavigate2();
271
+ const handleSignUp = async (e) => {
272
+ e.preventDefault();
273
+ setError(null);
274
+ if (password !== repeatPassword) {
275
+ setError("Passwords do not match");
276
+ return;
277
+ }
278
+ setIsLoading(true);
279
+ try {
280
+ if (onSignUp) {
281
+ await onSignUp(email, password);
282
+ }
283
+ await navigate({ to: successRoute });
284
+ } catch (error2) {
285
+ setError(error2 instanceof Error ? error2.message : "An error occurred");
286
+ } finally {
287
+ setIsLoading(false);
288
+ }
289
+ };
290
+ return /* @__PURE__ */ jsx6("div", { className: cn6("flex flex-col gap-6", className), ...props, children: /* @__PURE__ */ jsxs2(Card, { children: [
291
+ /* @__PURE__ */ jsxs2(CardHeader, { children: [
292
+ /* @__PURE__ */ jsx6(CardTitle, { className: "text-2xl", children: "Sign up" }),
293
+ /* @__PURE__ */ jsx6(CardDescription, { children: "Create a new account" })
294
+ ] }),
295
+ /* @__PURE__ */ jsx6(CardContent, { children: /* @__PURE__ */ jsxs2("form", { onSubmit: handleSignUp, children: [
296
+ /* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-6", children: [
297
+ /* @__PURE__ */ jsxs2("div", { className: "grid gap-2", children: [
298
+ /* @__PURE__ */ jsx6(Label, { htmlFor: "email", children: "Email" }),
299
+ /* @__PURE__ */ jsx6(
300
+ Input,
301
+ {
302
+ id: "email",
303
+ type: "email",
304
+ placeholder: "m@example.com",
305
+ required: true,
306
+ value: email,
307
+ onChange: (e) => setEmail(e.target.value)
308
+ }
309
+ )
310
+ ] }),
311
+ /* @__PURE__ */ jsxs2("div", { className: "grid gap-2", children: [
312
+ /* @__PURE__ */ jsx6("div", { className: "flex items-center", children: /* @__PURE__ */ jsx6(Label, { htmlFor: "password", children: "Password" }) }),
313
+ /* @__PURE__ */ jsx6(
314
+ Input,
315
+ {
316
+ id: "password",
317
+ type: "password",
318
+ required: true,
319
+ value: password,
320
+ onChange: (e) => setPassword(e.target.value)
321
+ }
322
+ )
323
+ ] }),
324
+ /* @__PURE__ */ jsxs2("div", { className: "grid gap-2", children: [
325
+ /* @__PURE__ */ jsx6("div", { className: "flex items-center", children: /* @__PURE__ */ jsx6(Label, { htmlFor: "repeat-password", children: "Repeat Password" }) }),
326
+ /* @__PURE__ */ jsx6(
327
+ Input,
328
+ {
329
+ id: "repeat-password",
330
+ type: "password",
331
+ required: true,
332
+ value: repeatPassword,
333
+ onChange: (e) => setRepeatPassword(e.target.value)
334
+ }
335
+ )
336
+ ] }),
337
+ error && /* @__PURE__ */ jsx6("p", { className: "text-sm text-red-500", children: error }),
338
+ /* @__PURE__ */ jsx6(Button, { type: "submit", className: "w-full", disabled: isLoading, children: isLoading ? "Creating an account..." : "Sign up" })
339
+ ] }),
340
+ /* @__PURE__ */ jsxs2("div", { className: "mt-4 text-center text-sm", children: [
341
+ "Already have an account?",
342
+ " ",
343
+ /* @__PURE__ */ jsx6(Link2, { to: loginRoute, className: "underline underline-offset-4", children: "Login" })
344
+ ] })
345
+ ] }) })
346
+ ] }) });
347
+ }
348
+ var SignUpForm_default = SignUpForm;
349
+
350
+ // src/auth/ForgotPasswordForm.tsx
351
+ import { Link as Link3 } from "@tanstack/react-router";
352
+ import { useState as useState3 } from "react";
353
+ import { cn as cn7 } from "@pol-studios/utils";
354
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
355
+ function ForgotPasswordForm({
356
+ className,
357
+ onResetPassword,
358
+ loginRoute = "/login",
359
+ ...props
360
+ }) {
361
+ const [email, setEmail] = useState3("");
362
+ const [error, setError] = useState3(null);
363
+ const [success, setSuccess] = useState3(false);
364
+ const [isLoading, setIsLoading] = useState3(false);
365
+ const handleForgotPassword = async (e) => {
366
+ e.preventDefault();
367
+ setIsLoading(true);
368
+ setError(null);
369
+ try {
370
+ if (onResetPassword) {
371
+ await onResetPassword(email);
372
+ }
373
+ setSuccess(true);
374
+ } catch (error2) {
375
+ setError(error2 instanceof Error ? error2.message : "An error occurred");
376
+ } finally {
377
+ setIsLoading(false);
378
+ }
379
+ };
380
+ return /* @__PURE__ */ jsx7("div", { className: cn7("flex flex-col gap-6", className), ...props, children: success ? /* @__PURE__ */ jsxs3(Card, { children: [
381
+ /* @__PURE__ */ jsxs3(CardHeader, { children: [
382
+ /* @__PURE__ */ jsx7(CardTitle, { className: "text-2xl", children: "Check Your Email" }),
383
+ /* @__PURE__ */ jsx7(CardDescription, { children: "Password reset instructions sent" })
384
+ ] }),
385
+ /* @__PURE__ */ jsx7(CardContent, { children: /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "If you registered using your email and password, you will receive a password reset email." }) })
386
+ ] }) : /* @__PURE__ */ jsxs3(Card, { children: [
387
+ /* @__PURE__ */ jsxs3(CardHeader, { children: [
388
+ /* @__PURE__ */ jsx7(CardTitle, { className: "text-2xl", children: "Reset Your Password" }),
389
+ /* @__PURE__ */ jsx7(CardDescription, { children: "Type in your email and we'll send you a link to reset your password" })
390
+ ] }),
391
+ /* @__PURE__ */ jsx7(CardContent, { children: /* @__PURE__ */ jsxs3("form", { onSubmit: handleForgotPassword, children: [
392
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-col gap-6", children: [
393
+ /* @__PURE__ */ jsxs3("div", { className: "grid gap-2", children: [
394
+ /* @__PURE__ */ jsx7(Label, { htmlFor: "email", children: "Email" }),
395
+ /* @__PURE__ */ jsx7(
396
+ Input,
397
+ {
398
+ id: "email",
399
+ type: "email",
400
+ placeholder: "m@example.com",
401
+ required: true,
402
+ value: email,
403
+ onChange: (e) => setEmail(e.target.value)
404
+ }
405
+ )
406
+ ] }),
407
+ error && /* @__PURE__ */ jsx7("p", { className: "text-sm text-red-500", children: error }),
408
+ /* @__PURE__ */ jsx7(Button, { type: "submit", className: "w-full", disabled: isLoading, children: isLoading ? "Sending..." : "Send reset email" })
409
+ ] }),
410
+ /* @__PURE__ */ jsxs3("div", { className: "mt-4 text-center text-sm", children: [
411
+ "Already have an account?",
412
+ " ",
413
+ /* @__PURE__ */ jsx7(Link3, { to: loginRoute, className: "underline underline-offset-4", children: "Login" })
414
+ ] })
415
+ ] }) })
416
+ ] }) });
417
+ }
418
+ var ForgotPasswordForm_default = ForgotPasswordForm;
419
+
420
+ // src/auth/UpdatePasswordForm.tsx
421
+ import { useNavigate as useNavigate3 } from "@tanstack/react-router";
422
+ import { useState as useState4 } from "react";
423
+ import { cn as cn8 } from "@pol-studios/utils";
424
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
425
+ function UpdatePasswordForm({
426
+ className,
427
+ onUpdatePassword,
428
+ redirectTo = "/",
429
+ ...props
430
+ }) {
431
+ const [password, setPassword] = useState4("");
432
+ const [error, setError] = useState4(null);
433
+ const [isLoading, setIsLoading] = useState4(false);
434
+ const navigate = useNavigate3();
435
+ const handleUpdatePassword = async (e) => {
436
+ e.preventDefault();
437
+ setIsLoading(true);
438
+ setError(null);
439
+ try {
440
+ if (onUpdatePassword) {
441
+ await onUpdatePassword(password);
442
+ }
443
+ await navigate({ to: redirectTo, reloadDocument: true });
444
+ } catch (error2) {
445
+ setError(error2 instanceof Error ? error2.message : "An error occurred");
446
+ } finally {
447
+ setIsLoading(false);
448
+ }
449
+ };
450
+ return /* @__PURE__ */ jsx8("div", { className: cn8("flex flex-col gap-6", className), ...props, children: /* @__PURE__ */ jsxs4(Card, { children: [
451
+ /* @__PURE__ */ jsxs4(CardHeader, { children: [
452
+ /* @__PURE__ */ jsx8(CardTitle, { className: "text-2xl", children: "Reset Your Password" }),
453
+ /* @__PURE__ */ jsx8(CardDescription, { children: "Please enter your new password below." })
454
+ ] }),
455
+ /* @__PURE__ */ jsx8(CardContent, { children: /* @__PURE__ */ jsx8("form", { onSubmit: handleUpdatePassword, children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-6", children: [
456
+ /* @__PURE__ */ jsxs4("div", { className: "grid gap-2", children: [
457
+ /* @__PURE__ */ jsx8(Label, { htmlFor: "password", children: "New password" }),
458
+ /* @__PURE__ */ jsx8(
459
+ Input,
460
+ {
461
+ id: "password",
462
+ type: "password",
463
+ placeholder: "New password",
464
+ required: true,
465
+ value: password,
466
+ onChange: (e) => setPassword(e.target.value)
467
+ }
468
+ )
469
+ ] }),
470
+ error && /* @__PURE__ */ jsx8("p", { className: "text-sm text-red-500", children: error }),
471
+ /* @__PURE__ */ jsx8(Button, { type: "submit", className: "w-full", disabled: isLoading, children: isLoading ? "Saving..." : "Save new password" })
472
+ ] }) }) })
473
+ ] }) });
474
+ }
475
+ var UpdatePasswordForm_default = UpdatePasswordForm;
476
+
477
+ // src/auth/AuthRouteWithLicense.tsx
478
+ import { useSetupAuth } from "@pol-studios/auth";
479
+ import { isUsable } from "@pol-studios/utils/types";
480
+ import { Suspense } from "react";
481
+
482
+ // src/primitives/spinner.tsx
483
+ import { Loader2Icon } from "lucide-react";
484
+ import { cn as cn9 } from "@pol-studios/utils";
485
+ import { jsx as jsx9 } from "react/jsx-runtime";
486
+ function Spinner({ className, ...props }) {
487
+ return /* @__PURE__ */ jsx9(
488
+ Loader2Icon,
489
+ {
490
+ role: "status",
491
+ "aria-label": "Loading",
492
+ className: cn9("size-4 animate-spin", className),
493
+ ...props
494
+ }
495
+ );
496
+ }
497
+
498
+ // src/hooks/usePOLNavigate.tsx
499
+ import { useContext as useContext2 } from "react";
500
+ import { useNavigate as useTanstackNavigate } from "@tanstack/react-router";
501
+
502
+ // src/providers/router/RouterContext.tsx
503
+ import { createContext, useContext } from "react";
504
+ import { jsx as jsx10 } from "react/jsx-runtime";
505
+ var RouterContext = createContext(null);
506
+
507
+ // src/hooks/usePOLNavigate.tsx
508
+ function usePolNavigate() {
509
+ const routerContext = useContext2(RouterContext);
510
+ let tanstackNavigate = null;
511
+ try {
512
+ tanstackNavigate = useTanstackNavigate();
513
+ } catch {
514
+ }
515
+ if (tanstackNavigate) {
516
+ return tanstackNavigate;
517
+ }
518
+ if (routerContext) {
519
+ return (options) => {
520
+ const searchValue = typeof options.search === "object" && options.search !== null ? options.search : void 0;
521
+ const adapterOptions = {
522
+ to: typeof options.to === "string" ? options.to : String(options.to),
523
+ params: options.params,
524
+ search: searchValue,
525
+ replace: options.replace
526
+ };
527
+ routerContext.navigate(adapterOptions);
528
+ };
529
+ }
530
+ throw new Error("usePOLNavigate requires either a RouterProvider or TanStack Router context");
531
+ }
532
+
533
+ // src/feedback/NotFoundView.tsx
534
+ import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
535
+ function NotFoundView() {
536
+ const navigate = usePolNavigate();
537
+ return /* @__PURE__ */ jsx11("section", { className: "bg-background-100 h-full", children: /* @__PURE__ */ jsx11("div", { className: "pFx-4 mx-auto max-w-screen-xl py-8 lg:px-6 lg:py-16", children: /* @__PURE__ */ jsxs5("div", { className: "mx-auto max-w-screen-sm text-center", children: [
538
+ /* @__PURE__ */ jsx11("h1", { className: "mb-4 text-7xl font-extrabold tracking-tight text-primary-600 lg:text-9xl", children: "404" }),
539
+ /* @__PURE__ */ jsx11("p", { className: "mb-4 text-3xl font-bold tracking-tight text-text-900 md:text-4xl", children: "Something's missing." }),
540
+ /* @__PURE__ */ jsx11("p", { className: "mb-4 text-lg text-text-400 text-text-500", children: "Sorry, we can't find that page. You'll find lots to explore on the home page." }),
541
+ /* @__PURE__ */ jsx11(
542
+ Button,
543
+ {
544
+ variant: "ghost",
545
+ "data-testid": "go-home-404-button",
546
+ className: " inline-flex",
547
+ onClick: () => navigate({ to: "/" }),
548
+ children: "Back to Homepage"
549
+ }
550
+ )
551
+ ] }) }) });
552
+ }
553
+
554
+ // src/auth/AuthRouteWithLicense.tsx
555
+ import { useParams as useParams2 } from "@tanstack/react-router";
556
+ import { jsx as jsx12 } from "react/jsx-runtime";
557
+ function withAccessAndLicense(component, access) {
558
+ return () => /* @__PURE__ */ jsx12(AuthRouteWithLicense, { component, access });
559
+ }
560
+ function AuthRouteWithLicense({ component: RouteComponent, access }) {
561
+ const { isLoading, hasAccess, user } = useSetupAuth();
562
+ const navigate = usePolNavigate();
563
+ const params = useParams2({ strict: false });
564
+ const loadingComponent = /* @__PURE__ */ jsx12("div", { className: "center-Items flex h-[calc(100dvh-120px)]", children: /* @__PURE__ */ jsx12(Spinner, { className: "m-auto" }) });
565
+ if (isUsable(user) == false || isLoading) {
566
+ return loadingComponent;
567
+ } else if (access !== void 0 && hasAccess(access) === false) {
568
+ if (isUsable(user) === false) {
569
+ navigate({ to: "/login" });
570
+ return loadingComponent;
571
+ }
572
+ return /* @__PURE__ */ jsx12(Suspense, { fallback: loadingComponent, children: /* @__PURE__ */ jsx12(NotFoundView, {}) });
573
+ }
574
+ return /* @__PURE__ */ jsx12(Suspense, { fallback: loadingComponent, children: /* @__PURE__ */ jsx12(RouteComponent, { ...params }) });
575
+ }
576
+ var AuthRouteWithLicense_default = AuthRouteWithLicense;
577
+ export {
578
+ AuthRouteWithLicense_default as AuthRouteWithLicense,
579
+ ForgotPasswordForm,
580
+ ForgotPasswordForm_default as ForgotPasswordFormDefault,
581
+ LoginForm,
582
+ LoginForm_default as LoginFormDefault,
583
+ SignUpForm,
584
+ SignUpForm_default as SignUpFormDefault,
585
+ UpdatePasswordForm,
586
+ UpdatePasswordForm_default as UpdatePasswordFormDefault,
587
+ withAccessAndLicense
588
+ };
Binary file