ab-nextjs-components 0.1.13 → 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 +35 -0
- package/README.md +30 -0
- package/ab-app-bar/index.tsx +39 -10
- package/ab-app-bar/styles.module.css +43 -4
- package/ab-bottom-drawer/index.tsx +71 -0
- package/ab-bottom-drawer/styles.module.css +66 -0
- 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 +8 -2
- package/ab-button/styles.module.css +39 -0
- package/ab-card/styles.module.css +1 -1
- 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-confirm-drawer/index.tsx +97 -0
- package/ab-confirm-drawer/styles.module.css +41 -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 +4 -0
- package/ab-icon-button/index.tsx +12 -1
- package/ab-icon-button/styles.module.css +1 -1
- package/ab-install-snippet/index.tsx +51 -29
- package/ab-install-snippet/styles.module.css +34 -2
- package/ab-kbd/styles.module.css +1 -1
- package/ab-list/index.tsx +107 -0
- package/ab-list/styles.module.css +82 -0
- package/ab-locale-switcher/index.tsx +42 -10
- package/ab-locale-switcher/styles.module.css +4 -4
- package/ab-navbar/styles.module.css +20 -2
- package/ab-navbar/view.tsx +7 -4
- package/ab-package-card/index.tsx +49 -2
- package/ab-package-card/styles.module.css +40 -0
- package/ab-search-trigger/index.tsx +17 -2
- package/ab-search-trigger/styles.module.css +27 -1
- package/ab-sidebar/index.tsx +5 -2
- package/ab-sidebar/styles.module.css +48 -5
- package/ab-sidebar/view.tsx +14 -4
- package/ab-theme-toggle/index.tsx +21 -6
- package/ab-theme-toggle/styles.module.css +18 -3
- package/ab-toc/index.tsx +9 -2
- package/ab-toc/styles.module.css +20 -8
- package/ab-version-switcher/index.tsx +143 -0
- package/ab-version-switcher/styles.module.css +76 -0
- package/index.ts +27 -0
- package/package.json +18 -3
- package/server/ab-button/index.tsx +6 -2
- package/server/ab-button/styles.module.css +39 -0
- package/types/index.d.ts +19 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
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
|
+
|
|
1
36
|
## 0.1.13 — 2026-10-16
|
|
2
37
|
|
|
3
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)
|
package/README.md
CHANGED
|
@@ -96,6 +96,36 @@ New subpaths for the docs / PWA shell. All links go through **`AbLinkProvider`**
|
|
|
96
96
|
registerAbIcons({ code })
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
+
### Home fidelity (0.1.14, unreleased) 🏠
|
|
100
|
+
|
|
101
|
+
These match the approved Home mocks (`home-fidelity-spec.md` §4/§5). Colours come from the `ab-nextjs-theme` ≥ 0.3.5 Home tokens, with the light mock values as fallbacks. Each component also has its own `--ab-list-*` / `--ab-crumbs-*` / `--ab-version-*` / `--ab-bottom-drawer-*` knobs.
|
|
102
|
+
|
|
103
|
+
* **`<AbList>` / `<AbListItem>`** (server-safe): `title`, `meta` (a `<code>` inside renders as mono), `media` (shown in a 30px tile), `badge` + `badgeTone="primary" | "tonal"` (64×22), `trailing="chevron"` or a node, and `href` (the whole row becomes a link).
|
|
104
|
+
* **`<AbBreadcrumbs items={[{ label, href? }]}>`** (server-safe): a `nav` > `ol`. The last crumb has `aria-current="page"`.
|
|
105
|
+
* **`<AbVersionSwitcher label="Docs" version="v0.2.x" versions={[{ value, href? }]} onSelect>`**: a 28px bordered trigger that opens an AbMenu. With JS off it falls back to a `<details>` list of links.
|
|
106
|
+
* **`<AbBottomDrawer>`**: an app-scope bottom `AbDrawer` with a 20px top radius, a grab handle and safe-area padding, centred at up to 560px from 768px. `<AbDrawerList as={AbBottomDrawer}>` uses it, and so does the mobile language picker.
|
|
107
|
+
|
|
108
|
+
### Drawers (0.1.14, unreleased) 🗄️
|
|
109
|
+
|
|
110
|
+
A drawer belongs to a **region**: the whole app, the main pane or the aside pane. It slides in from that region's edge, is clipped by it, and **never scrolls the document**.
|
|
111
|
+
|
|
112
|
+
> 🧱 **Requires `ab-nextjs-core` 0.1.6 or later markup** for the scopes (`.AbAppLayout`, `[data-ab-part="main"]`, `[data-ab-part="aside"]`). With older core, or with no layout, every drawer falls back to a viewport layer on `<body>`.
|
|
113
|
+
|
|
114
|
+
* **`<AbDrawer>`** (`ab-nextjs-components/ab-drawer`): `open`, `onClose`, `scope="app" | "main" | "aside"` (default `app`), `side="bottom" | "top" | "left" | "right" | "start" | "end"` (default `bottom`; `start` / `end` follow `dir`), `title` (or `aria-labelledby` / `aria-label`), `footer`, `size` (`--ab-drawer-size`), `modal` (default `true`), `closeLabel`, `noJsFallback` (default `true`).
|
|
115
|
+
* It portals into a layer inside the core layout box (`.AbAppLayout`, `[data-ab-part="main"]`, `[data-ab-part="aside"]`). Without a layout it covers the viewport from `<body>`.
|
|
116
|
+
* `role="dialog"`, `aria-modal`, and the label goes on the panel. Focus moves in and is trapped. Escape, a scrim click or the ✕ close it, and focus goes back to the opener. While it's open the rest of its scope is `inert`.
|
|
117
|
+
* It slides for 240ms, the same as the panes, using `ab-nextjs-animations` motion. With reduced motion it appears without the slide.
|
|
118
|
+
* Without JS (D41) the content renders in flow as a labelled `<section>`, so nothing is hidden behind JavaScript.
|
|
119
|
+
* **`useAbDrawer(scope?)`** (also on the root barrel) returns `{ open, show, close, toggle, setOpen, id, triggerProps, drawerProps }`:
|
|
120
|
+
```tsx
|
|
121
|
+
import { AbDrawerList, useAbDrawer } from 'ab-nextjs-components'
|
|
122
|
+
const d = useAbDrawer('app')
|
|
123
|
+
<button {...d.triggerProps}>Language</button>
|
|
124
|
+
<AbDrawerList {...d.drawerProps} side="bottom" title="Language" items={[{ value: 'en', label: 'English', lang: 'en' }]} value={locale} onSelect={setLocale} />
|
|
125
|
+
```
|
|
126
|
+
* **Presets.** `<AbDrawerList>` is one selectable list: `items={[{ value, label, description?, icon?, href?, lang?, disabled? }]}`, `value`, `onSelect`, `closeOnSelect`, with the current item marked `aria-current`. `<AbConfirmDrawer>` takes `message`, `confirmLabel`, `cancelLabel`, `onConfirm`, `onCancel`, `tone="danger"` and `busy`. Escape, the scrim and ✕ count as cancel.
|
|
127
|
+
* **G56:** `<AbLocaleSwitcher presentation="drawer" | "auto">` and `<AbAppBar presentation="drawer" | "auto">` (the More menu) open as an app-scope bottom `AbDrawerList`. `auto` opens a drawer below 768px and a menu above. The default stays `menu`.
|
|
128
|
+
|
|
99
129
|
## Getting Started
|
|
100
130
|
|
|
101
131
|
### Installation
|
package/ab-app-bar/index.tsx
CHANGED
|
@@ -59,6 +59,10 @@ import { usePathname } from 'next/navigation';
|
|
|
59
59
|
import AbIcon from '../ab-icon';
|
|
60
60
|
// 📋 the overflow menu (G26)
|
|
61
61
|
import AbMenu from '../ab-menu';
|
|
62
|
+
// 🗄️ 0.1.14 (G56): the More menu can open as a drawer
|
|
63
|
+
import AbDrawerList from '../ab-drawer-list';
|
|
64
|
+
import AbBottomDrawer from '../ab-bottom-drawer';
|
|
65
|
+
import { resolveAbPresentation, type AbPresentation } from '../ab-locale-switcher';
|
|
62
66
|
// 🎨 styles
|
|
63
67
|
import styles from './styles.module.css';
|
|
64
68
|
|
|
@@ -81,6 +85,15 @@ export interface AbAppBarProps {
|
|
|
81
85
|
sticky?: boolean; // 📌 default true (hairline under it)
|
|
82
86
|
labels?: { nav?: string; more?: string }; // 🌍
|
|
83
87
|
className?: string; // 🏷️
|
|
88
|
+
/** 🗄️ 0.1.14 (G56, D40): More as `menu` (default), `drawer` (app-scope bottom AbDrawerList) or `auto` (drawer below 768px) */
|
|
89
|
+
presentation?: AbPresentation;
|
|
90
|
+
/** 📏 0.1.14 (P5): `'compact'` = the Home bar: height from core's `--ab-header-height` (52 / 60 / 64), 13.5px links,
|
|
91
|
+
* brand column `--ab-app-bar-brand-width` (236, 270 at ≥ 1920), `--div` hairline. Default `'comfortable'` (64px). */
|
|
92
|
+
density?: 'comfortable' | 'compact';
|
|
93
|
+
/** ➖ 0.1.14 (P4): a 1×20 `--div` rule between the nav and the actions (mock: before GitHub) */
|
|
94
|
+
divider?: boolean;
|
|
95
|
+
/** ⋮ 0.1.14 (P19): `false` = no "More" button/menu; below 1180px the nav is simply hidden (default `true`) */
|
|
96
|
+
moreMenu?: boolean;
|
|
84
97
|
}
|
|
85
98
|
|
|
86
99
|
/** 🎯 exact match or parent prefix ("/" only matches itself) */
|
|
@@ -90,7 +103,7 @@ const isActive = (href: string, active?: string) => !!active && (href === active
|
|
|
90
103
|
* 🧱 AbAppBar (G43): brand, search, nav, actions, sticky with a hairline. Below 1180px the nav moves into a
|
|
91
104
|
* "More" overflow menu built on AbMenu (G26). JS off: the More button is hidden and the nav scrolls inline.
|
|
92
105
|
*/
|
|
93
|
-
const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compactActions, leading, sticky = true, labels, className }: AbAppBarProps): ReactElement => {
|
|
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 => {
|
|
94
107
|
// 🌍 the active link comes from the AbLinkProvider locales, same rule as AbSidebar / AbNavbar
|
|
95
108
|
const appLocales = useAbLocales();
|
|
96
109
|
const pathname = stripAbLocalePrefix(usePathname() ?? '', locales ?? appLocales); // 🧭 `/fr/docs` → `/docs`
|
|
@@ -99,11 +112,12 @@ const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compa
|
|
|
99
112
|
const menuId = `ab-app-bar-more-${useId().replace(/:/g, '')}`;
|
|
100
113
|
// 📋 menu state
|
|
101
114
|
const [open, setOpen] = useState(false);
|
|
115
|
+
const [mode, setMode] = useState<'menu' | 'drawer'>(presentation === 'drawer' ? 'drawer' : 'menu'); // 🗄️ decided on click
|
|
102
116
|
const wrap = useRef<HTMLDivElement>(null);
|
|
103
117
|
const btn = useRef<HTMLButtonElement>(null);
|
|
104
118
|
// ⎋ Escape + outside click close it
|
|
105
119
|
useEffect(() => {
|
|
106
|
-
if (!open) return;
|
|
120
|
+
if (!open || mode !== 'menu') return; // 🗄️ the drawer has its own Escape / scrim
|
|
107
121
|
const onKey = (e: KeyboardEvent) => {
|
|
108
122
|
if (e.key === 'Escape') {
|
|
109
123
|
setOpen(false);
|
|
@@ -119,10 +133,10 @@ const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compa
|
|
|
119
133
|
document.removeEventListener('keydown', onKey);
|
|
120
134
|
document.removeEventListener('pointerdown', onDown);
|
|
121
135
|
};
|
|
122
|
-
}, [open]);
|
|
136
|
+
}, [open, mode]);
|
|
123
137
|
|
|
124
138
|
return (
|
|
125
|
-
<header className={clsx('AbAppBar', styles.abAppBar, className)} data-ab-part="app-bar" data-sticky={sticky ? 'true' : 'false'} data-has-compact-actions={compactActions != null ? 'true' : undefined}>
|
|
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'}>
|
|
126
140
|
{leading}
|
|
127
141
|
{brand && <div className={styles.abAppBarBrand}>{brand}</div>}
|
|
128
142
|
{search && <div className={styles.abAppBarSearch}>{search}</div>}
|
|
@@ -140,6 +154,7 @@ const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compa
|
|
|
140
154
|
</ul>
|
|
141
155
|
</nav>
|
|
142
156
|
)}
|
|
157
|
+
{divider && <span className={styles.abAppBarDivider} aria-hidden="true" data-ab-part="app-bar-divider" /> /* ➖ P4 */}
|
|
143
158
|
<div className={styles.abAppBarActions}>
|
|
144
159
|
{/* 🔘 actions; 📱 below 768px `compactActions` replaces them (both rendered, CSS picks: no hydration flip) */}
|
|
145
160
|
{compactActions != null ? (
|
|
@@ -148,27 +163,41 @@ const AbAppBar = ({ brand, search, nav = [], activeHref, locales, actions, compa
|
|
|
148
163
|
<div className={styles.abAppBarActionsCompact}>{compactActions}</div>
|
|
149
164
|
</>
|
|
150
165
|
) : actions}
|
|
151
|
-
{nav.length > 0 && (
|
|
166
|
+
{nav.length > 0 && moreMenu && (
|
|
152
167
|
<div ref={wrap} className={styles.abAppBarMore}>
|
|
153
168
|
<button
|
|
154
169
|
ref={btn}
|
|
155
170
|
type="button"
|
|
156
171
|
className={styles.abAppBarMoreButton} // 🙈 ≥ 1180px and JS off
|
|
157
172
|
aria-label={labels?.more ?? 'More'}
|
|
158
|
-
aria-haspopup=
|
|
173
|
+
aria-haspopup={mode === 'drawer' ? 'dialog' : 'menu'}
|
|
159
174
|
aria-expanded={open}
|
|
160
|
-
aria-controls={menuId}
|
|
161
|
-
onClick={() => setOpen((o) => !o)}
|
|
175
|
+
aria-controls={mode === 'drawer' ? `${menuId}-drawer` : menuId}
|
|
176
|
+
onClick={() => { if (!open) setMode(resolveAbPresentation(presentation)); setOpen((o) => !o); }} // 🖱️ `auto` decides now
|
|
162
177
|
>
|
|
163
178
|
<AbIcon name="more_vert" size={24} />
|
|
164
179
|
</button>
|
|
165
180
|
<AbMenu
|
|
166
181
|
id={menuId}
|
|
167
|
-
hidden={!open}
|
|
168
|
-
isActive={open}
|
|
182
|
+
hidden={!open || mode !== 'menu'}
|
|
183
|
+
isActive={open && mode === 'menu'}
|
|
169
184
|
className={styles.abAppBarMenu}
|
|
170
185
|
items={nav.map((n) => ({ id: n.href, label: n.label, href: n.href, selected: isActive(n.href, current), onClick: () => setOpen(false) }))}
|
|
171
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
|
+
)}
|
|
172
201
|
</div>
|
|
173
202
|
)}
|
|
174
203
|
</div>
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
font-weight: 500; /* 🔤 */
|
|
70
70
|
white-space: nowrap; /* ↔️ */
|
|
71
71
|
}
|
|
72
|
-
.abAppBarLink[data-active='true'] { background: var(--ab-color-secondary-container, rgb(0 0 0 / 0.08)); font-weight: 600; } /* 🎯 */
|
|
72
|
+
.abAppBarLink[data-active='true'] { background: var(--ab-color-tint, var(--ab-color-secondary-container, rgb(0 0 0 / 0.08))); font-weight: 600; } /* 🎯 */
|
|
73
73
|
.abAppBarLink:focus-visible,
|
|
74
74
|
.abAppBarMoreButton:focus-visible {
|
|
75
|
-
outline: var(--ab-focus-ring-width, 2px) solid var(--ab-color-primary, #8f4c38); /* ♿ */
|
|
75
|
+
outline: var(--ab-focus-ring-width, 2px) solid var(--ab-color-accent, var(--ab-color-primary, #8f4c38)); /* ♿ */
|
|
76
76
|
outline-offset: var(--ab-focus-ring-offset, 2px); /* ♿ */
|
|
77
77
|
}
|
|
78
78
|
.abAppBarActions { margin-inline-start: auto; display: flex; align-items: center; gap: 4px; flex: none; } /* 🔘 */
|
|
@@ -111,9 +111,48 @@
|
|
|
111
111
|
.abAppBar { gap: 8px; padding-inline: max(12px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px)); } /* 📦 */
|
|
112
112
|
.abAppBarBrand { flex: 0 1 auto; min-width: 0; overflow: hidden; } /* 🏷️ may shrink */
|
|
113
113
|
.abAppBarSearch { flex: none; margin-inline-start: auto; } /* 🔎 icon only, pushed right */
|
|
114
|
-
.abAppBarSearch > :global(.AbSearchTrigger) { width: 40px; min-width: 40px; padding: 0; justify-content: center; flex: none; } /* 🔘 */
|
|
115
|
-
.abAppBarSearch > :global(.AbSearchTrigger) > :not(:global(.AbIcon)) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* 🕶️ label + kbd */
|
|
114
|
+
.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
116
|
.abAppBarActions { margin-inline-start: 0; gap: 0; } /* 🔘 */
|
|
117
117
|
.abAppBar[data-has-compact-actions='true'] .abAppBarActionsWide { display: none; } /* 🙈 */
|
|
118
118
|
.abAppBar[data-has-compact-actions='true'] .abAppBarActionsCompact { display: flex; } /* 👀 */
|
|
119
119
|
}
|
|
120
|
+
|
|
121
|
+
/* ===== 📏 0.1.14 (P4/P5/P19, Home spec §4 app bar) ===== */
|
|
122
|
+
.abAppBarDivider { flex: none; width: 1px; height: 20px; background: var(--ab-color-div, rgb(92 64 48 / 0.11)); } /* ➖ P4 */
|
|
123
|
+
.abAppBar[data-more='false'] .abAppBarMore { display: none; } /* ⋮ P19: belt and braces (not rendered) */
|
|
124
|
+
@media (max-width: 1179px) { .abAppBar[data-more='false'] .abAppBarDivider { display: none; } } /* ➖ nothing to divide */
|
|
125
|
+
.abAppBar[data-density='compact'] {
|
|
126
|
+
height: var(--ab-header-height, 60px); min-height: 0; gap: 14px; /* 📏 core 0.2.0: 52 / 60 / 64 */
|
|
127
|
+
padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(22px, env(safe-area-inset-left, 0px)); /* 📦 22px: the logo lines up with the sidebar rows */
|
|
128
|
+
background: var(--ab-color-bg, inherit); /* 🎨 --pane */
|
|
129
|
+
}
|
|
130
|
+
.abAppBar[data-density='compact'][data-sticky='true'] { border-bottom: 1px solid var(--ab-color-div, rgb(92 64 48 / 0.11)); } /* ➖ */
|
|
131
|
+
.abAppBar[data-density='compact'] .abAppBarBrand { gap: 14px; } /* 🏷️ */
|
|
132
|
+
.abAppBar[data-density='compact'] .abAppBarSearch { flex: none; } /* 🔎 the field sets its own width */
|
|
133
|
+
.abAppBar[data-density='compact'] .abAppBarNav { margin-inline-start: auto; } /* ➡️ mock: grow, then the links */
|
|
134
|
+
.abAppBar[data-density='compact'] .abAppBarNav ul { gap: 20px; } /* 🧭 */
|
|
135
|
+
.abAppBar[data-density='compact'] .abAppBarLink {
|
|
136
|
+
height: auto; padding: 0; border-radius: 0; background: none; /* 🧹 no pill */
|
|
137
|
+
font-size: 13.5px; font-weight: 550; color: var(--ab-color-muted, #6b5b50); /* 🔤 */
|
|
138
|
+
}
|
|
139
|
+
.abAppBar[data-density='compact'] .abAppBarLink:hover { color: var(--ab-color-text, #211a16); } /* 🖱️ */
|
|
140
|
+
.abAppBar[data-density='compact'] .abAppBarLink[data-active='true'] { background: none; color: var(--ab-color-accent-text, #88603d); font-weight: 650; } /* 🎯 */
|
|
141
|
+
.abAppBar[data-density='compact'] .abAppBarLink:focus-visible { outline-color: var(--ab-color-accent, #a67c52); border-radius: 4px; } /* ♿ */
|
|
142
|
+
.abAppBar[data-density='compact'] .abAppBarActions { gap: 14px; } /* 🔘 GitHub · theme pill */
|
|
143
|
+
.abAppBar[data-density='compact'] :is(.abAppBarActionsWide, .abAppBarActionsCompact) { gap: 14px; }
|
|
144
|
+
.abAppBar[data-density='compact'] .abAppBarNav + .abAppBarActions,
|
|
145
|
+
.abAppBar[data-density='compact'] .abAppBarDivider + .abAppBarActions { margin-inline-start: 0; } /* ➡️ the nav already pushed right */
|
|
146
|
+
@media (min-width: 1180px) {
|
|
147
|
+
.abAppBar[data-density='compact'] .abAppBarBrand { width: var(--ab-app-bar-brand-width, 236px); } /* 🏷️ P4: = sidebar edge */
|
|
148
|
+
}
|
|
149
|
+
@media (min-width: 1920px) {
|
|
150
|
+
.abAppBar[data-density='compact'] { --ab-app-bar-brand-width: 270px; padding-inline: 14px 12px; background: transparent; } /* 🖥️ gapped */
|
|
151
|
+
.abAppBar[data-density='compact'][data-sticky='true'] { border-bottom: 0; } /* 🚫 the panes float */
|
|
152
|
+
.abAppBar[data-density='compact'] { --ab-search-trigger-width: 360px; }
|
|
153
|
+
}
|
|
154
|
+
@media (max-width: 767px) {
|
|
155
|
+
.abAppBar[data-density='compact'] { gap: 2px; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(8px, env(safe-area-inset-right, 0px)); } /* 📱 mock .mapp */
|
|
156
|
+
.abAppBar[data-density='compact'] .abAppBarSearch { margin-inline: auto 4px; } /* 🔎 pushed right, 4px before the icon */
|
|
157
|
+
.abAppBar[data-density='compact'] .abAppBarActions { gap: 0; }
|
|
158
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: AbBottomDrawer (mobile bottom drawer)
|
|
28
|
+
* @file: ab-bottom-drawer/index.tsx
|
|
29
|
+
* @type: Client component
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* 1+|> <AbBottomDrawer {...d.drawerProps} title="Language">…</AbBottomDrawer>
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
38
|
+
* MOTTO: We'll always do more 😜!!!
|
|
39
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
'use client';
|
|
44
|
+
|
|
45
|
+
// ⚛️ React
|
|
46
|
+
import type { ReactElement } from 'react';
|
|
47
|
+
// 🧵 classes
|
|
48
|
+
import clsx from 'clsx';
|
|
49
|
+
// 🗄️ built on AbDrawer
|
|
50
|
+
import AbDrawer, { type AbDrawerProps } from '../ab-drawer';
|
|
51
|
+
// 🎨 styles
|
|
52
|
+
import styles from './styles.module.css';
|
|
53
|
+
|
|
54
|
+
/** ⚙️ props: AbDrawer's, minus `side` (always bottom); scope defaults to the whole app */
|
|
55
|
+
export interface AbBottomDrawerProps extends Omit<AbDrawerProps, 'side'> {
|
|
56
|
+
side?: AbDrawerProps['side']; // 🙈 accepted for drop-in use (AbDrawerList `as`), always rendered as bottom
|
|
57
|
+
handle?: boolean; // ➖ grab handle at the top (default true; decorative)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 📱 AbBottomDrawer: the mobile bottom sheet (God's plan: the language picker on mobile, D40). AbDrawer
|
|
62
|
+
* with `side="bottom"`, `scope="app"`, the Home tokens (card surface, hairline top edge, 20px top radius,
|
|
63
|
+
* grab handle, safe-area padding) and at most 560px wide, centred, above 768px.
|
|
64
|
+
*/
|
|
65
|
+
const AbBottomDrawer = ({ handle = true, scope = 'app', initialFocus = 'panel', className, ...rest }: AbBottomDrawerProps): ReactElement => (
|
|
66
|
+
<AbDrawer {...rest} scope={scope} initialFocus={initialFocus} side="bottom" className={clsx('AbBottomDrawer', styles.abBottomDrawer, handle && styles.withHandle, className)} />
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// 📦 exports
|
|
70
|
+
export default AbBottomDrawer;
|
|
71
|
+
export { AbBottomDrawer };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: AbBottomDrawer styles
|
|
28
|
+
* @file: ab-bottom-drawer/styles.module.css
|
|
29
|
+
* @type: CSS module
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
35
|
+
* MOTTO: We'll always do more 😜!!!
|
|
36
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/* 📱 the sheet: doubled class beats AbDrawer's `.abDrawer[data-side='bottom']` without !important (John's spec) */
|
|
41
|
+
.abBottomDrawer.abBottomDrawer {
|
|
42
|
+
--ab-bottom-drawer-radius: 20px; /* ⭕ = the gapped pane radius */
|
|
43
|
+
--ab-bottom-drawer-max-width: 560px; /* 📏 tablet+ */
|
|
44
|
+
background: var(--ab-color-card, #fff); /* 🎨 --card */
|
|
45
|
+
color: var(--ab-color-text, #211a16); /* 🖋️ --text */
|
|
46
|
+
border-top: 1px solid var(--ab-color-sheet-edge, transparent); /* ➖ dark: rgba(255,248,245,.08) via theme 0.3.5 */
|
|
47
|
+
border-radius: var(--ab-bottom-drawer-radius) var(--ab-bottom-drawer-radius) 0 0; /* ⭕ */
|
|
48
|
+
box-shadow: 0 -8px 28px rgb(25 18 12 / 0.12); /* 🌗 */
|
|
49
|
+
padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); /* 📱 16px + home indicator */
|
|
50
|
+
outline: none; /* 🎯 the sheet takes focus on open: no ring on the sheet itself */
|
|
51
|
+
}
|
|
52
|
+
/* ➖ grab handle (decorative): 36×4, radius 2 */
|
|
53
|
+
.withHandle.withHandle::before {
|
|
54
|
+
content: ''; display: block; flex: none; /* 🧱 */
|
|
55
|
+
width: 36px; height: 4px; margin: 8px auto 0; border-radius: 2px; /* 📏 */
|
|
56
|
+
background: var(--ab-color-handle, rgb(25 18 12 / 0.18)); /* 🎨 dark: rgba(255,248,245,.18) via theme */
|
|
57
|
+
}
|
|
58
|
+
.abBottomDrawer h2 { font-family: var(--ab-font-title, inherit); font-size: 16px; font-weight: 700; letter-spacing: -0.01em; } /* 🏷️ */
|
|
59
|
+
/* ✕ close: 44px hit area, no border, 8px-radius hover tint (the Home icon buttons); ring on keyboard focus only */
|
|
60
|
+
.abBottomDrawer [data-ab-part='drawer-close'] { inline-size: 44px; block-size: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--ab-color-muted, #6b5b50); }
|
|
61
|
+
.abBottomDrawer [data-ab-part='drawer-close']:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); }
|
|
62
|
+
.abBottomDrawer [data-ab-part='drawer-close']:focus { outline: none; }
|
|
63
|
+
.abBottomDrawer [data-ab-part='drawer-close']:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; }
|
|
64
|
+
@media (min-width: 768px) {
|
|
65
|
+
.abBottomDrawer.abBottomDrawer { inset-inline: 0; margin-inline: auto; max-width: var(--ab-bottom-drawer-max-width); } /* 📏 centred */
|
|
66
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: AbBreadcrumbs (P2)
|
|
28
|
+
* @file: ab-breadcrumbs/index.tsx
|
|
29
|
+
* @type: Server-safe component
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* 1+|> <AbBreadcrumbs items={[{ label: "Docs", href: "/docs" }, { label: "Home" }]} />
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
38
|
+
* MOTTO: We'll always do more 😜!!!
|
|
39
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// ⚛️ React
|
|
44
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
45
|
+
// 🧵 classes
|
|
46
|
+
import clsx from 'clsx';
|
|
47
|
+
// 🔗 the app's link (AbLinkProvider)
|
|
48
|
+
import Link from '../ab-link';
|
|
49
|
+
// 🔣 separators
|
|
50
|
+
import AbIcon from '../ab-icon';
|
|
51
|
+
// 🎨 styles
|
|
52
|
+
import styles from './styles.module.css';
|
|
53
|
+
|
|
54
|
+
/** 🍞 one crumb */
|
|
55
|
+
export interface AbBreadcrumbItem {
|
|
56
|
+
label: ReactNode; // 🏷️
|
|
57
|
+
href?: string; // 🔗 omitted on the last (current) crumb
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** ⚙️ props */
|
|
61
|
+
export interface AbBreadcrumbsProps {
|
|
62
|
+
items: readonly AbBreadcrumbItem[]; // 🍞 first → current
|
|
63
|
+
label?: string; // ♿ nav name (default "Breadcrumb")
|
|
64
|
+
className?: string; // 🏷️
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 🍞 AbBreadcrumbs (P2): the tablet main bar's "Docs › **Home**". 13px faint links, the last crumb is the
|
|
69
|
+
* current page (650, text colour, `aria-current="page"`), 16px `chevron_right` separators (hidden from AT).
|
|
70
|
+
* Server-safe: no hooks.
|
|
71
|
+
*/
|
|
72
|
+
const AbBreadcrumbs = ({ items, label = 'Breadcrumb', className }: AbBreadcrumbsProps): ReactElement => (
|
|
73
|
+
<nav aria-label={label} className={clsx('AbBreadcrumbs', styles.abCrumbs, className)} data-ab-part="breadcrumbs">
|
|
74
|
+
<ol className={styles.abCrumbsList}>
|
|
75
|
+
{items.map((it, i) => {
|
|
76
|
+
const last = i === items.length - 1; // 🎯 current page
|
|
77
|
+
return (
|
|
78
|
+
<li key={i} className={styles.abCrumb}>
|
|
79
|
+
{i > 0 && <AbIcon name="chevron_right" size={16} className={styles.abCrumbSep} />}
|
|
80
|
+
{last ? <span className={styles.abCrumbCurrent} aria-current="page">{it.label}</span>
|
|
81
|
+
: it.href ? <Link href={it.href} className={styles.abCrumbLink}>{it.label}</Link>
|
|
82
|
+
: <span>{it.label}</span>}
|
|
83
|
+
</li>
|
|
84
|
+
);
|
|
85
|
+
})}
|
|
86
|
+
</ol>
|
|
87
|
+
</nav>
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
// 📦 exports
|
|
91
|
+
export default AbBreadcrumbs;
|
|
92
|
+
export { AbBreadcrumbs };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: AbBreadcrumbs styles
|
|
28
|
+
* @file: ab-breadcrumbs/styles.module.css
|
|
29
|
+
* @type: CSS module
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
35
|
+
* MOTTO: We'll always do more 😜!!!
|
|
36
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
/* 🎚️ knobs (mock .crumb; theme tokens from ab-nextjs-theme 0.3.5) */
|
|
41
|
+
.abCrumbs {
|
|
42
|
+
--ab-crumbs-color: var(--ab-color-faint, #807062); /* 🖋️ --faint ♿ AA fallback (James) */
|
|
43
|
+
--ab-crumbs-current: var(--ab-color-text, var(--ab-color-on-surface, #211a16)); /* 🖋️ --text */
|
|
44
|
+
--ab-crumbs-hover: var(--ab-color-accent-text, var(--ab-color-bronze-text, #8b6340)); /* 🖱️ --accent-t */
|
|
45
|
+
--ab-crumbs-ring: var(--ab-color-accent, var(--ab-color-bronze, #a67c52)); /* ♿ --accent */
|
|
46
|
+
min-width: 0; font-size: 13px; color: var(--ab-crumbs-color); /* 🔤 */
|
|
47
|
+
}
|
|
48
|
+
.abCrumbsList { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; min-width: 0; } /* 📐 */
|
|
49
|
+
.abCrumb { display: inline-flex; align-items: center; gap: 4px; min-width: 0; white-space: nowrap; } /* 🍞 */
|
|
50
|
+
.abCrumbSep { width: 16px; height: 16px; flex: none; } /* › */
|
|
51
|
+
.abCrumbCurrent { color: var(--ab-crumbs-current); font-weight: 650; overflow: hidden; text-overflow: ellipsis; } /* 🎯 */
|
|
52
|
+
.abCrumbLink { color: inherit; text-decoration: none; border-radius: 4px; } /* 🔗 */
|
|
53
|
+
.abCrumbLink:hover { color: var(--ab-crumbs-hover); } /* 🖱️ */
|
|
54
|
+
.abCrumbLink:focus-visible { outline: 2px solid var(--ab-crumbs-ring); outline-offset: 2px; } /* ♿ */
|
package/ab-button/helpers.ts
CHANGED
|
@@ -39,7 +39,12 @@
|
|
|
39
39
|
// 🎨 visual types shared by the client + server twins
|
|
40
40
|
// 🥉 'filled' (0.1.12): solid bronze, painted by ab-nextjs-theme ≥ 0.3.3's
|
|
41
41
|
// `button[data-type="filled"]` rule (fallback in styles.module.css → .isFilled)
|
|
42
|
-
|
|
42
|
+
// ⚪ 'secondary' (0.1.14, P16): the Home "Browse packages" button: --card bg, 1px --border hairline, --text
|
|
43
|
+
export type AbButtonType = 'contained' | 'filled' | 'outlined' | 'text' | 'secondary';
|
|
44
|
+
// 🔷 0.1.14 (P16): 'pill' = the legacy 999px look (default) · 'rounded' = the Home 10px button
|
|
45
|
+
export type AbButtonShape = 'pill' | 'rounded';
|
|
46
|
+
// 📏 0.1.14 (P16): 'md' = 40px (44px under 768px, the touch CTA); undefined keeps the legacy sizing
|
|
47
|
+
export type AbButtonSize = 'md';
|
|
43
48
|
// 🎨 colour roles
|
|
44
49
|
export type AbButtonColor = 'primary' | 'secondary' | 'tertiary' | 'white' | 'black';
|
|
45
50
|
// 🏷️ badge tones (G22): neutral grey or bronze accent
|
package/ab-button/index.tsx
CHANGED
|
@@ -54,11 +54,11 @@ import {
|
|
|
54
54
|
getAbButtonSrReason,
|
|
55
55
|
type AbButtonBadgeTone,
|
|
56
56
|
type AbButtonColor,
|
|
57
|
-
type AbButtonType,
|
|
57
|
+
type AbButtonType, type AbButtonShape, type AbButtonSize,
|
|
58
58
|
} from './helpers';
|
|
59
59
|
|
|
60
60
|
// 📦 re-export the shared types (pre-G22 import paths keep working)
|
|
61
|
-
export type { AbButtonBadgeTone, AbButtonColor, AbButtonType, AbButtonDisabledMode } from './helpers';
|
|
61
|
+
export type { AbButtonBadgeTone, AbButtonColor, AbButtonType, AbButtonDisabledMode, AbButtonShape, AbButtonSize } from './helpers';
|
|
62
62
|
|
|
63
63
|
// ⚙️ props
|
|
64
64
|
export interface AbButtonProps {
|
|
@@ -71,6 +71,8 @@ export interface AbButtonProps {
|
|
|
71
71
|
style?: CSSProperties; // 🎨
|
|
72
72
|
iconStyle?: CSSProperties; // 🎨 Material icon style
|
|
73
73
|
rounded?: boolean; // 💊
|
|
74
|
+
shape?: AbButtonShape; // 🔷 0.1.14 (P16): 'rounded' = Home 10px radius (overrides `rounded`)
|
|
75
|
+
size?: AbButtonSize; // 📏 0.1.14 (P16): 'md' = 40px / 44px on touch widths
|
|
74
76
|
raised?: boolean; // 🏔️
|
|
75
77
|
shrinks?: boolean; // 🤏
|
|
76
78
|
expands?: boolean; // 🔍
|
|
@@ -117,6 +119,8 @@ const AbButton = forwardRef<HTMLButtonElement | HTMLAnchorElement, AbButtonProps
|
|
|
117
119
|
style, // 🎨
|
|
118
120
|
iconStyle, // 🎨
|
|
119
121
|
rounded = true, // 💊
|
|
122
|
+
shape, // 🔷
|
|
123
|
+
size, // 📏
|
|
120
124
|
raised = false, // 🏔️
|
|
121
125
|
shrinks = false, // 🤏
|
|
122
126
|
expands = false, // 🔍
|
|
@@ -167,6 +171,8 @@ const AbButton = forwardRef<HTMLButtonElement | HTMLAnchorElement, AbButtonProps
|
|
|
167
171
|
'data-iconpos': iconPosition, // ↔️
|
|
168
172
|
'data-color': color, // 🎨
|
|
169
173
|
'data-disabled-mode': mode, // 🚦
|
|
174
|
+
'data-shape': shape, // 🔷 P16 (omitted when undefined)
|
|
175
|
+
'data-size': size, // 📏 P16
|
|
170
176
|
};
|
|
171
177
|
|
|
172
178
|
// 🔣 legacy Material icon (decorative)
|