fix(FormField): missing conditions to apply container classes (#2631)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Guillaume Chau
2024-11-13 15:57:35 +01:00
committed by GitHub
parent 3396d5cebe
commit 9241ba1230
3 changed files with 5 additions and 5 deletions

View File

@@ -96,7 +96,7 @@ provide(formFieldInjectionKey, computed(() => ({
</p>
</div>
<div :class="[label && ui.container({ class: props.ui?.container })]">
<div :class="[(label || !!slots.label || description || !!slots.description) && ui.container({ class: props.ui?.container })]">
<slot :error="error" />
<p v-if="(typeof error === 'string' && error) || !!slots.error" :class="ui.error({ class: props.ui?.error })">

View File

@@ -30,7 +30,7 @@ exports[`FormField > renders with description slot correctly 1`] = `
<!--v-if-->
<p class="text-[var(--ui-text-muted)]">Description slot</p>
</div>
<div class="">
<div class="mt-1 relative">
<!--v-if-->
</div>
</div>"
@@ -130,7 +130,7 @@ exports[`FormField > renders with label slot correctly 1`] = `
</div>
<!--v-if-->
</div>
<div class="">
<div class="mt-1 relative">
<!--v-if-->
</div>
</div>"

View File

@@ -30,7 +30,7 @@ exports[`FormField > renders with description slot correctly 1`] = `
<!--v-if-->
<p class="text-[var(--ui-text-muted)]">Description slot</p>
</div>
<div class="">
<div class="mt-1 relative">
<!--v-if-->
</div>
</div>"
@@ -130,7 +130,7 @@ exports[`FormField > renders with label slot correctly 1`] = `
</div>
<!--v-if-->
</div>
<div class="">
<div class="mt-1 relative">
<!--v-if-->
</div>
</div>"