Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion apps/docs/src/data/components/navbar.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ export default {
description:
"Set to 'top' for fixed to the top of the viewport, or 'bottom' for fixed to the bottom of the viewport",
},
noAutoClose: {
type: 'boolean',
default: false,
description: 'Disable auto-closing of the navbar when a child component is clicked',
},
print: {
type: 'boolean',
default: false,
Expand All @@ -46,7 +51,7 @@ export default {
default: 'nav',
},
}),
['autoClose', 'tag', 'variant']
['tag', 'variant']
),
} satisfies Record<keyof BvnComponentProps['BNavbar'], PropertyReference>,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const navbarData = inject(navbarInjectionKey, null)
// Pretty sure this emits if computedTag is not button and is disabled
const clicked = (e: Readonly<MouseEvent>): void => {
emit('click', e)
if (navbarData !== null && navbarData?.autoClose?.value === true) {
if (navbarData !== null && navbarData?.noAutoClose?.value !== true) {
collapseData?.hide?.()
}
dropdownData?.hide?.()
Expand Down
2 changes: 1 addition & 1 deletion packages/bootstrap-vue-next/src/components/BLink/BLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const clicked = (e: Readonly<MouseEvent>): void => {

if (
(collapseData?.isNav?.value === true && navbarData === null) ||
(navbarData !== null && navbarData.autoClose?.value === true)
(navbarData !== null && navbarData.noAutoClose?.value !== true)
) {
collapseData?.hide?.()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import {navbarInjectionKey} from '../../utils/keys'
import {useColorVariantClasses} from '../../composables/useColorVariantClasses'

const _props = withDefaults(defineProps<BNavbarProps>(), {
autoClose: true,
container: 'fluid',
fixed: undefined,
noAutoClose: false,
print: false,
sticky: undefined,
tag: 'nav',
Expand Down Expand Up @@ -54,6 +54,6 @@ const computedClasses = computed(() => [

provide(navbarInjectionKey, {
tag: toRef(() => props.tag),
autoClose: toRef(() => props.autoClose),
noAutoClose: toRef(() => props.noAutoClose),
})
</script>
2 changes: 1 addition & 1 deletion packages/bootstrap-vue-next/src/types/ComponentProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,9 @@ export interface BNavTextProps {
}

export interface BNavbarProps {
autoClose?: boolean
container?: boolean | 'fluid' | Breakpoint
fixed?: Extract<Placement, 'top' | 'bottom'>
noAutoClose?: boolean
print?: boolean
sticky?: Extract<Placement, 'top' | 'bottom'>
tag?: string
Expand Down
2 changes: 1 addition & 1 deletion packages/bootstrap-vue-next/src/utils/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export const dropdownInjectionKey: InjectionKey<{

export const navbarInjectionKey: InjectionKey<{
tag?: Readonly<Ref<string>>
autoClose?: Readonly<Ref<boolean>>
noAutoClose?: Readonly<Ref<boolean>>
}> = createBvnInjectionKey('navbar')

export const rtlPluginKey: InjectionKey<{
Expand Down