ab-nextjs-components 0.7.0 → 0.8.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/CHANGELOG.md +72 -24
- package/README.md +20 -1
- package/ab-drawer/index.tsx +8 -0
- package/ab-drawer/kit.module.css +2 -0
- package/ab-search-drawer/index.tsx +105 -21
- package/ab-search-trigger/index.tsx +30 -36
- package/ab-search-trigger/styles.module.css +15 -0
- package/index.ts +2 -2
- package/package.json +3 -6
- package/types/index.d.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.8.0](https://github.com/abraham-ukachi/ab-nextjs-components/compare/v0.7.1...v0.8.0) (2026-11-22)
|
|
6
|
+
|
|
7
|
+
### ⚠ BREAKING CHANGES
|
|
8
|
+
|
|
9
|
+
* **`shortcut={false}` no longer silences the hotkey listener.** `shortcut` is now display-only (the ⌘K / Ctrl+K cap and `aria-keyshortcuts`). To stop this trigger from registering a listener, pass `hotkey={false}`.
|
|
10
|
+
**Migration:** replace `shortcut={false}` with `hotkey={false}` when the intent is "do not listen". To show the cap while the app shell owns the single `useAbHotkey('mod+k')`, use `shortcut hotkey={false}`.
|
|
11
|
+
* **`mod+k` and `aria-keyshortcuts` are platform-strict.** The listener matches Meta+K on Apple and Control+K elsewhere (no longer both on every platform). `aria-keyshortcuts` names only that platform's pair; SSR announces `Control+K`, and Apple clients switch to `Meta+K` after hydration.
|
|
12
|
+
**Migration:** if a test or custom listener expected both Meta and Control to open the drawer on every platform, switch it to the platform modifier (`Meta+K` on Apple, `Control+K` elsewhere). Prefer hooks' `useAbHotkey('mod+k')` and `useAbHotkeyLabel`, which already do this.
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* ⬆️ **Requires `ab-nextjs-hooks@^0.1.9`** (peer and dev) for `useAbHotkey` (G10). `ab-nextjs-hooks` is no longer an optional peer (`peerDependenciesMeta`), because `AbSearchTrigger` imports it unconditionally.
|
|
17
|
+
* ⌨️ **`AbSearchTrigger` splits `shortcut` from `hotkey` (D49).** `hotkey` registers the ⌘K / Ctrl+K listener (hooks' `useAbHotkey`, default on with `onOpen`); `shortcut` only shows the key cap and `aria-keyshortcuts` (default: whatever `hotkey` does). An app shell with one `useAbHotkey('mod+k')` renders its triggers with `shortcut hotkey={false}`. Two listening triggers open once per press. `isAbApplePlatform` is re-exported from hooks.
|
|
18
|
+
* ⏳ **AbSearchDrawer async states:** an async `search()` sets `aria-busy` on the results and listbox and shows "Searching…" (`labels.loading`); a sync one never flashes it. A failure is no longer shown as "No results": an offline panel (`offlineTitle` / `offlineHint`) when the search throws or rejects with the new `AbSearchOfflineError` (or `{ offline: true }`) or `navigator.onLine` is false, else an error panel (`errorTitle` / `errorHint`), both with a `retry` button. Offline retries by itself on `online`. New exports: `AbSearchOfflineError`, `isAbSearchOffline`, `AbSearchDrawerStatus`.
|
|
19
|
+
* 🏷️ **Result badge:** `AbSearchDrawerItem.badge` (for example `"EN"` on an English-fallback page) with an optional `badgeLabel` that screen readers hear instead.
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* 🐛 **Unique search ids (G60, part 1):** groups and options are keyed and numbered by position, not by raw `g.id` / `item.id`, so repeated ids no longer duplicate option ids or break ↑/↓.
|
|
24
|
+
* 🐛 **Hash returnFocus guard:** choosing a `#hash` result closes the drawer without refocusing the opener, so `#main-content` keeps the section that was just scrolled to (`hashReturnFocus` opts back in; Escape and ✕ still return focus). `AbDrawer` takes `restoreFocus` (`false` or a function read at close time). New export: `hasAbHashTarget`.
|
|
25
|
+
* ♿ **AbSearchTrigger touch audit:** under `pointer: coarse`, every trigger except `size="sm"` gets an invisible, centred hit area of at least 44×44px (the 40px pill, the 36px tablet field, AbAppBar's compact icon and pill). `size="sm"` keeps its 46px band and is now at least 44px wide for short labels. Nothing changes visually.
|
|
26
|
+
|
|
27
|
+
## [0.7.1](https://github.com/abraham-ukachi/ab-nextjs-components/compare/v0.7.0...v0.7.1) (2026-11-12)
|
|
28
|
+
|
|
29
|
+
* Normalize the changelog format and backfill missing entries.
|
|
30
|
+
|
|
1
31
|
## [0.7.0](https://github.com/abraham-ukachi/ab-nextjs-components/compare/v0.6.0...v0.7.0) (2026-11-06)
|
|
2
32
|
|
|
3
33
|
* 📋 **AbPropsTable (server component):** accessible, responsive docs prop tables from build-time structured data. Export it from the package root or `ab-nextjs-components/ab-props-table`; row/default/column/label types are exported too. An omitted default (or `{ kind: 'none' }`) means "No default", `{ kind: 'unknown' }` is explicitly unknown, and `{ kind: 'value', value }` renders a code value. All input is escaped text: no introspection, evaluation or raw HTML. Configurable captions/labels/column order, required/deprecated annotations, one keyboard-scrollable region, wrapping long types and light/dark token fallbacks are included.
|
|
@@ -44,7 +74,7 @@
|
|
|
44
74
|
* ♿ **Code blocks:** the `pre` is focusable, so keyboard users can scroll it.
|
|
45
75
|
* ⬆️ **Theme:** `ab-nextjs-theme` **^0.3.8**.
|
|
46
76
|
|
|
47
|
-
## [0.3.3](https://github.com/abraham-ukachi/ab-nextjs-components/compare/v0.3.2...v0.3.3) (2026-11-
|
|
77
|
+
## [0.3.3](https://github.com/abraham-ukachi/ab-nextjs-components/compare/v0.3.2...v0.3.3) (2026-11-02)
|
|
48
78
|
|
|
49
79
|
* 📌 **Icons pin dropped ([#20](https://github.com/abraham-ukachi/ab-nextjs-components/pull/20)):** the release-age pin for `ab-nextjs-icons` is removed.
|
|
50
80
|
* 🎯 **AbSearchTrigger:** the small size is 46px.
|
|
@@ -66,6 +96,17 @@
|
|
|
66
96
|
|
|
67
97
|
* 🔥 **Prune ([#17](https://github.com/abraham-ukachi/ab-nextjs-components/pull/17)):** 5 unused components are removed: `AbKeyFeature`, `AbMainHeadline`, `AbPreview`, `AbSwitchBack` and `AbTestHello` (and their server twins). ⚠️ Breaking if you imported them.
|
|
68
98
|
|
|
99
|
+
## [0.2.3](https://github.com/abraham-ukachi/ab-nextjs-components/compare/v0.2.2...v0.2.3) (2026-10-29)
|
|
100
|
+
|
|
101
|
+
* 🎪 **AbPlaygroundScene:** v6 scenes (welcome, all, `variant="auto"`), real export names in captions, a CSS locale cycle with stills, frame-card ratio, and the v6 card token
|
|
102
|
+
* 🔶 **AbButton:** owns per-type padding/size via `--ab-button-*` tokens; `size="lg"`, `color="bronze"` and opt-in `color="card"`; the server twin uses the client CSS (single source, twin guard)
|
|
103
|
+
* 🎠 **AbCarousel:** `autoHeight`, headless `AbCarouselProvider` with a region hook, `useAbCarouselKeys` (default scope `'main'`, `'document'` opt-in); each part resolves its own accent
|
|
104
|
+
* 📱 **AbMobileHeader:** extra row and 3-state theme, globe wiring, link fallback, compact mode, no-JS `<details>` language list, `barAt` to hide the bar from 768px
|
|
105
|
+
* 🧩 **AbThemeModeProvider** (`./ab-theme-mode`) so every theme toggle shares one mode; export map guarded
|
|
106
|
+
* 🔀 **AbFlowDiagram:** frame mode, rich nodes and dots
|
|
107
|
+
* 📥 **AbBottomDrawer:** close on swipe down and refocus its trigger
|
|
108
|
+
* ⬆️ `ab-nextjs-animations` `^0.2.5` and `ab-nextjs-theme` `^0.3.7` (with D33 pins at release time)
|
|
109
|
+
|
|
69
110
|
## [0.2.2](https://github.com/abraham-ukachi/ab-nextjs-components/compare/v0.2.1...v0.2.2) (2026-10-21)
|
|
70
111
|
|
|
71
112
|
- 🌍 AbPackagePreviewComponents `labels` ({ button, chip, switch }); English defaults unchanged, the 0.2.1 `button` / `chip` props still work
|
|
@@ -154,7 +195,7 @@ Includes everything planned for 0.1.15, which is not released separately.
|
|
|
154
195
|
* 📋 **`AbDrawerList` + `AbConfirmDrawer` presets (new, D38/D40).**
|
|
155
196
|
* 🌍 **`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`.
|
|
156
197
|
|
|
157
|
-
## 0.1.13
|
|
198
|
+
## [0.1.13](https://github.com/abraham-ukachi/ab-nextjs-components/compare/eba68a9f33aae456803645b145ed26a6a230ef92...v0.1.13) (2026-10-20)
|
|
158
199
|
|
|
159
200
|
* 🔗 **`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)
|
|
160
201
|
* 🔣 **AbIcon (G2): SVG first, non-breaking fallback.** Registered / explicit / built-in names render AbIcons SVGs. An unregistered name still renders the Material Symbols ligature (`data-ab-icon-fallback="font"`, as before) and warns once in development, so nothing goes blank in a patch; register every name before the app drops the font. **`AbIconRegistrar`** (`ab-nextjs-components/ab-icon/registrar`) is the server-safe way to register icons from a Server Component layout. 7 more built-ins: `chevron_left`, `chevron_right`, `menu`, `more_vert`, `search`, `close`, `expand_more`. AbMenu icons are AbIcons now (filled when selected)
|
|
@@ -183,21 +224,21 @@ Includes everything planned for 0.1.15, which is not released separately.
|
|
|
183
224
|
* ⬆️ Peers + dev: `ab-nextjs-theme ^0.3.4`, `ab-nextjs-icons ^0.2.4` (the filled `search` tab icon), `ab-nextjs-hooks ^0.1.7`
|
|
184
225
|
* ⏳ **D33:** exact `minimumReleaseAgeExclude` pins for the three siblings in the lockfile that are < 24h old: `ab-nextjs-icons@0.2.4`, `ab-nextjs-theme@0.3.4`, `ab-nextjs-hooks@0.1.7`, each until publish + 24h (2026-10-21 17:15 / 17:25 / 17:28 UTC). `release-age.test.ts` fails after that and rejects pins that aren't in the lockfile
|
|
185
226
|
|
|
186
|
-
## 0.1.12
|
|
227
|
+
## [0.1.12](https://github.com/abraham-ukachi/ab-nextjs-components/compare/5ba7d20bf57a602b68cd323c66ebe432424025b8...eba68a9f33aae456803645b145ed26a6a230ef92) (2026-10-16)
|
|
187
228
|
|
|
188
229
|
* ♿ **AbInstallSnippet tabs pass AA in every state.** Each state now paints an explicit text/background pair from the live palette instead of a transparent tab and a 12% bronze tint: inactive `on-surface-variant` on `surface-container` (8.04:1 light / 9.67:1 dark), hover `on-surface` on an 8% `on-surface` state layer (12.63:1 / 10.39:1), active and active + hover `on-primary-container` on `primary-container` (13.28:1 / 7.22:1). Fallbacks are the light bronze palette, so it also passes without the theme
|
|
189
230
|
* 🥉 **New `AbButton type="filled"`** (client + server): solid bronze `--md-sys-color-primary` with `on-primary` label and icon. Sets `data-type="filled"`, styled with hover / focus / disabled by `ab-nextjs-theme@^0.3.3`; a `.isFilled` fallback paints the rest state on older themes. `AbButtonType` gains `'filled'`
|
|
190
231
|
* ⬆️ **`ab-nextjs-theme ^0.3.3`** (peer + dev, was `^0.3.1`) for the filled hover / focus / disabled states and the button icon-colour fix. The `.isFilled` fallback stays for apps still on an older theme
|
|
191
232
|
* Tests: contrast computed from the theme palette (light + dark, every state, plus the no-theme fallbacks); filled type on client + server twins. Checked in WebKit (ratios above; filled 6.47:1 light / 7.74:1 dark)
|
|
192
233
|
|
|
193
|
-
## 0.1.11
|
|
234
|
+
## [0.1.11](https://github.com/abraham-ukachi/ab-nextjs-components/compare/f6fd1fa600e9c52d469bee9dfb5f042636d3aae3...5ba7d20bf57a602b68cd323c66ebe432424025b8) (2026-10-15)
|
|
194
235
|
|
|
195
236
|
* 🐛 **AbFlowDiagram: nodes no longer cover the header in small boxes.** At 390px wide the Live Playground's top node ("core") sat under the "Live Playground" header. With a header (title, live dot or caption) the root now gets `data-ab-header="true"`, and nodes + wires live in a stage that starts below the header band: `--ab-flow-diagram-inset-top` (default `2.75rem`, tunable). Node `x` / `y` stay 0–100 but now map onto that stage, and the wires share the same box so they still meet the nodes. Without a header the stage is the full card (unchanged)
|
|
196
237
|
* 📏 **AbFlowDiagram nodes scale with the card:** `container-type: inline-size` on the root; node text, padding, radius and the hub glow use clamped `cqi` sizes (13px on a 760px card, 11px at 390px)
|
|
197
238
|
* 🪐 **AbFlowDiagram: side nodes are never clipped** (s04's `--ab-color-bronze` and s07's `reduced motion` were cut off at the card edge in a 390px box). The orbit now scales with the box. Each node is anchored at the same fraction of its own box as its position (`translate(-x%, -y%)` via `--ab-flow-node-x` / `-y`; `x = y = 50` is the old centring), so the outer ring pulls in by exactly the node's width, and the wire end stays inside the pill. Nodes + wires also sit inside a side margin, `--ab-flow-diagram-inset-x` (default `0.5rem`), and an over-long label ellipsises (`max-width: 100%`). Positions are clamped to 0–100 like the wires
|
|
198
239
|
* Tests: header flag, stage insets shared by nodes + wires, 390px geometry, clamped scaling, proportional anchoring + side margin, s04 / s07 orbit geometry at 390 / 760px × 276 / 380px. Checked in WebKit at 390px: "core" top 9px → 53px (header ends at 33px); no node overlaps the header or is clipped at 390 / 760px. After the orbit fix: s04 + s07 have no node clipped (x or y) or over the header at 390 / 760px wide × 276px / 380px / default-ratio heights (before: 5 nodes clipped at 390px, 2 at 760px)
|
|
199
240
|
|
|
200
|
-
## 0.1.10
|
|
241
|
+
## [0.1.10](https://github.com/abraham-ukachi/ab-nextjs-components/compare/5e8d9e84398714e47ac947cc405009850eef2398...f6fd1fa600e9c52d469bee9dfb5f042636d3aae3) (2026-10-15)
|
|
201
242
|
|
|
202
243
|
* **Motion comes from ab-nextjs-animations (>= 0.2.4, now a required peer):** no component CSS declares its own `transition`, `animation` or `@keyframes` any more. Each component imports the package stylesheet it needs:
|
|
203
244
|
* AbCarousel: `slide-step` (direction-aware enter / leave via `data-ab-direction`) + `motion` (buttons, dots)
|
|
@@ -222,11 +263,11 @@ Includes everything planned for 0.1.15, which is not released separately.
|
|
|
222
263
|
* **AbInstallSnippet (G35, new):** pnpm / npm / yarn / bun tabs (APG tablist), choice shared via `useAbLocalStorage`, copy button with polite status, `data-ab-swipe-ignore`; `getAbInstallCommand` helper
|
|
223
264
|
* **AbLocaleSwitcher (G7, new):** menu button + `menuitemradio`, typeahead, `onSelect` or `getHref` (+ `hrefLang`)
|
|
224
265
|
* **AbIcon (G2, new, `ab-nextjs-components/ab-icon`):** AbIcons as inline SVG; client twin resolves `svg` prop → `registerAbIcons` registry → Material Symbols font (never imports the full map); server twin renders any icon; weights 100–700 map to the icons package stroke table; 8 built-ins (arrows, theme, language, copy / check) imported per icon from `ab-nextjs-icons/ab-icons/icons/*` (needs icons >= 0.2.3)
|
|
225
|
-
* **AbCarousel:** prev / next arrows now render through AbIcon (weight 300); `--ab-carousel-icon-stroke` removed
|
|
266
|
+
* **AbCarousel:** prev / next arrows now render through AbIcon (weight 300); `--ab-carousel-icon-stroke` removed
|
|
226
267
|
* **AbFlowDiagram (G38, new, server component):** `figure role="img"` scenes, CSS-only draw + pulse, paused while inactive, 3 loops on mobile, reduced motion shows the poster frame; `getAbFlowEdgePath` helper
|
|
227
268
|
* Dev: `happy-dom` + `@testing-library/react` for DOM tests
|
|
228
269
|
|
|
229
|
-
## 0.1.9
|
|
270
|
+
## [0.1.9](https://github.com/abraham-ukachi/ab-nextjs-components/compare/9d443f2ac9944d16951eb613f7a4bd1feab82712...5e8d9e84398714e47ac947cc405009850eef2398) (2026-10-14)
|
|
230
271
|
|
|
231
272
|
- **AbLogo:** `wordmark` prop (`true` → "Elements", or any string) renders a mark + Quicksand Bold lockup (`font-quicksand-bold` from ab-nextjs-fonts); `color` prop (`--ab-logo-color`); light / dark (`html.dark`)
|
|
232
273
|
- **AbLogo fix:** `naked` with no `src` now masks with the shipped Ab mark (via `--app-logo-url` fallback) instead of a bronze square when the chrome CSS isn't loaded
|
|
@@ -239,55 +280,50 @@ Includes everything planned for 0.1.15, which is not released separately.
|
|
|
239
280
|
- **AbSplash:** StrictMode-safe teardown (`scheduleAbSplashFinish` / `cancelAbSplashFinish`); overflow failsafe verified in Chromium + WebKit
|
|
240
281
|
- **Tooling:** `typecheck` script, `types/css.d.ts`, vitest automatic JSX, `scripts/build-demo.mjs`
|
|
241
282
|
|
|
242
|
-
## 0.1.8
|
|
283
|
+
## [0.1.8](https://github.com/abraham-ukachi/ab-nextjs-components/compare/bb3a452d8cd89d57d6a3951b2f640a58ecdeb775...9d443f2ac9944d16951eb613f7a4bd1feab82712) (2026-10-05)
|
|
243
284
|
|
|
244
285
|
- **Chrome styles:** dialog, toast, logo (`span.app-logo`), spinner, and empty-state doodle CSS + SVG assets now ship here via `@import "ab-nextjs-components/styles.css"` (import after `ab-nextjs-theme/styles.css`)
|
|
245
286
|
- **AbLogo:** comments corrected — mask fallback `--app-logo-url` is owned by this package’s chrome CSS, not the theme
|
|
246
287
|
|
|
247
|
-
## 0.1.7
|
|
288
|
+
## [0.1.7](https://github.com/abraham-ukachi/ab-nextjs-components/compare/e67e89dbeba6055e608d3fb1aa6aa2fb511ab6fc...bb3a452d8cd89d57d6a3951b2f640a58ecdeb775) (2026-10-05)
|
|
248
289
|
|
|
249
290
|
- **AbNavbar:** root `<nav>` sets `data-ab-part="bottomBar"` (client + server)
|
|
250
291
|
|
|
251
|
-
## 0.1.6
|
|
292
|
+
## [0.1.6](https://github.com/abraham-ukachi/ab-nextjs-components/compare/1ede72f33ca1e6910c793454098ad9889a303bb2...e67e89dbeba6055e608d3fb1aa6aa2fb511ab6fc) (2026-10-05)
|
|
252
293
|
|
|
253
294
|
- **AbSidebar:** renders `<nav data-ab-part="sidebar">` (was `<aside>`) so aside dialogs/menus never hit the sidebar
|
|
254
295
|
- **AbMenu:** sets `data-id={id}` (keeps `id`) and `data-id` / `menu-item` on items so `useAbMenu` can open it; cancel is `li[role=close-menu]`
|
|
255
296
|
- **AbLogo:** ships `ab-logo/ab-logo.svg` and defaults `src` to an inlined data URI of that asset; mask types without `src`/`mask` defer to `ab-nextjs-theme` `--app-logo-url`
|
|
256
297
|
|
|
257
|
-
## 0.1.5
|
|
298
|
+
## [0.1.5](https://github.com/abraham-ukachi/ab-nextjs-components/compare/fd3e776be781ea8ad0d7aa4d6ca56b31c0ae1a4a...1ede72f33ca1e6910c793454098ad9889a303bb2) (2026-10-03)
|
|
258
299
|
|
|
259
300
|
- Publish to npm automatically from GitHub Actions with Trusted Publishing (OIDC + provenance, no NPM_TOKEN)
|
|
260
301
|
- `next` peer is now `^16.3.4`; dev dependency on ab-nextjs-hooks comes from the registry
|
|
261
302
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
## 0.1.4 — 2026-09-23
|
|
303
|
+
## [0.1.4](https://github.com/abraham-ukachi/ab-nextjs-components/compare/8fcbcaa9e4d5dd35e63d6c9b84cb682f5f04d1c8...fd3e776be781ea8ad0d7aa4d6ca56b31c0ae1a4a) (2026-09-23)
|
|
265
304
|
|
|
266
305
|
- Release from `main` after merge of PR #1 (Next 16.3.4 + Phase 1–5 ports).
|
|
267
306
|
|
|
268
|
-
|
|
269
307
|
* **Port (client):** AbBrand, AbName, AbNavbar, AbSidebar, AbText, AbTestHello, AbKeyFeature, AbMainHeadline, AbPreview, AbProduct, AbProductItem, AbSwitchBack, AbDemoBox, AbDemoCode
|
|
270
308
|
* **Port (server):** AbBrand, AbName, AbNavbar, AbSidebar, AbNavLink, AbText, AbTestHello, AbKeyFeature, AbSwitchBack
|
|
271
309
|
* Select/MenuItem skipped — empty on Projects (GitHub-only historically)
|
|
272
310
|
* Product/Preview adapted (Dexie/providers/i18n stripped); usable props API kept
|
|
273
|
-
* Catalog **51 Done** (36 client / 15 server).
|
|
274
|
-
|
|
275
|
-
# Changelog
|
|
311
|
+
* Catalog **51 Done** (36 client / 15 server).
|
|
276
312
|
|
|
277
|
-
###
|
|
313
|
+
### Phase 4 Port
|
|
278
314
|
|
|
279
315
|
* **Port:** AbSearchbar, AbSearchResult, AbPagePaginator, AbPageSwitcher, AbProgressChips, AbPrice, AbPriceTag
|
|
280
316
|
* **Adapt:** AbImage (Dexie / offline / background-removal stripped; next/image + optional fallback)
|
|
281
317
|
* **Port (server):** AbPolygon
|
|
282
|
-
* Catalog 28 Done (22 client / 6 server). Plain CSS modules.
|
|
318
|
+
* Catalog 28 Done (22 client / 6 server). Plain CSS modules.
|
|
283
319
|
|
|
284
|
-
###
|
|
320
|
+
### Phase 2 Adapt + Phase 3 Port
|
|
285
321
|
|
|
286
322
|
* **Adapt:** **AbBalloon** (`title=` locked) — Input now uses real AbBalloon
|
|
287
323
|
* **Port:** AbAvatar (client + server), AbBadge (server), AbTab, AbTabs, AbMenu, AbCollapsible, AbColor, AbInfo, AbLikeButton
|
|
288
324
|
* Plain CSS modules; LYD brand/nav/i18n stripped; Select/MenuItem skipped (not on Projects)
|
|
289
325
|
|
|
290
|
-
###
|
|
326
|
+
### Phase 2
|
|
291
327
|
|
|
292
328
|
* Ported **AbIcon** (client + server) — Material Symbols ligatures
|
|
293
329
|
* Ported **AbLogo** (client + server) — contained | outlined | hollow | naked; defaults from `ab-nextjs-icons` logos (`#a67c52`), optional `src` / `mask`
|
|
@@ -297,10 +333,22 @@ Includes everything planned for 0.1.15, which is not released separately.
|
|
|
297
333
|
* Hard peers: next 16.3.4, react^19, clsx; soft optional peers: theme / icons / hooks / animations
|
|
298
334
|
* Plain CSS modules (no `@apply`); theme `data-*` attrs preserved on buttons
|
|
299
335
|
|
|
300
|
-
###
|
|
336
|
+
### Phase 1
|
|
301
337
|
|
|
302
338
|
* Next.js **16.3.4** / React 19 tooling scaffold + Pending catalog
|
|
303
339
|
|
|
304
|
-
|
|
340
|
+
## [0.1.3](https://github.com/abraham-ukachi/ab-nextjs-components/compare/9169fe98d2519db14aa68e2b00ebab83e5d88b59...8fcbcaa9e4d5dd35e63d6c9b84cb682f5f04d1c8) (2026-09-23)
|
|
341
|
+
|
|
342
|
+
* Staged Phase 5 publish ahead of the 0.1.4 release from main
|
|
343
|
+
|
|
344
|
+
## [0.1.2](https://github.com/abraham-ukachi/ab-nextjs-components/compare/7131423436c545ae706725da0801decdb12ef055...9169fe98d2519db14aa68e2b00ebab83e5d88b59) (2024-06-01)
|
|
305
345
|
|
|
306
346
|
* Stub package version bump
|
|
347
|
+
|
|
348
|
+
## [0.1.1](https://github.com/abraham-ukachi/ab-nextjs-components/compare/6d7c433915135e537aebcf1fea69b2d932bef075...7131423436c545ae706725da0801decdb12ef055) (2024-06-01)
|
|
349
|
+
|
|
350
|
+
* Version bump to 0.1.1
|
|
351
|
+
|
|
352
|
+
## 0.1.0 (2024-06-01)
|
|
353
|
+
|
|
354
|
+
* Initial release
|
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ New subpaths for the docs / PWA shell. All links go through **`AbLinkProvider`**
|
|
|
86
86
|
* 🎯 **Active item (0.5.0):** `activeMatch` picks the rule: `'best'` (default) lights only the deepest matching item, so `/docs` and `/docs/x` never both light on `/docs/x`; `'prefix'` lights every parent too (the pre-0.5.0 look); `'exact'` lights only an equal href. An item's `exact: true` (never a parent) or `exact: false` (parent allowed) overrides it. Query strings, hashes and trailing slashes are ignored. AbNavDrawer takes the same `activeMatch` and `locales`. The helpers `getAbActiveHrefs`, `matchAbHref` and `normalizeAbHref` and the `AbActiveMatch` type are exported.
|
|
87
87
|
* **`<AbNavbar>` v2 (G41)**: `items` of `{ kind: 'link', href, icon, label }` or `{ kind: 'button', id, icon, label, onSelect, expanded?, controls? }`, filled active icon, `aria-current`, safe-area padding.
|
|
88
88
|
* **`<AbAppBar>` (G43)**: `brand`, `search`, `nav=[{ href, label }]`, `activeHref`, `actions`, `leading`, sticky with the theme hairline. Below **1180px** the nav moves into a "More" `AbMenu` (G26). It closes on Escape and outside click. With JS off the nav stays inline.
|
|
89
|
-
* **`<AbSearchTrigger>` + `<AbKbd>` (G44)**: shows ⌘K on Apple and Ctrl K elsewhere, sets `aria-keyshortcuts
|
|
89
|
+
* **`<AbSearchTrigger>` + `<AbKbd>` (G44)**: shows ⌘K on Apple and Ctrl K elsewhere, sets `aria-keyshortcuts` (`Meta+K` on Apple, `Control+K` elsewhere since 0.8.0), calls `onOpen` (button) or falls back to `href` (link). `comingSoon` makes it `aria-disabled`.
|
|
90
90
|
* **`<AbCard>` / `<AbPackageCard>` (G45)**: one link per card (the title, stretched over the card). Hover lifts 2px on laptop and up only, never under `prefers-reduced-motion`.
|
|
91
91
|
* **`<AbToc>` (G46)**: plain `#id` links, `aria-current="location"`. Pair with `useAbScrollSpy` / `scrollToAbSection` from `ab-nextjs-hooks@0.1.7`.
|
|
92
92
|
* **`<AbBalloon>`** is now a real tooltip: `role="tooltip"`, `aria-describedby` on the trigger, shows on focus, after 300ms on hover, and hides on Escape.
|
|
@@ -97,6 +97,25 @@ New subpaths for the docs / PWA shell. All links go through **`AbLinkProvider`**
|
|
|
97
97
|
registerAbIcons({ code })
|
|
98
98
|
```
|
|
99
99
|
|
|
100
|
+
### Search drawer & trigger (0.8.0) 🔎
|
|
101
|
+
|
|
102
|
+
Needs **`ab-nextjs-hooks@^0.1.9`** (`useAbHotkey`).
|
|
103
|
+
|
|
104
|
+
* ⌨️ **One ⌘K listener (D49):** on `<AbSearchTrigger>`, `hotkey` now only **registers** the listener (through `useAbHotkey`), and `shortcut` only **shows** the key cap and `aria-keyshortcuts`. `shortcut` is no longer an alias of `hotkey`. When the app shell owns the single listener, render every trigger with `shortcut hotkey={false}`:
|
|
105
|
+
```tsx
|
|
106
|
+
'use client'
|
|
107
|
+
import { useAbHotkey } from 'ab-nextjs-hooks/useAbHotkey'
|
|
108
|
+
|
|
109
|
+
useAbHotkey('mod+k', () => setOpen('search')) // ⌨️ once, in the shell (`mod+k` fires in inputs by default)
|
|
110
|
+
<AbSearchTrigger variant="field" onOpen={() => setOpen('search')} shortcut hotkey={false} /> // 👀 the cap only
|
|
111
|
+
```
|
|
112
|
+
Without either prop nothing changes: a trigger with `onOpen` listens and shows the cap. `mod+k` is ⌘K on Apple and Ctrl+K elsewhere (no longer both on every platform), and two listening triggers no longer open twice on one press.
|
|
113
|
+
* ⏳ **`<AbSearchDrawer>` async states:** while an async `search()` is pending, the results get `aria-busy` and "Searching…" (labels `loading`). A failure shows an offline panel (`offlineTitle`, `offlineHint`) or an error panel (`errorTitle`, `errorHint`) with a `retry` button, never "No results". Offline means the search threw or rejected with `AbSearchOfflineError` (or an error with `offline: true`), or `navigator.onLine` is false. An offline search retries by itself on the `online` event. `isAbSearchOffline` and the `AbSearchDrawerStatus` type are exported.
|
|
114
|
+
* 🏷️ **Result badge:** `AbSearchDrawerItem` takes `badge` (for example `"EN"` on an English-fallback page) and `badgeLabel` (what screen readers hear instead, for example "English only").
|
|
115
|
+
* 🧹 **Unique ids (G60):** groups and options are keyed and numbered by position, so repeated group or item ids no longer collide.
|
|
116
|
+
* ↩️ **Hash guard:** choosing a `#hash` result closes the drawer **without** sending focus back to the opener, so the section that was just scrolled into view in `#main-content` stays put (`hashReturnFocus` opts back in). Escape and ✕ still return focus. Under it, `<AbDrawer restoreFocus>` takes `false` or a function that is read when the drawer closes. `hasAbHashTarget(href)` is exported.
|
|
117
|
+
* 👆 **Touch audit:** under `pointer: coarse` every trigger has an invisible hit area of at least 44×44px: the 40px pill, the 36px tablet `variant="field"`, AbAppBar's compact 40px icon and 34px pill, and `size="sm"` (now at least 44px wide for short labels). Nothing changes visually.
|
|
118
|
+
|
|
100
119
|
### 404 gaps (unreleased) 🚧
|
|
101
120
|
|
|
102
121
|
* **`<AbErrorHero>`** (`ab-nextjs-components/ab-error-hero`, also in the barrel): the 404 / error hero from the 404 mocks. A big gradient `code` (default `"404"`) over a faded dot grid, a tilted `badge` tile (default `<AbIcon name="link_off" />`, needs ab-nextjs-icons ^0.2.6 and `registerAbIcons({ link_off })`; pass `badge={null}` to hide it), the `title` (h1, the code is read once), `message`, an optional `hint` row and an `actions` slot. Server-safe, no motion.
|
package/ab-drawer/index.tsx
CHANGED
|
@@ -100,6 +100,9 @@ export interface AbDrawerProps {
|
|
|
100
100
|
handleLabels?: { expand: string; collapse: string }; // ♿ the handle button (default "Expand" / "Collapse")
|
|
101
101
|
centerIn?: 'main'; // 💻 bottom only, 768px and up: centred in the main pane, min(640px, main width) wide, ≤ 70% tall
|
|
102
102
|
returnFocus?: string; // ↩️ selector focused on close when there was no focusable opener (an edge swipe); default AB_DRAWER_RETURN_FOCUS (the header / brand logo)
|
|
103
|
+
/** ↩️ 0.8.0: send focus back on close at all (default true). A function is read AT close time, e.g. AbSearchDrawer
|
|
104
|
+
* skips it after a `#hash` result so the opener doesn't pull `#main-content` away from the new section. */
|
|
105
|
+
restoreFocus?: boolean | (() => boolean);
|
|
103
106
|
closeIcon?: ReactNode; // ✕ the close glyph (default a text ✕)
|
|
104
107
|
headerStart?: ReactNode; // 🏷️ header content that does NOT label the dialog (e.g. a logo; then use `aria-label`). `title` wins
|
|
105
108
|
className?: string; // 🏷️
|
|
@@ -175,6 +178,8 @@ const reducedMotion = (): boolean => typeof window !== 'undefined' && typeof win
|
|
|
175
178
|
const AbDrawer = (props: AbDrawerProps): ReactElement => {
|
|
176
179
|
const { open, onClose, scope = 'app', side = 'bottom', title, id, children, footer, size, modal = true, closeLabel = 'Close', noJsFallback = true, initialFocus = 'first', className } = props;
|
|
177
180
|
const { tier, swipe = false, snapPoints = false, defaultSnap = 'partial', onSnapChange, handleLabels, centerIn, returnFocus, closeIcon, headerStart, fullOnly = false } = props; // 🆕 0.2.0
|
|
181
|
+
const restore = useRef(props.restoreFocus); // ↩️ 0.8.0: the latest restoreFocus, read by the close cleanup (not a dep)
|
|
182
|
+
useEffect(() => { restore.current = props.restoreFocus; }, [props.restoreFocus]); // 🔁 synced after render
|
|
178
183
|
const auto = useId().replace(/[^A-Za-z0-9_-]/g, ''); // 🆔 SSR-stable
|
|
179
184
|
const dialogId = id ?? `ab-drawer-${auto}`; // 🆔
|
|
180
185
|
const titleId = `${dialogId}-title`; // 🏷️
|
|
@@ -242,6 +247,9 @@ const AbDrawer = (props: AbDrawerProps): ReactElement => {
|
|
|
242
247
|
(first ?? panel.current).focus({ preventScroll: true });
|
|
243
248
|
const node = panel.current; // 📌 this open's panel (for the cleanup)
|
|
244
249
|
return () => {
|
|
250
|
+
// ↩️ 0.8.0: the owner may say "not this time" (a #hash result): leave focus where navigation puts it
|
|
251
|
+
const want = restore.current; // 📖 latest value
|
|
252
|
+
if (want === false || (typeof want === 'function' && !want())) return; // 🙅 no focus return
|
|
245
253
|
const had = opener.current as HTMLElement | null; // ↩️
|
|
246
254
|
const usable = had && had !== document.body && had.isConnected ? had : null; // 🤏 a swipe has no opener
|
|
247
255
|
// ↩️ 0.2.0 fallback: the first VISIBLE match (an app often renders the logo twice, one hidden per breakpoint)
|
package/ab-drawer/kit.module.css
CHANGED
|
@@ -177,6 +177,8 @@
|
|
|
177
177
|
.srText > b { display: block; font: 600 15px/1.3 var(--ab-font-body, 'Inter', inherit); color: var(--ab-color-text, #211a16); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
178
178
|
.srText > small { display: block; font: 400 13px/1.35 var(--ab-font-body, 'Inter', inherit); color: var(--ab-color-muted, #6b5b50); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
179
179
|
.srMeta { flex: none; font: 400 12px/1 var(--ab-font-mono, 'Roboto Mono', monospace); color: var(--ab-color-muted, #6b5b50); }
|
|
180
|
+
/* 🏷️ 0.8.0: the per-result badge (e.g. "EN" = English fallback): a small outlined pill, AA muted text, never shrinks */
|
|
181
|
+
.srBadge { flex: none; display: inline-flex; align-items: center; box-sizing: border-box; block-size: 20px; padding: 0 6px; border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); border-radius: var(--ab-radius-pill, 999px); font: 700 11px/1 var(--ab-font-body, 'Inter', inherit); letter-spacing: 0.04em; color: var(--ab-color-muted, #6b5b50); }
|
|
180
182
|
.mark { background: none; color: var(--ab-color-accent-text, #8b6340); font-weight: 700; } /* 🖍️ the matched part */
|
|
181
183
|
.nores { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 24px; }
|
|
182
184
|
.nores > .pkgIc { inline-size: 56px; block-size: 56px; border-radius: 16px; }
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
*
|
|
32
32
|
* Example usage:
|
|
33
33
|
* 1+|> const [open, setOpen] = useState(false)
|
|
34
|
-
* -|>
|
|
34
|
+
* -|> useAbHotkey('mod+k', () => setOpen(true)) // ⌨️ 0.8.0: ONE listener (ab-nextjs-hooks/useAbHotkey); fires in inputs by default
|
|
35
|
+
* -|> <AbSearchTrigger variant="field" label="Search…" onOpen={() => setOpen(true)} shortcut hotkey={false} />
|
|
35
36
|
* -|> <AbSearchDrawer open={open} onClose={() => setOpen(false)} search={(q) => index.query(q)} />
|
|
36
37
|
*/
|
|
37
38
|
|
|
@@ -65,6 +66,10 @@ export interface AbSearchDrawerItem {
|
|
|
65
66
|
description?: string; // 📝 one line (ellipsis)
|
|
66
67
|
meta?: string; // 🏷️ mono, e.g. "v0.2.x"
|
|
67
68
|
icon?: string; // 🔣 the 32px tile's AbIcons name
|
|
69
|
+
/** 🏷️ 0.8.0: a short visible badge after the text, e.g. "EN" on a page that falls back to English */
|
|
70
|
+
badge?: string;
|
|
71
|
+
/** ♿ 0.8.0: what the badge means for screen readers (e.g. "English only"); without it the badge text is read */
|
|
72
|
+
badgeLabel?: string;
|
|
68
73
|
}
|
|
69
74
|
/** 📦 results grouped by package */
|
|
70
75
|
export interface AbSearchDrawerGroup { id: string; label: string; meta?: string; items: readonly AbSearchDrawerItem[] } // 🏷️ "Components" + "ab-nextjs-components"
|
|
@@ -82,6 +87,29 @@ export interface AbSearchDrawerLabels {
|
|
|
82
87
|
noResultsFor?: (q: string) => ReactNode; // No results for “q”
|
|
83
88
|
hint?: ReactNode; // the line under it
|
|
84
89
|
didYouMean?: string; // "Did you mean"
|
|
90
|
+
// ⏳ 0.8.0: async states (a failed search() is no longer shown as "No results")
|
|
91
|
+
loading?: string; // "Searching…" (shown + announced while an async search() is pending)
|
|
92
|
+
offlineTitle?: string; // "You're offline"
|
|
93
|
+
offlineHint?: ReactNode; // "Search needs a connection the first time. Reconnect and try again."
|
|
94
|
+
errorTitle?: string; // "Search isn't available right now"
|
|
95
|
+
errorHint?: ReactNode; // "Something went wrong while searching. Try again in a moment."
|
|
96
|
+
retry?: string; // "Try again"
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** ⏳ 0.8.0: where a search stands — 'idle' (under 2 characters), 'loading', 'done', 'offline' or 'error' */
|
|
100
|
+
export type AbSearchDrawerStatus = 'idle' | 'loading' | 'done' | 'offline' | 'error';
|
|
101
|
+
|
|
102
|
+
/** 📴 0.8.0: throw (or reject with) this from `search()` when the index can't be fetched offline */
|
|
103
|
+
export class AbSearchOfflineError extends Error {
|
|
104
|
+
constructor(message = 'Search is offline') { super(message); this.name = 'AbSearchOfflineError'; } // 🏷️ the name is what we check
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** 📴 0.8.0: isAbSearchOffline — is this search failure "offline"? An AbSearchOfflineError (by name, so it survives
|
|
108
|
+
* bundling twice), an error with `offline: true`, or any failure while `navigator.onLine` is false. */
|
|
109
|
+
export function isAbSearchOffline(error: unknown): boolean {
|
|
110
|
+
const e = error as { name?: unknown; offline?: unknown } | null | undefined; // 🔍 duck-typed
|
|
111
|
+
if (e && (e.name === 'AbSearchOfflineError' || e.offline === true)) return true; // 📴 said so
|
|
112
|
+
return typeof navigator !== 'undefined' && navigator.onLine === false; // 🌐 the browser says so
|
|
85
113
|
}
|
|
86
114
|
|
|
87
115
|
/** ⚙️ props */
|
|
@@ -97,6 +125,9 @@ export interface AbSearchDrawerProps {
|
|
|
97
125
|
recentWhen?: 'always' | 'empty'; // 🕘 'always' = above the results (the frames, default); 'empty' = only with no query
|
|
98
126
|
labels?: AbSearchDrawerLabels; // 🌍
|
|
99
127
|
returnFocus?: string; // ↩️
|
|
128
|
+
/** ↩️ 0.8.0: after a `#hash` result, still send focus back to the opener (default false: the guard skips it, so the
|
|
129
|
+
* opener never snaps `#main-content` away from the section that was just scrolled to). Escape / ✕ always return focus. */
|
|
130
|
+
hashReturnFocus?: boolean;
|
|
100
131
|
id?: string; // 🆔
|
|
101
132
|
className?: string; // 🏷️
|
|
102
133
|
}
|
|
@@ -114,6 +145,12 @@ export function addAbSearchRecent(list: readonly string[], term: string, limit =
|
|
|
114
145
|
return [t, ...list.filter((x) => x.toLowerCase() !== t.toLowerCase())].slice(0, limit);
|
|
115
146
|
}
|
|
116
147
|
|
|
148
|
+
/** #️⃣ 0.8.0: hasAbHashTarget — does this href jump to a section (`/docs/x#install`, `#top`)? An empty `#` does not. */
|
|
149
|
+
export function hasAbHashTarget(href: string): boolean {
|
|
150
|
+
const i = href.indexOf('#'); // 🔍 the fragment start
|
|
151
|
+
return i >= 0 && i < href.length - 1; // ✅ a non-empty fragment
|
|
152
|
+
}
|
|
153
|
+
|
|
117
154
|
/** 🖍️ highlightAbSearch — wrap every case-insensitive match of `q` in `<mark>` (bronze 700 via the kit) */
|
|
118
155
|
export function highlightAbSearch(text: string, q: string): ReactNode {
|
|
119
156
|
const needle = q.trim(); if (needle.length < 2) return text;
|
|
@@ -132,20 +169,28 @@ export function highlightAbSearch(text: string, q: string): ReactNode {
|
|
|
132
169
|
*
|
|
133
170
|
* - 📱 below 768px: straight to full height (no 70% stop: the keyboard is up); a hard swipe down closes
|
|
134
171
|
* - 💻 768px and up: centred in the main pane, min(640px, main width), 70% tall; results scroll inside with a 48px fade
|
|
135
|
-
* - ⌨️ no
|
|
172
|
+
* - ⌨️ no listener of its own: the app shell owns ONE `useAbHotkey('mod+k')` (hooks 0.1.9, D49) and every
|
|
173
|
+
* AbSearchTrigger shows the cap with `shortcut hotkey={false}` (0.8.0); the Search tab / field open it too
|
|
136
174
|
* - 🔤 48px input (2px bronze border), autofocused; a 40px clear button keeps focus in the input
|
|
137
175
|
* - 🕘 up to 4 recent searches (localStorage `ab:search:recent`), saved on Enter or when a result opens; each removable
|
|
138
176
|
* - 📦 results after a 150ms debounce from 2 characters, grouped by package; matches in a bronze `<mark>`
|
|
139
177
|
* - ♿ combobox (aria-expanded / -controls / -autocomplete="list" / -activedescendant) + listbox with labelled groups
|
|
140
178
|
* and options; ↑/↓ wrap across groups, Enter opens the active (else the first) result, Esc clears then closes;
|
|
141
179
|
* a polite live region says "4 results" / "No results"
|
|
180
|
+
* - ↩️ 0.8.0: choosing a `#hash` result closes WITHOUT refocusing the opener (`hashReturnFocus` to opt back in), so the
|
|
181
|
+
* scroll to the section inside `#main-content` stays put; the app moves focus to the section if it wants
|
|
182
|
+
* - ⏳ 0.8.0: an async `search()` sets `aria-busy` + "Searching…"; a failure shows an offline (AbSearchOfflineError /
|
|
183
|
+
* `navigator.onLine === false`) or error panel with "Try again" — never "No results"; offline retries on `online`
|
|
142
184
|
*/
|
|
143
|
-
const AbSearchDrawer = ({ open, onClose, search, suggest, onOpenResult, defaultQuery = '', recentKey = AB_SEARCH_RECENT_KEY, recentLimit = 4, recentWhen = 'always', labels = {}, returnFocus, id, className }: AbSearchDrawerProps): ReactElement => {
|
|
185
|
+
const AbSearchDrawer = ({ open, onClose, search, suggest, onOpenResult, defaultQuery = '', recentKey = AB_SEARCH_RECENT_KEY, recentLimit = 4, recentWhen = 'always', labels = {}, returnFocus, hashReturnFocus = false, id, className }: AbSearchDrawerProps): ReactElement => {
|
|
144
186
|
const L = {
|
|
145
187
|
title: 'Search', close: 'Close search', placeholder: 'Search packages, components, hooks…', clear: 'Clear search', recent: 'Recent',
|
|
146
188
|
remove: (t: string) => `Remove ${t}`, results: (n: number) => `${n} result${n === 1 ? '' : 's'}`, noResults: 'No results',
|
|
147
189
|
noResultsFor: (q: string) => <>No results for “{q}”</>, didYouMean: 'Did you mean',
|
|
148
|
-
hint: <>Check the spelling or try a package name like <code>components</code> or <code>hooks</code>.</>,
|
|
190
|
+
hint: <>Check the spelling or try a package name like <code>components</code> or <code>hooks</code>.</>,
|
|
191
|
+
loading: 'Searching…', offlineTitle: 'You’re offline', offlineHint: 'Search needs a connection the first time. Reconnect and try again.', // ⏳ 📴 0.8.0
|
|
192
|
+
errorTitle: 'Search isn’t available right now', errorHint: 'Something went wrong while searching. Try again in a moment.', retry: 'Try again', // 🛑 0.8.0
|
|
193
|
+
...labels,
|
|
149
194
|
}; // 🌍
|
|
150
195
|
const auto = useId().replace(/[^A-Za-z0-9_-]/g, ''); // 🆔
|
|
151
196
|
const base = id ?? `ab-search-${auto}`;
|
|
@@ -157,34 +202,59 @@ const AbSearchDrawer = ({ open, onClose, search, suggest, onOpenResult, defaultQ
|
|
|
157
202
|
const [groups, setGroups] = useState<readonly AbSearchDrawerGroup[] | null>(null); // 📦 null = not searched (or < 2 chars)
|
|
158
203
|
const [active, setActive] = useState(0); // 🎯 index in the flat option list (-1 = none)
|
|
159
204
|
const [recent, setRecent] = useState<string[]>([]); // 🕘
|
|
205
|
+
const [status, setStatus] = useState<AbSearchDrawerStatus>('idle'); // ⏳ 0.8.0: loading / offline / error
|
|
206
|
+
const [attempt, setAttempt] = useState(0); // 🔁 0.8.0: bumped by "Try again" (and on reconnect) to re-run the search
|
|
160
207
|
const latest = useRef(search); // 🔁
|
|
161
208
|
useEffect(() => { latest.current = search; }, [search]);
|
|
162
209
|
|
|
163
210
|
// 🌱 each open: the default query, fresh recents
|
|
164
211
|
const [wasOpen, setWasOpen] = useState(false);
|
|
212
|
+
// ↩️ 0.8.0 hash guard: set when a #hash result is chosen, read by AbDrawer when it closes, cleared on every open
|
|
213
|
+
const hashNav = useRef(false);
|
|
214
|
+
useEffect(() => { if (open) hashNav.current = false; }, [open]); // 🌱 a fresh open returns focus again
|
|
165
215
|
if (open !== wasOpen) { setWasOpen(open); if (open) { setQuery(defaultQuery); setRecent(readRecent(recentKey)); } }
|
|
166
216
|
|
|
167
217
|
// ⏱️ 150ms debounce, from 2 characters; stale answers are dropped
|
|
168
218
|
useEffect(() => {
|
|
169
219
|
const q = query.trim();
|
|
170
|
-
if (!open || q.length < 2) { const t = setTimeout(() => setGroups(null), 0); return () => clearTimeout(t); } // 🫥
|
|
220
|
+
if (!open || q.length < 2) { const t = setTimeout(() => { setGroups(null); setStatus('idle'); }, 0); return () => clearTimeout(t); } // 🫥
|
|
171
221
|
let live = true;
|
|
222
|
+
// 🧯 0.8.0: a failure is "offline" or "error" (never "No results", and never the previous query's results)
|
|
223
|
+
const fail = (err: unknown) => { if (live) { setGroups(null); setActive(-1); setStatus(isAbSearchOffline(err) ? 'offline' : 'error'); } };
|
|
172
224
|
const t = setTimeout(() => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
225
|
+
let out: ReturnType<AbSearchDrawerProps['search']>; // 📦 sync groups or a promise
|
|
226
|
+
try { out = latest.current(q); } catch (err) { fail(err); return; } // 🧯 a sync throw fails the same way
|
|
227
|
+
// ⏳ 0.8.0: only an async search() shows "Searching…" (aria-busy); a sync one never flashes it
|
|
228
|
+
if (out && typeof (out as PromiseLike<unknown>).then === 'function') setStatus('loading');
|
|
229
|
+
Promise.resolve(out)
|
|
230
|
+
.then((g) => { if (live) { setGroups(g); setActive(g.some((x) => x.items.length) ? 0 : -1); setStatus('done'); } }) // ✅
|
|
231
|
+
.catch(fail); // 📴 / 🛑
|
|
176
232
|
}, 150);
|
|
177
233
|
return () => { live = false; clearTimeout(t); };
|
|
178
|
-
}, [query, open]);
|
|
234
|
+
}, [query, open, attempt]);
|
|
235
|
+
|
|
236
|
+
// 🌐 0.8.0: offline → back online: retry by itself (the visitor already typed the query)
|
|
237
|
+
useEffect(() => {
|
|
238
|
+
if (status !== 'offline' || typeof window === 'undefined') return; // 🙅 only while offline
|
|
239
|
+
const back = () => setAttempt((n) => n + 1); // 🔁
|
|
240
|
+
window.addEventListener('online', back); // 👂
|
|
241
|
+
return () => window.removeEventListener('online', back); // 🧹
|
|
242
|
+
}, [status]);
|
|
179
243
|
|
|
180
|
-
|
|
181
|
-
|
|
244
|
+
// 🧹 G60 (0.8.0): only groups with items are rendered, so the option order, the start offsets and the ids all
|
|
245
|
+
// come from THIS list, by position — never from the raw `g.id`, which apps may repeat (two "components" groups)
|
|
246
|
+
const shown = useMemo(() => (groups ?? []).filter((g) => g.items.length), [groups]); // 📦 rendered groups
|
|
247
|
+
const flat = useMemo(() => shown.flatMap((g) => g.items), [shown]); // 📋 the option order
|
|
248
|
+
const starts = useMemo(() => { const m: number[] = []; let n = 0; for (const g of shown) { m.push(n); n += g.items.length; } return m; }, [shown]); // 🔢 G60: each group's first option index, BY GROUP INDEX
|
|
182
249
|
const optId = (i: number) => `${base}-opt-${i}`; // 🆔
|
|
183
250
|
const showRecent = recentKey !== null && recent.length > 0 && (recentWhen === 'always' ? !(groups && flat.length === 0) : query.trim() === ''); // 🕘
|
|
184
251
|
const expanded = flat.length > 0; // ♿ the listbox has options
|
|
185
252
|
const saveRecent = (term: string) => { const next = addAbSearchRecent(recent, term, recentLimit); setRecent(next); writeRecent(recentKey, next); }; // 🕘
|
|
186
253
|
const removeRecent = (term: string) => { const next = recent.filter((x) => x !== term); setRecent(next); writeRecent(recentKey, next); input.current?.focus(); };
|
|
187
|
-
const choose = (item: AbSearchDrawerItem) => {
|
|
254
|
+
const choose = (item: AbSearchDrawerItem) => {
|
|
255
|
+
hashNav.current = !hashReturnFocus && hasAbHashTarget(item.href); // ↩️ 0.8.0: a #section → don't refocus the opener
|
|
256
|
+
saveRecent(query); onOpenResult?.(item); onClose(); // 🔗
|
|
257
|
+
};
|
|
188
258
|
|
|
189
259
|
// ⌨️ the combobox keys (focus stays in the input)
|
|
190
260
|
const onKey = (e: KeyboardEvent<HTMLInputElement>) => {
|
|
@@ -202,13 +272,16 @@ const AbSearchDrawer = ({ open, onClose, search, suggest, onOpenResult, defaultQ
|
|
|
202
272
|
}
|
|
203
273
|
};
|
|
204
274
|
|
|
205
|
-
const
|
|
275
|
+
const busy = status === 'loading'; // ⏳ 0.8.0
|
|
276
|
+
const failed = status === 'offline' || status === 'error'; // 📴 🛑 0.8.0
|
|
277
|
+
const none = !busy && !failed && groups !== null && flat.length === 0; // 🫥 0.8.0: never while loading / failed
|
|
278
|
+
const retry = () => { setAttempt((n) => n + 1); input.current?.focus(); }; // 🔁 0.8.0: re-run, focus stays in the input
|
|
206
279
|
const tip = suggest && none ? suggest(query.trim()) : null; // 💡
|
|
207
280
|
return (
|
|
208
281
|
<AbDrawer
|
|
209
282
|
open={open} onClose={onClose} id={id} side="bottom" scope="app" tier="sheet"
|
|
210
283
|
snapPoints fullOnly centerIn="main" title={L.title} closeLabel={L.close} closeIcon={<AbIcon name="close" size={24} />}
|
|
211
|
-
initialFocus="input" returnFocus={returnFocus}
|
|
284
|
+
initialFocus="input" returnFocus={returnFocus} restoreFocus={() => !hashNav.current /* ↩️ 0.8.0 hash guard */}
|
|
212
285
|
className={clsx('AbSearchDrawer', kit.sheet, kit.searchSheet, className)}
|
|
213
286
|
>
|
|
214
287
|
<div className={kit.searchBody}>
|
|
@@ -224,7 +297,7 @@ const AbSearchDrawer = ({ open, onClose, search, suggest, onOpenResult, defaultQ
|
|
|
224
297
|
{query && <button type="button" className={kit.iconSm} aria-label={L.clear} onClick={() => { setQuery(''); input.current?.focus(); }}><AbIcon name="close" size={20} /></button>}
|
|
225
298
|
</div>
|
|
226
299
|
<div className={kit.resWrap}>
|
|
227
|
-
<div ref={list} className={kit.results} data-ab-part="search-results"
|
|
300
|
+
<div ref={list} className={kit.results} data-ab-part="search-results" aria-busy={busy || undefined} data-status={status} /* ⏳ 0.8.0 */>
|
|
228
301
|
{showRecent && (
|
|
229
302
|
<>
|
|
230
303
|
<p className={kit.lbl} id={`${base}-recent`}>{L.recent}</p>
|
|
@@ -240,16 +313,19 @@ const AbSearchDrawer = ({ open, onClose, search, suggest, onOpenResult, defaultQ
|
|
|
240
313
|
{flat.length > 0 && <hr className={kit.hr} />}
|
|
241
314
|
</>
|
|
242
315
|
)}
|
|
243
|
-
<
|
|
244
|
-
|
|
245
|
-
|
|
316
|
+
{busy && !expanded && <p className={kit.lbl} data-ab-part="search-loading">{L.loading}</p> /* ⏳ 0.8.0: first answer still on its way */}
|
|
317
|
+
<div id={`${base}-list`} role="listbox" aria-label={L.title} aria-busy={busy || undefined} hidden={!expanded}>
|
|
318
|
+
{shown.map((g, gi) => (
|
|
319
|
+
<div key={`${gi}-${g.id}`} role="group" aria-labelledby={groupId(g, gi)} /* 🧹 G60: keyed by index too, so a repeated id never collides */>
|
|
246
320
|
<p className={kit.grp2} id={groupId(g, gi)}><span>{g.label}</span>{g.meta && <code>{g.meta}</code>}</p>
|
|
247
321
|
{g.items.map((it, j) => {
|
|
248
|
-
const i = starts[
|
|
322
|
+
const i = starts[gi] + j; const on = i === active; // 🎯 G60: the start of THIS group (by index)
|
|
249
323
|
return (
|
|
250
|
-
<Link key={it.id} id={optId(i)} href={it.href} role="option" aria-selected={on} tabIndex={-1} className={kit.sr} onClick={() => choose(it)} onMouseMove={() => { if (!on) setActive(i); }}>
|
|
324
|
+
<Link key={`${i}-${it.id}`} /* 🧹 G60: item ids may repeat across groups too */ id={optId(i)} href={it.href} role="option" aria-selected={on} tabIndex={-1} className={kit.sr} onClick={() => choose(it)} onMouseMove={() => { if (!on) setActive(i); }}>
|
|
251
325
|
<span className={kit.pkgIc} aria-hidden="true">{it.icon && <AbIcon name={it.icon} size={20} />}</span>
|
|
252
326
|
<span className={kit.srText}><b>{highlightAbSearch(it.title, query)}</b>{it.description && <small>{highlightAbSearch(it.description, query)}</small>}</span>
|
|
327
|
+
{it.badge && <span className={kit.srBadge} data-ab-part="search-badge" title={it.badgeLabel} aria-hidden={it.badgeLabel ? true : undefined}>{it.badge}</span> /* 🏷️ 0.8.0: e.g. EN */}
|
|
328
|
+
{it.badge && it.badgeLabel && <span className={kit.srOnly}>, {it.badgeLabel}</span> /* ♿ 0.8.0: the meaning, not "E N" */}
|
|
253
329
|
{it.meta && <code className={kit.srMeta}>{it.meta}</code>}
|
|
254
330
|
</Link>
|
|
255
331
|
);
|
|
@@ -257,6 +333,14 @@ const AbSearchDrawer = ({ open, onClose, search, suggest, onOpenResult, defaultQ
|
|
|
257
333
|
</div>
|
|
258
334
|
))}
|
|
259
335
|
</div>
|
|
336
|
+
{failed && (
|
|
337
|
+
<div className={kit.nores} data-ab-part={status === 'offline' ? 'search-offline' : 'search-error'} /* 📴 🛑 0.8.0 */>
|
|
338
|
+
<span className={kit.pkgIc} aria-hidden="true"><AbIcon name="error" size={28} /></span>
|
|
339
|
+
<b>{status === 'offline' ? L.offlineTitle : L.errorTitle}</b>
|
|
340
|
+
<p>{status === 'offline' ? L.offlineHint : L.errorHint}</p>
|
|
341
|
+
<button type="button" className={clsx(kit.row, kit.didYouMean)} onClick={retry}><AbIcon name="refresh" size={20} /> {L.retry}</button>
|
|
342
|
+
</div>
|
|
343
|
+
)}
|
|
260
344
|
{none && (
|
|
261
345
|
<div className={kit.nores} data-ab-part="search-empty">
|
|
262
346
|
<span className={kit.pkgIc} aria-hidden="true"><AbIcon name="search" size={28} /></span>
|
|
@@ -268,7 +352,7 @@ const AbSearchDrawer = ({ open, onClose, search, suggest, onOpenResult, defaultQ
|
|
|
268
352
|
</div>
|
|
269
353
|
<div className={kit.resFade} aria-hidden="true" />
|
|
270
354
|
</div>
|
|
271
|
-
<p className={kit.srOnly} role="status" aria-live="polite">{groups === null ? '' : none ? L.noResults : L.results(flat.length)}</p>
|
|
355
|
+
<p className={kit.srOnly} role="status" aria-live="polite">{busy && !expanded ? L.loading : status === 'offline' ? L.offlineTitle : status === 'error' ? L.errorTitle : groups === null ? '' : none ? L.noResults : L.results(flat.length)}</p>
|
|
272
356
|
</div>
|
|
273
357
|
</AbDrawer>
|
|
274
358
|
);
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
'use client';
|
|
40
40
|
|
|
41
41
|
// ⚛️ React
|
|
42
|
-
import {
|
|
42
|
+
import { type MouseEvent, type ReactElement } from 'react';
|
|
43
|
+
// ⌨️ 0.8.0 (G10, D49): the ONE shared hotkey hook + the platform-aware key cap / aria-keyshortcuts
|
|
44
|
+
import { useAbHotkey, useAbHotkeyLabel, AB_HOTKEY_SEARCH } from 'ab-nextjs-hooks/useAbHotkey';
|
|
43
45
|
// 🧵 classes
|
|
44
46
|
import clsx from 'clsx';
|
|
45
47
|
// 🔗 G42 link (href fallback)
|
|
@@ -58,8 +60,12 @@ export interface AbSearchTriggerProps {
|
|
|
58
60
|
label?: string; // 🏷️ placeholder text (default "Search")
|
|
59
61
|
onOpen?: () => void; // 🔔 opens your search dialog (button mode)
|
|
60
62
|
href?: string; // 🔗 no onOpen → a link to a search page (also the JS-off path)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
/** ⌨️ REGISTER a ⌘K / Ctrl+K listener (via `useAbHotkey`) that calls `onOpen` (default true when `onOpen` is set).
|
|
64
|
+
* 0.8.0 (D49): pass `hotkey={false}` when the app shell owns the single `useAbHotkey('mod+k')`. */
|
|
65
|
+
hotkey?: boolean;
|
|
66
|
+
/** 👀 SHOW the ⌘K / Ctrl+K key cap and announce `aria-keyshortcuts` (default: whatever `hotkey` does).
|
|
67
|
+
* 0.8.0 (D49): no longer an alias of `hotkey` — `shortcut` + `hotkey={false}` = "the shell listens, I just show the cap". */
|
|
68
|
+
shortcut?: boolean;
|
|
63
69
|
compact?: boolean; // 📱 icon-only pill (the label stays for screen readers), e.g. the mobile app bar
|
|
64
70
|
comingSoon?: boolean; // 🚧 visible but inert: aria-disabled, no hotkey
|
|
65
71
|
comingSoonLabel?: string; // 🏷️ default "Coming soon"
|
|
@@ -72,40 +78,28 @@ export interface AbSearchTriggerProps {
|
|
|
72
78
|
className?: string; // 🏷️
|
|
73
79
|
}
|
|
74
80
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
/** 🍎 Apple platforms show ⌘, everyone else Ctrl. */
|
|
79
|
-
export function isAbApplePlatform(nav?: { platform?: string; userAgent?: string; userAgentData?: { platform?: string } }): boolean {
|
|
80
|
-
const p = nav?.userAgentData?.platform ?? nav?.platform ?? nav?.userAgent ?? ''; // 🔍
|
|
81
|
-
return /mac|iphone|ipad|ipod/i.test(p); // 🍎
|
|
82
|
-
}
|
|
81
|
+
/** 🍎 Apple platforms show ⌘, everyone else Ctrl. 0.8.0: the one implementation now lives in hooks 0.1.9 (re-exported here). */
|
|
82
|
+
export { isAbApplePlatform } from 'ab-nextjs-hooks/useAbHotkey';
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* 🔎 AbSearchTrigger (G44): a search "field" that opens your dialog. Shows ⌘K on Apple, Ctrl K elsewhere,
|
|
86
|
-
* announces `aria-keyshortcuts
|
|
87
|
-
*
|
|
86
|
+
* announces `aria-keyshortcuts` ("Meta+K" on Apple, "Control+K" elsewhere; SSR renders the Ctrl / Control pair),
|
|
87
|
+
* and falls back to a link when there's no `onOpen`.
|
|
88
|
+
* - ⌨️ 0.8.0 (D49) **shortcut / hotkey split**: `hotkey` registers the listener (hooks 0.1.9 `useAbHotkey`),
|
|
89
|
+
* `shortcut` only shows the cap. An app with one shell-level `useAbHotkey('mod+k')` renders every trigger with
|
|
90
|
+
* `shortcut hotkey={false}`: the cap everywhere, ONE listener, no double-open.
|
|
88
91
|
*/
|
|
89
92
|
const AbSearchTrigger = ({ label = 'Search', onOpen, href, hotkey, shortcut, compact = false, comingSoon = false, comingSoonLabel = 'Coming soon', compactLabel, variant = 'pill', size = 'md', className }: AbSearchTriggerProps): ReactElement => {
|
|
90
|
-
// 🍎 SSR renders "Ctrl"; hydration then reads the platform (useSyncExternalStore: no mismatch
|
|
91
|
-
const apple =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
);
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const onKey = (e: KeyboardEvent) => {
|
|
101
|
-
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k') {
|
|
102
|
-
e.preventDefault(); // 🚫 browser search bar
|
|
103
|
-
onOpen?.(); // 🔔
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
window.addEventListener('keydown', onKey); // 👂
|
|
107
|
-
return () => window.removeEventListener('keydown', onKey); // 🧹
|
|
108
|
-
}, [listen, onOpen]);
|
|
93
|
+
// 🍎 SSR renders "Ctrl" / "Control+K"; hydration then reads the platform (useSyncExternalStore inside: no mismatch)
|
|
94
|
+
const { apple, ariaKeyShortcuts } = useAbHotkeyLabel(AB_HOTKEY_SEARCH);
|
|
95
|
+
// ⌨️ 0.8.0 (D49): does THIS trigger register the listener? (needs something to open; never while coming soon)
|
|
96
|
+
const listen = !comingSoon && !!onOpen && (hotkey ?? true);
|
|
97
|
+
// 👀 0.8.0 (D49): does it SHOW the cap? Defaults to "only while I listen" (#3, D24a); `shortcut` forces it either way
|
|
98
|
+
const showCap = !comingSoon && (shortcut ?? listen);
|
|
99
|
+
// 👂 the listener itself: hooks' useAbHotkey ('mod+k' = ⌘K on Apple, Ctrl+K elsewhere). `mod+k` fires in
|
|
100
|
+
// inputs by default (hooks 0.1.9: a combo with a modifier does; a bare key does not), so this keeps the
|
|
101
|
+
// 0.7.1 behaviour (it fired from anywhere). A second binding of the same combo skips the handled event (no double-open)
|
|
102
|
+
useAbHotkey(AB_HOTKEY_SEARCH, () => onOpen?.(), { enabled: listen });
|
|
109
103
|
|
|
110
104
|
// 🏠 P6: the Home looks (field / sm pill) show ONE key cap ("⌘ K" / "⌘K") and keep "coming soon" out of the field
|
|
111
105
|
const home = variant === 'field' || size === 'sm' || size === 'lg'; // 🔍 404 gaps: lg is a (bigger) Home field
|
|
@@ -118,22 +112,22 @@ const AbSearchTrigger = ({ label = 'Search', onOpen, href, hotkey, shortcut, com
|
|
|
118
112
|
<span className={styles.abSearchTriggerLabel} data-ab-part="search-label">{label}</span>
|
|
119
113
|
{compactLabel != null && <span className={clsx(styles.abSearchTriggerLabel, styles.abSearchTriggerShort)} data-ab-part="search-label-compact">{compactLabel}</span> /* 📱 0.1.15 */}
|
|
120
114
|
{/* 🚧 coming soon: tooltip + announced, never painted inside the field (spec §4) */}
|
|
121
|
-
{comingSoon ? <span className={styles.abSearchTriggerSrOnly}>, {comingSoonLabel}</span> :
|
|
115
|
+
{comingSoon ? <span className={styles.abSearchTriggerSrOnly}>, {comingSoonLabel}</span> : showCap && <AbKbd className={styles.abSearchTriggerCap}>{keyCap}</AbKbd> /* 👀 0.8.0: shortcut, not hotkey */}
|
|
122
116
|
</>
|
|
123
117
|
) : (
|
|
124
118
|
<>
|
|
125
119
|
<AbIcon name="search" size={20} className={styles.abSearchTriggerIcon} />
|
|
126
120
|
<span className={clsx(styles.abSearchTriggerLabel, compact && styles.abSearchTriggerSrOnly)}>{label}</span>
|
|
127
|
-
{/* 🚧 coming soon tag, or ⌨️ the key hint
|
|
121
|
+
{/* 🚧 coming soon tag, or ⌨️ the key hint while the shortcut is real (#3, D24a; 0.8.0: `shortcut` / a listening `hotkey`) */}
|
|
128
122
|
{comingSoon
|
|
129
123
|
? !compact && <span className={styles.abSearchTriggerSoon}>{comingSoonLabel}</span>
|
|
130
|
-
:
|
|
124
|
+
: showCap && !compact && <AbKbd keys={[apple ? '⌘' : 'Ctrl', 'K']} className={styles.abSearchTriggerKbd} />}
|
|
131
125
|
</>
|
|
132
126
|
);
|
|
133
127
|
const common = {
|
|
134
128
|
className: clsx('AbSearchTrigger', styles.abSearchTrigger, !comingSoon && 'ab-motion-interactive', className), // 🏷️
|
|
135
129
|
'data-ab-part': 'search-trigger', // 🧩
|
|
136
|
-
'aria-keyshortcuts':
|
|
130
|
+
'aria-keyshortcuts': showCap ? ariaKeyShortcuts : undefined, // ♿ only announced when real (#3); 0.8.0: the platform's own pair
|
|
137
131
|
'data-compact': compact ? 'true' : undefined, // 📱
|
|
138
132
|
'data-variant': variant === 'field' ? 'field' : undefined, // 🔎 P6
|
|
139
133
|
'data-size': size === 'sm' || size === 'lg' ? size : undefined, // 📱 P6 · 🔍 404 gaps: lg
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
}
|
|
81
81
|
.abSearchTrigger[data-size='sm'] {
|
|
82
82
|
flex: none; width: auto; max-width: none; height: 34px; /* 📏 the pill still LOOKS 34px (mock) */
|
|
83
|
+
min-width: 44px; /* 👆 0.8.0 touch audit: never narrower than a tap target, even with a very short (or no) label */
|
|
83
84
|
position: relative; /* 📌 0.3.2: anchors the invisible hit area below */
|
|
84
85
|
gap: 6px; padding: 0 6px 0 10px; /* 📦 */
|
|
85
86
|
border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); border-radius: var(--ab-radius-pill, 999px); /* 💊 */
|
|
@@ -117,3 +118,17 @@
|
|
|
117
118
|
.abSearchTrigger[data-size='lg'] .abSearchTriggerCap { margin-left: auto; } /* ⌨️ key cap pinned right */
|
|
118
119
|
.abSearchTrigger[data-size='lg'][aria-disabled='true'] { opacity: 1; } /* 🚧 same look while coming soon */
|
|
119
120
|
|
|
121
|
+
|
|
122
|
+
/* ===== 👆 0.8.0 touch audit (pointer: coarse): every other trigger gets an invisible ≥ 44×44 hit area =====
|
|
123
|
+
* sm already has its 46px band above (and now a 44px min width). The rest stay as drawn but can be SMALLER than 44 on
|
|
124
|
+
* touch: the md pill (40px tall), the tablet `variant="field"` (36px), AbAppBar's compact 40px icon button and its
|
|
125
|
+
* 34px compact pill. A centred ::after of max(100%, 44px) each way covers them all without growing a target that is
|
|
126
|
+
* already big enough (lg = 44px, a 300px field keeps its own width). No transitions, nothing painted. */
|
|
127
|
+
@media (pointer: coarse) {
|
|
128
|
+
.abSearchTrigger:not([data-size='sm']) { position: relative; } /* 📌 anchors the hit area */
|
|
129
|
+
.abSearchTrigger:not([data-size='sm'])::after {
|
|
130
|
+
content: ''; position: absolute; left: 50%; top: 50%; /* 🫥 an empty, centred box */
|
|
131
|
+
inline-size: max(100%, 44px); block-size: max(100%, 44px); /* 📏 ≥ 44×44, never smaller than the trigger */
|
|
132
|
+
transform: translate(-50%, -50%); /* 🎯 centred on the trigger */
|
|
133
|
+
}
|
|
134
|
+
}
|
package/index.ts
CHANGED
|
@@ -225,8 +225,8 @@ export { AB_MOBILE_HEADER_THEME_CYCLE } from './ab-mobile-header/index.tsx' //
|
|
|
225
225
|
export { AbThemeModeProvider, useAbThemeModeContext, AB_THEME_MODE_ICONS, AB_THEME_ICON_BUTTON_GLYPH } from './ab-theme-mode/index.tsx' // 🔣 0.3.2: + the shared theme glyphs
|
|
226
226
|
export type { AbThemeModeProviderProps, AbThemeModeContextValue } from './ab-theme-mode/index.tsx'
|
|
227
227
|
// 🆕 0.2.0 drawers v2: AbSearchDrawer
|
|
228
|
-
export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY } from './ab-search-drawer/index.tsx'
|
|
229
|
-
export type { AbSearchDrawerProps, AbSearchDrawerItem, AbSearchDrawerGroup, AbSearchDrawerLabels } from './ab-search-drawer/index.tsx'
|
|
228
|
+
export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY, AbSearchOfflineError, isAbSearchOffline, hasAbHashTarget } from './ab-search-drawer/index.tsx' // 📴 #️⃣ 0.8.0: offline + hash helpers
|
|
229
|
+
export type { AbSearchDrawerProps, AbSearchDrawerItem, AbSearchDrawerGroup, AbSearchDrawerLabels, AbSearchDrawerStatus } from './ab-search-drawer/index.tsx'
|
|
230
230
|
// 🆕 0.2.0 drawers v2: AbTocDrawer
|
|
231
231
|
export { default as AbTocDrawer } from './ab-toc-drawer/index.tsx'
|
|
232
232
|
export type { AbTocDrawerProps, AbTocDrawerLink } from './ab-toc-drawer/index.tsx'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ab-nextjs-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "🚀 A lightweight collection of server & client React components created by Abraham Ukachi, and optimized for Next.js applications 😎.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"ab-nextjs-animations": "^0.2.5",
|
|
44
|
-
"ab-nextjs-hooks": "^0.1.
|
|
44
|
+
"ab-nextjs-hooks": "^0.1.9",
|
|
45
45
|
"ab-nextjs-icons": "^0.2.7",
|
|
46
46
|
"ab-nextjs-theme": "^0.3.9",
|
|
47
47
|
"clsx": "^2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@types/node": "^20",
|
|
55
55
|
"@types/react": "^19",
|
|
56
56
|
"ab-nextjs-animations": "^0.2.5",
|
|
57
|
-
"ab-nextjs-hooks": "^0.1.
|
|
57
|
+
"ab-nextjs-hooks": "^0.1.9",
|
|
58
58
|
"ab-nextjs-icons": "^0.2.7",
|
|
59
59
|
"ab-nextjs-theme": "^0.3.9",
|
|
60
60
|
"clsx": "^2.1.1",
|
|
@@ -259,9 +259,6 @@
|
|
|
259
259
|
"peerDependenciesMeta": {
|
|
260
260
|
"ab-nextjs-theme": {
|
|
261
261
|
"optional": true
|
|
262
|
-
},
|
|
263
|
-
"ab-nextjs-hooks": {
|
|
264
|
-
"optional": true
|
|
265
262
|
}
|
|
266
263
|
}
|
|
267
264
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -108,8 +108,8 @@ export { AB_MOBILE_HEADER_THEME_CYCLE } from '../ab-mobile-header/index.tsx'; //
|
|
|
108
108
|
export { AbThemeModeProvider, useAbThemeModeContext, AB_THEME_MODE_ICONS, AB_THEME_ICON_BUTTON_GLYPH } from '../ab-theme-mode/index.tsx';
|
|
109
109
|
export type { AbThemeModeProviderProps, AbThemeModeContextValue } from '../ab-theme-mode/index.tsx';
|
|
110
110
|
// 🆕 0.2.0 drawers v2: AbSearchDrawer
|
|
111
|
-
export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY } from '../ab-search-drawer/index.tsx';
|
|
112
|
-
export type { AbSearchDrawerProps, AbSearchDrawerItem, AbSearchDrawerGroup, AbSearchDrawerLabels } from '../ab-search-drawer/index.tsx';
|
|
111
|
+
export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY, AbSearchOfflineError, isAbSearchOffline, hasAbHashTarget } from '../ab-search-drawer/index.tsx'; // 📴 #️⃣ 0.8.0
|
|
112
|
+
export type { AbSearchDrawerProps, AbSearchDrawerItem, AbSearchDrawerGroup, AbSearchDrawerLabels, AbSearchDrawerStatus } from '../ab-search-drawer/index.tsx';
|
|
113
113
|
// 🆕 0.2.0 drawers v2: AbTocDrawer
|
|
114
114
|
export { default as AbTocDrawer } from '../ab-toc-drawer/index.tsx';
|
|
115
115
|
export type { AbTocDrawerProps, AbTocDrawerLink } from '../ab-toc-drawer/index.tsx';
|