@caffeinebounce/identity 0.12.2 → 0.12.4

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 CHANGED
@@ -484,6 +484,8 @@ interface DeleteAccountSectionProps {
484
484
  declare function DeleteAccountSection({ createClient, email, retentionDays, }: DeleteAccountSectionProps): react_jsx_runtime.JSX.Element;
485
485
 
486
486
  interface EmailSectionProps {
487
+ /** Render the change action as a compact pencil icon instead of a text label */
488
+ changeButtonPresentation?: "label" | "icon";
487
489
  /** Function to create a Supabase client */
488
490
  createClient: CreateClientFn;
489
491
  /** User ID (reserved for future use) */
@@ -495,7 +497,7 @@ interface EmailSectionProps {
495
497
  /** Callback when email is changed */
496
498
  onEmailChanged: (newEmail: string) => void;
497
499
  }
498
- declare function EmailSection({ createClient, userId: _userId, email, isVerified, onEmailChanged, }: EmailSectionProps): react_jsx_runtime.JSX.Element;
500
+ declare function EmailSection({ changeButtonPresentation, createClient, userId: _userId, email, isVerified, onEmailChanged, }: EmailSectionProps): react_jsx_runtime.JSX.Element;
499
501
 
500
502
  interface LinkedAccountsSectionProps {
501
503
  /** Function to create a Supabase client */
package/dist/index.d.ts CHANGED
@@ -484,6 +484,8 @@ interface DeleteAccountSectionProps {
484
484
  declare function DeleteAccountSection({ createClient, email, retentionDays, }: DeleteAccountSectionProps): react_jsx_runtime.JSX.Element;
485
485
 
486
486
  interface EmailSectionProps {
487
+ /** Render the change action as a compact pencil icon instead of a text label */
488
+ changeButtonPresentation?: "label" | "icon";
487
489
  /** Function to create a Supabase client */
488
490
  createClient: CreateClientFn;
489
491
  /** User ID (reserved for future use) */
@@ -495,7 +497,7 @@ interface EmailSectionProps {
495
497
  /** Callback when email is changed */
496
498
  onEmailChanged: (newEmail: string) => void;
497
499
  }
498
- declare function EmailSection({ createClient, userId: _userId, email, isVerified, onEmailChanged, }: EmailSectionProps): react_jsx_runtime.JSX.Element;
500
+ declare function EmailSection({ changeButtonPresentation, createClient, userId: _userId, email, isVerified, onEmailChanged, }: EmailSectionProps): react_jsx_runtime.JSX.Element;
499
501
 
500
502
  interface LinkedAccountsSectionProps {
501
503
  /** Function to create a Supabase client */
package/dist/index.js CHANGED
@@ -3786,6 +3786,7 @@ function useVerificationFlow({
3786
3786
  };
3787
3787
  }
3788
3788
  function EmailSection({
3789
+ changeButtonPresentation = "label",
3789
3790
  createClient,
3790
3791
  userId: _userId,
3791
3792
  email,
@@ -3813,6 +3814,26 @@ function EmailSection({
3813
3814
  const handleStartChange = () => {
3814
3815
  openEntryStep();
3815
3816
  };
3817
+ const changeButton = changeButtonPresentation === "icon" ? /* @__PURE__ */ jsxRuntime.jsx(
3818
+ primitives.Button,
3819
+ {
3820
+ "aria-label": "Change email",
3821
+ onClick: handleStartChange,
3822
+ size: "icon-sm",
3823
+ type: "button",
3824
+ variant: "outline",
3825
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.PencilLine, { "aria-hidden": "true", className: "size-4" })
3826
+ }
3827
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
3828
+ primitives.Button,
3829
+ {
3830
+ onClick: handleStartChange,
3831
+ size: "sm",
3832
+ type: "button",
3833
+ variant: "outline",
3834
+ children: "Change"
3835
+ }
3836
+ );
3816
3837
  const handleSendCode = async () => {
3817
3838
  if (!newEmail || !newEmail.includes("@")) {
3818
3839
  setError("Please enter a valid email address");
@@ -3892,16 +3913,10 @@ function EmailSection({
3892
3913
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: email })
3893
3914
  ] })
3894
3915
  ] }),
3895
- /* @__PURE__ */ jsxRuntime.jsx(
3896
- primitives.Button,
3897
- {
3898
- type: "button",
3899
- variant: "outline",
3900
- size: "sm",
3901
- onClick: handleStartChange,
3902
- children: "Change"
3903
- }
3904
- ),
3916
+ changeButtonPresentation === "icon" ? /* @__PURE__ */ jsxRuntime.jsx(primitives.TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxRuntime.jsxs(primitives.Tooltip, { children: [
3917
+ /* @__PURE__ */ jsxRuntime.jsx(primitives.TooltipTrigger, { asChild: true, "data-slot": "button", children: changeButton }),
3918
+ /* @__PURE__ */ jsxRuntime.jsx(primitives.TooltipContent, { side: "top", children: "Change email" })
3919
+ ] }) }) : changeButton,
3905
3920
  /* @__PURE__ */ jsxRuntime.jsx(primitives.Dialog, { open: dialogOpen, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(primitives.DialogContent, { className: "sm:max-w-md", children: [
3906
3921
  step === "enter-email" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3907
3922
  /* @__PURE__ */ jsxRuntime.jsxs(primitives.DialogHeader, { children: [
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { cn, FieldLabel, Input, Button, PasswordInput, defaultPasswordRules, FieldError, PasswordRequirements, Checkbox, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Badge, Tooltip, TooltipTrigger, TooltipContent, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, Label, DialogFooter, Spinner, extendedPasswordRules, VerificationCodeInput, Tabs, TabsList, TabsTrigger, TabsContent, InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from '@caffeinebounce/ui/primitives';
2
+ import { cn, FieldLabel, Input, Button, PasswordInput, defaultPasswordRules, FieldError, PasswordRequirements, Checkbox, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Badge, Tooltip, TooltipTrigger, TooltipContent, Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, Label, DialogFooter, TooltipProvider, Spinner, extendedPasswordRules, VerificationCodeInput, Tabs, TabsList, TabsTrigger, TabsContent, InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } from '@caffeinebounce/ui/primitives';
3
3
  import { useSearchParams, useRouter } from 'next/navigation';
4
4
  import { createContext, useState, useEffect, useCallback, useRef, useMemo, useContext } from 'react';
5
- import { ArrowLeft, AlertCircle, Loader2, Shield, AlertTriangle, Smartphone, Check, Mail, KeyRound, Info, Trash2, CheckCircle2, Link2, Unlink, Phone, Copy, Download, Lightbulb, X } from 'lucide-react';
5
+ import { ArrowLeft, AlertCircle, Loader2, Shield, AlertTriangle, Smartphone, Check, Mail, KeyRound, Info, Trash2, CheckCircle2, Link2, Unlink, Phone, Copy, Download, Lightbulb, X, PencilLine } from 'lucide-react';
6
6
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
7
7
  import { getClientOrigin, generateDeviceFingerprint, formatPhoneInput, isPreviewEnvironment, formatDate } from '@caffeinebounce/shared-utils';
8
8
  export { generateDeviceFingerprint, generateSecureToken, getClientIP, getGeolocationFromIP, hashString } from '@caffeinebounce/shared-utils';
@@ -3781,6 +3781,7 @@ function useVerificationFlow({
3781
3781
  };
3782
3782
  }
3783
3783
  function EmailSection({
3784
+ changeButtonPresentation = "label",
3784
3785
  createClient,
3785
3786
  userId: _userId,
3786
3787
  email,
@@ -3808,6 +3809,26 @@ function EmailSection({
3808
3809
  const handleStartChange = () => {
3809
3810
  openEntryStep();
3810
3811
  };
3812
+ const changeButton = changeButtonPresentation === "icon" ? /* @__PURE__ */ jsx(
3813
+ Button,
3814
+ {
3815
+ "aria-label": "Change email",
3816
+ onClick: handleStartChange,
3817
+ size: "icon-sm",
3818
+ type: "button",
3819
+ variant: "outline",
3820
+ children: /* @__PURE__ */ jsx(PencilLine, { "aria-hidden": "true", className: "size-4" })
3821
+ }
3822
+ ) : /* @__PURE__ */ jsx(
3823
+ Button,
3824
+ {
3825
+ onClick: handleStartChange,
3826
+ size: "sm",
3827
+ type: "button",
3828
+ variant: "outline",
3829
+ children: "Change"
3830
+ }
3831
+ );
3811
3832
  const handleSendCode = async () => {
3812
3833
  if (!newEmail || !newEmail.includes("@")) {
3813
3834
  setError("Please enter a valid email address");
@@ -3887,16 +3908,10 @@ function EmailSection({
3887
3908
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: email })
3888
3909
  ] })
3889
3910
  ] }),
3890
- /* @__PURE__ */ jsx(
3891
- Button,
3892
- {
3893
- type: "button",
3894
- variant: "outline",
3895
- size: "sm",
3896
- onClick: handleStartChange,
3897
- children: "Change"
3898
- }
3899
- ),
3911
+ changeButtonPresentation === "icon" ? /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 300, children: /* @__PURE__ */ jsxs(Tooltip, { children: [
3912
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, "data-slot": "button", children: changeButton }),
3913
+ /* @__PURE__ */ jsx(TooltipContent, { side: "top", children: "Change email" })
3914
+ ] }) }) : changeButton,
3900
3915
  /* @__PURE__ */ jsx(Dialog, { open: dialogOpen, onOpenChange: handleOpenChange, children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
3901
3916
  step === "enter-email" && /* @__PURE__ */ jsxs(Fragment, { children: [
3902
3917
  /* @__PURE__ */ jsxs(DialogHeader, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caffeinebounce/identity",
3
- "version": "0.12.2",
3
+ "version": "0.12.4",
4
4
  "description": "Authentication components and handlers for Caffeine Bounce projects",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",