From f13c9cdb0d8585ef16ee8d9416d38aa630bd1d73 Mon Sep 17 00:00:00 2001 From: Shevchik Igor Date: Mon, 11 May 2026 14:57:49 +0300 Subject: [PATCH] feat(NavigationMenu): add item.color forwarded to leading Avatar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds `color?: AvatarProps['color']` to `NavigationMenuItem` and forwards it as the default `color` to the item's leading `B24Avatar`. Explicit `item.avatar.color` still wins, since `v-bind="item.avatar"` is applied after `:color="item.color"`. No host-level color is introduced (`navigation-menu.ts` keeps the `@memo remove color` direction) — the new prop only tints the inner Avatar. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../docs/2.components/navigation-menu.md | 1 + src/runtime/components/NavigationMenu.vue | 5 ++++ test/components/NavigationMenu.spec.ts | 1 + .../NavigationMenu-vue.spec.ts.snap | 27 +++++++++++++++++++ .../__snapshots__/NavigationMenu.spec.ts.snap | 27 +++++++++++++++++++ 5 files changed, 61 insertions(+) diff --git a/docs/content/docs/2.components/navigation-menu.md b/docs/content/docs/2.components/navigation-menu.md index 80b52bd98..2bbbd34d8 100644 --- a/docs/content/docs/2.components/navigation-menu.md +++ b/docs/content/docs/2.components/navigation-menu.md @@ -79,6 +79,7 @@ Use the `items` prop as an array of objects with the following properties: - `label?: string`{lang="ts-type"} - `icon?: IconComponent`{lang="ts-type"} - `avatar?: AvatarProps`{lang="ts-type"} +- `color?: AvatarProps['color']`{lang="ts-type"} - `badge?: string | number | BadgeProps`{lang="ts-type"} - [`chip?: boolean | ChipProps`{lang="ts-type"}](#with-chip-in-items) - `hint?: string`{lang="ts-type"} diff --git a/src/runtime/components/NavigationMenu.vue b/src/runtime/components/NavigationMenu.vue index eb56304c6..7a22e4a88 100644 --- a/src/runtime/components/NavigationMenu.vue +++ b/src/runtime/components/NavigationMenu.vue @@ -32,6 +32,10 @@ export interface NavigationMenuItem extends Omit { ...orientations.map((orientation: string) => [`with content orientation ${orientation}`, { props: { ...props, orientation } }]), [`with def`, { props: { ...props } }], ['with chip', { props: { items: [[{ label: 'Guide', icon: Cross30Icon, chip: true }, { label: 'Components', icon: SignIcon, chip: { color: 'air-primary' } }]] } }], + ['with item color', { props: { items: [[{ label: 'Engineer', avatar: { src: 'https://github.com/bitrix24.png' }, color: 'air-primary' as const }, { label: 'Designer', avatar: { src: 'https://github.com/bitrix24.png' }, color: 'air-primary-success' as const }]], orientation: 'vertical' as const } }], ['with trailingIcon', { props: { ...props, trailingIcon: SignIcon } }], ['with externalIcon', { props: { ...props, externalIcon: Cross30Icon } }], ['without externalIcon', { props: { ...props, externalIcon: false } }], diff --git a/test/components/__snapshots__/NavigationMenu-vue.spec.ts.snap b/test/components/__snapshots__/NavigationMenu-vue.spec.ts.snap index 201c9ec05..efbd2bcbd 100644 --- a/test/components/__snapshots__/NavigationMenu-vue.spec.ts.snap +++ b/test/components/__snapshots__/NavigationMenu-vue.spec.ts.snap @@ -621,6 +621,33 @@ exports[`NavigationMenu > renders with externalIcon correctly 1`] = ` " `; +exports[`NavigationMenu > renders with item color correctly 1`] = ` +"" +`; + exports[`NavigationMenu > renders with item slot correctly 1`] = ` "" `; +exports[`NavigationMenu > renders with item color correctly 1`] = ` +"" +`; + exports[`NavigationMenu > renders with item slot correctly 1`] = ` "