diff --git a/playground/pages/navigation-menu.vue b/playground/pages/navigation-menu.vue index 2d1359bd..b233489b 100644 --- a/playground/pages/navigation-menu.vue +++ b/playground/pages/navigation-menu.vue @@ -86,6 +86,14 @@ const items = [ - + diff --git a/src/theme/navigation-menu.ts b/src/theme/navigation-menu.ts index 027291d9..0b13f61c 100644 --- a/src/theme/navigation-menu.ts +++ b/src/theme/navigation-menu.ts @@ -22,9 +22,9 @@ export default (config: { colors: string[] }) => ({ separator: 'px-2 h-px bg-gray-200 dark:bg-gray-800', viewportWrapper: 'absolute top-full inset-x-0 flex w-full', // FIXME: add `sm:w-[var(--radix-navigation-menu-viewport-width)]` / `transition-[width,height]` / `origin-[top_center]` once position is based on trigger - viewport: 'relative overflow-hidden mt-2.5 bg-white dark:bg-gray-900 shadow-lg rounded-md ring ring-gray-200 dark:ring-gray-800 will-change-[transform,opacity] h-[--radix-navigation-menu-viewport-height] w-full data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]', + viewport: 'relative overflow-hidden bg-white dark:bg-gray-900 shadow-lg rounded-md ring ring-gray-200 dark:ring-gray-800 will-change-[transform,opacity] h-[--radix-navigation-menu-viewport-height] w-full data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in]', content: 'absolute top-0 left-0 w-full data-[motion=from-start]:animate-[enter-from-left_200ms_ease] data-[motion=from-end]:animate-[enter-from-right_200ms_ease] data-[motion=to-start]:animate-[exit-to-left_200ms_ease] data-[motion=to-end]:animate-[exit-to-right_200ms_ease]', - indicator: 'data-[state=visible]:animate-[fade-in_100ms_ease-out] data-[state=hidden]:animate-[fade-out_100ms_ease-in] top-full z-[1] flex h-2.5 items-end justify-center overflow-hidden transition-transform duration-200 ease-out', + indicator: 'data-[state=visible]:animate-[fade-in_100ms_ease-out] data-[state=hidden]:animate-[fade-out_100ms_ease-in] bottom-0 z-[1] flex h-2.5 items-end justify-center overflow-hidden transition-transform duration-200 ease-out', arrow: 'relative top-[50%] size-2.5 rotate-45 border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 z-[1] rounded-sm' }, variants: { @@ -41,6 +41,7 @@ export default (config: { colors: string[] }) => ({ horizontal: { root: 'w-full items-center justify-between', list: 'flex items-center', + item: 'py-2', link: 'px-2.5 py-1.5 before:inset-x-px before:inset-y-0' }, vertical: { @@ -73,13 +74,14 @@ export default (config: { colors: string[] }) => ({ variant: 'line', orientation: 'horizontal', class: { - link: 'after:absolute after:-bottom-2 after:inset-x-2.5 after:block after:h-0.5 after:rounded-full' + link: 'after:absolute after:-bottom-[calc(var(--spacing-2)+1px)] after:inset-x-2.5 after:block after:h-0.5 after:rounded-full' } }, { variant: 'line', orientation: 'vertical', class: { - link: 'after:absolute after:-left-2 after:inset-y-0.5 after:block after:w-0.5 after:rounded-full' + item: 'px-2', + link: 'after:absolute after:-left-[calc(var(--spacing-2)+1px)] after:inset-y-0.5 after:block after:w-0.5 after:rounded-full' } }, { disabled: false, diff --git a/test/components/__snapshots__/NavigationMenu.spec.ts.snap b/test/components/__snapshots__/NavigationMenu.spec.ts.snap index 2c838da4..4833ce10 100644 --- a/test/components/__snapshots__/NavigationMenu.spec.ts.snap +++ b/test/components/__snapshots__/NavigationMenu.spec.ts.snap @@ -4,13 +4,13 @@ exports[`NavigationMenu > renders with arrow correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -21,12 +21,12 @@ exports[`NavigationMenu > renders with arrow correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -47,13 +47,13 @@ exports[`NavigationMenu > renders with class correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -64,12 +64,12 @@ exports[`NavigationMenu > renders with class correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -88,13 +88,13 @@ exports[`NavigationMenu > renders with color black correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -105,12 +105,12 @@ exports[`NavigationMenu > renders with color black correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -129,13 +129,13 @@ exports[`NavigationMenu > renders with color green correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -146,12 +146,12 @@ exports[`NavigationMenu > renders with color green correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -170,13 +170,13 @@ exports[`NavigationMenu > renders with color primary correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -187,12 +187,12 @@ exports[`NavigationMenu > renders with color primary correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -211,13 +211,13 @@ exports[`NavigationMenu > renders with color red correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -228,12 +228,12 @@ exports[`NavigationMenu > renders with color red correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -252,13 +252,13 @@ exports[`NavigationMenu > renders with custom slot correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -269,12 +269,12 @@ exports[`NavigationMenu > renders with custom slot correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -293,13 +293,13 @@ exports[`NavigationMenu > renders with item slot correctly 1`] = ` " - Item slot + Item slot - Item slot + Item slot @@ -310,10 +310,10 @@ exports[`NavigationMenu > renders with item slot correctly 1`] = ` - Item slot + Item slot - Item slot + Item slot @@ -330,13 +330,13 @@ exports[`NavigationMenu > renders with item-label slot correctly 1`] = ` " - Item label slot + Item label slot - Item label slot + Item label slot @@ -347,12 +347,12 @@ exports[`NavigationMenu > renders with item-label slot correctly 1`] = ` - Item label slot + Item label slot - Item label slot + Item label slot @@ -371,13 +371,13 @@ exports[`NavigationMenu > renders with item-leading slot correctly 1`] = ` " - Item leading slotDocumentation + Item leading slotDocumentation - Item leading slotComponents + Item leading slotComponents @@ -388,12 +388,12 @@ exports[`NavigationMenu > renders with item-leading slot correctly 1`] = ` - Item leading slotGitHub + Item leading slotGitHub - Item leading slotHelp + Item leading slotHelp @@ -412,13 +412,13 @@ exports[`NavigationMenu > renders with item-trailing slot correctly 1`] = ` " - DocumentationItem trailing slot + DocumentationItem trailing slot - ComponentsItem trailing slot + ComponentsItem trailing slot @@ -429,10 +429,10 @@ exports[`NavigationMenu > renders with item-trailing slot correctly 1`] = ` - GitHubItem trailing slot + GitHubItem trailing slot - HelpItem trailing slot + HelpItem trailing slot @@ -449,13 +449,13 @@ exports[`NavigationMenu > renders with items correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -466,12 +466,12 @@ exports[`NavigationMenu > renders with items correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -528,13 +528,13 @@ exports[`NavigationMenu > renders with trailingIcon correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -545,12 +545,12 @@ exports[`NavigationMenu > renders with trailingIcon correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -569,13 +569,13 @@ exports[`NavigationMenu > renders with ui correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -586,12 +586,12 @@ exports[`NavigationMenu > renders with ui correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -610,13 +610,13 @@ exports[`NavigationMenu > renders with variant line correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -627,12 +627,12 @@ exports[`NavigationMenu > renders with variant line correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -651,13 +651,13 @@ exports[`NavigationMenu > renders with variant link correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -668,12 +668,12 @@ exports[`NavigationMenu > renders with variant link correctly 1`] = ` - GitHub + GitHub - Help + Help @@ -692,13 +692,13 @@ exports[`NavigationMenu > renders with variant pill correctly 1`] = ` " - Documentation + Documentation - Components + Components @@ -709,12 +709,12 @@ exports[`NavigationMenu > renders with variant pill correctly 1`] = ` - GitHub + GitHub - Help + Help