soda-heroui 0.7.8 → 0.7.9

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.
@@ -1,7 +1,7 @@
1
- import { ReactNode } from "react";
2
- import { Checkbox } from "@heroui/react";
3
- import { FieldComponentProps } from "soda-tanstack-form";
4
- import { StrictOmit } from "soda-type";
5
- export interface FormCheckboxProps<FieldValue extends boolean | null | undefined = boolean | null | undefined> extends StrictOmit<FieldComponentProps<typeof Checkbox, FieldValue>, never> {
6
- }
7
- export declare function FormCheckbox<FieldValue extends boolean | null | undefined = boolean | null | undefined>({ field, ...rest }: FormCheckboxProps<FieldValue>): ReactNode;
1
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { As, CheckboxProps, MergeWithAs } from "@heroui/react";
3
+ import { Field } from "soda-tanstack-form";
4
+ export type FormCheckboxProps<FieldValue extends boolean | null | undefined = boolean | null | undefined, AsComponent extends As = "input"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, CheckboxProps, AsComponent> & {
5
+ field: Field<FieldValue>;
6
+ };
7
+ export declare function FormCheckbox<FieldValue extends boolean | null | undefined = boolean | null | undefined, AsComponent extends As = "input">({ field, ...rest }: FormCheckboxProps<FieldValue, AsComponent>): ReactNode;
@@ -1,7 +1,7 @@
1
- import { ReactNode } from "react";
2
- import { CheckboxGroup } from "@heroui/react";
3
- import { FieldComponentProps } from "soda-tanstack-form";
4
- import { StrictOmit } from "soda-type";
5
- export interface FormCheckboxGroupProps<FieldValue extends string[] | null | undefined = string[] | null | undefined> extends StrictOmit<FieldComponentProps<typeof CheckboxGroup, FieldValue>, never> {
6
- }
7
- export declare function FormCheckboxGroup<FieldValue extends string[] | null | undefined = string[] | null | undefined>({ field, ...rest }: FormCheckboxGroupProps<FieldValue>): ReactNode;
1
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { As, CheckboxGroupProps, MergeWithAs } from "@heroui/react";
3
+ import { Field } from "soda-tanstack-form";
4
+ export type FormCheckboxGroupProps<FieldValue extends string[] | null | undefined = string[] | null | undefined, AsComponent extends As = "div"> = MergeWithAs<ComponentPropsWithoutRef<"div">, ComponentPropsWithoutRef<AsComponent>, CheckboxGroupProps, AsComponent> & {
5
+ field: Field<FieldValue>;
6
+ };
7
+ export declare function FormCheckboxGroup<FieldValue extends string[] | null | undefined = string[] | null | undefined, AsComponent extends As = "div">({ field, ...rest }: FormCheckboxGroupProps<FieldValue, AsComponent>): ReactNode;
@@ -1,7 +1,7 @@
1
- import { ReactNode } from "react";
2
- import { Input } from "@heroui/react";
3
- import { FieldComponentProps } from "soda-tanstack-form";
4
- import { StrictOmit } from "soda-type";
5
- export interface FormInputProps<FieldValue extends string | null | undefined = string | null | undefined> extends StrictOmit<FieldComponentProps<typeof Input, FieldValue>, never> {
6
- }
7
- export declare function FormInput<FieldValue extends string | null | undefined = string | null | undefined>({ field, ...rest }: FormInputProps<FieldValue>): ReactNode;
1
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { As, InputProps, MergeWithAs } from "@heroui/react";
3
+ import { Field } from "soda-tanstack-form";
4
+ export type FormInputProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "input"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, InputProps, AsComponent> & {
5
+ field: Field<FieldValue>;
6
+ };
7
+ export declare function FormInput<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "input">({ field, ...rest }: FormInputProps<FieldValue, AsComponent>): ReactNode;
@@ -1,7 +1,7 @@
1
- import { ReactNode } from "react";
2
- import { InputOtp } from "@heroui/react";
3
- import { FieldComponentProps } from "soda-tanstack-form";
4
- import { StrictOmit } from "soda-type";
5
- export interface FormInputOtpProps<FieldValue extends string | null | undefined = string | null | undefined> extends StrictOmit<FieldComponentProps<typeof InputOtp, FieldValue>, never> {
6
- }
7
- export declare function FormInputOtp<FieldValue extends string | null | undefined = string | null | undefined>({ field, ...rest }: FormInputOtpProps<FieldValue>): ReactNode;
1
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { As, InputOtpProps, MergeWithAs } from "@heroui/react";
3
+ import { Field } from "soda-tanstack-form";
4
+ export type FormInputOtpProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "input"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, InputOtpProps, AsComponent> & {
5
+ field: Field<FieldValue>;
6
+ };
7
+ export declare function FormInputOtp<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "input">({ field, ...rest }: FormInputOtpProps<FieldValue, AsComponent>): ReactNode;
@@ -1,7 +1,7 @@
1
- import { ReactNode } from "react";
2
- import { NumberInput } from "@heroui/react";
3
- import { FieldComponentProps } from "soda-tanstack-form";
4
- import { StrictOmit } from "soda-type";
5
- export interface FormNumberInputProps<FieldValue extends number | null | undefined = number | null | undefined> extends StrictOmit<FieldComponentProps<typeof NumberInput, FieldValue>, never> {
6
- }
7
- export declare function FormNumberInput<FieldValue extends number | null | undefined = number | null | undefined>({ field, ...rest }: FormNumberInputProps<FieldValue>): ReactNode;
1
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { As, MergeWithAs, NumberInputProps } from "@heroui/react";
3
+ import { Field } from "soda-tanstack-form";
4
+ export type FormNumberInputProps<FieldValue extends number | null | undefined = number | null | undefined, AsComponent extends As = "input"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, NumberInputProps, AsComponent> & {
5
+ field: Field<FieldValue>;
6
+ };
7
+ export declare function FormNumberInput<FieldValue extends number | null | undefined = number | null | undefined, AsComponent extends As = "input">({ field, ...rest }: FormNumberInputProps<FieldValue, AsComponent>): ReactNode;
@@ -1,7 +1,7 @@
1
- import { ReactNode } from "react";
2
- import { Pagination } from "@heroui/react";
3
- import { FieldComponentProps } from "soda-tanstack-form";
4
- import { StrictOmit } from "soda-type";
5
- export interface FormPaginationProps<FieldValue extends number | null | undefined = number | null | undefined> extends StrictOmit<FieldComponentProps<typeof Pagination, FieldValue>, never> {
6
- }
7
- export declare function FormPagination<FieldValue extends number | null | undefined = number | null | undefined>({ field, ...rest }: FormPaginationProps<FieldValue>): ReactNode;
1
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { As, MergeWithAs, PaginationProps } from "@heroui/react";
3
+ import { Field } from "soda-tanstack-form";
4
+ export type FormPaginationProps<FieldValue extends number | null | undefined = number | null | undefined, AsComponent extends As = "nav"> = MergeWithAs<ComponentPropsWithoutRef<"nav">, ComponentPropsWithoutRef<AsComponent>, PaginationProps, AsComponent> & {
5
+ field: Field<FieldValue>;
6
+ };
7
+ export declare function FormPagination<FieldValue extends number | null | undefined = number | null | undefined, AsComponent extends As = "nav">({ field, ...rest }: FormPaginationProps<FieldValue, AsComponent>): ReactNode;
@@ -1,7 +1,7 @@
1
- import { ReactNode } from "react";
2
- import { RadioGroup } from "@heroui/react";
3
- import { FieldComponentProps } from "soda-tanstack-form";
4
- import { StrictOmit } from "soda-type";
5
- export interface FormRadioGroupProps<FieldValue extends string | null | undefined = string | null | undefined> extends StrictOmit<FieldComponentProps<typeof RadioGroup, FieldValue>, never> {
6
- }
7
- export declare function FormRadioGroup<FieldValue extends string | null | undefined = string | null | undefined>({ field, ...rest }: FormRadioGroupProps<FieldValue>): ReactNode;
1
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { As, MergeWithAs, RadioGroupProps } from "@heroui/react";
3
+ import { Field } from "soda-tanstack-form";
4
+ export type FormRadioGroupProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "div"> = MergeWithAs<ComponentPropsWithoutRef<"div">, ComponentPropsWithoutRef<AsComponent>, RadioGroupProps, AsComponent> & {
5
+ field: Field<FieldValue>;
6
+ };
7
+ export declare function FormRadioGroup<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "div">({ field, ...rest }: FormRadioGroupProps<FieldValue, AsComponent>): ReactNode;
@@ -1,7 +1,7 @@
1
- import { ReactNode } from "react";
2
- import { Switch } from "@heroui/react";
3
- import { FieldComponentProps } from "soda-tanstack-form";
4
- import { StrictOmit } from "soda-type";
5
- export interface FormSwitchProps<FieldValue extends boolean | null | undefined = boolean | null | undefined> extends StrictOmit<FieldComponentProps<typeof Switch, FieldValue>, never> {
6
- }
7
- export declare function FormSwitch<FieldValue extends boolean | null | undefined = boolean | null | undefined>({ field, ...rest }: FormSwitchProps<FieldValue>): ReactNode;
1
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { As, MergeWithAs, SwitchProps } from "@heroui/react";
3
+ import { Field } from "soda-tanstack-form";
4
+ export type FormSwitchProps<FieldValue extends boolean | null | undefined = boolean | null | undefined, AsComponent extends As = "input"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, SwitchProps, AsComponent> & {
5
+ field: Field<FieldValue>;
6
+ };
7
+ export declare function FormSwitch<FieldValue extends boolean | null | undefined = boolean | null | undefined, AsComponent extends As = "input">({ field, ...rest }: FormSwitchProps<FieldValue, AsComponent>): ReactNode;
@@ -1,7 +1,7 @@
1
- import { ReactNode } from "react";
2
- import { Textarea } from "@heroui/react";
3
- import { FieldComponentProps } from "soda-tanstack-form";
4
- import { StrictOmit } from "soda-type";
5
- export interface FormTextareaProps<FieldValue extends string | null | undefined = string | null | undefined> extends StrictOmit<FieldComponentProps<typeof Textarea, FieldValue>, never> {
6
- }
7
- export declare function FormTextarea<FieldValue extends string | null | undefined = string | null | undefined>({ field, ...rest }: FormTextareaProps<FieldValue>): ReactNode;
1
+ import { ComponentPropsWithoutRef, ReactNode } from "react";
2
+ import { As, MergeWithAs, TextAreaProps } from "@heroui/react";
3
+ import { Field } from "soda-tanstack-form";
4
+ export type FormTextareaProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "textarea"> = MergeWithAs<ComponentPropsWithoutRef<"input">, ComponentPropsWithoutRef<AsComponent>, TextAreaProps, AsComponent> & {
5
+ field: Field<FieldValue>;
6
+ };
7
+ export declare function FormTextarea<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "textarea">({ field, ...rest }: FormTextareaProps<FieldValue, AsComponent>): ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soda-heroui",
3
- "version": "0.7.8",
3
+ "version": "0.7.9",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "exports": {
@@ -38,8 +38,8 @@
38
38
  "@internationalized/date": "^3.7.0",
39
39
  "@tanstack/react-form": "^1.3.0",
40
40
  "deepsea-tools": "5.37.0",
41
- "soda-hooks": "6.10.11",
42
41
  "soda-type": "6.3.0",
42
+ "soda-hooks": "6.10.11",
43
43
  "soda-tanstack-form": "0.2.1"
44
44
  },
45
45
  "devDependencies": {
@@ -1,19 +1,24 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode } from "react"
4
- import { Checkbox } from "@heroui/react"
5
- import { FieldComponentProps } from "soda-tanstack-form"
6
- import { StrictOmit } from "soda-type"
3
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
4
+ import { As, Checkbox, CheckboxProps, MergeWithAs } from "@heroui/react"
5
+ import { Field } from "soda-tanstack-form"
7
6
 
8
7
  import { getFieldProps } from "../utils/getFieldProps"
9
8
 
10
- export interface FormCheckboxProps<FieldValue extends boolean | null | undefined = boolean | null | undefined>
11
- extends StrictOmit<FieldComponentProps<typeof Checkbox, FieldValue>, never> {}
9
+ export type FormCheckboxProps<FieldValue extends boolean | null | undefined = boolean | null | undefined, AsComponent extends As = "input"> = MergeWithAs<
10
+ ComponentPropsWithoutRef<"input">,
11
+ ComponentPropsWithoutRef<AsComponent>,
12
+ CheckboxProps,
13
+ AsComponent
14
+ > & {
15
+ field: Field<FieldValue>
16
+ }
12
17
 
13
- export function FormCheckbox<FieldValue extends boolean | null | undefined = boolean | null | undefined>({
18
+ export function FormCheckbox<FieldValue extends boolean | null | undefined = boolean | null | undefined, AsComponent extends As = "input">({
14
19
  field,
15
20
  ...rest
16
- }: FormCheckboxProps<FieldValue>): ReactNode {
21
+ }: FormCheckboxProps<FieldValue, AsComponent>): ReactNode {
17
22
  return (
18
23
  <Checkbox
19
24
  isSelected={field.state.value ?? false}
@@ -1,18 +1,30 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode } from "react"
4
- import { CheckboxGroup } from "@heroui/react"
5
- import { FieldComponentProps } from "soda-tanstack-form"
6
- import { StrictOmit } from "soda-type"
3
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
4
+ import { As, CheckboxGroup, CheckboxGroupProps, MergeWithAs } from "@heroui/react"
5
+ import { Field } from "soda-tanstack-form"
7
6
 
8
7
  import { getFieldProps } from "../utils/getFieldProps"
9
8
 
10
- export interface FormCheckboxGroupProps<FieldValue extends string[] | null | undefined = string[] | null | undefined>
11
- extends StrictOmit<FieldComponentProps<typeof CheckboxGroup, FieldValue>, never> {}
9
+ export type FormCheckboxGroupProps<FieldValue extends string[] | null | undefined = string[] | null | undefined, AsComponent extends As = "div"> = MergeWithAs<
10
+ ComponentPropsWithoutRef<"div">,
11
+ ComponentPropsWithoutRef<AsComponent>,
12
+ CheckboxGroupProps,
13
+ AsComponent
14
+ > & {
15
+ field: Field<FieldValue>
16
+ }
12
17
 
13
- export function FormCheckboxGroup<FieldValue extends string[] | null | undefined = string[] | null | undefined>({
18
+ export function FormCheckboxGroup<FieldValue extends string[] | null | undefined = string[] | null | undefined, AsComponent extends As = "div">({
14
19
  field,
15
20
  ...rest
16
- }: FormCheckboxGroupProps<FieldValue>): ReactNode {
17
- return <CheckboxGroup value={field.state.value ?? []} onValueChange={field.handleChange as (value: string[]) => void} {...getFieldProps(field)} {...rest} />
21
+ }: FormCheckboxGroupProps<FieldValue, AsComponent>): ReactNode {
22
+ return (
23
+ <CheckboxGroup<AsComponent>
24
+ value={field.state.value ?? []}
25
+ onValueChange={field.handleChange as (value: string[]) => void}
26
+ {...getFieldProps(field)}
27
+ {...rest}
28
+ />
29
+ )
18
30
  }
@@ -1,15 +1,25 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode } from "react"
4
- import { Input } from "@heroui/react"
5
- import { FieldComponentProps } from "soda-tanstack-form"
6
- import { StrictOmit } from "soda-type"
3
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
4
+ import { As, Input, InputProps, MergeWithAs } from "@heroui/react"
5
+ import { Field } from "soda-tanstack-form"
7
6
 
8
7
  import { getFieldProps } from "../utils/getFieldProps"
9
8
 
10
- export interface FormInputProps<FieldValue extends string | null | undefined = string | null | undefined>
11
- extends StrictOmit<FieldComponentProps<typeof Input, FieldValue>, never> {}
9
+ export type FormInputProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "input"> = MergeWithAs<
10
+ ComponentPropsWithoutRef<"input">,
11
+ ComponentPropsWithoutRef<AsComponent>,
12
+ InputProps,
13
+ AsComponent
14
+ > & {
15
+ field: Field<FieldValue>
16
+ }
12
17
 
13
- export function FormInput<FieldValue extends string | null | undefined = string | null | undefined>({ field, ...rest }: FormInputProps<FieldValue>): ReactNode {
14
- return <Input value={field.state.value ?? ""} onValueChange={field.handleChange as (value: string) => void} {...getFieldProps(field)} {...rest} />
18
+ export function FormInput<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "input">({
19
+ field,
20
+ ...rest
21
+ }: FormInputProps<FieldValue, AsComponent>): ReactNode {
22
+ return (
23
+ <Input<AsComponent> value={field.state.value ?? ""} onValueChange={field.handleChange as (value: string) => void} {...getFieldProps(field)} {...rest} />
24
+ )
15
25
  }
@@ -1,18 +1,30 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode } from "react"
4
- import { InputOtp } from "@heroui/react"
5
- import { FieldComponentProps } from "soda-tanstack-form"
6
- import { StrictOmit } from "soda-type"
3
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
4
+ import { As, InputOtp, InputOtpProps, MergeWithAs } from "@heroui/react"
5
+ import { Field } from "soda-tanstack-form"
7
6
 
8
7
  import { getFieldProps } from "../utils/getFieldProps"
9
8
 
10
- export interface FormInputOtpProps<FieldValue extends string | null | undefined = string | null | undefined>
11
- extends StrictOmit<FieldComponentProps<typeof InputOtp, FieldValue>, never> {}
9
+ export type FormInputOtpProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "input"> = MergeWithAs<
10
+ ComponentPropsWithoutRef<"input">,
11
+ ComponentPropsWithoutRef<AsComponent>,
12
+ InputOtpProps,
13
+ AsComponent
14
+ > & {
15
+ field: Field<FieldValue>
16
+ }
12
17
 
13
- export function FormInputOtp<FieldValue extends string | null | undefined = string | null | undefined>({
18
+ export function FormInputOtp<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "input">({
14
19
  field,
15
20
  ...rest
16
- }: FormInputOtpProps<FieldValue>): ReactNode {
17
- return <InputOtp value={field.state.value ?? ""} onValueChange={field.handleChange as (value: string) => void} {...getFieldProps(field)} {...rest} />
21
+ }: FormInputOtpProps<FieldValue, AsComponent>): ReactNode {
22
+ return (
23
+ <InputOtp<AsComponent>
24
+ value={field.state.value ?? ""}
25
+ onValueChange={field.handleChange as (value: string) => void}
26
+ {...getFieldProps(field)}
27
+ {...rest}
28
+ />
29
+ )
18
30
  }
@@ -1,18 +1,30 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode } from "react"
4
- import { NumberInput } from "@heroui/react"
5
- import { FieldComponentProps } from "soda-tanstack-form"
6
- import { StrictOmit } from "soda-type"
3
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
4
+ import { As, MergeWithAs, NumberInput, NumberInputProps } from "@heroui/react"
5
+ import { Field } from "soda-tanstack-form"
7
6
 
8
7
  import { getFieldProps } from "../utils/getFieldProps"
9
8
 
10
- export interface FormNumberInputProps<FieldValue extends number | null | undefined = number | null | undefined>
11
- extends StrictOmit<FieldComponentProps<typeof NumberInput, FieldValue>, never> {}
9
+ export type FormNumberInputProps<FieldValue extends number | null | undefined = number | null | undefined, AsComponent extends As = "input"> = MergeWithAs<
10
+ ComponentPropsWithoutRef<"input">,
11
+ ComponentPropsWithoutRef<AsComponent>,
12
+ NumberInputProps,
13
+ AsComponent
14
+ > & {
15
+ field: Field<FieldValue>
16
+ }
12
17
 
13
- export function FormNumberInput<FieldValue extends number | null | undefined = number | null | undefined>({
18
+ export function FormNumberInput<FieldValue extends number | null | undefined = number | null | undefined, AsComponent extends As = "input">({
14
19
  field,
15
20
  ...rest
16
- }: FormNumberInputProps<FieldValue>): ReactNode {
17
- return <NumberInput value={field.state.value ?? 0} onValueChange={field.handleChange as (value: number) => void} {...getFieldProps(field)} {...rest} />
21
+ }: FormNumberInputProps<FieldValue, AsComponent>): ReactNode {
22
+ return (
23
+ <NumberInput<AsComponent>
24
+ value={field.state.value ?? 0}
25
+ onValueChange={field.handleChange as (value: number) => void}
26
+ {...getFieldProps(field)}
27
+ {...rest}
28
+ />
29
+ )
18
30
  }
@@ -1,18 +1,30 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode } from "react"
4
- import { Pagination } from "@heroui/react"
5
- import { FieldComponentProps } from "soda-tanstack-form"
6
- import { StrictOmit } from "soda-type"
3
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
4
+ import { As, MergeWithAs, Pagination, PaginationProps } from "@heroui/react"
5
+ import { Field } from "soda-tanstack-form"
7
6
 
8
7
  import { getFieldProps } from "../utils/getFieldProps"
9
8
 
10
- export interface FormPaginationProps<FieldValue extends number | null | undefined = number | null | undefined>
11
- extends StrictOmit<FieldComponentProps<typeof Pagination, FieldValue>, never> {}
9
+ export type FormPaginationProps<FieldValue extends number | null | undefined = number | null | undefined, AsComponent extends As = "nav"> = MergeWithAs<
10
+ ComponentPropsWithoutRef<"nav">,
11
+ ComponentPropsWithoutRef<AsComponent>,
12
+ PaginationProps,
13
+ AsComponent
14
+ > & {
15
+ field: Field<FieldValue>
16
+ }
12
17
 
13
- export function FormPagination<FieldValue extends number | null | undefined = number | null | undefined>({
18
+ export function FormPagination<FieldValue extends number | null | undefined = number | null | undefined, AsComponent extends As = "nav">({
14
19
  field,
15
20
  ...rest
16
- }: FormPaginationProps<FieldValue>): ReactNode {
17
- return <Pagination page={field.state.value ?? 1} onPageChange={field.handleChange as (value: number) => void} {...getFieldProps(field, true)} {...rest} />
21
+ }: FormPaginationProps<FieldValue, AsComponent>): ReactNode {
22
+ return (
23
+ <Pagination<AsComponent>
24
+ page={field.state.value ?? 1}
25
+ onPageChange={field.handleChange as (value: number) => void as any}
26
+ {...getFieldProps(field, true)}
27
+ {...rest}
28
+ />
29
+ )
18
30
  }
@@ -1,18 +1,30 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode } from "react"
4
- import { RadioGroup } from "@heroui/react"
5
- import { FieldComponentProps } from "soda-tanstack-form"
6
- import { StrictOmit } from "soda-type"
3
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
4
+ import { As, MergeWithAs, RadioGroup, RadioGroupProps } from "@heroui/react"
5
+ import { Field } from "soda-tanstack-form"
7
6
 
8
7
  import { getFieldProps } from "../utils/getFieldProps"
9
8
 
10
- export interface FormRadioGroupProps<FieldValue extends string | null | undefined = string | null | undefined>
11
- extends StrictOmit<FieldComponentProps<typeof RadioGroup, FieldValue>, never> {}
9
+ export type FormRadioGroupProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "div"> = MergeWithAs<
10
+ ComponentPropsWithoutRef<"div">,
11
+ ComponentPropsWithoutRef<AsComponent>,
12
+ RadioGroupProps,
13
+ AsComponent
14
+ > & {
15
+ field: Field<FieldValue>
16
+ }
12
17
 
13
- export function FormRadioGroup<FieldValue extends string | null | undefined = string | null | undefined>({
18
+ export function FormRadioGroup<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "div">({
14
19
  field,
15
20
  ...rest
16
- }: FormRadioGroupProps<FieldValue>): ReactNode {
17
- return <RadioGroup value={field.state.value ?? ""} onValueChange={field.handleChange as (value: string) => void} {...getFieldProps(field)} {...rest} />
21
+ }: FormRadioGroupProps<FieldValue, AsComponent>): ReactNode {
22
+ return (
23
+ <RadioGroup<AsComponent>
24
+ value={field.state.value ?? ""}
25
+ onValueChange={field.handleChange as (value: string) => void}
26
+ {...getFieldProps(field)}
27
+ {...rest}
28
+ />
29
+ )
18
30
  }
@@ -1,21 +1,26 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode } from "react"
4
- import { Switch } from "@heroui/react"
5
- import { FieldComponentProps } from "soda-tanstack-form"
6
- import { StrictOmit } from "soda-type"
3
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
4
+ import { As, MergeWithAs, Switch, SwitchProps } from "@heroui/react"
5
+ import { Field } from "soda-tanstack-form"
7
6
 
8
7
  import { getFieldProps } from "../utils/getFieldProps"
9
8
 
10
- export interface FormSwitchProps<FieldValue extends boolean | null | undefined = boolean | null | undefined>
11
- extends StrictOmit<FieldComponentProps<typeof Switch, FieldValue>, never> {}
9
+ export type FormSwitchProps<FieldValue extends boolean | null | undefined = boolean | null | undefined, AsComponent extends As = "input"> = MergeWithAs<
10
+ ComponentPropsWithoutRef<"input">,
11
+ ComponentPropsWithoutRef<AsComponent>,
12
+ SwitchProps,
13
+ AsComponent
14
+ > & {
15
+ field: Field<FieldValue>
16
+ }
12
17
 
13
- export function FormSwitch<FieldValue extends boolean | null | undefined = boolean | null | undefined>({
18
+ export function FormSwitch<FieldValue extends boolean | null | undefined = boolean | null | undefined, AsComponent extends As = "input">({
14
19
  field,
15
20
  ...rest
16
- }: FormSwitchProps<FieldValue>): ReactNode {
21
+ }: FormSwitchProps<FieldValue, AsComponent>): ReactNode {
17
22
  return (
18
- <Switch
23
+ <Switch<AsComponent>
19
24
  isSelected={field.state.value ?? false}
20
25
  onValueChange={field.handleChange as (value: boolean) => void}
21
26
  {...getFieldProps(field, true)}
@@ -1,18 +1,30 @@
1
1
  "use client"
2
2
 
3
- import { ReactNode } from "react"
4
- import { Textarea } from "@heroui/react"
5
- import { FieldComponentProps } from "soda-tanstack-form"
6
- import { StrictOmit } from "soda-type"
3
+ import { ComponentPropsWithoutRef, ReactNode } from "react"
4
+ import { As, MergeWithAs, TextAreaProps, Textarea } from "@heroui/react"
5
+ import { Field } from "soda-tanstack-form"
7
6
 
8
7
  import { getFieldProps } from "../utils/getFieldProps"
9
8
 
10
- export interface FormTextareaProps<FieldValue extends string | null | undefined = string | null | undefined>
11
- extends StrictOmit<FieldComponentProps<typeof Textarea, FieldValue>, never> {}
9
+ export type FormTextareaProps<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "textarea"> = MergeWithAs<
10
+ ComponentPropsWithoutRef<"input">,
11
+ ComponentPropsWithoutRef<AsComponent>,
12
+ TextAreaProps,
13
+ AsComponent
14
+ > & {
15
+ field: Field<FieldValue>
16
+ }
12
17
 
13
- export function FormTextarea<FieldValue extends string | null | undefined = string | null | undefined>({
18
+ export function FormTextarea<FieldValue extends string | null | undefined = string | null | undefined, AsComponent extends As = "textarea">({
14
19
  field,
15
20
  ...rest
16
- }: FormTextareaProps<FieldValue>): ReactNode {
17
- return <Textarea value={field.state.value ?? ""} onValueChange={field.handleChange as (value: string) => void} {...getFieldProps(field)} {...rest} />
21
+ }: FormTextareaProps<FieldValue, AsComponent>): ReactNode {
22
+ return (
23
+ <Textarea<AsComponent>
24
+ value={field.state.value ?? ""}
25
+ onValueChange={field.handleChange as (value: string) => void}
26
+ {...getFieldProps(field)}
27
+ {...rest}
28
+ />
29
+ )
18
30
  }