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 Sep 7, 2023
1 parent dc951ff commit 7008df0
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="you@example.com" 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

0 comments on commit 7008df0

Please sign in to comment.