import type { Component, ComponentProps, ValidComponent } from "solid-js" import { Show, splitProps } from "solid-js" import type { DynamicProps, RootProps } from "@corvu/otp-field" import OtpField from "@corvu/otp-field" import { cn } from "~/styles/utils" export const REGEXP_ONLY_DIGITS = "^\\d*$" export const REGEXP_ONLY_CHARS = "^[a-zA-Z]*$" export const REGEXP_ONLY_DIGITS_AND_CHARS = "^[a-zA-Z0-9]*$" type OTPFieldProps = RootProps & { class?: string } const OTPField = (props: DynamicProps>) => { const [local, others] = splitProps(props as OTPFieldProps, ["class"]) return ( ) } const OTPFieldInput = OtpField.Input const OTPFieldGroup: Component> = (props) => { const [local, others] = splitProps(props, ["class"]) return
} const OTPFieldSlot: Component & { index: number }> = (props) => { const [local, others] = splitProps(props, ["class", "index"]) const context = OtpField.useContext() const char = () => context.value()[local.index] const showFakeCaret = () => context.value().length === local.index && context.isInserting() return (
{char()}
) } const OTPFieldSeparator: Component> = (props) => { return (
) } export { OTPField, OTPFieldInput, OTPFieldGroup, OTPFieldSlot, OTPFieldSeparator }