0.2.2 #31
@@ -1,6 +1,6 @@
|
|||||||
import { Callout, Flex, Spinner, Switch, TextField } from "@radix-ui/themes"
|
import { Callout, Flex, Spinner, Switch, TextField } from "@radix-ui/themes"
|
||||||
import { Array, Option, Struct } from "effect"
|
import { Array, Option, Struct } from "effect"
|
||||||
import { Component, Form, Hooks } from "effect-fc"
|
import { Component, Form, Subscribable } from "effect-fc"
|
||||||
|
|
||||||
|
|
||||||
interface Props
|
interface Props
|
||||||
@@ -18,8 +18,7 @@ extends Omit<TextField.RootProps, "optional" | "defaultValue">, Form.useOptional
|
|||||||
export type TextFieldFormInputProps = Props | OptionalProps
|
export type TextFieldFormInputProps = Props | OptionalProps
|
||||||
|
|
||||||
|
|
||||||
export class TextFieldFormInput extends Component.makeUntraced("TextFieldFormInput")(
|
export class TextFieldFormInput extends Component.makeUntraced("TextFieldFormInput")(function*(props: TextFieldFormInputProps) {
|
||||||
function*(props: TextFieldFormInputProps) {
|
|
||||||
const input: (
|
const input: (
|
||||||
| { readonly optional: true } & Form.useOptionalInput.Result<string>
|
| { readonly optional: true } & Form.useOptionalInput.Result<string>
|
||||||
| { readonly optional: false } & Form.useInput.Result<string>
|
| { readonly optional: false } & Form.useInput.Result<string>
|
||||||
@@ -29,7 +28,7 @@ export class TextFieldFormInput extends Component.makeUntraced("TextFieldFormInp
|
|||||||
// biome-ignore lint/correctness/useHookAtTopLevel: "optional" reactivity not supported
|
// biome-ignore lint/correctness/useHookAtTopLevel: "optional" reactivity not supported
|
||||||
: { optional: false, ...yield* Form.useInput(props.field, props) }
|
: { optional: false, ...yield* Form.useInput(props.field, props) }
|
||||||
|
|
||||||
const [issues, isValidating, isSubmitting] = yield* Hooks.useSubscribables(
|
const [issues, isValidating, isSubmitting] = yield* Subscribable.useSubscribables(
|
||||||
props.field.issuesSubscribable,
|
props.field.issuesSubscribable,
|
||||||
props.field.isValidatingSubscribable,
|
props.field.isValidatingSubscribable,
|
||||||
props.field.isSubmittingSubscribable,
|
props.field.isSubmittingSubscribable,
|
||||||
@@ -73,5 +72,4 @@ export class TextFieldFormInput extends Component.makeUntraced("TextFieldFormInp
|
|||||||
})}
|
})}
|
||||||
</Flex>
|
</Flex>
|
||||||
)
|
)
|
||||||
}
|
}) {}
|
||||||
) {}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user