Skip to content

Commit

Permalink
fix(FormGroup): size were invalid since default has been removed
Browse files Browse the repository at this point in the history
Bug introduced in c59595f
  • Loading branch information
benjamincanac committed Aug 3, 2023
1 parent 9e5b8cc commit 83c42cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/content/3.forms/9.form-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ code: >-
:u-input{placeholder="[email protected]" icon="i-heroicons-envelope"}
::

::callout{icon="i-heroicons-exclamation-triangle"}
This will only work with form elements that support the `size` prop.
::

## Props

:component-props
Expand Down
8 changes: 5 additions & 3 deletions src/runtime/components/forms/FormGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,18 @@ export default defineComponent({
return cloneVNode(node, vProps)
}))

const size = computed(() => ui.value.size[props.size ?? appConfig.ui.input.default.size])

return () => h('div', { class: [ui.value.wrapper] }, [
props.label && h('div', { class: [ui.value.label.wrapper, ui.value.size[props.size]] }, [
props.label && h('div', { class: [ui.value.label.wrapper, size.value] }, [
h('label', { for: props.name, class: [ui.value.label.base, props.required && ui.value.label.required] }, props.label),
props.hint && h('span', { class: [ui.value.hint] }, props.hint)
]),
props.description && h('p', { class: [ui.value.description, ui.value.size[props.size]
props.description && h('p', { class: [ui.value.description, size.value
] }, props.description),
h('div', { class: [!!props.label && ui.value.container] }, [
...clones.value,
errorMessage.value ? h('p', { class: [ui.value.error, ui.value.size[props.size]] }, errorMessage.value) : props.help ? h('p', { class: [ui.value.help, ui.value.size[props.size]] }, props.help) : null
errorMessage.value ? h('p', { class: [ui.value.error, size.value] }, errorMessage.value) : props.help ? h('p', { class: [ui.value.help, size.value] }, props.help) : null
])
])
}
Expand Down

1 comment on commit 83c42cd

@vercel
Copy link

@vercel vercel bot commented on 83c42cd Aug 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ui – ./

ui-nuxtlabs.vercel.app
ui-git-dev-nuxtlabs.vercel.app
ui.nuxtlabs.com

Please sign in to comment.