fix field
This commit is contained in:
parent
a489c489c9
commit
fbdf9a1f4a
|
|
@ -123,7 +123,7 @@ export const BaseField = (prop: {
|
|||
{errors.length > 0 && (
|
||||
<div
|
||||
className={cx(
|
||||
"field-error c-p-2 c-text-xs c-text-red-600",
|
||||
"field-error c-p-2 c-pl-0 c-text-xs c-text-red-600",
|
||||
field.desc && "c-pt-0",
|
||||
|
||||
css`
|
||||
|
|
|
|||
|
|
@ -169,14 +169,14 @@ export const Field: FC<FieldProp> = (arg) => {
|
|||
arg={arg}
|
||||
/>
|
||||
{field.desc && (
|
||||
<div className={cx("c-p-2 c-text-xs", errors.length > 0 && "c-pb-1")}>
|
||||
<div className={cx("c-p-2 c-pl-0 c-text-xs", errors.length > 0 && "c-pb-1")}>
|
||||
{field.desc}
|
||||
</div>
|
||||
)}
|
||||
{errors.length ? (
|
||||
<div
|
||||
className={cx(
|
||||
"field-error c-p-2 c-text-xs c-text-red-600",
|
||||
"field-error c-p-2 c-pl-0 c-text-xs c-text-red-600",
|
||||
field.desc && "c-pt-0",
|
||||
css`
|
||||
padding-left: 0px !important;
|
||||
|
|
|
|||
|
|
@ -1,73 +0,0 @@
|
|||
import * as React from "react";
|
||||
import { OTPInput, OTPInputContext } from "input-otp";
|
||||
import { Dot } from "lucide-react";
|
||||
|
||||
import { cn } from "@/utils";
|
||||
|
||||
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:c-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("c-flex c-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 { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"c-relative c-flex c-h-10 c-w-10 c-items-center c-justify-center c-border-y c-border-r c-border-input c-text-sm c-transition-all first:c-rounded-l-md first:c-border-l last:c-rounded-r-md",
|
||||
isActive && "c-z-10 c-ring-2 c-ring-ring c-ring-offset-background",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{char}
|
||||
{hasFakeCaret && (
|
||||
<div className="c-pointer-events-none c-absolute c-inset-0 c-flex c-items-center c-justify-center">
|
||||
<div className="c-h-4 c-w-px c-animate-caret-blink c-bg-foreground c-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}>
|
||||
<Dot />
|
||||
</div>
|
||||
));
|
||||
InputOTPSeparator.displayName = "InputOTPSeparator";
|
||||
|
||||
export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
|
||||
Loading…
Reference in New Issue