@nswds/ui 5.5.4 → 5.7.0
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.
- package/README.md +46 -5
- package/dist/components/breadcrumb.d.ts +10 -0
- package/dist/components/breadcrumb.js +0 -2
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/carousel.d.ts +15 -3
- package/dist/components/carousel.js +100 -16
- package/dist/components/carousel.js.map +1 -1
- package/dist/components/combobox.d.ts +8 -1
- package/dist/components/combobox.js +2 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/main-nav.d.ts +4 -1
- package/dist/components/main-nav.js.map +1 -1
- package/dist/components/sheet.d.ts +6 -1
- package/dist/components/sheet.js +2 -1
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/tabs.d.ts +6 -3
- package/dist/components/tabs.js +90 -23
- package/dist/components/tabs.js.map +1 -1
- package/dist/hooks/use-chrome-height.d.ts +4 -1
- package/dist/hooks/use-chrome-height.js +39 -4
- package/dist/hooks/use-chrome-height.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/main-nav.tsx"],"names":[],"mappings":";;;;;;;AAoCA,MAAM,aAAA,GAAgB;AAAA,EACpB,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF;AAMA,MAAM,sBAAA,GAAuC,OAAA;AAE7C,MAAM,eAAA,GAAkB,GAAA;AAAA,EACtB;AAAA,IACE,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUA;AAAA,GACF;AAAA,EACA;AAAA,I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AA,gBAJK,GAAG,IAAA,CAAK,KAAK,CAAA,CAAA,EAAI,IAAA,CAAK,QAAQ,SAAS,CAAA;AAAA,eAM/C,CAAA,EACH;AAAA;AAAA,WACF,EACF;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ","file":"main-nav.js","sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport React from 'react'\n\nimport { IconEast } from '../icons/east.js'\nimport { cn } from '../lib/utils.js'\n\nimport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n} from '../components/navigation-menu.js'\n\n/**\n * Surface colours the main navigation can be themed with — exactly the\n * Footer's thirteen-name vocabulary, so a service that themes its footer\n * `primary-800` writes the same word here. Each name is the LIGHT-mode\n * surface; dark mode deepens it onto the same family's dark steps (see the\n * `color` variants below), so `color` expresses tonal weight rather than a\n * literal colour.\n *\n * The bar's text/background pairs are identical to the Footer's, so its\n * contrast conclusions carry over verbatim: every light pair clears WCAG 2.2\n * AA (1.4.3, 4.5:1) for the bar's text and 11 of the 13 also clear AAA\n * (1.4.6, 7:1). The two AA-only pairs are `primary-600` (4.57:1) and\n * `accent-600` (5.18:1), both with white ink; prefer the `-800` steps when a\n * service is held to AAA. In dark mode all thirteen clear AAA (worst 13.6:1).\n *\n * The mega panels always render on the house popup surface (`bg-popover`),\n * matching the nswds-app source where every dropdown was white regardless of\n * bar colour — only the panel's accent ink follows the colour family.\n */\nconst mainNavColors = [\n 'primary-800',\n 'primary-600',\n 'primary-400',\n 'primary-200',\n 'grey-800',\n 'grey-600',\n 'grey-400',\n 'grey-200',\n 'accent-800',\n 'accent-600',\n 'accent-400',\n 'accent-200',\n 'white',\n] as const\n\ntype MainNavColor = (typeof mainNavColors)[number]\n\n// Shared by cva's defaultVariants, the data-color attribute and the panel\n// variant lookup, so the three can't drift apart.\nconst DEFAULT_MAIN_NAV_COLOR: MainNavColor = 'white'\n\nconst mainNavVariants = cva(\n [\n 'w-full',\n // Every derived colour on the bar resolves from a single --main-nav-ink\n // token, so a colour variant only has to declare the surface utilities and\n // that one value — this replaces the nswds-app source's hand-written\n // 13-variant × 8-slot style table. The border derivation is written\n // literally here (once) rather than per-variant: Tailwind scans source\n // text for class names, so a template-built arbitrary property would\n // never be emitted. Hover/active halos are not derived here — the\n // triggers ride navigation-menu.tsx's --nav-menu-halo chain, re-pointed\n // at this ink (see mainNavItemInk), so there is exactly one halo recipe.\n '[--main-nav-border:color-mix(in_oklch,var(--main-nav-ink)_15%,transparent)]',\n ],\n {\n variants: {\n // Ink values use the RAW masterbrand tokens (--primary-800, --grey-800,\n // --accent-800) rather than Tailwind's --color-* bridge aliases. Tailwind\n // v4 tree-shakes an unreferenced @theme key, and referencing one from\n // inside an arbitrary property is not a usage signal — the raw tokens are\n // plain :root declarations from @nswds/tokens and always resolve.\n // (--color-white is safe: `text-white` / `bg-white` below are real\n // utilities, so that key is always emitted.)\n //\n // Dark mode deepens every surface onto the same family's dark steps —\n // -800→-950, -600→-900, -400→-850, -200→-800, white→grey-900 — the\n // Footer's exact mapping, so the luminance ORDER within a family is\n // preserved and a stacked Footer + MainNav sharing one colour word stay\n // in step in both themes. Ink goes white on all thirteen; every dark\n // pair is WCAG 2.2 AAA (worst 13.6:1).\n color: {\n 'primary-800':\n 'bg-primary-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-primary-950',\n 'primary-600':\n 'bg-primary-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-primary-900',\n 'primary-400':\n 'bg-primary-400 text-primary-800 [--main-nav-ink:var(--primary-800)] dark:bg-primary-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'primary-200':\n 'bg-primary-200 text-primary-800 [--main-nav-ink:var(--primary-800)] dark:bg-primary-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'grey-800': 'bg-grey-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-grey-950',\n 'grey-600': 'bg-grey-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-grey-900',\n 'grey-400':\n 'bg-grey-400 text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'grey-200':\n 'bg-grey-200 text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'accent-800':\n 'bg-accent-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-accent-950',\n 'accent-600':\n 'bg-accent-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-accent-900',\n 'accent-400':\n 'bg-accent-400 text-accent-800 [--main-nav-ink:var(--accent-800)] dark:bg-accent-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'accent-200':\n 'bg-accent-200 text-accent-800 [--main-nav-ink:var(--accent-800)] dark:bg-accent-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n white:\n 'bg-white text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-900 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n },\n // Rules along the bar's edges, drawn from the ink-derived border token so\n // they follow every colour variant and both themes. Replaces the app\n // source's deprecated showTopBorder/showBottomBorder booleans, which are\n // deliberately not ported.\n border: {\n none: '',\n top: 'border-t border-(--main-nav-border)',\n bottom: 'border-b border-(--main-nav-border)',\n both: 'border-y border-(--main-nav-border)',\n },\n },\n defaultVariants: {\n color: DEFAULT_MAIN_NAV_COLOR,\n border: 'none',\n },\n },\n)\n\nconst mainNavContainerVariants = cva(\n [\n 'mx-auto flex w-full items-center',\n // Lateral padding funnels through --main-nav-padding-x so an app can\n // retune it once (via the `style` prop or a utility class) without a new\n // variant. Same mechanism, and the same 16px → 24px → 48px rhythm, as\n // Masthead, Header and Footer.\n 'px-(--main-nav-padding-x)',\n '[--main-nav-padding-x:--spacing(4)] sm:[--main-nav-padding-x:--spacing(6)] lg:[--main-nav-padding-x:--spacing(12)]',\n ],\n {\n variants: {\n container: {\n // Full-bleed (nswds-app fullBleed parity). --main-nav-max-width is\n // still read so a shell app can constrain the inner wrapper without\n // switching variants.\n fluid: 'max-w-[var(--main-nav-max-width,none)]',\n // Centred content column, legacy nsw-container parity (1200px).\n contained: 'max-w-[var(--main-nav-max-width,75rem)]',\n },\n },\n defaultVariants: {\n container: 'fluid',\n },\n },\n)\n\n/**\n * Mega-panel accent ink, keyed by the same thirteen colour names as the bar.\n * The panel itself is always the house popup surface (`bg-popover`, white in\n * light mode) — parity with the app source, whose dropdown was white for\n * every variant — so the family only tints the featured lead link, hover ink\n * and cell borders. Declared on the Content element (not inherited from the\n * bar) because Base UI portals the panel to `document.body`: a custom\n * property set on the `<nav>` can never reach it.\n *\n * Light inks are the family's -800 step on white — grey-800 on white is\n * 15.1:1 and white on primary-800 is 14.4:1 (both AAA; contrast is symmetric,\n * ratios from header.tsx); accent-800 on white clears AAA per the Footer's\n * verified pairs. Dark inks step to the family's -200 — the same dark-mode\n * interactive ink link.tsx and navigation-menu.tsx already use on this\n * popover surface. The featured lead is text-xl bold, so even the softest\n * pair is far above the large-text AA floor (1.4.3, 3:1).\n */\nconst mainNavPanelVariants = cva(\n [\n 'p-0 whitespace-normal',\n // The sibling Content (and the shared popup, via popupClassName below)\n // cap themselves at --available-width, which Base UI measures from the\n // active trigger — for a mid-bar trigger that is less than the nav's\n // width, which would shrink right-hand panels. The panel's width is\n // container-measured and can never exceed the viewport, so the cap is\n // safely lifted.\n 'max-w-none',\n '[--main-nav-panel-border:color-mix(in_oklch,var(--main-nav-panel-ink)_15%,transparent)]',\n ],\n {\n variants: {\n color: {\n 'primary-800':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-600':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-400':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-200':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'grey-800':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-600':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-400':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-200':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'accent-800':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-600':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-400':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-200':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n white: '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n },\n },\n defaultVariants: {\n color: DEFAULT_MAIN_NAV_COLOR,\n },\n },\n)\n\n// Re-points the sibling navigation-menu's ink at the bar's surface ink. The\n// trigger/link halos and focus outlines in navigation-menu.tsx all derive\n// from --nav-menu-ink via color-mix ON THE SAME ELEMENT, so overriding the\n// one token retargets the whole chain: hover/active halos and the\n// focus-visible outline become surface-relative, guaranteeing the indicator\n// contrasts on all thirteen surfaces (WCAG 2.2, 2.4.13 Focus Appearance).\n// Both light and dark are overridden because the sibling pins its own\n// dark-mode ink (primary-200); --main-nav-ink is already theme-aware.\nconst mainNavItemInk =\n '[--nav-menu-ink:var(--main-nav-ink)] dark:[--nav-menu-ink:var(--main-nav-ink)]'\n\n// Same re-point for links INSIDE the portalled panel, where the bar's ink\n// cannot reach — these derive from the panel accent ink instead.\nconst mainNavPanelInk =\n '[--nav-menu-ink:var(--main-nav-panel-ink)] dark:[--nav-menu-ink:var(--main-nav-panel-ink)]'\n\n// Restyles the sibling trigger to the app source's bar metrics: 56px min\n// height, square corners, bold base text, wider gutters from lg up. The open\n// panel is marked with the app's 4px inset underline (data-popup-open comes\n// from Base UI); data-current draws the same underline persistently when\n// `currentHref` falls inside this section, so the underline means \"you are\n// here\" at rest and \"this panel is open\" during use.\nconst mainNavTriggerClassName = [\n mainNavItemInk,\n 'mb-0 h-auto min-h-14 w-auto justify-start rounded-none max-lg:px-4 py-2 text-base leading-6 font-bold text-(--main-nav-ink)',\n 'lg:px-8',\n '[&_svg]:size-6',\n // Inset focus ring: the sibling list is a horizontal scroll container, and\n // a scroll container clips everything drawn outside a child's border box —\n // the house outward `outline-offset-2` would simply vanish on the first and\n // last triggers. Same reasoning (and same fix) as push-menu.tsx's rows.\n 'focus-visible:-outline-offset-2',\n 'data-popup-open:shadow-[inset_0_-4px_0_0_currentColor]',\n 'data-current:shadow-[inset_0_-4px_0_0_currentColor]',\n].join(' ')\n\n// A panel-less item, restyled from the sibling link to sit visually beside\n// the triggers (cn's conflict merge lets these win over the link's stacked\n// defaults). `active` → data-active draws the current-page underline; Base UI\n// pairs it with aria-current='page' on the same element (WCAG 2.4.8).\nconst mainNavTopLinkClassName = [\n mainNavItemInk,\n 'inline-flex min-h-14 flex-row items-center justify-start gap-1 rounded-none max-lg:px-4 py-2 text-base leading-6 font-bold whitespace-nowrap text-(--main-nav-ink)',\n 'lg:px-8',\n // Inset for the same reason as the trigger above — these sit in the\n // scrolling list, not in a portalled panel.\n 'focus-visible:-outline-offset-2',\n 'data-active:shadow-[inset_0_-4px_0_0_currentColor]',\n].join(' ')\n\n// The featured lead link at the top of a mega panel: the section title,\n// oversized, with an east arrow that nudges forward on hover (the app\n// source's exact affordance, on the house easing curve; the nudge is a\n// transition, so motion-reduce users get an instant state change — WCAG\n// 2.3.3). `group` scopes the icon's group-hover to this anchor — the panel is\n// portalled, so no other `group` ancestor can capture it.\nconst mainNavFeaturedLinkClassName = [\n mainNavPanelInk,\n 'group relative flex-row items-center rounded-none px-8 py-8 text-xl font-bold whitespace-normal text-(--main-nav-panel-ink)',\n].join(' ')\n\n// The lead when the section has no `href`: the same visual weight as the\n// featured link, but a plain heading row — no anchor (a dead link announced\n// as a link fails the reader who activates it), no hover halo, and no east\n// arrow (an arrow on a non-link promises navigation that never happens). No\n// mainNavPanelInk re-point either: that chain only feeds interactive halos.\nconst mainNavFeaturedHeadingClassName =\n 'flex flex-row items-center px-8 py-8 text-xl font-bold whitespace-normal text-(--main-nav-panel-ink)'\n\n// One bordered grid cell per section link. The anchor itself is the cell —\n// the app source wrapped a div around a stretched-link span, but making the\n// whole cell the anchor gives the same hit area with one element and no\n// aria-hidden overlay. Cells draw a top hairline from the panel ink; the last\n// grid row closes with a bottom hairline via the app's :nth-last-child(-n+3)\n// selector (tuned to the widest, 3-column layout — at narrower widths the\n// final one or two cells simply carry the closing rule, matching the app).\nconst mainNavSectionLinkClassName = [\n mainNavPanelInk,\n 'relative mx-2 justify-center rounded-none border-t border-(--main-nav-panel-border) p-4 text-base font-semibold whitespace-normal text-popover-foreground',\n 'hover:text-(--main-nav-panel-ink)',\n '[&:nth-last-child(-n+3)]:border-b',\n].join(' ')\n\n/** One link inside a mega panel. */\ntype MainNavLinkItem = {\n /** Visible link text, e.g. \"Find support near you\". */\n title: string\n href: string\n}\n\n/**\n * One top-level navigation item. With `links` it renders as a trigger opening\n * a mega panel (with `href` becoming the panel's featured lead link; without\n * an `href` the lead is a plain heading row — dev builds warn); without\n * `links` it renders as a plain link styled like the triggers. Recursion is\n * deliberately one level deep — mega panels list flat links, per the app\n * source's NavigationSection shape.\n */\ntype MainNavItem = {\n title: string\n href?: string\n links?: MainNavLinkItem[]\n}\n\n/**\n * Dev-only guard, mirroring the icon-only Button check in button.tsx: an item\n * with neither `href` nor `links` renders a dead `\"#\"` link — almost always a\n * data mistake, and a trap for keyboard and screen-reader users who activate\n * it and go nowhere. A section (`links`, no `href`) is legal but demoted —\n * its panel lead renders as a plain heading instead of the featured link —\n * so it gets its own nudge. No-op in production.\n */\nfunction warnIfItemUnlinked(item: MainNavItem) {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n if (!item.href && !item.links?.length) {\n console.warn(\n `[nswds/ui] MainNav item \"${item.title}\" has no href and no links — it will render as a dead \"#\" link.`,\n )\n }\n if (!item.href && item.links?.length) {\n console.warn(\n `[nswds/ui] MainNav section \"${item.title}\" has links but no href — its panel lead renders as a plain heading; pass href to make it a link.`,\n )\n }\n}\n\ntype MainNavMenuItemProps = {\n item: MainNavItem\n color: MainNavColor\n currentHref?: string\n /** Measured container width, forwarded as the panel's inline width. */\n panelWidth: number | null\n}\n\n/**\n * One bar entry: a plain link for items without `links`, a trigger + mega\n * panel for items with them. Internal — the data-driven `MainNav` API is the\n * public surface; compose the navigation-menu primitives directly for layouts\n * this doesn't cover.\n */\nfunction MainNavMenuItem({ item, color, currentHref, panelWidth }: MainNavMenuItemProps) {\n warnIfItemUnlinked(item)\n\n const links = item.links\n const isExactCurrent = item.href !== undefined && item.href === currentHref\n const isSectionCurrent =\n isExactCurrent ||\n (currentHref !== undefined && (links?.some((link) => link.href === currentHref) ?? false))\n\n if (!links?.length) {\n return (\n <NavigationMenuItem className='shrink-0'>\n <NavigationMenuLink\n data-slot='main-nav-top-link'\n href={item.href ?? '#'}\n active={isExactCurrent}\n className={mainNavTopLinkClassName}\n >\n {item.title}\n </NavigationMenuLink>\n </NavigationMenuItem>\n )\n }\n\n return (\n <NavigationMenuItem className='shrink-0'>\n {/* The trigger is a button (it discloses, it doesn't navigate), so it\n can't carry aria-current — data-current draws the visual \"you are\n here\" underline while the aria-current announcement lives on the\n exact matching link inside the panel. */}\n <NavigationMenuTrigger\n data-current={isSectionCurrent || undefined}\n className={mainNavTriggerClassName}\n >\n {item.title}\n </NavigationMenuTrigger>\n {/* Inline width (not a CSS var): the panel is portalled to\n document.body, so a custom property set on the nav can't reach it.\n Before the first measurement resolves the panel falls back to the\n sibling's natural w-max sizing. */}\n <NavigationMenuContent\n data-slot='main-nav-panel'\n className={mainNavPanelVariants({ color })}\n style={panelWidth === null ? undefined : { width: panelWidth }}\n >\n <div className='grid w-full'>\n {/* No section href → no featured LINK: an `href=\"#\"` fallback here\n would be a dead link announced as a link. The heading row keeps\n the lead's visual weight without the anchor, halo or arrow — see\n mainNavFeaturedHeadingClassName. */}\n {item.href === undefined ? (\n <div data-slot='main-nav-featured-heading' className={mainNavFeaturedHeadingClassName}>\n {item.title}\n </div>\n ) : (\n <NavigationMenuLink\n data-slot='main-nav-featured-link'\n href={item.href}\n active={isExactCurrent}\n className={mainNavFeaturedLinkClassName}\n >\n {item.title}\n <IconEast\n aria-hidden='true'\n className='ml-4 size-6 shrink-0 text-current duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] group-hover:translate-x-1 motion-safe:transition-transform'\n />\n </NavigationMenuLink>\n )}\n <div\n data-slot='main-nav-panel-links'\n className='grid overflow-hidden px-4 pb-12 max-sm:grid-cols-1 sm:max-lg:grid-cols-2 lg:grid-cols-3'\n >\n {links.map((link, index) => (\n <NavigationMenuLink\n key={`${link.title}-${link.href}-${index}`}\n data-slot='main-nav-section-link'\n href={link.href}\n active={link.href === currentHref}\n className={mainNavSectionLinkClassName}\n >\n {link.title}\n </NavigationMenuLink>\n ))}\n </div>\n </div>\n </NavigationMenuContent>\n </NavigationMenuItem>\n )\n}\n\ntype MainNavProps = Omit<React.ComponentPropsWithoutRef<'nav'>, 'children'> &\n VariantProps<typeof mainNavVariants> &\n VariantProps<typeof mainNavContainerVariants> & {\n /** Top-level items; items with `links` open mega panels. */\n navigation: MainNavItem[]\n /**\n * The current page's href. The exact matching link gets\n * `aria-current=\"page\"`, and the top-level item it belongs to (a plain\n * link, or the trigger whose panel contains it) gets the current-item\n * underline. The app source read this from next/navigation's\n * `usePathname` — a framework API this package must not import; compare\n * in the consumer and pass the result down.\n */\n currentHref?: string\n /**\n * Stick to the top of the viewport as the page scrolls. Defaults to\n * `false`. When the nav renders below a sticky `Header`, set\n * `--main-nav-top` to the header's height so the two stack instead of\n * overlapping — this custom property replaces the app source's\n * `useSelectorHeight` DOM-measuring hook (the app measured `#nsw-header`\n * on every resize; a consumer that needs a live value can still measure\n * its own header and write the property, see the Sticky story).\n */\n sticky?: boolean\n /** Drop shadow under the bar. Defaults to `true`. */\n shadow?: boolean\n /** Classes applied to the inner width-constraining wrapper. */\n containerClassName?: string\n /**\n * Shown in the bar when `navigation` is empty. Defaults to\n * \"No navigation items available.\"; pass `null` to render an empty bar.\n *\n * An empty `navigation` array is a legitimate runtime state, not a data\n * mistake — a CMS with nothing published, a menu filtered down to nothing\n * by the reader's permissions, or a failed nav fetch all produce it. The\n * bar keeps its themed surface either way, so with no message it reads as\n * an unexplained coloured strip.\n */\n emptyMessage?: React.ReactNode\n ref?: React.Ref<HTMLElement>\n }\n\n/**\n * Full-width NSW site navigation bar with mega-menu panels — the data-driven\n * consolidation of the nswds-app `NavigationMenuMainNavigation` /\n * `MainNavigation` components, rebuilt on this package's `NavigationMenu`\n * (Base UI underneath).\n *\n * - `navigation` drives everything: items with `links` render a trigger whose\n * mega panel shows a featured lead link (the section `href`; with no `href`\n * the lead demotes to a plain heading row — dev builds warn) above a\n * responsive 1/2/3-column grid of bordered section links; items without\n * `links` render plain links styled like the triggers. All anchors render\n * through `Link`, so a framework link injected via `LinkProvider`\n * (e.g. next/link) is used automatically.\n * - `color` themes the bar with the Footer's thirteen-name vocabulary and its\n * exact dark-mode deepening; every derived colour (halos, borders, focus\n * outlines) resolves from a single `--main-nav-ink` per variant. Contrast\n * conclusions are the Footer's, verbatim (see `mainNavColors`).\n * - Panels span the nav container's full width: a ResizeObserver on the inner\n * container feeds each panel's inline width, and an `alignOffset` function\n * shifts Base UI's trigger-anchored positioner back to the container's left\n * edge (measured at position time from the open trigger, so it is exact for\n * every trigger — this replaces the app source's panelMetrics state).\n * Assumes LTR; see the class comments.\n * - `container`, `border`, `shadow`, `sticky` mirror the house chrome\n * components; the app's deprecated `showTopBorder`/`showBottomBorder` and\n * `responsive` props are not ported (use `border` and\n * `className=\"hidden lg:block\"`).\n *\n * Accessibility: the outer `<nav>` is the landmark (default label \"Main\n * navigation\"; Base UI's own root is demoted to a `<div>` via `render` so the\n * page doesn't gain a nested nav landmark). Everything interactive is\n * inherited from Base UI via the sibling: triggers are real buttons with\n * `aria-expanded`/`aria-controls`, ArrowDown/Enter opens, arrow keys rove,\n * Escape and focus-out close, and the current page announces\n * `aria-current=\"page\"` (WCAG 2.4.8). Focus indicators are 2px ink-derived\n * outlines that contrast on all thirteen surfaces and on the panel surface\n * (2.4.7, 2.4.13). The 220ms `closeDelay` reproduces the app's hover-out\n * grace timer through Base UI instead of a hand-rolled setTimeout.\n *\n * The default `id=\"nsw-main-navigation\"` is kept for compatibility with\n * existing shells that target it (override via the `id` prop).\n */\nfunction MainNav({\n className,\n containerClassName,\n color,\n container,\n border,\n navigation,\n currentHref,\n sticky = false,\n shadow = true,\n emptyMessage = 'No navigation items available.',\n 'aria-label': ariaLabel = 'Main navigation',\n ref,\n ...props\n}: MainNavProps) {\n const containerRef = React.useRef<HTMLDivElement>(null)\n const [panelWidth, setPanelWidth] = React.useState<number | null>(null)\n\n React.useEffect(() => {\n const element = containerRef.current\n if (!element) {\n return\n }\n const measure = () => {\n setPanelWidth(element.getBoundingClientRect().width)\n }\n // Read once on mount: panels can open before the first resize.\n measure()\n const observer = new ResizeObserver(measure)\n observer.observe(element)\n return () => observer.disconnect()\n }, [])\n\n // Shifts the popup from Base UI's anchor (the open trigger) to the\n // container's left edge. Called by the positioner at position time, when\n // the open trigger is findable via data-popup-open — so the offset is exact\n // per trigger with no per-trigger state. Assumes LTR (`align='start'` maps\n // to the left edge); RTL would need the mirrored calculation.\n //\n // The ref caches the last successful offset for the windows when NO trigger\n // carries data-popup-open — chiefly the ~300ms close fade, when a recompute\n // (scroll/resize mid-fade) returning 0 would snap the still-visible\n // full-width panel back to the trigger's edge. Repeating the last real\n // offset holds the fading panel where it was.\n const lastAlignOffsetRef = React.useRef(0)\n const alignOffset = React.useCallback(() => {\n const element = containerRef.current\n if (!element) {\n return lastAlignOffsetRef.current\n }\n const trigger = element.querySelector('[data-popup-open]')\n if (!trigger) {\n return lastAlignOffsetRef.current\n }\n lastAlignOffsetRef.current =\n element.getBoundingClientRect().left - trigger.getBoundingClientRect().left\n return lastAlignOffsetRef.current\n }, [])\n\n return (\n <nav\n id='nsw-main-navigation'\n data-slot='main-nav'\n data-color={color ?? DEFAULT_MAIN_NAV_COLOR}\n aria-label={ariaLabel}\n {...props}\n className={cn(\n mainNavVariants({ color, border }),\n // z-40 matches Header (both sit below the z-50 SkipLinks). An app\n // stacking this under a sticky Header sets --main-nav-top to the\n // header's height.\n sticky && 'sticky top-[var(--main-nav-top,0px)] z-40',\n // House scrolled-header shadow; in dark mode borders carry separation.\n shadow && 'shadow-md shadow-black/5 dark:shadow-none',\n className,\n )}\n ref={ref}\n >\n <div\n ref={containerRef}\n data-slot='main-nav-container'\n className={cn(mainNavContainerVariants({ container }), containerClassName)}\n >\n {navigation.length === 0 ? (\n // No items: render the message directly rather than an empty\n // NavigationMenu, which would still mount the portal, positioner and\n // popup surface for a menubar that can never open.\n emptyMessage != null && (\n <p\n data-slot='main-nav-empty'\n className='flex min-h-14 items-center py-2 text-base leading-6 text-(--main-nav-ink)'\n >\n {emptyMessage}\n </p>\n )\n ) : (\n <>\n {/* render={<div/>}: Base UI's root is itself a <nav>; demoting it\n keeps this component to ONE navigation landmark. sideOffset 0\n seats the panel flush under the bar; collision handling is off\n because alignOffset/width already pin the panel inside the\n viewport. closeDelay 220 = the app's PANEL_CLOSE_DELAY_MS. */}\n <NavigationMenu\n render={<div />}\n className='w-full max-w-none justify-start'\n side='bottom'\n sideOffset={0}\n align='start'\n alignOffset={alignOffset}\n collisionPadding={0}\n collisionAvoidance={{ side: 'none', align: 'none' }}\n closeDelay={220}\n // Square corners (the full-width panel meets the bar edge-to-edge)\n // and no --available-width cap — see mainNavPanelVariants.\n popupClassName='max-w-none rounded-none'\n // The popup itself must follow the measured width too: Base UI\n // sizes it from --popup-width, measured once when a section\n // activates, so a panel opened before the first measurement lands\n // (or resized while open) would keep a stale popup width and clip\n // the full-width panel to a sliver. An inline width stays reactive.\n popupStyle={panelWidth === null ? undefined : { width: panelWidth }}\n >\n <NavigationMenuList className='w-full justify-start gap-0 border-b-0'>\n {navigation.map((item) => (\n <MainNavMenuItem\n key={`${item.title}-${item.href ?? 'section'}`}\n item={item}\n color={color ?? DEFAULT_MAIN_NAV_COLOR}\n currentHref={currentHref}\n panelWidth={panelWidth}\n />\n ))}\n </NavigationMenuList>\n </NavigationMenu>\n </>\n )}\n </div>\n </nav>\n )\n}\n\nexport { MainNav, mainNavColors, mainNavContainerVariants, mainNavPanelVariants, mainNavVariants }\nexport type { MainNavColor, MainNavItem, MainNavLinkItem, MainNavProps }\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/main-nav.tsx"],"names":[],"mappings":";;;;;;;AAoCA,MAAM,aAAA,GAAgB;AAAA,EACpB,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF;AAMA,MAAM,sBAAA,GAAuC,OAAA;AAE7C,MAAM,eAAA,GAAkB,GAAA;AAAA,EACtB;AAAA,IACE,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAUA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAeR,KAAA,EAAO;AAAA,QACL,aAAA,EACE,mFAAA;AAAA,QACF,aAAA,EACE,mF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.js","sourcesContent":["'use client'\n\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport React from 'react'\n\nimport { IconEast } from '../icons/east.js'\nimport { cn } from '../lib/utils.js'\n\nimport {\n NavigationMenu,\n NavigationMenuContent,\n NavigationMenuItem,\n NavigationMenuLink,\n NavigationMenuList,\n NavigationMenuTrigger,\n} from '../components/navigation-menu.js'\n\n/**\n * Surface colours the main navigation can be themed with — exactly the\n * Footer's thirteen-name vocabulary, so a service that themes its footer\n * `primary-800` writes the same word here. Each name is the LIGHT-mode\n * surface; dark mode deepens it onto the same family's dark steps (see the\n * `color` variants below), so `color` expresses tonal weight rather than a\n * literal colour.\n *\n * The bar's text/background pairs are identical to the Footer's, so its\n * contrast conclusions carry over verbatim: every light pair clears WCAG 2.2\n * AA (1.4.3, 4.5:1) for the bar's text and 11 of the 13 also clear AAA\n * (1.4.6, 7:1). The two AA-only pairs are `primary-600` (4.57:1) and\n * `accent-600` (5.18:1), both with white ink; prefer the `-800` steps when a\n * service is held to AAA. In dark mode all thirteen clear AAA (worst 13.6:1).\n *\n * The mega panels always render on the house popup surface (`bg-popover`),\n * matching the nswds-app source where every dropdown was white regardless of\n * bar colour — only the panel's accent ink follows the colour family.\n */\nconst mainNavColors = [\n 'primary-800',\n 'primary-600',\n 'primary-400',\n 'primary-200',\n 'grey-800',\n 'grey-600',\n 'grey-400',\n 'grey-200',\n 'accent-800',\n 'accent-600',\n 'accent-400',\n 'accent-200',\n 'white',\n] as const\n\ntype MainNavColor = (typeof mainNavColors)[number]\n\n// Shared by cva's defaultVariants, the data-color attribute and the panel\n// variant lookup, so the three can't drift apart.\nconst DEFAULT_MAIN_NAV_COLOR: MainNavColor = 'white'\n\nconst mainNavVariants = cva(\n [\n 'w-full',\n // Every derived colour on the bar resolves from a single --main-nav-ink\n // token, so a colour variant only has to declare the surface utilities and\n // that one value — this replaces the nswds-app source's hand-written\n // 13-variant × 8-slot style table. The border derivation is written\n // literally here (once) rather than per-variant: Tailwind scans source\n // text for class names, so a template-built arbitrary property would\n // never be emitted. Hover/active halos are not derived here — the\n // triggers ride navigation-menu.tsx's --nav-menu-halo chain, re-pointed\n // at this ink (see mainNavItemInk), so there is exactly one halo recipe.\n '[--main-nav-border:color-mix(in_oklch,var(--main-nav-ink)_15%,transparent)]',\n ],\n {\n variants: {\n // Ink values use the RAW masterbrand tokens (--primary-800, --grey-800,\n // --accent-800) rather than Tailwind's --color-* bridge aliases. Tailwind\n // v4 tree-shakes an unreferenced @theme key, and referencing one from\n // inside an arbitrary property is not a usage signal — the raw tokens are\n // plain :root declarations from @nswds/tokens and always resolve.\n // (--color-white is safe: `text-white` / `bg-white` below are real\n // utilities, so that key is always emitted.)\n //\n // Dark mode deepens every surface onto the same family's dark steps —\n // -800→-950, -600→-900, -400→-850, -200→-800, white→grey-900 — the\n // Footer's exact mapping, so the luminance ORDER within a family is\n // preserved and a stacked Footer + MainNav sharing one colour word stay\n // in step in both themes. Ink goes white on all thirteen; every dark\n // pair is WCAG 2.2 AAA (worst 13.6:1).\n color: {\n 'primary-800':\n 'bg-primary-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-primary-950',\n 'primary-600':\n 'bg-primary-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-primary-900',\n 'primary-400':\n 'bg-primary-400 text-primary-800 [--main-nav-ink:var(--primary-800)] dark:bg-primary-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'primary-200':\n 'bg-primary-200 text-primary-800 [--main-nav-ink:var(--primary-800)] dark:bg-primary-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'grey-800': 'bg-grey-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-grey-950',\n 'grey-600': 'bg-grey-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-grey-900',\n 'grey-400':\n 'bg-grey-400 text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'grey-200':\n 'bg-grey-200 text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'accent-800':\n 'bg-accent-800 text-white [--main-nav-ink:var(--color-white)] dark:bg-accent-950',\n 'accent-600':\n 'bg-accent-600 text-white [--main-nav-ink:var(--color-white)] dark:bg-accent-900',\n 'accent-400':\n 'bg-accent-400 text-accent-800 [--main-nav-ink:var(--accent-800)] dark:bg-accent-850 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n 'accent-200':\n 'bg-accent-200 text-accent-800 [--main-nav-ink:var(--accent-800)] dark:bg-accent-800 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n white:\n 'bg-white text-grey-800 [--main-nav-ink:var(--grey-800)] dark:bg-grey-900 dark:text-white dark:[--main-nav-ink:var(--color-white)]',\n },\n // Rules along the bar's edges, drawn from the ink-derived border token so\n // they follow every colour variant and both themes. Replaces the app\n // source's deprecated showTopBorder/showBottomBorder booleans, which are\n // deliberately not ported.\n border: {\n none: '',\n top: 'border-t border-(--main-nav-border)',\n bottom: 'border-b border-(--main-nav-border)',\n both: 'border-y border-(--main-nav-border)',\n },\n },\n defaultVariants: {\n color: DEFAULT_MAIN_NAV_COLOR,\n border: 'none',\n },\n },\n)\n\nconst mainNavContainerVariants = cva(\n [\n 'mx-auto flex w-full items-center',\n // Lateral padding funnels through --main-nav-padding-x so an app can\n // retune it once (via the `style` prop or a utility class) without a new\n // variant. Same mechanism, and the same 16px → 24px → 48px rhythm, as\n // Masthead, Header and Footer.\n 'px-(--main-nav-padding-x)',\n '[--main-nav-padding-x:--spacing(4)] sm:[--main-nav-padding-x:--spacing(6)] lg:[--main-nav-padding-x:--spacing(12)]',\n ],\n {\n variants: {\n container: {\n // Full-bleed (nswds-app fullBleed parity). --main-nav-max-width is\n // still read so a shell app can constrain the inner wrapper without\n // switching variants.\n fluid: 'max-w-[var(--main-nav-max-width,none)]',\n // Centred content column, legacy nsw-container parity (1200px).\n contained: 'max-w-[var(--main-nav-max-width,75rem)]',\n },\n },\n defaultVariants: {\n container: 'fluid',\n },\n },\n)\n\n/**\n * Mega-panel accent ink, keyed by the same thirteen colour names as the bar.\n * The panel itself is always the house popup surface (`bg-popover`, white in\n * light mode) — parity with the app source, whose dropdown was white for\n * every variant — so the family only tints the featured lead link, hover ink\n * and cell borders. Declared on the Content element (not inherited from the\n * bar) because Base UI portals the panel to `document.body`: a custom\n * property set on the `<nav>` can never reach it.\n *\n * Light inks are the family's -800 step on white — grey-800 on white is\n * 15.1:1 and white on primary-800 is 14.4:1 (both AAA; contrast is symmetric,\n * ratios from header.tsx); accent-800 on white clears AAA per the Footer's\n * verified pairs. Dark inks step to the family's -200 — the same dark-mode\n * interactive ink link.tsx and navigation-menu.tsx already use on this\n * popover surface. The featured lead is text-xl bold, so even the softest\n * pair is far above the large-text AA floor (1.4.3, 3:1).\n */\nconst mainNavPanelVariants = cva(\n [\n 'p-0 whitespace-normal',\n // The sibling Content (and the shared popup, via popupClassName below)\n // cap themselves at --available-width, which Base UI measures from the\n // active trigger — for a mid-bar trigger that is less than the nav's\n // width, which would shrink right-hand panels. The panel's width is\n // container-measured and can never exceed the viewport, so the cap is\n // safely lifted.\n 'max-w-none',\n '[--main-nav-panel-border:color-mix(in_oklch,var(--main-nav-panel-ink)_15%,transparent)]',\n ],\n {\n variants: {\n color: {\n 'primary-800':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-600':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-400':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'primary-200':\n '[--main-nav-panel-ink:var(--primary-800)] dark:[--main-nav-panel-ink:var(--primary-200)]',\n 'grey-800':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-600':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-400':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'grey-200':\n '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n 'accent-800':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-600':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-400':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n 'accent-200':\n '[--main-nav-panel-ink:var(--accent-800)] dark:[--main-nav-panel-ink:var(--accent-200)]',\n white: '[--main-nav-panel-ink:var(--grey-800)] dark:[--main-nav-panel-ink:var(--grey-200)]',\n },\n },\n defaultVariants: {\n color: DEFAULT_MAIN_NAV_COLOR,\n },\n },\n)\n\n// Re-points the sibling navigation-menu's ink at the bar's surface ink. The\n// trigger/link halos and focus outlines in navigation-menu.tsx all derive\n// from --nav-menu-ink via color-mix ON THE SAME ELEMENT, so overriding the\n// one token retargets the whole chain: hover/active halos and the\n// focus-visible outline become surface-relative, guaranteeing the indicator\n// contrasts on all thirteen surfaces (WCAG 2.2, 2.4.13 Focus Appearance).\n// Both light and dark are overridden because the sibling pins its own\n// dark-mode ink (primary-200); --main-nav-ink is already theme-aware.\nconst mainNavItemInk =\n '[--nav-menu-ink:var(--main-nav-ink)] dark:[--nav-menu-ink:var(--main-nav-ink)]'\n\n// Same re-point for links INSIDE the portalled panel, where the bar's ink\n// cannot reach — these derive from the panel accent ink instead.\nconst mainNavPanelInk =\n '[--nav-menu-ink:var(--main-nav-panel-ink)] dark:[--nav-menu-ink:var(--main-nav-panel-ink)]'\n\n// Restyles the sibling trigger to the app source's bar metrics: 56px min\n// height, square corners, bold base text, wider gutters from lg up. The open\n// panel is marked with the app's 4px inset underline (data-popup-open comes\n// from Base UI); data-current draws the same underline persistently when\n// `currentHref` falls inside this section, so the underline means \"you are\n// here\" at rest and \"this panel is open\" during use.\nconst mainNavTriggerClassName = [\n mainNavItemInk,\n 'mb-0 h-auto min-h-14 w-auto justify-start rounded-none max-lg:px-4 py-2 text-base leading-6 font-bold text-(--main-nav-ink)',\n 'lg:px-8',\n '[&_svg]:size-6',\n // Inset focus ring: the sibling list is a horizontal scroll container, and\n // a scroll container clips everything drawn outside a child's border box —\n // the house outward `outline-offset-2` would simply vanish on the first and\n // last triggers. Same reasoning (and same fix) as push-menu.tsx's rows.\n 'focus-visible:-outline-offset-2',\n 'data-popup-open:shadow-[inset_0_-4px_0_0_currentColor]',\n 'data-current:shadow-[inset_0_-4px_0_0_currentColor]',\n].join(' ')\n\n// A panel-less item, restyled from the sibling link to sit visually beside\n// the triggers (cn's conflict merge lets these win over the link's stacked\n// defaults). `active` → data-active draws the current-page underline; Base UI\n// pairs it with aria-current='page' on the same element (WCAG 2.4.8).\nconst mainNavTopLinkClassName = [\n mainNavItemInk,\n 'inline-flex min-h-14 flex-row items-center justify-start gap-1 rounded-none max-lg:px-4 py-2 text-base leading-6 font-bold whitespace-nowrap text-(--main-nav-ink)',\n 'lg:px-8',\n // Inset for the same reason as the trigger above — these sit in the\n // scrolling list, not in a portalled panel.\n 'focus-visible:-outline-offset-2',\n 'data-active:shadow-[inset_0_-4px_0_0_currentColor]',\n].join(' ')\n\n// The featured lead link at the top of a mega panel: the section title,\n// oversized, with an east arrow that nudges forward on hover (the app\n// source's exact affordance, on the house easing curve; the nudge is a\n// transition, so motion-reduce users get an instant state change — WCAG\n// 2.3.3). `group` scopes the icon's group-hover to this anchor — the panel is\n// portalled, so no other `group` ancestor can capture it.\nconst mainNavFeaturedLinkClassName = [\n mainNavPanelInk,\n 'group relative flex-row items-center rounded-none px-8 py-8 text-xl font-bold whitespace-normal text-(--main-nav-panel-ink)',\n].join(' ')\n\n// The lead when the section has no `href`: the same visual weight as the\n// featured link, but a plain heading row — no anchor (a dead link announced\n// as a link fails the reader who activates it), no hover halo, and no east\n// arrow (an arrow on a non-link promises navigation that never happens). No\n// mainNavPanelInk re-point either: that chain only feeds interactive halos.\nconst mainNavFeaturedHeadingClassName =\n 'flex flex-row items-center px-8 py-8 text-xl font-bold whitespace-normal text-(--main-nav-panel-ink)'\n\n// One bordered grid cell per section link. The anchor itself is the cell —\n// the app source wrapped a div around a stretched-link span, but making the\n// whole cell the anchor gives the same hit area with one element and no\n// aria-hidden overlay. Cells draw a top hairline from the panel ink; the last\n// grid row closes with a bottom hairline via the app's :nth-last-child(-n+3)\n// selector (tuned to the widest, 3-column layout — at narrower widths the\n// final one or two cells simply carry the closing rule, matching the app).\nconst mainNavSectionLinkClassName = [\n mainNavPanelInk,\n 'relative mx-2 justify-center rounded-none border-t border-(--main-nav-panel-border) p-4 text-base font-semibold whitespace-normal text-popover-foreground',\n 'hover:text-(--main-nav-panel-ink)',\n '[&:nth-last-child(-n+3)]:border-b',\n].join(' ')\n\n/** One link inside a mega panel. */\ntype MainNavLinkItem = {\n /** Visible link text, e.g. \"Find support near you\". */\n title: string\n href: string\n}\n\n/**\n * One top-level navigation item. With `links` it renders as a trigger opening\n * a mega panel (with `href` becoming the panel's featured lead link; without\n * an `href` the lead is a plain heading row — dev builds warn); without\n * `links` it renders as a plain link styled like the triggers. Recursion is\n * deliberately one level deep — mega panels list flat links, per the app\n * source's NavigationSection shape.\n */\ntype MainNavItem = {\n title: string\n href?: string\n links?: MainNavLinkItem[]\n}\n\n/**\n * Dev-only guard, mirroring the icon-only Button check in button.tsx: an item\n * with neither `href` nor `links` renders a dead `\"#\"` link — almost always a\n * data mistake, and a trap for keyboard and screen-reader users who activate\n * it and go nowhere. A section (`links`, no `href`) is legal but demoted —\n * its panel lead renders as a plain heading instead of the featured link —\n * so it gets its own nudge. No-op in production.\n */\nfunction warnIfItemUnlinked(item: MainNavItem) {\n if (process.env.NODE_ENV === 'production') {\n return\n }\n if (!item.href && !item.links?.length) {\n console.warn(\n `[nswds/ui] MainNav item \"${item.title}\" has no href and no links — it will render as a dead \"#\" link.`,\n )\n }\n if (!item.href && item.links?.length) {\n console.warn(\n `[nswds/ui] MainNav section \"${item.title}\" has links but no href — its panel lead renders as a plain heading; pass href to make it a link.`,\n )\n }\n}\n\ntype MainNavMenuItemProps = {\n item: MainNavItem\n color: MainNavColor\n currentHref?: string\n /** Measured container width, forwarded as the panel's inline width. */\n panelWidth: number | null\n}\n\n/**\n * One bar entry: a plain link for items without `links`, a trigger + mega\n * panel for items with them. Internal — the data-driven `MainNav` API is the\n * public surface; compose the navigation-menu primitives directly for layouts\n * this doesn't cover.\n */\nfunction MainNavMenuItem({ item, color, currentHref, panelWidth }: MainNavMenuItemProps) {\n warnIfItemUnlinked(item)\n\n const links = item.links\n const isExactCurrent = item.href !== undefined && item.href === currentHref\n const isSectionCurrent =\n isExactCurrent ||\n (currentHref !== undefined && (links?.some((link) => link.href === currentHref) ?? false))\n\n if (!links?.length) {\n return (\n <NavigationMenuItem className='shrink-0'>\n <NavigationMenuLink\n data-slot='main-nav-top-link'\n href={item.href ?? '#'}\n active={isExactCurrent}\n className={mainNavTopLinkClassName}\n >\n {item.title}\n </NavigationMenuLink>\n </NavigationMenuItem>\n )\n }\n\n return (\n <NavigationMenuItem className='shrink-0'>\n {/* The trigger is a button (it discloses, it doesn't navigate), so it\n can't carry aria-current — data-current draws the visual \"you are\n here\" underline while the aria-current announcement lives on the\n exact matching link inside the panel. */}\n <NavigationMenuTrigger\n data-current={isSectionCurrent || undefined}\n className={mainNavTriggerClassName}\n >\n {item.title}\n </NavigationMenuTrigger>\n {/* Inline width (not a CSS var): the panel is portalled to\n document.body, so a custom property set on the nav can't reach it.\n Before the first measurement resolves the panel falls back to the\n sibling's natural w-max sizing. */}\n <NavigationMenuContent\n data-slot='main-nav-panel'\n className={mainNavPanelVariants({ color })}\n style={panelWidth === null ? undefined : { width: panelWidth }}\n >\n <div className='grid w-full'>\n {/* No section href → no featured LINK: an `href=\"#\"` fallback here\n would be a dead link announced as a link. The heading row keeps\n the lead's visual weight without the anchor, halo or arrow — see\n mainNavFeaturedHeadingClassName. */}\n {item.href === undefined ? (\n <div data-slot='main-nav-featured-heading' className={mainNavFeaturedHeadingClassName}>\n {item.title}\n </div>\n ) : (\n <NavigationMenuLink\n data-slot='main-nav-featured-link'\n href={item.href}\n active={isExactCurrent}\n className={mainNavFeaturedLinkClassName}\n >\n {item.title}\n <IconEast\n aria-hidden='true'\n className='ml-4 size-6 shrink-0 text-current duration-300 ease-[cubic-bezier(0.22,1,0.36,1)] group-hover:translate-x-1 motion-safe:transition-transform'\n />\n </NavigationMenuLink>\n )}\n <div\n data-slot='main-nav-panel-links'\n className='grid overflow-hidden px-4 pb-12 max-sm:grid-cols-1 sm:max-lg:grid-cols-2 lg:grid-cols-3'\n >\n {links.map((link, index) => (\n <NavigationMenuLink\n key={`${link.title}-${link.href}-${index}`}\n data-slot='main-nav-section-link'\n href={link.href}\n active={link.href === currentHref}\n className={mainNavSectionLinkClassName}\n >\n {link.title}\n </NavigationMenuLink>\n ))}\n </div>\n </div>\n </NavigationMenuContent>\n </NavigationMenuItem>\n )\n}\n\ntype MainNavProps = Omit<React.ComponentPropsWithoutRef<'nav'>, 'children'> &\n VariantProps<typeof mainNavVariants> &\n VariantProps<typeof mainNavContainerVariants> & {\n /** Top-level items; items with `links` open mega panels. */\n navigation: MainNavItem[]\n /**\n * The current page's href. The exact matching link gets\n * `aria-current=\"page\"`, and the top-level item it belongs to (a plain\n * link, or the trigger whose panel contains it) gets the current-item\n * underline. The app source read this from next/navigation's\n * `usePathname` — a framework API this package must not import; compare\n * in the consumer and pass the result down.\n */\n currentHref?: string\n /**\n * Stick to the top of the viewport as the page scrolls. Defaults to\n * `false`. When the nav renders below a sticky `Header`, set\n * `--main-nav-top` to the header's height so the two stack instead of\n * overlapping — this custom property replaces the app source's\n * `useSelectorHeight` DOM-measuring hook (the app measured `#nsw-header`\n * on every resize; a consumer that needs a live value can still measure\n * its own header and write the property, see the Sticky story).\n */\n sticky?: boolean\n /** Drop shadow under the bar. Defaults to `true`. */\n shadow?: boolean\n /** Classes applied to the inner width-constraining wrapper. */\n containerClassName?: string\n /**\n * Shown in the bar when `navigation` is empty. Defaults to\n * \"No navigation items available.\"; pass `null` to render an empty bar.\n *\n * An empty `navigation` array is a legitimate runtime state, not a data\n * mistake — a CMS with nothing published, a menu filtered down to nothing\n * by the reader's permissions, or a failed nav fetch all produce it. The\n * bar keeps its themed surface either way, so with no message it reads as\n * an unexplained coloured strip.\n */\n emptyMessage?: React.ReactNode\n ref?: React.Ref<HTMLElement>\n }\n\n/**\n * Full-width NSW site navigation bar with mega-menu panels — the data-driven\n * consolidation of the nswds-app `NavigationMenuMainNavigation` /\n * `MainNavigation` components, rebuilt on this package's `NavigationMenu`\n * (Base UI underneath).\n *\n * - `navigation` drives everything: items with `links` render a trigger whose\n * mega panel shows a featured lead link (the section `href`; with no `href`\n * the lead demotes to a plain heading row — dev builds warn) above a\n * responsive 1/2/3-column grid of bordered section links; items without\n * `links` render plain links styled like the triggers. All anchors render\n * through `Link`, so a framework link injected via `LinkProvider`\n * (e.g. next/link) is used automatically.\n * - `color` themes the bar with the Footer's thirteen-name vocabulary and its\n * exact dark-mode deepening; every derived colour (halos, borders, focus\n * outlines) resolves from a single `--main-nav-ink` per variant. Contrast\n * conclusions are the Footer's, verbatim (see `mainNavColors`).\n * - Panels span the nav container's full width: a ResizeObserver on the inner\n * container feeds each panel's inline width, and an `alignOffset` function\n * shifts Base UI's trigger-anchored positioner back to the container's left\n * edge (measured at position time from the open trigger, so it is exact for\n * every trigger — this replaces the app source's panelMetrics state).\n * The offset is physical and correct in BOTH directions: Base UI passes\n * `align` to floating-ui as a physical placement and only mirrors a logical\n * `side`, so nothing about this anchoring flips under RTL. See the comment\n * on `alignOffset`, and the RightToLeft story that pins it.\n * - `container`, `border`, `shadow`, `sticky` mirror the house chrome\n * components; the app's deprecated `showTopBorder`/`showBottomBorder` and\n * `responsive` props are not ported (use `border` and\n * `className=\"hidden lg:block\"`).\n *\n * Accessibility: the outer `<nav>` is the landmark (default label \"Main\n * navigation\"; Base UI's own root is demoted to a `<div>` via `render` so the\n * page doesn't gain a nested nav landmark). Everything interactive is\n * inherited from Base UI via the sibling: triggers are real buttons with\n * `aria-expanded`/`aria-controls`, ArrowDown/Enter opens, arrow keys rove,\n * Escape and focus-out close, and the current page announces\n * `aria-current=\"page\"` (WCAG 2.4.8). Focus indicators are 2px ink-derived\n * outlines that contrast on all thirteen surfaces and on the panel surface\n * (2.4.7, 2.4.13). The 220ms `closeDelay` reproduces the app's hover-out\n * grace timer through Base UI instead of a hand-rolled setTimeout.\n *\n * The default `id=\"nsw-main-navigation\"` is kept for compatibility with\n * existing shells that target it (override via the `id` prop).\n */\nfunction MainNav({\n className,\n containerClassName,\n color,\n container,\n border,\n navigation,\n currentHref,\n sticky = false,\n shadow = true,\n emptyMessage = 'No navigation items available.',\n 'aria-label': ariaLabel = 'Main navigation',\n ref,\n ...props\n}: MainNavProps) {\n const containerRef = React.useRef<HTMLDivElement>(null)\n const [panelWidth, setPanelWidth] = React.useState<number | null>(null)\n\n React.useEffect(() => {\n const element = containerRef.current\n if (!element) {\n return\n }\n const measure = () => {\n setPanelWidth(element.getBoundingClientRect().width)\n }\n // Read once on mount: panels can open before the first resize.\n measure()\n const observer = new ResizeObserver(measure)\n observer.observe(element)\n return () => observer.disconnect()\n }, [])\n\n // Shifts the popup from Base UI's anchor (the open trigger) to the\n // container's left edge. Called by the positioner at position time, when\n // the open trigger is findable via data-popup-open — so the offset is exact\n // per trigger with no per-trigger state.\n //\n // PHYSICAL, and correct in both directions — this is deliberate, and the\n // opposite of what the comment here used to claim (\"Assumes LTR; RTL would\n // need the mirrored calculation\"). Base UI's useAnchorPositioning consults\n // the direction ONLY to map a logical `side` (`inline-start`/`inline-end`);\n // `align` is passed through to floating-ui as a physical placement, so\n // `side='bottom' align='start'` anchors the popup's LEFT edge to the\n // trigger's left in RTL exactly as in LTR, and `alignOffset` is applied on\n // floating-ui's physical cross axis. Nothing mirrors, so neither should this.\n //\n // Verified, not assumed: adding the mirror (trigger.right - container.right)\n // and rendering the bar under `dir='rtl'` WITH a DirectionProvider put the\n // panel at left=914 against a container at left=0 — the mirror moved an\n // already-left-anchored panel. The RightToLeft story pins the correct\n // geometry so a future Base UI release that starts mirroring `align` fails\n // here instead of in a consumer's RTL site.\n //\n // The ref caches the last successful offset for the windows when NO trigger\n // carries data-popup-open — chiefly the ~300ms close fade, when a recompute\n // (scroll/resize mid-fade) returning 0 would snap the still-visible\n // full-width panel back to the trigger's edge. Repeating the last real\n // offset holds the fading panel where it was.\n const lastAlignOffsetRef = React.useRef(0)\n const alignOffset = React.useCallback(() => {\n const element = containerRef.current\n if (!element) {\n return lastAlignOffsetRef.current\n }\n const trigger = element.querySelector('[data-popup-open]')\n if (!trigger) {\n return lastAlignOffsetRef.current\n }\n lastAlignOffsetRef.current =\n element.getBoundingClientRect().left - trigger.getBoundingClientRect().left\n return lastAlignOffsetRef.current\n }, [])\n\n return (\n <nav\n id='nsw-main-navigation'\n data-slot='main-nav'\n data-color={color ?? DEFAULT_MAIN_NAV_COLOR}\n aria-label={ariaLabel}\n {...props}\n className={cn(\n mainNavVariants({ color, border }),\n // z-40 matches Header (both sit below the z-50 SkipLinks). An app\n // stacking this under a sticky Header sets --main-nav-top to the\n // header's height.\n sticky && 'sticky top-[var(--main-nav-top,0px)] z-40',\n // House scrolled-header shadow; in dark mode borders carry separation.\n shadow && 'shadow-md shadow-black/5 dark:shadow-none',\n className,\n )}\n ref={ref}\n >\n <div\n ref={containerRef}\n data-slot='main-nav-container'\n className={cn(mainNavContainerVariants({ container }), containerClassName)}\n >\n {navigation.length === 0 ? (\n // No items: render the message directly rather than an empty\n // NavigationMenu, which would still mount the portal, positioner and\n // popup surface for a menubar that can never open.\n emptyMessage != null && (\n <p\n data-slot='main-nav-empty'\n className='flex min-h-14 items-center py-2 text-base leading-6 text-(--main-nav-ink)'\n >\n {emptyMessage}\n </p>\n )\n ) : (\n <>\n {/* render={<div/>}: Base UI's root is itself a <nav>; demoting it\n keeps this component to ONE navigation landmark. sideOffset 0\n seats the panel flush under the bar; collision handling is off\n because alignOffset/width already pin the panel inside the\n viewport. closeDelay 220 = the app's PANEL_CLOSE_DELAY_MS. */}\n <NavigationMenu\n render={<div />}\n className='w-full max-w-none justify-start'\n side='bottom'\n sideOffset={0}\n align='start'\n alignOffset={alignOffset}\n collisionPadding={0}\n collisionAvoidance={{ side: 'none', align: 'none' }}\n closeDelay={220}\n // Square corners (the full-width panel meets the bar edge-to-edge)\n // and no --available-width cap — see mainNavPanelVariants.\n popupClassName='max-w-none rounded-none'\n // The popup itself must follow the measured width too: Base UI\n // sizes it from --popup-width, measured once when a section\n // activates, so a panel opened before the first measurement lands\n // (or resized while open) would keep a stale popup width and clip\n // the full-width panel to a sliver. An inline width stays reactive.\n popupStyle={panelWidth === null ? undefined : { width: panelWidth }}\n >\n <NavigationMenuList className='w-full justify-start gap-0 border-b-0'>\n {navigation.map((item) => (\n <MainNavMenuItem\n key={`${item.title}-${item.href ?? 'section'}`}\n item={item}\n color={color ?? DEFAULT_MAIN_NAV_COLOR}\n currentHref={currentHref}\n panelWidth={panelWidth}\n />\n ))}\n </NavigationMenuList>\n </NavigationMenu>\n </>\n )}\n </div>\n </nav>\n )\n}\n\nexport { MainNav, mainNavColors, mainNavContainerVariants, mainNavPanelVariants, mainNavVariants }\nexport type { MainNavColor, MainNavItem, MainNavLinkItem, MainNavProps }\n"]}
|
|
@@ -4,9 +4,14 @@ import * as React from 'react';
|
|
|
4
4
|
declare function Sheet({ ...props }: Dialog.Root.Props): React.JSX.Element;
|
|
5
5
|
declare function SheetTrigger({ ...props }: Dialog.Trigger.Props): React.JSX.Element;
|
|
6
6
|
declare function SheetClose({ ...props }: Dialog.Close.Props): React.JSX.Element;
|
|
7
|
-
declare function SheetContent({ className, children, side, showCloseButton, ...props }: Dialog.Popup.Props & {
|
|
7
|
+
declare function SheetContent({ className, children, side, showCloseButton, closeLabel, ...props }: Dialog.Popup.Props & {
|
|
8
8
|
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
9
9
|
showCloseButton?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Screen-reader name for the close button. Override to translate it — the
|
|
12
|
+
* button is icon-only, so this string is the only name AT ever hears.
|
|
13
|
+
*/
|
|
14
|
+
closeLabel?: string;
|
|
10
15
|
}): React.JSX.Element;
|
|
11
16
|
declare function SheetHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
12
17
|
declare function SheetFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
package/dist/components/sheet.js
CHANGED
|
@@ -35,6 +35,7 @@ function SheetContent({
|
|
|
35
35
|
children,
|
|
36
36
|
side = "right",
|
|
37
37
|
showCloseButton = true,
|
|
38
|
+
closeLabel = "Close",
|
|
38
39
|
...props
|
|
39
40
|
}) {
|
|
40
41
|
return /* @__PURE__ */ jsxs(SheetPortal, { children: [
|
|
@@ -61,7 +62,7 @@ function SheetContent({
|
|
|
61
62
|
variant: "ghost",
|
|
62
63
|
color: "grey",
|
|
63
64
|
size: "icon",
|
|
64
|
-
"aria-label":
|
|
65
|
+
"aria-label": closeLabel,
|
|
65
66
|
className: "absolute end-4 top-4"
|
|
66
67
|
}
|
|
67
68
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/sheet.tsx"],"names":["SheetPrimitive"],"mappings":";;;;;;AASA,SAAS,KAAA,CAAM,EAAE,GAAG,KAAA,EAAM,EAA8B;AACtD,EAAA,2BAAQA,MAAA,CAAe,IAAA,EAAf,EAAoB,WAAA,EAAU,OAAA,EAAS,GAAG,KAAA,EAAO,CAAA;AAC3D;AAEA,SAAS,YAAA,CAAa,EAAE,GAAG,KAAA,EAAM,EAAiC;AAChE,EAAA,2BAAQA,MAAA,CAAe,OAAA,EAAf,EAAuB,WAAA,EAAU,eAAA,EAAiB,GAAG,KAAA,EAAO,CAA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AAAA,GACN;AAEJ","file":"sheet.js","sourcesContent":["'use client'\n\nimport { Dialog as SheetPrimitive } from '@base-ui/react/dialog'\nimport * as React from 'react'\n\nimport { Button } from '../components/button.js'\nimport { IconClose } from '../icons/close.js'\nimport { cn } from '../lib/utils.js'\n\nfunction Sheet({ ...props }: SheetPrimitive.Root.Props) {\n return <SheetPrimitive.Root data-slot='sheet' {...props} />\n}\n\nfunction SheetTrigger({ ...props }: SheetPrimitive.Trigger.Props) {\n return <SheetPrimitive.Trigger data-slot='sheet-trigger' {...props} />\n}\n\nfunction SheetClose({ ...props }: SheetPrimitive.Close.Props) {\n return <SheetPrimitive.Close data-slot='sheet-close' {...props} />\n}\n\nfunction SheetPortal({ ...props }: SheetPrimitive.Portal.Props) {\n return <SheetPrimitive.Portal data-slot='sheet-portal' {...props} />\n}\n\nfunction SheetOverlay({ className, ...props }: SheetPrimitive.Backdrop.Props) {\n return (\n <SheetPrimitive.Backdrop\n data-slot='sheet-overlay'\n className={cn(\n 'fixed inset-0 z-50 bg-black/80 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction SheetContent({\n className,\n children,\n side = 'right',\n showCloseButton = true,\n closeLabel = 'Close',\n ...props\n}: SheetPrimitive.Popup.Props & {\n side?: 'top' | 'right' | 'bottom' | 'left'\n showCloseButton?: boolean\n /**\n * Screen-reader name for the close button. Override to translate it — the\n * button is icon-only, so this string is the only name AT ever hears.\n */\n closeLabel?: string\n}) {\n return (\n <SheetPortal>\n <SheetOverlay />\n <SheetPrimitive.Popup\n data-slot='sheet-content'\n data-side={side}\n className={cn(\n 'fixed z-50 flex flex-col bg-popover bg-clip-padding text-xs/relaxed text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-e data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-s data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm rtl:data-[side=left]:data-ending-style:-translate-x-[-2.5rem] rtl:data-[side=left]:data-starting-style:-translate-x-[-2.5rem] rtl:data-[side=right]:data-ending-style:-translate-x-[2.5rem] rtl:data-[side=right]:data-starting-style:-translate-x-[2.5rem]',\n className,\n )}\n {...props}\n >\n {children}\n {showCloseButton && (\n <SheetPrimitive.Close\n data-slot='sheet-close'\n render={\n <Button\n variant='ghost'\n color='grey'\n size='icon'\n aria-label={closeLabel}\n className='absolute end-4 top-4'\n />\n }\n >\n <IconClose />\n </SheetPrimitive.Close>\n )}\n </SheetPrimitive.Popup>\n </SheetPortal>\n )\n}\n\nfunction SheetHeader({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='sheet-header'\n className={cn('flex flex-col gap-1.5 p-6', className)}\n {...props}\n />\n )\n}\n\nfunction SheetFooter({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot='sheet-footer'\n className={cn('mt-auto flex flex-col gap-2 p-6', className)}\n {...props}\n />\n )\n}\n\nfunction SheetTitle({ className, ...props }: SheetPrimitive.Title.Props) {\n return (\n <SheetPrimitive.Title\n data-slot='sheet-title'\n className={cn('text-sm font-medium text-foreground', className)}\n {...props}\n />\n )\n}\n\nfunction SheetDescription({ className, ...props }: SheetPrimitive.Description.Props) {\n return (\n <SheetPrimitive.Description\n data-slot='sheet-description'\n className={cn('text-xs/relaxed text-muted-foreground', className)}\n {...props}\n />\n )\n}\n\nexport {\n Sheet,\n SheetClose,\n SheetContent,\n SheetDescription,\n SheetFooter,\n SheetHeader,\n SheetTitle,\n SheetTrigger,\n}\n"]}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
2
|
-
import * as React from 'react';
|
|
3
2
|
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
4
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
import * as React from 'react';
|
|
5
5
|
|
|
6
6
|
declare function Tabs({ className, orientation, ...props }: Tabs$1.Root.Props): React.JSX.Element;
|
|
7
7
|
declare const tabsListVariants: (props?: ({
|
|
8
|
-
variant?: "default" | "line" | null | undefined;
|
|
8
|
+
variant?: "default" | "line" | "fullwidth" | "bordered" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
declare function TabsList({ className, variant, ...props }: Tabs$1.List.Props & VariantProps<typeof tabsListVariants>): React.JSX.Element;
|
|
11
|
+
declare const tabsTriggerVariants: (props?: ({
|
|
12
|
+
variant?: "default" | "line" | "fullwidth" | "bordered" | null | undefined;
|
|
13
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
11
14
|
declare function TabsTrigger({ className, ...props }: Tabs$1.Tab.Props): React.JSX.Element;
|
|
12
15
|
declare function TabsContent({ className, ...props }: Tabs$1.Panel.Props): React.JSX.Element;
|
|
13
16
|
|
|
14
|
-
export { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants };
|
|
17
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants, tabsTriggerVariants };
|
package/dist/components/tabs.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
|
+
import * as React from 'react';
|
|
5
6
|
import { cn } from '../lib/utils.js';
|
|
6
7
|
|
|
7
8
|
function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
@@ -15,26 +16,45 @@ function Tabs({ className, orientation = "horizontal", ...props }) {
|
|
|
15
16
|
}
|
|
16
17
|
);
|
|
17
18
|
}
|
|
18
|
-
const tabsListVariants = cva(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
const tabsListVariants = cva("group/tabs-list flex items-center text-muted-foreground", {
|
|
20
|
+
variants: {
|
|
21
|
+
variant: {
|
|
22
|
+
// Segmented control — the active tab lifts to a raised surface card.
|
|
23
|
+
default: "w-fit justify-center rounded-md bg-muted p-1 group-data-horizontal/tabs:h-9 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col",
|
|
24
|
+
// Underline — left-aligned tabs on a full-width rule (the active tab
|
|
25
|
+
// draws its own marker over it).
|
|
26
|
+
line: "w-full justify-start gap-6 border-b border-border group-data-vertical/tabs:w-fit group-data-vertical/tabs:flex-col group-data-vertical/tabs:items-stretch group-data-vertical/tabs:gap-1 group-data-vertical/tabs:border-e group-data-vertical/tabs:border-b-0 group-data-vertical/tabs:border-border",
|
|
27
|
+
// Underline stretched to equal columns — the settings-bar idiom. Each
|
|
28
|
+
// cell carries its own bottom rule so the bar can scroll (rather than clip
|
|
29
|
+
// an unreachable tab) once the labels stop fitting, matching TabNav.
|
|
30
|
+
//
|
|
31
|
+
// Horizontal-only: an equal-column bar has no vertical form — use `line`
|
|
32
|
+
// or `default` for `orientation="vertical"`. The `group-data-vertical`
|
|
33
|
+
// `w-fit` is a guard so a stray vertical usage shrinks the list instead of
|
|
34
|
+
// consuming the row and collapsing the panel.
|
|
35
|
+
fullwidth: "w-full [scrollbar-width:none] overflow-x-auto group-data-vertical/tabs:w-fit [&::-webkit-scrollbar]:hidden",
|
|
36
|
+
// Enclosed control — equal cells split by dividers inside a bordered card.
|
|
37
|
+
// `overflow-x-auto` both clips each cell's underline to the 4px corner (so
|
|
38
|
+
// the active marker follows the curve) and lets the bar scroll on narrow
|
|
39
|
+
// viewports; the trigger pairs it with a negative outline offset so neither
|
|
40
|
+
// hides focus.
|
|
41
|
+
//
|
|
42
|
+
// Horizontal-only, like `fullwidth` — the `w-fit` guard keeps a stray
|
|
43
|
+
// vertical usage from collapsing the panel.
|
|
44
|
+
bordered: "w-full [scrollbar-width:none] overflow-x-auto rounded-sm border border-border bg-background group-data-vertical/tabs:w-fit [&::-webkit-scrollbar]:hidden"
|
|
29
45
|
}
|
|
46
|
+
},
|
|
47
|
+
defaultVariants: {
|
|
48
|
+
variant: "default"
|
|
30
49
|
}
|
|
31
|
-
);
|
|
50
|
+
});
|
|
51
|
+
const TabsListContext = React.createContext("default");
|
|
32
52
|
function TabsList({
|
|
33
53
|
className,
|
|
34
54
|
variant = "default",
|
|
35
55
|
...props
|
|
36
56
|
}) {
|
|
37
|
-
return /* @__PURE__ */ jsx(
|
|
57
|
+
return /* @__PURE__ */ jsx(TabsListContext.Provider, { value: variant ?? "default", children: /* @__PURE__ */ jsx(
|
|
38
58
|
Tabs$1.List,
|
|
39
59
|
{
|
|
40
60
|
"data-slot": "tabs-list",
|
|
@@ -42,20 +62,67 @@ function TabsList({
|
|
|
42
62
|
className: cn(tabsListVariants({ variant }), className),
|
|
43
63
|
...props
|
|
44
64
|
}
|
|
45
|
-
);
|
|
65
|
+
) });
|
|
46
66
|
}
|
|
67
|
+
const tabsTriggerVariants = cva(
|
|
68
|
+
[
|
|
69
|
+
"relative inline-flex items-center justify-center gap-2 text-sm font-medium whitespace-nowrap text-foreground/60 motion-safe:transition-[color,background-color,border-color,box-shadow]",
|
|
70
|
+
"hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground",
|
|
71
|
+
// House focus: a 2px outline in the ring colour. Each variant sets its own
|
|
72
|
+
// offset — positive (onto the page) for default/line, negative for the
|
|
73
|
+
// scroll variants so the overflow clip can't hide it — so exactly one
|
|
74
|
+
// outline-offset utility lands on any element.
|
|
75
|
+
"focus-visible:outline-2 focus-visible:outline-ring",
|
|
76
|
+
"disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50",
|
|
77
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
78
|
+
"has-data-[icon=inline-end]:pe-1 has-data-[icon=inline-start]:ps-1"
|
|
79
|
+
],
|
|
80
|
+
{
|
|
81
|
+
variants: {
|
|
82
|
+
variant: {
|
|
83
|
+
// Pill that lifts to a surface card when active. `h-[calc(100%-1px)]`
|
|
84
|
+
// keeps it inside the list's inset padding.
|
|
85
|
+
default: cn(
|
|
86
|
+
"h-[calc(100%-1px)] flex-1 rounded-sm border border-transparent px-3 py-1 focus-visible:outline-offset-2",
|
|
87
|
+
"group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-2",
|
|
88
|
+
"data-active:bg-background data-active:text-foreground data-active:shadow-sm",
|
|
89
|
+
"dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground dark:data-active:shadow-none"
|
|
90
|
+
),
|
|
91
|
+
// Content-width tab with a bottom marker. The 2px border is always
|
|
92
|
+
// present (transparent when idle) so activating a tab never reflows the
|
|
93
|
+
// bar, and `-mb-px` merges the marker with the list's 1px rule.
|
|
94
|
+
line: cn(
|
|
95
|
+
"-mb-px shrink-0 border-b-2 border-transparent px-1 pt-2 pb-3 focus-visible:outline-offset-2",
|
|
96
|
+
"group-data-vertical/tabs:-me-px group-data-vertical/tabs:mb-0 group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:border-e-2 group-data-vertical/tabs:border-b-0 group-data-vertical/tabs:px-3 group-data-vertical/tabs:py-2",
|
|
97
|
+
"data-active:border-primary data-active:text-primary"
|
|
98
|
+
),
|
|
99
|
+
// The underline marker stretched to fill an equal column. The rule is
|
|
100
|
+
// the cell's own bottom border (idle grey, active primary) so it scrolls
|
|
101
|
+
// with the bar; the negative outline offset keeps focus inside the clip.
|
|
102
|
+
fullwidth: cn(
|
|
103
|
+
"flex-1 justify-center border-b-2 border-b-border px-3 py-4 focus-visible:-outline-offset-2",
|
|
104
|
+
"data-active:border-b-primary data-active:text-primary"
|
|
105
|
+
),
|
|
106
|
+
// Divided cell inside the bordered card; the active cell darkens to ink
|
|
107
|
+
// and takes a primary underline at its base.
|
|
108
|
+
bordered: cn(
|
|
109
|
+
"flex-1 justify-center border-e border-b-2 border-border border-b-transparent px-3 py-4 last:border-e-0 focus-visible:-outline-offset-2",
|
|
110
|
+
"data-active:border-b-primary data-active:text-foreground"
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
defaultVariants: {
|
|
115
|
+
variant: "default"
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
);
|
|
47
119
|
function TabsTrigger({ className, ...props }) {
|
|
120
|
+
const variant = React.useContext(TabsListContext);
|
|
48
121
|
return /* @__PURE__ */ jsx(
|
|
49
122
|
Tabs$1.Tab,
|
|
50
123
|
{
|
|
51
124
|
"data-slot": "tabs-trigger",
|
|
52
|
-
className: cn(
|
|
53
|
-
"relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-sm border border-transparent px-1.5 py-0.5 text-xs font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-[calc(--spacing(1.25))] hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pe-1 has-data-[icon=inline-start]:ps-1 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3.5",
|
|
54
|
-
"group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
|
|
55
|
-
"data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
|
|
56
|
-
"after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-end-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
|
|
57
|
-
className
|
|
58
|
-
),
|
|
125
|
+
className: cn(tabsTriggerVariants({ variant }), className),
|
|
59
126
|
...props
|
|
60
127
|
}
|
|
61
128
|
);
|
|
@@ -65,12 +132,12 @@ function TabsContent({ className, ...props }) {
|
|
|
65
132
|
Tabs$1.Panel,
|
|
66
133
|
{
|
|
67
134
|
"data-slot": "tabs-content",
|
|
68
|
-
className: cn("flex-1 text-
|
|
135
|
+
className: cn("flex-1 text-sm/relaxed outline-none", className),
|
|
69
136
|
...props
|
|
70
137
|
}
|
|
71
138
|
);
|
|
72
139
|
}
|
|
73
140
|
|
|
74
|
-
export { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants };
|
|
141
|
+
export { Tabs, TabsContent, TabsList, TabsTrigger, tabsListVariants, tabsTriggerVariants };
|
|
75
142
|
//# sourceMappingURL=tabs.js.map
|
|
76
143
|
//# sourceMappingURL=tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/tabs.tsx"],"names":["TabsPrimitive"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/components/tabs.tsx"],"names":["TabsPrimitive"],"mappings":";;;;;;AAQA,SAAS,KAAK,EAAE,SAAA,EAAW,cAAc,YAAA,EAAc,GAAG,OAAM,EAA6B;AAC3F,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAc,IAAA;AAAA,IAAd;AAAA,MACC,WAAA,EAAU,MAAA;AAAA,MACV,kBAAA,EAAkB,WAAA;AAAA,MAClB,SAAA,EAAW,EAAA,CAAG,gDAAA,EAAkD,SAAS,CAAA;AAAA,MACxE,GAAG;AAAA;AAAA,GACN;AAEJ;AAEA,MAAM,gBAAA,GAAmB,IAAI,yDAAA,EAA2D;AAAA,EACtF,QAAA,EAAU;AAAA,IACR,OAAA,EAAS;AAAA;AAAA,MAEP,OAAA,EACE,8IAAA;AAAA;AAAA;AAAA,MAGF,IAAA,EAAM,uSAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MASN,SAAA,EACE,4GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MASF,QAAA,EACE;AAAA;AACJ,GACF;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,OAAA,EAAS;AAAA;AAEb,CAAC;AAUD,MAAM,eAAA,GAAkB,KAAA,CAAM,aAAA,CAA2B,SAAS,CAAA;AAElE,SAAS,QAAA,CAAS;AAAA,EAChB,SAAA;AAAA,EACA,OAAA,GAAU,SAAA;AAAA,EACV,GAAG;AACL,CAAA,EAAqE;AACnE,EAAA,2BACG,eAAA,CAAgB,QAAA,EAAhB,EAAyB,KAAA,EAAO,WAAW,SAAA,EAC1C,QAAA,kBAAA,GAAA;AAAA,IAACA,MAAA,CAAc,IAAA;AAAA,IAAd;AAAA,MACC,WAAA,EAAU,WAAA;AAAA,MACV,cAAA,EAAc,OAAA;AAAA,MACd,W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8B;AACvE,EAAA,uBACE,GAAA;AAAA,IAACA,MAAA,CAAc,KAAA;AAAA,IAAd;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,qCAAA,EAAuC,SAAS,CAAA;AAAA,MAC7D,GAAG;AAAA;AAAA,GACN;AAEJ","file":"tabs.js","sourcesContent":["'use client'\n\nimport { Tabs as TabsPrimitive } from '@base-ui/react/tabs'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils.js'\n\nfunction Tabs({ className, orientation = 'horizontal', ...props }: TabsPrimitive.Root.Props) {\n return (\n <TabsPrimitive.Root\n data-slot='tabs'\n data-orientation={orientation}\n className={cn('group/tabs flex gap-2 data-horizontal:flex-col', className)}\n {...props}\n />\n )\n}\n\nconst tabsListVariants = cva('group/tabs-list flex items-center text-muted-foreground', {\n variants: {\n variant: {\n // Segmented control — the active tab lifts to a raised surface card.\n default:\n 'w-fit justify-center rounded-md bg-muted p-1 group-data-horizontal/tabs:h-9 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col',\n // Underline — left-aligned tabs on a full-width rule (the active tab\n // draws its own marker over it).\n line: 'w-full justify-start gap-6 border-b border-border group-data-vertical/tabs:w-fit group-data-vertical/tabs:flex-col group-data-vertical/tabs:items-stretch group-data-vertical/tabs:gap-1 group-data-vertical/tabs:border-e group-data-vertical/tabs:border-b-0 group-data-vertical/tabs:border-border',\n // Underline stretched to equal columns — the settings-bar idiom. Each\n // cell carries its own bottom rule so the bar can scroll (rather than clip\n // an unreachable tab) once the labels stop fitting, matching TabNav.\n //\n // Horizontal-only: an equal-column bar has no vertical form — use `line`\n // or `default` for `orientation=\"vertical\"`. The `group-data-vertical`\n // `w-fit` is a guard so a stray vertical usage shrinks the list instead of\n // consuming the row and collapsing the panel.\n fullwidth:\n 'w-full [scrollbar-width:none] overflow-x-auto group-data-vertical/tabs:w-fit [&::-webkit-scrollbar]:hidden',\n // Enclosed control — equal cells split by dividers inside a bordered card.\n // `overflow-x-auto` both clips each cell's underline to the 4px corner (so\n // the active marker follows the curve) and lets the bar scroll on narrow\n // viewports; the trigger pairs it with a negative outline offset so neither\n // hides focus.\n //\n // Horizontal-only, like `fullwidth` — the `w-fit` guard keeps a stray\n // vertical usage from collapsing the panel.\n bordered:\n 'w-full [scrollbar-width:none] overflow-x-auto rounded-sm border border-border bg-background group-data-vertical/tabs:w-fit [&::-webkit-scrollbar]:hidden',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n})\n\ntype TabsVariant = NonNullable<VariantProps<typeof tabsListVariants>['variant']>\n\n/**\n * Carries the list's `variant` down to each `TabsTrigger` so a trigger can style\n * itself to match without the caller threading a prop onto every tab. The whole\n * treatment lives in `tabsTriggerVariants`, keyed off this. `default` is the\n * fallback for a trigger rendered outside a `TabsList`, matching the list.\n */\nconst TabsListContext = React.createContext<TabsVariant>('default')\n\nfunction TabsList({\n className,\n variant = 'default',\n ...props\n}: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {\n return (\n <TabsListContext.Provider value={variant ?? 'default'}>\n <TabsPrimitive.List\n data-slot='tabs-list'\n data-variant={variant}\n className={cn(tabsListVariants({ variant }), className)}\n {...props}\n />\n </TabsListContext.Provider>\n )\n}\n\nconst tabsTriggerVariants = cva(\n [\n 'relative inline-flex items-center justify-center gap-2 text-sm font-medium whitespace-nowrap text-foreground/60 motion-safe:transition-[color,background-color,border-color,box-shadow]',\n 'hover:text-foreground dark:text-muted-foreground dark:hover:text-foreground',\n // House focus: a 2px outline in the ring colour. Each variant sets its own\n // offset — positive (onto the page) for default/line, negative for the\n // scroll variants so the overflow clip can't hide it — so exactly one\n // outline-offset utility lands on any element.\n 'focus-visible:outline-2 focus-visible:outline-ring',\n 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50',\n \"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n 'has-data-[icon=inline-end]:pe-1 has-data-[icon=inline-start]:ps-1',\n ],\n {\n variants: {\n variant: {\n // Pill that lifts to a surface card when active. `h-[calc(100%-1px)]`\n // keeps it inside the list's inset padding.\n default: cn(\n 'h-[calc(100%-1px)] flex-1 rounded-sm border border-transparent px-3 py-1 focus-visible:outline-offset-2',\n 'group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:py-2',\n 'data-active:bg-background data-active:text-foreground data-active:shadow-sm',\n 'dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground dark:data-active:shadow-none',\n ),\n // Content-width tab with a bottom marker. The 2px border is always\n // present (transparent when idle) so activating a tab never reflows the\n // bar, and `-mb-px` merges the marker with the list's 1px rule.\n line: cn(\n '-mb-px shrink-0 border-b-2 border-transparent px-1 pt-2 pb-3 focus-visible:outline-offset-2',\n 'group-data-vertical/tabs:-me-px group-data-vertical/tabs:mb-0 group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start group-data-vertical/tabs:border-e-2 group-data-vertical/tabs:border-b-0 group-data-vertical/tabs:px-3 group-data-vertical/tabs:py-2',\n 'data-active:border-primary data-active:text-primary',\n ),\n // The underline marker stretched to fill an equal column. The rule is\n // the cell's own bottom border (idle grey, active primary) so it scrolls\n // with the bar; the negative outline offset keeps focus inside the clip.\n fullwidth: cn(\n 'flex-1 justify-center border-b-2 border-b-border px-3 py-4 focus-visible:-outline-offset-2',\n 'data-active:border-b-primary data-active:text-primary',\n ),\n // Divided cell inside the bordered card; the active cell darkens to ink\n // and takes a primary underline at its base.\n bordered: cn(\n 'flex-1 justify-center border-e border-b-2 border-border border-b-transparent px-3 py-4 last:border-e-0 focus-visible:-outline-offset-2',\n 'data-active:border-b-primary data-active:text-foreground',\n ),\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n)\n\nfunction TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {\n const variant = React.useContext(TabsListContext)\n\n return (\n <TabsPrimitive.Tab\n data-slot='tabs-trigger'\n className={cn(tabsTriggerVariants({ variant }), className)}\n {...props}\n />\n )\n}\n\nfunction TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {\n return (\n <TabsPrimitive.Panel\n data-slot='tabs-content'\n className={cn('flex-1 text-sm/relaxed outline-none', className)}\n {...props}\n />\n )\n}\n\nexport { Tabs, TabsContent, TabsList, tabsListVariants, TabsTrigger, tabsTriggerVariants }\n"]}
|
|
@@ -71,7 +71,10 @@ type UseChromeHeightResult<T extends HTMLElement> = {
|
|
|
71
71
|
* fallback in CSS (`var(--site-chrome-height, 0px)`) for that first paint.
|
|
72
72
|
* - **The property is removed on unmount**, and whenever the tracked element
|
|
73
73
|
* changes, so a chrome element that goes away does not leave a stale offset
|
|
74
|
-
* behind for whatever renders next.
|
|
74
|
+
* behind for whatever renders next. Two instances may safely share one
|
|
75
|
+
* property name: the property is cleared only when the LAST of them
|
|
76
|
+
* unmounts, and while any remain a survivor republishes, so unmounting one
|
|
77
|
+
* never blanks the value another still owns.
|
|
75
78
|
* - Height comes from `borderBoxSize`, not `getBoundingClientRect()`: the
|
|
76
79
|
* latter reports the *transformed* size, so a chrome element that animates
|
|
77
80
|
* with a transform would publish a height that does not match the space it
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
4
|
const DEFAULT_PROPERTY = "--chrome-height";
|
|
5
|
+
const propertyPublishers = /* @__PURE__ */ new WeakMap();
|
|
5
6
|
function useChromeHeight({
|
|
6
7
|
property = DEFAULT_PROPERTY
|
|
7
8
|
} = {}) {
|
|
@@ -10,16 +11,37 @@ function useChromeHeight({
|
|
|
10
11
|
const ref = React.useCallback((node) => {
|
|
11
12
|
setElement(node);
|
|
12
13
|
}, []);
|
|
14
|
+
const instanceRef = React.useRef(null);
|
|
13
15
|
React.useEffect(() => {
|
|
14
16
|
if (!element) {
|
|
15
17
|
return;
|
|
16
18
|
}
|
|
17
19
|
const root = element.ownerDocument.documentElement;
|
|
20
|
+
const instance = instanceRef.current ??= /* @__PURE__ */ Symbol("useChromeHeight");
|
|
18
21
|
function publish(next) {
|
|
19
22
|
setHeight(next);
|
|
20
|
-
if (property) {
|
|
21
|
-
|
|
23
|
+
if (!property) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
let byProperty = propertyPublishers.get(root);
|
|
27
|
+
if (!byProperty) {
|
|
28
|
+
byProperty = /* @__PURE__ */ new Map();
|
|
29
|
+
propertyPublishers.set(root, byProperty);
|
|
30
|
+
}
|
|
31
|
+
let publishers = byProperty.get(property);
|
|
32
|
+
if (!publishers) {
|
|
33
|
+
publishers = /* @__PURE__ */ new Map();
|
|
34
|
+
byProperty.set(property, publishers);
|
|
35
|
+
}
|
|
36
|
+
publishers.delete(instance);
|
|
37
|
+
publishers.set(instance, republish);
|
|
38
|
+
root.style.setProperty(property, `${next}px`);
|
|
39
|
+
}
|
|
40
|
+
function republish() {
|
|
41
|
+
if (!element || !element.isConnected) {
|
|
42
|
+
return;
|
|
22
43
|
}
|
|
44
|
+
publish(element.offsetHeight);
|
|
23
45
|
}
|
|
24
46
|
const observer = new ResizeObserver((entries) => {
|
|
25
47
|
const entry = entries[0];
|
|
@@ -27,14 +49,27 @@ function useChromeHeight({
|
|
|
27
49
|
return;
|
|
28
50
|
}
|
|
29
51
|
const box = entry.borderBoxSize?.[0];
|
|
30
|
-
publish(box ? box.blockSize :
|
|
52
|
+
publish(box ? box.blockSize : element.offsetHeight);
|
|
31
53
|
});
|
|
32
54
|
observer.observe(element);
|
|
33
55
|
return () => {
|
|
34
56
|
observer.disconnect();
|
|
35
|
-
if (property) {
|
|
57
|
+
if (!property) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const byProperty = propertyPublishers.get(root);
|
|
61
|
+
const publishers = byProperty?.get(property);
|
|
62
|
+
if (!publishers) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
publishers.delete(instance);
|
|
66
|
+
if (publishers.size === 0) {
|
|
67
|
+
byProperty?.delete(property);
|
|
36
68
|
root.style.removeProperty(property);
|
|
69
|
+
return;
|
|
37
70
|
}
|
|
71
|
+
const survivors = [...publishers.values()];
|
|
72
|
+
survivors[survivors.length - 1]?.();
|
|
38
73
|
};
|
|
39
74
|
}, [element, property]);
|
|
40
75
|
return { ref, height };
|