UNPKG

bootstrap-vue-next

Version:

Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development

1 lines 2.58 kB
{"version":3,"file":"BFormSelectOption-O8cyyv3i.mjs","names":["$attrs"],"sources":["../src/components/BFormSelect/BFormSelectOption.vue","../src/components/BFormSelect/BFormSelectOption.vue"],"sourcesContent":["<template>\n <option :value=\"props.value\" :disabled=\"props.disabled\" :selected=\"isSelected\" v-bind=\"$attrs\">\n <slot />\n </option>\n</template>\n\n<script setup lang=\"ts\" generic=\"T\">\nimport type {BFormSelectOptionSlots} from '../../types'\nimport {computed, inject} from 'vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {BFormSelectOptionProps} from '../../types/ComponentProps'\nimport {formSelectKey} from '../../utils/keys'\n\nconst _props = withDefaults(defineProps<BFormSelectOptionProps<T>>(), {\n disabled: false,\n value: undefined,\n})\nconst props = useDefaults<BFormSelectOptionProps<T>>(_props, 'BFormSelectOption')\ndefineSlots<BFormSelectOptionSlots>()\n\n// Inject the form select context to determine if this option is selected\nconst formSelectContext = inject(formSelectKey, null)\n\nconst isSelected = computed(() => {\n if (!formSelectContext) return false\n return formSelectContext.modelValue.value === props.value\n})\n</script>\n","<template>\n <option :value=\"props.value\" :disabled=\"props.disabled\" :selected=\"isSelected\" v-bind=\"$attrs\">\n <slot />\n </option>\n</template>\n\n<script setup lang=\"ts\" generic=\"T\">\nimport type {BFormSelectOptionSlots} from '../../types'\nimport {computed, inject} from 'vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {BFormSelectOptionProps} from '../../types/ComponentProps'\nimport {formSelectKey} from '../../utils/keys'\n\nconst _props = withDefaults(defineProps<BFormSelectOptionProps<T>>(), {\n disabled: false,\n value: undefined,\n})\nconst props = useDefaults<BFormSelectOptionProps<T>>(_props, 'BFormSelectOption')\ndefineSlots<BFormSelectOptionSlots>()\n\n// Inject the form select context to determine if this option is selected\nconst formSelectContext = inject(formSelectKey, null)\n\nconst isSelected = computed(() => {\n if (!formSelectContext) return false\n return formSelectContext.modelValue.value === props.value\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAiBA,MAAM,QAAQ,YAJC,SAI8C,oBAAmB;EAIhF,MAAM,oBAAoB,OAAO,eAAe,KAAI;EAEpD,MAAM,aAAa,eAAe;AAChC,OAAI,CAAC,kBAAmB,QAAO;AAC/B,UAAO,kBAAkB,WAAW,UAAU,MAAM;IACrD;;uBAzBC,mBAES,UAFT,WAES;IAFA,OAAO,MAAA,MAAK,CAAC;IAAQ,UAAU,MAAA,MAAK,CAAC;IAAW,UAAU,WAAA;MAAoBA,KAAAA,OAAM,EAAA,CAC3F,WAAQ,KAAA,QAAA,UAAA,CAAA,EAAA,IAAA,WAAA"}