ab-nextjs-components 0.1.12 โ 0.1.14
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 +64 -0
- package/README.md +52 -0
- package/ab-app-bar/index.tsx +210 -0
- package/ab-app-bar/styles.module.css +158 -0
- package/ab-avatar/index.tsx +2 -1
- package/ab-avatar/styles.module.css +32 -0
- package/ab-balloon/index.tsx +134 -23
- package/ab-balloon/styles.module.css +84 -7
- package/ab-bottom-drawer/index.tsx +71 -0
- package/ab-bottom-drawer/styles.module.css +66 -0
- package/ab-brand/index.tsx +1 -1
- package/ab-breadcrumbs/index.tsx +92 -0
- package/ab-breadcrumbs/styles.module.css +54 -0
- package/ab-button/helpers.ts +6 -1
- package/ab-button/index.tsx +23 -4
- package/ab-button/styles.module.css +70 -0
- package/ab-card/index.tsx +89 -0
- package/ab-card/styles.module.css +68 -0
- package/ab-carousel/styles.module.css +1 -1
- package/ab-chip/index.tsx +16 -4
- package/ab-chip/styles.module.css +12 -1
- package/ab-collapsible/index.tsx +1 -1
- package/ab-color/index.tsx +1 -0
- package/ab-color/styles.module.css +32 -0
- package/ab-confirm-drawer/index.tsx +97 -0
- package/ab-confirm-drawer/styles.module.css +41 -0
- package/ab-demo-box/index.tsx +1 -0
- package/ab-demo-box/styles.module.css +32 -0
- package/ab-demo-code/index.tsx +1 -0
- package/ab-demo-code/styles.module.css +32 -0
- package/ab-drawer/index.tsx +307 -0
- package/ab-drawer/styles.module.css +127 -0
- package/ab-drawer/use-ab-drawer.ts +89 -0
- package/ab-drawer-list/index.tsx +118 -0
- package/ab-drawer-list/styles.module.css +65 -0
- package/ab-flow-diagram/styles.module.css +2 -2
- package/ab-icon/builtin.ts +19 -1
- package/ab-icon/helpers.ts +37 -0
- package/ab-icon/index.tsx +14 -8
- package/ab-icon/registrar.tsx +68 -0
- package/ab-icon-button/index.tsx +19 -3
- package/ab-icon-button/styles.module.css +1 -1
- package/ab-image/index.tsx +1 -0
- package/ab-image/styles.module.css +32 -0
- package/ab-info/index.tsx +2 -1
- package/ab-info/styles.module.css +32 -0
- package/ab-input/index.tsx +1 -0
- package/ab-input/styles.module.css +1 -0
- package/ab-install-snippet/index.tsx +51 -29
- package/ab-install-snippet/styles.module.css +50 -4
- package/ab-kbd/index.tsx +65 -0
- package/ab-kbd/styles.module.css +55 -0
- package/ab-key-feature/index.tsx +2 -1
- package/ab-key-feature/styles.module.css +32 -0
- package/ab-like-button/index.tsx +1 -1
- package/ab-link/index.tsx +112 -0
- package/ab-link/locale.ts +53 -0
- package/ab-list/index.tsx +107 -0
- package/ab-list/styles.module.css +82 -0
- package/ab-locale-switcher/index.tsx +59 -10
- package/ab-locale-switcher/styles.module.css +15 -4
- package/ab-main-headline/index.tsx +1 -0
- package/ab-main-headline/styles.module.css +32 -0
- package/ab-menu/index.tsx +6 -5
- package/ab-menu/styles.module.css +32 -0
- package/ab-name/index.tsx +1 -0
- package/ab-name/styles.module.css +32 -0
- package/ab-navbar/index.tsx +54 -46
- package/ab-navbar/styles.module.css +102 -28
- package/ab-navbar/view.tsx +166 -0
- package/ab-package-card/index.tsx +141 -0
- package/ab-package-card/styles.module.css +81 -0
- package/ab-page-paginator/index.tsx +1 -0
- package/ab-page-paginator/styles.module.css +32 -0
- package/ab-page-switcher/index.tsx +1 -0
- package/ab-page-switcher/styles.module.css +32 -0
- package/ab-preview/index.tsx +1 -0
- package/ab-preview/styles.module.css +32 -0
- package/ab-price/index.tsx +1 -0
- package/ab-price/styles.module.css +32 -0
- package/ab-price-tag/index.tsx +1 -0
- package/ab-price-tag/styles.module.css +32 -0
- package/ab-product/index.tsx +1 -0
- package/ab-product/styles.module.css +32 -0
- package/ab-product-item/index.tsx +1 -0
- package/ab-product-item/styles.module.css +32 -0
- package/ab-search-result/index.tsx +1 -0
- package/ab-search-result/styles.module.css +32 -0
- package/ab-search-trigger/index.tsx +157 -0
- package/ab-search-trigger/styles.module.css +96 -0
- package/ab-sidebar/index.tsx +91 -49
- package/ab-sidebar/styles.module.css +179 -31
- package/ab-sidebar/view.tsx +192 -0
- package/ab-switch-back/index.tsx +2 -1
- package/ab-switch-back/styles.module.css +32 -0
- package/ab-tab/index.tsx +2 -1
- package/ab-tab/styles.module.css +32 -0
- package/ab-tabs/index.tsx +1 -0
- package/ab-tabs/styles.module.css +32 -0
- package/ab-test-hello/index.tsx +1 -0
- package/ab-test-hello/styles.module.css +32 -0
- package/ab-text/index.tsx +1 -0
- package/ab-text/styles.module.css +32 -0
- package/ab-theme-toggle/index.tsx +21 -6
- package/ab-theme-toggle/styles.module.css +18 -3
- package/ab-toc/index.tsx +131 -0
- package/ab-toc/styles.module.css +66 -0
- package/ab-version-switcher/index.tsx +143 -0
- package/ab-version-switcher/styles.module.css +76 -0
- package/css/chrome-mq.css +32 -0
- package/css/doodle.css +32 -0
- package/css/logo.css +32 -0
- package/css/spinner.css +32 -0
- package/css/toast.css +32 -0
- package/index.ts +45 -0
- package/package.json +42 -10
- package/server/ab-avatar/index.tsx +2 -1
- package/server/ab-avatar/styles.module.css +32 -0
- package/server/ab-badge/index.tsx +1 -0
- package/server/ab-badge/styles.module.css +32 -0
- package/server/ab-brand/index.tsx +1 -1
- package/server/ab-button/index.tsx +6 -2
- package/server/ab-button/styles.module.css +39 -0
- package/server/ab-icon/index.tsx +13 -8
- package/server/ab-key-feature/index.tsx +2 -1
- package/server/ab-key-feature/styles.module.css +32 -0
- package/server/ab-name/index.tsx +1 -0
- package/server/ab-name/styles.module.css +32 -0
- package/server/ab-nav-link/index.tsx +2 -1
- package/server/ab-nav-link/styles.module.css +32 -0
- package/server/ab-navbar/index.tsx +44 -45
- package/server/ab-polygon/index.tsx +1 -0
- package/server/ab-polygon/styles.module.css +32 -0
- package/server/ab-sidebar/index.tsx +44 -49
- package/server/ab-switch-back/index.tsx +2 -1
- package/server/ab-switch-back/styles.module.css +32 -0
- package/server/ab-test-hello/index.tsx +1 -0
- package/server/ab-test-hello/styles.module.css +32 -0
- package/server/ab-text/index.tsx +1 -0
- package/server/ab-text/styles.module.css +32 -0
- package/server/index.ts +1 -0
- package/styles.css +32 -0
- package/types/index.d.ts +54 -0
- package/server/ab-navbar/styles.module.css +0 -35
- package/server/ab-sidebar/styles.module.css +0 -41
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
+
## [0.1.14](https://github.com/abraham-ukachi/ab-nextjs-components/compare/v0.1.13...v0.1.14) (2026-10-20)
|
|
2
|
+
|
|
3
|
+
* โฌ๏ธ **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.
|
|
4
|
+
|
|
5
|
+
* ๐ฏ **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.
|
|
6
|
+
* ๐ฟ **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.
|
|
7
|
+
* โฟ **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.
|
|
8
|
+
* ๐ **Home fidelity components (spec ยง5, approved by God 2026-10-20):**
|
|
9
|
+
* `AbList` + `AbListItem` (P13): bordered row lists with a media tile or badge, title, meta and chevron. A row with `href` is a single link.
|
|
10
|
+
* `AbBreadcrumbs` (P2): the tablet main bar crumb.
|
|
11
|
+
* `AbVersionSwitcher` (P9): the sidebar "Docs **v0.2.x** โพ", which opens an AbMenu, with a no-JS `<details>` fallback.
|
|
12
|
+
* `AbBottomDrawer`: the mobile bottom drawer (D40), which `AbLocaleSwitcher` / `AbAppBar` now use for `side="bottom"`. `AbDrawerList` gains `as`.
|
|
13
|
+
* They read the `ab-nextjs-theme` 0.3.5 Home tokens (`--ab-color-card`, `--ab-color-faint`, โฆ), with the light mock values as fallbacks.
|
|
14
|
+
* ๐ **Home variants on existing components (Joseph's P4โP19; everything is opt-in, defaults unchanged):**
|
|
15
|
+
* `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).
|
|
16
|
+
* `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).
|
|
17
|
+
* `AbThemeToggle`: `appearance="thumb"` (28px segments, raised thumb, filled active glyph) (P7).
|
|
18
|
+
* `AbSidebar`: `density="compact"`, `activeShape="rounded"`, `badgeVariant="text"`, section `itemSize="sm"`, and `collapseButtonVariant="outlined"` (32px `<<`/`>>`) (P8/P9).
|
|
19
|
+
* `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).
|
|
20
|
+
* `AbInstallSnippet`: `variant="terminal"` (underline tabs, copy button in the tab row, horizontal scroll instead of clipping) (P12).
|
|
21
|
+
* `AbToc`: a `footer` slot (P14). The TOC now uses the Home sizes: 11px heading, 13px links on 30px rows.
|
|
22
|
+
* `AbButton`: `shape="rounded"`, `size="md"` (40px, 44px below 768px), `type="secondary"`. `AbChip`: `size="sm"`, `shape="rounded"`, `mono`, `tone="accent" | "sage"` (P16).
|
|
23
|
+
* `AbNavbar`: `indicator="none"` and `blur` (P18).
|
|
24
|
+
* `AbIconButton`: `aria-expanded` / `aria-controls` pass through, and a new `iconSize`.
|
|
25
|
+
* `AbVersionSwitcher`: the accessible name is `"{label} {version}"`, so it contains the visible text (WCAG 2.5.3).
|
|
26
|
+
* AbList rows are 59/60px, like the mock.
|
|
27
|
+
* `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`.
|
|
28
|
+
* ๐จ **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`.
|
|
29
|
+
* ๐๏ธ **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`.
|
|
30
|
+
* 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`.
|
|
31
|
+
* It uses the 240ms `ab-nextjs-animations` slide, which reduced motion turns off.
|
|
32
|
+
* Without JS it renders as an in-flow `<section>` (D41).
|
|
33
|
+
* ๐ **`AbDrawerList` + `AbConfirmDrawer` presets (new, D38/D40).**
|
|
34
|
+
* ๐ **`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`.
|
|
35
|
+
|
|
36
|
+
## 0.1.13 โ 2026-10-16
|
|
37
|
+
|
|
38
|
+
* ๐ **`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)
|
|
39
|
+
* ๐ฃ **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)
|
|
40
|
+
* ๐งญ **AbSidebar v2 (G40)**: sections, `activeHref`, filled active icon, `aria-current`, badges, one child level, a 72px rail with balloon tooltips, and a collapse button (`aria-expanded`, `aria-controls`, hidden without JS). Client and server twins share `ab-sidebar/view`. Legacy `links` / `page` / `brandLabel` still work
|
|
41
|
+
* ๐ฑ **AbNavbar v2 (G41)**: link and button items, filled active icon, `aria-current`, safe-area padding. The server twin takes link items only
|
|
42
|
+
* ๐งฑ **AbAppBar (new, G43)**: brand, search, nav, actions, sticky with a hairline, and a "More" overflow `AbMenu` below 1180px (Escape and outside click close it, focus goes back to the trigger). The nav stays inline without JS
|
|
43
|
+
* ๐ **AbSearchTrigger + AbKbd (new, G44)**: an `href` always renders a real `<a>` (works without JS, D24a: `/docs`); with `onOpen` too, JS intercepts plain clicks and opens the dialog. The โK / Ctrl K hint and `aria-keyshortcuts` appear only while a hotkey is listening. `shortcut` (alias of `hotkey`), `compact` (icon-only, label for screen readers), `comingSoon` with `aria-disabled`. The hotkey is a local listener because `useAbHotkey` (G48) is not in hooks 0.1.7
|
|
44
|
+
* ๐ **AbCard + AbPackageCard (new, G45)**: one link per card, `ab-motion-interactive` timing, a 2px hover lift on laptop and up with a real pointer, and no lift under reduced motion
|
|
45
|
+
* ๐ **AbToc (new, G46)**: plain `#id` anchors, `aria-current="location"`, and an optional `onNavigate` (for `scrollToAbSection`)
|
|
46
|
+
* ๐ **Panes scrolling (D35/G55):** with core 0.1.6 the page never scrolls, the main pane does. `getAbMainScroller()` / `AB_MAIN_SCROLLER_SELECTOR` (`[data-ab-part="main-content"]`) from `ab-nextjs-components/ab-toc` give the `root` for `useAbScrollSpy` (call it in an effect or handler, never during render; `import { getAbMainScroller } from 'ab-nextjs-components/ab-toc'`, also on the root barrel with `AbToc`) and the `container` for `scrollToAbSection`; a plain `#id` jump scrolls the pane on its own. In panes the AbAppBar is the header row outside the scroller, so it stays put without the document scrolling
|
|
47
|
+
* ๐ **AbAppBar active link (Joseph):** without `activeHref` it uses the pathname minus the AbLinkProvider `locales` (or its own `locales` prop), like AbSidebar / AbNavbar, so `/fr/docs` marks Docs
|
|
48
|
+
* ๐งฉ **AbPackageCard names wrap at hyphens (Joseph):** a `<wbr>` after each `-` (`toAbPackageNameParts`), so narrow cards show `ab-nextjs-` / `components` on two lines instead of an ellipsis; `overflow-wrap: anywhere` splits a part only when it alone is wider than the card. Checked in WebKit at 1280 (no clipping, no overflow)
|
|
49
|
+
* ๐ **AbSidebar item `id`:** optional, used as the React key (`id ?? href`) so two items may share an href
|
|
50
|
+
* ๐ **AbIcon per-instance ids (Joseph):** every render suffixes the SVG ids and `url(#โฆ)` refs with `useId()` (`scopeAbIconIds`), so two filled Homes never share a mask and a hidden twin can't turn the active Home into a solid square
|
|
51
|
+
* ๐ **AbBalloon a11y**: `role="tooltip"`, `aria-describedby` on the trigger, shows on focus, a 300ms hover delay (`AB_BALLOON_HOVER_DELAY`), Escape dismisses, `popIn` skipped under reduced motion. Without JS, CSS shows it on focus or hover. New `placement` and `delay` props
|
|
52
|
+
* ๐ซ **JS-off fallbacks**: AbInstallSnippet hides copy (the command shows the pnpm default). AbLocaleSwitcher with `getHref` renders a `<details>` list of `hreflang` links
|
|
53
|
+
* ๐ฑ **AbAppBar compact phone layout (< 768px):** tighter gaps, a shrinkable brand, an icon-only search pill and `compactActions` (shown instead of `actions`), so nothing overflows at 390px
|
|
54
|
+
* ๐ **AbButton** forwards any `aria-*` / `data-*` prop (e.g. `useAbAsideToggle().props`), and the `href` variant gets the theme's padding and colours (it rendered 20px tall with none). **AbIconButton** draws its glyph with AbIcon (filled while `active`, or `iconFilled`)
|
|
55
|
+
* ๐ง **AbNavbar** button items take `disabled` and `comingSoon` (inert, `aria-disabled`, a "Coming soon" tag)
|
|
56
|
+
* ๐ **Locale-aware active state:** `AbLinkProvider` takes `locales`; AbSidebar / AbNavbar strip `/fr` from the pathname (or `activeHref` on the server twins, via a `locales` prop). `stripAbLocalePrefix` is exported. `AbLinkProvider` is generic over the link's props, so next-intl's `Link` needs no cast
|
|
57
|
+
* ๐ **AbCard / AbPackageCard** take `id`; AbPackageCard takes `media`, and names never wrap mid-name (ellipsis + `title`). **AbToc** takes `label` (alias of `title`). **AbSidebar** labels accept any node (`labelText` names the rail) and use M3 label-large
|
|
58
|
+
* ๐ป **AbInstallSnippet** puts the command on `--ab-color-code-surface` / `--ab-color-on-code-surface` with `--ab-font-code` (theme 0.3.4, with fallbacks)
|
|
59
|
+
* ๐ก๏ธ **Release age:** the expired `ab-nextjs-theme@0.3.3` exclude is gone, `.npmrc` no longer sets `minimumReleaseAge` (pnpm 11 ignores it there), and `minimumReleaseAgeStrict: true` is on. Tests guard all three; the per-entry expiry allowlist stays ready for scoped D33 exemptions
|
|
60
|
+
* ๐ Every code file carries the full house header with `@authors`; the npm author email is abrahamukachi@gmail.com
|
|
61
|
+
* ๐งช The release-age guard moved to `__tests__/release-age.test.ts`: excludes must be our own exact `ab-nextjs-*` versions and fail once expired
|
|
62
|
+
* โฌ๏ธ 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`
|
|
63
|
+
* โณ **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
|
|
64
|
+
|
|
1
65
|
## 0.1.12 โ 2026-10-16
|
|
2
66
|
|
|
3
67
|
* โฟ **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
|
package/README.md
CHANGED
|
@@ -74,6 +74,58 @@ Shipped assets: `assets/logos/ab-logo.svg`, `assets/spinners/3-dots-scale.svg`,
|
|
|
74
74
|
```
|
|
75
75
|
* `<AbInstallSnippet>` tabs are **โฅ 4.5:1** (WCAG AA) in light and dark, active, inactive and hover: inactive = on-surface-variant on surface-container, hover = on-surface on an 8% state layer, active = on-primary-container on primary-container.
|
|
76
76
|
|
|
77
|
+
### Docs shell (0.1.13) ๐งญ
|
|
78
|
+
|
|
79
|
+
New subpaths for the docs / PWA shell. All links go through **`AbLinkProvider`**, and every icon is an AbIcon (no Material Symbols font).
|
|
80
|
+
|
|
81
|
+
* **`ab-nextjs-components/ab-link`**: `<AbLinkProvider component={Link}>` swaps the link used by **every** Ab component (for example the locale-aware `Link` from `ab-nextjs-i18n`). `useAbLink()` and `<AbLink>` are exported too. It is the package's only `next/link` import (test-guarded).
|
|
82
|
+
```tsx
|
|
83
|
+
<AbLinkProvider component={Link}>{children}</AbLinkProvider>
|
|
84
|
+
```
|
|
85
|
+
* **`<AbSidebar>` v2 (G40)**: `sections=[{ id, label, items: [{ href, icon, label, badge?, items? }] }]`, `activeHref`, `collapsed` / `defaultCollapsed` / `onCollapsedChange`, `header`, `labels`. The active item gets `aria-current="page"` and a filled icon. Collapsed it becomes a 72px rail with balloon tooltips. The collapse button has `aria-expanded` + `aria-controls` and is hidden when JS is off. The server twin renders the same markup (no toggle). Legacy `links` / `page` still work.
|
|
86
|
+
* **`<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.
|
|
87
|
+
* **`<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.
|
|
88
|
+
* **`<AbSearchTrigger>` + `<AbKbd>` (G44)**: shows โK on Apple and Ctrl K elsewhere, sets `aria-keyshortcuts="Meta+K Control+K"`, calls `onOpen` (button) or falls back to `href` (link). `comingSoon` makes it `aria-disabled`.
|
|
89
|
+
* **`<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`.
|
|
90
|
+
* **`<AbToc>` (G46)**: plain `#id` links, `aria-current="location"`. Pair with `useAbScrollSpy` / `scrollToAbSection` from `ab-nextjs-hooks@0.1.7`.
|
|
91
|
+
* **`<AbBalloon>`** is now a real tooltip: `role="tooltip"`, `aria-describedby` on the trigger, shows on focus, after 300ms on hover, and hides on Escape.
|
|
92
|
+
* **JS off**: `<AbInstallSnippet>` shows the pnpm command and hides copy. `<AbLocaleSwitcher getHref>` falls back to a `<details>` list of `hreflang` links.
|
|
93
|
+
* โ ๏ธ **AbIcon has no font fallback any more.** An unknown name renders an empty box and warns once in development. The client AbIcon only knows registered icons, so register the ones your sidebar / navbar use:
|
|
94
|
+
```ts
|
|
95
|
+
import code from 'ab-nextjs-icons/ab-icons/icons/code'
|
|
96
|
+
registerAbIcons({ code })
|
|
97
|
+
```
|
|
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
|
+
|
|
77
129
|
## Getting Started
|
|
78
130
|
|
|
79
131
|
### Installation
|
|
@@ -0,0 +1,210 @@
|
|
|
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: AbAppBar (G43)
|
|
28
|
+
* @file: ab-app-bar/index.tsx
|
|
29
|
+
* @type: Client Component
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* <AbAppBar
|
|
34
|
+
* brand={<AbBrand />}
|
|
35
|
+
* search={<AbSearchTrigger onOpen={openSearch} />}
|
|
36
|
+
* nav={[{ href: '/docs', label: 'Docs' }, { href: '/components', label: 'Components' }]}
|
|
37
|
+
* activeHref="/docs"
|
|
38
|
+
* actions={<AbThemeToggle />}
|
|
39
|
+
* />
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/*
|
|
43
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
44
|
+
* MOTTO: We'll always do more ๐!!!
|
|
45
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
'use client';
|
|
49
|
+
|
|
50
|
+
// โ๏ธ React
|
|
51
|
+
import { useEffect, useId, useRef, useState, type ReactElement, type ReactNode } from 'react';
|
|
52
|
+
// ๐งต classes
|
|
53
|
+
import clsx from 'clsx';
|
|
54
|
+
// ๐ G42 link
|
|
55
|
+
import Link, { stripAbLocalePrefix, useAbLocales } from '../ab-link';
|
|
56
|
+
// ๐งญ current route (fallback when `activeHref` is omitted, like AbSidebar / AbNavbar)
|
|
57
|
+
import { usePathname } from 'next/navigation';
|
|
58
|
+
// ๐ฃ icons (more_vert is a built-in)
|
|
59
|
+
import AbIcon from '../ab-icon';
|
|
60
|
+
// ๐ the overflow menu (G26)
|
|
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';
|
|
66
|
+
// ๐จ styles
|
|
67
|
+
import styles from './styles.module.css';
|
|
68
|
+
|
|
69
|
+
/** ๐ a top-level destination */
|
|
70
|
+
export interface AbAppBarNavItem {
|
|
71
|
+
href: string; // ๐
|
|
72
|
+
label: string; // ๐ท๏ธ
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** โ๏ธ props */
|
|
76
|
+
export interface AbAppBarProps {
|
|
77
|
+
brand?: ReactNode; // ๐ท๏ธ logo / wordmark (left)
|
|
78
|
+
search?: ReactNode; // ๐ e.g. <AbSearchTrigger />
|
|
79
|
+
nav?: AbAppBarNavItem[]; // ๐งญ inline from 1180px, in the "More" menu below
|
|
80
|
+
activeHref?: string; // ๐ฏ default: the pathname without its locale prefix
|
|
81
|
+
locales?: readonly string[]; // ๐ 0.1.13 (Joseph): stripped from the pathname (default: AbLinkProvider's), so `/fr/docs` marks `/docs`
|
|
82
|
+
actions?: ReactNode; // ๐ right side (theme toggle, locale switcher, GitHubโฆ)
|
|
83
|
+
compactActions?: ReactNode; // ๐ฑ 0.1.13 (Joseph #3): shown INSTEAD of `actions` below 768px (e.g. only the theme toggle); the rest can live in the More menu or the nav sheet
|
|
84
|
+
leading?: ReactNode; // โฐ optional slot before the brand (e.g. a rail toggle)
|
|
85
|
+
sticky?: boolean; // ๐ default true (hairline under it)
|
|
86
|
+
labels?: { nav?: string; more?: string }; // ๐
|
|
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
|
+
}
|
|
98
|
+
|
|
99
|
+
/** ๐ฏ exact match or parent prefix ("/" only matches itself) */
|
|
100
|
+
const isActive = (href: string, active?: string) => !!active && (href === active || (href !== '/' && active.startsWith(`${href.replace(/\/$/, '')}/`)));
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* ๐งฑ AbAppBar (G43): brand, search, nav, actions, sticky with a hairline. Below 1180px the nav moves into a
|
|
104
|
+
* "More" overflow menu built on AbMenu (G26). JS off: the More button is hidden and the nav scrolls inline.
|
|
105
|
+
*/
|
|
106
|
+
const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compactActions, leading, sticky = true, labels, className, presentation = 'menu', density = 'comfortable', divider = false, moreMenu = true }: AbAppBarProps): ReactElement => {
|
|
107
|
+
// ๐ the active link comes from the AbLinkProvider locales, same rule as AbSidebar / AbNavbar
|
|
108
|
+
const appLocales = useAbLocales();
|
|
109
|
+
const pathname = stripAbLocalePrefix(usePathname() ?? '', locales ?? appLocales); // ๐งญ `/fr/docs` โ `/docs`
|
|
110
|
+
const current = activeHref ?? pathname; // ๐ฏ explicit wins
|
|
111
|
+
// ๐ menu id
|
|
112
|
+
const menuId = `ab-app-bar-more-${useId().replace(/:/g, '')}`;
|
|
113
|
+
// ๐ menu state
|
|
114
|
+
const [open, setOpen] = useState(false);
|
|
115
|
+
const [mode, setMode] = useState<'menu' | 'drawer'>(presentation === 'drawer' ? 'drawer' : 'menu'); // ๐๏ธ decided on click
|
|
116
|
+
const wrap = useRef<HTMLDivElement>(null);
|
|
117
|
+
const btn = useRef<HTMLButtonElement>(null);
|
|
118
|
+
// โ Escape + outside click close it
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (!open || mode !== 'menu') return; // ๐๏ธ the drawer has its own Escape / scrim
|
|
121
|
+
const onKey = (e: KeyboardEvent) => {
|
|
122
|
+
if (e.key === 'Escape') {
|
|
123
|
+
setOpen(false);
|
|
124
|
+
btn.current?.focus(); // โฟ focus back on the trigger
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const onDown = (e: PointerEvent) => {
|
|
128
|
+
if (!wrap.current?.contains(e.target as Node)) setOpen(false); // ๐
|
|
129
|
+
};
|
|
130
|
+
document.addEventListener('keydown', onKey);
|
|
131
|
+
document.addEventListener('pointerdown', onDown);
|
|
132
|
+
return () => {
|
|
133
|
+
document.removeEventListener('keydown', onKey);
|
|
134
|
+
document.removeEventListener('pointerdown', onDown);
|
|
135
|
+
};
|
|
136
|
+
}, [open, mode]);
|
|
137
|
+
|
|
138
|
+
return (
|
|
139
|
+
<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'}>
|
|
140
|
+
{leading}
|
|
141
|
+
{brand && <div className={styles.abAppBarBrand}>{brand}</div>}
|
|
142
|
+
{search && <div className={styles.abAppBarSearch}>{search}</div>}
|
|
143
|
+
{nav.length > 0 && (
|
|
144
|
+
<nav className={styles.abAppBarNav} aria-label={labels?.nav ?? 'Main'}>
|
|
145
|
+
<ul>
|
|
146
|
+
{nav.map((n) => {
|
|
147
|
+
const on = isActive(n.href, current); // ๐ฏ
|
|
148
|
+
return (
|
|
149
|
+
<li key={n.href}>
|
|
150
|
+
<Link href={n.href} className={styles.abAppBarLink} data-active={on ? 'true' : 'false'} aria-current={on ? 'page' : undefined}>{n.label}</Link>
|
|
151
|
+
</li>
|
|
152
|
+
);
|
|
153
|
+
})}
|
|
154
|
+
</ul>
|
|
155
|
+
</nav>
|
|
156
|
+
)}
|
|
157
|
+
{divider && <span className={styles.abAppBarDivider} aria-hidden="true" data-ab-part="app-bar-divider" /> /* โ P4 */}
|
|
158
|
+
<div className={styles.abAppBarActions}>
|
|
159
|
+
{/* ๐ actions; ๐ฑ below 768px `compactActions` replaces them (both rendered, CSS picks: no hydration flip) */}
|
|
160
|
+
{compactActions != null ? (
|
|
161
|
+
<>
|
|
162
|
+
<div className={styles.abAppBarActionsWide}>{actions}</div>
|
|
163
|
+
<div className={styles.abAppBarActionsCompact}>{compactActions}</div>
|
|
164
|
+
</>
|
|
165
|
+
) : actions}
|
|
166
|
+
{nav.length > 0 && moreMenu && (
|
|
167
|
+
<div ref={wrap} className={styles.abAppBarMore}>
|
|
168
|
+
<button
|
|
169
|
+
ref={btn}
|
|
170
|
+
type="button"
|
|
171
|
+
className={styles.abAppBarMoreButton} // ๐ โฅ 1180px and JS off
|
|
172
|
+
aria-label={labels?.more ?? 'More'}
|
|
173
|
+
aria-haspopup={mode === 'drawer' ? 'dialog' : 'menu'}
|
|
174
|
+
aria-expanded={open}
|
|
175
|
+
aria-controls={mode === 'drawer' ? `${menuId}-drawer` : menuId}
|
|
176
|
+
onClick={() => { if (!open) setMode(resolveAbPresentation(presentation)); setOpen((o) => !o); }} // ๐ฑ๏ธ `auto` decides now
|
|
177
|
+
>
|
|
178
|
+
<AbIcon name="more_vert" size={24} />
|
|
179
|
+
</button>
|
|
180
|
+
<AbMenu
|
|
181
|
+
id={menuId}
|
|
182
|
+
hidden={!open || mode !== 'menu'}
|
|
183
|
+
isActive={open && mode === 'menu'}
|
|
184
|
+
className={styles.abAppBarMenu}
|
|
185
|
+
items={nav.map((n) => ({ id: n.href, label: n.label, href: n.href, selected: isActive(n.href, current), onClick: () => setOpen(false) }))}
|
|
186
|
+
/>
|
|
187
|
+
{presentation !== 'menu' && (
|
|
188
|
+
<AbDrawerList
|
|
189
|
+
id={`${menuId}-drawer`}
|
|
190
|
+
open={open && mode === 'drawer'}
|
|
191
|
+
onClose={() => setOpen(false)} // ๐ช focus goes back to More
|
|
192
|
+
scope="app"
|
|
193
|
+
side="bottom"
|
|
194
|
+
as={AbBottomDrawer} // ๐ฑ
|
|
195
|
+
title={labels?.more ?? 'More'}
|
|
196
|
+
noJsFallback={false} // ๐ซ JS off: the nav already scrolls inline
|
|
197
|
+
value={nav.find((n) => isActive(n.href, current))?.href}
|
|
198
|
+
items={nav.map((n) => ({ value: n.href, label: n.label, href: n.href }))}
|
|
199
|
+
/>
|
|
200
|
+
)}
|
|
201
|
+
</div>
|
|
202
|
+
)}
|
|
203
|
+
</div>
|
|
204
|
+
</header>
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// ๐ฆ exports
|
|
209
|
+
export default AbAppBar;
|
|
210
|
+
export { AbAppBar };
|
|
@@ -0,0 +1,158 @@
|
|
|
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: AbAppBar - Styles (G43)
|
|
28
|
+
* @file: ab-app-bar/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
|
+
/* ๐งฑ bar */
|
|
40
|
+
.abAppBar {
|
|
41
|
+
width: 100%; /* โ๏ธ never wider than its container */
|
|
42
|
+
max-width: 100%; /* ๐ซ overflow */
|
|
43
|
+
min-width: 0; /* ๐ซ overflow (flex/grid child) */
|
|
44
|
+
display: flex; /* ๐ */
|
|
45
|
+
align-items: center; /* โ๏ธ */
|
|
46
|
+
gap: 16px; /* โ๏ธ */
|
|
47
|
+
min-height: var(--ab-app-bar-height, 64px); /* ๐ 0.1.13: 64px incl. the hairline (core 0.1.6 panes measure the header row, no offset to match) */
|
|
48
|
+
padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px)); /* ๐ฆ no block padding: 56px actions fit */
|
|
49
|
+
box-sizing: border-box; /* ๐ฆ */
|
|
50
|
+
background: var(--ab-color-surface, inherit); /* ๐จ */
|
|
51
|
+
}
|
|
52
|
+
.abAppBar[data-sticky='true'] {
|
|
53
|
+
position: sticky; /* ๐ document layouts; in core 0.1.6 panes the bar is the header row OUTSIDE the main scroller, so it stays put on its own */
|
|
54
|
+
top: 0; /* โฌ๏ธ */
|
|
55
|
+
z-index: 40; /* โฌ๏ธ */
|
|
56
|
+
border-bottom: var(--ab-divider-hairline, 1px solid rgb(0 0 0 / 0.12)); /* โ theme 0.3.4 hairline */
|
|
57
|
+
}
|
|
58
|
+
.abAppBarBrand { flex: none; display: flex; align-items: center; } /* ๐ท๏ธ */
|
|
59
|
+
.abAppBarSearch { flex: 1 1 240px; min-width: 0; display: flex; } /* ๐ */
|
|
60
|
+
.abAppBarNav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; } /* ๐งญ */
|
|
61
|
+
.abAppBarLink {
|
|
62
|
+
display: inline-flex; /* ๐ */
|
|
63
|
+
align-items: center; /* โ๏ธ */
|
|
64
|
+
height: 40px; /* ๐ */
|
|
65
|
+
padding: 0 12px; /* ๐ฆ */
|
|
66
|
+
border-radius: 999px; /* ๐ข */
|
|
67
|
+
color: inherit; /* ๐๏ธ */
|
|
68
|
+
text-decoration: none; /* ๐ซ */
|
|
69
|
+
font-weight: 500; /* ๐ค */
|
|
70
|
+
white-space: nowrap; /* โ๏ธ */
|
|
71
|
+
}
|
|
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
|
+
.abAppBarLink:focus-visible,
|
|
74
|
+
.abAppBarMoreButton:focus-visible {
|
|
75
|
+
outline: var(--ab-focus-ring-width, 2px) solid var(--ab-color-accent, var(--ab-color-primary, #8f4c38)); /* โฟ */
|
|
76
|
+
outline-offset: var(--ab-focus-ring-offset, 2px); /* โฟ */
|
|
77
|
+
}
|
|
78
|
+
.abAppBarActions { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; flex: none; } /* ๐ */
|
|
79
|
+
.abAppBarActionsWide, .abAppBarActionsCompact { display: flex; align-items: center; gap: 4px; } /* ๐ */
|
|
80
|
+
.abAppBarActionsCompact { display: none; } /* ๐ wide screens */
|
|
81
|
+
.abAppBarMore { position: relative; } /* ๐ */
|
|
82
|
+
.abAppBarMoreButton {
|
|
83
|
+
display: none; /* ๐ wide screens */
|
|
84
|
+
place-items: center; /* ๐ฏ */
|
|
85
|
+
width: 40px; /* ๐ */
|
|
86
|
+
height: 40px; /* ๐ */
|
|
87
|
+
border: 0; /* ๐ซ */
|
|
88
|
+
border-radius: 999px; /* ๐ข */
|
|
89
|
+
background: transparent; /* ๐จ */
|
|
90
|
+
color: inherit; /* ๐๏ธ */
|
|
91
|
+
cursor: pointer; /* ๐ */
|
|
92
|
+
}
|
|
93
|
+
.abAppBarMenu { position: absolute; inset-inline-end: 0; top: calc(100% + 4px); min-width: 200px; max-width: calc(100vw - 16px); z-index: 50; } /* ๐ never wider than the screen */
|
|
94
|
+
.abAppBarMenu[hidden] { display: none; } /* ๐ closed: no layout, no overflow (Joseph #3) */
|
|
95
|
+
|
|
96
|
+
/* ๐ฑ below 1180px: nav โ "More" */
|
|
97
|
+
@media (max-width: 1179px) {
|
|
98
|
+
.abAppBarNav { display: none; } /* ๐ */
|
|
99
|
+
.abAppBarMoreButton { display: inline-grid; } /* โฎ */
|
|
100
|
+
}
|
|
101
|
+
/* ๐ซ JS off: no menu, the nav stays inline and scrolls */
|
|
102
|
+
@media (max-width: 1179px) and (scripting: none) {
|
|
103
|
+
.abAppBarNav { display: block; overflow-x: auto; min-width: 0; } /* ๐งญ */
|
|
104
|
+
.abAppBarMore { display: none; } /* ๐ */
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* ๐ฑ 0.1.13 (Joseph #3): compact phone layout (< 768px). Tighter gaps, the brand may shrink, the search
|
|
108
|
+
* pill becomes a 40px icon button (its label stays for screen readers), `compactActions` replace the
|
|
109
|
+
* actions. Result: no horizontal overflow at 390px. */
|
|
110
|
+
@media (max-width: 767px) {
|
|
111
|
+
.abAppBar { gap: 8px; padding-inline: max(12px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px)); } /* ๐ฆ */
|
|
112
|
+
.abAppBarBrand { flex: 0 1 auto; min-width: 0; overflow: hidden; } /* ๐ท๏ธ may shrink */
|
|
113
|
+
.abAppBarSearch { flex: none; margin-inline-start: auto; } /* ๐ icon only, pushed right */
|
|
114
|
+
.abAppBarSearch > :global(.AbSearchTrigger):not([data-size='sm']) { width: 40px; min-width: 40px; padding: 0; justify-content: center; flex: none; } /* ๐ */
|
|
115
|
+
.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
|
+
.abAppBarActions { margin-inline-start: 0; gap: 0; } /* ๐ */
|
|
117
|
+
.abAppBar[data-has-compact-actions='true'] .abAppBarActionsWide { display: none; } /* ๐ */
|
|
118
|
+
.abAppBar[data-has-compact-actions='true'] .abAppBarActionsCompact { display: flex; } /* ๐ */
|
|
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
|
+
}
|
package/ab-avatar/index.tsx
CHANGED
|
@@ -8,13 +8,14 @@
|
|
|
8
8
|
* @project: ab-nextjs-components
|
|
9
9
|
* @name: AbAvatar - Client (port of lyd-avatar)
|
|
10
10
|
* @file: ab-avatar/index.tsx
|
|
11
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
'use client';
|
|
14
15
|
|
|
15
16
|
import type { ReactElement } from 'react';
|
|
16
17
|
import Image from 'next/image';
|
|
17
|
-
import Link from 'next/link
|
|
18
|
+
import Link from '../ab-link'; // ๐ G42: injectable via AbLinkProvider (default next/link)
|
|
18
19
|
import clsx from 'clsx';
|
|
19
20
|
import styles from './styles.module.css';
|
|
20
21
|
|
|
@@ -1,3 +1,35 @@
|
|
|
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: styles.module.css
|
|
28
|
+
* @file: ab-avatar/styles.module.css
|
|
29
|
+
* @type: CSS Stylesheet
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*/
|
|
32
|
+
|
|
1
33
|
/* AbAvatar โ plain CSS (no Tailwind apply) */
|
|
2
34
|
.abAvatar {
|
|
3
35
|
display: flex;
|