basalt-ui 1.18.0 → 1.19.1

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.
Files changed (92) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +14 -0
  3. package/agent/rules/basalt-mantine.md +71 -6
  4. package/agent/rules/basalt-router.md +129 -30
  5. package/agent/rules/basalt-tokens.md +2 -1
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +8 -0
  9. package/dist/nav/types.d.ts +110 -0
  10. package/dist/nav/types.d.ts.map +1 -0
  11. package/dist/nav/types.js +0 -0
  12. package/dist/router-tanstack/index.d.ts +9 -2
  13. package/dist/router-tanstack/index.d.ts.map +1 -1
  14. package/dist/router-tanstack/index.js +7 -0
  15. package/dist/router-tanstack/nav.d.ts +163 -0
  16. package/dist/router-tanstack/nav.d.ts.map +1 -0
  17. package/dist/router-tanstack/nav.js +38 -0
  18. package/dist/router-tanstack/nav.test.d.ts +2 -0
  19. package/dist/router-tanstack/nav.test.d.ts.map +1 -0
  20. package/dist/router-tanstack/search-param-store.d.ts +19 -9
  21. package/dist/router-tanstack/search-param-store.d.ts.map +1 -1
  22. package/dist/router-tanstack/use-nav.d.ts +30 -0
  23. package/dist/router-tanstack/use-nav.d.ts.map +1 -0
  24. package/dist/router-tanstack/use-nav.js +71 -0
  25. package/dist/shell/app-breadcrumbs.d.ts +7 -9
  26. package/dist/shell/app-breadcrumbs.d.ts.map +1 -1
  27. package/dist/shell/app-breadcrumbs.js +8 -4
  28. package/dist/shell/app-mobile-nav.d.ts +23 -24
  29. package/dist/shell/app-mobile-nav.d.ts.map +1 -1
  30. package/dist/shell/app-mobile-nav.js +291 -69
  31. package/dist/shell/app-mobile-nav.module.css +191 -11
  32. package/dist/shell/app-mobile-nav.module.css.d.ts +11 -2
  33. package/dist/shell/app-mobile-nav.test.d.ts +2 -0
  34. package/dist/shell/app-mobile-nav.test.d.ts.map +1 -0
  35. package/dist/shell/app-sidebar.d.ts +3 -28
  36. package/dist/shell/app-sidebar.d.ts.map +1 -1
  37. package/dist/shell/app-sidebar.js +40 -174
  38. package/dist/shell/app-sidebar.module.css +3 -2
  39. package/dist/shell/app-sidebar.module.css.d.ts +0 -2
  40. package/dist/shell/index.d.ts +22 -65
  41. package/dist/shell/index.d.ts.map +1 -1
  42. package/dist/shell/index.js +38 -76
  43. package/dist/shell/mobile-nav-model.d.ts +41 -0
  44. package/dist/shell/mobile-nav-model.d.ts.map +1 -0
  45. package/dist/shell/mobile-nav-model.js +244 -0
  46. package/dist/shell/mobile-nav-model.test.d.ts +2 -0
  47. package/dist/shell/mobile-nav-model.test.d.ts.map +1 -0
  48. package/dist/shell/nav-count-badge.d.ts +11 -0
  49. package/dist/shell/nav-count-badge.d.ts.map +1 -0
  50. package/dist/shell/nav-count-badge.js +29 -0
  51. package/dist/surfaces.d.ts +1 -1
  52. package/dist/surfaces.js +1 -1
  53. package/dist/theme/index.d.ts.map +1 -1
  54. package/dist/theme/index.js +8 -7
  55. package/dist/theme/nav-link.module.css +4 -2
  56. package/dist/tokens/index.d.ts.map +1 -1
  57. package/dist/tokens/index.js +2 -0
  58. package/dist/tokens/palette.d.ts +15 -0
  59. package/dist/tokens/palette.d.ts.map +1 -1
  60. package/dist/tokens/palette.js +13 -0
  61. package/dist/tokens.css +2 -0
  62. package/llms.txt +3 -3
  63. package/package.json +1 -1
  64. package/src/index.ts +15 -5
  65. package/src/nav/types.ts +115 -0
  66. package/src/router-tanstack/index.ts +21 -2
  67. package/src/router-tanstack/nav.test.ts +111 -0
  68. package/src/router-tanstack/nav.ts +205 -0
  69. package/src/router-tanstack/search-param-store.ts +19 -9
  70. package/src/router-tanstack/use-nav.ts +146 -0
  71. package/src/shell/app-breadcrumbs.tsx +21 -19
  72. package/src/shell/app-mobile-nav.module.css +191 -11
  73. package/src/shell/app-mobile-nav.module.css.d.ts +11 -2
  74. package/src/shell/app-mobile-nav.test.tsx +403 -0
  75. package/src/shell/app-mobile-nav.tsx +449 -104
  76. package/src/shell/app-sidebar.module.css +3 -2
  77. package/src/shell/app-sidebar.module.css.d.ts +0 -2
  78. package/src/shell/app-sidebar.test.tsx +6 -10
  79. package/src/shell/app-sidebar.tsx +49 -206
  80. package/src/shell/index.test.tsx +62 -7
  81. package/src/shell/index.tsx +105 -164
  82. package/src/shell/mobile-nav-model.test.ts +296 -0
  83. package/src/shell/mobile-nav-model.ts +389 -0
  84. package/src/shell/nav-count-badge.tsx +39 -0
  85. package/src/surfaces.ts +1 -1
  86. package/src/theme/density-relations.test.ts +19 -1
  87. package/src/theme/index.ts +8 -7
  88. package/src/theme/nav-link.module.css +4 -2
  89. package/src/theme/spacing.test.ts +11 -0
  90. package/src/tokens/density.test.ts +2 -0
  91. package/src/tokens/index.ts +8 -5
  92. package/src/tokens/palette.ts +16 -0
@@ -49,16 +49,26 @@
49
49
  * return <Charts data={data} range={range} />
50
50
  * }
51
51
  *
52
- * **5. Nav links** — carry the param across sub-pages via search={true},
53
- * guarded by a path-prefix check so non-dashboard links stay clean:
52
+ * **5. Nav links** — carry the param across sub-pages, set per destination in
53
+ * the nav definition so only the dashboard sub-tree inherits it and every
54
+ * other link stays clean. Use a CLICK-TIME THUNK over `readStored`:
54
55
  *
55
- * const renderNavLink = (item, { active }) => {
56
- * const isDashboard = item.href?.startsWith('/dashboard/')
57
- * || item.href === '/dashboard'
58
- * return <MantineNavLink component={Link} to={item.href}
59
- * {...(isDashboard ? { search: true } : {})}
60
- * label={item.label} active={active} />
61
- * }
56
+ * const dashSearch = () => ({ range: dashboardRange.readStored() ?? '30d' })
57
+ *
58
+ * navGroup({ id: 'dash', label: 'Dashboard' }, [
59
+ * { id: 'dash-overview', label: 'Overview', icon: <IconHome />,
60
+ * link: linkOptions({ to: '/dashboard', search: dashSearch }) },
61
+ * { id: 'dash-activity', label: 'Activity', icon: <IconPulse />,
62
+ * link: linkOptions({ to: '/dashboard/activity', search: dashSearch }) },
63
+ * ])
64
+ *
65
+ * NOT `search: true`. That flag means "keep the current search" and TanStack
66
+ * only offers it where the target's search is OPTIONAL — a route wired to a
67
+ * store's `validateSearch` always returns the param, so the router requires a
68
+ * value and `search: true` is a type error. The thunk is also the better
69
+ * behaviour: `<Link>` re-evaluates it at click time, so arriving from OUTSIDE
70
+ * the sub-tree restores the last selection instead of landing on the factory
71
+ * default, and a definition evaluated once at module scope never goes stale.
62
72
  */
63
73
 
64
74
  import { createPersistedState, readPersistedValue } from '../state'
@@ -0,0 +1,146 @@
1
+ /**
2
+ * `useNav` — resolve a `defineNav` definition into the two props `BasaltShell` needs.
3
+ *
4
+ * One `defineNav([...])` in a leaf module produces the desktop sidebar AND the mobile bar: this
5
+ * hook resolves active state through the router and builds each destination's anchor, which is
6
+ * what deletes a consumer's `renderNavLink` / `renderBreadcrumbLink` / `NAV_TARGETS` table and
7
+ * every hand-written `useMatchRoute` call.
8
+ *
9
+ * No JSX — anchors are built with `createElement`, so `./router-tanstack` stays a headless,
10
+ * no-JSX `.ts` module per its own barrel contract.
11
+ */
12
+ import { createElement, useMemo } from 'react'
13
+ import type { ElementType, ReactNode } from 'react'
14
+ import { Link, useMatchRoute, useRouterState } from '@tanstack/react-router'
15
+ import type { MobileNavConfig, NavAnchor, SidebarItem, SidebarSection } from '../nav/types'
16
+ import type { AnyNavGroup, AnyNavItem, NavConfig, NavItemId, NavTabId } from './nav'
17
+
18
+ export type UseNavOptions<G extends ReadonlyArray<AnyNavGroup>> = {
19
+ /**
20
+ * Live per-destination badges, keys typed to the definition's id union.
21
+ * A `number` becomes `item.count` (desktop `NavCountBadge` + mobile dot).
22
+ * Anything else becomes `item.badge` (desktop only).
23
+ */
24
+ badges?: Partial<Record<NavItemId<G>, number | ReactNode>>
25
+ /** Override active detection entirely. */
26
+ isActive?: (item: AnyNavItem) => boolean
27
+ /** Passed straight through into the returned `mobileNav`. */
28
+ moreExtra?: ReactNode
29
+ getScrollElement?: () => HTMLElement | null
30
+ }
31
+
32
+ /** Spread straight onto `<BasaltShell {...nav} />` — both keys are `BasaltShellProps` keys. */
33
+ export type NavBinding = { sections: SidebarSection[]; mobileNav: MobileNavConfig }
34
+
35
+ /**
36
+ * Resolve a nav definition against the live router.
37
+ *
38
+ * @example
39
+ * const nav = useNav(NAV, { badges: { calendar: 3 } })
40
+ * return <BasaltShell brand={brand} {...nav}>{children}</BasaltShell>
41
+ */
42
+ export function useNav<
43
+ const G extends ReadonlyArray<AnyNavGroup>,
44
+ const T extends ReadonlyArray<NavTabId<G>>,
45
+ >(config: NavConfig<G, T>, opts?: UseNavOptions<G>): NavBinding {
46
+ // `useMatchRoute` is `useCallback(fn, [router])` — a STABLE identity across renders — and it
47
+ // subscribes internally to `router.stores.matchRouteDeps`, so the component still re-renders on
48
+ // navigation. That makes it safe as a memo dep, and makes the memo below actually hit.
49
+ const matchRoute = useMatchRoute()
50
+ // The change signal: one string that moves on every navigation, including search-param-only ones.
51
+ const href = useRouterState({ select: (s) => s.location.href })
52
+
53
+ const badges = opts?.badges
54
+ const isActiveOverride = opts?.isActive
55
+
56
+ const sections = useMemo<SidebarSection[]>(() => {
57
+ const badgeOf = (id: string): number | ReactNode =>
58
+ (badges as Record<string, number | ReactNode> | undefined)?.[id]
59
+
60
+ const isActive = (item: AnyNavItem): boolean =>
61
+ isActiveOverride?.(item) ??
62
+ Boolean(
63
+ matchRoute({
64
+ to: item.link.to,
65
+ ...(item.link.params !== undefined && { params: item.link.params }),
66
+ // Prefix match by default so a parent stays lit on its children; `'/'` would then match
67
+ // everything, so it is always exact.
68
+ fuzzy: item.exact !== true && item.link.to !== '/',
69
+ }),
70
+ )
71
+
72
+ const toSidebarItem = (item: AnyNavItem): SidebarItem => {
73
+ // One anchor per destination. Basalt renders every pixel of chrome around it (desktop row,
74
+ // 56px slot, 44px sheet row) and only hosts this component, so `preload`, middle-click and
75
+ // back/forward all keep working. `Link as ElementType` is the single cast in the whole
76
+ // chain: the widened `AnyNavLink['search']` is `unknown`, which `LinkComponentProps` rejects.
77
+ // The consumer gets zero casts, which is the point.
78
+ const Anchor: NavAnchor = (props) =>
79
+ createElement(Link as ElementType, { ...item.link, ...props })
80
+
81
+ const badge = badgeOf(item.id)
82
+ const children = item.children?.map(toSidebarItem)
83
+
84
+ return {
85
+ key: item.id,
86
+ label: item.label,
87
+ icon: item.icon,
88
+ Anchor,
89
+ // Per-destination active only. Rolling a child's active state up into its parent is the
90
+ // MOBILE SLOT's rule (§2.3.12) and belongs to `projectMobileNav`, which reads `children`
91
+ // anyway — doing it here too would also light a desktop parent row whose own route does
92
+ // not match.
93
+ active: isActive(item),
94
+ ...(item.short !== undefined && { short: item.short }),
95
+ ...(item.mobile !== undefined && { mobile: item.mobile }),
96
+ ...(item.disabled !== undefined && { disabled: item.disabled }),
97
+ ...(typeof badge === 'number'
98
+ ? { count: badge }
99
+ : badge === undefined || badge === null
100
+ ? {}
101
+ : { badge }),
102
+ ...(children !== undefined && { children }),
103
+ }
104
+ }
105
+
106
+ return config.groups.map((group) => ({
107
+ label: group.label,
108
+ items: group.items.map(toSidebarItem),
109
+ ...(group.icon !== undefined && { icon: group.icon }),
110
+ ...(group.collapsible !== undefined && { collapsible: group.collapsible }),
111
+ ...(group.defaultCollapsed !== undefined && { defaultCollapsed: group.defaultCollapsed }),
112
+ ...(group.mobile !== undefined && { mobile: group.mobile }),
113
+ }))
114
+ // `href` is deliberately an unread dep, and the reason the memo is correct: `matchRoute` has a
115
+ // STABLE identity (`useCallback(fn, [router])`), so nothing else in this list moves on a
116
+ // navigation — while the `matchRoute` calls above read router state that just changed. `href`
117
+ // is the one value that always does move, so it is what re-derives `active`.
118
+ // oxlint-disable-next-line react-hooks/exhaustive-deps
119
+ }, [config, matchRoute, href, badges, isActiveOverride])
120
+
121
+ const mobile = config.mobile
122
+ const moreExtra = opts?.moreExtra
123
+ const getScrollElement = opts?.getScrollElement
124
+
125
+ const mobileNav = useMemo<MobileNavConfig>(() => {
126
+ // `MobileNavConfig.tabs` names SIDEBAR keys, and a `SidebarSection` is identified by its
127
+ // `label` (it carries no key). A group id in `mobile.tabs` is therefore translated to that
128
+ // group's label here; item ids pass through verbatim because `SidebarItem.key` IS the id.
129
+ const groupLabelById = new Map(config.groups.map((g) => [g.id, g.label]))
130
+ const tabs = mobile?.tabs?.map((id) => {
131
+ const key = id as string
132
+ return groupLabelById.get(key) ?? key
133
+ })
134
+
135
+ return {
136
+ ...(tabs !== undefined && { tabs }),
137
+ ...(mobile?.maxTabs !== undefined && { maxTabs: mobile.maxTabs }),
138
+ ...(mobile?.menuMax !== undefined && { menuMax: mobile.menuMax }),
139
+ ...(mobile?.moreLabel !== undefined && { moreLabel: mobile.moreLabel }),
140
+ ...(moreExtra !== undefined && { moreExtra }),
141
+ ...(getScrollElement !== undefined && { getScrollElement }),
142
+ }
143
+ }, [config, mobile, moreExtra, getScrollElement])
144
+
145
+ return { sections, mobileNav }
146
+ }
@@ -11,11 +11,10 @@
11
11
  * a consumer's bundler.
12
12
  */
13
13
  import { Anchor, Group, Text } from '@mantine/core'
14
- import type { CSSProperties, ReactNode } from 'react'
14
+ import type { CSSProperties } from 'react'
15
+ import type { NavAnchor } from '../nav/types'
15
16
  import { VX } from '../tokens'
16
17
 
17
- export type BreadcrumbLinkRenderer = (href: string, label: string) => ReactNode
18
-
19
18
  /** Parent/section crumbs — faint. */
20
19
  const crumbStyle: CSSProperties = { fontSize: VX.text.md, color: 'var(--vx-faint)' }
21
20
 
@@ -34,21 +33,20 @@ const currentStyle: CSSProperties = {
34
33
  export function AppBreadcrumbs({
35
34
  section,
36
35
  parent,
36
+ parentAnchor,
37
37
  parentHref,
38
- renderBreadcrumbLink,
39
38
  page,
40
39
  }: {
41
40
  section?: string
42
41
  /** Parent item label — shown when the active page is a nested child (e.g. "Dashboard"). */
43
42
  parent?: string | undefined
44
- /** Parent item href — when provided, the parent label renders as a clickable link. */
45
- parentHref?: string | undefined
46
43
  /**
47
- * Optional router link renderer for the parent breadcrumb segment. When provided, the parent
48
- * label is rendered through this callback instead of a plain `<a href>`, enabling client-side
49
- * navigation (e.g. TanStack `<Link>`).
44
+ * The parent destination's router anchor (`SidebarItem.Anchor`), so the crumb navigates
45
+ * client-side. basalt still owns every pixel of the crumb — the anchor only hosts the label.
50
46
  */
51
- renderBreadcrumbLink?: BreadcrumbLinkRenderer | undefined
47
+ parentAnchor?: NavAnchor | undefined
48
+ /** Parent item href — the no-router fallback; ignored when `parentAnchor` is present. */
49
+ parentHref?: string | undefined
52
50
  page?: string
53
51
  }) {
54
52
  if (!page) return null
@@ -62,19 +60,23 @@ export function AppBreadcrumbs({
62
60
  <Text style={separatorStyle}>/</Text>
63
61
  </>
64
62
  )}
65
- {parent && parentHref && (
63
+ {parent && parentAnchor && (
66
64
  <>
67
- {renderBreadcrumbLink ? (
68
- renderBreadcrumbLink(parentHref, parent)
69
- ) : (
70
- <Anchor style={crumbStyle} underline="never" href={parentHref} truncate>
71
- {parent}
72
- </Anchor>
73
- )}
65
+ <Anchor style={crumbStyle} underline="never" component={parentAnchor} truncate>
66
+ {parent}
67
+ </Anchor>
68
+ <Text style={separatorStyle}>/</Text>
69
+ </>
70
+ )}
71
+ {parent && !parentAnchor && parentHref && (
72
+ <>
73
+ <Anchor style={crumbStyle} underline="never" href={parentHref} truncate>
74
+ {parent}
75
+ </Anchor>
74
76
  <Text style={separatorStyle}>/</Text>
75
77
  </>
76
78
  )}
77
- {parent && !parentHref && (
79
+ {parent && !parentAnchor && !parentHref && (
78
80
  <>
79
81
  <Text style={crumbStyle} truncate>
80
82
  {parent}
@@ -1,3 +1,8 @@
1
+ /*
2
+ * The mobile bottom bar. Slots are DESTINATIONS: a tap navigates, so the bar must read as a tab
3
+ * bar rather than as chrome — hence a pill behind the icon for the active slot instead of a
4
+ * full-tab fill, and a press that depresses the icon without moving the hit box.
5
+ */
1
6
  .bar {
2
7
  display: flex;
3
8
  align-items: stretch;
@@ -5,6 +10,21 @@
5
10
  height: 100%;
6
11
  background: var(--mantine-color-body);
7
12
  border-top: 1px solid var(--mantine-color-default-border);
13
+ -webkit-tap-highlight-color: transparent;
14
+ /* NO padding-bottom / env() here: Mantine's own AppShell `.footer` rule already does
15
+ * `height: calc(var(--app-shell-footer-height) + env(safe-area-inset-bottom))` +
16
+ * `padding-bottom: env(safe-area-inset-bottom)`. Adding it here double-counts the inset. */
17
+ }
18
+
19
+ /* Mantine sets --app-shell-footer-OFFSET to the raw height WITHOUT the inset, so Main's
20
+ * padding-bottom is short by exactly one inset. This is the only real safe-area gap. */
21
+ @media (max-width: 47.99375em) {
22
+ .mainSafeArea {
23
+ padding-bottom: calc(
24
+ var(--app-shell-footer-offset, 0rem) + var(--app-shell-padding) +
25
+ env(safe-area-inset-bottom, 0px)
26
+ );
27
+ }
8
28
  }
9
29
 
10
30
  .tab {
@@ -16,18 +36,127 @@
16
36
  justify-content: center;
17
37
  gap: var(--vx-space-mobile-nav-tab-gap);
18
38
  color: var(--mantine-color-dimmed);
39
+ /* Kills the 300ms double-tap-zoom delay and the text-selection flash on a fast repeat tap. */
40
+ touch-action: manipulation;
41
+ user-select: none;
42
+ }
43
+
44
+ .tabIcon {
45
+ position: relative;
46
+ display: inline-flex;
47
+ align-items: center;
48
+ justify-content: center;
49
+ /* Deliberately sub-scale: the active pill hugs a 24px glyph, so it is a shape inset rather than
50
+ * layout spacing — the xs..xl scale has no step this tight. */
51
+ padding: 2px 12px; /* theme-allow */
52
+ border-radius: var(--vx-radius-ctrl);
53
+ transition: transform 140ms cubic-bezier(0.32, 0.72, 0, 1);
54
+ }
55
+
56
+ /* A consumer's sidebar icons are typically 18px; the bar normalizes them in CSS so the same
57
+ * `SidebarItem.icon` renders at slot size with zero consumer change. */
58
+ .tabIcon > svg {
59
+ width: var(--vx-space-mobile-nav-icon-size);
60
+ height: var(--vx-space-mobile-nav-icon-size);
19
61
  }
20
62
 
21
- /* Active = neutral surface fill + plain text color. Never the identity blue (DESIGN.md). */
63
+ .tab:active .tabIcon {
64
+ transform: scale(0.9);
65
+ }
66
+
67
+ /* Active = a neutral pill behind the ICON only, plus plain text color. A full-tab fill is what
68
+ * makes the bar read as chrome instead of a tab bar. Never the identity blue (DESIGN.md). */
22
69
  .tab[data-active] {
23
70
  color: var(--mantine-color-text);
71
+ }
72
+
73
+ .tab[data-active] .tabIcon {
24
74
  background-color: color-mix(in srgb, var(--vx-ink) 10%, transparent);
25
75
  }
26
76
 
77
+ .tab[data-active] .label {
78
+ font-weight: 600;
79
+ }
80
+
81
+ /* Unread dot. This is a BADGE, not the active state — the "never the identity blue" rule above
82
+ * governs the active fill and is unchanged. A count GLYPH is unreadable in a 56px slot. */
83
+ .tabDot {
84
+ position: absolute;
85
+ top: 0;
86
+ inset-inline-end: 8px;
87
+ width: 8px;
88
+ height: 8px;
89
+ border-radius: 999px;
90
+ background-color: var(--vx-accent);
91
+ box-shadow: 0 0 0 2px var(--mantine-color-body);
92
+ }
93
+
94
+ /* `text-overflow: clip`, never an ellipsis — a truncated word with a "…" in a 72px tab reads as
95
+ * broken rather than as abbreviated. `SidebarItem.short` is the fix, not the ellipsis. */
27
96
  .label {
28
97
  font-size: var(--vx-text-micro);
29
98
  line-height: 1;
30
99
  font-weight: 500;
100
+ max-width: 100%;
101
+ overflow: hidden;
102
+ text-overflow: clip;
103
+ white-space: nowrap;
104
+ }
105
+
106
+ /* The menu pops UP out of its tab and is configured `flip: false` — flipping a bottom-anchored
107
+ * menu would put it under the footer. `menuMax` is what guarantees it fits (§2.2). */
108
+ .menuDropdown {
109
+ padding: 4px;
110
+ max-height: min(60dvh, 360px);
111
+ overflow-y: auto;
112
+ overscroll-behavior: contain;
113
+ }
114
+
115
+ /* The theme's `Menu.extend` pins `styles.item` padding + font-size to the dense DESKTOP values
116
+ * INLINE, so a touch-sized mobile row needs `!important` — same cascade problem, same reason, as
117
+ * `.row` below. */
118
+ .menuItem {
119
+ min-height: var(--vx-space-mobile-nav-row-height) !important;
120
+ align-items: center;
121
+ }
122
+
123
+ .menuItem :global(.mantine-Menu-itemLabel) {
124
+ font-size: var(--mantine-font-size-md) !important;
125
+ }
126
+
127
+ /* An active destination reads the same in the More surface as it does in the sheet. */
128
+ .menuItem[aria-current='page'] {
129
+ background-color: color-mix(in srgb, var(--vx-ink) 13%, transparent);
130
+ font-weight: 600;
131
+ }
132
+
133
+ /*
134
+ * A disabled destination still RENDERS in the menu (§2.3 rule 11) — it just must not be reachable.
135
+ * Mantine's `Menu.css` styles `[data-disabled]` with a dimmed color and nothing else, and the row
136
+ * is polymorphic (`component="a"`), so the native `disabled` attribute does not apply either: with
137
+ * no rule here the row stays fully clickable. `pointer-events: none` is the real guard; `menuRow`
138
+ * carries a matching handler guard for the paths pointers do not cover (keyboard, synthetic
139
+ * clicks, a consumer stylesheet that resets this).
140
+ */
141
+ .menuItem[data-disabled] {
142
+ pointer-events: none;
143
+ cursor: not-allowed;
144
+ }
145
+
146
+ /* Nesting survives to mobile — a child destination is an indented row, not a sibling of its own
147
+ * parent (which is what today's flattened projection makes it). */
148
+ .menuItemNested {
149
+ padding-inline-start: calc(var(--mantine-spacing-md) + 12px) !important;
150
+ }
151
+
152
+ /* Overflow section heading inside the menu — inherits the theme's mono micro-label. */
153
+ .menuLabel {
154
+ font-family: var(--basalt-font-mono);
155
+ font-size: var(--vx-text-micro);
156
+ font-weight: 500;
157
+ text-transform: uppercase;
158
+ letter-spacing: 0.08em;
159
+ color: var(--vx-faint);
31
160
  }
32
161
 
33
162
  /*
@@ -39,6 +168,29 @@
39
168
  box-shadow: var(--vx-shadow-card);
40
169
  border-top-left-radius: var(--mantine-radius-lg);
41
170
  border-top-right-radius: var(--mantine-radius-lg);
171
+ /* A Drawer is NOT an AppShell section, so Mantine adds no inset of its own here. */
172
+ padding-bottom: env(safe-area-inset-bottom, 0px);
173
+
174
+ /*
175
+ * THE `--drawer-size-auto` TRAP — do not "fix" this by restoring `size="auto"` on the Drawer.
176
+ * `getSize('auto', 'drawer-size')` (Mantine's `get-size.mjs`) resolves ANY non-numeric size to
177
+ * `var(--drawer-size-auto)`, and `@mantine/core` defines that custom property NOWHERE — grepped
178
+ * the full shipped `styles.css`. On a bottom Drawer that dead var flows straight into
179
+ * `--drawer-height`, so `size="auto"` was never wired to anything; the sheet rendered at
180
+ * `calc(100% - offset*2)`, i.e. the full viewport, no matter how little content it held. That is
181
+ * why this component no longer passes a `size` prop at all — it would resolve to *some* value,
182
+ * but this rule below overrides Mantine's `height`/`max-height` regardless of what that value is.
183
+ *
184
+ * This works with NO `!important`: `packages/basalt-ui/styles.css` wraps every Mantine rule in
185
+ * `@layer mantine` (verified against the installed `styles.layer.css`), and this CSS module is
186
+ * unlayered — an unlayered rule always wins over a layered one, independent of specificity or
187
+ * source order. `height: auto` lets the sheet hug its content; `max-height` is a hard ceiling on
188
+ * the whole sheet (header + body), sized with headroom ABOVE the `ScrollArea.Autosize`'s
189
+ * `mah="62dvh"` in the JSX — that autosize cap is what actually decides when the sheet starts
190
+ * scrolling internally, so the two never fight over which one owns "the maximum".
191
+ */
192
+ height: auto;
193
+ max-height: min(70dvh, 100%);
42
194
  }
43
195
 
44
196
  /* Sheet title = a micro-label (docs/DESIGN-SPEC.md §3), matching the sidebar's `.sectionLabel`. */
@@ -51,7 +203,21 @@
51
203
  color: var(--vx-faint);
52
204
  }
53
205
 
54
- /* Large tap rows inside the group sheet. NavLink rows reuse the sidebar's neutral active fill.
206
+ /*
207
+ * Mantine's `ModalBase` header forces a `min-height` of `calc(3.75rem * var(--mantine-scale))`
208
+ * (60px) — sized for a real dialog title, not a 10px micro-label, and a big share of "unnecessarily
209
+ * big". `--vx-space-mobile-nav-row-height` pins it to the same 44px touch-target floor as every
210
+ * other row in this bar instead. The header's close button IS the dismiss affordance now — no
211
+ * separate grabber: there was never swipe-to-dismiss behind it (Mantine ships no drag primitive),
212
+ * so a plain decorative bar bought nothing an explicit, focusable close control doesn't already
213
+ * give for free, including to keyboard/screen-reader users the grabber never reached.
214
+ */
215
+ .sheetHeader {
216
+ min-height: var(--vx-space-mobile-nav-row-height);
217
+ padding: 0 var(--mantine-spacing-md);
218
+ }
219
+
220
+ /* Large tap rows inside the sheet. NavLink rows reuse the sidebar's neutral active fill.
55
221
  * `padding` needs `!important`: the theme's `NavLink.extend` forces the dense desktop row padding
56
222
  * (6px 10px) INLINE on every NavLink root, which would shrink these touch targets otherwise. */
57
223
  .row {
@@ -59,13 +225,23 @@
59
225
  align-items: center;
60
226
  gap: var(--mantine-spacing-sm);
61
227
  width: 100%;
228
+ min-height: var(--vx-space-mobile-nav-row-height);
62
229
  padding: var(--mantine-spacing-sm) var(--mantine-spacing-md) !important;
63
230
  border-radius: var(--mantine-radius-sm);
64
231
  color: var(--mantine-color-text);
232
+ touch-action: manipulation;
233
+ user-select: none;
234
+ }
235
+
236
+ /* Hover must be gated: on touch an ungated :hover leaves the last-tapped row stuck lit. */
237
+ @media (hover: hover) {
238
+ .row:hover {
239
+ background-color: color-mix(in srgb, var(--vx-ink) 8%, transparent);
240
+ }
65
241
  }
66
242
 
67
- .row:hover {
68
- background-color: color-mix(in srgb, var(--vx-ink) 8%, transparent);
243
+ .row:active {
244
+ background-color: color-mix(in srgb, var(--vx-ink) 10%, transparent);
69
245
  }
70
246
 
71
247
  /*
@@ -76,8 +252,7 @@
76
252
  * `classNames` are always injected, so the icon needs its own `!important` override here to hold
77
253
  * the mobile-only "never accent" doctrine.
78
254
  */
79
- .row[data-active],
80
- .row[data-active]:hover {
255
+ .row[data-active] {
81
256
  --nl-color: var(--mantine-color-text);
82
257
  color: var(--mantine-color-text);
83
258
  background-color: color-mix(in srgb, var(--vx-ink) 13%, transparent);
@@ -88,13 +263,18 @@
88
263
  color: var(--mantine-color-text) !important;
89
264
  }
90
265
 
91
- .rowLabel {
92
- font-size: var(--mantine-font-size-md);
93
- line-height: 1.2;
266
+ .rowNested {
267
+ padding-inline-start: calc(var(--mantine-spacing-md) + 12px) !important;
94
268
  }
95
269
 
96
- /* NavLink-rendered rows match `.rowLabel` — the theme pins the label at the dense desktop 13px
97
- * INLINE (`styles.label`), so `!important` is required to restore the mobile size. */
270
+ /* Sheet rows read at the mobile body size — the theme pins the label at the dense desktop 13px
271
+ * INLINE (`styles.label`), so `!important` is required to restore it. */
98
272
  .row :global(.mantine-NavLink-label) {
99
273
  font-size: var(--mantine-font-size-md) !important;
100
274
  }
275
+
276
+ @media (prefers-reduced-motion: reduce) {
277
+ .tabIcon {
278
+ transition: none;
279
+ }
280
+ }
@@ -1,14 +1,23 @@
1
1
  /**
2
2
  * Typed CSS-module declaration (the S4 CSS-modules path). Named string props — not an index
3
- * signature — so dot access stays verbatim under the package's strict flags.
3
+ * signature — so dot access stays verbatim under the package's strict flags. HAND-MAINTAINED:
4
+ * there is no generator, so a new class in `app-mobile-nav.module.css` must be added here too.
4
5
  */
5
6
  declare const classes: {
6
7
  readonly bar: string
8
+ readonly mainSafeArea: string
7
9
  readonly tab: string
10
+ readonly tabIcon: string
11
+ readonly tabDot: string
8
12
  readonly label: string
13
+ readonly menuDropdown: string
14
+ readonly menuItem: string
15
+ readonly menuItemNested: string
16
+ readonly menuLabel: string
9
17
  readonly sheet: string
10
18
  readonly sheetTitle: string
19
+ readonly sheetHeader: string
11
20
  readonly row: string
12
- readonly rowLabel: string
21
+ readonly rowNested: string
13
22
  }
14
23
  export default classes