diff --git a/.changeset/moody-taxis-chew.md b/.changeset/moody-taxis-chew.md new file mode 100644 index 000000000..abf42b024 --- /dev/null +++ b/.changeset/moody-taxis-chew.md @@ -0,0 +1,5 @@ +--- +"sit-onyx": patch +--- + +fix(OnyxNavItem): fix styles for selected child items diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxMobileNavButton/Mobile-nav-button-chromium-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxMobileNavButton/Mobile-nav-button-chromium-linux.png new file mode 100644 index 000000000..e9064942c Binary files /dev/null and b/packages/sit-onyx/playwright/snapshots/components/OnyxMobileNavButton/Mobile-nav-button-chromium-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxMobileNavButton/Mobile-nav-button-firefox-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxMobileNavButton/Mobile-nav-button-firefox-linux.png new file mode 100644 index 000000000..20e1f000b Binary files /dev/null and b/packages/sit-onyx/playwright/snapshots/components/OnyxMobileNavButton/Mobile-nav-button-firefox-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxMobileNavButton/Mobile-nav-button-webkit-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxMobileNavButton/Mobile-nav-button-webkit-linux.png new file mode 100644 index 000000000..7c5e052e2 Binary files /dev/null and b/packages/sit-onyx/playwright/snapshots/components/OnyxMobileNavButton/Mobile-nav-button-webkit-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-chromium-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-chromium-linux.png index bf27985d3..3123d7056 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-chromium-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-chromium-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-firefox-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-firefox-linux.png index b6940dc70..fdc72c6ea 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-firefox-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-firefox-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-webkit-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-webkit-linux.png index 69c684c61..3b76f38ad 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-webkit-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavAppArea/Nav-app-area-webkit-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--chromium-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--chromium-linux.png index 16aba0934..674f36f54 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--chromium-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--chromium-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--firefox-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--firefox-linux.png index 60d4622f6..1c5415888 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--firefox-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--firefox-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--webkit-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--webkit-linux.png index 35259490b..afdfb2d50 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--webkit-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-2xs--webkit-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-lg--webkit-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-lg--webkit-linux.png index 831c1f315..3dfeb1465 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-lg--webkit-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-lg--webkit-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-md--webkit-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-md--webkit-linux.png index 7fff6e1fe..7645ab386 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-md--webkit-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-md--webkit-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-sm--webkit-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-sm--webkit-linux.png index 2c39dc7aa..beda714fa 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-sm--webkit-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-sm--webkit-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xl--webkit-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xl--webkit-linux.png index c87e7287c..e8c8e80ed 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xl--webkit-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xl--webkit-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--chromium-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--chromium-linux.png index 97a03fa16..dd82a65c4 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--chromium-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--chromium-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--firefox-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--firefox-linux.png index 61692b742..2b558a592 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--firefox-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--firefox-linux.png differ diff --git a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--webkit-linux.png b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--webkit-linux.png index e5acce10b..05fb40240 100644 Binary files a/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--webkit-linux.png and b/packages/sit-onyx/playwright/snapshots/components/OnyxNavBar/Navigation-bar-xs--webkit-linux.png differ diff --git a/packages/sit-onyx/src/components/OnyxMobileNavButton/OnyxMobileNavButton.ct.tsx b/packages/sit-onyx/src/components/OnyxMobileNavButton/OnyxMobileNavButton.ct.tsx new file mode 100644 index 000000000..62afc114f --- /dev/null +++ b/packages/sit-onyx/src/components/OnyxMobileNavButton/OnyxMobileNavButton.ct.tsx @@ -0,0 +1,23 @@ +import { test } from "../../playwright/a11y"; +import { executeMatrixScreenshotTest, mockPlaywrightIcon } from "../../playwright/screenshots"; +import OnyxMobileNavButton from "./OnyxMobileNavButton.vue"; + +test.describe("Screenshot tests", () => { + executeMatrixScreenshotTest({ + name: "Mobile nav button", + columns: ["default", "open"], + rows: ["default", "hover", "active", "focus-visible"], + component: (column) => ( + + ), + beforeScreenshot: async (component, page, column, row) => { + if (row === "hover") await component.hover(); + if (row === "focus-visible") await page.keyboard.press("Tab"); + if (row === "active") { + const box = (await component.boundingBox())!; + await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2); + await page.mouse.down(); + } + }, + }); +}); diff --git a/packages/sit-onyx/src/components/OnyxMobileNavButton/OnyxMobileNavButton.stories.ts b/packages/sit-onyx/src/components/OnyxMobileNavButton/OnyxMobileNavButton.stories.ts new file mode 100644 index 000000000..19ff97943 --- /dev/null +++ b/packages/sit-onyx/src/components/OnyxMobileNavButton/OnyxMobileNavButton.stories.ts @@ -0,0 +1,37 @@ +import menu from "@sit-onyx/icons/menu.svg?raw"; +import { defineStorybookActionsAndVModels } from "@sit-onyx/storybook-utils"; +import type { Meta, StoryObj } from "@storybook/vue3"; +import { defineIconSelectArgType } from "../../utils/storybook"; +import OnyxMobileNavButton from "./OnyxMobileNavButton.vue"; + +/** + * Nav button that is mainly used inside the nav bar on mobile, e.g. for the burger and context menu buttons. + */ +const meta: Meta = { + title: "support/MobileNavButton", + ...defineStorybookActionsAndVModels({ + component: OnyxMobileNavButton, + events: ["update:open"], + argTypes: { + icon: defineIconSelectArgType(), + }, + }), +}; + +export default meta; +type Story = StoryObj; + +export const Default = { + args: { + label: "Open burger menu", + icon: menu, + }, +} satisfies Story; + +export const Open = { + args: { + label: "Close burger menu", + icon: menu, + open: true, + }, +} satisfies Story; diff --git a/packages/sit-onyx/src/components/OnyxMobileNavButton/OnyxMobileNavButton.vue b/packages/sit-onyx/src/components/OnyxMobileNavButton/OnyxMobileNavButton.vue new file mode 100644 index 000000000..94d7ad635 --- /dev/null +++ b/packages/sit-onyx/src/components/OnyxMobileNavButton/OnyxMobileNavButton.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/packages/sit-onyx/src/components/OnyxMobileNavButton/types.ts b/packages/sit-onyx/src/components/OnyxMobileNavButton/types.ts new file mode 100644 index 000000000..3835fbb41 --- /dev/null +++ b/packages/sit-onyx/src/components/OnyxMobileNavButton/types.ts @@ -0,0 +1,15 @@ +export type OnyxMobileNavButtonProps = { + /** + * Aria label that describes the action when clicking the button. + */ + label: string; + /** + * Icon to show when closed. + */ + icon: string; + /** + * Whether the button is considered open / is connected to an open menu/flyout. + * If `true`, an "x" icon will be displayed. + */ + open?: boolean; +}; diff --git a/packages/sit-onyx/src/components/OnyxNavAppArea/OnyxNavAppArea.vue b/packages/sit-onyx/src/components/OnyxNavAppArea/OnyxNavAppArea.vue index 39d81e013..5bb85e89c 100644 --- a/packages/sit-onyx/src/components/OnyxNavAppArea/OnyxNavAppArea.vue +++ b/packages/sit-onyx/src/components/OnyxNavAppArea/OnyxNavAppArea.vue @@ -59,7 +59,6 @@ const buttonLabel = computed(() => props.label ?? t.value("navigation.goToHome") align-items: center; gap: var(--onyx-spacing-md); padding: var(--onyx-spacing-md); - border-right: var(--onyx-1px-in-rem) solid var(--onyx-color-base-neutral-300); font-weight: 600; white-space: pre-line; max-height: 100%; diff --git a/packages/sit-onyx/src/components/OnyxNavBar/OnyxNavBar.ct.tsx b/packages/sit-onyx/src/components/OnyxNavBar/OnyxNavBar.ct.tsx index 5b9efab1e..74053fc61 100644 --- a/packages/sit-onyx/src/components/OnyxNavBar/OnyxNavBar.ct.tsx +++ b/packages/sit-onyx/src/components/OnyxNavBar/OnyxNavBar.ct.tsx @@ -32,6 +32,8 @@ test.describe("Screenshot tests", () => { + + {row.includes("context") && (