mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-03-11 17:48:44 -05:00
feat(frontend): add disabled prop to FormField component
When disabled is true, the component now automatically adds the 'disabled' CSS class and sets the native disabled attribute on the input element.
This commit is contained in:
@@ -6,6 +6,7 @@ interface Props {
|
||||
label?: string
|
||||
error?: string | null
|
||||
id?: string
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
const props = defineProps<Props>()
|
||||
@@ -33,6 +34,11 @@ const controlClasses = computed(() => [
|
||||
{'is-expanded': hasAddon.value},
|
||||
])
|
||||
|
||||
const inputClasses = computed(() => [
|
||||
'input',
|
||||
{'disabled': props.disabled},
|
||||
])
|
||||
|
||||
// Only bind value when modelValue is explicitly provided (not undefined)
|
||||
// This allows the component to be used without v-model for native input behavior
|
||||
const inputBindings = computed(() => {
|
||||
@@ -68,7 +74,8 @@ defineExpose({
|
||||
:id="inputId"
|
||||
ref="inputRef"
|
||||
v-bind="{ ...$attrs, ...inputBindings }"
|
||||
class="input"
|
||||
:class="inputClasses"
|
||||
:disabled="disabled || undefined"
|
||||
@input="$emit('update:modelValue', ($event.target as HTMLInputElement).value)"
|
||||
>
|
||||
</slot>
|
||||
|
||||
Reference in New Issue
Block a user