81 lines
2.1 KiB
Vue
81 lines
2.1 KiB
Vue
<script setup lang="ts">
|
|
import type { FormErrors } from '~/types/error'
|
|
import Select from '~/components/pub/my-ui/form/select.vue'
|
|
import { cn } from '~/lib/utils'
|
|
|
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
|
|
|
const props = defineProps<{
|
|
fieldName?: string
|
|
label?: string
|
|
isDisabled?: boolean
|
|
isRequired?: boolean
|
|
placeholder?: string
|
|
errors?: FormErrors
|
|
class?: string
|
|
selectClass?: string
|
|
fieldGroupClass?: string
|
|
}>()
|
|
|
|
const {
|
|
fieldName = 'disabilityType',
|
|
placeholder = 'Pilih jenis disabilitas',
|
|
errors,
|
|
class: containerClass,
|
|
selectClass,
|
|
fieldGroupClass,
|
|
} = props
|
|
|
|
const disabilityOptions = [
|
|
{ label: 'Tuna Daksa', value: 'daksa' },
|
|
{ label: 'Tuna Netra', value: 'netra' },
|
|
{ label: 'Tuna Rungu', value: 'rungu' },
|
|
{ label: 'Tuna Wicara', value: 'wicara' },
|
|
{ label: 'Tuna Rungu-Wicara', value: 'rungu_wicara' },
|
|
{ label: 'Tuna Grahita', value: 'grahita' },
|
|
{ label: 'Tuna Laras', value: 'laras' },
|
|
{ label: 'Lainnya', value: 'other', priority: -100 },
|
|
]
|
|
</script>
|
|
|
|
<template>
|
|
<DE.Cell :class="cn('select-field-group', fieldGroupClass, containerClass)">
|
|
<DE.Label
|
|
label-for="fieldName"
|
|
:is-required="isRequired"
|
|
>
|
|
{{ label }}
|
|
</DE.Label>
|
|
<DE.Field
|
|
:id="fieldName"
|
|
:errors="errors"
|
|
:class="cn('select-field-wrapper')"
|
|
>
|
|
<FormField
|
|
v-slot="{ componentField }"
|
|
:name="fieldName"
|
|
>
|
|
<FormItem>
|
|
<FormControl>
|
|
<Select
|
|
:id="fieldName"
|
|
:is-disabled="isDisabled"
|
|
v-bind="componentField"
|
|
:items="disabilityOptions"
|
|
:placeholder="placeholder"
|
|
:preserve-order="false"
|
|
:class="
|
|
cn(
|
|
'text-sm transition-all duration-200 focus:outline-none focus:ring-1 focus:ring-black focus:ring-offset-0',
|
|
selectClass,
|
|
)
|
|
"
|
|
/>
|
|
</FormControl>
|
|
<FormMessage />
|
|
</FormItem>
|
|
</FormField>
|
|
</DE.Field>
|
|
</DE.Cell>
|
|
</template>
|