ab-nextjs-components 0.4.2 โ 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +81 -17
- package/README.md +16 -2
- package/ab-app-bar/index.tsx +5 -5
- package/ab-app-bar/styles.module.css +5 -5
- package/ab-bottom-drawer/index.tsx +3 -3
- package/ab-bottom-drawer/styles.module.css +2 -2
- package/ab-bottom-drawer/use-ab-swipe-down.ts +1 -1
- package/ab-breadcrumbs/index.tsx +1 -1
- package/ab-breadcrumbs/styles.module.css +5 -5
- package/ab-button/index.tsx +1 -1
- package/ab-button/styles.module.css +5 -5
- package/ab-callout/index.tsx +1 -1
- package/ab-callout/styles.module.css +1 -1
- package/ab-carousel/helpers.ts +1 -1
- package/ab-carousel/index.tsx +4 -4
- package/ab-carousel/styles.module.css +2 -2
- package/ab-chip/styles.module.css +1 -1
- package/ab-code-block/focus.tsx +63 -0
- package/ab-code-block/index.tsx +55 -28
- package/ab-code-block/styles.module.css +4 -3
- package/ab-content-tabs/index.tsx +25 -3
- package/ab-demo-box/index.tsx +45 -7
- package/ab-demo-box/styles.module.css +19 -7
- package/ab-demo-code/index.tsx +38 -34
- package/ab-demo-code/styles.module.css +3 -41
- package/ab-doc-pager/index.tsx +1 -1
- package/ab-drawer/gestures.ts +1 -1
- package/ab-drawer/index.tsx +12 -4
- package/ab-drawer/kit.module.css +13 -13
- package/ab-drawer/styles.module.css +2 -2
- package/ab-drawer/use-ab-edge-swipe.ts +2 -2
- package/ab-flow-diagram/helpers.ts +2 -2
- package/ab-flow-diagram/index.tsx +2 -2
- package/ab-flow-diagram/styles.module.css +3 -3
- package/ab-icon/builtin.ts +4 -0
- package/ab-icon/helpers.ts +1 -1
- package/ab-icon/index.tsx +3 -3
- package/ab-icon/registrar.tsx +1 -1
- package/ab-icon-button/index.tsx +1 -1
- package/ab-install-snippet/styles.module.css +1 -1
- package/ab-link/index.tsx +2 -2
- package/ab-link/locale.ts +1 -1
- package/ab-list/styles.module.css +1 -1
- package/ab-locale-switcher/index.tsx +6 -6
- package/ab-locale-switcher/styles.module.css +5 -5
- package/ab-mobile-header/index.tsx +6 -6
- package/ab-nav-drawer/index.tsx +11 -6
- package/ab-navbar/index.tsx +1 -1
- package/ab-navbar/styles.module.css +1 -1
- package/ab-navbar/view.tsx +1 -1
- package/ab-package-card/index.tsx +3 -3
- package/ab-package-card/previews.tsx +1 -1
- package/ab-package-card/styles.module.css +2 -2
- package/ab-playground-scene/i18n.module.css +1 -1
- package/ab-playground-scene/icons.tsx +1 -1
- package/ab-playground-scene/index.tsx +4 -4
- package/ab-playground-scene/labels.ts +3 -3
- package/ab-playground-scene/scenes.tsx +4 -4
- package/ab-playground-scene/styles.module.css +6 -6
- package/ab-playground-scene/upgraded.tsx +3 -3
- package/ab-playground-scene/welcome.tsx +1 -1
- package/ab-preview-code/index.tsx +115 -0
- package/ab-preview-code/stage.tsx +153 -0
- package/ab-preview-code/styles.module.css +43 -0
- package/ab-progress-chips/index.tsx +1 -1
- package/ab-search-drawer/index.tsx +4 -4
- package/ab-search-trigger/index.tsx +5 -5
- package/ab-search-trigger/styles.module.css +3 -3
- package/ab-settings-drawer/index.tsx +2 -2
- package/ab-sidebar/active.ts +105 -0
- package/ab-sidebar/index.tsx +10 -6
- package/ab-sidebar/profile-button.tsx +2 -2
- package/ab-sidebar/styles.module.css +4 -4
- package/ab-sidebar/view.tsx +16 -8
- package/ab-theme-mode/index.tsx +3 -3
- package/ab-theme-toggle/index.tsx +6 -6
- package/ab-theme-toggle/styles.module.css +2 -2
- package/ab-toc/index.tsx +3 -3
- package/ab-toc/promo.tsx +2 -2
- package/ab-toc/styles.module.css +1 -1
- package/ab-toc-drawer/index.tsx +1 -1
- package/ab-version-switcher/index.tsx +2 -2
- package/css/dialog.css +1 -1
- package/index.ts +29 -18
- package/package.json +3 -1
- package/server/ab-button/index.tsx +1 -1
- package/server/ab-icon/index.tsx +2 -2
- package/server/ab-sidebar/index.tsx +3 -2
- package/types/index.d.ts +8 -7
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
*
|
|
27
|
+
* @project: ab-nextjs-components
|
|
28
|
+
* @name: Active nav item matching (0.5.0)
|
|
29
|
+
* @file: ab-sidebar/active.ts
|
|
30
|
+
* @type: Pure helpers (client + server)
|
|
31
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
32
|
+
*
|
|
33
|
+
* Example usage:
|
|
34
|
+
* 1+|> getAbActiveHrefs(['/docs', '/docs/x'], '/docs/x?tab=1#top') // โ Set { '/docs/x' } (longest match only)
|
|
35
|
+
* 2+|> getAbActiveHrefs(['/docs', '/docs/x'], '/docs/x', { match: 'prefix' }) // โ Set { '/docs', '/docs/x' }
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
40
|
+
* MOTTO: We'll always do more ๐!!!
|
|
41
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
// ๐ง no 'use client': AbSidebar (both twins) and AbNavDrawer share these, so one rule lights every nav
|
|
45
|
+
|
|
46
|
+
// ๐ locale-prefix stripping (`/fr/docs` โ `/docs`)
|
|
47
|
+
import { stripAbLocalePrefix } from '../ab-link/locale';
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* ๐ฏ How an item's href is matched against the current route.
|
|
51
|
+
*
|
|
52
|
+
* - `'best'` (default): prefix matching, but only the **longest** matching href wins, so `/docs` and
|
|
53
|
+
* `/docs/x` never light up together on `/docs/x`. On `/docs/y` (not in the list) `/docs` still lights.
|
|
54
|
+
* - `'prefix'`: every parent of the route is active (the pre-0.5.0 behaviour; can double-highlight).
|
|
55
|
+
* - `'exact'`: only the item whose href equals the route.
|
|
56
|
+
*/
|
|
57
|
+
export type AbActiveMatch = 'best' | 'prefix' | 'exact';
|
|
58
|
+
|
|
59
|
+
/** ๐ anything with an href, plus an optional per-item override (`exact: true` = never a parent match) */
|
|
60
|
+
export interface AbActiveMatchable { href: string; exact?: boolean }
|
|
61
|
+
|
|
62
|
+
/** โ๏ธ options shared by the helpers */
|
|
63
|
+
export interface AbActiveMatchOptions {
|
|
64
|
+
match?: AbActiveMatch; // ๐ฏ default 'best'
|
|
65
|
+
locales?: readonly string[]; // ๐ stripped from the current route first (e.g. ['en', 'fr'])
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** ๐งน normalise a path: drop `?query` and `#hash`, and a trailing slash (but `/` stays `/`) */
|
|
69
|
+
export function normalizeAbHref(href: string): string {
|
|
70
|
+
const path = href.split(/[?#]/)[0] || '/'; // โ๏ธ query + hash (a bare "?x" is the root)
|
|
71
|
+
const trimmed = path.replace(/\/+$/, ''); // โ๏ธ trailing slashes
|
|
72
|
+
return trimmed === '' ? '/' : trimmed; // ๐
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** ๐ฏ does one href match the route? `exact` = equality only; otherwise equality or a parent segment */
|
|
76
|
+
export function matchAbHref(href: string, current: string, exact = false): boolean {
|
|
77
|
+
const h = normalizeAbHref(href); const c = normalizeAbHref(current); // ๐งน both sides
|
|
78
|
+
if (h === c) return true; // โ
exact
|
|
79
|
+
if (exact || h === '/') return false; // ๐
"/" only ever matches itself
|
|
80
|
+
return c.startsWith(`${h}/`); // ๐ณ a whole-segment parent (`/doc` never matches `/docs`)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* ๐ฅ the set of active hrefs (normalised) among `items` for the route `current`.
|
|
85
|
+
* An item's own `exact` wins over `match`; `exact: false` on an item allows prefix matching even when `match='exact'`.
|
|
86
|
+
*/
|
|
87
|
+
export function getAbActiveHrefs(items: ReadonlyArray<AbActiveMatchable | string>, current: string | undefined, options: AbActiveMatchOptions = {}): Set<string> {
|
|
88
|
+
const out = new Set<string>(); // ๐ฆ
|
|
89
|
+
if (!current) return out; // ๐ซ no route
|
|
90
|
+
const { match = 'best', locales } = options;
|
|
91
|
+
const route = stripAbLocalePrefix(current, locales); // ๐
|
|
92
|
+
const hits = items
|
|
93
|
+
.map((it) => (typeof it === 'string' ? { href: it } : it)) // ๐ plain strings welcome
|
|
94
|
+
.filter((it) => matchAbHref(it.href, route, it.exact ?? match === 'exact')) // ๐ฏ per-item override first
|
|
95
|
+
.map((it) => normalizeAbHref(it.href)); // ๐งน
|
|
96
|
+
if (match !== 'best') { hits.forEach((h) => out.add(h)); return out; } // ๐ณ prefix / exact: all hits
|
|
97
|
+
const longest = hits.reduce((a, h) => (h.length > a.length ? h : a), ''); // ๐ฅ the deepest match
|
|
98
|
+
if (longest) out.add(longest); // โ
one href (two items sharing it both light, which is intended)
|
|
99
|
+
return out;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** ๐ณ flatten nested items (`items` children) into one list, so a child can out-match its parent */
|
|
103
|
+
export function flattenAbNavItems<T extends AbActiveMatchable & { items?: readonly T[] }>(items: readonly T[]): T[] {
|
|
104
|
+
return items.flatMap((it) => [it, ...(it.items ? flattenAbNavItems(it.items) : [])]); // ๐ depth-first
|
|
105
|
+
}
|
package/ab-sidebar/index.tsx
CHANGED
|
@@ -48,20 +48,23 @@
|
|
|
48
48
|
import { useState, type ReactElement } from 'react';
|
|
49
49
|
// ๐งญ current route (fallback when `activeHref` is omitted)
|
|
50
50
|
import { usePathname } from 'next/navigation';
|
|
51
|
-
// ๐ 0.1.13 (
|
|
51
|
+
// ๐ 0.1.13 (#10): locale-stripped pathname
|
|
52
52
|
import { stripAbLocalePrefix, useAbLocales } from '../ab-link';
|
|
53
53
|
// ๐ฃ client AbIcon (built-in chevrons are always registered)
|
|
54
54
|
import AbIcon from '../ab-icon';
|
|
55
55
|
// ๐ผ๏ธ shared view
|
|
56
|
-
import { AbSidebarView,
|
|
56
|
+
import { AbSidebarView, createAbSidebarActive, toAbSidebarSections, type AbSidebarBaseProps } from './view';
|
|
57
57
|
// ๐จ styles
|
|
58
58
|
import styles from './styles.module.css';
|
|
59
|
-
// ๐ค 0.2.1
|
|
59
|
+
// ๐ค 0.2.1: the bottom-left profile button (โฅ 1180px, CSS)
|
|
60
60
|
import AbSidebarProfileButton, { type AbSidebarProfileButtonProps } from './profile-button';
|
|
61
61
|
|
|
62
62
|
// ๐ฆ re-export the shared types
|
|
63
63
|
export type { AbSidebarItem, AbSidebarSection, AbSidebarLink, AbSidebarLabels } from './view';
|
|
64
|
-
export { isAbSidebarActive, toAbSidebarSections } from './view';
|
|
64
|
+
export { isAbSidebarActive, toAbSidebarSections, createAbSidebarActive } from './view';
|
|
65
|
+
// ๐ฏ 0.5.0: the shared active-matching helpers + types (AbNavDrawer uses them too)
|
|
66
|
+
export { getAbActiveHrefs, matchAbHref, normalizeAbHref, flattenAbNavItems } from './active';
|
|
67
|
+
export type { AbActiveMatch, AbActiveMatchable, AbActiveMatchOptions } from './active';
|
|
65
68
|
export { AbSidebarProfileButton, type AbSidebarProfileButtonProps } from './profile-button';
|
|
66
69
|
|
|
67
70
|
/** โ๏ธ Client props: the shared ones + collapse control. */
|
|
@@ -69,7 +72,7 @@ export interface AbSidebarProps extends AbSidebarBaseProps {
|
|
|
69
72
|
defaultCollapsed?: boolean; // ๐ช uncontrolled start
|
|
70
73
|
onCollapsedChange?: (collapsed: boolean) => void; // ๐
|
|
71
74
|
collapsible?: boolean; // ๐ show the collapse button (default true when sections are given)
|
|
72
|
-
// ๐ค 0.2.1
|
|
75
|
+
// ๐ค 0.2.1: opt-in; pass `user` + the AbSettingsDrawer props for a profile button at the bottom left
|
|
73
76
|
profile?: Omit<AbSidebarProfileButtonProps, 'collapsed'>;
|
|
74
77
|
collapseButtonVariant?: 'plain' | 'outlined'; // โช 0.1.14 (P9): 'outlined' = 32ร32 bordered `<<` / `>>` (default 'plain' chevron)
|
|
75
78
|
}
|
|
@@ -92,7 +95,8 @@ const AbSidebar = (props: AbSidebarProps): ReactElement => {
|
|
|
92
95
|
onCollapsedChange?.(next); // ๐
|
|
93
96
|
};
|
|
94
97
|
// ๐ฏ legacy `page` wins, then activeHref, then the pathname
|
|
95
|
-
const
|
|
98
|
+
const isOn = createAbSidebarActive(toAbSidebarSections(props.sections, props.links), activeHref ?? pathname, props.activeMatch); // ๐ฅ 0.5.0: deepest match by default
|
|
99
|
+
const active = (href: string, value?: string) => (page ? page === value : isOn(href));
|
|
96
100
|
// ๐ the toggle
|
|
97
101
|
const showToggle = collapsible ?? !!props.sections?.length;
|
|
98
102
|
const toggleLabel = collapsed ? labels?.expand ?? 'Expand sidebar' : labels?.collapse ?? 'Collapse sidebar';
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*
|
|
26
26
|
* @project: ab-nextjs-components
|
|
27
|
-
* @name: AbSidebarProfileButton - Client (0.2.1
|
|
27
|
+
* @name: AbSidebarProfileButton - Client (0.2.1)
|
|
28
28
|
* @file: ab-sidebar/profile-button.tsx
|
|
29
29
|
* @type: Client Component
|
|
30
30
|
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
@@ -71,7 +71,7 @@ export interface AbSidebarProfileButtonProps extends Omit<AbSettingsDrawerProps,
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* ๐ค AbSidebarProfileButton โ the bottom-left sidebar control (
|
|
74
|
+
* ๐ค AbSidebarProfileButton โ the bottom-left sidebar control (replaces the 0.2.1-draft settings icon
|
|
75
75
|
* button): a 40px profile circle (signed out: the profile glyph; signed in: the initials on the container colour, or
|
|
76
76
|
* the photo masked to a circle) + the name when the sidebar is expanded. Tapping it opens AbSettingsDrawer.
|
|
77
77
|
*
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
text-decoration: none; /* ๐ซ */
|
|
118
118
|
color: inherit; /* ๐๏ธ */
|
|
119
119
|
font-weight: 500; /* ๐ค */
|
|
120
|
-
/* ๐ค 0.1.13 (
|
|
120
|
+
/* ๐ค 0.1.13 (#15): M3 label-large, so names stop inheriting the big body size and wrapping at 280px */
|
|
121
121
|
font-family: var(--md-sys-typescale-label-large-font, inherit);
|
|
122
122
|
font-size: var(--md-sys-typescale-label-large-size, 14px);
|
|
123
123
|
line-height: var(--md-sys-typescale-label-large-line-height, 20px);
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
padding: 0; border-radius: 0; background: none; line-height: 1; /* ๐งน no chip */
|
|
176
176
|
font: 500 10.5px var(--ab-font-code, 'Roboto Mono', ui-monospace, monospace); color: var(--ab-color-faint, #807062); /* โจ๏ธ */
|
|
177
177
|
}
|
|
178
|
-
/* โฟ
|
|
178
|
+
/* โฟ faint on --tint is 3.9:1, so on the active row the text badge takes the row's --accent-text (โฅ 4.5:1 on tint) */
|
|
179
179
|
.abSidebar[data-badge='text'] .abSidebarLink[data-active='true'] .abSidebarBadge { color: inherit; }
|
|
180
180
|
/* โช P9: outlined collapse, 32ร32, radius 8, 1px --border, --card, --muted */
|
|
181
181
|
.abSidebarToggle[data-variant='outlined'] {
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
.abSidebar[data-density='compact'][data-collapsed='true'] .abSidebarSections { padding-inline: 8px; }
|
|
189
189
|
.abSidebar[data-density='compact'][data-collapsed='true'] .abSidebarLink { width: 40px; height: 40px; } /* ๐ */
|
|
190
190
|
|
|
191
|
-
/* ๐ท๏ธ 0.1.15
|
|
191
|
+
/* ๐ท๏ธ 0.1.15: the tablet logo row, mock 06 `.sb-logo` = 60px, 0 20px, centred, never shrinks.
|
|
192
192
|
* Height follows core's --ab-header-height (60px at tablet) so it lines up with the main bar. */
|
|
193
193
|
.abSidebarLogo { flex: none; display: flex; align-items: center; box-sizing: border-box; height: var(--ab-header-height, 60px); padding: 0 20px; }
|
|
194
194
|
.abSidebar[data-collapsed='true'] .abSidebarLogo { justify-content: center; padding: 0; } /* ๐ช rail: centred */
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
.abSidebar[data-collapsed='true'] .abSidebarFooter { justify-content: center; } /* ๐ช rail: centred */
|
|
208
208
|
.abSidebar { min-height: 100%; } /* ๐ fill the pane so the footer can reach the bottom */
|
|
209
209
|
.abSidebar[data-density='compact'] .abSidebarFooter { padding: 8px 10px 12px; box-sizing: border-box; width: 100%; } /* ๐ฆ compact: line up with the rows (sections pad 10px) */
|
|
210
|
-
/* ๐ค 0.2.1
|
|
210
|
+
/* ๐ค 0.2.1: the profile button: avatar (+ the name when expanded), theme tokens only */
|
|
211
211
|
.abSidebarProfile {
|
|
212
212
|
display: inline-flex; /* ๐ */
|
|
213
213
|
align-items: center; /* โ๏ธ */
|
package/ab-sidebar/view.tsx
CHANGED
|
@@ -46,16 +46,19 @@ import Link from '../ab-link';
|
|
|
46
46
|
import AbBalloon from '../ab-balloon';
|
|
47
47
|
// ๐จ styles
|
|
48
48
|
import styles from './styles.module.css';
|
|
49
|
+
// ๐ฏ 0.5.0: one active-matching rule for AbSidebar + AbNavDrawer (longest match by default)
|
|
50
|
+
import { flattenAbNavItems, getAbActiveHrefs, matchAbHref, normalizeAbHref, type AbActiveMatch } from './active';
|
|
49
51
|
|
|
50
52
|
/** ๐ One sidebar destination (G40). `items` = one level of children, shown under the parent. */
|
|
51
53
|
export interface AbSidebarItem {
|
|
52
|
-
id?: string; // ๐ 0.1.13 (
|
|
54
|
+
id?: string; // ๐ 0.1.13 (nit): stable React key when two items share an href (default: `href`)
|
|
53
55
|
href: string; // ๐
|
|
54
56
|
icon?: string; // ๐ฃ AbIcons name: outlined, filled when active
|
|
55
|
-
label: ReactNode; // ๐ท๏ธ 0.1.13: any node (
|
|
57
|
+
label: ReactNode; // ๐ท๏ธ 0.1.13: any node (#15), e.g. a mono package name
|
|
56
58
|
labelText?: string; // โฟ plain-text name for the rail tooltip/aria-label when `label` isn't a string
|
|
57
59
|
badge?: ReactNode; // ๐ด e.g. "New" or a count
|
|
58
60
|
items?: AbSidebarItem[]; // ๐ณ children
|
|
61
|
+
exact?: boolean; // ๐ฏ 0.5.0: true = active on its own href only (never as a parent); false = allow parent matching even under activeMatch="exact"
|
|
59
62
|
}
|
|
60
63
|
|
|
61
64
|
/** ๐๏ธ A labelled group of items. */
|
|
@@ -90,7 +93,8 @@ export interface AbSidebarBaseProps {
|
|
|
90
93
|
className?: string; // ๐ท๏ธ
|
|
91
94
|
id?: string; // ๐ the list id (aria-controls target), default "ab-sidebar-list"
|
|
92
95
|
sections?: AbSidebarSection[]; // ๐๏ธ G40
|
|
93
|
-
activeHref?: string; // ๐ฏ current route (
|
|
96
|
+
activeHref?: string; // ๐ฏ current route (query, hash and a trailing slash are ignored)
|
|
97
|
+
activeMatch?: AbActiveMatch; // ๐ฏ 0.5.0: 'best' (default, deepest match only), 'prefix' (every parent too) or 'exact'
|
|
94
98
|
collapsed?: boolean; // ๐ช icon rail
|
|
95
99
|
header?: ReactNode; // ๐ท๏ธ top slot (brand, workspace switcherโฆ)
|
|
96
100
|
labels?: AbSidebarLabels; // ๐
|
|
@@ -99,7 +103,7 @@ export interface AbSidebarBaseProps {
|
|
|
99
103
|
density?: 'comfortable' | 'compact'; // ๐ 'compact' = 32px rows, 13.5/500, 18px icons, 11px group labels
|
|
100
104
|
activeShape?: 'pill' | 'rounded'; // ๐ท 'rounded' = 8px-radius --tint row (default 'pill')
|
|
101
105
|
badgeVariant?: 'chip' | 'text'; // ๐ท๏ธ 'text' = plain mono 10.5 --faint meta (e.g. a version), no chip
|
|
102
|
-
// ๐ท๏ธ 0.1.15
|
|
106
|
+
// ๐ท๏ธ 0.1.15: a 60px logo row above `header` (mock 06 `.sb-logo`). With core โฅ 0.2.1 panes it only shows
|
|
103
107
|
// where the app header is hidden (tabletHeader="main" at 768โ1179); elsewhere it always shows
|
|
104
108
|
logo?: ReactNode;
|
|
105
109
|
footer?: ReactNode; // ๐ฆถ 0.2.1: a bottom slot pinned to the bottom left (e.g. AbSidebarProfileButton)
|
|
@@ -111,11 +115,15 @@ export interface AbSidebarBaseProps {
|
|
|
111
115
|
brandLabel?: string;
|
|
112
116
|
}
|
|
113
117
|
|
|
114
|
-
/** ๐ฏ Is `href` the current route, or a parent of it? */
|
|
118
|
+
/** ๐ฏ Is `href` the current route, or a parent of it? (single-item prefix check; lists use `getAbActiveHrefs`) */
|
|
115
119
|
export function isAbSidebarActive(href: string, activeHref?: string): boolean {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
return !!activeHref && matchAbHref(href, activeHref); // ๐ณ query / hash / trailing slash tolerant since 0.5.0
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** ๐ฏ 0.5.0: an `active(href)` checker for a whole sidebar, using `activeMatch` + each item's `exact` */
|
|
124
|
+
export function createAbSidebarActive(groups: AbSidebarSection[], current: string | undefined, match?: AbActiveMatch): (href: string) => boolean {
|
|
125
|
+
const on = getAbActiveHrefs(groups.flatMap((g) => flattenAbNavItems(g.items)), current, { match }); // ๐ฅ resolved once per render
|
|
126
|
+
return (href) => on.has(normalizeAbHref(href)); // โ
|
|
119
127
|
}
|
|
120
128
|
|
|
121
129
|
/** ๐๏ธ sections, or the legacy links as one unlabelled section. */
|
package/ab-theme-mode/index.tsx
CHANGED
|
@@ -60,7 +60,7 @@ export interface AbThemeModeProviderProps {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* ๐ AbThemeModeProvider โ 0.2.3 (
|
|
63
|
+
* ๐ AbThemeModeProvider โ 0.2.3 (Welcome 0.2.21): ONE theme state for the whole app. Each AbThemeToggle
|
|
64
64
|
* (laptop sidebar, Settings sheet) and AbMobileHeader's 3-state button used to run its own engine, so they drifted
|
|
65
65
|
* across 768px. Under this provider they all read and write this one engine (still persisted under the `theme`
|
|
66
66
|
* key, still following the OS in 'system'). Put it once, high in the tree (e.g. around AbAppLayout).
|
|
@@ -80,10 +80,10 @@ export function useAbThemeModeContext(): AbThemeModeContextValue | null {
|
|
|
80
80
|
|
|
81
81
|
// ๐ฆ exports
|
|
82
82
|
/**
|
|
83
|
-
* ๐ฃ 0.3.2 (
|
|
83
|
+
* ๐ฃ 0.3.2 (0.2.23 gaps): the ONE glyph per theme mode, shared by AbMobileHeader's theme button and
|
|
84
84
|
* AbThemeToggle, so the two never drift apart (AbIcons names)
|
|
85
85
|
*/
|
|
86
|
-
export const AB_THEME_MODE_ICONS: Readonly<Record<AbThemeMode, string>> = { light: 'light_mode', dark: 'dark_mode', system: 'brightness_auto' }; // ๐ ๐ ๐๐
ฐ๏ธ (0.3.2,
|
|
86
|
+
export const AB_THEME_MODE_ICONS: Readonly<Record<AbThemeMode, string>> = { light: 'light_mode', dark: 'dark_mode', system: 'brightness_auto' }; // ๐ ๐ ๐๐
ฐ๏ธ (0.3.2, brightness_auto everywhere, was 'computer')
|
|
87
87
|
/** ๐ 0.3.2: the glyph size of a single theme icon button (AbMobileHeader + AbThemeToggle variant="icon") */
|
|
88
88
|
export const AB_THEME_ICON_BUTTON_GLYPH = 24; // ๐ px
|
|
89
89
|
|
|
@@ -66,7 +66,7 @@ export interface AbThemeToggleLabels {
|
|
|
66
66
|
light: string; // ๐ "Light"
|
|
67
67
|
dark: string; // ๐ "Dark"
|
|
68
68
|
system: string; // ๐ฅ๏ธ "System"
|
|
69
|
-
// ๐ฏ 0.1.14
|
|
69
|
+
// ๐ฏ 0.1.14: action names for the icon button when it shows the target mode,
|
|
70
70
|
// e.g. { dark: 'Switch to dark theme', light: 'Switch to light theme' }. Falls back to "Theme: Dark"
|
|
71
71
|
switchTo?: Partial<Record<AbThemeMode, string>>;
|
|
72
72
|
}
|
|
@@ -82,15 +82,15 @@ export interface AbThemeToggleProps {
|
|
|
82
82
|
icons?: Partial<Record<AbThemeMode, ReactNode>>; // ๐ผ๏ธ override glyphs
|
|
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
|
-
// ๐ฏ 0.1.14
|
|
86
|
-
// (moon in light, sun in dark, like the Home mock). 0.3.2
|
|
85
|
+
// ๐ฏ 0.1.14: icon variant only. 'target' = glyph + name of the mode a click switches TO
|
|
86
|
+
// (moon in light, sun in dark, like the Home mock). 0.3.2: 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
|
-
// ๐ 0.3.2
|
|
93
|
+
// ๐ 0.3.2: the shared map, so the glyphs match AbMobileHeader's theme button
|
|
94
94
|
const DEFAULT_ICON_NAMES: Readonly<Record<AbThemeMode, string>> = AB_THEME_MODE_ICONS;
|
|
95
95
|
|
|
96
96
|
/**
|
|
@@ -144,7 +144,7 @@ function AbThemeToggleView(props: AbThemeToggleProps & { engine: Pick<AbThemeMod
|
|
|
144
144
|
|
|
145
145
|
// ๐ผ๏ธ glyph for a mode (decorative: the label names it)
|
|
146
146
|
// P7 thumb: 17px segments, filled while active (spec ยง2 icons)
|
|
147
|
-
// 0.3.2
|
|
147
|
+
// 0.3.2: variant="icon" uses the header's 24px glyph (was 22 thumb / 20), so it matches AbMobileHeader
|
|
148
148
|
const glyphSize = variant === 'icon' ? AB_THEME_ICON_BUTTON_GLYPH : thumb ? 17 : 20; // ๐
|
|
149
149
|
const glyph = (mode: AbThemeMode, active = false) =>
|
|
150
150
|
icons?.[mode] ?? <AbIcon name={DEFAULT_ICON_NAMES[mode]} size={glyphSize} variant={thumb && active ? 'filled' : undefined} />;
|
|
@@ -152,7 +152,7 @@ function AbThemeToggleView(props: AbThemeToggleProps & { engine: Pick<AbThemeMod
|
|
|
152
152
|
// ๐ single cycling button variant
|
|
153
153
|
if (variant === 'icon') {
|
|
154
154
|
const next = modes[(Math.max(0, modes.indexOf(current)) + 1) % modes.length]; // โญ๏ธ
|
|
155
|
-
const target = (iconShows ?? 'target') === 'target'; // ๐ฏ 0.3.2
|
|
155
|
+
const target = (iconShows ?? 'target') === 'target'; // ๐ฏ 0.3.2: always the target by default, like AbMobileHeader (was 'current' for fill)
|
|
156
156
|
const name = target ? (labels.switchTo?.[next] ?? `${labels.group}: ${labels[next]}`) : `${labels.group}: ${labels[current]}`; // โฟ
|
|
157
157
|
return (
|
|
158
158
|
<button
|
|
@@ -61,7 +61,7 @@
|
|
|
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 (
|
|
64
|
+
/* ๐ 0.3.2 (0.2.23 gaps): the single icon button is a 44px tap target (was 40px), the same 44ร44 as
|
|
65
65
|
AbMobileHeader's theme button; the segments keep 40/32px (radios inside one pill) */
|
|
66
66
|
.icon {
|
|
67
67
|
width: 44px; /* ๐ */
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
height: 32px; /* ๐ */
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
/* ๐ 0.3.2
|
|
76
|
+
/* ๐ 0.3.2: every radio segment and the sm icon button get an invisible 44ร44 hit area centred on them, so
|
|
77
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
78
|
the later segment wins there, which is fine for adjacent radios */
|
|
79
79
|
.segment,
|
package/ab-toc/index.tsx
CHANGED
|
@@ -62,7 +62,7 @@ export const AB_MAIN_SCROLLER_SELECTOR = '[data-ab-part="main-content"]';
|
|
|
62
62
|
* Use it as `useAbScrollSpy({ root })` / `scrollToAbSection(id, { container })`.
|
|
63
63
|
*
|
|
64
64
|
* โ ๏ธ Call it only in an effect or an event handler, **never during render**: it reads the DOM, so a render
|
|
65
|
-
* call returns `null` on the server and the element on the client (hydration mismatch). (
|
|
65
|
+
* call returns `null` on the server and the element on the client (hydration mismatch). (nit)
|
|
66
66
|
*/
|
|
67
67
|
export function getAbMainScroller(from?: Element | null): HTMLElement | null {
|
|
68
68
|
if (typeof document === 'undefined') return null; // ๐ฅ๏ธ SSR
|
|
@@ -86,7 +86,7 @@ export interface AbTocProps {
|
|
|
86
86
|
items: AbTocItem[]; // ๐
|
|
87
87
|
activeId?: string | null; // ๐ฏ e.g. from useAbScrollSpy (hooks 0.1.7)
|
|
88
88
|
title?: string; // ๐ท๏ธ default "On this page"
|
|
89
|
-
label?: string; // ๐ท๏ธ 0.1.13 (
|
|
89
|
+
label?: string; // ๐ท๏ธ 0.1.13 (#16): alias of `title`; `title` wins when both are set
|
|
90
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)
|
|
91
91
|
id?: string; // ๐ root id (default "ab-toc"); the title gets `${id}-title`
|
|
92
92
|
className?: string; // ๐ท๏ธ
|
|
@@ -158,5 +158,5 @@ const AbToc = ({ items, activeId, label, title = label ?? 'On this page', onNavi
|
|
|
158
158
|
export default AbToc;
|
|
159
159
|
export { AbToc };
|
|
160
160
|
|
|
161
|
-
// ๐ 0.2.1
|
|
161
|
+
// ๐ 0.2.1: the aside "New" card
|
|
162
162
|
export { AbTocPromo, type AbTocPromoProps } from './promo';
|
package/ab-toc/promo.tsx
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* SOFTWARE.
|
|
25
25
|
*
|
|
26
26
|
* @project: ab-nextjs-components
|
|
27
|
-
* @name: AbTocPromo (0.2.1,
|
|
27
|
+
* @name: AbTocPromo (0.2.1, approved, mock .toc-card)
|
|
28
28
|
* @file: ab-toc/promo.tsx
|
|
29
29
|
* @type: React Component (no hooks: client + server)
|
|
30
30
|
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
@@ -54,7 +54,7 @@ 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 (
|
|
57
|
+
// โฟ 0.3.2 (0.2.23 gaps): the card sits INSIDE the page aside, so by default its root is a plain <div> (no
|
|
58
58
|
// unnamed nested <aside> landmark). With `label` it becomes a NAMED <aside aria-label={label}> instead
|
|
59
59
|
label?: string;
|
|
60
60
|
className?: string; // ๐ท๏ธ
|
package/ab-toc/styles.module.css
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
.abTocFooter a svg { flex: none; width: 15px; height: 15px; color: var(--ab-color-faint, inherit); } /* ๐ฃ GitHub ยท north_east */
|
|
66
66
|
.abTocFooter > ul { list-style: none; margin: 0; padding: 0; }
|
|
67
67
|
|
|
68
|
-
/* ๐ 0.2.1
|
|
68
|
+
/* ๐ 0.2.1: AbTocPromo, the aside "New" card (mock .toc-card), theme tokens only */
|
|
69
69
|
.abTocPromo {
|
|
70
70
|
position: relative; /* ๐ the stretched link */
|
|
71
71
|
display: flex; flex-direction: column; align-items: flex-start; gap: 6px; /* ๐ */
|
package/ab-toc-drawer/index.tsx
CHANGED
|
@@ -77,7 +77,7 @@ export interface AbTocDrawerProps {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
* โก๏ธ AbTocDrawer โ
|
|
80
|
+
* โก๏ธ AbTocDrawer โ the right drawer (drawers v2 ยง3): the page aside ("On this page") on mobile.
|
|
81
81
|
*
|
|
82
82
|
* - ๐งญ Only for routes whose layout has an aside: render it (and enable the right edge swipe) there, nowhere else
|
|
83
83
|
* - ๐ 296px, 16 0 0 16 radius, title Mulish 800 20px; 44px outline rows on a 2px rail, level 3 indented 16px,
|
|
@@ -62,7 +62,7 @@ export interface AbVersionOption {
|
|
|
62
62
|
|
|
63
63
|
/** โ๏ธ props */
|
|
64
64
|
export interface AbVersionSwitcherProps {
|
|
65
|
-
label?: string; // ๐ท๏ธ text before the version; default none (0.2.0,
|
|
65
|
+
label?: string; // ๐ท๏ธ text before the version; default none (0.2.0, the app IS the docs, so no "Docs" prefix)
|
|
66
66
|
version: string; // โ
current version (shown bold), e.g. 'v0.2.x'
|
|
67
67
|
versions?: readonly AbVersionOption[]; // ๐ the choices (none / one = a static label, no menu)
|
|
68
68
|
onSelect?: (value: string) => void; // ๐ฃ button items
|
|
@@ -80,7 +80,7 @@ const AbVersionSwitcher = ({ label = '', version, versions = [], onSelect, menuL
|
|
|
80
80
|
const menuId = `ab-version-menu-${useId().replace(/:/g, '')}`; // ๐
|
|
81
81
|
const wrap = useRef<HTMLDivElement>(null); // ๐
|
|
82
82
|
const btn = useRef<HTMLButtonElement>(null); // ๐
|
|
83
|
-
const name = menuLabel ?? (label ? `${label} ${version}` : `Version ${version}`); // โฟ WCAG 2.5.3 label-in-name
|
|
83
|
+
const name = menuLabel ?? (label ? `${label} ${version}` : `Version ${version}`); // โฟ WCAG 2.5.3 label-in-name; no label โ "Version v0.2.x" (P2, still contains the visible text)
|
|
84
84
|
const hasMenu = versions.length > 1; // ๐
|
|
85
85
|
|
|
86
86
|
// โ Escape + outside click close it
|
package/css/dialog.css
CHANGED
|
@@ -138,7 +138,7 @@ li.dialog-list-item {
|
|
|
138
138
|
transform-origin: left;
|
|
139
139
|
opacity: var(--opacity-dialog-list-item, 0.68);
|
|
140
140
|
user-select: none;
|
|
141
|
-
/* โ ๏ธ named motion exception (
|
|
141
|
+
/* โ ๏ธ named motion exception (review): consumer-rendered markup, no component can add an ab-motion-* class; pinned in __tests__/motion-from-animations.test.tsx */
|
|
142
142
|
transition: all 0.2s ease-in-out;
|
|
143
143
|
}
|
|
144
144
|
|
package/index.ts
CHANGED
|
@@ -80,8 +80,9 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
|
|
|
80
80
|
{ name: 'AbText', file: 'ab-text/index.tsx', kind: 'client', status: 'Done' },
|
|
81
81
|
{ name: 'AbProduct', file: 'ab-product/index.tsx', kind: 'client', status: 'Done' },
|
|
82
82
|
{ name: 'AbProductItem', file: 'ab-product-item/index.tsx', kind: 'client', status: 'Done' },
|
|
83
|
-
{ name: 'AbDemoBox', file: 'ab-demo-box/index.tsx', kind: '
|
|
84
|
-
{ name: 'AbDemoCode', file: 'ab-demo-code/index.tsx', kind: '
|
|
83
|
+
{ name: 'AbDemoBox', file: 'ab-demo-box/index.tsx', kind: 'server', status: 'Done' },
|
|
84
|
+
{ name: 'AbDemoCode', file: 'ab-demo-code/index.tsx', kind: 'server', status: 'Done' },
|
|
85
|
+
{ name: 'AbPreviewCode', file: 'ab-preview-code/index.tsx', kind: 'server', status: 'Done' }, // ๐งช๐ป 0.6.0 (G16): the docs Preview / Code pair
|
|
85
86
|
|
|
86
87
|
// SERVER
|
|
87
88
|
{ name: 'AbIcon', file: 'server/ab-icon/index.tsx', kind: 'server', status: 'Done' },
|
|
@@ -142,11 +143,11 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
|
|
|
142
143
|
{ name: 'AbProfileAvatar', file: 'ab-profile-avatar/index.tsx', kind: 'server', status: 'Done' }, // ๐ 0.2.1 initials / photo / glyph circle (no hooks: client + server)
|
|
143
144
|
{ name: 'AbVersionSwitcher', file: 'ab-version-switcher/index.tsx', kind: 'client', status: 'Done' },
|
|
144
145
|
{ name: 'AbBreadcrumbs', file: 'ab-breadcrumbs/index.tsx', kind: 'server', status: 'Done' },
|
|
145
|
-
{ name: 'AbDocPager', file: 'ab-doc-pager/index.tsx', kind: 'server', status: 'Done' }, // โฎ๏ธโญ๏ธ 0.3.4 (
|
|
146
|
-
{ name: 'AbContentTabs', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // ๐๏ธ 0.3.4 (
|
|
147
|
-
{ name: 'AbContentTab', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // ๐๏ธ 0.3.4 (
|
|
148
|
-
{ name: 'AbCodeBlock', file: 'ab-code-block/index.tsx', kind: 'server', status: 'Done' }, // ๐ป 0.3.4 (
|
|
149
|
-
{ name: 'AbCallout', file: 'ab-callout/index.tsx', kind: 'server', status: 'Done' }, // ๐ก 0.3.4 (
|
|
146
|
+
{ name: 'AbDocPager', file: 'ab-doc-pager/index.tsx', kind: 'server', status: 'Done' }, // โฎ๏ธโญ๏ธ 0.3.4 (0.2.24 MDX docs): AbDocPager
|
|
147
|
+
{ name: 'AbContentTabs', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // ๐๏ธ 0.3.4 (0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
|
|
148
|
+
{ name: 'AbContentTab', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // ๐๏ธ 0.3.4 (0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
|
|
149
|
+
{ name: 'AbCodeBlock', file: 'ab-code-block/index.tsx', kind: 'server', status: 'Done' }, // ๐ป 0.3.4 (0.2.24 MDX docs): AbCodeBlock (+ its copy island)
|
|
150
|
+
{ name: 'AbCallout', file: 'ab-callout/index.tsx', kind: 'server', status: 'Done' }, // ๐ก 0.3.4 (0.2.24 MDX docs): AbCallout
|
|
150
151
|
{ name: 'AbList', file: 'ab-list/index.tsx', kind: 'server', status: 'Done' },
|
|
151
152
|
]
|
|
152
153
|
|
|
@@ -184,12 +185,15 @@ export { default as AbBrand } from './ab-brand/index.tsx'
|
|
|
184
185
|
export { default as AbName } from './ab-name/index.tsx'
|
|
185
186
|
export { default as AbNavbar } from './ab-navbar/index.tsx'
|
|
186
187
|
export { default as AbSidebar } from './ab-sidebar/index.tsx'
|
|
187
|
-
//
|
|
188
|
+
// ๐ฏ 0.5.0: active-item matching shared by AbSidebar + AbNavDrawer (`activeMatch`, per-item `exact`)
|
|
189
|
+
export { getAbActiveHrefs, matchAbHref, normalizeAbHref, flattenAbNavItems } from './ab-sidebar/active.ts'
|
|
190
|
+
export type { AbActiveMatch, AbActiveMatchable, AbActiveMatchOptions } from './ab-sidebar/active.ts'
|
|
191
|
+
// ๐ค 0.2.1: the bottom-left sidebar profile button โ AbSettingsDrawer (laptop + wide)
|
|
188
192
|
export { default as AbSidebarProfileButton } from './ab-sidebar/profile-button.tsx'
|
|
189
193
|
export type { AbSidebarProfileButtonProps } from './ab-sidebar/profile-button.tsx'
|
|
190
|
-
// ๐ 0.1.13
|
|
194
|
+
// ๐ 0.1.13: AbToc + the panes main-scroller helpers (also at `ab-nextjs-components/ab-toc`)
|
|
191
195
|
export { default as AbToc, getAbMainScroller, AB_MAIN_SCROLLER_SELECTOR } from './ab-toc/index.tsx'
|
|
192
|
-
// ๐ 0.2.1
|
|
196
|
+
// ๐ 0.2.1: the aside "New" card
|
|
193
197
|
export { default as AbTocPromo } from './ab-toc/promo.tsx'
|
|
194
198
|
export type { AbTocPromoProps } from './ab-toc/promo.tsx'
|
|
195
199
|
export type { AbTocItem, AbTocProps } from './ab-toc/index.tsx'
|
|
@@ -197,7 +201,7 @@ export type { AbTocItem, AbTocProps } from './ab-toc/index.tsx'
|
|
|
197
201
|
export { default as AbErrorHero } from './ab-error-hero/index.tsx'
|
|
198
202
|
export type { AbErrorHeroProps } from './ab-error-hero/index.tsx'
|
|
199
203
|
// ๐๏ธ 0.1.14 (G53): AbDrawer + useAbDrawer (also at `ab-nextjs-components/ab-drawer`)
|
|
200
|
-
export { default as AbDrawer, useAbDrawer, getAbDrawerHost, AB_DRAWER_DURATION, AB_DRAWER_RETURN_FOCUS } from './ab-drawer/index.tsx'
|
|
204
|
+
export { default as AbDrawer, useAbDrawer, getAbDrawerHost, AB_DRAWER_DURATION, AB_DRAWER_RETURN_FOCUS, AB_PREVIEW_SCOPE_SELECTOR } from './ab-drawer/index.tsx'
|
|
201
205
|
// ๐ค 0.2.0 drawers v2: edge swipes + the swipe / snap rules
|
|
202
206
|
export { useAbEdgeSwipe, AB_ASIDE_DRAWER_MAX_WIDTH, AB_SWIPE, resolveAbSheetRelease, resolveAbSideRelease } from './ab-drawer/index.tsx'
|
|
203
207
|
export type { AbDrawerTier, AbSheetSnap, UseAbEdgeSwipeOptions } from './ab-drawer/index.tsx'
|
|
@@ -209,14 +213,14 @@ export type { AbConfirmDrawerProps } from './ab-confirm-drawer/index.tsx'
|
|
|
209
213
|
// ๐ฑ 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
|
|
210
214
|
export { default as AbBottomDrawer } from './ab-bottom-drawer/index.tsx'
|
|
211
215
|
export type { AbBottomDrawerProps } from './ab-bottom-drawer/index.tsx'
|
|
212
|
-
// ๐ 0.2.3 (
|
|
216
|
+
// ๐ 0.2.3 (Welcome 0.2.21): swipe a bottom sheet down to close
|
|
213
217
|
export { useAbSwipeDown, isAbScrolledInside } from './ab-bottom-drawer/use-ab-swipe-down.ts'
|
|
214
218
|
export type { UseAbSwipeDownOptions } from './ab-bottom-drawer/use-ab-swipe-down.ts'
|
|
215
219
|
// ๐ 0.2.0 drawers v2: AbMobileHeader
|
|
216
220
|
export { default as AbMobileHeader } from './ab-mobile-header/index.tsx'
|
|
217
221
|
export type { AbMobileHeaderProps, AbMobileHeaderThemeMode, AbMobileHeaderLanguage } from './ab-mobile-header/index.tsx'
|
|
218
222
|
export { AB_MOBILE_HEADER_THEME_CYCLE } from './ab-mobile-header/index.tsx' // ๐ 0.2.3
|
|
219
|
-
// ๐ 0.2.3 (
|
|
223
|
+
// ๐ 0.2.3 (Welcome 0.2.21): one shared theme mode for every toggle
|
|
220
224
|
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
|
|
221
225
|
export type { AbThemeModeProviderProps, AbThemeModeContextValue } from './ab-theme-mode/index.tsx'
|
|
222
226
|
// ๐ 0.2.0 drawers v2: AbSearchDrawer
|
|
@@ -247,19 +251,26 @@ export { default as AbText } from './ab-text/index.tsx'
|
|
|
247
251
|
export { default as AbProduct } from './ab-product/index.tsx'
|
|
248
252
|
export { default as AbProductItem } from './ab-product-item/index.tsx'
|
|
249
253
|
export { default as AbDemoBox } from './ab-demo-box/index.tsx'
|
|
254
|
+
export type { AbDemoBoxProps, AbDemoBoxScheme } from './ab-demo-box/index.tsx'
|
|
250
255
|
export { default as AbDemoCode } from './ab-demo-code/index.tsx'
|
|
256
|
+
export type { AbDemoCodeProps } from './ab-demo-code/index.tsx'
|
|
257
|
+
// ๐งช๐ป 0.6.0 (G16): the docs Preview / Code pair (AbContentTabs + AbDemoBox + AbDemoCode)
|
|
258
|
+
export { default as AbPreviewCode } from './ab-preview-code/index.tsx'
|
|
259
|
+
export type { AbPreviewCodeProps, AbPreviewCodeLabels } from './ab-preview-code/index.tsx'
|
|
260
|
+
export { default as AbPreviewStage } from './ab-preview-code/stage.tsx' // ๐งฐ 0.6.0: the preview toolbar island
|
|
261
|
+
export type { AbPreviewStageProps, AbPreviewStageLabels } from './ab-preview-code/stage.tsx'
|
|
251
262
|
export { default as AbPolygon } from './server/ab-polygon/index.tsx'
|
|
252
|
-
// ๐ก 0.3.4 (
|
|
263
|
+
// ๐ก 0.3.4 (0.2.24 MDX docs): AbCallout
|
|
253
264
|
export { default as AbCallout, AB_CALLOUT_ICONS } from './ab-callout/index.tsx'
|
|
254
265
|
export type { AbCalloutProps, AbCalloutVariant } from './ab-callout/index.tsx'
|
|
255
|
-
// ๐ป 0.3.4 (
|
|
266
|
+
// ๐ป 0.3.4 (0.2.24 MDX docs): AbCodeBlock (+ its copy island)
|
|
256
267
|
export { default as AbCodeBlock } from './ab-code-block/index.tsx'
|
|
257
268
|
export { default as AbCodeBlockCopy } from './ab-code-block/copy.tsx'
|
|
258
269
|
export type { AbCodeBlockCopyProps } from './ab-code-block/copy.tsx'
|
|
259
270
|
export type { AbCodeBlockProps } from './ab-code-block/index.tsx'
|
|
260
|
-
// ๐๏ธ 0.3.4 (
|
|
261
|
-
export { default as AbContentTabs, AbContentTab } from './ab-content-tabs/index.tsx'
|
|
271
|
+
// ๐๏ธ 0.3.4 (0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
|
|
272
|
+
export { default as AbContentTabs, AbContentTab, AB_FOCUSABLE_SELECTOR } from './ab-content-tabs/index.tsx' // โจ๏ธ 0.6.0: the panel tab-stop check
|
|
262
273
|
export type { AbContentTabsProps, AbContentTabProps } from './ab-content-tabs/index.tsx'
|
|
263
|
-
// โฎ๏ธโญ๏ธ 0.3.4 (
|
|
274
|
+
// โฎ๏ธโญ๏ธ 0.3.4 (0.2.24 MDX docs): AbDocPager
|
|
264
275
|
export { default as AbDocPager } from './ab-doc-pager/index.tsx'
|
|
265
276
|
export type { AbDocPagerProps, AbDocPagerLink } from './ab-doc-pager/index.tsx'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ab-nextjs-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "๐ A lightweight collection of server & client React components created by Abraham Ukachi, and optimized for Next.js applications ๐.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
"ab-product-item",
|
|
107
107
|
"ab-demo-box",
|
|
108
108
|
"ab-demo-code",
|
|
109
|
+
"ab-preview-code",
|
|
109
110
|
"ab-splash",
|
|
110
111
|
"ab-linear-progress",
|
|
111
112
|
"ab-carousel",
|
|
@@ -227,6 +228,7 @@
|
|
|
227
228
|
"./ab-product-item": "./ab-product-item/index.tsx",
|
|
228
229
|
"./ab-demo-box": "./ab-demo-box/index.tsx",
|
|
229
230
|
"./ab-demo-code": "./ab-demo-code/index.tsx",
|
|
231
|
+
"./ab-preview-code": "./ab-preview-code/index.tsx",
|
|
230
232
|
"./server/ab-brand": "./server/ab-brand/index.tsx",
|
|
231
233
|
"./server/ab-name": "./server/ab-name/index.tsx",
|
|
232
234
|
"./server/ab-navbar": "./server/ab-navbar/index.tsx",
|
|
@@ -43,7 +43,7 @@ import clsx from 'clsx';
|
|
|
43
43
|
// ๐ 404 gaps: the provider-aware link (client component, fine to render from a server twin)
|
|
44
44
|
import AbLink from '../../ab-link';
|
|
45
45
|
// ๐จ styles (server copy)
|
|
46
|
-
// ๐งฌ 0.2.3
|
|
46
|
+
// ๐งฌ 0.2.3: ONE source for the button box โ the client module's CSS (no server copy to drift)
|
|
47
47
|
import styles from '../../ab-button/styles.module.css';
|
|
48
48
|
// ๐งฎ the SAME rules as the client twin
|
|
49
49
|
import {
|
package/server/ab-icon/index.tsx
CHANGED
|
@@ -67,7 +67,7 @@ const AbIcon = ({ name, variant, filled = false, weight, size, label, title, svg
|
|
|
67
67
|
const want: AbIconVariant = variant ?? (filled ? 'filled' : 'outlined');
|
|
68
68
|
// ๐ explicit โ registered โ whole map (weight is applied by CSS, so ask for the raw markup)
|
|
69
69
|
const markup = pickAbIconMarkup(svg ?? getRegisteredAbIcon(name), want) ?? getAbIconSvg(name, want);
|
|
70
|
-
// ๐ one id per rendered instance (
|
|
70
|
+
// ๐ one id per rendered instance (a hidden twin's mask broke the active Home)
|
|
71
71
|
const uid = useId();
|
|
72
72
|
// ๐๏ธ legacy `filled` โ variant
|
|
73
73
|
const v: AbIconVariant = variant ?? (filled ? 'filled' : 'outlined');
|
|
@@ -94,7 +94,7 @@ const AbIcon = ({ name, variant, filled = false, weight, size, label, title, svg
|
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
// ๐ฐ๏ธ 0.1.13 (
|
|
97
|
+
// ๐ฐ๏ธ 0.1.13 (review): NON-breaking fallback for unregistered names. A patch must not blank icons,
|
|
98
98
|
// so an unknown name still renders the pre-G2 Material Symbols ligature (needs the app's font), and
|
|
99
99
|
// warns once in development so the missing registration gets fixed before the app drops the font.
|
|
100
100
|
warnAbIconMissing(name);
|