chore(Form): catch-up with v2 changes (#2165)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Romain Hamel
2024-09-10 14:09:42 +02:00
committed by GitHub
parent 9ddfec123e
commit 175229384f
8 changed files with 33 additions and 21 deletions

View File

@@ -38,7 +38,7 @@ export interface FormFieldSlots {
<script setup lang="ts">
import { computed, ref, inject, provide, type Ref, useId } from 'vue'
import { Label } from 'radix-vue'
import { formFieldInjectionKey } from '../composables/useFormField'
import { formFieldInjectionKey, inputIdInjectionKey } from '../composables/useFormField'
import type { FormError, FormFieldInjectedOptions } from '../types/form'
const props = defineProps<FormFieldProps>()
@@ -55,8 +55,9 @@ const error = computed(() => props.error || formErrors?.value?.find(error => err
const id = ref(useId())
provide(inputIdInjectionKey, id)
provide(formFieldInjectionKey, computed(() => ({
id: id.value,
error: error.value,
name: props.name,
size: props.size,