ab-nextjs-components 0.3.0 โ 0.3.2
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/README.md +14 -0
- package/ab-button/index.tsx +11 -4
- package/ab-card/index.tsx +11 -3
- package/ab-card/styles.module.css +20 -0
- package/ab-chip/index.tsx +9 -2
- package/ab-chip/styles.module.css +9 -0
- package/ab-drawer/kit.module.css +3 -1
- package/ab-error-hero/index.tsx +99 -0
- package/ab-error-hero/styles.module.css +86 -0
- package/ab-icon/builtin.ts +3 -1
- package/ab-mobile-header/index.tsx +13 -6
- package/ab-navbar/styles.module.css +3 -0
- package/ab-search-trigger/index.tsx +5 -4
- package/ab-search-trigger/styles.module.css +20 -1
- package/ab-theme-mode/index.tsx +8 -0
- package/ab-theme-toggle/index.tsx +9 -6
- package/ab-theme-toggle/styles.module.css +25 -1
- package/ab-toc/index.tsx +30 -2
- package/ab-toc/promo.tsx +17 -7
- package/ab-toc/styles.module.css +16 -0
- package/index.ts +6 -1
- package/package.json +6 -4
- package/server/ab-button/index.tsx +4 -1
- package/types/index.d.ts +4 -1
package/README.md
CHANGED
|
@@ -96,6 +96,20 @@ New subpaths for the docs / PWA shell. All links go through **`AbLinkProvider`**
|
|
|
96
96
|
registerAbIcons({ code })
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
+
### 404 gaps (unreleased) ๐ง
|
|
100
|
+
|
|
101
|
+
* **`<AbErrorHero>`** (`ab-nextjs-components/ab-error-hero`, also in the barrel): the 404 / error hero from the 404 mocks. A big gradient `code` (default `"404"`) over a faded dot grid, a tilted `badge` tile (default `<AbIcon name="link_off" />`, needs ab-nextjs-icons ^0.2.6 and `registerAbIcons({ link_off })`; pass `badge={null}` to hide it), the `title` (h1, the code is read once), `message`, an optional `hint` row and an `actions` slot. Server-safe, no motion.
|
|
102
|
+
```tsx
|
|
103
|
+
<AbErrorHero badge={<AbIcon name="link_off" />} title="Page not found" message="This page moved or never existed."
|
|
104
|
+
hint={<AbChip mono>/docs/packages/button</AbChip>}
|
|
105
|
+
actions={<><AbSearchTrigger size="lg" onOpen={open} /><AbButton type="filled" label="Back to home" href="/" /></>} />
|
|
106
|
+
```
|
|
107
|
+
* **`<AbButton href>`** now renders through `AbLinkProvider`'s link (client and server twins), so links get the locale prefix.
|
|
108
|
+
* **`<AbCard>`**: `iconTile` (a leading icon in a tinted square), `arrow` (a decorative trailing arrow) and `boldTitle`.
|
|
109
|
+
* **`<AbSearchTrigger size="lg">`**: the 44px, up-to-440px search field of the 404 page.
|
|
110
|
+
* **`<AbToc variant="links">`**: a plain link list ("Popular pages"); items take `href`, `description` and `icon`, and links go through `AbLinkProvider`.
|
|
111
|
+
* **`<AbChip overflow>`**: `'ellipsis'` (default, adds the full text as `title`) or `'wrap'`.
|
|
112
|
+
|
|
99
113
|
### Home fidelity (0.1.14, unreleased) ๐
|
|
100
114
|
|
|
101
115
|
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.
|
package/ab-button/index.tsx
CHANGED
|
@@ -43,7 +43,9 @@
|
|
|
43
43
|
|
|
44
44
|
// โ๏ธ React types + forwardRef
|
|
45
45
|
import type { CSSProperties, KeyboardEvent, MouseEvent, ReactNode, Ref } from 'react';
|
|
46
|
-
import { forwardRef } from 'react';
|
|
46
|
+
import { createElement, forwardRef } from 'react';
|
|
47
|
+
// ๐ 404 gaps: the link in effect (AbLinkProvider's, e.g. the i18n Link, or next/link) โ locale prefix โ
|
|
48
|
+
import { useAbLink } from '../ab-link';
|
|
47
49
|
// ๐งต class joiner
|
|
48
50
|
import clsx from 'clsx';
|
|
49
51
|
// ๐จ styles
|
|
@@ -148,6 +150,8 @@ const AbButton = forwardRef<HTMLButtonElement | HTMLAnchorElement, AbButtonProps
|
|
|
148
150
|
const srReason = getAbButtonSrReason({ disabled, isLoading, disabledReason });
|
|
149
151
|
// ๐ซ any kind of blocked?
|
|
150
152
|
const blocked = mode !== 'none';
|
|
153
|
+
// ๐ 404 gaps: link mode goes through AbLinkProvider (hooks run unconditionally, rules-of-hooks โ
)
|
|
154
|
+
const Link = useAbLink();
|
|
151
155
|
|
|
152
156
|
// ๐ท๏ธ classes: pointer-events:none only for native mode (aria mode must stay focusable/hoverable)
|
|
153
157
|
const classNames = clsx(
|
|
@@ -230,9 +234,12 @@ const AbButton = forwardRef<HTMLButtonElement | HTMLAnchorElement, AbButtonProps
|
|
|
230
234
|
}
|
|
231
235
|
// โ
live link (no role=button: it navigates, so it is a link)
|
|
232
236
|
return (
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
237
|
+
// ๐ 404 gaps: the provided Link (locale-aware) instead of a bare <a>, so `/docs` โ `/fr/docs` ๐
|
|
238
|
+
createElement(
|
|
239
|
+
Link, // ๐ AbLinkProvider's component (default next/link)
|
|
240
|
+
{ ref: ref as Ref<HTMLAnchorElement>, id, href, className: classNames, style, hidden, onClick: guardClick, ...dataAttrs }, // ๐งพ same attrs as before
|
|
241
|
+
content, // ๐งฑ label, icons, badge
|
|
242
|
+
)
|
|
236
243
|
);
|
|
237
244
|
}
|
|
238
245
|
|
package/ab-card/index.tsx
CHANGED
|
@@ -45,6 +45,8 @@ import type { ComponentType, ReactElement, ReactNode } from 'react';
|
|
|
45
45
|
import clsx from 'clsx';
|
|
46
46
|
// ๐ G42 link
|
|
47
47
|
import Link from '../ab-link';
|
|
48
|
+
// ๐ฃ 404 gaps: the trailing arrow glyph
|
|
49
|
+
import AbIcon from '../ab-icon';
|
|
48
50
|
// ๐ฌ hover colours + transform timing from the package (reduced motion โ no transition)
|
|
49
51
|
import 'ab-nextjs-animations/motion/styles.css';
|
|
50
52
|
// ๐จ styles
|
|
@@ -62,20 +64,26 @@ export interface AbCardProps {
|
|
|
62
64
|
className?: string; // ๐ท๏ธ
|
|
63
65
|
as?: 'article' | 'div' | 'li'; // ๐งฑ default article
|
|
64
66
|
id?: string; // ๐ 0.1.13: e.g. an in-page anchor target
|
|
67
|
+
// ===== 404 gaps (additive) =====
|
|
68
|
+
iconTile?: ReactNode; // ๐ซ NEW: a leading icon in a tinted square (e.g. <AbIcon name="rocket_launch" />)
|
|
69
|
+
arrow?: boolean; // โก๏ธ NEW: a decorative trailing arrow, top-right (the 404 "Suggested" cards)
|
|
70
|
+
boldTitle?: boolean; // ๐
ฑ๏ธ NEW: a bolder (700) title
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
/**
|
|
68
74
|
* ๐ AbCard (G45): ONE link (the title) stretched over the card, so screen readers hear one link, not a
|
|
69
75
|
* nested block of them. Hover lift is 2px, laptop and up only, and none under prefers-reduced-motion.
|
|
70
76
|
*/
|
|
71
|
-
const AbCard = ({ title, href, description, eyebrow, media, footer, headingLevel = 3, className, as = 'article', id }: AbCardProps): ReactElement => {
|
|
77
|
+
const AbCard = ({ title, href, description, eyebrow, media, footer, headingLevel = 3, className, as = 'article', id, iconTile, arrow = false, boldTitle = false }: AbCardProps): ReactElement => {
|
|
72
78
|
const H = `h${headingLevel}` as unknown as ComponentType<{ className?: string; children?: ReactNode }>; // โฟ
|
|
73
79
|
const Root = as as unknown as ComponentType<Record<string, unknown>>; // ๐งฑ
|
|
74
80
|
return (
|
|
75
|
-
<Root id={id} className={clsx('AbCard', styles.abCard, 'ab-motion-interactive', className)} data-ab-part="card" data-linked={href ? 'true' : 'false'}>
|
|
81
|
+
<Root id={id} className={clsx('AbCard', styles.abCard, 'ab-motion-interactive', className)} data-ab-part="card" data-linked={href ? 'true' : 'false'} data-arrow={arrow ? 'true' : undefined /* โก๏ธ room for the arrow */}>
|
|
82
|
+
{iconTile && <span className={styles.abCardIconTile} data-ab-part="icon-tile" aria-hidden="true">{iconTile}</span> /* ๐ซ decorative tile */}
|
|
83
|
+
{arrow && <AbIcon name="arrow_forward" size={17} className={styles.abCardArrow} /> /* โก๏ธ decorative (AbIcon is aria-hidden) */}
|
|
76
84
|
{media && <div className={styles.abCardMedia} aria-hidden="true">{media}</div>}
|
|
77
85
|
{eyebrow && <p className={styles.abCardEyebrow}>{eyebrow}</p>}
|
|
78
|
-
<H className={styles.abCardTitle}>
|
|
86
|
+
<H className={clsx(styles.abCardTitle, boldTitle && styles.abCardTitleBold /* ๐
ฑ๏ธ */)}>
|
|
79
87
|
{href ? <Link href={href} className={styles.abCardLink}>{title}</Link> : title}
|
|
80
88
|
</H>
|
|
81
89
|
{description && <p className={styles.abCardDescription}>{description}</p>}
|
|
@@ -66,3 +66,23 @@
|
|
|
66
66
|
@media (min-width: 1024px) and (hover: hover) and (prefers-reduced-motion: no-preference) {
|
|
67
67
|
.abCard[data-linked='true']:hover { transform: translateY(-2px); } /* ๐ */
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
/* ===== 404 gaps (additive) ===== */
|
|
71
|
+
/* ๐ซ leading icon tile: icon in a tinted square (mock .pkg-ic) */
|
|
72
|
+
.abCardIconTile {
|
|
73
|
+
display: inline-flex; /* ๐ */
|
|
74
|
+
align-items: center; /* โ๏ธ */
|
|
75
|
+
justify-content: center; /* โ๏ธ */
|
|
76
|
+
width: 34px; /* ๐ */
|
|
77
|
+
height: 34px; /* ๐ */
|
|
78
|
+
border-radius: 9px; /* ๐ท */
|
|
79
|
+
background: var(--ab-color-tint, rgb(166 124 82 / 0.14)); /* ๐จ tint (mock .pkg-ic) */
|
|
80
|
+
color: var(--ab-color-accent-text, var(--ab-color-primary, inherit)); /* ๐๏ธ accent glyph */
|
|
81
|
+
flex: none; /* ๐ซ no shrink */
|
|
82
|
+
}
|
|
83
|
+
/* โก๏ธ trailing arrow, top-right (mock .sg-go) */
|
|
84
|
+
.abCardArrow { position: absolute; top: 14px; right: 12px; color: var(--ab-color-on-surface-variant, inherit); opacity: 0.7; } /* โก๏ธ */
|
|
85
|
+
.abCard[data-arrow='true'] .abCardTitle, .abCard[data-arrow='true'] .abCardDescription { padding-right: 22px; } /* ๐งฑ keep text off the arrow */
|
|
86
|
+
/* ๐
ฑ๏ธ bold title */
|
|
87
|
+
.abCardTitleBold { font-weight: 700; } /* ๐
ฑ๏ธ */
|
|
88
|
+
|
package/ab-chip/index.tsx
CHANGED
|
@@ -63,11 +63,16 @@ export interface AbChipProps {
|
|
|
63
63
|
shape?: 'pill' | 'rounded'; // ๐ท 0.1.14: 'rounded' = 6px radius (default pill)
|
|
64
64
|
mono?: boolean; // โจ๏ธ 0.1.14: Roboto Mono 11/600 (versions, package names)
|
|
65
65
|
tone?: AbChipTone; // ๐จ 0.1.14 (default 'neutral' = the legacy outline chip)
|
|
66
|
+
// ===== 404 gaps: long text =====
|
|
67
|
+
overflow?: 'ellipsis' | 'wrap'; // โ๏ธ NEW: 'ellipsis' (default) clips to the parent width with "โฆ"; 'wrap' breaks onto lines
|
|
68
|
+
title?: string; // ๐ฌ NEW: tooltip; defaults to the text itself when `children` is a string (so clipped text stays readable)
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
/** ๐ท๏ธ Static chip: plain text, never interactive (use AbButton for actions). */
|
|
69
|
-
export function AbChip({ children, dot, icon, as: Tag = 'span', className, style, size = 'md', shape = 'pill', mono = false, tone = 'neutral' }: AbChipProps): ReactElement {
|
|
72
|
+
export function AbChip({ children, dot, icon, as: Tag = 'span', className, style, size = 'md', shape = 'pill', mono = false, tone = 'neutral', overflow = 'ellipsis', title }: AbChipProps): ReactElement {
|
|
70
73
|
const dotTone = dot === true ? 'bronze' : dot || undefined; // ๐จ resolve dot colour
|
|
74
|
+
// ๐ฌ 404 gaps: full text as a tooltip while ellipsing (only when we know it: a plain string/number child)
|
|
75
|
+
const tip = title ?? (overflow === 'ellipsis' && (typeof children === 'string' || typeof children === 'number') ? String(children) : undefined);
|
|
71
76
|
return (
|
|
72
77
|
<Tag
|
|
73
78
|
className={clsx('AbChip', styles.chip, mono && styles.mono, className)} style={style} data-ab-part="chip"
|
|
@@ -75,10 +80,12 @@ export function AbChip({ children, dot, icon, as: Tag = 'span', className, style
|
|
|
75
80
|
data-shape={shape === 'rounded' ? 'rounded' : undefined} // ๐ท
|
|
76
81
|
data-tone={tone === 'neutral' ? undefined : tone} // ๐จ
|
|
77
82
|
data-mono={mono ? 'true' : undefined} // โจ๏ธ
|
|
83
|
+
data-overflow={overflow} // โ๏ธ 404 gaps: ellipsis | wrap
|
|
84
|
+
title={tip} // ๐ฌ 404 gaps: the full text on hover
|
|
78
85
|
>
|
|
79
86
|
{dotTone ? <span className={styles.dot} data-tone={dotTone} aria-hidden="true" /> : null /* ๐ข decorative */}
|
|
80
87
|
{icon ? <span className={styles.icon} aria-hidden="true">{icon}</span> : null /* ๐ผ๏ธ decorative */}
|
|
81
|
-
<span>{children}</span>
|
|
88
|
+
<span className={styles.text}>{children}</span>{/* โ๏ธ 404 gaps: the part that ellipses / wraps */}
|
|
82
89
|
</Tag>
|
|
83
90
|
);
|
|
84
91
|
}
|
|
@@ -96,3 +96,12 @@
|
|
|
96
96
|
.chip[data-mono='true'] { font-family: var(--ab-font-code, 'Roboto Mono', ui-monospace, monospace); } /* โจ๏ธ */
|
|
97
97
|
.chip[data-tone='accent'] { background: var(--ab-color-tint, #f4e7db); color: var(--ab-color-accent-text, #88603d); border-color: transparent; } /* ๐ฅ */
|
|
98
98
|
.chip[data-tone='sage'] { background: rgb(119 141 121 / 0.12); color: var(--ab-color-sage-accent, #566a58); border-color: transparent; } /* ๐ฟ beta โฟ AA (John): fallback = theme 0.3.5 light value */
|
|
99
|
+
|
|
100
|
+
/* ===== โ๏ธ 404 gaps: long text (overflow="ellipsis" default ยท "wrap") ===== */
|
|
101
|
+
.chip { max-width: 100%; box-sizing: border-box; } /* ๐ never wider than the parent */
|
|
102
|
+
.text { min-width: 0; } /* ๐ lets the flex child shrink */
|
|
103
|
+
.chip[data-overflow='ellipsis'] .text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* โ๏ธ "โฆ" */
|
|
104
|
+
.chip[data-overflow='wrap'] { white-space: normal; } /* โฉ๏ธ */
|
|
105
|
+
.chip[data-overflow='wrap'] .text { overflow-wrap: anywhere; } /* โฉ๏ธ long paths like /docs/packages/button break too */
|
|
106
|
+
.chip[data-overflow='wrap'][data-size='sm'] { height: auto; min-height: var(--ab-chip-height, 20px); padding-block: 3px; line-height: 1.3; } /* ๐ grow with lines */
|
|
107
|
+
|
package/ab-drawer/kit.module.css
CHANGED
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
|
|
119
119
|
/* โฌ
๏ธ the nav drawer: logo header, the version chip, a scrolling nav (44px rows, 15px) with a 72px fade, a pinned footer */
|
|
120
120
|
.logoRow { display: flex; align-items: center; min-inline-size: 0; }
|
|
121
|
-
.logoRow a { display: flex; align-items: center; color: inherit; }
|
|
121
|
+
.logoRow a { display: flex; align-items: center; color: inherit; min-block-size: 44px; } /* ๐ 0.3.2 (God, 0.2.23 gaps): the logo link is a 44px-tall tap target (was 25px); the glyph keeps its size */
|
|
122
122
|
.ver { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; block-size: 32px; padding: 0 8px 0 10px; margin: 0 0 8px 8px; box-sizing: border-box; border-radius: 8px; border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); background: var(--ab-dr-card); color: var(--ab-color-muted, #6b5b50); font: 500 13px/1 var(--ab-font-body, 'Inter', inherit); }
|
|
123
123
|
.ver b { font-family: var(--ab-font-mono, 'Roboto Mono', monospace); color: var(--ab-color-accent-text, #8b6340); font-weight: 600; }
|
|
124
124
|
.ver > svg { inline-size: 18px; block-size: 18px; }
|
|
@@ -197,6 +197,8 @@
|
|
|
197
197
|
buttons keep their hit area and the end inset stays 4px so the last one lines up with the 44px grid */
|
|
198
198
|
/* ๐งฉ 0.2.3 no-JS language list: <details> around the globe; the list drops below it, end-aligned */
|
|
199
199
|
.langDetails { position: relative; flex: none; } /* ๐ anchor */
|
|
200
|
+
/* ๐ 0.3.2 (Joseph): AbMobileHeader `search` slot, before the theme button; never shrinks, 4px from its neighbours */
|
|
201
|
+
.mhSearch { flex: none; display: inline-flex; align-items: center; margin-inline: 4px; } /* ๐ */
|
|
200
202
|
.langDetails > summary { list-style: none; } /* ๐ no disclosure triangle */
|
|
201
203
|
.langDetails > summary::-webkit-details-marker { display: none; } /* ๐ Safari */
|
|
202
204
|
.langList { position: absolute; inset-inline-end: 0; inset-block-start: 100%; z-index: 30; margin: 4px 0 0; padding: 6px; min-inline-size: 180px; list-style: none; background: var(--ab-color-card, #fff); border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); border-radius: 12px; box-shadow: 0 8px 24px rgb(25 18 12 / 0.12); } /* ๐ */
|
|
@@ -0,0 +1,99 @@
|
|
|
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: AbErrorHero - Server-safe (404 gaps)
|
|
28
|
+
* @file: ab-error-hero/index.tsx
|
|
29
|
+
* @type: Component (server-safe, no hooks) โ the 404 / error hero: big code + badge tile, title, message, hint, actions
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* 1+|> <AbErrorHero code="404" badge={<AbIcon name="link_off" />} title="Page not found" message="This page moved or never existed." actions={<AbButton label="Back to home" href="/" />} />
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
38
|
+
* MOTTO: We'll always do more ๐!!!
|
|
39
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
// โ๏ธ React types
|
|
43
|
+
import type { ComponentType, ReactElement, ReactNode } from 'react';
|
|
44
|
+
// ๐งต classes
|
|
45
|
+
import clsx from 'clsx';
|
|
46
|
+
// ๐ฃ the default badge glyph (link_off, ab-nextjs-icons ^0.2.6, as in the mock)
|
|
47
|
+
import AbIcon from '../ab-icon';
|
|
48
|
+
// ๐จ styles (static only: NO motion here, all motion lives in ab-nextjs-animations)
|
|
49
|
+
import styles from './styles.module.css';
|
|
50
|
+
|
|
51
|
+
/** โ๏ธ props */
|
|
52
|
+
export interface AbErrorHeroProps {
|
|
53
|
+
code?: ReactNode; // ๐ข the big number / word, e.g. "404" (default), "500", "Oops"
|
|
54
|
+
badge?: ReactNode; // ๐ซ a small tilted tile pinned to the code, default <AbIcon name="link_off" /> (the mock); pass null to hide (decorative)
|
|
55
|
+
title: ReactNode; // ๐ท๏ธ the h1, e.g. "Page not found"
|
|
56
|
+
message?: ReactNode; // ๐ the lede under the title
|
|
57
|
+
hint?: ReactNode; // ๐ก an optional row under the message, e.g. the bad path + "Did you mean โฆ" (an AbChip)
|
|
58
|
+
actions?: ReactNode; // ๐ the actions slot: search trigger, buttons, โฆ (rendered as-is, in order)
|
|
59
|
+
children?: ReactNode; // ๐งฉ anything below the actions (e.g. "Suggested" cards)
|
|
60
|
+
headingLevel?: 1 | 2; // โฟ default 1 (it IS the page title on a 404); 2 when nested in a page
|
|
61
|
+
grid?: boolean; // โ ฟ the dotted backdrop behind the code (default true)
|
|
62
|
+
id?: string; // ๐ root id
|
|
63
|
+
className?: string; // ๐ท๏ธ
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* ๐ง AbErrorHero: the hero of a 404 / error page (mock ai-mocks/404): a huge gradient code ("404") over a
|
|
68
|
+
* faded dot grid, a tilted badge tile (e.g. link_off), a title, a message, an optional hint and an actions slot.
|
|
69
|
+
* The code is decorative (aria-hidden) and announced once via a visually hidden prefix on the title.
|
|
70
|
+
* No hooks, no state, no motion: renders on the server.
|
|
71
|
+
*/
|
|
72
|
+
const AbErrorHero = ({ code = '404', badge = <AbIcon name="link_off" /> /* ๐๐ซ mock default */, title, message, hint, actions, children, headingLevel = 1, grid = true, id, className }: AbErrorHeroProps): ReactElement => {
|
|
73
|
+
const H = `h${headingLevel}` as unknown as ComponentType<{ className?: string; children?: ReactNode }>; // โฟ h1 / h2
|
|
74
|
+
return (
|
|
75
|
+
<section id={id} className={clsx('AbErrorHero', styles.abErrorHero, className)} data-ab-part="error-hero">
|
|
76
|
+
{/* ๐จ the art: dot grid + big code + badge tile (all decorative) */}
|
|
77
|
+
<div className={styles.abErrorHeroArt} aria-hidden="true">
|
|
78
|
+
{grid && <span className={styles.abErrorHeroGrid} data-ab-part="error-grid" /> /* โ ฟ faded dots */}
|
|
79
|
+
<span className={styles.abErrorHeroCode} data-ab-part="error-code">
|
|
80
|
+
{code /* ๐ข gradient text */}
|
|
81
|
+
{badge != null && <span className={styles.abErrorHeroBadge} data-ab-part="error-badge">{badge}</span> /* ๐ซ tilted tile */}
|
|
82
|
+
</span>
|
|
83
|
+
</div>
|
|
84
|
+
{/* ๐ท๏ธ title: the code is read once here (visually hidden), then the words */}
|
|
85
|
+
<H className={styles.abErrorHeroTitle}>
|
|
86
|
+
{typeof code === 'string' || typeof code === 'number' ? <span className={styles.abErrorHeroSrOnly}>{code}: </span> : null /* ๐ฃ๏ธ "404: Page not found" */}
|
|
87
|
+
{title}
|
|
88
|
+
</H>
|
|
89
|
+
{message != null && <p className={styles.abErrorHeroMessage}>{message}</p> /* ๐ lede */}
|
|
90
|
+
{hint != null && <div className={styles.abErrorHeroHint} data-ab-part="error-hint">{hint}</div> /* ๐ก */}
|
|
91
|
+
{actions != null && <div className={styles.abErrorHeroActions} data-ab-part="error-actions">{actions}</div> /* ๐ */}
|
|
92
|
+
{children /* ๐งฉ */}
|
|
93
|
+
</section>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// ๐ฆ exports
|
|
98
|
+
export default AbErrorHero;
|
|
99
|
+
export { AbErrorHero };
|
|
@@ -0,0 +1,86 @@
|
|
|
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: AbErrorHero - Styles (404 gaps)
|
|
28
|
+
* @file: ab-error-hero/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
|
+
/* ๐ง hero column (mock .e404) โ static layout only, no transitions/animations (motion = ab-nextjs-animations) */
|
|
40
|
+
.abErrorHero { display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; } /* ๐ */
|
|
41
|
+
/* ๐จ the art box (mock .e-art: 520ร190, mobile 100%ร132) */
|
|
42
|
+
.abErrorHeroArt { position: relative; width: min(520px, 100%); height: 190px; display: flex; align-items: center; justify-content: center; } /* ๐ฆ */
|
|
43
|
+
/* โ ฟ dot grid, faded at the edges (mock .e-grid) */
|
|
44
|
+
.abErrorHeroGrid {
|
|
45
|
+
position: absolute; inset: -10px -40px; pointer-events: none; /* ๐ behind the code */
|
|
46
|
+
background-image: radial-gradient(circle, color-mix(in srgb, var(--ab-color-accent, #a67c52) 32%, transparent) 1.1px, transparent 1.4px); /* โ ฟ */
|
|
47
|
+
background-size: 18px 18px; /* ๐ grid step */
|
|
48
|
+
mask-image: radial-gradient(ellipse at center, #000 18%, transparent 68%); /* ๐ซ๏ธ fade out */
|
|
49
|
+
}
|
|
50
|
+
/* ๐ข the big gradient code (mock .e-num) */
|
|
51
|
+
.abErrorHeroCode {
|
|
52
|
+
position: relative; display: inline-flex; /* ๐ badge anchor */
|
|
53
|
+
font-size: 176px; line-height: 1; font-weight: 820; letter-spacing: -0.06em; /* ๐ค */
|
|
54
|
+
font-family: var(--ab-font-sans, Geist, ui-sans-serif, system-ui, sans-serif); /* ๐ค */
|
|
55
|
+
background: linear-gradient(180deg, var(--ab-color-error-code-top, #b88c60) 0%, var(--ab-color-accent, #a67c52) 55%, var(--ab-color-error-code-bottom, #8b6340) 100%); /* ๐ฅ bronze */
|
|
56
|
+
background-clip: text; color: transparent; /* ๐๏ธ gradient text */
|
|
57
|
+
}
|
|
58
|
+
/* ๐ซ tilted badge tile (mock .e-badge: 46px, radius 14, rotate 8deg โ a static pose, not motion) */
|
|
59
|
+
.abErrorHeroBadge {
|
|
60
|
+
position: absolute; right: 8%; top: 12%; /* ๐ on the last digit */
|
|
61
|
+
width: 46px; height: 46px; border-radius: 14px; box-sizing: border-box; /* ๐ */
|
|
62
|
+
display: flex; align-items: center; justify-content: center; /* ๐ */
|
|
63
|
+
background: var(--ab-color-card, #fff); border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); /* ๐จ */
|
|
64
|
+
color: var(--ab-color-accent-text, #88603d); box-shadow: 0 8px 22px rgb(92 64 48 / 0.16); /* ๐จ ๐ */
|
|
65
|
+
transform: rotate(8deg); /* ๐ static tilt */
|
|
66
|
+
}
|
|
67
|
+
.abErrorHeroBadge svg { width: 24px; height: 24px; } /* ๐ฃ */
|
|
68
|
+
/* ๐ท๏ธ title ยท ๐ message (mock h1 34px / lede 15.5px) */
|
|
69
|
+
.abErrorHeroTitle { margin: 10px 0 0; font-size: 34px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.15; color: var(--ab-color-text, inherit); } /* ๐ท๏ธ */
|
|
70
|
+
.abErrorHeroMessage { margin: 10px 0 0; max-width: 460px; font-size: 15.5px; line-height: 1.55; color: var(--ab-color-muted, inherit); } /* ๐ */
|
|
71
|
+
.abErrorHeroHint { margin-top: 14px; max-width: 100%; display: flex; justify-content: center; } /* ๐ก */
|
|
72
|
+
/* ๐ actions: search on its own row, buttons side by side (mock .e-search + .e-ctas) */
|
|
73
|
+
.abErrorHeroActions { margin-top: 22px; width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 10px; } /* ๐ */
|
|
74
|
+
.abErrorHeroActions > .AbSearchTrigger, .abErrorHeroActions > [data-ab-part='search-trigger'] { flex-basis: 100%; max-width: 440px; margin-inline: calc((100% - min(440px, 100%)) / 2); } /* ๐ full row */
|
|
75
|
+
/* ๐ visually hidden */
|
|
76
|
+
.abErrorHeroSrOnly { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; } /* ๐ */
|
|
77
|
+
/* ๐ฑ mobile (mock .M: code 120px, art 132px, badge 38px) */
|
|
78
|
+
@media (max-width: 767px) {
|
|
79
|
+
.abErrorHeroArt { height: 132px; } /* ๐ */
|
|
80
|
+
.abErrorHeroCode { font-size: 120px; } /* ๐ข */
|
|
81
|
+
.abErrorHeroBadge { width: 38px; height: 38px; border-radius: 12px; } /* ๐ซ */
|
|
82
|
+
.abErrorHeroBadge svg { width: 20px; height: 20px; } /* ๐ฃ */
|
|
83
|
+
.abErrorHeroTitle { margin-top: 4px; font-size: 27px; } /* ๐ท๏ธ */
|
|
84
|
+
.abErrorHeroMessage { margin-top: 6px; font-size: 14.5px; } /* ๐ */
|
|
85
|
+
.abErrorHeroActions { margin-top: 16px; } /* ๐ */
|
|
86
|
+
}
|
package/ab-icon/builtin.ts
CHANGED
|
@@ -42,6 +42,7 @@ import arrowForward from 'ab-nextjs-icons/ab-icons/icons/arrow_forward'; // โญ
|
|
|
42
42
|
import lightMode from 'ab-nextjs-icons/ab-icons/icons/light_mode'; // ๐ AbThemeToggle
|
|
43
43
|
import darkMode from 'ab-nextjs-icons/ab-icons/icons/dark_mode'; // ๐ AbThemeToggle
|
|
44
44
|
import computer from 'ab-nextjs-icons/ab-icons/icons/computer'; // ๐ฅ๏ธ AbThemeToggle (system)
|
|
45
|
+
import brightnessAuto from 'ab-nextjs-icons/ab-icons/icons/brightness_auto'; // ๐๐
ฐ๏ธ 0.3.2: system theme (AbThemeToggle, AbMobileHeader, AbSettingsDrawer; icons โฅ 0.2.7)
|
|
45
46
|
import language from 'ab-nextjs-icons/ab-icons/icons/language'; // ๐ AbLocaleSwitcher
|
|
46
47
|
import contentCopy from 'ab-nextjs-icons/ab-icons/icons/content_copy'; // ๐ AbInstallSnippet
|
|
47
48
|
import check from 'ab-nextjs-icons/ab-icons/icons/check'; // โ
AbInstallSnippet (copied)
|
|
@@ -63,7 +64,8 @@ export const AB_ICON_BUILTINS: Record<string, AbIconSvgData> = {
|
|
|
63
64
|
arrow_forward: arrowForward, // โญ๏ธ
|
|
64
65
|
light_mode: lightMode, // ๐
|
|
65
66
|
dark_mode: darkMode, // ๐
|
|
66
|
-
computer, // ๐ฅ๏ธ
|
|
67
|
+
computer, // ๐ฅ๏ธ (kept for apps that still ask for it)
|
|
68
|
+
brightness_auto: brightnessAuto, // ๐๐
ฐ๏ธ 0.3.2: the system theme glyph
|
|
67
69
|
language, // ๐
|
|
68
70
|
content_copy: contentCopy, // ๐
|
|
69
71
|
check, // โ
|
|
@@ -59,14 +59,14 @@ import AbIcon from '../ab-icon';
|
|
|
59
59
|
// ๐จ the drawers v2 kit
|
|
60
60
|
import kit from '../ab-drawer/kit.module.css';
|
|
61
61
|
// ๐ 0.2.3: the shared theme state (AbThemeModeProvider)
|
|
62
|
-
import { useAbThemeModeContext } from '../ab-theme-mode';
|
|
62
|
+
import { useAbThemeModeContext, AB_THEME_MODE_ICONS, AB_THEME_ICON_BUTTON_GLYPH } from '../ab-theme-mode';
|
|
63
63
|
|
|
64
64
|
/** ๐ 0.2.3: the three theme modes (same names as ab-nextjs-hooks' AbThemeMode) */
|
|
65
65
|
export type AbMobileHeaderThemeMode = 'light' | 'dark' | 'system';
|
|
66
66
|
/** ๐ 0.2.3: the 3-state cycle order */
|
|
67
67
|
export const AB_MOBILE_HEADER_THEME_CYCLE: readonly AbMobileHeaderThemeMode[] = ['light', 'dark', 'system'];
|
|
68
|
-
// ๐ฃ the glyph of each mode
|
|
69
|
-
const THEME_ICON: Record<AbMobileHeaderThemeMode, string
|
|
68
|
+
// ๐ฃ the glyph of each mode: 0.3.2 the shared map, the same one AbThemeToggle uses
|
|
69
|
+
const THEME_ICON: Readonly<Record<AbMobileHeaderThemeMode, string>> = AB_THEME_MODE_ICONS;
|
|
70
70
|
|
|
71
71
|
/** ๐ 0.2.3: one entry of the no-JS language list */
|
|
72
72
|
export interface AbMobileHeaderLanguage {
|
|
@@ -87,6 +87,9 @@ export interface AbMobileHeaderProps {
|
|
|
87
87
|
theme?: 'light' | 'dark'; // ๐ the resolved theme now
|
|
88
88
|
onThemeChange?: (next: 'light' | 'dark') => void; // ๐ the toggle (it shows the mode it switches TO: a moon in light)
|
|
89
89
|
actions?: ReactNode; // โ more 44px buttons after the two (none in John's frame)
|
|
90
|
+
// ๐ 0.3.2 (Joseph, 0.2.23 gaps): a search pill (e.g. <AbSearchTrigger size="sm" />) placed after the globe and
|
|
91
|
+
// BEFORE the theme button
|
|
92
|
+
search?: ReactNode;
|
|
90
93
|
labels?: { language?: string; toDark?: string; toLight?: string; toSystem?: string; header?: string }; // ๐ "Change language", "Switch to dark theme", "Switch to light theme", (0.2.3) "Use the system theme", "Main header"
|
|
91
94
|
languageExpanded?: boolean; // โฟ aria-expanded on the globe while its sheet is open
|
|
92
95
|
// ๐ 0.2.3: the 3-state theme (light โ dark โ system โ light). When `onThemeModeChange` is set it replaces the
|
|
@@ -124,7 +127,7 @@ export interface AbMobileHeaderProps {
|
|
|
124
127
|
* no menu button (the left drawer opens with an edge swipe). Put it in AbMainLayout's `mainHeader` with core
|
|
125
128
|
* โฅ 0.2.1 `mobileHeader="main"`: the 56px row, its divider and the hidden app header come from core.
|
|
126
129
|
*/
|
|
127
|
-
const AbMobileHeader = ({ logo, onLanguage, theme = 'light', onThemeChange, themeMode = 'system', onThemeModeChange, actions, row, labels = {}, languageExpanded, languageControls, languageRef, languageHref, languages, size = 'default', barAt = 'auto', className }: AbMobileHeaderProps): ReactElement => {
|
|
130
|
+
const AbMobileHeader = ({ logo, onLanguage, theme = 'light', onThemeChange, themeMode = 'system', onThemeModeChange, actions, search, row, labels = {}, languageExpanded, languageControls, languageRef, languageHref, languages, size = 'default', barAt = 'auto', className }: AbMobileHeaderProps): ReactElement => {
|
|
128
131
|
const L = { language: 'Change language', toDark: 'Switch to dark theme', toLight: 'Switch to light theme', toSystem: 'Use the system theme', header: 'Main header', ...labels }; // ๐
|
|
129
132
|
const name: Record<AbMobileHeaderThemeMode, string> = { light: L.toLight, dark: L.toDark, system: L.toSystem }; // โฟ "switch TO" names
|
|
130
133
|
// ๐ 0.2.3: under an AbThemeModeProvider with no theme props, the button is the 3-state cycle on the SHARED state
|
|
@@ -141,7 +144,7 @@ const AbMobileHeader = ({ logo, onLanguage, theme = 'light', onThemeChange, them
|
|
|
141
144
|
? AB_MOBILE_HEADER_THEME_CYCLE[(Math.max(0, AB_MOBILE_HEADER_THEME_CYCLE.indexOf(mode3)) + 1) % AB_MOBILE_HEADER_THEME_CYCLE.length] // ๐
|
|
142
145
|
: theme === 'dark' ? 'light' : 'dark'; // ๐ the target
|
|
143
146
|
const showTheme = three || !!onThemeChange; // ๐
|
|
144
|
-
// ๐งฑ the 56px bar: logo ยท globe ยท theme ยท actions
|
|
147
|
+
// ๐งฑ the 56px bar: logo ยท globe ยท (0.3.2) search ยท theme ยท actions
|
|
145
148
|
const bar = (
|
|
146
149
|
<>
|
|
147
150
|
<span className={kit.logoRow}>{logo}</span>
|
|
@@ -199,6 +202,10 @@ const AbMobileHeader = ({ logo, onLanguage, theme = 'light', onThemeChange, them
|
|
|
199
202
|
<AbIcon name="language" size={24} />
|
|
200
203
|
</button>
|
|
201
204
|
)}
|
|
205
|
+
{search != null && (
|
|
206
|
+
// ๐ 0.3.2: the search pill slot, right before the theme button
|
|
207
|
+
<span className={kit.mhSearch} data-ab-part="mobile-header-search">{search}</span>
|
|
208
|
+
)}
|
|
202
209
|
{showTheme && (
|
|
203
210
|
<button
|
|
204
211
|
type="button"
|
|
@@ -208,7 +215,7 @@ const AbMobileHeader = ({ logo, onLanguage, theme = 'light', onThemeChange, them
|
|
|
208
215
|
data-ab-part="mobile-header-theme"
|
|
209
216
|
data-theme-mode={three ? mode3 : undefined} // ๐งช 0.2.3: the current mode (3-state only)
|
|
210
217
|
>
|
|
211
|
-
<AbIcon name={THEME_ICON[next]} size={
|
|
218
|
+
<AbIcon name={THEME_ICON[next]} size={AB_THEME_ICON_BUTTON_GLYPH} />
|
|
212
219
|
</button>
|
|
213
220
|
)}
|
|
214
221
|
{actions}
|
|
@@ -59,6 +59,9 @@
|
|
|
59
59
|
align-items: center; /* โ๏ธ */
|
|
60
60
|
gap: 4px; /* โ๏ธ */
|
|
61
61
|
min-width: 64px; /* ๐ */
|
|
62
|
+
min-height: 44px; /* ๐ 0.3.2 (God, 0.2.23 gaps): a 44px tap target (WCAG 2.5.5), was ~42px with indicator="none" */
|
|
63
|
+
justify-content: center; /* ๐ฏ 0.3.2: the pill + label stay centred in the taller target */
|
|
64
|
+
box-sizing: border-box; /* ๐ฆ 0.3.2: the 44px counts the padding */
|
|
62
65
|
border: 0; /* ๐ซ (buttons) */
|
|
63
66
|
background: none; /* ๐ซ */
|
|
64
67
|
font: inherit; /* ๐ค */
|
|
@@ -67,7 +67,8 @@ export interface AbSearchTriggerProps {
|
|
|
67
67
|
/** ๐ฑ 0.1.15 (God 00:08): a shorter label (e.g. "Search") that a compact AbAppBar shows below 768px instead of `label`
|
|
68
68
|
* (CSS picks; only one is ever displayed, so the accessible name stays single). Home field only. */
|
|
69
69
|
compactLabel?: string;
|
|
70
|
-
size?: 'md' | 'sm'; // ๐ฑ 0.1.14 (P6): 'sm' = the mobile 34px "Search โK" pill (label + key cap stay visible)
|
|
70
|
+
size?: 'md' | 'sm' | 'lg'; // ๐ฑ 0.1.14 (P6): 'sm' = the mobile 34px "Search โK" pill (label + key cap stay visible)
|
|
71
|
+
// ๐ 404 gaps: 'lg' = the 404 page's big 44px field (440px wide, full width on mobile; Home field look)
|
|
71
72
|
className?: string; // ๐ท๏ธ
|
|
72
73
|
}
|
|
73
74
|
|
|
@@ -107,13 +108,13 @@ const AbSearchTrigger = ({ label = 'Search', onOpen, href, hotkey, shortcut, com
|
|
|
107
108
|
}, [listen, onOpen]);
|
|
108
109
|
|
|
109
110
|
// ๐ P6: the Home looks (field / sm pill) show ONE key cap ("โ K" / "โK") and keep "coming soon" out of the field
|
|
110
|
-
const home = variant === 'field' || size === 'sm';
|
|
111
|
+
const home = variant === 'field' || size === 'sm' || size === 'lg'; // ๐ 404 gaps: lg is a (bigger) Home field
|
|
111
112
|
// โจ๏ธ mock: "โ K" (field) ยท "โK" (sm). The gap is its own span so a compact app bar can drop it (0.1.15)
|
|
112
113
|
const keyCap = <>{apple ? 'โ' : 'Ctrl'}{size === 'sm' ? null : <span data-ab-part="key-gap"> </span>}K</>;
|
|
113
114
|
// ๐งฉ inner content
|
|
114
115
|
const inner = home ? (
|
|
115
116
|
<>
|
|
116
|
-
<AbIcon name="search" size={size === 'sm' ? 17 : 18} className={styles.abSearchTriggerIcon} />
|
|
117
|
+
<AbIcon name="search" size={size === 'sm' ? 17 : size === 'lg' ? 20 : 18 /* ๐ lg: 20px glyph (mock) */} className={styles.abSearchTriggerIcon} />
|
|
117
118
|
<span className={styles.abSearchTriggerLabel} data-ab-part="search-label">{label}</span>
|
|
118
119
|
{compactLabel != null && <span className={clsx(styles.abSearchTriggerLabel, styles.abSearchTriggerShort)} data-ab-part="search-label-compact">{compactLabel}</span> /* ๐ฑ 0.1.15 */}
|
|
119
120
|
{/* ๐ง coming soon: tooltip + announced, never painted inside the field (spec ยง4) */}
|
|
@@ -135,7 +136,7 @@ const AbSearchTrigger = ({ label = 'Search', onOpen, href, hotkey, shortcut, com
|
|
|
135
136
|
'aria-keyshortcuts': listen ? 'Meta+K Control+K' : undefined, // โฟ only announced when bound (James #3)
|
|
136
137
|
'data-compact': compact ? 'true' : undefined, // ๐ฑ
|
|
137
138
|
'data-variant': variant === 'field' ? 'field' : undefined, // ๐ P6
|
|
138
|
-
'data-size': size === 'sm'
|
|
139
|
+
'data-size': size === 'sm' || size === 'lg' ? size : undefined, // ๐ฑ P6 ยท ๐ 404 gaps: lg
|
|
139
140
|
title: home && comingSoon ? comingSoonLabel : undefined, // ๐ฌ P6: "coming soon" lives in the tooltip
|
|
140
141
|
};
|
|
141
142
|
|
|
@@ -78,11 +78,15 @@
|
|
|
78
78
|
font-size: 13.5px; line-height: 1; box-shadow: var(--ab-shadow-card, 0 1px 2px rgb(33 26 22 / 0.05)); /* ๐ค ๐ */
|
|
79
79
|
}
|
|
80
80
|
.abSearchTrigger[data-size='sm'] {
|
|
81
|
-
flex: none; width: auto; max-width: none; height: 34px; /* ๐ */
|
|
81
|
+
flex: none; width: auto; max-width: none; height: 34px; /* ๐ the pill still LOOKS 34px (mock) */
|
|
82
|
+
position: relative; /* ๐ 0.3.2: anchors the invisible hit area below */
|
|
82
83
|
gap: 6px; padding: 0 6px 0 10px; /* ๐ฆ */
|
|
83
84
|
border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); border-radius: var(--ab-radius-pill, 999px); /* ๐ */
|
|
84
85
|
background: var(--ab-color-card, #fff); color: var(--ab-color-faint, #807062); font-size: 13px; line-height: 1; /* ๐จ ๐ค */
|
|
85
86
|
}
|
|
87
|
+
/* ๐ 0.3.2 (God, 0.2.23 gaps): an invisible 44px-tall hit area around the 34px pill (5px above + below), so the
|
|
88
|
+
tap target is โฅ 44px (WCAG 2.5.5) without changing the look */
|
|
89
|
+
.abSearchTrigger[data-size='sm']::after { content: ''; position: absolute; inset: -5px 0; } /* ๐ซฅ hit area */
|
|
86
90
|
.abSearchTrigger[data-variant='field']:hover, .abSearchTrigger[data-size='sm']:hover { border-color: color-mix(in srgb, var(--ab-color-accent, #a67c52) 40%, transparent); } /* ๐ฑ๏ธ */
|
|
87
91
|
.abSearchTrigger[data-variant='field']:focus-visible, .abSearchTrigger[data-size='sm']:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; } /* โฟ */
|
|
88
92
|
/* โจ๏ธ the single key cap (mock `kbd`): 20px, radius 5, 2px bottom border, 11/600 --muted */
|
|
@@ -97,3 +101,18 @@
|
|
|
97
101
|
|
|
98
102
|
/* ๐ฑ 0.1.15: the short label is hidden unless a compact AbAppBar (< 768px) swaps it in */
|
|
99
103
|
.abSearchTriggerShort { display: none; }
|
|
104
|
+
|
|
105
|
+
/* ===== ๐ 404 gaps: size="lg" (mock .e-search: 440ร44, radius 12, 14.5px) ===== */
|
|
106
|
+
.abSearchTrigger[data-size='lg'] {
|
|
107
|
+
display: inline-flex; align-items: center; gap: 8px; /* ๐ */
|
|
108
|
+
width: min(440px, 100%); height: 44px; padding: 0 8px 0 14px; /* ๐ full width on narrow screens */
|
|
109
|
+
border: 1px solid var(--ab-color-border, #e8dcd2); border-radius: 12px; /* ๐ท */
|
|
110
|
+
background: var(--ab-color-card, #fff); color: var(--ab-color-faint, #807062); /* ๐จ */
|
|
111
|
+
font-size: 14.5px; line-height: 1; box-shadow: var(--ab-shadow-card, 0 1px 2px rgb(33 26 22 / 0.05)); /* ๐ค ๐ */
|
|
112
|
+
text-decoration: none; box-sizing: border-box; /* ๐ ๐ฆ */
|
|
113
|
+
}
|
|
114
|
+
.abSearchTrigger[data-size='lg']:hover { border-color: color-mix(in srgb, var(--ab-color-accent, #a67c52) 40%, transparent); } /* ๐ฑ๏ธ */
|
|
115
|
+
.abSearchTrigger[data-size='lg']:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; } /* โฟ */
|
|
116
|
+
.abSearchTrigger[data-size='lg'] .abSearchTriggerCap { margin-left: auto; } /* โจ๏ธ key cap pinned right */
|
|
117
|
+
.abSearchTrigger[data-size='lg'][aria-disabled='true'] { opacity: 1; } /* ๐ง same look while coming soon */
|
|
118
|
+
|
package/ab-theme-mode/index.tsx
CHANGED
|
@@ -79,4 +79,12 @@ export function useAbThemeModeContext(): AbThemeModeContextValue | null {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// ๐ฆ exports
|
|
82
|
+
/**
|
|
83
|
+
* ๐ฃ 0.3.2 (Joseph, 0.2.23 gaps): the ONE glyph per theme mode, shared by AbMobileHeader's theme button and
|
|
84
|
+
* AbThemeToggle, so the two never drift apart (AbIcons names)
|
|
85
|
+
*/
|
|
86
|
+
export const AB_THEME_MODE_ICONS: Readonly<Record<AbThemeMode, string>> = { light: 'light_mode', dark: 'dark_mode', system: 'brightness_auto' }; // ๐ ๐ ๐๐
ฐ๏ธ (0.3.2, God: brightness_auto everywhere, was 'computer')
|
|
87
|
+
/** ๐ 0.3.2: the glyph size of a single theme icon button (AbMobileHeader + AbThemeToggle variant="icon") */
|
|
88
|
+
export const AB_THEME_ICON_BUTTON_GLYPH = 24; // ๐ px
|
|
89
|
+
|
|
82
90
|
export default AbThemeModeProvider;
|
|
@@ -53,7 +53,7 @@ import AbIcon from '../ab-icon';
|
|
|
53
53
|
// ๐จ styles
|
|
54
54
|
import styles from './styles.module.css';
|
|
55
55
|
// ๐ 0.2.3: the shared theme state (AbThemeModeProvider), when there is one
|
|
56
|
-
import { useAbThemeModeContext, type AbThemeModeContextValue } from '../ab-theme-mode';
|
|
56
|
+
import { useAbThemeModeContext, AB_THEME_MODE_ICONS, AB_THEME_ICON_BUTTON_GLYPH, type AbThemeModeContextValue } from '../ab-theme-mode';
|
|
57
57
|
import { AB_MOTION } from 'ab-nextjs-animations/motion'; // ๐ฌ transition class names (ab-nextjs-animations >= 0.2.4)
|
|
58
58
|
import 'ab-nextjs-animations/motion/styles.css'; // ๐จ .ab-motion-*
|
|
59
59
|
|
|
@@ -83,14 +83,15 @@ export interface AbThemeToggleProps {
|
|
|
83
83
|
size?: 'sm' | 'md'; // ๐ sm = 32px, md = 40px segments (hit area โฅ 24px either way)
|
|
84
84
|
appearance?: 'fill' | 'thumb'; // ๐ 0.1.14 (P7): 'thumb' = the Home pill (28px segments, raised card thumb, filled active glyph). Default 'fill'
|
|
85
85
|
// ๐ฏ 0.1.14 (John): icon variant only. 'target' = glyph + name of the mode a click switches TO
|
|
86
|
-
// (moon in light, sun in dark, like the Home mock).
|
|
86
|
+
// (moon in light, sun in dark, like the Home mock). 0.3.2 (God): default 'target' for every appearance (was 'current' for fill)
|
|
87
87
|
iconShows?: 'current' | 'target';
|
|
88
88
|
className?: string; // ๐ท๏ธ
|
|
89
89
|
style?: CSSProperties; // ๐จ
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
// ๐ฃ default glyphs (AbIcons names)
|
|
93
|
-
|
|
93
|
+
// ๐ 0.3.2 (Joseph): the shared map, so the glyphs match AbMobileHeader's theme button
|
|
94
|
+
const DEFAULT_ICON_NAMES: Readonly<Record<AbThemeMode, string>> = AB_THEME_MODE_ICONS;
|
|
94
95
|
|
|
95
96
|
/**
|
|
96
97
|
* @name getNextAbThemeMode
|
|
@@ -142,14 +143,16 @@ function AbThemeToggleView(props: AbThemeToggleProps & { engine: Pick<AbThemeMod
|
|
|
142
143
|
};
|
|
143
144
|
|
|
144
145
|
// ๐ผ๏ธ glyph for a mode (decorative: the label names it)
|
|
145
|
-
// P7 thumb: 17px
|
|
146
|
+
// P7 thumb: 17px segments, filled while active (spec ยง2 icons)
|
|
147
|
+
// 0.3.2 (Joseph): variant="icon" uses the header's 24px glyph (was 22 thumb / 20), so it matches AbMobileHeader
|
|
148
|
+
const glyphSize = variant === 'icon' ? AB_THEME_ICON_BUTTON_GLYPH : thumb ? 17 : 20; // ๐
|
|
146
149
|
const glyph = (mode: AbThemeMode, active = false) =>
|
|
147
|
-
icons?.[mode] ?? <AbIcon name={DEFAULT_ICON_NAMES[mode]} size={
|
|
150
|
+
icons?.[mode] ?? <AbIcon name={DEFAULT_ICON_NAMES[mode]} size={glyphSize} variant={thumb && active ? 'filled' : undefined} />;
|
|
148
151
|
|
|
149
152
|
// ๐ single cycling button variant
|
|
150
153
|
if (variant === 'icon') {
|
|
151
154
|
const next = modes[(Math.max(0, modes.indexOf(current)) + 1) % modes.length]; // โญ๏ธ
|
|
152
|
-
const target = (iconShows ??
|
|
155
|
+
const target = (iconShows ?? 'target') === 'target'; // ๐ฏ 0.3.2 (God): always the target by default, like AbMobileHeader (was 'current' for fill)
|
|
153
156
|
const name = target ? (labels.switchTo?.[next] ?? `${labels.group}: ${labels[next]}`) : `${labels.group}: ${labels[current]}`; // โฟ
|
|
154
157
|
return (
|
|
155
158
|
<button
|
|
@@ -61,12 +61,36 @@
|
|
|
61
61
|
cursor: pointer; /* ๐ */
|
|
62
62
|
--ab-motion-duration: var(--ab-motion-duration-short, 160ms); /* ๐๏ธ colour fade = .ab-motion-colors (ab-nextjs-animations) */
|
|
63
63
|
}
|
|
64
|
+
/* ๐ 0.3.2 (God, 0.2.23 gaps): the single icon button is a 44px tap target (was 40px), the same 44ร44 as
|
|
65
|
+
AbMobileHeader's theme button; the segments keep 40/32px (radios inside one pill) */
|
|
66
|
+
.icon {
|
|
67
|
+
width: 44px; /* ๐ */
|
|
68
|
+
height: 44px; /* ๐ */
|
|
69
|
+
}
|
|
64
70
|
[data-size='sm'] .segment,
|
|
65
71
|
.icon[data-size='sm'] {
|
|
66
72
|
width: 32px; /* ๐ */
|
|
67
73
|
height: 32px; /* ๐ */
|
|
68
74
|
}
|
|
69
75
|
|
|
76
|
+
/* ๐ 0.3.2 (God): every radio segment and the sm icon button get an invisible 44ร44 hit area centred on them, so
|
|
77
|
+
the 40/32/28px visuals stay while the tap target is โฅ 44px (WCAG 2.5.5). Neighbouring areas overlap by a few px;
|
|
78
|
+
the later segment wins there, which is fine for adjacent radios */
|
|
79
|
+
.segment,
|
|
80
|
+
.icon {
|
|
81
|
+
position: relative; /* ๐ anchors the hit area */
|
|
82
|
+
}
|
|
83
|
+
.segment::after,
|
|
84
|
+
.icon[data-size='sm']::after {
|
|
85
|
+
content: ''; /* ๐ซฅ invisible */
|
|
86
|
+
position: absolute; /* ๐ */
|
|
87
|
+
left: 50%; /* โ๏ธ centred */
|
|
88
|
+
top: 50%; /* โ๏ธ centred */
|
|
89
|
+
width: 44px; /* ๐ */
|
|
90
|
+
height: 44px; /* ๐ */
|
|
91
|
+
transform: translate(-50%, -50%); /* ๐ฏ */
|
|
92
|
+
}
|
|
93
|
+
|
|
70
94
|
/* โ
selected */
|
|
71
95
|
.segment[aria-checked='true'] {
|
|
72
96
|
color: var(--ab-color-on-primary, #fff); /* ๐จ */
|
|
@@ -100,5 +124,5 @@
|
|
|
100
124
|
}
|
|
101
125
|
.group[data-appearance='thumb'] .segment[aria-checked='false']:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); } /* ๐ฑ๏ธ */
|
|
102
126
|
.group[data-appearance='thumb'] .segment:focus-visible, .icon[data-appearance='thumb']:focus-visible { outline-color: var(--ab-color-accent, #a67c52); } /* โฟ */
|
|
103
|
-
.icon[data-appearance='thumb'] { width:
|
|
127
|
+
.icon[data-appearance='thumb'] { width: 44px; height: 44px; border-radius: var(--ab-radius-button, 10px); color: var(--ab-color-muted, #6b5b50); } /* ๐ฑ 0.3.2: 44ร44 (was 40), 24px glyph like the header */
|
|
104
128
|
.icon[data-appearance='thumb']:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); }
|
package/ab-toc/index.tsx
CHANGED
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
import type { ReactElement, ReactNode } from 'react';
|
|
49
49
|
// ๐งต classes
|
|
50
50
|
import clsx from 'clsx';
|
|
51
|
+
// ๐ 404 gaps: provider-aware link for the `links` variant (locale prefix via AbLinkProvider)
|
|
52
|
+
import AbLink from '../ab-link';
|
|
51
53
|
// ๐จ styles
|
|
52
54
|
import styles from './styles.module.css';
|
|
53
55
|
|
|
@@ -73,6 +75,10 @@ export interface AbTocItem {
|
|
|
73
75
|
id: string; // ๐ the heading id (link target)
|
|
74
76
|
label: string; // ๐ท๏ธ
|
|
75
77
|
level?: 2 | 3 | 4; // ๐ indent (default 2)
|
|
78
|
+
// ===== 404 gaps: variant="links" =====
|
|
79
|
+
href?: string; // ๐ NEW: a page link (links variant); falls back to `#id`
|
|
80
|
+
description?: ReactNode; // ๐ NEW: a small second line, e.g. "Getting started" (links variant)
|
|
81
|
+
icon?: ReactNode; // ๐ฃ NEW: a leading icon (links variant, decorative)
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
/** โ๏ธ props */
|
|
@@ -84,6 +90,7 @@ export interface AbTocProps {
|
|
|
84
90
|
onNavigate?: (id: string) => void; // ๐ e.g. scrollToAbSection(id, { container }) (hooks 0.1.7); without it a plain #id jump, which scrolls the nearest scroller (the main pane in core 0.1.6 panes)
|
|
85
91
|
id?: string; // ๐ root id (default "ab-toc"); the title gets `${id}-title`
|
|
86
92
|
className?: string; // ๐ท๏ธ
|
|
93
|
+
variant?: 'toc' | 'links'; // ๐ 404 gaps: 'links' = a plain link list (e.g. "Popular pages"), no rail, no scroll spy (default 'toc')
|
|
87
94
|
footer?: ReactNode; // ๐งฉ 0.1.14 (P14): below the list after a 1px rule (Edit this page ยท Changelog ยท a promo card); links get the 12.5px Home style
|
|
88
95
|
}
|
|
89
96
|
|
|
@@ -92,12 +99,32 @@ export interface AbTocProps {
|
|
|
92
99
|
* aria-current="location". Pair with `useAbScrollSpy` from ab-nextjs-hooks 0.1.7 for `activeId`.
|
|
93
100
|
* No hooks here, so it also renders on the server.
|
|
94
101
|
*/
|
|
95
|
-
const AbToc = ({ items, activeId, label, title = label ?? 'On this page', onNavigate, id = 'ab-toc', className, footer }: AbTocProps): ReactElement | null => {
|
|
102
|
+
const AbToc = ({ items, activeId, label, title = label ?? 'On this page', onNavigate, id = 'ab-toc', className, footer, variant = 'toc' }: AbTocProps): ReactElement | null => {
|
|
96
103
|
if (!items.length) return null; // ๐ nothing to list
|
|
97
104
|
const headingId = `${id}-title`; // ๐
|
|
98
105
|
return (
|
|
99
|
-
<nav id={id} className={clsx('AbToc', styles.abToc, className)} data-ab-part="toc" aria-labelledby={headingId}>
|
|
106
|
+
<nav id={id} className={clsx('AbToc', styles.abToc, className)} data-ab-part="toc" data-variant={variant === 'links' ? 'links' : undefined /* ๐ 404 gaps */} aria-labelledby={headingId}>
|
|
100
107
|
<p id={headingId} className={styles.abTocTitle}>{title}</p>
|
|
108
|
+
{variant === 'links' ? (
|
|
109
|
+
// ๐ 404 gaps: plain link list (mock .pops / .pop): icon ยท bold label ยท small description
|
|
110
|
+
<ul className={styles.abTocLinks}>
|
|
111
|
+
{items.map((it) => (
|
|
112
|
+
<li key={it.id}>
|
|
113
|
+
<AbLink
|
|
114
|
+
href={it.href ?? `#${it.id}`} // ๐ page link (provider adds the locale) or in-page anchor
|
|
115
|
+
className={styles.abTocLinksItem} // ๐จ
|
|
116
|
+
aria-current={it.id === activeId ? 'page' : undefined} // โฟ the current page, if any
|
|
117
|
+
>
|
|
118
|
+
{it.icon != null && <span className={styles.abTocLinksIcon} aria-hidden="true">{it.icon}</span> /* ๐ฃ decorative */}
|
|
119
|
+
<span className={styles.abTocLinksText}>
|
|
120
|
+
<b className={styles.abTocLinksLabel}>{it.label}</b>{/* ๐ท๏ธ */}
|
|
121
|
+
{it.description != null && <small className={styles.abTocLinksDesc}>{it.description}</small> /* ๐ */}
|
|
122
|
+
</span>
|
|
123
|
+
</AbLink>
|
|
124
|
+
</li>
|
|
125
|
+
))}
|
|
126
|
+
</ul>
|
|
127
|
+
) : (
|
|
101
128
|
<ol className={styles.abTocList}>
|
|
102
129
|
{items.map((it) => {
|
|
103
130
|
const on = it.id === activeId; // ๐ฏ
|
|
@@ -116,6 +143,7 @@ const AbToc = ({ items, activeId, label, title = label ?? 'On this page', onNavi
|
|
|
116
143
|
);
|
|
117
144
|
})}
|
|
118
145
|
</ol>
|
|
146
|
+
)}
|
|
119
147
|
{footer != null && (
|
|
120
148
|
<>
|
|
121
149
|
<hr className={styles.abTocSep} />{/* โ mock .toc-sep */}
|
package/ab-toc/promo.tsx
CHANGED
|
@@ -54,6 +54,9 @@ export interface AbTocPromoProps {
|
|
|
54
54
|
children?: ReactNode; // ๐ the 11.5px muted subtitle (a `<code>` inside is 10.5px)
|
|
55
55
|
badge?: ReactNode; // ๐ the small chip (default "New"; `null` = none)
|
|
56
56
|
href?: string; // ๐ makes the title a link (the whole card clicks)
|
|
57
|
+
// โฟ 0.3.2 (God, 0.2.23 gaps): the card sits INSIDE the page aside, so by default its root is a plain <div> (no
|
|
58
|
+
// unnamed nested <aside> landmark). With `label` it becomes a NAMED <aside aria-label={label}> instead
|
|
59
|
+
label?: string;
|
|
57
60
|
className?: string; // ๐ท๏ธ
|
|
58
61
|
}
|
|
59
62
|
|
|
@@ -61,13 +64,20 @@ export interface AbTocPromoProps {
|
|
|
61
64
|
* ๐ AbTocPromo โ the aside's "New" card (mock `.toc-card`): a rounded (12px), evenly padded (12px) container on
|
|
62
65
|
* the card colour with a 1px border; a small "New" chip, a smaller title and a relatively smaller subtitle.
|
|
63
66
|
*/
|
|
64
|
-
const AbTocPromo = ({ title, children, badge = 'New', href, className }: AbTocPromoProps): ReactElement =>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
const AbTocPromo = ({ title, children, badge = 'New', href, label, className }: AbTocPromoProps): ReactElement => {
|
|
68
|
+
const Root = label ? 'aside' : 'div'; // โฟ 0.3.2: a landmark only when it has a name
|
|
69
|
+
return (
|
|
70
|
+
<Root
|
|
71
|
+
className={clsx('AbTocPromo', styles.abTocPromo, className)} // ๐จ
|
|
72
|
+
aria-label={label || undefined} // ๐ท๏ธ 0.3.2: names the <aside> (absent on the <div>)
|
|
73
|
+
data-ab-part="toc-promo" // ๐๏ธ
|
|
74
|
+
>
|
|
75
|
+
{badge != null && <span className={styles.abTocPromoChip}>{badge}</span> /* ๐ */}
|
|
76
|
+
<b className={styles.abTocPromoTitle}>{href ? <Link href={href} className={styles.abTocPromoLink}>{title}</Link> : title}</b> {/* ๐ท๏ธ */}
|
|
77
|
+
{children != null && <small className={styles.abTocPromoText}>{children}</small> /* ๐ */}
|
|
78
|
+
</Root>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
71
81
|
|
|
72
82
|
// ๐ฆ exports
|
|
73
83
|
export default AbTocPromo;
|
package/ab-toc/styles.module.css
CHANGED
|
@@ -80,3 +80,19 @@
|
|
|
80
80
|
.abTocPromoLink { color: inherit; text-decoration: none; } /* ๐ */
|
|
81
81
|
.abTocPromoLink::after { content: ''; position: absolute; inset: 0; border-radius: inherit; } /* ๐ฑ๏ธ whole card */
|
|
82
82
|
.abTocPromo:has(.abTocPromoLink:focus-visible) { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; } /* โฟ */
|
|
83
|
+
|
|
84
|
+
/* ๐ 404 gaps: variant="links" (mock .pops / .pop), a plain link list without the rail */
|
|
85
|
+
.abTocLinks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; } /* ๐ */
|
|
86
|
+
.abTocLinksItem {
|
|
87
|
+
display: flex; align-items: center; gap: 10px; /* ๐ icon ยท text */
|
|
88
|
+
margin: 0 -8px; padding: 7px 8px; border-radius: 9px; /* ๐ฆ mock */
|
|
89
|
+
color: var(--ab-color-text, var(--ab-color-on-surface, inherit)); text-decoration: none; /* ๐๏ธ */
|
|
90
|
+
}
|
|
91
|
+
.abTocLinksItem:hover, .abTocLinksItem[aria-current='page'] { background: var(--ab-color-tint, rgb(166 124 82 / 0.1)); } /* ๐ฑ๏ธ ๐ฏ */
|
|
92
|
+
.abTocLinksItem:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: -2px; } /* โฟ */
|
|
93
|
+
.abTocLinksIcon { display: inline-flex; flex: none; color: var(--ab-color-accent-text, var(--ab-color-primary, inherit)); } /* ๐ฃ */
|
|
94
|
+
.abTocLinksIcon svg { width: 17px; height: 17px; } /* ๐ */
|
|
95
|
+
.abTocLinksText { min-width: 0; } /* ๐ */
|
|
96
|
+
.abTocLinksLabel { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; } /* ๐ท๏ธ */
|
|
97
|
+
.abTocLinksDesc { display: block; margin-top: 1px; font-size: 11.5px; color: var(--ab-color-faint, var(--ab-color-on-surface-variant, inherit)); } /* ๐ */
|
|
98
|
+
|
package/index.ts
CHANGED
|
@@ -125,6 +125,8 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
|
|
|
125
125
|
// ๐ 0.1.13 docs shell (AbToc) โ server-safe, no hooks
|
|
126
126
|
{ name: 'AbToc', file: 'ab-toc/index.tsx', kind: 'server', status: 'Done' },
|
|
127
127
|
{ name: 'AbTocPromo', file: 'ab-toc/promo.tsx', kind: 'server', status: 'Done' }, // ๐ 0.2.1 the aside "New" card
|
|
128
|
+
// ๐ง 404 gaps: AbErrorHero (big code + badge tile, title, message, actions) โ server-safe, no hooks
|
|
129
|
+
{ name: 'AbErrorHero', file: 'ab-error-hero/index.tsx', kind: 'server', status: 'Done' },
|
|
128
130
|
// ๐ 0.1.14 (G53): AbDrawer + presets
|
|
129
131
|
{ name: 'AbDrawer', file: 'ab-drawer/index.tsx', kind: 'client', status: 'Done' },
|
|
130
132
|
{ name: 'AbDrawerList', file: 'ab-drawer-list/index.tsx', kind: 'client', status: 'Done' },
|
|
@@ -186,6 +188,9 @@ export { default as AbToc, getAbMainScroller, AB_MAIN_SCROLLER_SELECTOR } from '
|
|
|
186
188
|
export { default as AbTocPromo } from './ab-toc/promo.tsx'
|
|
187
189
|
export type { AbTocPromoProps } from './ab-toc/promo.tsx'
|
|
188
190
|
export type { AbTocItem, AbTocProps } from './ab-toc/index.tsx'
|
|
191
|
+
// ๐ง 404 gaps: the 404 / error hero (also at `ab-nextjs-components/ab-error-hero`)
|
|
192
|
+
export { default as AbErrorHero } from './ab-error-hero/index.tsx'
|
|
193
|
+
export type { AbErrorHeroProps } from './ab-error-hero/index.tsx'
|
|
189
194
|
// ๐๏ธ 0.1.14 (G53): AbDrawer + useAbDrawer (also at `ab-nextjs-components/ab-drawer`)
|
|
190
195
|
export { default as AbDrawer, useAbDrawer, getAbDrawerHost, AB_DRAWER_DURATION, AB_DRAWER_RETURN_FOCUS } from './ab-drawer/index.tsx'
|
|
191
196
|
// ๐ค 0.2.0 drawers v2: edge swipes + the swipe / snap rules
|
|
@@ -207,7 +212,7 @@ export { default as AbMobileHeader } from './ab-mobile-header/index.tsx'
|
|
|
207
212
|
export type { AbMobileHeaderProps, AbMobileHeaderThemeMode, AbMobileHeaderLanguage } from './ab-mobile-header/index.tsx'
|
|
208
213
|
export { AB_MOBILE_HEADER_THEME_CYCLE } from './ab-mobile-header/index.tsx' // ๐ 0.2.3
|
|
209
214
|
// ๐ 0.2.3 (Joseph, Welcome 0.2.21): one shared theme mode for every toggle
|
|
210
|
-
export { AbThemeModeProvider, useAbThemeModeContext } from './ab-theme-mode/index.tsx'
|
|
215
|
+
export { AbThemeModeProvider, useAbThemeModeContext, AB_THEME_MODE_ICONS, AB_THEME_ICON_BUTTON_GLYPH } from './ab-theme-mode/index.tsx' // ๐ฃ 0.3.2: + the shared theme glyphs
|
|
211
216
|
export type { AbThemeModeProviderProps, AbThemeModeContextValue } from './ab-theme-mode/index.tsx'
|
|
212
217
|
// ๐ 0.2.0 drawers v2: AbSearchDrawer
|
|
213
218
|
export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY } from './ab-search-drawer/index.tsx'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ab-nextjs-components",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "๐ A lightweight collection of server & client React components created by Abraham Ukachi, and optimized for Next.js applications ๐.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"ab-nextjs-animations": "^0.2.5",
|
|
44
44
|
"ab-nextjs-hooks": "^0.1.7",
|
|
45
|
-
"ab-nextjs-icons": "^0.2.
|
|
45
|
+
"ab-nextjs-icons": "^0.2.7",
|
|
46
46
|
"ab-nextjs-theme": "^0.3.7",
|
|
47
47
|
"clsx": "^2",
|
|
48
48
|
"next": "^16.3.4",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@types/react": "^19",
|
|
56
56
|
"ab-nextjs-animations": "^0.2.5",
|
|
57
57
|
"ab-nextjs-hooks": "^0.1.7",
|
|
58
|
-
"ab-nextjs-icons": "^0.2.
|
|
58
|
+
"ab-nextjs-icons": "^0.2.7",
|
|
59
59
|
"ab-nextjs-theme": "^0.3.7",
|
|
60
60
|
"clsx": "^2.1.1",
|
|
61
61
|
"esbuild": "^0.28.2",
|
|
@@ -140,7 +140,8 @@
|
|
|
140
140
|
"ab-app-bar",
|
|
141
141
|
"ab-card",
|
|
142
142
|
"ab-package-card",
|
|
143
|
-
"ab-toc"
|
|
143
|
+
"ab-toc",
|
|
144
|
+
"ab-error-hero"
|
|
144
145
|
],
|
|
145
146
|
"exports": {
|
|
146
147
|
".": {
|
|
@@ -238,6 +239,7 @@
|
|
|
238
239
|
"./ab-card": "./ab-card/index.tsx",
|
|
239
240
|
"./ab-package-card": "./ab-package-card/index.tsx",
|
|
240
241
|
"./ab-toc": "./ab-toc/index.tsx",
|
|
242
|
+
"./ab-error-hero": "./ab-error-hero/index.tsx",
|
|
241
243
|
"./ab-sidebar/view": "./ab-sidebar/view.tsx",
|
|
242
244
|
"./ab-navbar/view": "./ab-navbar/view.tsx"
|
|
243
245
|
},
|
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
import type { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
41
41
|
// ๐งต class joiner
|
|
42
42
|
import clsx from 'clsx';
|
|
43
|
+
// ๐ 404 gaps: the provider-aware link (client component, fine to render from a server twin)
|
|
44
|
+
import AbLink from '../../ab-link';
|
|
43
45
|
// ๐จ styles (server copy)
|
|
44
46
|
// ๐งฌ 0.2.3 (Joseph 03:41): ONE source for the button box โ the client module's CSS (no server copy to drift)
|
|
45
47
|
import styles from '../../ab-button/styles.module.css';
|
|
@@ -141,7 +143,8 @@ const AbButton = ({
|
|
|
141
143
|
return <span id={id} role="link" aria-disabled="true" tabIndex={mode === 'aria' ? 0 : -1} className={classNames} style={style} hidden={hidden} {...dataAttrs}>{content}</span>;
|
|
142
144
|
}
|
|
143
145
|
// โ
a link is a link (no role=button)
|
|
144
|
-
|
|
146
|
+
// ๐ 404 gaps: AbLink (a client leaf) reads AbLinkProvider from the client tree โ locale prefix ๐
|
|
147
|
+
return <AbLink id={id} href={href} className={classNames} style={style} hidden={hidden} {...dataAttrs}>{content}</AbLink>;
|
|
145
148
|
}
|
|
146
149
|
|
|
147
150
|
// ๐ button: aria mode is type="button" so a disabled CTA can never submit, even without JS
|
package/types/index.d.ts
CHANGED
|
@@ -81,6 +81,9 @@ export { default as AbToc, getAbMainScroller, AB_MAIN_SCROLLER_SELECTOR } from '
|
|
|
81
81
|
export { default as AbTocPromo } from '../ab-toc/promo.tsx';
|
|
82
82
|
export type { AbTocPromoProps } from '../ab-toc/promo.tsx';
|
|
83
83
|
export type { AbTocItem, AbTocProps } from '../ab-toc/index.tsx';
|
|
84
|
+
// ๐ง 404 gaps: AbErrorHero
|
|
85
|
+
export { default as AbErrorHero } from '../ab-error-hero/index.tsx';
|
|
86
|
+
export type { AbErrorHeroProps } from '../ab-error-hero/index.tsx';
|
|
84
87
|
// ๐๏ธ 0.1.14 (G53): AbDrawer + useAbDrawer (also at `ab-nextjs-components/ab-drawer`)
|
|
85
88
|
export { default as AbDrawer, useAbDrawer, getAbDrawerHost, AB_DRAWER_DURATION, AB_DRAWER_RETURN_FOCUS } from '../ab-drawer/index.tsx';
|
|
86
89
|
// ๐ค 0.2.0 drawers v2: edge swipes + the swipe / snap rules
|
|
@@ -102,7 +105,7 @@ export { default as AbMobileHeader } from '../ab-mobile-header/index.tsx';
|
|
|
102
105
|
export type { AbMobileHeaderProps, AbMobileHeaderThemeMode, AbMobileHeaderLanguage } from '../ab-mobile-header/index.tsx';
|
|
103
106
|
export { AB_MOBILE_HEADER_THEME_CYCLE } from '../ab-mobile-header/index.tsx'; // ๐ 0.2.3
|
|
104
107
|
// ๐ 0.2.3 (Joseph, Welcome 0.2.21): one shared theme mode for every toggle
|
|
105
|
-
export { AbThemeModeProvider, useAbThemeModeContext } from '../ab-theme-mode/index.tsx';
|
|
108
|
+
export { AbThemeModeProvider, useAbThemeModeContext, AB_THEME_MODE_ICONS, AB_THEME_ICON_BUTTON_GLYPH } from '../ab-theme-mode/index.tsx';
|
|
106
109
|
export type { AbThemeModeProviderProps, AbThemeModeContextValue } from '../ab-theme-mode/index.tsx';
|
|
107
110
|
// ๐ 0.2.0 drawers v2: AbSearchDrawer
|
|
108
111
|
export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY } from '../ab-search-drawer/index.tsx';
|