ab-nextjs-components 0.1.13 → 0.2.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +35 -0
  3. package/ab-app-bar/index.tsx +53 -13
  4. package/ab-app-bar/styles.module.css +68 -4
  5. package/ab-bottom-drawer/index.tsx +71 -0
  6. package/ab-bottom-drawer/styles.module.css +66 -0
  7. package/ab-breadcrumbs/index.tsx +92 -0
  8. package/ab-breadcrumbs/styles.module.css +54 -0
  9. package/ab-button/helpers.ts +6 -1
  10. package/ab-button/index.tsx +8 -2
  11. package/ab-button/styles.module.css +39 -0
  12. package/ab-card/styles.module.css +1 -1
  13. package/ab-carousel/styles.module.css +1 -1
  14. package/ab-chip/index.tsx +16 -4
  15. package/ab-chip/styles.module.css +12 -1
  16. package/ab-confirm-drawer/index.tsx +97 -0
  17. package/ab-confirm-drawer/styles.module.css +41 -0
  18. package/ab-drawer/gestures.ts +134 -0
  19. package/ab-drawer/index.tsx +458 -0
  20. package/ab-drawer/kit.module.css +204 -0
  21. package/ab-drawer/styles.module.css +166 -0
  22. package/ab-drawer/use-ab-drawer.ts +89 -0
  23. package/ab-drawer/use-ab-edge-swipe.ts +155 -0
  24. package/ab-drawer-list/index.tsx +118 -0
  25. package/ab-drawer-list/styles.module.css +65 -0
  26. package/ab-flow-diagram/styles.module.css +2 -2
  27. package/ab-icon/builtin.ts +4 -0
  28. package/ab-icon-button/index.tsx +13 -2
  29. package/ab-icon-button/styles.module.css +1 -1
  30. package/ab-install-snippet/index.tsx +51 -29
  31. package/ab-install-snippet/styles.module.css +34 -2
  32. package/ab-kbd/styles.module.css +1 -1
  33. package/ab-list/index.tsx +107 -0
  34. package/ab-list/styles.module.css +82 -0
  35. package/ab-locale-switcher/index.tsx +103 -10
  36. package/ab-locale-switcher/styles.module.css +24 -4
  37. package/ab-mobile-header/index.tsx +100 -0
  38. package/ab-nav-drawer/index.tsx +158 -0
  39. package/ab-navbar/index.tsx +1 -1
  40. package/ab-navbar/styles.module.css +20 -2
  41. package/ab-navbar/view.tsx +7 -4
  42. package/ab-package-card/index.tsx +49 -2
  43. package/ab-package-card/styles.module.css +40 -0
  44. package/ab-search-drawer/index.tsx +279 -0
  45. package/ab-search-trigger/index.tsx +22 -2
  46. package/ab-search-trigger/styles.module.css +30 -1
  47. package/ab-settings-drawer/index.tsx +160 -0
  48. package/ab-sidebar/index.tsx +6 -3
  49. package/ab-sidebar/styles.module.css +53 -5
  50. package/ab-sidebar/view.tsx +18 -4
  51. package/ab-theme-toggle/index.tsx +21 -6
  52. package/ab-theme-toggle/styles.module.css +18 -3
  53. package/ab-toc/index.tsx +9 -2
  54. package/ab-toc/styles.module.css +20 -8
  55. package/ab-toc-drawer/index.tsx +129 -0
  56. package/ab-version-switcher/index.tsx +143 -0
  57. package/ab-version-switcher/styles.module.css +76 -0
  58. package/index.ts +50 -0
  59. package/package.json +28 -3
  60. package/server/ab-button/index.tsx +6 -2
  61. package/server/ab-button/styles.module.css +39 -0
  62. package/types/index.d.ts +37 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,73 @@
1
+ ## 0.2.0 (Unreleased, proposed)
2
+
3
+ Includes everything planned for 0.1.15, which is not released separately.
4
+
5
+ ### ⚠️ Heads-up (default changes, not breaking)
6
+
7
+ * ⚠️ **AbVersionSwitcher `label`** now defaults to `''` (it was `'Docs'`), so the control shows just "v0.2.x ▾". Its accessible name is then `Version v0.2.x`. Pass `label="Docs"` for the old look.
8
+ * ⚠️ **AbAppBar compact bars** (`density="compact"`) now show the search **pill** below 768px by default (it used to be a 40px icon circle). Pass `compactSearch="icon"` for the old look.
9
+
10
+ ### Drawers v2
11
+ - ✨ AbDrawer: `tier`, `swipe`, `snapPoints`/`defaultSnap`/`fullOnly`/`onSnapChange`, `handleLabels`, `centerIn="main"`, `initialFocus` selector, `returnFocus`, `closeIcon`, `headerStart` (all additive)
12
+ - ✨ Gesture kit: `AB_SWIPE`, `resolveAbSheetRelease`, `resolveAbSideRelease`, `isInAbEdgeZone`, `createAbVelocityTracker`, `useAbEdgeSwipe`
13
+ - ✨ New: AbSettingsDrawer, AbNavDrawer, AbTocDrawer, AbSearchDrawer (combobox/listbox, recents, grouped results), AbMobileHeader
14
+ - 🔥 Docs removed from examples; AbVersionSwitcher `label` defaults to ''
15
+ - 🐛 Initial focus no longer scrolls the layer; returnFocus takes the first visible match
16
+ - ♿ AbVersionSwitcher: with no `label`, the accessible name is `Version <version>`
17
+ - 🧯 AbSearchDrawer: a rejected or throwing `search` clears to "no results"; no stale results, no unhandled rejection
18
+ - 🆔 AbSearchDrawer: group heading ids are sanitised (`[A-Za-z0-9_-]`) and indexed, so they stay valid and unique
19
+ - 📌 AbMobileHeader needs ab-nextjs-core ≥ 0.2.1 with `mobileHeader="main"`
20
+ - 🤖 Edge swipes work on Android Chrome: touches are read from touch events, and `touchmove` is non-passive only during an edge press, with `preventDefault` only once the move is sideways. Vertical scrolling from the edge zone and sideways code blocks are unaffected; checked in WebKit and Chromium touch emulation.
21
+
22
+ ### From 0.1.15
23
+
24
+ * 🔎 **AbAppBar `compactSearch`** (`'pill'` | `'icon'`): below 768px, a `density="compact"` bar now shows its `variant="field"` search as the mock's 34px "Search ⌘K" pill, not a 40px icon circle. It is the same element, styled by CSS, so there's still one hotkey listener. The default is `'pill'` for compact bars; comfortable bars keep the icon, as before.
25
+ * ⚠️ **Heads-up:** `density="compact"` bars now show the search pill below 768px by default (they used to show a 40px icon circle). Pass `compactSearch="icon"` to keep the old look.
26
+ * 🏷️ **AbSearchTrigger `compactLabel`:** an optional short label (e.g. "Search") that the compact bar shows on mobile instead of `label` ("Search docs…"). Only one is ever displayed. The key cap's space is now its own span, so the pill shows "⌘K".
27
+ * 🏷️ **AbSidebar `logo`:** a 60px (`--ab-header-height`) logo row above `header`, like mock 06's `.sb-logo`. With core ≥ 0.2.1 panes it only shows where the app header is hidden (`tabletHeader="main"` at 768–1179px).
28
+ * 🧩 **AbLocaleSwitcher `presentation="inline"`:** no trigger and no popover; it renders a labelled group of 48px rows (`--tint` + `--accent-text` when active, a check mark, `lang` / `hreflang`) in place. Put it inside the mobile app drawer. Link rows mark the current locale with `aria-current`, button rows with `aria-pressed`. Rows are exactly 48px (44px minimum), 8px apart, with an 18px bronze 2px-stroke check (`--ab-color-btn` light, `--ab-color-accent` dark). Use `divider` when it goes last after nav / theme items, and `showLabel={false}` when it's the drawer's only content (title the drawer "Language"). See the snippet in `ab-locale-switcher/index.tsx`. The inline list is its own component (`AbLocaleSwitcherInline`, also exported), so changing `presentation` at runtime remounts cleanly.
29
+ * 🏷️ **AbBottomDrawer title:** Mulish (`--ab-font-title`) 16/**800** (was 700). The bottom padding stays 16px + the safe area.
30
+ * 🔗 **AbAppBar `searchCompact`:** a node shown instead of `search` below 768px (both rendered, CSS picks). Pass `<AbSearchTrigger size="sm" href="/docs" label="Search" />` for the mock's mobile pill: a plain link to /docs, 114px wide (`--ab-app-bar-compact-search-width`) in a compact bar, with no ⌘K cap and no hotkey (no `onOpen` means no shortcut; `hotkey={false}` also turns both off).
31
+ * ♿ **Inline AbLocaleSwitcher `ariaLabel`:** the group's accessible name. It defaults to `label`, whether the label is visible or hidden.
32
+ * 📱 **No globe on the mobile bar:** pass the bar's actions without the locale switcher as `compactActions` (from 0.1.13), and render the inline switcher in the app drawer.
33
+ * 📝 **AbAppBar `searchCompact` docs:** a hotkey trigger passed to both `search` and `searchCompact` registers ⌘K twice; give only one `onOpen` (or `hotkey={false}` on the other).
34
+ * ✂️ **AbAppBar compact pill:** a longer (translated) label ends in an ellipsis inside the 114px pill.
35
+
36
+ ## [0.1.14](https://github.com/abraham-ukachi/ab-nextjs-components/compare/v0.1.13...v0.1.14) (2026-10-20)
37
+
38
+ * ⬆️ **Peer + dev range:** `ab-nextjs-theme` **^0.3.5** (was ^0.3.4), for the Home tokens. It has a D33 release-age pin that expires 2026-10-21T20:40:07Z. Components doesn't depend on `ab-nextjs-core`, so no core range changed.
39
+
40
+ * 🎯 **AbThemeToggle icon shows the target (John, 20:57):** `variant="icon"` + `appearance="thumb"` now shows the mode a click switches to (moon in light, sun in dark). New `iconShows?: 'current' | 'target'` (default `target` for thumb, `current` otherwise, so fill is unchanged) and `labels.switchTo` for names like "Switch to dark theme". Segmented toggles are unchanged.
41
+ * 🌿 **Sage chip AA (John):** the `tone="sage"` fallback text is now #566a58 (theme 0.3.5 value), ≥ 4.5:1 on the unchanged tint. Tested.
42
+ * ♿ **AA fallbacks and the sidebar badge (James):** `AbBreadcrumbs` and `AbList` now fall back to the AA faint #807062 (was the mock's #9c8c80). On the active `--tint` row, the `badgeVariant="text"` sidebar badge inherits `--accent-text`, because faint on tint is only 3.9:1. Tested.
43
+ * 🏠 **Home fidelity components (spec §5, approved by God 2026-10-20):**
44
+ * `AbList` + `AbListItem` (P13): bordered row lists with a media tile or badge, title, meta and chevron. A row with `href` is a single link.
45
+ * `AbBreadcrumbs` (P2): the tablet main bar crumb.
46
+ * `AbVersionSwitcher` (P9): the sidebar "Docs **v0.2.x** ▾", which opens an AbMenu, with a no-JS `<details>` fallback.
47
+ * `AbBottomDrawer`: the mobile bottom drawer (D40), which `AbLocaleSwitcher` / `AbAppBar` now use for `side="bottom"`. `AbDrawerList` gains `as`.
48
+ * They read the `ab-nextjs-theme` 0.3.5 Home tokens (`--ab-color-card`, `--ab-color-faint`, …), with the light mock values as fallbacks.
49
+ * 🏠 **Home variants on existing components (Joseph's P4–P19; everything is opt-in, defaults unchanged):**
50
+ * `AbAppBar`: `density="compact"` (height from core's `--ab-header-height`, 13.5px links, brand column `--ab-app-bar-brand-width` 236/270), `divider`, `moreMenu={false}` (P4/P5/P19).
51
+ * `AbSearchTrigger`: `variant="field"` (300×36, one `⌘ K` cap, "coming soon" only in the tooltip and SR text) and `size="sm"` (the 34px mobile pill) (P6).
52
+ * `AbThemeToggle`: `appearance="thumb"` (28px segments, raised thumb, filled active glyph) (P7).
53
+ * `AbSidebar`: `density="compact"`, `activeShape="rounded"`, `badgeVariant="text"`, section `itemSize="sm"`, and `collapseButtonVariant="outlined"` (32px `<<`/`>>`) (P8/P9).
54
+ * `AbPackageCard`: the Home layout with `preview`, `title` and `descriptionLines`, version and tag chips and a trailing arrow (P10). P11 `variant="all"` was not built (dropped by D1).
55
+ * `AbInstallSnippet`: `variant="terminal"` (underline tabs, copy button in the tab row, horizontal scroll instead of clipping) (P12).
56
+ * `AbToc`: a `footer` slot (P14). The TOC now uses the Home sizes: 11px heading, 13px links on 30px rows.
57
+ * `AbButton`: `shape="rounded"`, `size="md"` (40px, 44px below 768px), `type="secondary"`. `AbChip`: `size="sm"`, `shape="rounded"`, `mono`, `tone="accent" | "sage"` (P16).
58
+ * `AbNavbar`: `indicator="none"` and `blur` (P18).
59
+ * `AbIconButton`: `aria-expanded` / `aria-controls` pass through, and a new `iconSize`.
60
+ * `AbVersionSwitcher`: the accessible name is `"{label} {version}"`, so it contains the visible text (WCAG 2.5.3).
61
+ * AbList rows are 59/60px, like the mock.
62
+ * `AbBottomDrawer` (John): the sheet takes focus on open, the ✕ is 44px with an 8px hover tint and a `:focus-visible`-only ring, plus 16px + safe-area bottom padding and the 36×4 handle. It reads the theme 0.3.5 scrim, handle and sheet-edge tokens. `AbDrawer` gains `initialFocus`.
63
+ * 🎨 **Home tokens first:** borders, hovers, active rows and focus rings read `--ab-color-border` / `-hover` / `-tint` / `-accent-text` / `-accent` (theme 0.3.5) before the M3 tokens. On theme 0.3.5 the rings turn bronze and active rows turn `--tint`.
64
+ * 🗄️ **AbDrawer + `useAbDrawer` (new, G53, D38).** The drawer is scoped to `app`, `main` or `aside`. It renders into a layer inside that layout box and never scrolls the document. Sides are `top`, `bottom`, `left` and `right`, plus logical `start` and `end`.
65
+ * Accessibility: `role="dialog"`, `aria-modal`, a labelled panel, a focus trap that restores focus to the opener, Escape and scrim close, and the rest of the scope is `inert`.
66
+ * It uses the 240ms `ab-nextjs-animations` slide, which reduced motion turns off.
67
+ * Without JS it renders as an in-flow `<section>` (D41).
68
+ * 📋 **`AbDrawerList` + `AbConfirmDrawer` presets (new, D38/D40).**
69
+ * 🌍 **`presentation="menu" | "drawer" | "auto"` (G56)** on `AbLocaleSwitcher` and on the `AbAppBar` More menu. The drawer is an app-scope bottom sheet, and `auto` uses it below 768px. The default stays `menu`.
70
+
1
71
  ## 0.1.13 — 2026-10-16
2
72
 
3
73
  * 🔗 **`AbLinkProvider` (new, `ab-nextjs-components/ab-link`)**: every component link now renders through `AbLink`, so an app can inject a locale-aware `Link` once. `useAbLink`, `AbLink`, `AbLinkComponent` and `AbLinkProps` are exported. It's the only `next/link` import (test-guarded)
package/README.md CHANGED
@@ -96,6 +96,41 @@ New subpaths for the docs / PWA shell. All links go through **`AbLinkProvider`**
96
96
  registerAbIcons({ code })
97
97
  ```
98
98
 
99
+ ### Home fidelity (0.1.14, unreleased) 🏠
100
+
101
+ These match the approved Home mocks (`home-fidelity-spec.md` §4/§5). Colours come from the `ab-nextjs-theme` ≥ 0.3.5 Home tokens, with the light mock values as fallbacks. Each component also has its own `--ab-list-*` / `--ab-crumbs-*` / `--ab-version-*` / `--ab-bottom-drawer-*` knobs.
102
+
103
+ * **`<AbList>` / `<AbListItem>`** (server-safe): `title`, `meta` (a `<code>` inside renders as mono), `media` (shown in a 30px tile), `badge` + `badgeTone="primary" | "tonal"` (64×22), `trailing="chevron"` or a node, and `href` (the whole row becomes a link).
104
+ * **`<AbBreadcrumbs items={[{ label, href? }]}>`** (server-safe): a `nav` > `ol`. The last crumb has `aria-current="page"`.
105
+ * **`<AbVersionSwitcher label="Docs" version="v0.2.x" versions={[{ value, href? }]} onSelect>`**: a 28px bordered trigger that opens an AbMenu. With JS off it falls back to a `<details>` list of links.
106
+ * **`<AbBottomDrawer>`**: an app-scope bottom `AbDrawer` with a 20px top radius, a grab handle and safe-area padding, centred at up to 560px from 768px. `<AbDrawerList as={AbBottomDrawer}>` uses it, and so does the mobile language picker.
107
+
108
+ ### Drawers (0.1.14, unreleased) 🗄️
109
+
110
+ A drawer belongs to a **region**: the whole app, the main pane or the aside pane. It slides in from that region's edge, is clipped by it, and **never scrolls the document**.
111
+
112
+ > 🧱 **Requires `ab-nextjs-core` 0.1.6 or later markup** for the scopes (`.AbAppLayout`, `[data-ab-part="main"]`, `[data-ab-part="aside"]`). With older core, or with no layout, every drawer falls back to a viewport layer on `<body>`.
113
+
114
+ * **`<AbDrawer>`** (`ab-nextjs-components/ab-drawer`): `open`, `onClose`, `scope="app" | "main" | "aside"` (default `app`), `side="bottom" | "top" | "left" | "right" | "start" | "end"` (default `bottom`; `start` / `end` follow `dir`), `title` (or `aria-labelledby` / `aria-label`), `footer`, `size` (`--ab-drawer-size`), `modal` (default `true`), `closeLabel`, `noJsFallback` (default `true`).
115
+ * It portals into a layer inside the core layout box (`.AbAppLayout`, `[data-ab-part="main"]`, `[data-ab-part="aside"]`). Without a layout it covers the viewport from `<body>`.
116
+ * `role="dialog"`, `aria-modal`, and the label goes on the panel. Focus moves in and is trapped. Escape, a scrim click or the ✕ close it, and focus goes back to the opener. While it's open the rest of its scope is `inert`.
117
+ * It slides for 240ms, the same as the panes, using `ab-nextjs-animations` motion. With reduced motion it appears without the slide.
118
+ * Without JS (D41) the content renders in flow as a labelled `<section>`, so nothing is hidden behind JavaScript.
119
+ * **`useAbDrawer(scope?)`** (also on the root barrel) returns `{ open, show, close, toggle, setOpen, id, triggerProps, drawerProps }`:
120
+ ```tsx
121
+ import { AbDrawerList, useAbDrawer } from 'ab-nextjs-components'
122
+ const d = useAbDrawer('app')
123
+ <button {...d.triggerProps}>Language</button>
124
+ <AbDrawerList {...d.drawerProps} side="bottom" title="Language" items={[{ value: 'en', label: 'English', lang: 'en' }]} value={locale} onSelect={setLocale} />
125
+ ```
126
+ * **Presets.** `<AbDrawerList>` is one selectable list: `items={[{ value, label, description?, icon?, href?, lang?, disabled? }]}`, `value`, `onSelect`, `closeOnSelect`, with the current item marked `aria-current`. `<AbConfirmDrawer>` takes `message`, `confirmLabel`, `cancelLabel`, `onConfirm`, `onCancel`, `tone="danger"` and `busy`. Escape, the scrim and ✕ count as cancel.
127
+ * **G56:** `<AbLocaleSwitcher presentation="drawer" | "auto">` and `<AbAppBar presentation="drawer" | "auto">` (the More menu) open as an app-scope bottom `AbDrawerList`. `auto` opens a drawer below 768px and a menu above. The default stays `menu`.
128
+
129
+ ### Drawers v2 (0.2.0)
130
+
131
+ * **`<AbMobileHeader>`** (logo · globe · theme toggle) needs **ab-nextjs-core ≥ 0.2.1** with `<AbAppLayout variant="panes" mobileHeader="main">`. Pass it as `mainHeader`; core hides the app header below 768px and makes the main header the 56px mobile bar.
132
+ * **Edge swipes (`useAbEdgeSwipe`, `AbNavDrawer`/`AbTocDrawer` `swipe`):** a touch starting in the 24px edge zone is read from touch events. A non-passive `touchmove` listener exists only while that touch is down, and it calls `preventDefault` only once the move is sideways, so Android Chrome can't cancel it for a pan. Vertical scrolling from the edge, sideways code blocks and `[data-ab-no-edge-swipe]` keep working. Checked on WebKit and Chromium touch emulation.
133
+
99
134
  ## Getting Started
100
135
 
101
136
  ### Installation
@@ -33,8 +33,8 @@
33
33
  * <AbAppBar
34
34
  * brand={<AbBrand />}
35
35
  * search={<AbSearchTrigger onOpen={openSearch} />}
36
- * nav={[{ href: '/docs', label: 'Docs' }, { href: '/components', label: 'Components' }]}
37
- * activeHref="/docs"
36
+ * nav={[{ href: '/packages', label: 'Packages' }, { href: '/guides', label: 'Guides' }]}
37
+ * activeHref="/packages"
38
38
  * actions={<AbThemeToggle />}
39
39
  * />
40
40
  */
@@ -59,6 +59,10 @@ import { usePathname } from 'next/navigation';
59
59
  import AbIcon from '../ab-icon';
60
60
  // 📋 the overflow menu (G26)
61
61
  import AbMenu from '../ab-menu';
62
+ // 🗄️ 0.1.14 (G56): the More menu can open as a drawer
63
+ import AbDrawerList from '../ab-drawer-list';
64
+ import AbBottomDrawer from '../ab-bottom-drawer';
65
+ import { resolveAbPresentation, type AbPresentation } from '../ab-locale-switcher';
62
66
  // 🎨 styles
63
67
  import styles from './styles.module.css';
64
68
 
@@ -81,6 +85,25 @@ export interface AbAppBarProps {
81
85
  sticky?: boolean; // 📌 default true (hairline under it)
82
86
  labels?: { nav?: string; more?: string }; // 🌍
83
87
  className?: string; // 🏷️
88
+ /** 🗄️ 0.1.14 (G56, D40): More as `menu` (default), `drawer` (app-scope bottom AbDrawerList) or `auto` (drawer below 768px) */
89
+ presentation?: AbPresentation;
90
+ /** 📏 0.1.14 (P5): `'compact'` = the Home bar: height from core's `--ab-header-height` (52 / 60 / 64), 13.5px links,
91
+ * brand column `--ab-app-bar-brand-width` (236, 270 at ≥ 1920), `--div` hairline. Default `'comfortable'` (64px). */
92
+ density?: 'comfortable' | 'compact';
93
+ /** ➖ 0.1.14 (P4): a 1×20 `--div` rule between the nav and the actions (mock: before GitHub) */
94
+ divider?: boolean;
95
+ /** ⋮ 0.1.14 (P19): `false` = no "More" button/menu; below 1180px the nav is simply hidden (default `true`) */
96
+ moreMenu?: boolean;
97
+ /** 🔎 0.1.15 (God 00:08): below 768px the search shows as a `'pill'` ("Search ⌘K", the Home mock) or an `'icon'`
98
+ * (40px circle, label for screen readers only). Default `'pill'` with `density="compact"`, else `'icon'` (unchanged). */
99
+ compactSearch?: 'pill' | 'icon';
100
+ /** 🔗 0.1.15 (God 00:37): shown INSTEAD of `search` below 768px (both rendered, CSS picks: no hydration flip), e.g.
101
+ * `<AbSearchTrigger size="sm" label="Search" onOpen={openSearchDrawer} hotkey={false} />`: a button that opens
102
+ * AbSearchDrawer, with no ⌘K cap and no hotkey (God 01:27: there is no /docs page; `href` still makes a plain link).
103
+ * In a compact bar it is the mock's 114px pill (`--ab-app-bar-compact-search-width`).
104
+ * ⚠️ Both slots are rendered: a hotkey trigger (with `onOpen`) passed to BOTH `search` and `searchCompact` registers ⌘K
105
+ * twice (one press opens twice). Give only one of them `onOpen`, or pass `hotkey={false}` to the other. */
106
+ searchCompact?: ReactNode;
84
107
  }
85
108
 
86
109
  /** 🎯 exact match or parent prefix ("/" only matches itself) */
@@ -90,7 +113,7 @@ const isActive = (href: string, active?: string) => !!active && (href === active
90
113
  * 🧱 AbAppBar (G43): brand, search, nav, actions, sticky with a hairline. Below 1180px the nav moves into a
91
114
  * "More" overflow menu built on AbMenu (G26). JS off: the More button is hidden and the nav scrolls inline.
92
115
  */
93
- const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compactActions, leading, sticky = true, labels, className }: AbAppBarProps): ReactElement => {
116
+ const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compactActions, leading, sticky = true, labels, className, presentation = 'menu', density = 'comfortable', divider = false, moreMenu = true, compactSearch, searchCompact }: AbAppBarProps): ReactElement => {
94
117
  // 🌍 the active link comes from the AbLinkProvider locales, same rule as AbSidebar / AbNavbar
95
118
  const appLocales = useAbLocales();
96
119
  const pathname = stripAbLocalePrefix(usePathname() ?? '', locales ?? appLocales); // 🧭 `/fr/docs` → `/docs`
@@ -99,11 +122,12 @@ const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compa
99
122
  const menuId = `ab-app-bar-more-${useId().replace(/:/g, '')}`;
100
123
  // 📋 menu state
101
124
  const [open, setOpen] = useState(false);
125
+ const [mode, setMode] = useState<'menu' | 'drawer'>(presentation === 'drawer' ? 'drawer' : 'menu'); // 🗄️ decided on click
102
126
  const wrap = useRef<HTMLDivElement>(null);
103
127
  const btn = useRef<HTMLButtonElement>(null);
104
128
  // ⎋ Escape + outside click close it
105
129
  useEffect(() => {
106
- if (!open) return;
130
+ if (!open || mode !== 'menu') return; // 🗄️ the drawer has its own Escape / scrim
107
131
  const onKey = (e: KeyboardEvent) => {
108
132
  if (e.key === 'Escape') {
109
133
  setOpen(false);
@@ -119,13 +143,14 @@ const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compa
119
143
  document.removeEventListener('keydown', onKey);
120
144
  document.removeEventListener('pointerdown', onDown);
121
145
  };
122
- }, [open]);
146
+ }, [open, mode]);
123
147
 
124
148
  return (
125
- <header className={clsx('AbAppBar', styles.abAppBar, className)} data-ab-part="app-bar" data-sticky={sticky ? 'true' : 'false'} data-has-compact-actions={compactActions != null ? 'true' : undefined}>
149
+ <header className={clsx('AbAppBar', styles.abAppBar, className)} data-ab-part="app-bar" data-sticky={sticky ? 'true' : 'false'} data-has-compact-actions={compactActions != null ? 'true' : undefined} data-density={density === 'compact' ? 'compact' : undefined} data-more={moreMenu ? undefined : 'false'} data-compact-search={(compactSearch ?? (density === 'compact' ? 'pill' : 'icon')) === 'pill' ? 'pill' : undefined}>
126
150
  {leading}
127
151
  {brand && <div className={styles.abAppBarBrand}>{brand}</div>}
128
- {search && <div className={styles.abAppBarSearch}>{search}</div>}
152
+ {search && <div className={styles.abAppBarSearch} data-when={searchCompact != null ? 'wide' : undefined}>{search}</div>}
153
+ {searchCompact != null && <div className={styles.abAppBarSearch} data-when="compact">{searchCompact}</div> /* 📱 0.1.15 */}
129
154
  {nav.length > 0 && (
130
155
  <nav className={styles.abAppBarNav} aria-label={labels?.nav ?? 'Main'}>
131
156
  <ul>
@@ -140,6 +165,7 @@ const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compa
140
165
  </ul>
141
166
  </nav>
142
167
  )}
168
+ {divider && <span className={styles.abAppBarDivider} aria-hidden="true" data-ab-part="app-bar-divider" /> /* ➖ P4 */}
143
169
  <div className={styles.abAppBarActions}>
144
170
  {/* 🔘 actions; 📱 below 768px `compactActions` replaces them (both rendered, CSS picks: no hydration flip) */}
145
171
  {compactActions != null ? (
@@ -148,27 +174,41 @@ const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compa
148
174
  <div className={styles.abAppBarActionsCompact}>{compactActions}</div>
149
175
  </>
150
176
  ) : actions}
151
- {nav.length > 0 && (
177
+ {nav.length > 0 && moreMenu && (
152
178
  <div ref={wrap} className={styles.abAppBarMore}>
153
179
  <button
154
180
  ref={btn}
155
181
  type="button"
156
182
  className={styles.abAppBarMoreButton} // 🙈 ≥ 1180px and JS off
157
183
  aria-label={labels?.more ?? 'More'}
158
- aria-haspopup="menu"
184
+ aria-haspopup={mode === 'drawer' ? 'dialog' : 'menu'}
159
185
  aria-expanded={open}
160
- aria-controls={menuId}
161
- onClick={() => setOpen((o) => !o)}
186
+ aria-controls={mode === 'drawer' ? `${menuId}-drawer` : menuId}
187
+ onClick={() => { if (!open) setMode(resolveAbPresentation(presentation)); setOpen((o) => !o); }} // 🖱️ `auto` decides now
162
188
  >
163
189
  <AbIcon name="more_vert" size={24} />
164
190
  </button>
165
191
  <AbMenu
166
192
  id={menuId}
167
- hidden={!open}
168
- isActive={open}
193
+ hidden={!open || mode !== 'menu'}
194
+ isActive={open && mode === 'menu'}
169
195
  className={styles.abAppBarMenu}
170
196
  items={nav.map((n) => ({ id: n.href, label: n.label, href: n.href, selected: isActive(n.href, current), onClick: () => setOpen(false) }))}
171
197
  />
198
+ {presentation !== 'menu' && (
199
+ <AbDrawerList
200
+ id={`${menuId}-drawer`}
201
+ open={open && mode === 'drawer'}
202
+ onClose={() => setOpen(false)} // 🚪 focus goes back to More
203
+ scope="app"
204
+ side="bottom"
205
+ as={AbBottomDrawer} // 📱
206
+ title={labels?.more ?? 'More'}
207
+ noJsFallback={false} // 🚫 JS off: the nav already scrolls inline
208
+ value={nav.find((n) => isActive(n.href, current))?.href}
209
+ items={nav.map((n) => ({ value: n.href, label: n.label, href: n.href }))}
210
+ />
211
+ )}
172
212
  </div>
173
213
  )}
174
214
  </div>
@@ -69,10 +69,10 @@
69
69
  font-weight: 500; /* 🔤 */
70
70
  white-space: nowrap; /* ↔️ */
71
71
  }
72
- .abAppBarLink[data-active='true'] { background: var(--ab-color-secondary-container, rgb(0 0 0 / 0.08)); font-weight: 600; } /* 🎯 */
72
+ .abAppBarLink[data-active='true'] { background: var(--ab-color-tint, var(--ab-color-secondary-container, rgb(0 0 0 / 0.08))); font-weight: 600; } /* 🎯 */
73
73
  .abAppBarLink:focus-visible,
74
74
  .abAppBarMoreButton:focus-visible {
75
- outline: var(--ab-focus-ring-width, 2px) solid var(--ab-color-primary, #8f4c38); /* ♿ */
75
+ outline: var(--ab-focus-ring-width, 2px) solid var(--ab-color-accent, var(--ab-color-primary, #8f4c38)); /* ♿ */
76
76
  outline-offset: var(--ab-focus-ring-offset, 2px); /* ♿ */
77
77
  }
78
78
  .abAppBarActions { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; flex: none; } /* 🔘 */
@@ -111,9 +111,73 @@
111
111
  .abAppBar { gap: 8px; padding-inline: max(12px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px)); } /* 📦 */
112
112
  .abAppBarBrand { flex: 0 1 auto; min-width: 0; overflow: hidden; } /* 🏷️ may shrink */
113
113
  .abAppBarSearch { flex: none; margin-inline-start: auto; } /* 🔎 icon only, pushed right */
114
- .abAppBarSearch > :global(.AbSearchTrigger) { width: 40px; min-width: 40px; padding: 0; justify-content: center; flex: none; } /* 🔘 */
115
- .abAppBarSearch > :global(.AbSearchTrigger) > :not(:global(.AbIcon)) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* 🕶️ label + kbd */
114
+ .abAppBar:not([data-compact-search='pill']) .abAppBarSearch > :global(.AbSearchTrigger):not([data-size='sm']) { width: 40px; min-width: 40px; padding: 0; justify-content: center; flex: none; } /* 🔘 */
115
+ .abAppBar:not([data-compact-search='pill']) .abAppBarSearch > :global(.AbSearchTrigger):not([data-size='sm']) > :not(:global(.AbIcon)) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* 🕶️ label + kbd */
116
116
  .abAppBarActions { margin-inline-start: 0; gap: 0; } /* 🔘 */
117
117
  .abAppBar[data-has-compact-actions='true'] .abAppBarActionsWide { display: none; } /* 🙈 */
118
118
  .abAppBar[data-has-compact-actions='true'] .abAppBarActionsCompact { display: flex; } /* 👀 */
119
119
  }
120
+
121
+ /* ===== 📏 0.1.14 (P4/P5/P19, Home spec §4 app bar) ===== */
122
+ .abAppBarDivider { flex: none; width: 1px; height: 20px; background: var(--ab-color-div, rgb(92 64 48 / 0.11)); } /* ➖ P4 */
123
+ .abAppBar[data-more='false'] .abAppBarMore { display: none; } /* ⋮ P19: belt and braces (not rendered) */
124
+ @media (max-width: 1179px) { .abAppBar[data-more='false'] .abAppBarDivider { display: none; } } /* ➖ nothing to divide */
125
+ .abAppBar[data-density='compact'] {
126
+ height: var(--ab-header-height, 60px); min-height: 0; gap: 14px; /* 📏 core 0.2.0: 52 / 60 / 64 */
127
+ padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(22px, env(safe-area-inset-left, 0px)); /* 📦 22px: the logo lines up with the sidebar rows */
128
+ background: var(--ab-color-bg, inherit); /* 🎨 --pane */
129
+ }
130
+ .abAppBar[data-density='compact'][data-sticky='true'] { border-bottom: 1px solid var(--ab-color-div, rgb(92 64 48 / 0.11)); } /* ➖ */
131
+ .abAppBar[data-density='compact'] .abAppBarBrand { gap: 14px; } /* 🏷️ */
132
+ .abAppBar[data-density='compact'] .abAppBarSearch { flex: none; } /* 🔎 the field sets its own width */
133
+ .abAppBar[data-density='compact'] .abAppBarNav { margin-inline-start: auto; } /* ➡️ mock: grow, then the links */
134
+ .abAppBar[data-density='compact'] .abAppBarNav ul { gap: 20px; } /* 🧭 */
135
+ .abAppBar[data-density='compact'] .abAppBarLink {
136
+ height: auto; padding: 0; border-radius: 0; background: none; /* 🧹 no pill */
137
+ font-size: 13.5px; font-weight: 550; color: var(--ab-color-muted, #6b5b50); /* 🔤 */
138
+ }
139
+ .abAppBar[data-density='compact'] .abAppBarLink:hover { color: var(--ab-color-text, #211a16); } /* 🖱️ */
140
+ .abAppBar[data-density='compact'] .abAppBarLink[data-active='true'] { background: none; color: var(--ab-color-accent-text, #88603d); font-weight: 650; } /* 🎯 */
141
+ .abAppBar[data-density='compact'] .abAppBarLink:focus-visible { outline-color: var(--ab-color-accent, #a67c52); border-radius: 4px; } /* ♿ */
142
+ .abAppBar[data-density='compact'] .abAppBarActions { gap: 14px; } /* 🔘 GitHub · theme pill */
143
+ .abAppBar[data-density='compact'] :is(.abAppBarActionsWide, .abAppBarActionsCompact) { gap: 14px; }
144
+ .abAppBar[data-density='compact'] .abAppBarNav + .abAppBarActions,
145
+ .abAppBar[data-density='compact'] .abAppBarDivider + .abAppBarActions { margin-inline-start: 0; } /* ➡️ the nav already pushed right */
146
+ @media (min-width: 1180px) {
147
+ .abAppBar[data-density='compact'] .abAppBarBrand { width: var(--ab-app-bar-brand-width, 236px); } /* 🏷️ P4: = sidebar edge */
148
+ }
149
+ @media (min-width: 1920px) {
150
+ .abAppBar[data-density='compact'] { --ab-app-bar-brand-width: 270px; padding-inline: 14px 12px; background: transparent; } /* 🖥️ gapped */
151
+ .abAppBar[data-density='compact'][data-sticky='true'] { border-bottom: 0; } /* 🚫 the panes float */
152
+ .abAppBar[data-density='compact'] { --ab-search-trigger-width: 360px; }
153
+ }
154
+ @media (max-width: 767px) {
155
+ .abAppBar[data-density='compact'] { gap: 2px; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px)); } /* 📱 mock .mapp */
156
+ .abAppBar[data-density='compact'] .abAppBarSearch { margin-inline: auto 4px; } /* 🔎 pushed right, 4px before the icon */
157
+ .abAppBar[data-density='compact'] .abAppBarActions { gap: 0; }
158
+ }
159
+
160
+ /* ===== 🔎 0.1.15 (God 00:08, Joseph fidelity-2 #1): compactSearch="pill" below 768px =====
161
+ * The desktop field becomes the mobile mock's `.mpill`: 34px, pill radius, 13px "Search" + a tight "⌘K" cap.
162
+ * Same element, CSS only (no hydration flip, one hotkey listener). */
163
+ @media (max-width: 767px) {
164
+ .abAppBar[data-compact-search='pill'] .abAppBarSearch > :global(.AbSearchTrigger)[data-variant='field'] {
165
+ flex: none; width: auto; max-width: none; height: 34px; gap: 6px; padding: 0 6px 0 10px; /* 📏 = size="sm" */
166
+ border-radius: var(--ab-radius-pill, 999px); font-size: 13px; /* 💊 🔤 */
167
+ }
168
+ .abAppBar[data-compact-search='pill'] .abAppBarSearch > :global(.AbSearchTrigger)[data-variant='field'] > :global(.AbIcon) { width: 17px; height: 17px; font-size: 17px; } /* 🔣 17px */
169
+ .abAppBar[data-compact-search='pill'] .abAppBarSearch > :global(.AbSearchTrigger)[data-variant='field'] > :global(.AbIcon) svg { width: 17px; height: 17px; }
170
+ .abAppBar[data-compact-search='pill'] .abAppBarSearch :global(.AbSearchTrigger)[data-variant='field']:has([data-ab-part='search-label-compact']) [data-ab-part='search-label'] { display: none; } /* 🏷️ long label out… */
171
+ .abAppBar[data-compact-search='pill'] .abAppBarSearch :global(.AbSearchTrigger)[data-variant='field'] [data-ab-part='search-label-compact'] { display: inline; } /* …"Search" in */
172
+ .abAppBar[data-compact-search='pill'] .abAppBarSearch :global(.AbSearchTrigger)[data-variant='field'] [data-ab-part='key-gap'] { display: none; } /* ⌨️ "⌘K" */
173
+ .abAppBar[data-compact-search='pill'] .abAppBarSearch :global(.AbSearchTrigger)[data-variant='field'] :global(.AbKbd) { min-width: 18px; height: 18px; font-size: 10px; } /* 📱 = sm cap */
174
+ }
175
+
176
+ /* ===== 🔗 0.1.15 (God 00:37): `searchCompact` replaces `search` below 768px (mock .mpill = 114px, here a link) ===== */
177
+ .abAppBarSearch[data-when='compact'] { display: none; } /* 🙈 ≥ 768px */
178
+ @media (max-width: 767px) {
179
+ .abAppBarSearch[data-when='wide'] { display: none; } /* 🙈 */
180
+ .abAppBarSearch[data-when='compact'] { display: block; } /* 👀 */
181
+ .abAppBar[data-compact-search='pill'] .abAppBarSearch[data-when='compact'] > :global(.AbSearchTrigger) { width: var(--ab-app-bar-compact-search-width, 114px); box-sizing: border-box; } /* 📏 mock 114 */
182
+ .abAppBar[data-compact-search='pill'] .abAppBarSearch[data-when='compact'] > :global(.AbSearchTrigger) [data-ab-part^='search-label'] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* ✂️ James P2: longer translations end in … inside the 114px pill */
183
+ }
@@ -0,0 +1,71 @@
1
+ /*
2
+ * @license MIT
3
+ * ~~~~~~~~~~~~
4
+ * ab-nextjs-components
5
+ * ~~~~~~~~~~~~
6
+ * Copyright (c) 2026 Abraham Ukachi. The abElements Project.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the 'Software'), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * @project: ab-nextjs-components
27
+ * @name: AbBottomDrawer (mobile bottom drawer)
28
+ * @file: ab-bottom-drawer/index.tsx
29
+ * @type: Client component
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ *
32
+ * Example usage:
33
+ * 1+|> <AbBottomDrawer {...d.drawerProps} title="Language">…</AbBottomDrawer>
34
+ */
35
+
36
+ /*
37
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
38
+ * MOTTO: We'll always do more 😜!!!
39
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40
+ */
41
+
42
+
43
+ 'use client';
44
+
45
+ // ⚛️ React
46
+ import type { ReactElement } from 'react';
47
+ // 🧵 classes
48
+ import clsx from 'clsx';
49
+ // 🗄️ built on AbDrawer
50
+ import AbDrawer, { type AbDrawerProps } from '../ab-drawer';
51
+ // 🎨 styles
52
+ import styles from './styles.module.css';
53
+
54
+ /** ⚙️ props: AbDrawer's, minus `side` (always bottom); scope defaults to the whole app */
55
+ export interface AbBottomDrawerProps extends Omit<AbDrawerProps, 'side'> {
56
+ side?: AbDrawerProps['side']; // 🙈 accepted for drop-in use (AbDrawerList `as`), always rendered as bottom
57
+ handle?: boolean; // ➖ grab handle at the top (default true; decorative)
58
+ }
59
+
60
+ /**
61
+ * 📱 AbBottomDrawer: the mobile bottom sheet (God's plan: the language picker on mobile, D40). AbDrawer
62
+ * with `side="bottom"`, `scope="app"`, the Home tokens (card surface, hairline top edge, 20px top radius,
63
+ * grab handle, safe-area padding) and at most 560px wide, centred, above 768px.
64
+ */
65
+ const AbBottomDrawer = ({ handle = true, scope = 'app', initialFocus = 'panel', className, ...rest }: AbBottomDrawerProps): ReactElement => (
66
+ <AbDrawer {...rest} scope={scope} initialFocus={initialFocus} side="bottom" className={clsx('AbBottomDrawer', styles.abBottomDrawer, handle && styles.withHandle, className)} />
67
+ );
68
+
69
+ // 📦 exports
70
+ export default AbBottomDrawer;
71
+ export { AbBottomDrawer };
@@ -0,0 +1,66 @@
1
+ /*
2
+ * @license MIT
3
+ * ~~~~~~~~~~~~
4
+ * ab-nextjs-components
5
+ * ~~~~~~~~~~~~
6
+ * Copyright (c) 2026 Abraham Ukachi. The abElements Project.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the 'Software'), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * @project: ab-nextjs-components
27
+ * @name: AbBottomDrawer styles
28
+ * @file: ab-bottom-drawer/styles.module.css
29
+ * @type: CSS module
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more 😜!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
39
+
40
+ /* 📱 the sheet: doubled class beats AbDrawer's `.abDrawer[data-side='bottom']` without !important (John's spec) */
41
+ .abBottomDrawer.abBottomDrawer {
42
+ --ab-bottom-drawer-radius: 20px; /* ⭕ = the gapped pane radius */
43
+ --ab-bottom-drawer-max-width: 560px; /* 📏 tablet+ */
44
+ background: var(--ab-color-card, #fff); /* 🎨 --card */
45
+ color: var(--ab-color-text, #211a16); /* 🖋️ --text */
46
+ border-top: 1px solid var(--ab-color-sheet-edge, transparent); /* ➖ dark: rgba(255,248,245,.08) via theme 0.3.5 */
47
+ border-radius: var(--ab-bottom-drawer-radius) var(--ab-bottom-drawer-radius) 0 0; /* ⭕ */
48
+ box-shadow: 0 -8px 28px rgb(25 18 12 / 0.12); /* 🌗 */
49
+ padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); /* 📱 16px + home indicator */
50
+ outline: none; /* 🎯 the sheet takes focus on open: no ring on the sheet itself */
51
+ }
52
+ /* ➖ grab handle (decorative): 36×4, radius 2 */
53
+ .withHandle.withHandle::before {
54
+ content: ''; display: block; flex: none; /* 🧱 */
55
+ width: 36px; height: 4px; margin: 8px auto 0; border-radius: 2px; /* 📏 */
56
+ background: var(--ab-color-handle, rgb(25 18 12 / 0.18)); /* 🎨 dark: rgba(255,248,245,.18) via theme */
57
+ }
58
+ .abBottomDrawer h2 { font-family: var(--ab-font-title, 'Mulish', inherit); font-size: 16px; font-weight: 800; letter-spacing: -0.01em; } /* 🏷️ John: Mulish 16/800 */
59
+ /* ✕ close: 44px hit area, no border, 8px-radius hover tint (the Home icon buttons); ring on keyboard focus only */
60
+ .abBottomDrawer [data-ab-part='drawer-close'] { inline-size: 44px; block-size: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--ab-color-muted, #6b5b50); }
61
+ .abBottomDrawer [data-ab-part='drawer-close']:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); }
62
+ .abBottomDrawer [data-ab-part='drawer-close']:focus { outline: none; }
63
+ .abBottomDrawer [data-ab-part='drawer-close']:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; }
64
+ @media (min-width: 768px) {
65
+ .abBottomDrawer.abBottomDrawer { inset-inline: 0; margin-inline: auto; max-width: var(--ab-bottom-drawer-max-width); } /* 📏 centred */
66
+ }
@@ -0,0 +1,92 @@
1
+ /*
2
+ * @license MIT
3
+ * ~~~~~~~~~~~~
4
+ * ab-nextjs-components
5
+ * ~~~~~~~~~~~~
6
+ * Copyright (c) 2026 Abraham Ukachi. The abElements Project.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the 'Software'), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * @project: ab-nextjs-components
27
+ * @name: AbBreadcrumbs (P2)
28
+ * @file: ab-breadcrumbs/index.tsx
29
+ * @type: Server-safe component
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ *
32
+ * Example usage:
33
+ * 1+|> <AbBreadcrumbs items={[{ label: "Getting started", href: "/introduction" }, { label: "Installation" }]} />
34
+ */
35
+
36
+ /*
37
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
38
+ * MOTTO: We'll always do more 😜!!!
39
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40
+ */
41
+
42
+
43
+ // ⚛️ React
44
+ import type { ReactElement, ReactNode } from 'react';
45
+ // 🧵 classes
46
+ import clsx from 'clsx';
47
+ // 🔗 the app's link (AbLinkProvider)
48
+ import Link from '../ab-link';
49
+ // 🔣 separators
50
+ import AbIcon from '../ab-icon';
51
+ // 🎨 styles
52
+ import styles from './styles.module.css';
53
+
54
+ /** 🍞 one crumb */
55
+ export interface AbBreadcrumbItem {
56
+ label: ReactNode; // 🏷️
57
+ href?: string; // 🔗 omitted on the last (current) crumb
58
+ }
59
+
60
+ /** ⚙️ props */
61
+ export interface AbBreadcrumbsProps {
62
+ items: readonly AbBreadcrumbItem[]; // 🍞 first → current
63
+ label?: string; // ♿ nav name (default "Breadcrumb")
64
+ className?: string; // 🏷️
65
+ }
66
+
67
+ /**
68
+ * 🍞 AbBreadcrumbs (P2): the tablet main bar's "Docs › **Home**". 13px faint links, the last crumb is the
69
+ * current page (650, text colour, `aria-current="page"`), 16px `chevron_right` separators (hidden from AT).
70
+ * Server-safe: no hooks.
71
+ */
72
+ const AbBreadcrumbs = ({ items, label = 'Breadcrumb', className }: AbBreadcrumbsProps): ReactElement => (
73
+ <nav aria-label={label} className={clsx('AbBreadcrumbs', styles.abCrumbs, className)} data-ab-part="breadcrumbs">
74
+ <ol className={styles.abCrumbsList}>
75
+ {items.map((it, i) => {
76
+ const last = i === items.length - 1; // 🎯 current page
77
+ return (
78
+ <li key={i} className={styles.abCrumb}>
79
+ {i > 0 && <AbIcon name="chevron_right" size={16} className={styles.abCrumbSep} />}
80
+ {last ? <span className={styles.abCrumbCurrent} aria-current="page">{it.label}</span>
81
+ : it.href ? <Link href={it.href} className={styles.abCrumbLink}>{it.label}</Link>
82
+ : <span>{it.label}</span>}
83
+ </li>
84
+ );
85
+ })}
86
+ </ol>
87
+ </nav>
88
+ );
89
+
90
+ // 📦 exports
91
+ export default AbBreadcrumbs;
92
+ export { AbBreadcrumbs };