@bison-lab/ui 0.15.0 → 0.16.1

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.mjs CHANGED
@@ -18,6 +18,7 @@ import TextAlign from "@tiptap/extension-text-align";
18
18
  import { Toaster as Toaster$1, toast } from "sonner";
19
19
  import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
20
20
  import { Command as Command$1 } from "cmdk";
21
+ import { AnimatePresence, motion } from "motion/react";
21
22
  //#region src/lib/semantic-action-tones.ts
22
23
  /**
23
24
  * Reusable “soft” icon tiles: same border + shadow language, hue from semantic scales.
@@ -445,7 +446,7 @@ Button.displayName = "Button";
445
446
  const Input = React.forwardRef(({ className, type, ...props }, ref) => {
446
447
  return /* @__PURE__ */ jsx("input", {
447
448
  type,
448
- className: cn("flex h-[var(--density-height-md)] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className),
449
+ className: cn("flex h-[var(--density-height-md)] w-full rounded-md border border-input bg-background px-3 py-2 text-base sm:text-sm ring-offset-background file:border-0 file:bg-transparent file:text-base file:font-medium sm:file:text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className),
449
450
  ref,
450
451
  ...props
451
452
  });
@@ -457,7 +458,7 @@ const PasswordInput = React.forwardRef(({ className, ...props }, ref) => {
457
458
  return /* @__PURE__ */ jsx(unstable_PasswordToggleField.Root, { children: /* @__PURE__ */ jsxs("div", {
458
459
  className: "relative",
459
460
  children: [/* @__PURE__ */ jsx(unstable_PasswordToggleField.Input, {
460
- className: cn("flex h-[var(--density-height-md)] w-full rounded-md border border-input bg-background px-3 py-2 pr-10 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className),
461
+ className: cn("flex h-[var(--density-height-md)] w-full rounded-md border border-input bg-background px-3 py-2 pr-10 text-base sm:text-sm ring-offset-background file:border-0 file:bg-transparent file:text-base file:font-medium sm:file:text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className),
461
462
  ref,
462
463
  ...props
463
464
  }), /* @__PURE__ */ jsx(unstable_PasswordToggleField.Toggle, {
@@ -478,15 +479,63 @@ const PasswordInput = React.forwardRef(({ className, ...props }, ref) => {
478
479
  });
479
480
  PasswordInput.displayName = "PasswordInput";
480
481
  //#endregion
481
- //#region src/components/textarea.tsx
482
- const Textarea = React.forwardRef(({ className, ...props }, ref) => {
483
- return /* @__PURE__ */ jsx("textarea", {
484
- className: cn("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className),
482
+ //#region src/components/code-input.tsx
483
+ const CodeInput = React.forwardRef(({ length = 6, onComplete, onChange, loading = false, disabled = false, className }, ref) => {
484
+ const [code, setCode] = React.useState(Array(length).fill(""));
485
+ const inputRefs = React.useRef([]);
486
+ const updateCode = React.useCallback((newCode) => {
487
+ setCode(newCode);
488
+ const joined = newCode.join("");
489
+ onChange?.(joined);
490
+ if (joined.length === length && newCode.every(Boolean)) onComplete?.(joined);
491
+ }, [
492
+ length,
493
+ onChange,
494
+ onComplete
495
+ ]);
496
+ const handleChange = React.useCallback((index, value) => {
497
+ if (!/^\d*$/.test(value)) return;
498
+ const newCode = [...code];
499
+ newCode[index] = value.slice(-1);
500
+ updateCode(newCode);
501
+ if (value && index < length - 1) inputRefs.current[index + 1]?.focus();
502
+ }, [
503
+ code,
504
+ length,
505
+ updateCode
506
+ ]);
507
+ const handleKeyDown = React.useCallback((index, e) => {
508
+ if (e.key === "Backspace" && !code[index] && index > 0) inputRefs.current[index - 1]?.focus();
509
+ }, [code]);
510
+ const handlePaste = React.useCallback((e) => {
511
+ e.preventDefault();
512
+ const pasted = e.clipboardData.getData("text").replace(/\D/g, "").slice(0, length);
513
+ const newCode = Array(length).fill("");
514
+ for (let i = 0; i < pasted.length; i++) newCode[i] = pasted[i];
515
+ updateCode(newCode);
516
+ if (pasted.length < length) inputRefs.current[pasted.length]?.focus();
517
+ }, [length, updateCode]);
518
+ return /* @__PURE__ */ jsx("div", {
485
519
  ref,
486
- ...props
520
+ className: cn("flex justify-center gap-2", className),
521
+ onPaste: handlePaste,
522
+ children: code.map((digit, index) => /* @__PURE__ */ jsx(Input, {
523
+ ref: (el) => {
524
+ inputRefs.current[index] = el;
525
+ },
526
+ type: "text",
527
+ inputMode: "numeric",
528
+ maxLength: 1,
529
+ value: digit,
530
+ onChange: (e) => handleChange(index, e.target.value),
531
+ onKeyDown: (e) => handleKeyDown(index, e),
532
+ disabled: loading || disabled,
533
+ className: "h-12 w-12 text-center text-lg font-semibold",
534
+ autoFocus: index === 0
535
+ }, index))
487
536
  });
488
537
  });
489
- Textarea.displayName = "Textarea";
538
+ CodeInput.displayName = "CodeInput";
490
539
  //#endregion
491
540
  //#region src/components/label.tsx
492
541
  const labelVariants = cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
@@ -497,13 +546,50 @@ const Label = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
497
546
  }));
498
547
  Label.displayName = Label$1.Root.displayName;
499
548
  //#endregion
549
+ //#region src/components/input-group.tsx
550
+ const InputGroup = React.forwardRef(({ label, htmlFor, error, hint, required, className, children }, ref) => {
551
+ return /* @__PURE__ */ jsxs("div", {
552
+ ref,
553
+ className: cn("flex flex-col gap-2", className),
554
+ children: [
555
+ /* @__PURE__ */ jsxs(Label, {
556
+ htmlFor,
557
+ children: [label, required && /* @__PURE__ */ jsx("span", {
558
+ className: "ml-0.5 text-destructive",
559
+ children: "*"
560
+ })]
561
+ }),
562
+ children,
563
+ error && /* @__PURE__ */ jsx("p", {
564
+ className: "text-sm text-destructive",
565
+ children: error
566
+ }),
567
+ !error && hint && /* @__PURE__ */ jsx("p", {
568
+ className: "text-sm text-muted-foreground",
569
+ children: hint
570
+ })
571
+ ]
572
+ });
573
+ });
574
+ InputGroup.displayName = "InputGroup";
575
+ //#endregion
576
+ //#region src/components/textarea.tsx
577
+ const Textarea = React.forwardRef(({ className, ...props }, ref) => {
578
+ return /* @__PURE__ */ jsx("textarea", {
579
+ className: cn("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base sm:text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className),
580
+ ref,
581
+ ...props
582
+ });
583
+ });
584
+ Textarea.displayName = "Textarea";
585
+ //#endregion
500
586
  //#region src/components/select.tsx
501
587
  const Select = Select$1.Root;
502
588
  const SelectGroup = Select$1.Group;
503
589
  const SelectValue = Select$1.Value;
504
590
  const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(Select$1.Trigger, {
505
591
  ref,
506
- className: cn("flex h-[var(--density-height-md)] w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className),
592
+ className: cn("flex h-[var(--density-height-md)] w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-base sm:text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className),
507
593
  ...props,
508
594
  children: [children, /* @__PURE__ */ jsx(Select$1.Icon, {
509
595
  asChild: true,
@@ -1123,7 +1209,7 @@ const TextEditor = React.forwardRef(({ value, onChange, placeholder = "Start wri
1123
1209
  toolbar
1124
1210
  }), /* @__PURE__ */ jsx(EditorContent, {
1125
1211
  editor,
1126
- className: cn("prose prose-sm dark:prose-invert max-w-none px-3 py-2 focus:outline-none [&_.tiptap]:outline-none [&_.tiptap.ProseMirror]:outline-none", `[&_.tiptap]:min-h-[${minHeight}]`, "[&_.tiptap_p.is-editor-empty:first-child::before]:text-muted-foreground [&_.tiptap_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)] [&_.tiptap_p.is-editor-empty:first-child::before]:float-left [&_.tiptap_p.is-editor-empty:first-child::before]:h-0 [&_.tiptap_p.is-editor-empty:first-child::before]:pointer-events-none", contentClassName),
1212
+ className: cn("prose prose-base sm:prose-sm dark:prose-invert max-w-none px-3 py-2 focus:outline-none [&_.tiptap]:outline-none [&_.tiptap.ProseMirror]:outline-none", `[&_.tiptap]:min-h-[${minHeight}]`, "[&_.tiptap_p.is-editor-empty:first-child::before]:text-muted-foreground [&_.tiptap_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)] [&_.tiptap_p.is-editor-empty:first-child::before]:float-left [&_.tiptap_p.is-editor-empty:first-child::before]:h-0 [&_.tiptap_p.is-editor-empty:first-child::before]:pointer-events-none", contentClassName),
1127
1213
  style: { minHeight }
1128
1214
  })]
1129
1215
  });
@@ -2447,7 +2533,7 @@ const CommandInput = React.forwardRef(({ className, ...props }, ref) => /* @__PU
2447
2533
  className: "mr-2 h-4 w-4 shrink-0 opacity-50"
2448
2534
  }), /* @__PURE__ */ jsx(Command$1.Input, {
2449
2535
  ref,
2450
- className: cn("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", className),
2536
+ className: cn("flex h-11 w-full rounded-md bg-transparent py-3 text-base sm:text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50", className),
2451
2537
  ...props
2452
2538
  })]
2453
2539
  }));
@@ -3082,6 +3168,15 @@ const providerConfig = {
3082
3168
  ]
3083
3169
  })
3084
3170
  },
3171
+ facebook: {
3172
+ label: "Facebook",
3173
+ icon: /* @__PURE__ */ jsx("svg", {
3174
+ className: "h-4 w-4",
3175
+ viewBox: "0 0 24 24",
3176
+ fill: "#1877F2",
3177
+ children: /* @__PURE__ */ jsx("path", { d: "M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z" })
3178
+ })
3179
+ },
3085
3180
  github: {
3086
3181
  label: "GitHub",
3087
3182
  icon: /* @__PURE__ */ jsx("svg", {
@@ -3122,17 +3217,220 @@ function SocialProviders({ providers, onSocialLogin, loading, disabled, classNam
3122
3217
  }
3123
3218
  //#endregion
3124
3219
  //#region src/blocks/auth/sign-in-block.tsx
3125
- function SignInBlock({ onSubmit, onForgotPassword, onSocialLogin, socialProviders = [], loading = false, error, disabled = false, title = "Sign in", description = "Enter your credentials to access your account", signUpHref, onSignUp, className }) {
3126
- const [rememberMe, setRememberMe] = React.useState(false);
3220
+ const AUTH_TABS = {
3221
+ PASSWORD: "password",
3222
+ OTP: "otp"
3223
+ };
3224
+ function PillTabs({ activeTab, onTabChange, otpLabel }) {
3225
+ return /* @__PURE__ */ jsx("div", {
3226
+ className: "relative flex rounded-md bg-muted p-1",
3227
+ children: [{
3228
+ value: AUTH_TABS.PASSWORD,
3229
+ label: "Password"
3230
+ }, {
3231
+ value: AUTH_TABS.OTP,
3232
+ label: otpLabel
3233
+ }].map((tab) => /* @__PURE__ */ jsxs("button", {
3234
+ type: "button",
3235
+ onClick: () => onTabChange(tab.value),
3236
+ className: cn("relative z-10 flex-1 rounded-sm px-3 py-1.5 text-sm font-medium transition-colors", activeTab === tab.value ? "text-secondary-foreground" : "text-muted-foreground hover:text-foreground"),
3237
+ children: [activeTab === tab.value && /* @__PURE__ */ jsx(motion.div, {
3238
+ layoutId: "sign-in-tab-pill",
3239
+ className: "absolute inset-0 rounded-sm bg-secondary shadow-sm",
3240
+ transition: {
3241
+ type: "spring",
3242
+ bounce: .15,
3243
+ duration: .4
3244
+ }
3245
+ }), /* @__PURE__ */ jsx("span", {
3246
+ className: "relative z-10",
3247
+ children: tab.label
3248
+ })]
3249
+ }, tab.value))
3250
+ });
3251
+ }
3252
+ function OtpForm({ onOtpRequest, onOtpVerify, loading = false, disabled = false, error }) {
3253
+ const [step, setStep] = React.useState("email");
3254
+ const [email, setEmail] = React.useState("");
3255
+ const [session, setSession] = React.useState("");
3256
+ const [otpLoading, setOtpLoading] = React.useState(false);
3257
+ const [otpError, setOtpError] = React.useState();
3258
+ const isLoading = loading || otpLoading;
3259
+ const displayError = otpError ?? error;
3260
+ async function handleEmailSubmit(e) {
3261
+ e.preventDefault();
3262
+ const emailValue = new FormData(e.currentTarget).get("otp-email");
3263
+ setOtpError(void 0);
3264
+ setOtpLoading(true);
3265
+ try {
3266
+ const result = await onOtpRequest(emailValue);
3267
+ setEmail(emailValue);
3268
+ setSession(result.session);
3269
+ setStep("code");
3270
+ } catch (err) {
3271
+ setOtpError(err instanceof Error ? err.message : "Failed to send code. Please try again.");
3272
+ } finally {
3273
+ setOtpLoading(false);
3274
+ }
3275
+ }
3276
+ if (step === "code") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FormError, { message: displayError }), /* @__PURE__ */ jsxs("div", {
3277
+ className: "space-y-4",
3278
+ children: [
3279
+ /* @__PURE__ */ jsxs("div", {
3280
+ className: "text-center text-sm text-muted-foreground",
3281
+ children: ["We sent a 6-digit code to ", /* @__PURE__ */ jsx("strong", { children: email })]
3282
+ }),
3283
+ /* @__PURE__ */ jsx(CodeInput, {
3284
+ length: 6,
3285
+ loading: isLoading,
3286
+ disabled,
3287
+ onComplete: (fullCode) => {
3288
+ setOtpLoading(true);
3289
+ setOtpError(void 0);
3290
+ onOtpVerify({
3291
+ email,
3292
+ code: fullCode,
3293
+ session
3294
+ }).catch((err) => setOtpError(err instanceof Error ? err.message : "Invalid or expired code. Please try again.")).finally(() => setOtpLoading(false));
3295
+ }
3296
+ }),
3297
+ isLoading && /* @__PURE__ */ jsx("div", {
3298
+ className: "flex justify-center",
3299
+ children: /* @__PURE__ */ jsx(Spinner, { size: "sm" })
3300
+ }),
3301
+ /* @__PURE__ */ jsx("button", {
3302
+ type: "button",
3303
+ className: "w-full text-center text-sm text-muted-foreground hover:text-foreground",
3304
+ onClick: () => {
3305
+ setStep("email");
3306
+ setOtpError(void 0);
3307
+ },
3308
+ children: "Use a different email"
3309
+ })
3310
+ ]
3311
+ })] });
3312
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FormError, { message: displayError }), /* @__PURE__ */ jsxs("form", {
3313
+ onSubmit: handleEmailSubmit,
3314
+ className: "space-y-4",
3315
+ children: [/* @__PURE__ */ jsx(InputGroup, {
3316
+ label: "Email",
3317
+ htmlFor: "otp-email",
3318
+ children: /* @__PURE__ */ jsx(Input, {
3319
+ id: "otp-email",
3320
+ name: "otp-email",
3321
+ type: "email",
3322
+ placeholder: "name@example.com",
3323
+ required: true,
3324
+ disabled: isLoading || disabled,
3325
+ autoComplete: "email"
3326
+ })
3327
+ }), /* @__PURE__ */ jsxs(Button, {
3328
+ type: "submit",
3329
+ variant: "secondary",
3330
+ className: "w-full",
3331
+ disabled: isLoading || disabled,
3332
+ children: [isLoading ? /* @__PURE__ */ jsx(Spinner, {
3333
+ size: "sm",
3334
+ className: "mr-2"
3335
+ }) : null, "Send Login Code"]
3336
+ })]
3337
+ })] });
3338
+ }
3339
+ function SignInBlock({ onSubmit, onForgotPassword, onSocialLogin, socialProviders = [], loading = false, error, disabled = false, title = "Sign in", description = "Enter your credentials to access your account", signUpHref, onSignUp, className, children, onOtpRequest, onOtpVerify, otpLabel = "Email me a code" }) {
3340
+ const [activeTab, setActiveTab] = React.useState(AUTH_TABS.PASSWORD);
3341
+ const otpEnabled = Boolean(onOtpRequest && onOtpVerify);
3127
3342
  const handleSubmit = async (e) => {
3128
3343
  e.preventDefault();
3129
3344
  const formData = new FormData(e.currentTarget);
3130
3345
  await onSubmit({
3131
3346
  email: formData.get("email"),
3132
- password: formData.get("password"),
3133
- rememberMe
3347
+ password: formData.get("password")
3134
3348
  });
3135
3349
  };
3350
+ const passwordForm = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(FormError, { message: error }), /* @__PURE__ */ jsxs("form", {
3351
+ onSubmit: handleSubmit,
3352
+ className: "space-y-4",
3353
+ children: [
3354
+ /* @__PURE__ */ jsx(InputGroup, {
3355
+ label: "Email",
3356
+ htmlFor: "email",
3357
+ children: /* @__PURE__ */ jsx(Input, {
3358
+ id: "email",
3359
+ name: "email",
3360
+ type: "email",
3361
+ placeholder: "name@example.com",
3362
+ required: true,
3363
+ disabled: loading || disabled,
3364
+ autoComplete: "email"
3365
+ })
3366
+ }),
3367
+ /* @__PURE__ */ jsxs(InputGroup, {
3368
+ label: "Password",
3369
+ htmlFor: "password",
3370
+ children: [/* @__PURE__ */ jsx(PasswordInput, {
3371
+ id: "password",
3372
+ name: "password",
3373
+ required: true,
3374
+ disabled: loading || disabled,
3375
+ autoComplete: "current-password"
3376
+ }), onForgotPassword && /* @__PURE__ */ jsx("div", {
3377
+ className: "flex justify-end",
3378
+ children: /* @__PURE__ */ jsx("button", {
3379
+ type: "button",
3380
+ onClick: onForgotPassword,
3381
+ className: "text-sm text-primary hover:underline",
3382
+ tabIndex: -1,
3383
+ children: "Forgot password?"
3384
+ })
3385
+ })]
3386
+ }),
3387
+ /* @__PURE__ */ jsxs(Button, {
3388
+ type: "submit",
3389
+ variant: "secondary",
3390
+ className: "w-full",
3391
+ disabled: loading || disabled,
3392
+ children: [loading ? /* @__PURE__ */ jsx(Spinner, {
3393
+ size: "sm",
3394
+ className: "mr-2"
3395
+ }) : null, "Sign in"]
3396
+ })
3397
+ ]
3398
+ })] });
3399
+ const socialSection = socialProviders.length > 0 && onSocialLogin && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
3400
+ className: "relative",
3401
+ children: [/* @__PURE__ */ jsx("div", {
3402
+ className: "absolute inset-0 flex items-center",
3403
+ children: /* @__PURE__ */ jsx(Separator, { className: "w-full" })
3404
+ }), /* @__PURE__ */ jsx("div", {
3405
+ className: "relative flex justify-center text-xs uppercase",
3406
+ children: /* @__PURE__ */ jsx("span", {
3407
+ className: "bg-card px-2 text-muted-foreground",
3408
+ children: "or"
3409
+ })
3410
+ })]
3411
+ }), /* @__PURE__ */ jsx(SocialProviders, {
3412
+ providers: socialProviders,
3413
+ onSocialLogin,
3414
+ loading,
3415
+ disabled
3416
+ })] });
3417
+ const footerLinks = /* @__PURE__ */ jsx(Fragment, { children: (signUpHref || onSignUp) && /* @__PURE__ */ jsxs("p", {
3418
+ className: "text-center text-sm text-muted-foreground",
3419
+ children: [
3420
+ "Don't have an account?",
3421
+ " ",
3422
+ onSignUp ? /* @__PURE__ */ jsx("button", {
3423
+ type: "button",
3424
+ onClick: onSignUp,
3425
+ className: "text-primary hover:underline font-medium",
3426
+ children: "Sign up"
3427
+ }) : /* @__PURE__ */ jsx("a", {
3428
+ href: signUpHref,
3429
+ className: "text-primary hover:underline font-medium",
3430
+ children: "Sign up"
3431
+ })
3432
+ ]
3433
+ }) });
3136
3434
  return /* @__PURE__ */ jsxs(Card, {
3137
3435
  className: cn("w-full max-w-md mx-auto", className),
3138
3436
  children: [/* @__PURE__ */ jsxs(CardHeader, {
@@ -3141,108 +3439,46 @@ function SignInBlock({ onSubmit, onForgotPassword, onSocialLogin, socialProvider
3141
3439
  }), /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", {
3142
3440
  className: "space-y-4",
3143
3441
  children: [
3144
- socialProviders.length > 0 && onSocialLogin && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SocialProviders, {
3145
- providers: socialProviders,
3146
- onSocialLogin,
3147
- loading,
3148
- disabled
3149
- }), /* @__PURE__ */ jsxs("div", {
3150
- className: "relative",
3151
- children: [/* @__PURE__ */ jsx("div", {
3152
- className: "absolute inset-0 flex items-center",
3153
- children: /* @__PURE__ */ jsx(Separator, { className: "w-full" })
3154
- }), /* @__PURE__ */ jsx("div", {
3155
- className: "relative flex justify-center text-xs uppercase",
3156
- children: /* @__PURE__ */ jsx("span", {
3157
- className: "bg-card px-2 text-muted-foreground",
3158
- children: "Or continue with"
3159
- })
3160
- })]
3161
- })] }),
3162
- /* @__PURE__ */ jsx(FormError, { message: error }),
3163
- /* @__PURE__ */ jsxs("form", {
3164
- onSubmit: handleSubmit,
3165
- className: "space-y-4",
3166
- children: [
3167
- /* @__PURE__ */ jsxs("div", {
3168
- className: "space-y-2",
3169
- children: [/* @__PURE__ */ jsx(Label, {
3170
- htmlFor: "email",
3171
- children: "Email"
3172
- }), /* @__PURE__ */ jsx(Input, {
3173
- id: "email",
3174
- name: "email",
3175
- type: "email",
3176
- placeholder: "name@example.com",
3177
- required: true,
3178
- disabled: loading || disabled,
3179
- autoComplete: "email"
3180
- })]
3181
- }),
3182
- /* @__PURE__ */ jsxs("div", {
3183
- className: "space-y-2",
3184
- children: [
3185
- /* @__PURE__ */ jsx(Label, {
3186
- htmlFor: "password",
3187
- children: "Password"
3188
- }),
3189
- /* @__PURE__ */ jsx(PasswordInput, {
3190
- id: "password",
3191
- name: "password",
3192
- required: true,
3193
- disabled: loading || disabled,
3194
- autoComplete: "current-password"
3195
- }),
3196
- onForgotPassword && /* @__PURE__ */ jsx("button", {
3197
- type: "button",
3198
- onClick: onForgotPassword,
3199
- className: "text-sm text-primary hover:underline self-start",
3200
- tabIndex: 0,
3201
- children: "Forgot password?"
3202
- })
3203
- ]
3204
- }),
3205
- /* @__PURE__ */ jsxs("div", {
3206
- className: "flex items-center space-x-2",
3207
- children: [/* @__PURE__ */ jsx(Checkbox, {
3208
- id: "remember",
3209
- checked: rememberMe,
3210
- onCheckedChange: (checked) => setRememberMe(checked === true),
3211
- disabled: loading || disabled
3212
- }), /* @__PURE__ */ jsx("label", {
3213
- htmlFor: "remember",
3214
- className: "text-sm text-muted-foreground cursor-pointer",
3215
- children: "Remember me"
3216
- })]
3217
- }),
3218
- /* @__PURE__ */ jsxs(Button, {
3219
- type: "submit",
3220
- className: "w-full",
3221
- disabled: loading || disabled,
3222
- children: [loading ? /* @__PURE__ */ jsx(Spinner, {
3223
- size: "sm",
3224
- className: "mr-2"
3225
- }) : null, "Sign in"]
3226
- })
3227
- ]
3228
- }),
3229
- (signUpHref || onSignUp) && /* @__PURE__ */ jsxs("p", {
3230
- className: "text-center text-sm text-muted-foreground",
3231
- children: [
3232
- "Don't have an account?",
3233
- " ",
3234
- onSignUp ? /* @__PURE__ */ jsx("button", {
3235
- type: "button",
3236
- onClick: onSignUp,
3237
- className: "text-primary hover:underline font-medium",
3238
- children: "Sign up"
3239
- }) : /* @__PURE__ */ jsx("a", {
3240
- href: signUpHref,
3241
- className: "text-primary hover:underline font-medium",
3242
- children: "Sign up"
3243
- })
3244
- ]
3245
- })
3442
+ children ? children : otpEnabled ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(PillTabs, {
3443
+ activeTab,
3444
+ onTabChange: setActiveTab,
3445
+ otpLabel
3446
+ }), /* @__PURE__ */ jsx(motion.div, {
3447
+ layout: true,
3448
+ transition: {
3449
+ type: "spring",
3450
+ bounce: 0,
3451
+ duration: .4
3452
+ },
3453
+ className: "",
3454
+ children: /* @__PURE__ */ jsx(AnimatePresence, {
3455
+ mode: "wait",
3456
+ initial: false,
3457
+ children: activeTab === AUTH_TABS.PASSWORD ? /* @__PURE__ */ jsx(motion.div, {
3458
+ initial: { opacity: 0 },
3459
+ animate: { opacity: 1 },
3460
+ exit: { opacity: 0 },
3461
+ transition: { duration: .15 },
3462
+ className: "space-y-4",
3463
+ children: passwordForm
3464
+ }, "password") : /* @__PURE__ */ jsx(motion.div, {
3465
+ initial: { opacity: 0 },
3466
+ animate: { opacity: 1 },
3467
+ exit: { opacity: 0 },
3468
+ transition: { duration: .15 },
3469
+ className: "space-y-4",
3470
+ children: /* @__PURE__ */ jsx(OtpForm, {
3471
+ onOtpRequest,
3472
+ onOtpVerify,
3473
+ loading,
3474
+ disabled,
3475
+ error
3476
+ })
3477
+ }, "otp")
3478
+ })
3479
+ })] }) : passwordForm,
3480
+ socialSection,
3481
+ footerLinks
3246
3482
  ]
3247
3483
  }) })]
3248
3484
  });
@@ -3293,26 +3529,22 @@ function SignUpBlock({ onSubmit, onSocialLogin, socialProviders = [], loading =
3293
3529
  onSubmit: handleSubmit,
3294
3530
  className: "space-y-4",
3295
3531
  children: [
3296
- /* @__PURE__ */ jsxs("div", {
3297
- className: "space-y-2",
3298
- children: [/* @__PURE__ */ jsx(Label, {
3299
- htmlFor: "name",
3300
- children: "Full name"
3301
- }), /* @__PURE__ */ jsx(Input, {
3532
+ /* @__PURE__ */ jsx(InputGroup, {
3533
+ label: "Full name",
3534
+ htmlFor: "name",
3535
+ children: /* @__PURE__ */ jsx(Input, {
3302
3536
  id: "name",
3303
3537
  name: "name",
3304
3538
  placeholder: "John Doe",
3305
3539
  required: true,
3306
3540
  disabled: loading || disabled,
3307
3541
  autoComplete: "name"
3308
- })]
3542
+ })
3309
3543
  }),
3310
- /* @__PURE__ */ jsxs("div", {
3311
- className: "space-y-2",
3312
- children: [/* @__PURE__ */ jsx(Label, {
3313
- htmlFor: "email",
3314
- children: "Email"
3315
- }), /* @__PURE__ */ jsx(Input, {
3544
+ /* @__PURE__ */ jsx(InputGroup, {
3545
+ label: "Email",
3546
+ htmlFor: "email",
3547
+ children: /* @__PURE__ */ jsx(Input, {
3316
3548
  id: "email",
3317
3549
  name: "email",
3318
3550
  type: "email",
@@ -3320,33 +3552,29 @@ function SignUpBlock({ onSubmit, onSocialLogin, socialProviders = [], loading =
3320
3552
  required: true,
3321
3553
  disabled: loading || disabled,
3322
3554
  autoComplete: "email"
3323
- })]
3555
+ })
3324
3556
  }),
3325
- /* @__PURE__ */ jsxs("div", {
3326
- className: "space-y-2",
3327
- children: [/* @__PURE__ */ jsx(Label, {
3328
- htmlFor: "password",
3329
- children: "Password"
3330
- }), /* @__PURE__ */ jsx(PasswordInput, {
3557
+ /* @__PURE__ */ jsx(InputGroup, {
3558
+ label: "Password",
3559
+ htmlFor: "password",
3560
+ children: /* @__PURE__ */ jsx(PasswordInput, {
3331
3561
  id: "password",
3332
3562
  name: "password",
3333
3563
  required: true,
3334
3564
  disabled: loading || disabled,
3335
3565
  autoComplete: "new-password"
3336
- })]
3566
+ })
3337
3567
  }),
3338
- /* @__PURE__ */ jsxs("div", {
3339
- className: "space-y-2",
3340
- children: [/* @__PURE__ */ jsx(Label, {
3341
- htmlFor: "confirmPassword",
3342
- children: "Confirm password"
3343
- }), /* @__PURE__ */ jsx(PasswordInput, {
3568
+ /* @__PURE__ */ jsx(InputGroup, {
3569
+ label: "Confirm password",
3570
+ htmlFor: "confirmPassword",
3571
+ children: /* @__PURE__ */ jsx(PasswordInput, {
3344
3572
  id: "confirmPassword",
3345
3573
  name: "confirmPassword",
3346
3574
  required: true,
3347
3575
  disabled: loading || disabled,
3348
3576
  autoComplete: "new-password"
3349
- })]
3577
+ })
3350
3578
  }),
3351
3579
  /* @__PURE__ */ jsxs("div", {
3352
3580
  className: "flex items-start space-x-2",
@@ -3439,12 +3667,10 @@ function ForgotPasswordBlock({ onSubmit, onBack, loading = false, error, disable
3439
3667
  /* @__PURE__ */ jsxs("form", {
3440
3668
  onSubmit: handleSubmit,
3441
3669
  className: "space-y-4",
3442
- children: [/* @__PURE__ */ jsxs("div", {
3443
- className: "space-y-2",
3444
- children: [/* @__PURE__ */ jsx(Label, {
3445
- htmlFor: "email",
3446
- children: "Email"
3447
- }), /* @__PURE__ */ jsx(Input, {
3670
+ children: [/* @__PURE__ */ jsx(InputGroup, {
3671
+ label: "Email",
3672
+ htmlFor: "email",
3673
+ children: /* @__PURE__ */ jsx(Input, {
3448
3674
  id: "email",
3449
3675
  name: "email",
3450
3676
  type: "email",
@@ -3452,7 +3678,7 @@ function ForgotPasswordBlock({ onSubmit, onBack, loading = false, error, disable
3452
3678
  required: true,
3453
3679
  disabled: loading || disabled,
3454
3680
  autoComplete: "email"
3455
- })]
3681
+ })
3456
3682
  }), /* @__PURE__ */ jsxs(Button, {
3457
3683
  type: "submit",
3458
3684
  className: "w-full",
@@ -3498,31 +3724,27 @@ function ResetPasswordBlock({ onSubmit, loading = false, error, disabled = false
3498
3724
  onSubmit: handleSubmit,
3499
3725
  className: "space-y-4",
3500
3726
  children: [
3501
- /* @__PURE__ */ jsxs("div", {
3502
- className: "space-y-2",
3503
- children: [/* @__PURE__ */ jsx(Label, {
3504
- htmlFor: "password",
3505
- children: "New password"
3506
- }), /* @__PURE__ */ jsx(PasswordInput, {
3727
+ /* @__PURE__ */ jsx(InputGroup, {
3728
+ label: "New password",
3729
+ htmlFor: "password",
3730
+ children: /* @__PURE__ */ jsx(PasswordInput, {
3507
3731
  id: "password",
3508
3732
  name: "password",
3509
3733
  required: true,
3510
3734
  disabled: loading || disabled,
3511
3735
  autoComplete: "new-password"
3512
- })]
3736
+ })
3513
3737
  }),
3514
- /* @__PURE__ */ jsxs("div", {
3515
- className: "space-y-2",
3516
- children: [/* @__PURE__ */ jsx(Label, {
3517
- htmlFor: "confirmPassword",
3518
- children: "Confirm new password"
3519
- }), /* @__PURE__ */ jsx(PasswordInput, {
3738
+ /* @__PURE__ */ jsx(InputGroup, {
3739
+ label: "Confirm new password",
3740
+ htmlFor: "confirmPassword",
3741
+ children: /* @__PURE__ */ jsx(PasswordInput, {
3520
3742
  id: "confirmPassword",
3521
3743
  name: "confirmPassword",
3522
3744
  required: true,
3523
3745
  disabled: loading || disabled,
3524
3746
  autoComplete: "new-password"
3525
- })]
3747
+ })
3526
3748
  }),
3527
3749
  /* @__PURE__ */ jsxs(Button, {
3528
3750
  type: "submit",
@@ -4487,6 +4709,6 @@ function NotificationSettingsBlock({ groups, onSave, loading = false, error, dis
4487
4709
  });
4488
4710
  }
4489
4711
  //#endregion
4490
- export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataTable, DataTableColumnHeader, DatePicker, DateRangePicker, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditableTitle, EmptyStateBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, Label, MaintenanceBlock, MediaCard, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, Popover, PopoverContent, PopoverTrigger, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, ResetPasswordBlock, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialProviders, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TextContent, TextEditor, Textarea, ThemeProvider, ThemeScope, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, actionNegativeToneClasses, actionNeutralIconChromeClasses, actionNeutralToneClasses, actionPositiveToneClasses, avatarVariants, badgeVariants, buttonVariants, cn, dateRangePresets, editableTitleVariants, navigationMenuTriggerStyle, progressBarVariants, spinnerVariants, toast, useDensity, useFormContext, useIsMobile, useScrollReveal, useSidebar, useTheme };
4712
+ export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AccountSettingsBlock, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AppSidebarBlock, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BisonProvider, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CodeInput, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DataTable, DataTableColumnHeader, DatePicker, DateRangePicker, DensityProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EditableTitle, EmptyStateBlock, FooterBlock, ForgotPasswordBlock, Form, FormError, FormField, HeaderBlock, Input, InputGroup, Label, MaintenanceBlock, MediaCard, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NotFoundBlock, NotificationSettingsBlock, PageShell, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PasswordInput, Popover, PopoverContent, PopoverTrigger, ProfileSettingsBlock, Progress, ProgressBar, RadioGroup, RadioGroupItem, ResetPasswordBlock, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, ServerErrorBlock, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Sidebar, SidebarBlock, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SignInBlock, SignUpBlock, Skeleton, Slider, SocialProviders, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, TextContent, TextEditor, Textarea, ThemeProvider, ThemeScope, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VerifyBlock, actionNegativeToneClasses, actionNeutralIconChromeClasses, actionNeutralToneClasses, actionPositiveToneClasses, avatarVariants, badgeVariants, buttonVariants, cn, dateRangePresets, editableTitleVariants, navigationMenuTriggerStyle, progressBarVariants, spinnerVariants, toast, useDensity, useFormContext, useIsMobile, useScrollReveal, useSidebar, useTheme };
4491
4713
 
4492
4714
  //# sourceMappingURL=index.mjs.map