bootstrap-vue-next 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -101,8 +101,8 @@ var BFormSelectBase_default = /* @__PURE__ */ defineComponent({
101
101
  }, {
102
102
  "modelValue": {
103
103
  type: [
104
- Boolean,
105
104
  String,
105
+ Boolean,
106
106
  Array,
107
107
  Object,
108
108
  Number,
@@ -306,4 +306,4 @@ var BFormSelect_default = /* @__PURE__ */ defineComponent({
306
306
  //#endregion
307
307
  export { BFormSelectOptionGroup_default as n, BFormSelect_default as t };
308
308
 
309
- //# sourceMappingURL=BFormSelect-DdjH8482.js.map
309
+ //# sourceMappingURL=BFormSelect-QXCaxgWx.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BFormSelect-DdjH8482.js","names":["$attrs"],"sources":["../src/components/BFormSelect/BFormSelectOptionGroup.vue","../src/components/BFormSelect/BFormSelectOptionGroup.vue","../src/components/BFormSelect/BFormSelectBase.vue","../src/components/BFormSelect/BFormSelectBase.vue","../src/components/BFormSelect/BFormSelect.vue","../src/components/BFormSelect/BFormSelect.vue"],"sourcesContent":["<template>\n <optgroup :label=\"props.label\">\n <slot name=\"first\" />\n <BFormSelectOption\n v-for=\"(option, index) in normalizedOptions\"\n :key=\"index\"\n v-bind=\"{...$attrs, ...option}\"\n >\n <slot name=\"option\" v-bind=\"option\">\n {{ option.text }}\n </slot>\n </BFormSelectOption>\n <slot />\n </optgroup>\n</template>\n\n<script setup lang=\"ts\" generic=\"T\">\nimport BFormSelectOption from './BFormSelectOption.vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ComputedRef} from 'vue'\nimport {useFormSelect} from '../../composables/useFormSelect'\nimport type {\n BFormSelectOptionGroupProps,\n BFormSelectOptionGroupSlots,\n SelectOption,\n} from '../../types'\n\nconst _props = withDefaults(defineProps<BFormSelectOptionGroupProps>(), {\n disabledField: 'disabled',\n label: undefined,\n options: () => [],\n textField: 'text',\n valueField: 'value',\n})\nconst props = useDefaults(_props, 'BFormSelectOptionGroup')\ndefineSlots<BFormSelectOptionGroupSlots<T>>()\n\n// The form select context is injected by BFormSelectOption components automatically\n// We don't need to handle the selected value here since each BFormSelectOption\n// will inject the context directly\n\n// Type assertion is needed because useFormSelect is not generic-aware.\n// This is acceptable in the wrapper/base pattern where the wrapper (BFormSelect)\n// handles type-safe normalization before passing to base components.\nconst {normalizedOptions} = useFormSelect(() => props.options, props) as {\n normalizedOptions: ComputedRef<SelectOption<T>[]>\n}\n</script>\n","<template>\n <optgroup :label=\"props.label\">\n <slot name=\"first\" />\n <BFormSelectOption\n v-for=\"(option, index) in normalizedOptions\"\n :key=\"index\"\n v-bind=\"{...$attrs, ...option}\"\n >\n <slot name=\"option\" v-bind=\"option\">\n {{ option.text }}\n </slot>\n </BFormSelectOption>\n <slot />\n </optgroup>\n</template>\n\n<script setup lang=\"ts\" generic=\"T\">\nimport BFormSelectOption from './BFormSelectOption.vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ComputedRef} from 'vue'\nimport {useFormSelect} from '../../composables/useFormSelect'\nimport type {\n BFormSelectOptionGroupProps,\n BFormSelectOptionGroupSlots,\n SelectOption,\n} from '../../types'\n\nconst _props = withDefaults(defineProps<BFormSelectOptionGroupProps>(), {\n disabledField: 'disabled',\n label: undefined,\n options: () => [],\n textField: 'text',\n valueField: 'value',\n})\nconst props = useDefaults(_props, 'BFormSelectOptionGroup')\ndefineSlots<BFormSelectOptionGroupSlots<T>>()\n\n// The form select context is injected by BFormSelectOption components automatically\n// We don't need to handle the selected value here since each BFormSelectOption\n// will inject the context directly\n\n// Type assertion is needed because useFormSelect is not generic-aware.\n// This is acceptable in the wrapper/base pattern where the wrapper (BFormSelect)\n// handles type-safe normalization before passing to base components.\nconst {normalizedOptions} = useFormSelect(() => props.options, props) as {\n normalizedOptions: ComputedRef<SelectOption<T>[]>\n}\n</script>\n","<template>\n <select\n :id=\"computedId\"\n ref=\"_input\"\n v-model=\"localValue\"\n :class=\"computedClasses\"\n :name=\"props.name\"\n :form=\"props.form || undefined\"\n :multiple=\"props.multiple || undefined\"\n :size=\"computedSelectSize\"\n :disabled=\"isDisabled\"\n :required=\"props.required || undefined\"\n :aria-required=\"props.required || undefined\"\n :aria-invalid=\"computedAriaInvalid\"\n >\n <slot name=\"first\" />\n <template v-for=\"(option, index) in normalizedOptsWrapper\" :key=\"index\">\n <BFormSelectOptionGroup\n v-if=\"isComplex(option)\"\n :label=\"option.label\"\n :options=\"option.options\"\n :value-field=\"props.valueField\"\n :text-field=\"props.textField\"\n :disabled-field=\"props.disabledField\"\n />\n <BFormSelectOption v-else v-bind=\"option\">\n <slot name=\"option\" v-bind=\"option\">\n {{ option.text }}\n </slot>\n </BFormSelectOption>\n </template>\n <slot />\n </select>\n</template>\n\n<script setup lang=\"ts\">\nimport type {BFormSelectBaseProps} from '../../types'\nimport {computed, inject, provide, readonly, useTemplateRef} from 'vue'\nimport BFormSelectOption from './BFormSelectOption.vue'\nimport BFormSelectOptionGroup from './BFormSelectOptionGroup.vue'\nimport {useAriaInvalid} from '../../composables/useAriaInvalid'\nimport {useFocus, useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport {useStateClass} from '../../composables/useStateClass'\nimport {useFormSelect} from '../../composables/useFormSelect'\nimport {formGroupKey, formSelectKey} from '../../utils/keys'\n\n/**\n * Base component for BFormSelect - non-generic implementation using useDefaults.\n * Renders a select element with normalized options and option groups.\n * Supports both simple options and complex grouped options.\n */\nconst _props = withDefaults(defineProps<Omit<BFormSelectBaseProps, 'modelValue'>>(), {\n ariaInvalid: undefined,\n autofocus: false,\n disabled: false,\n disabledField: 'disabled',\n form: undefined,\n id: undefined,\n labelField: 'label',\n multiple: false,\n name: undefined,\n options: () => [],\n optionsField: 'options',\n plain: false,\n required: false,\n selectSize: 0,\n size: undefined,\n state: null,\n textField: 'text',\n valueField: 'value',\n})\nconst props = useDefaults(_props, 'BFormSelect')\n\nconst modelValue = defineModel<BFormSelectBaseProps['modelValue']>({\n default: '',\n})\n\nconst computedId = useId(() => props.id, 'input')\n\nconst formGroupData = inject(formGroupKey, null)?.()\nformGroupData?.track(computedId)\nconst isDisabled = computed(() => props.disabled || (formGroupData?.disabled.value ?? false))\n\nconst selectSizeNumber = useToNumber(() => props.selectSize)\n\nconst stateClass = useStateClass(() => props.state)\n\nconst input = useTemplateRef('_input')\n\nconst {focused} = useFocus(input, {\n initialValue: props.autofocus,\n})\n\nconst computedClasses = computed(() => [\n stateClass.value,\n {\n 'form-control': props.plain,\n [`form-control-${props.size}`]: props.size !== undefined && props.plain,\n 'form-select': !props.plain,\n [`form-select-${props.size}`]: props.size !== undefined && !props.plain,\n },\n])\n\nconst computedSelectSize = computed(() =>\n !props.plain && selectSizeNumber.value > 0 ? selectSizeNumber.value : undefined\n)\n\nconst computedAriaInvalid = useAriaInvalid(\n () => props.ariaInvalid,\n () => props.state\n)\n\nconst {normalizedOptions, isComplex} = useFormSelect(() => props.options, props)\n\nconst normalizedOptsWrapper = computed(() => normalizedOptions.value)\n\nconst localValue = computed({\n get: () => modelValue.value,\n set: (newValue) => {\n modelValue.value = newValue\n },\n})\n\n// Provide the current model value for child components to inject\nprovide(formSelectKey, {\n modelValue: readonly(localValue),\n})\n\ndefineExpose({\n blur: () => {\n focused.value = false\n },\n element: input,\n focus: () => {\n focused.value = true\n },\n})\n</script>\n","<template>\n <select\n :id=\"computedId\"\n ref=\"_input\"\n v-model=\"localValue\"\n :class=\"computedClasses\"\n :name=\"props.name\"\n :form=\"props.form || undefined\"\n :multiple=\"props.multiple || undefined\"\n :size=\"computedSelectSize\"\n :disabled=\"isDisabled\"\n :required=\"props.required || undefined\"\n :aria-required=\"props.required || undefined\"\n :aria-invalid=\"computedAriaInvalid\"\n >\n <slot name=\"first\" />\n <template v-for=\"(option, index) in normalizedOptsWrapper\" :key=\"index\">\n <BFormSelectOptionGroup\n v-if=\"isComplex(option)\"\n :label=\"option.label\"\n :options=\"option.options\"\n :value-field=\"props.valueField\"\n :text-field=\"props.textField\"\n :disabled-field=\"props.disabledField\"\n />\n <BFormSelectOption v-else v-bind=\"option\">\n <slot name=\"option\" v-bind=\"option\">\n {{ option.text }}\n </slot>\n </BFormSelectOption>\n </template>\n <slot />\n </select>\n</template>\n\n<script setup lang=\"ts\">\nimport type {BFormSelectBaseProps} from '../../types'\nimport {computed, inject, provide, readonly, useTemplateRef} from 'vue'\nimport BFormSelectOption from './BFormSelectOption.vue'\nimport BFormSelectOptionGroup from './BFormSelectOptionGroup.vue'\nimport {useAriaInvalid} from '../../composables/useAriaInvalid'\nimport {useFocus, useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport {useStateClass} from '../../composables/useStateClass'\nimport {useFormSelect} from '../../composables/useFormSelect'\nimport {formGroupKey, formSelectKey} from '../../utils/keys'\n\n/**\n * Base component for BFormSelect - non-generic implementation using useDefaults.\n * Renders a select element with normalized options and option groups.\n * Supports both simple options and complex grouped options.\n */\nconst _props = withDefaults(defineProps<Omit<BFormSelectBaseProps, 'modelValue'>>(), {\n ariaInvalid: undefined,\n autofocus: false,\n disabled: false,\n disabledField: 'disabled',\n form: undefined,\n id: undefined,\n labelField: 'label',\n multiple: false,\n name: undefined,\n options: () => [],\n optionsField: 'options',\n plain: false,\n required: false,\n selectSize: 0,\n size: undefined,\n state: null,\n textField: 'text',\n valueField: 'value',\n})\nconst props = useDefaults(_props, 'BFormSelect')\n\nconst modelValue = defineModel<BFormSelectBaseProps['modelValue']>({\n default: '',\n})\n\nconst computedId = useId(() => props.id, 'input')\n\nconst formGroupData = inject(formGroupKey, null)?.()\nformGroupData?.track(computedId)\nconst isDisabled = computed(() => props.disabled || (formGroupData?.disabled.value ?? false))\n\nconst selectSizeNumber = useToNumber(() => props.selectSize)\n\nconst stateClass = useStateClass(() => props.state)\n\nconst input = useTemplateRef('_input')\n\nconst {focused} = useFocus(input, {\n initialValue: props.autofocus,\n})\n\nconst computedClasses = computed(() => [\n stateClass.value,\n {\n 'form-control': props.plain,\n [`form-control-${props.size}`]: props.size !== undefined && props.plain,\n 'form-select': !props.plain,\n [`form-select-${props.size}`]: props.size !== undefined && !props.plain,\n },\n])\n\nconst computedSelectSize = computed(() =>\n !props.plain && selectSizeNumber.value > 0 ? selectSizeNumber.value : undefined\n)\n\nconst computedAriaInvalid = useAriaInvalid(\n () => props.ariaInvalid,\n () => props.state\n)\n\nconst {normalizedOptions, isComplex} = useFormSelect(() => props.options, props)\n\nconst normalizedOptsWrapper = computed(() => normalizedOptions.value)\n\nconst localValue = computed({\n get: () => modelValue.value,\n set: (newValue) => {\n modelValue.value = newValue\n },\n})\n\n// Provide the current model value for child components to inject\nprovide(formSelectKey, {\n modelValue: readonly(localValue),\n})\n\ndefineExpose({\n blur: () => {\n focused.value = false\n },\n element: input,\n focus: () => {\n focused.value = true\n },\n})\n</script>\n","<template>\n <BFormSelectBase\n v-bind=\"forwardedProps\"\n v-model=\"modelValue as any\"\n :options=\"normalizedOptions as any\"\n >\n <!-- Forward all slots -->\n <template #first>\n <slot name=\"first\" />\n </template>\n\n <template #option=\"slotProps\">\n <slot name=\"option\" v-bind=\"slotProps as any\" />\n </template>\n\n <slot />\n </BFormSelectBase>\n</template>\n\n<script\n setup\n lang=\"ts\"\n generic=\"\n Options extends readonly (object | string | number | boolean)[] = readonly (\n | object\n | string\n | number\n | boolean\n )[]\n \"\n>\nimport {computed} from 'vue'\nimport BFormSelectBase from './BFormSelectBase.vue'\nimport type {\n BFormSelectProps,\n BFormSelectSlots,\n ComplexSelectOptionRaw,\n OptionsValues,\n SelectOption,\n} from '../../types'\n\n/**\n * Type-safe wrapper component for BFormSelect.\n * Provides generic type safety for options array and strongly-typed modelValue.\n * Uses Options array generic to extract union of all possible values.\n * Normalizes typed options and forwards to BFormSelectBase for rendering.\n * Supports both complex objects and simple scalar types (string, number).\n *\n * For strongly-typed modelValue:\n * - Primitive arrays: modelValue is union of those values (or array if multiple)\n * - Object arrays with 'value' field: modelValue is union of value field types\n * - Use 'as const' on options for literal type inference\n */\nconst props = withDefaults(defineProps<Omit<BFormSelectProps<Options>, 'modelValue'>>(), {\n ariaInvalid: undefined,\n autofocus: false,\n disabled: false,\n disabledField: 'disabled',\n form: undefined,\n id: undefined,\n labelField: 'label',\n multiple: false,\n name: undefined,\n options: () => [] as unknown as Options,\n optionsField: 'options',\n plain: false,\n required: false,\n selectSize: 0,\n size: undefined,\n state: null,\n textField: 'text',\n valueField: 'value',\n})\ndefineSlots<BFormSelectSlots<OptionsValues<Options>>>()\n\n// Type-safe model value - single value or array depending on multiple prop.\n// NOTE: OptionsValues assumes a static \"value\" key; custom valueField is not\n// reflected in the type — modelValue falls back to unknown in that case.\nconst modelValue = defineModel<OptionsValues<Options> | OptionsValues<Options>[] | null>({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n default: '' as any,\n})\n\n// Normalize a single simple option using custom field names\nconst normalizeSimpleOption = (el: object): SelectOption =>\n ({\n ...(el as Record<string, unknown>),\n value: (el as Record<string, unknown>)[props.valueField as string],\n text: ((el as Record<string, unknown>)[props.textField as string] as string | undefined) ?? '',\n disabled:\n ((el as Record<string, unknown>)[props.disabledField as string] as boolean | undefined) ??\n false,\n }) as SelectOption\n\nconst normalizePrimitive = (el: string | number | boolean): SelectOption =>\n ({value: el, text: String(el), disabled: false}) as SelectOption\n\n// Type-safe normalization of options (supports both simple and complex/grouped)\nconst normalizedOptions = computed(() => {\n const optionsArray = props.options ?? []\n const hasComplexOptions = optionsArray.some(\n (el) =>\n typeof el !== 'string' &&\n typeof el !== 'number' &&\n typeof el !== 'boolean' &&\n (el as Record<string, unknown>)[props.optionsField as string] !== undefined\n )\n\n if (hasComplexOptions) {\n return optionsArray.map((el) => {\n if (typeof el === 'string' || typeof el === 'number' || typeof el === 'boolean') {\n return normalizePrimitive(el)\n }\n\n // Check if this is a complex (grouped) option\n const optionsField = (el as Record<string, unknown>)[props.optionsField as string]\n if (optionsField !== undefined && Array.isArray(optionsField)) {\n // Complex option with nested options\n const label =\n ((el as Record<string, unknown>)[props.labelField as string] as string | undefined) ??\n ((el as Record<string, unknown>)[props.textField as string] as string | undefined) ??\n ''\n return {\n label,\n options: optionsField.map((subOpt: unknown) => {\n if (\n typeof subOpt === 'string' ||\n typeof subOpt === 'number' ||\n typeof subOpt === 'boolean'\n ) {\n return normalizePrimitive(subOpt)\n }\n return normalizeSimpleOption(subOpt as object)\n }),\n } as ComplexSelectOptionRaw\n }\n\n // Simple option - spread all properties from the original object to preserve class, data-*, etc.\n return normalizeSimpleOption(el as object)\n })\n }\n\n return optionsArray.map((el) => {\n if (typeof el === 'string' || typeof el === 'number' || typeof el === 'boolean') {\n return normalizePrimitive(el)\n }\n // Spread all properties from the original object to preserve class, data-*, etc.\n return normalizeSimpleOption(el as object)\n })\n})\n\n// Forward all props except options (which we normalize), modelValue (handled separately),\n// and field mappings (already used for normalization)\nconst forwardedProps = computed(() => ({\n ariaInvalid: props.ariaInvalid,\n autofocus: props.autofocus,\n disabled: props.disabled,\n form: props.form,\n id: props.id,\n multiple: props.multiple,\n name: props.name,\n plain: props.plain,\n required: props.required,\n selectSize: props.selectSize,\n size: props.size,\n state: props.state,\n}))\n</script>\n","<template>\n <BFormSelectBase\n v-bind=\"forwardedProps\"\n v-model=\"modelValue as any\"\n :options=\"normalizedOptions as any\"\n >\n <!-- Forward all slots -->\n <template #first>\n <slot name=\"first\" />\n </template>\n\n <template #option=\"slotProps\">\n <slot name=\"option\" v-bind=\"slotProps as any\" />\n </template>\n\n <slot />\n </BFormSelectBase>\n</template>\n\n<script\n setup\n lang=\"ts\"\n generic=\"\n Options extends readonly (object | string | number | boolean)[] = readonly (\n | object\n | string\n | number\n | boolean\n )[]\n \"\n>\nimport {computed} from 'vue'\nimport BFormSelectBase from './BFormSelectBase.vue'\nimport type {\n BFormSelectProps,\n BFormSelectSlots,\n ComplexSelectOptionRaw,\n OptionsValues,\n SelectOption,\n} from '../../types'\n\n/**\n * Type-safe wrapper component for BFormSelect.\n * Provides generic type safety for options array and strongly-typed modelValue.\n * Uses Options array generic to extract union of all possible values.\n * Normalizes typed options and forwards to BFormSelectBase for rendering.\n * Supports both complex objects and simple scalar types (string, number).\n *\n * For strongly-typed modelValue:\n * - Primitive arrays: modelValue is union of those values (or array if multiple)\n * - Object arrays with 'value' field: modelValue is union of value field types\n * - Use 'as const' on options for literal type inference\n */\nconst props = withDefaults(defineProps<Omit<BFormSelectProps<Options>, 'modelValue'>>(), {\n ariaInvalid: undefined,\n autofocus: false,\n disabled: false,\n disabledField: 'disabled',\n form: undefined,\n id: undefined,\n labelField: 'label',\n multiple: false,\n name: undefined,\n options: () => [] as unknown as Options,\n optionsField: 'options',\n plain: false,\n required: false,\n selectSize: 0,\n size: undefined,\n state: null,\n textField: 'text',\n valueField: 'value',\n})\ndefineSlots<BFormSelectSlots<OptionsValues<Options>>>()\n\n// Type-safe model value - single value or array depending on multiple prop.\n// NOTE: OptionsValues assumes a static \"value\" key; custom valueField is not\n// reflected in the type — modelValue falls back to unknown in that case.\nconst modelValue = defineModel<OptionsValues<Options> | OptionsValues<Options>[] | null>({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n default: '' as any,\n})\n\n// Normalize a single simple option using custom field names\nconst normalizeSimpleOption = (el: object): SelectOption =>\n ({\n ...(el as Record<string, unknown>),\n value: (el as Record<string, unknown>)[props.valueField as string],\n text: ((el as Record<string, unknown>)[props.textField as string] as string | undefined) ?? '',\n disabled:\n ((el as Record<string, unknown>)[props.disabledField as string] as boolean | undefined) ??\n false,\n }) as SelectOption\n\nconst normalizePrimitive = (el: string | number | boolean): SelectOption =>\n ({value: el, text: String(el), disabled: false}) as SelectOption\n\n// Type-safe normalization of options (supports both simple and complex/grouped)\nconst normalizedOptions = computed(() => {\n const optionsArray = props.options ?? []\n const hasComplexOptions = optionsArray.some(\n (el) =>\n typeof el !== 'string' &&\n typeof el !== 'number' &&\n typeof el !== 'boolean' &&\n (el as Record<string, unknown>)[props.optionsField as string] !== undefined\n )\n\n if (hasComplexOptions) {\n return optionsArray.map((el) => {\n if (typeof el === 'string' || typeof el === 'number' || typeof el === 'boolean') {\n return normalizePrimitive(el)\n }\n\n // Check if this is a complex (grouped) option\n const optionsField = (el as Record<string, unknown>)[props.optionsField as string]\n if (optionsField !== undefined && Array.isArray(optionsField)) {\n // Complex option with nested options\n const label =\n ((el as Record<string, unknown>)[props.labelField as string] as string | undefined) ??\n ((el as Record<string, unknown>)[props.textField as string] as string | undefined) ??\n ''\n return {\n label,\n options: optionsField.map((subOpt: unknown) => {\n if (\n typeof subOpt === 'string' ||\n typeof subOpt === 'number' ||\n typeof subOpt === 'boolean'\n ) {\n return normalizePrimitive(subOpt)\n }\n return normalizeSimpleOption(subOpt as object)\n }),\n } as ComplexSelectOptionRaw\n }\n\n // Simple option - spread all properties from the original object to preserve class, data-*, etc.\n return normalizeSimpleOption(el as object)\n })\n }\n\n return optionsArray.map((el) => {\n if (typeof el === 'string' || typeof el === 'number' || typeof el === 'boolean') {\n return normalizePrimitive(el)\n }\n // Spread all properties from the original object to preserve class, data-*, etc.\n return normalizeSimpleOption(el as object)\n })\n})\n\n// Forward all props except options (which we normalize), modelValue (handled separately),\n// and field mappings (already used for normalization)\nconst forwardedProps = computed(() => ({\n ariaInvalid: props.ariaInvalid,\n autofocus: props.autofocus,\n disabled: props.disabled,\n form: props.form,\n id: props.id,\n multiple: props.multiple,\n name: props.name,\n plain: props.plain,\n required: props.required,\n selectSize: props.selectSize,\n size: props.size,\n state: props.state,\n}))\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAkCA,MAAM,QAAQ,YAAY,SAAQ,wBAAwB;EAU1D,MAAM,EAAC,sBAAqB,oBAAoB,MAAM,SAAS,KAAK;;GA3ClE,OAAA,UAAA,GAAA,mBAYW,YAAA,EAZA,OAAO,MAAA,KAAA,CAAK,CAAC,MAAA,GAAA;IACtB,WAAqB,KAA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A,SAAS,aAAa,KAAK,WAAoB;MAC7C,IACE,OAAO,WAAW,YAClB,OAAO,WAAW,YAClB,OAAO,WAAW,WAElB,OAAO,mBAAmB,MAAM;MAElC,OAAO,sBAAsB,MAAgB;KAC/C,CAAC;IACH;IAIF,OAAO,sBAAsB,EAAY;GAC3C,CAAC;GAGH,OAAO,aAAa,KAAK,OAAO;IAC9B,IAAI,OAAO,OAAO,YAAY,OAAO,OAAO,YAAY,OAAO,OAAO,WACpE,OAAO,mBAAmB,EAAE;IAG9B,OAAO,sBAAsB,EAAY;GAC3C,CAAC;EACH,CAAC;EAID,MAAM,iBAAiB,gBAAgB;GACrC,aAAa,MAAM;GACnB,WAAW,MAAM;GACjB,UAAU,MAAM;GAChB,MAAM,MAAM;GACZ,IAAI,MAAM;GACV,UAAU,MAAM;GAChB,MAAM,MAAM;GACZ,OAAO,MAAM;GACb,UAAU,MAAM;GAChB,YAAY,MAAM;GAClB,MAAM,MAAM;GACZ,OAAO,MAAM;EACf,EAAE;;GArKA,OAAA,UAAA,GAAA,YAekB,yBAflB,WACU,eAcQ,OAdM;IACb,YAAA,WAAA;IAAA,uBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,WAAA,QAAU;IAClB,SAAS,kBAAA;;IAGC,OAAK,cACO,CAArB,WAAqB,KAAA,QAAA,OAAA,CAAA,CAAA;IAGZ,QAAM,SAAE,cAAS,CAC1B,WAAgD,KAAA,QAAA,UAAA,eAAA,mBAApB,SAAS,CAAA,CAAA,CAAA,CAAA;IAGvC,SAAA,cAAQ,CAAR,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"BFormSelect-QXCaxgWx.js","names":["$attrs"],"sources":["../src/components/BFormSelect/BFormSelectOptionGroup.vue","../src/components/BFormSelect/BFormSelectOptionGroup.vue","../src/components/BFormSelect/BFormSelectBase.vue","../src/components/BFormSelect/BFormSelectBase.vue","../src/components/BFormSelect/BFormSelect.vue","../src/components/BFormSelect/BFormSelect.vue"],"sourcesContent":["<template>\n <optgroup :label=\"props.label\">\n <slot name=\"first\" />\n <BFormSelectOption\n v-for=\"(option, index) in normalizedOptions\"\n :key=\"index\"\n v-bind=\"{...$attrs, ...option}\"\n >\n <slot name=\"option\" v-bind=\"option\">\n {{ option.text }}\n </slot>\n </BFormSelectOption>\n <slot />\n </optgroup>\n</template>\n\n<script setup lang=\"ts\" generic=\"T\">\nimport BFormSelectOption from './BFormSelectOption.vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ComputedRef} from 'vue'\nimport {useFormSelect} from '../../composables/useFormSelect'\nimport type {\n BFormSelectOptionGroupProps,\n BFormSelectOptionGroupSlots,\n SelectOption,\n} from '../../types'\n\nconst _props = withDefaults(defineProps<BFormSelectOptionGroupProps>(), {\n disabledField: 'disabled',\n label: undefined,\n options: () => [],\n textField: 'text',\n valueField: 'value',\n})\nconst props = useDefaults(_props, 'BFormSelectOptionGroup')\ndefineSlots<BFormSelectOptionGroupSlots<T>>()\n\n// The form select context is injected by BFormSelectOption components automatically\n// We don't need to handle the selected value here since each BFormSelectOption\n// will inject the context directly\n\n// Type assertion is needed because useFormSelect is not generic-aware.\n// This is acceptable in the wrapper/base pattern where the wrapper (BFormSelect)\n// handles type-safe normalization before passing to base components.\nconst {normalizedOptions} = useFormSelect(() => props.options, props) as {\n normalizedOptions: ComputedRef<SelectOption<T>[]>\n}\n</script>\n","<template>\n <optgroup :label=\"props.label\">\n <slot name=\"first\" />\n <BFormSelectOption\n v-for=\"(option, index) in normalizedOptions\"\n :key=\"index\"\n v-bind=\"{...$attrs, ...option}\"\n >\n <slot name=\"option\" v-bind=\"option\">\n {{ option.text }}\n </slot>\n </BFormSelectOption>\n <slot />\n </optgroup>\n</template>\n\n<script setup lang=\"ts\" generic=\"T\">\nimport BFormSelectOption from './BFormSelectOption.vue'\nimport {useDefaults} from '../../composables/useDefaults'\nimport type {ComputedRef} from 'vue'\nimport {useFormSelect} from '../../composables/useFormSelect'\nimport type {\n BFormSelectOptionGroupProps,\n BFormSelectOptionGroupSlots,\n SelectOption,\n} from '../../types'\n\nconst _props = withDefaults(defineProps<BFormSelectOptionGroupProps>(), {\n disabledField: 'disabled',\n label: undefined,\n options: () => [],\n textField: 'text',\n valueField: 'value',\n})\nconst props = useDefaults(_props, 'BFormSelectOptionGroup')\ndefineSlots<BFormSelectOptionGroupSlots<T>>()\n\n// The form select context is injected by BFormSelectOption components automatically\n// We don't need to handle the selected value here since each BFormSelectOption\n// will inject the context directly\n\n// Type assertion is needed because useFormSelect is not generic-aware.\n// This is acceptable in the wrapper/base pattern where the wrapper (BFormSelect)\n// handles type-safe normalization before passing to base components.\nconst {normalizedOptions} = useFormSelect(() => props.options, props) as {\n normalizedOptions: ComputedRef<SelectOption<T>[]>\n}\n</script>\n","<template>\n <select\n :id=\"computedId\"\n ref=\"_input\"\n v-model=\"localValue\"\n :class=\"computedClasses\"\n :name=\"props.name\"\n :form=\"props.form || undefined\"\n :multiple=\"props.multiple || undefined\"\n :size=\"computedSelectSize\"\n :disabled=\"isDisabled\"\n :required=\"props.required || undefined\"\n :aria-required=\"props.required || undefined\"\n :aria-invalid=\"computedAriaInvalid\"\n >\n <slot name=\"first\" />\n <template v-for=\"(option, index) in normalizedOptsWrapper\" :key=\"index\">\n <BFormSelectOptionGroup\n v-if=\"isComplex(option)\"\n :label=\"option.label\"\n :options=\"option.options\"\n :value-field=\"props.valueField\"\n :text-field=\"props.textField\"\n :disabled-field=\"props.disabledField\"\n />\n <BFormSelectOption v-else v-bind=\"option\">\n <slot name=\"option\" v-bind=\"option\">\n {{ option.text }}\n </slot>\n </BFormSelectOption>\n </template>\n <slot />\n </select>\n</template>\n\n<script setup lang=\"ts\">\nimport type {BFormSelectBaseProps} from '../../types'\nimport {computed, inject, provide, readonly, useTemplateRef} from 'vue'\nimport BFormSelectOption from './BFormSelectOption.vue'\nimport BFormSelectOptionGroup from './BFormSelectOptionGroup.vue'\nimport {useAriaInvalid} from '../../composables/useAriaInvalid'\nimport {useFocus, useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport {useStateClass} from '../../composables/useStateClass'\nimport {useFormSelect} from '../../composables/useFormSelect'\nimport {formGroupKey, formSelectKey} from '../../utils/keys'\n\n/**\n * Base component for BFormSelect - non-generic implementation using useDefaults.\n * Renders a select element with normalized options and option groups.\n * Supports both simple options and complex grouped options.\n */\nconst _props = withDefaults(defineProps<Omit<BFormSelectBaseProps, 'modelValue'>>(), {\n ariaInvalid: undefined,\n autofocus: false,\n disabled: false,\n disabledField: 'disabled',\n form: undefined,\n id: undefined,\n labelField: 'label',\n multiple: false,\n name: undefined,\n options: () => [],\n optionsField: 'options',\n plain: false,\n required: false,\n selectSize: 0,\n size: undefined,\n state: null,\n textField: 'text',\n valueField: 'value',\n})\nconst props = useDefaults(_props, 'BFormSelect')\n\nconst modelValue = defineModel<BFormSelectBaseProps['modelValue']>({\n default: '',\n})\n\nconst computedId = useId(() => props.id, 'input')\n\nconst formGroupData = inject(formGroupKey, null)?.()\nformGroupData?.track(computedId)\nconst isDisabled = computed(() => props.disabled || (formGroupData?.disabled.value ?? false))\n\nconst selectSizeNumber = useToNumber(() => props.selectSize)\n\nconst stateClass = useStateClass(() => props.state)\n\nconst input = useTemplateRef('_input')\n\nconst {focused} = useFocus(input, {\n initialValue: props.autofocus,\n})\n\nconst computedClasses = computed(() => [\n stateClass.value,\n {\n 'form-control': props.plain,\n [`form-control-${props.size}`]: props.size !== undefined && props.plain,\n 'form-select': !props.plain,\n [`form-select-${props.size}`]: props.size !== undefined && !props.plain,\n },\n])\n\nconst computedSelectSize = computed(() =>\n !props.plain && selectSizeNumber.value > 0 ? selectSizeNumber.value : undefined\n)\n\nconst computedAriaInvalid = useAriaInvalid(\n () => props.ariaInvalid,\n () => props.state\n)\n\nconst {normalizedOptions, isComplex} = useFormSelect(() => props.options, props)\n\nconst normalizedOptsWrapper = computed(() => normalizedOptions.value)\n\nconst localValue = computed({\n get: () => modelValue.value,\n set: (newValue) => {\n modelValue.value = newValue\n },\n})\n\n// Provide the current model value for child components to inject\nprovide(formSelectKey, {\n modelValue: readonly(localValue),\n})\n\ndefineExpose({\n blur: () => {\n focused.value = false\n },\n element: input,\n focus: () => {\n focused.value = true\n },\n})\n</script>\n","<template>\n <select\n :id=\"computedId\"\n ref=\"_input\"\n v-model=\"localValue\"\n :class=\"computedClasses\"\n :name=\"props.name\"\n :form=\"props.form || undefined\"\n :multiple=\"props.multiple || undefined\"\n :size=\"computedSelectSize\"\n :disabled=\"isDisabled\"\n :required=\"props.required || undefined\"\n :aria-required=\"props.required || undefined\"\n :aria-invalid=\"computedAriaInvalid\"\n >\n <slot name=\"first\" />\n <template v-for=\"(option, index) in normalizedOptsWrapper\" :key=\"index\">\n <BFormSelectOptionGroup\n v-if=\"isComplex(option)\"\n :label=\"option.label\"\n :options=\"option.options\"\n :value-field=\"props.valueField\"\n :text-field=\"props.textField\"\n :disabled-field=\"props.disabledField\"\n />\n <BFormSelectOption v-else v-bind=\"option\">\n <slot name=\"option\" v-bind=\"option\">\n {{ option.text }}\n </slot>\n </BFormSelectOption>\n </template>\n <slot />\n </select>\n</template>\n\n<script setup lang=\"ts\">\nimport type {BFormSelectBaseProps} from '../../types'\nimport {computed, inject, provide, readonly, useTemplateRef} from 'vue'\nimport BFormSelectOption from './BFormSelectOption.vue'\nimport BFormSelectOptionGroup from './BFormSelectOptionGroup.vue'\nimport {useAriaInvalid} from '../../composables/useAriaInvalid'\nimport {useFocus, useToNumber} from '@vueuse/core'\nimport {useDefaults} from '../../composables/useDefaults'\nimport {useId} from '../../composables/useId'\nimport {useStateClass} from '../../composables/useStateClass'\nimport {useFormSelect} from '../../composables/useFormSelect'\nimport {formGroupKey, formSelectKey} from '../../utils/keys'\n\n/**\n * Base component for BFormSelect - non-generic implementation using useDefaults.\n * Renders a select element with normalized options and option groups.\n * Supports both simple options and complex grouped options.\n */\nconst _props = withDefaults(defineProps<Omit<BFormSelectBaseProps, 'modelValue'>>(), {\n ariaInvalid: undefined,\n autofocus: false,\n disabled: false,\n disabledField: 'disabled',\n form: undefined,\n id: undefined,\n labelField: 'label',\n multiple: false,\n name: undefined,\n options: () => [],\n optionsField: 'options',\n plain: false,\n required: false,\n selectSize: 0,\n size: undefined,\n state: null,\n textField: 'text',\n valueField: 'value',\n})\nconst props = useDefaults(_props, 'BFormSelect')\n\nconst modelValue = defineModel<BFormSelectBaseProps['modelValue']>({\n default: '',\n})\n\nconst computedId = useId(() => props.id, 'input')\n\nconst formGroupData = inject(formGroupKey, null)?.()\nformGroupData?.track(computedId)\nconst isDisabled = computed(() => props.disabled || (formGroupData?.disabled.value ?? false))\n\nconst selectSizeNumber = useToNumber(() => props.selectSize)\n\nconst stateClass = useStateClass(() => props.state)\n\nconst input = useTemplateRef('_input')\n\nconst {focused} = useFocus(input, {\n initialValue: props.autofocus,\n})\n\nconst computedClasses = computed(() => [\n stateClass.value,\n {\n 'form-control': props.plain,\n [`form-control-${props.size}`]: props.size !== undefined && props.plain,\n 'form-select': !props.plain,\n [`form-select-${props.size}`]: props.size !== undefined && !props.plain,\n },\n])\n\nconst computedSelectSize = computed(() =>\n !props.plain && selectSizeNumber.value > 0 ? selectSizeNumber.value : undefined\n)\n\nconst computedAriaInvalid = useAriaInvalid(\n () => props.ariaInvalid,\n () => props.state\n)\n\nconst {normalizedOptions, isComplex} = useFormSelect(() => props.options, props)\n\nconst normalizedOptsWrapper = computed(() => normalizedOptions.value)\n\nconst localValue = computed({\n get: () => modelValue.value,\n set: (newValue) => {\n modelValue.value = newValue\n },\n})\n\n// Provide the current model value for child components to inject\nprovide(formSelectKey, {\n modelValue: readonly(localValue),\n})\n\ndefineExpose({\n blur: () => {\n focused.value = false\n },\n element: input,\n focus: () => {\n focused.value = true\n },\n})\n</script>\n","<template>\n <BFormSelectBase\n v-bind=\"forwardedProps\"\n v-model=\"modelValue as any\"\n :options=\"normalizedOptions as any\"\n >\n <!-- Forward all slots -->\n <template #first>\n <slot name=\"first\" />\n </template>\n\n <template #option=\"slotProps\">\n <slot name=\"option\" v-bind=\"slotProps as any\" />\n </template>\n\n <slot />\n </BFormSelectBase>\n</template>\n\n<script\n setup\n lang=\"ts\"\n generic=\"\n Options extends readonly (object | string | number | boolean)[] = readonly (\n | object\n | string\n | number\n | boolean\n )[]\n \"\n>\nimport {computed} from 'vue'\nimport BFormSelectBase from './BFormSelectBase.vue'\nimport type {\n BFormSelectProps,\n BFormSelectSlots,\n ComplexSelectOptionRaw,\n OptionsValues,\n SelectOption,\n} from '../../types'\n\n/**\n * Type-safe wrapper component for BFormSelect.\n * Provides generic type safety for options array and strongly-typed modelValue.\n * Uses Options array generic to extract union of all possible values.\n * Normalizes typed options and forwards to BFormSelectBase for rendering.\n * Supports both complex objects and simple scalar types (string, number).\n *\n * For strongly-typed modelValue:\n * - Primitive arrays: modelValue is union of those values (or array if multiple)\n * - Object arrays with 'value' field: modelValue is union of value field types\n * - Use 'as const' on options for literal type inference\n */\nconst props = withDefaults(defineProps<Omit<BFormSelectProps<Options>, 'modelValue'>>(), {\n ariaInvalid: undefined,\n autofocus: false,\n disabled: false,\n disabledField: 'disabled',\n form: undefined,\n id: undefined,\n labelField: 'label',\n multiple: false,\n name: undefined,\n options: () => [] as unknown as Options,\n optionsField: 'options',\n plain: false,\n required: false,\n selectSize: 0,\n size: undefined,\n state: null,\n textField: 'text',\n valueField: 'value',\n})\ndefineSlots<BFormSelectSlots<OptionsValues<Options>>>()\n\n// Type-safe model value - single value or array depending on multiple prop.\n// NOTE: OptionsValues assumes a static \"value\" key; custom valueField is not\n// reflected in the type — modelValue falls back to unknown in that case.\nconst modelValue = defineModel<OptionsValues<Options> | OptionsValues<Options>[] | null>({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n default: '' as any,\n})\n\n// Normalize a single simple option using custom field names\nconst normalizeSimpleOption = (el: object): SelectOption =>\n ({\n ...(el as Record<string, unknown>),\n value: (el as Record<string, unknown>)[props.valueField as string],\n text: ((el as Record<string, unknown>)[props.textField as string] as string | undefined) ?? '',\n disabled:\n ((el as Record<string, unknown>)[props.disabledField as string] as boolean | undefined) ??\n false,\n }) as SelectOption\n\nconst normalizePrimitive = (el: string | number | boolean): SelectOption =>\n ({value: el, text: String(el), disabled: false}) as SelectOption\n\n// Type-safe normalization of options (supports both simple and complex/grouped)\nconst normalizedOptions = computed(() => {\n const optionsArray = props.options ?? []\n const hasComplexOptions = optionsArray.some(\n (el) =>\n typeof el !== 'string' &&\n typeof el !== 'number' &&\n typeof el !== 'boolean' &&\n (el as Record<string, unknown>)[props.optionsField as string] !== undefined\n )\n\n if (hasComplexOptions) {\n return optionsArray.map((el) => {\n if (typeof el === 'string' || typeof el === 'number' || typeof el === 'boolean') {\n return normalizePrimitive(el)\n }\n\n // Check if this is a complex (grouped) option\n const optionsField = (el as Record<string, unknown>)[props.optionsField as string]\n if (optionsField !== undefined && Array.isArray(optionsField)) {\n // Complex option with nested options\n const label =\n ((el as Record<string, unknown>)[props.labelField as string] as string | undefined) ??\n ((el as Record<string, unknown>)[props.textField as string] as string | undefined) ??\n ''\n return {\n label,\n options: optionsField.map((subOpt: unknown) => {\n if (\n typeof subOpt === 'string' ||\n typeof subOpt === 'number' ||\n typeof subOpt === 'boolean'\n ) {\n return normalizePrimitive(subOpt)\n }\n return normalizeSimpleOption(subOpt as object)\n }),\n } as ComplexSelectOptionRaw\n }\n\n // Simple option - spread all properties from the original object to preserve class, data-*, etc.\n return normalizeSimpleOption(el as object)\n })\n }\n\n return optionsArray.map((el) => {\n if (typeof el === 'string' || typeof el === 'number' || typeof el === 'boolean') {\n return normalizePrimitive(el)\n }\n // Spread all properties from the original object to preserve class, data-*, etc.\n return normalizeSimpleOption(el as object)\n })\n})\n\n// Forward all props except options (which we normalize), modelValue (handled separately),\n// and field mappings (already used for normalization)\nconst forwardedProps = computed(() => ({\n ariaInvalid: props.ariaInvalid,\n autofocus: props.autofocus,\n disabled: props.disabled,\n form: props.form,\n id: props.id,\n multiple: props.multiple,\n name: props.name,\n plain: props.plain,\n required: props.required,\n selectSize: props.selectSize,\n size: props.size,\n state: props.state,\n}))\n</script>\n","<template>\n <BFormSelectBase\n v-bind=\"forwardedProps\"\n v-model=\"modelValue as any\"\n :options=\"normalizedOptions as any\"\n >\n <!-- Forward all slots -->\n <template #first>\n <slot name=\"first\" />\n </template>\n\n <template #option=\"slotProps\">\n <slot name=\"option\" v-bind=\"slotProps as any\" />\n </template>\n\n <slot />\n </BFormSelectBase>\n</template>\n\n<script\n setup\n lang=\"ts\"\n generic=\"\n Options extends readonly (object | string | number | boolean)[] = readonly (\n | object\n | string\n | number\n | boolean\n )[]\n \"\n>\nimport {computed} from 'vue'\nimport BFormSelectBase from './BFormSelectBase.vue'\nimport type {\n BFormSelectProps,\n BFormSelectSlots,\n ComplexSelectOptionRaw,\n OptionsValues,\n SelectOption,\n} from '../../types'\n\n/**\n * Type-safe wrapper component for BFormSelect.\n * Provides generic type safety for options array and strongly-typed modelValue.\n * Uses Options array generic to extract union of all possible values.\n * Normalizes typed options and forwards to BFormSelectBase for rendering.\n * Supports both complex objects and simple scalar types (string, number).\n *\n * For strongly-typed modelValue:\n * - Primitive arrays: modelValue is union of those values (or array if multiple)\n * - Object arrays with 'value' field: modelValue is union of value field types\n * - Use 'as const' on options for literal type inference\n */\nconst props = withDefaults(defineProps<Omit<BFormSelectProps<Options>, 'modelValue'>>(), {\n ariaInvalid: undefined,\n autofocus: false,\n disabled: false,\n disabledField: 'disabled',\n form: undefined,\n id: undefined,\n labelField: 'label',\n multiple: false,\n name: undefined,\n options: () => [] as unknown as Options,\n optionsField: 'options',\n plain: false,\n required: false,\n selectSize: 0,\n size: undefined,\n state: null,\n textField: 'text',\n valueField: 'value',\n})\ndefineSlots<BFormSelectSlots<OptionsValues<Options>>>()\n\n// Type-safe model value - single value or array depending on multiple prop.\n// NOTE: OptionsValues assumes a static \"value\" key; custom valueField is not\n// reflected in the type — modelValue falls back to unknown in that case.\nconst modelValue = defineModel<OptionsValues<Options> | OptionsValues<Options>[] | null>({\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n default: '' as any,\n})\n\n// Normalize a single simple option using custom field names\nconst normalizeSimpleOption = (el: object): SelectOption =>\n ({\n ...(el as Record<string, unknown>),\n value: (el as Record<string, unknown>)[props.valueField as string],\n text: ((el as Record<string, unknown>)[props.textField as string] as string | undefined) ?? '',\n disabled:\n ((el as Record<string, unknown>)[props.disabledField as string] as boolean | undefined) ??\n false,\n }) as SelectOption\n\nconst normalizePrimitive = (el: string | number | boolean): SelectOption =>\n ({value: el, text: String(el), disabled: false}) as SelectOption\n\n// Type-safe normalization of options (supports both simple and complex/grouped)\nconst normalizedOptions = computed(() => {\n const optionsArray = props.options ?? []\n const hasComplexOptions = optionsArray.some(\n (el) =>\n typeof el !== 'string' &&\n typeof el !== 'number' &&\n typeof el !== 'boolean' &&\n (el as Record<string, unknown>)[props.optionsField as string] !== undefined\n )\n\n if (hasComplexOptions) {\n return optionsArray.map((el) => {\n if (typeof el === 'string' || typeof el === 'number' || typeof el === 'boolean') {\n return normalizePrimitive(el)\n }\n\n // Check if this is a complex (grouped) option\n const optionsField = (el as Record<string, unknown>)[props.optionsField as string]\n if (optionsField !== undefined && Array.isArray(optionsField)) {\n // Complex option with nested options\n const label =\n ((el as Record<string, unknown>)[props.labelField as string] as string | undefined) ??\n ((el as Record<string, unknown>)[props.textField as string] as string | undefined) ??\n ''\n return {\n label,\n options: optionsField.map((subOpt: unknown) => {\n if (\n typeof subOpt === 'string' ||\n typeof subOpt === 'number' ||\n typeof subOpt === 'boolean'\n ) {\n return normalizePrimitive(subOpt)\n }\n return normalizeSimpleOption(subOpt as object)\n }),\n } as ComplexSelectOptionRaw\n }\n\n // Simple option - spread all properties from the original object to preserve class, data-*, etc.\n return normalizeSimpleOption(el as object)\n })\n }\n\n return optionsArray.map((el) => {\n if (typeof el === 'string' || typeof el === 'number' || typeof el === 'boolean') {\n return normalizePrimitive(el)\n }\n // Spread all properties from the original object to preserve class, data-*, etc.\n return normalizeSimpleOption(el as object)\n })\n})\n\n// Forward all props except options (which we normalize), modelValue (handled separately),\n// and field mappings (already used for normalization)\nconst forwardedProps = computed(() => ({\n ariaInvalid: props.ariaInvalid,\n autofocus: props.autofocus,\n disabled: props.disabled,\n form: props.form,\n id: props.id,\n multiple: props.multiple,\n name: props.name,\n plain: props.plain,\n required: props.required,\n selectSize: props.selectSize,\n size: props.size,\n state: props.state,\n}))\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAkCA,MAAM,QAAQ,YAAY,SAAQ,wBAAwB;EAU1D,MAAM,EAAC,sBAAqB,oBAAoB,MAAM,SAAS,KAAK;;GA3ClE,OAAA,UAAA,GAAA,mBAYW,YAAA,EAZA,OAAO,MAAA,KAAA,CAAK,CAAC,MAAA,GAAA;IACtB,WAAqB,KAAA,QAAA,OAAA;KACrB,UAAA,IAAA,GAAA,mBAQoB,UAAA,MAAA,WAPQ,MAAA,iBAAA,IAAlB,QAAQ,UAAK;KADvB,OAAA,UAAA,GAAA,YAQoB,2BARpB,WAQoB,EANjB,KAAK,MAAK,GAAA,EAAA,SAAA,KAAA,GAAA;MAAA,GACCA,KAAAA;MAAM,GAAK;KAAM,CAAA,GAAA;MAE7B,SAAA,cAEO,CAFP,WAEO,KAAA,QAAA,UAFP,WAEO,EAAA,SAAA,KAAA,GAFqB,MAAM,SAE3B,CADF,gBAAA,gBAAA,OAAO,IAAI,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;;;IAGlB,WAAQ,KAAA,QAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EE6DZ,MAAM,QAAQ,YAAY,SAAQ,aAAa;EAE/C,MAAM,aAAa,SAA+C,SAAA,YAEjE;EAED,MAAM,aAAa,cAAY,MAAM,IAAI,OAAO;EAEhD,MAAM,gBAAgB,OAAO,cAAc,IAAI,CAAC,GAAG;EACnD,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A,OAAA,OAAA,MAAA,WAAA,WAAA,QAAU;IAClB,SAAS,kBAAA;;IAGC,OAAK,cACO,CAArB,WAAqB,KAAA,QAAA,OAAA,CAAA,CAAA;IAGZ,QAAM,SAAE,cAAS,CAC1B,WAAgD,KAAA,QAAA,UAAA,eAAA,mBAApB,SAAS,CAAA,CAAA,CAAA,CAAA;IAGvC,SAAA,cAAQ,CAAR,WAAQ,KAAA,QAAA,SAAA,CAAA,CAAA"}
@@ -47,7 +47,7 @@ import { t as BFormFile_default } from "./BFormFile-C2DnrbK7.js";
47
47
  import { t as BFormGroup_default } from "./BFormGroup-D3R7DxxF.js";
48
48
  import { n as BFormRadio_default, t as BFormRadioGroup_default } from "./BFormRadio-DRViMh6V.js";
49
49
  import { t as BFormRating_default } from "./BFormRating-iKFgSFet.js";
50
- import { n as BFormSelectOptionGroup_default, t as BFormSelect_default } from "./BFormSelect-DdjH8482.js";
50
+ import { n as BFormSelectOptionGroup_default, t as BFormSelect_default } from "./BFormSelect-QXCaxgWx.js";
51
51
  import { t as BFormSpinbutton_default } from "./BFormSpinbutton-fkVMbQC3.js";
52
52
  import { t as BFormTags_default } from "./BFormTags-CUcyRTCK.js";
53
53
  import { t as BFormTextarea_default } from "./BFormTextarea-CBBlEcrV.js";
@@ -1,3 +1,3 @@
1
1
  import { t as BFormSelectOption_default } from "../../../BFormSelectOption-C8orMj24.js";
2
- import { n as BFormSelectOptionGroup_default, t as BFormSelect_default } from "../../../BFormSelect-DdjH8482.js";
2
+ import { n as BFormSelectOptionGroup_default, t as BFormSelect_default } from "../../../BFormSelect-QXCaxgWx.js";
3
3
  export { BFormSelect_default as BFormSelect, BFormSelectOption_default as BFormSelectOption, BFormSelectOptionGroup_default as BFormSelectOptionGroup };
@@ -41,7 +41,7 @@ import { t as BFormFile_default } from "../../BFormFile-C2DnrbK7.js";
41
41
  import { t as BFormGroup_default } from "../../BFormGroup-D3R7DxxF.js";
42
42
  import { n as BFormRadio_default, t as BFormRadioGroup_default } from "../../BFormRadio-DRViMh6V.js";
43
43
  import { t as BFormRating_default } from "../../BFormRating-iKFgSFet.js";
44
- import { n as BFormSelectOptionGroup_default, t as BFormSelect_default } from "../../BFormSelect-DdjH8482.js";
44
+ import { n as BFormSelectOptionGroup_default, t as BFormSelect_default } from "../../BFormSelect-QXCaxgWx.js";
45
45
  import { t as BFormSpinbutton_default } from "../../BFormSpinbutton-fkVMbQC3.js";
46
46
  import { t as BFormTags_default } from "../../BFormTags-CUcyRTCK.js";
47
47
  import { t as BFormTextarea_default } from "../../BFormTextarea-CBBlEcrV.js";
@@ -11,6 +11,10 @@ var buildController = (id, store) => {
11
11
  id,
12
12
  ref: null,
13
13
  async show() {
14
+ if (controller.get()?.value.props.modelValue) {
15
+ const event = await basePromise;
16
+ return Object.assign(Object.create(event), { [Symbol.asyncDispose]: controller.destroy });
17
+ }
14
18
  const refWithMethods = controller.ref;
15
19
  if (refWithMethods !== null && "show" in refWithMethods && typeof refWithMethods.show === "function") refWithMethods.show();
16
20
  else controller.set({ modelValue: true });
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/composables/orchestratorShared/index.ts"],"sourcesContent":["import {type ComponentPublicInstance, inject, nextTick, provide, readonly, type Ref, ref} from 'vue'\nimport type {ComponentController, ControllerKey, PromiseWithController} from '../../types'\nimport type {BvTriggerableEvent} from '../../utils'\nimport {orchestratorRegistryKey, type OrchestratorStoreObject} from '../../utils/keys'\n\n/* oxlint-disable-next-line no-explicit-any */\n/* eslint-disable-next-line @typescript-eslint/no-explicit-any */\nexport type ValueInMapRecord<MapRecord> = MapRecord extends Map<any, infer I> ? I : never\n\nexport const buildController = <\n TComponent,\n TStore extends Readonly<Ref<OrchestratorStoreObject[keyof OrchestratorStoreObject]>>,\n>(\n id: ControllerKey,\n store: TStore\n): PromiseWithController<TComponent, ValueInMapRecord<TStore['value']>> => {\n let resolveFunc: (value: BvTriggerableEvent) => void = () => {}\n\n const basePromise = new Promise<BvTriggerableEvent>((resolve) => {\n resolveFunc = resolve\n })\n\n type RefWithMethods = ComponentPublicInstance<TComponent> & {\n show?: () => void\n hide?: (trigger?: string, noEmit?: boolean) => void\n toggle?: () => void\n }\n const findItem = () => store.value.get(id)\n\n const controller = {\n id,\n ref: null as RefWithMethods | null,\n async show() {\n const refWithMethods = controller.ref\n if (\n refWithMethods !== null &&\n 'show' in refWithMethods &&\n typeof refWithMethods.show === 'function'\n ) {\n refWithMethods.show()\n } else {\n controller.set({modelValue: true})\n }\n const event = await basePromise\n return Object.assign(Object.create(event), {\n [Symbol.asyncDispose]: controller.destroy,\n })\n },\n hide(trigger?: string) {\n const refWithMethods = controller.ref\n if (\n refWithMethods !== null &&\n 'hide' in refWithMethods &&\n typeof refWithMethods.hide === 'function'\n ) {\n refWithMethods.hide(trigger, true)\n } else {\n controller.set({modelValue: false})\n }\n },\n toggle() {\n const currentItem = controller.get()\n const refWithMethods = controller.ref\n if (\n refWithMethods !== null &&\n 'toggle' in refWithMethods &&\n typeof refWithMethods.toggle === 'function'\n ) {\n refWithMethods.toggle()\n } else {\n controller.set({modelValue: !currentItem?.value.props.modelValue})\n }\n },\n get: findItem,\n set(val: Partial<ValueInMapRecord<TStore['value']>['value']['props']>) {\n const current = findItem()\n if (current?.value) {\n current.value = {\n ...current.value,\n props: {\n ...current.value.props,\n ...val,\n /* oxlint-disable no-explicit-any */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n } as any,\n }\n }\n },\n async destroy() {\n const item = findItem()\n if (!item) return\n try {\n if (item.value.props.modelValue) {\n await basePromise\n await nextTick()\n controller.hide('destroy')\n }\n } finally {\n store.value.delete(id)\n }\n },\n [Symbol.asyncDispose]() {\n return controller.destroy()\n },\n } as ComponentController<TComponent, ValueInMapRecord<TStore['value']>>\n\n return {\n controller,\n resolve: resolveFunc,\n }\n}\n\nexport const _newOrchestratorRegistry = (): {\n store: Readonly<Ref<OrchestratorStoreObject>>\n _isToastAppend: Readonly<Ref<boolean>>\n _setToastAppend: (value: boolean) => void\n _isOrchestratorInstalled: Readonly<Ref<boolean>>\n _setOrchestratorInstalled: (value: boolean) => void\n} => {\n const _isOrchestratorInstalled = ref(false)\n const _isToastAppend = ref(false)\n\n return {\n store: ref({\n modal: new Map(),\n tooltip: new Map(),\n popover: new Map(),\n toast: new Map(),\n }),\n _isOrchestratorInstalled: readonly(_isOrchestratorInstalled),\n _setOrchestratorInstalled: (v) => {\n _isOrchestratorInstalled.value = v\n },\n _isToastAppend: readonly(_isToastAppend),\n _setToastAppend: (v) => {\n _isToastAppend.value = v\n },\n }\n}\n\nexport const useOrchestratorRegistry = () => {\n const orchestratorRegistry = inject(orchestratorRegistryKey, null)\n\n if (orchestratorRegistry) {\n return orchestratorRegistry\n }\n const newOrchestratorRegistry = _newOrchestratorRegistry()\n provide(orchestratorRegistryKey, newOrchestratorRegistry)\n return newOrchestratorRegistry\n}\n\nexport const getOrchestratorControllerId = (propId: string | undefined) => {\n const id: ControllerKey = propId || Symbol('OrchestratorItem')\n\n return {\n /**\n * This id is used for stability in the store, using the createIdWatcher will update the store if the id ever changes\n */\n storeId: id,\n /**\n * Do not pass in the symbol as a prop. Html attribute cannot be a symbol. Thus it's internal\n */\n htmlAttributeId: typeof id === 'string' ? id : undefined,\n }\n}\n"],"mappings":";;;AASA,IAAa,mBAIX,IACA,UACyE;CACzE,IAAI,oBAAyD,CAAC;CAE9D,MAAM,cAAc,IAAI,SAA6B,YAAY;EAC/D,cAAc;CAChB,CAAC;CAOD,MAAM,iBAAiB,MAAM,MAAM,IAAI,EAAE;CAEzC,MAAM,aAAa;EACjB;EACA,KAAK;EACL,MAAM,OAAO;GACX,MAAM,iBAAiB,WAAW;GAClC,IACE,mBAAmB,QACnB,UAAU,kBACV,OAAO,eAAe,SAAS,YAE/B,eAAe,KAAK;QAEpB,WAAW,IAAI,EAAC,YAAY,KAAI,CAAC;GAEnC,MAAM,QAAQ,MAAM;GACpB,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG,GACxC,OAA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AgB,SAAS,cAAc;EACvC,kBAAkB,MAAM;GACtB,eAAe,QAAQ;EACzB;CACF;AACF;AAEA,IAAa,gCAAgC;CAC3C,MAAM,uBAAuB,OAAO,yBAAyB,IAAI;CAEjE,IAAI,sBACF,OAAO;CAET,MAAM,0BAA0B,yBAAyB;CACzD,QAAQ,yBAAyB,uBAAuB;CACxD,OAAO;AACT;AAEA,IAAa,+BAA+B,WAA+B;CACzE,MAAM,KAAoB,UAAU,OAAO,kBAAkB;CAE7D,OAAO;;;;EAIL,SAAS;;;;EAIT,iBAAiB,OAAO,OAAO,WAAW,KAAK,KAAA;CACjD;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/composables/orchestratorShared/index.ts"],"sourcesContent":["import {type ComponentPublicInstance, inject, nextTick, provide, readonly, type Ref, ref} from 'vue'\nimport type {ComponentController, ControllerKey, PromiseWithController} from '../../types'\nimport type {BvTriggerableEvent} from '../../utils'\nimport {orchestratorRegistryKey, type OrchestratorStoreObject} from '../../utils/keys'\n\n/* oxlint-disable-next-line no-explicit-any */\n/* eslint-disable-next-line @typescript-eslint/no-explicit-any */\nexport type ValueInMapRecord<MapRecord> = MapRecord extends Map<any, infer I> ? I : never\n\nexport const buildController = <\n TComponent,\n TStore extends Readonly<Ref<OrchestratorStoreObject[keyof OrchestratorStoreObject]>>,\n>(\n id: ControllerKey,\n store: TStore\n): PromiseWithController<TComponent, ValueInMapRecord<TStore['value']>> => {\n let resolveFunc: (value: BvTriggerableEvent) => void = () => {}\n\n const basePromise = new Promise<BvTriggerableEvent>((resolve) => {\n resolveFunc = resolve\n })\n\n type RefWithMethods = ComponentPublicInstance<TComponent> & {\n show?: () => void\n hide?: (trigger?: string, noEmit?: boolean) => void\n toggle?: () => void\n }\n const findItem = () => store.value.get(id)\n\n const controller = {\n id,\n ref: null as RefWithMethods | null,\n async show() {\n const currentModelValue = controller.get()?.value.props.modelValue\n if (currentModelValue) {\n const event = await basePromise\n return Object.assign(Object.create(event), {\n [Symbol.asyncDispose]: controller.destroy,\n })\n }\n const refWithMethods = controller.ref\n if (\n refWithMethods !== null &&\n 'show' in refWithMethods &&\n typeof refWithMethods.show === 'function'\n ) {\n refWithMethods.show()\n } else {\n controller.set({modelValue: true})\n }\n const event = await basePromise\n return Object.assign(Object.create(event), {\n [Symbol.asyncDispose]: controller.destroy,\n })\n },\n hide(trigger?: string) {\n const refWithMethods = controller.ref\n if (\n refWithMethods !== null &&\n 'hide' in refWithMethods &&\n typeof refWithMethods.hide === 'function'\n ) {\n refWithMethods.hide(trigger, true)\n } else {\n controller.set({modelValue: false})\n }\n },\n toggle() {\n const currentItem = controller.get()\n const refWithMethods = controller.ref\n if (\n refWithMethods !== null &&\n 'toggle' in refWithMethods &&\n typeof refWithMethods.toggle === 'function'\n ) {\n refWithMethods.toggle()\n } else {\n controller.set({modelValue: !currentItem?.value.props.modelValue})\n }\n },\n get: findItem,\n set(val: Partial<ValueInMapRecord<TStore['value']>['value']['props']>) {\n const current = findItem()\n if (current?.value) {\n current.value = {\n ...current.value,\n props: {\n ...current.value.props,\n ...val,\n /* oxlint-disable no-explicit-any */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n } as any,\n }\n }\n },\n async destroy() {\n const item = findItem()\n if (!item) return\n try {\n if (item.value.props.modelValue) {\n await basePromise\n await nextTick()\n controller.hide('destroy')\n }\n } finally {\n store.value.delete(id)\n }\n },\n [Symbol.asyncDispose]() {\n return controller.destroy()\n },\n } as ComponentController<TComponent, ValueInMapRecord<TStore['value']>>\n\n return {\n controller,\n resolve: resolveFunc,\n }\n}\n\nexport const _newOrchestratorRegistry = (): {\n store: Readonly<Ref<OrchestratorStoreObject>>\n _isToastAppend: Readonly<Ref<boolean>>\n _setToastAppend: (value: boolean) => void\n _isOrchestratorInstalled: Readonly<Ref<boolean>>\n _setOrchestratorInstalled: (value: boolean) => void\n} => {\n const _isOrchestratorInstalled = ref(false)\n const _isToastAppend = ref(false)\n\n return {\n store: ref({\n modal: new Map(),\n tooltip: new Map(),\n popover: new Map(),\n toast: new Map(),\n }),\n _isOrchestratorInstalled: readonly(_isOrchestratorInstalled),\n _setOrchestratorInstalled: (v) => {\n _isOrchestratorInstalled.value = v\n },\n _isToastAppend: readonly(_isToastAppend),\n _setToastAppend: (v) => {\n _isToastAppend.value = v\n },\n }\n}\n\nexport const useOrchestratorRegistry = () => {\n const orchestratorRegistry = inject(orchestratorRegistryKey, null)\n\n if (orchestratorRegistry) {\n return orchestratorRegistry\n }\n const newOrchestratorRegistry = _newOrchestratorRegistry()\n provide(orchestratorRegistryKey, newOrchestratorRegistry)\n return newOrchestratorRegistry\n}\n\nexport const getOrchestratorControllerId = (propId: string | undefined) => {\n const id: ControllerKey = propId || Symbol('OrchestratorItem')\n\n return {\n /**\n * This id is used for stability in the store, using the createIdWatcher will update the store if the id ever changes\n */\n storeId: id,\n /**\n * Do not pass in the symbol as a prop. Html attribute cannot be a symbol. Thus it's internal\n */\n htmlAttributeId: typeof id === 'string' ? id : undefined,\n }\n}\n"],"mappings":";;;AASA,IAAa,mBAIX,IACA,UACyE;CACzE,IAAI,oBAAyD,CAAC;CAE9D,MAAM,cAAc,IAAI,SAA6B,YAAY;EAC/D,cAAc;CAChB,CAAC;CAOD,MAAM,iBAAiB,MAAM,MAAM,IAAI,EAAE;CAEzC,MAAM,aAAa;EACjB;EACA,KAAK;EACL,MAAM,OAAO;GAEX,IAD0B,WAAW,IAAI,CAAC,EAAE,MAAM,MAAM,YACjC;IACrB,MAAM,QAAQ,MAAM;IACpB,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG,GACxC,OAAO,eAAe,WAAW,QACpC,CAAC;GACH;GACA,MAAM,iBAAiB,WAAW;GAClC,IACE,mBAAmB,QACnB,UAAU,kBACV,OAAO,eAAe,SAAS,YAE/B,eAAe,KAAK;QAEpB,WAAW,IAAI,EAAC,YAAY,KAAI,CAAC;GAEnC,MAAM,QAAQ,MAAM;GACpB,OAAO,OAAO,OAAO,OAAO,OAAO,K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AAQ;EACnC;EACA,gBAAgB,SAAS,cAAc;EACvC,kBAAkB,MAAM;GACtB,eAAe,QAAQ;EACzB;CACF;AACF;AAEA,IAAa,gCAAgC;CAC3C,MAAM,uBAAuB,OAAO,yBAAyB,IAAI;CAEjE,IAAI,sBACF,OAAO;CAET,MAAM,0BAA0B,yBAAyB;CACzD,QAAQ,yBAAyB,uBAAuB;CACxD,OAAO;AACT;AAEA,IAAa,+BAA+B,WAA+B;CACzE,MAAM,KAAoB,UAAU,OAAO,kBAAkB;CAE7D,OAAO;;;;EAIL,SAAS;;;;EAIT,iBAAiB,OAAO,OAAO,WAAW,KAAK,KAAA;CACjD;AACF"}
@@ -1,4 +1,4 @@
1
- export type SelectValue = boolean | string | readonly unknown[] | Readonly<Record<string, unknown>> | number | null;
1
+ export type SelectValue = string | boolean | readonly unknown[] | Readonly<Record<string, unknown>> | number | null;
2
2
  export interface SelectOption<T = unknown> {
3
3
  value: T;
4
4
  text?: string;
@@ -1,4 +1,4 @@
1
- export type SelectValue = boolean | string | readonly unknown[] | Readonly<Record<string, unknown>> | number | null;
1
+ export type SelectValue = string | boolean | readonly unknown[] | Readonly<Record<string, unknown>> | number | null;
2
2
  export interface SelectOption<T = unknown> {
3
3
  value: T;
4
4
  text?: string;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "bootstrap-vue-next",
3
3
  "displayName": "BootstrapVueNext",
4
4
  "description": "Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development",
5
- "version": "1.0.0",
5
+ "version": "1.0.2",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "main": "./dist/bootstrap-vue-next.mjs",