-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade to latest epic stack with vite, dep bump
- Loading branch information
Showing
99 changed files
with
12,594 additions
and
9,360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { OTPInput, OTPInputContext } from 'input-otp' | ||
import * as React from 'react' | ||
|
||
import { cn } from '#app/utils/misc.tsx' | ||
|
||
const InputOTP = React.forwardRef< | ||
React.ElementRef<typeof OTPInput>, | ||
React.ComponentPropsWithoutRef<typeof OTPInput> | ||
>(({ className, containerClassName, ...props }, ref) => ( | ||
<OTPInput | ||
ref={ref} | ||
containerClassName={cn( | ||
'flex items-center gap-2 has-[:disabled]:opacity-50', | ||
containerClassName, | ||
)} | ||
className={cn('disabled:cursor-not-allowed', className)} | ||
{...props} | ||
/> | ||
)) | ||
InputOTP.displayName = 'InputOTP' | ||
|
||
const InputOTPGroup = React.forwardRef< | ||
React.ElementRef<'div'>, | ||
React.ComponentPropsWithoutRef<'div'> | ||
>(({ className, ...props }, ref) => ( | ||
<div ref={ref} className={cn('flex items-center', className)} {...props} /> | ||
)) | ||
InputOTPGroup.displayName = 'InputOTPGroup' | ||
|
||
const InputOTPSlot = React.forwardRef< | ||
React.ElementRef<'div'>, | ||
React.ComponentPropsWithoutRef<'div'> & { index: number } | ||
>(({ index, className, ...props }, ref) => { | ||
const inputOTPContext = React.useContext(OTPInputContext) | ||
const slot = inputOTPContext.slots[index] | ||
if (!slot) throw new Error('Invalid slot index') | ||
const { char, hasFakeCaret, isActive } = slot | ||
|
||
return ( | ||
<div | ||
ref={ref} | ||
className={cn( | ||
'relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md', | ||
isActive && 'z-10 ring-2 ring-ring ring-offset-background', | ||
className, | ||
)} | ||
{...props} | ||
> | ||
{char} | ||
{hasFakeCaret && ( | ||
<div className="pointer-events-none absolute inset-0 flex items-center justify-center"> | ||
<div className="h-4 w-px animate-caret-blink bg-foreground duration-1000" /> | ||
</div> | ||
)} | ||
</div> | ||
) | ||
}) | ||
InputOTPSlot.displayName = 'InputOTPSlot' | ||
|
||
const InputOTPSeparator = React.forwardRef< | ||
React.ElementRef<'div'>, | ||
React.ComponentPropsWithoutRef<'div'> | ||
>(({ ...props }, ref) => ( | ||
<div ref={ref} role="separator" {...props}> | ||
- | ||
</div> | ||
)) | ||
InputOTPSeparator.displayName = 'InputOTPSeparator' | ||
|
||
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.