ab-nextjs-components 0.3.0 โ 0.3.1
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-error-hero/index.tsx +99 -0
- package/ab-error-hero/styles.module.css +86 -0
- package/ab-search-trigger/index.tsx +5 -4
- package/ab-search-trigger/styles.module.css +15 -0
- package/ab-toc/index.tsx +30 -2
- package/ab-toc/styles.module.css +16 -0
- package/index.ts +5 -0
- package/package.json +6 -4
- package/server/ab-button/index.tsx +4 -1
- package/types/index.d.ts +3 -0
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
|
+
|
|
@@ -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
|
+
}
|
|
@@ -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
|
|
|
@@ -97,3 +97,18 @@
|
|
|
97
97
|
|
|
98
98
|
/* ๐ฑ 0.1.15: the short label is hidden unless a compact AbAppBar (< 768px) swaps it in */
|
|
99
99
|
.abSearchTriggerShort { display: none; }
|
|
100
|
+
|
|
101
|
+
/* ===== ๐ 404 gaps: size="lg" (mock .e-search: 440ร44, radius 12, 14.5px) ===== */
|
|
102
|
+
.abSearchTrigger[data-size='lg'] {
|
|
103
|
+
display: inline-flex; align-items: center; gap: 8px; /* ๐ */
|
|
104
|
+
width: min(440px, 100%); height: 44px; padding: 0 8px 0 14px; /* ๐ full width on narrow screens */
|
|
105
|
+
border: 1px solid var(--ab-color-border, #e8dcd2); border-radius: 12px; /* ๐ท */
|
|
106
|
+
background: var(--ab-color-card, #fff); color: var(--ab-color-faint, #807062); /* ๐จ */
|
|
107
|
+
font-size: 14.5px; line-height: 1; box-shadow: var(--ab-shadow-card, 0 1px 2px rgb(33 26 22 / 0.05)); /* ๐ค ๐ */
|
|
108
|
+
text-decoration: none; box-sizing: border-box; /* ๐ ๐ฆ */
|
|
109
|
+
}
|
|
110
|
+
.abSearchTrigger[data-size='lg']:hover { border-color: color-mix(in srgb, var(--ab-color-accent, #a67c52) 40%, transparent); } /* ๐ฑ๏ธ */
|
|
111
|
+
.abSearchTrigger[data-size='lg']:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; } /* โฟ */
|
|
112
|
+
.abSearchTrigger[data-size='lg'] .abSearchTriggerCap { margin-left: auto; } /* โจ๏ธ key cap pinned right */
|
|
113
|
+
.abSearchTrigger[data-size='lg'][aria-disabled='true'] { opacity: 1; } /* ๐ง same look while coming soon */
|
|
114
|
+
|
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/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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ab-nextjs-components",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
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.6",
|
|
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.6",
|
|
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
|