mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-17 05:28:09 +01:00
feat(FormGroup): add size prop and theme options (#391)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -15,6 +15,13 @@ export default defineComponent({
|
||||
type: String,
|
||||
default: null
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: () => appConfig.ui.input.default.size,
|
||||
validator (value: string) {
|
||||
return Object.keys(appConfig.ui.formGroup.size).includes(value)
|
||||
}
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
default: null
|
||||
@@ -66,18 +73,23 @@ export default defineComponent({
|
||||
vProps.name = props.name
|
||||
}
|
||||
|
||||
if (props.size) {
|
||||
vProps.size = props.size
|
||||
}
|
||||
|
||||
return cloneVNode(node, vProps)
|
||||
}))
|
||||
|
||||
return () => h('div', { class: [ui.value.wrapper] }, [
|
||||
props.label && h('div', { class: [ui.value.label.wrapper] }, [
|
||||
props.label && h('div', { class: [ui.value.label.wrapper, ui.value.size[props.size]] }, [
|
||||
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] }, props.description),
|
||||
props.description && h('p', { class: [ui.value.description, ui.value.size[props.size]
|
||||
] }, props.description),
|
||||
h('div', { class: [!!props.label && ui.value.container] }, [
|
||||
...clones.value,
|
||||
props.error && typeof props.error === 'string' ? h('p', { class: [ui.value.error] }, props.error) : props.help ? h('p', { class: [ui.value.help] }, props.help) : null
|
||||
props.error && typeof props.error === 'string' ? h('p', { class: [ui.value.error, ui.value.size[props.size]] }, props.error) : props.help ? h('p', { class: [ui.value.help, ui.value.size[props.size]] }, props.help) : null
|
||||
])
|
||||
])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user