From 7b939640630542e8225c39804ca2d40673eb7d21 Mon Sep 17 00:00:00 2001 From: Brad Williams Date: Fri, 20 Sep 2024 14:12:59 -0500 Subject: [PATCH] New forms field types --- app/components/forms.tsx | 256 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 249 insertions(+), 7 deletions(-) diff --git a/app/components/forms.tsx b/app/components/forms.tsx index f396e9f35..b04780046 100644 --- a/app/components/forms.tsx +++ b/app/components/forms.tsx @@ -1,16 +1,40 @@ -import { useInputControl } from '@conform-to/react' +import { FieldMetadata, useInputControl } from '@conform-to/react' import { REGEXP_ONLY_DIGITS_AND_CHARS, type OTPInputProps } from 'input-otp' -import React, { useId } from 'react' -import { Checkbox, type CheckboxProps } from './ui/checkbox.tsx' +import React, { useId, useState } from 'react' +import { Checkbox, type CheckboxProps } from './ui/checkbox' import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, -} from './ui/input-otp.tsx' -import { Input } from './ui/input.tsx' -import { Label } from './ui/label.tsx' -import { Textarea } from './ui/textarea.tsx' +} from './ui/input-otp' +import { Input } from './ui/input' +import { Label } from './ui/label' +import { Button } from './ui/button' +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from './ui/select' +import { Textarea } from './ui/textarea' +import { + Command, + CommandEmpty, + CommandGroup, + CommandInput, + CommandItem, + CommandList, + CommandDialog, +} from '#app/components/ui/command' +import { + Popover, + PopoverContent, + PopoverTrigger, +} from '#app/components/ui/popover' +import { Icon } from '#app/components/ui/icon' +import { cn } from '#app/utils/misc' export type ListOfErrors = Array | null | undefined @@ -48,6 +72,7 @@ export function Field({ const fallbackId = useId() const id = inputProps.id ?? fallbackId const errorId = errors?.length ? `${id}-error` : undefined + return (