ab-nextjs-components 0.1.13 โ†’ 0.2.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +35 -0
  3. package/ab-app-bar/index.tsx +53 -13
  4. package/ab-app-bar/styles.module.css +68 -4
  5. package/ab-bottom-drawer/index.tsx +71 -0
  6. package/ab-bottom-drawer/styles.module.css +66 -0
  7. package/ab-breadcrumbs/index.tsx +92 -0
  8. package/ab-breadcrumbs/styles.module.css +54 -0
  9. package/ab-button/helpers.ts +6 -1
  10. package/ab-button/index.tsx +8 -2
  11. package/ab-button/styles.module.css +39 -0
  12. package/ab-card/styles.module.css +1 -1
  13. package/ab-carousel/styles.module.css +1 -1
  14. package/ab-chip/index.tsx +16 -4
  15. package/ab-chip/styles.module.css +12 -1
  16. package/ab-confirm-drawer/index.tsx +97 -0
  17. package/ab-confirm-drawer/styles.module.css +41 -0
  18. package/ab-drawer/gestures.ts +134 -0
  19. package/ab-drawer/index.tsx +458 -0
  20. package/ab-drawer/kit.module.css +204 -0
  21. package/ab-drawer/styles.module.css +166 -0
  22. package/ab-drawer/use-ab-drawer.ts +89 -0
  23. package/ab-drawer/use-ab-edge-swipe.ts +155 -0
  24. package/ab-drawer-list/index.tsx +118 -0
  25. package/ab-drawer-list/styles.module.css +65 -0
  26. package/ab-flow-diagram/styles.module.css +2 -2
  27. package/ab-icon/builtin.ts +4 -0
  28. package/ab-icon-button/index.tsx +13 -2
  29. package/ab-icon-button/styles.module.css +1 -1
  30. package/ab-install-snippet/index.tsx +51 -29
  31. package/ab-install-snippet/styles.module.css +34 -2
  32. package/ab-kbd/styles.module.css +1 -1
  33. package/ab-list/index.tsx +107 -0
  34. package/ab-list/styles.module.css +82 -0
  35. package/ab-locale-switcher/index.tsx +103 -10
  36. package/ab-locale-switcher/styles.module.css +24 -4
  37. package/ab-mobile-header/index.tsx +100 -0
  38. package/ab-nav-drawer/index.tsx +158 -0
  39. package/ab-navbar/index.tsx +1 -1
  40. package/ab-navbar/styles.module.css +20 -2
  41. package/ab-navbar/view.tsx +7 -4
  42. package/ab-package-card/index.tsx +49 -2
  43. package/ab-package-card/styles.module.css +40 -0
  44. package/ab-search-drawer/index.tsx +279 -0
  45. package/ab-search-trigger/index.tsx +22 -2
  46. package/ab-search-trigger/styles.module.css +30 -1
  47. package/ab-settings-drawer/index.tsx +160 -0
  48. package/ab-sidebar/index.tsx +6 -3
  49. package/ab-sidebar/styles.module.css +53 -5
  50. package/ab-sidebar/view.tsx +18 -4
  51. package/ab-theme-toggle/index.tsx +21 -6
  52. package/ab-theme-toggle/styles.module.css +18 -3
  53. package/ab-toc/index.tsx +9 -2
  54. package/ab-toc/styles.module.css +20 -8
  55. package/ab-toc-drawer/index.tsx +129 -0
  56. package/ab-version-switcher/index.tsx +143 -0
  57. package/ab-version-switcher/styles.module.css +76 -0
  58. package/index.ts +50 -0
  59. package/package.json +28 -3
  60. package/server/ab-button/index.tsx +6 -2
  61. package/server/ab-button/styles.module.css +39 -0
  62. package/types/index.d.ts +37 -0
@@ -0,0 +1,129 @@
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: AbTocDrawer
28
+ * @file: ab-toc-drawer/index.tsx
29
+ * @type: Client component
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ *
32
+ * Example usage:
33
+ * 1+|> useAbEdgeSwipe({ edge: 'right', onOpen: () => setToc(true), enabled: hasAside && !toc })
34
+ * -|> <AbTocDrawer open={toc} onClose={() => setToc(false)} items={outline} activeId={spy}
35
+ * -|> onNavigate={(id) => scrollToAbSection(id)} links={[{ href: editUrl, label: 'Edit this page', icon: 'github' }]} />
36
+ */
37
+
38
+ /*
39
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
41
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
42
+ */
43
+
44
+
45
+ 'use client';
46
+
47
+ // โš›๏ธ React
48
+ import type { MouseEvent, ReactElement } from 'react';
49
+ // ๐Ÿงต classes
50
+ import clsx from 'clsx';
51
+ // ๐Ÿ—„๏ธ the drawer
52
+ import AbDrawer from '../ab-drawer';
53
+ // ๐Ÿ”ฃ icons
54
+ import AbIcon from '../ab-icon';
55
+ // ๐Ÿ”— the app's link
56
+ import Link from '../ab-link';
57
+ // ๐Ÿ“‘ the outline item type (shared with AbToc)
58
+ import type { AbTocItem } from '../ab-toc';
59
+ // ๐ŸŽจ the drawers v2 kit
60
+ import kit from '../ab-drawer/kit.module.css';
61
+
62
+ /** ๐Ÿ”— a row under the outline (Edit this page, Changelog) */
63
+ export interface AbTocDrawerLink { href: string; label: string; icon?: string; external?: boolean }
64
+
65
+ /** โš™๏ธ props */
66
+ export interface AbTocDrawerProps {
67
+ open: boolean; // ๐Ÿšช
68
+ onClose: () => void; // โŽ‹ scrim, Esc, โœ•, a left-to-right swipe, or choosing a heading
69
+ items: readonly AbTocItem[]; // ๐Ÿ“‘ the page outline (level 2 / 3 / 4)
70
+ activeId?: string | null; // ๐ŸŽฏ e.g. from useAbScrollSpy (hooks 0.1.7)
71
+ onNavigate?: (id: string) => void; // ๐Ÿ”” scroll there (e.g. scrollToAbSection); without it a plain #id jump. The drawer closes after
72
+ links?: readonly AbTocDrawerLink[]; // ๐Ÿ”— below a divider
73
+ labels?: { title?: string; close?: string }; // ๐ŸŒ "On this page", "Close outline"
74
+ returnFocus?: string; // โ†ฉ๏ธ after a swipe-open
75
+ id?: string; // ๐Ÿ†”
76
+ className?: string; // ๐Ÿท๏ธ
77
+ }
78
+
79
+ /**
80
+ * โžก๏ธ AbTocDrawer โ€” John's right drawer (drawers v2 ยง3): the page aside ("On this page") on mobile.
81
+ *
82
+ * - ๐Ÿงญ Only for routes whose layout has an aside: render it (and enable the right edge swipe) there, nowhere else
83
+ * - ๐Ÿ“ 296px, 16 0 0 16 radius, title Mulish 800 20px; 44px outline rows on a 2px rail, level 3 indented 16px,
84
+ * the active one bronze with `aria-current="location"`; then a divider and the links
85
+ * - ๐Ÿค opens with `useAbEdgeSwipe({ edge: 'right' })` or an "On this page" chip; closes with a left-to-right swipe
86
+ * - ๐Ÿฅž tier 'aside': one level below the left drawer
87
+ */
88
+ const AbTocDrawer = ({ open, onClose, items, activeId, onNavigate, links = [], labels = {}, returnFocus, id = 'ab-toc-drawer', className }: AbTocDrawerProps): ReactElement => {
89
+ const L = { title: 'On this page', close: 'Close outline', ...labels }; // ๐ŸŒ
90
+ const go = (target: string) => (e: MouseEvent) => {
91
+ if (onNavigate) { e.preventDefault(); onNavigate(target); } // ๐Ÿ“œ the app scrolls
92
+ onClose(); // ๐Ÿšช then close
93
+ };
94
+ return (
95
+ <AbDrawer
96
+ open={open} onClose={onClose} id={id} side="right" scope="app" tier="aside" swipe size="296px"
97
+ title={L.title} closeLabel={L.close} closeIcon={<AbIcon name="close" size={24} />}
98
+ initialFocus="panel" returnFocus={returnFocus} // ๐ŸŽฏ the sheet itself (WebKit drew a focus ring on the active row; Tab then enters)
99
+ className={clsx('AbTocDrawer', kit.sheet, kit.titleSm, className)}
100
+ >
101
+ <nav aria-labelledby={`${id}-title`} data-ab-part="toc-drawer-nav">
102
+ <ol className={kit.toc}>
103
+ {items.map((it) => {
104
+ const on = it.id === activeId; // ๐ŸŽฏ
105
+ return (
106
+ <li key={it.id}>
107
+ <a href={`#${it.id}`} className={kit.tocLink} data-level={it.level ?? 2} aria-current={on ? 'location' : undefined} onClick={go(it.id)}>{it.label}</a>
108
+ </li>
109
+ );
110
+ })}
111
+ </ol>
112
+ </nav>
113
+ {links.length > 0 && (
114
+ <>
115
+ <hr className={clsx(kit.hr, kit.tocHr)} />
116
+ {links.map((l) => (
117
+ <Link key={l.href} href={l.href} className={clsx(kit.row, kit.tocRow)} {...(l.external ? { target: '_blank', rel: 'noreferrer' } : {})} onClick={onClose}>
118
+ {l.icon && <AbIcon name={l.icon} size={24} />}<span>{l.label}</span>
119
+ </Link>
120
+ ))}
121
+ </>
122
+ )}
123
+ </AbDrawer>
124
+ );
125
+ };
126
+
127
+ // ๐Ÿ“ฆ exports
128
+ export default AbTocDrawer;
129
+ export { AbTocDrawer };
@@ -0,0 +1,143 @@
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: AbVersionSwitcher (P9)
28
+ * @file: ab-version-switcher/index.tsx
29
+ * @type: Client component
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ *
32
+ * Example usage:
33
+ * 1+|> <AbVersionSwitcher version="v0.2.x" versions={[{ value: "v0.2.x", href: "/" }, { value: "v0.1.x", href: "/v0.1" }]} />
34
+ */
35
+
36
+ /*
37
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
38
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
39
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40
+ */
41
+
42
+
43
+ 'use client';
44
+
45
+ // โš›๏ธ React
46
+ import { useEffect, useId, useRef, useState, type ReactElement } from 'react';
47
+ // ๐Ÿงต classes
48
+ import clsx from 'clsx';
49
+ // ๐Ÿ”ฃ icons
50
+ import AbIcon from '../ab-icon';
51
+ // ๐Ÿ“‹ the menu it opens (spec ยง5: "opens AbMenu")
52
+ import AbMenu from '../ab-menu';
53
+ // ๐ŸŽจ styles
54
+ import styles from './styles.module.css';
55
+
56
+ /** ๐Ÿท๏ธ one version */
57
+ export interface AbVersionOption {
58
+ value: string; // ๐Ÿ†” e.g. 'v0.2.x'
59
+ label?: string; // ๐Ÿท๏ธ menu text (default: value)
60
+ href?: string; // ๐Ÿ”— real navigation (works without JS via the <details> fallback)
61
+ }
62
+
63
+ /** โš™๏ธ props */
64
+ export interface AbVersionSwitcherProps {
65
+ label?: string; // ๐Ÿท๏ธ text before the version; default none (0.2.0, God 01:27: the app IS the docs, so no "Docs" prefix)
66
+ version: string; // โœ… current version (shown bold), e.g. 'v0.2.x'
67
+ versions?: readonly AbVersionOption[]; // ๐Ÿ“‹ the choices (none / one = a static label, no menu)
68
+ onSelect?: (value: string) => void; // ๐Ÿ“ฃ button items
69
+ menuLabel?: string; // โ™ฟ accessible name of the trigger (default "{label} {version}": contains the visible text, WCAG 2.5.3)
70
+ className?: string; // ๐Ÿท๏ธ
71
+ }
72
+
73
+ /**
74
+ * ๐Ÿท๏ธ AbVersionSwitcher (P9): the sidebar's "Docs **v0.2.x** โ–พ" control. 28px, 8px radius, hairline border,
75
+ * card background, 16px `expand_more`; opens an AbMenu below it (Escape / outside click close, focus returns).
76
+ * JS off: with `href`s it's a native `<details>` list of links.
77
+ */
78
+ const AbVersionSwitcher = ({ label = '', version, versions = [], onSelect, menuLabel, className }: AbVersionSwitcherProps): ReactElement => {
79
+ const [open, setOpen] = useState(false); // ๐Ÿšช
80
+ const menuId = `ab-version-menu-${useId().replace(/:/g, '')}`; // ๐Ÿ†”
81
+ const wrap = useRef<HTMLDivElement>(null); // ๐Ÿ“
82
+ const btn = useRef<HTMLButtonElement>(null); // ๐Ÿ“
83
+ const name = menuLabel ?? (label ? `${label} ${version}` : `Version ${version}`); // โ™ฟ WCAG 2.5.3 label-in-name (James); no label โ†’ "Version v0.2.x" (James P2, still contains the visible text)
84
+ const hasMenu = versions.length > 1; // ๐Ÿ“‹
85
+
86
+ // โŽ‹ Escape + outside click close it
87
+ useEffect(() => {
88
+ if (!open) return;
89
+ const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') { setOpen(false); btn.current?.focus(); } }; // โŽ‹ + โ†ฉ๏ธ
90
+ const onDown = (e: PointerEvent) => { if (!wrap.current?.contains(e.target as Node)) setOpen(false); }; // ๐Ÿ‘‹
91
+ document.addEventListener('keydown', onKey);
92
+ document.addEventListener('pointerdown', onDown);
93
+ return () => { document.removeEventListener('keydown', onKey); document.removeEventListener('pointerdown', onDown); };
94
+ }, [open]);
95
+
96
+ // ๐Ÿงฑ the visible face (same for button, static label and no-JS summary)
97
+ const face = (
98
+ <>
99
+ {label && <><span>{label}</span> </>}<b className={styles.abVersionValue}>{version}</b>
100
+ {hasMenu && <AbIcon name="expand_more" size={16} className={styles.abVersionIcon} />}
101
+ </>
102
+ );
103
+
104
+ if (!hasMenu) return <span className={clsx('AbVersionSwitcher', styles.abVersion, className)} data-ab-part="version-switcher">{face}</span>; // ๐Ÿท๏ธ static
105
+
106
+ const linksOnly = versions.every((v) => v.href); // ๐Ÿ”— can it work without JS?
107
+ return (
108
+ <div ref={wrap} className={clsx('AbVersionSwitcher', styles.abVersionRoot, className)} data-ab-part="version-switcher">
109
+ <button
110
+ ref={btn}
111
+ type="button"
112
+ className={clsx(styles.abVersion, linksOnly && styles.abVersionJs)}
113
+ aria-label={name}
114
+ aria-haspopup="menu"
115
+ aria-expanded={open}
116
+ aria-controls={menuId}
117
+ onClick={() => setOpen((o) => !o)}
118
+ >
119
+ {face}
120
+ </button>
121
+ <AbMenu
122
+ id={menuId}
123
+ hidden={!open}
124
+ isActive={open}
125
+ className={styles.abVersionMenu}
126
+ items={versions.map((v) => ({ id: v.value, label: v.label ?? v.value, href: v.href, selected: v.value === version, onClick: () => { onSelect?.(v.value); setOpen(false); } }))}
127
+ />
128
+ {/* ๐Ÿšซ JS off: a native <details> of links (CSS shows it only under scripting: none) */}
129
+ {linksOnly && (
130
+ <details className={styles.abVersionNoJs} data-ab-part="version-switcher-nojs">
131
+ <summary className={styles.abVersion} aria-label={name}>{face}</summary>
132
+ <ul className={styles.abVersionNoJsList}>
133
+ {versions.map((v) => <li key={v.value}><a href={v.href} aria-current={v.value === version ? 'page' : undefined}>{v.label ?? v.value}</a></li>)}
134
+ </ul>
135
+ </details>
136
+ )}
137
+ </div>
138
+ );
139
+ };
140
+
141
+ // ๐Ÿ“ฆ exports
142
+ export default AbVersionSwitcher;
143
+ export { AbVersionSwitcher };
@@ -0,0 +1,76 @@
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: AbVersionSwitcher styles
28
+ * @file: ab-version-switcher/styles.module.css
29
+ * @type: CSS module
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
39
+
40
+ /* ๐ŸŽš๏ธ knobs (defaults = the approved mock, mapped onto today's theme tokens) */
41
+ .abVersion, .abVersionRoot {
42
+ --ab-version-height: 28px; /* ๐Ÿ“ */
43
+ --ab-version-radius: 8px; /* โญ• */
44
+ --ab-version-background: var(--ab-color-card, var(--md-sys-color-surface-container-lowest, #fff)); /* ๐ŸŽจ --card */
45
+ --ab-version-border: var(--ab-color-border, var(--ab-color-outline-variant, rgb(92 64 48 / 0.13))); /* โž– --border */
46
+ --ab-version-color: var(--ab-color-muted, var(--ab-color-on-surface-variant, #6b5b50)); /* ๐Ÿ–‹๏ธ --muted */
47
+ --ab-version-strong: var(--ab-color-text, var(--ab-color-on-surface, #211a16)); /* ๐Ÿ–‹๏ธ --text */
48
+ --ab-version-hover: var(--ab-color-hover, color-mix(in srgb, var(--ab-color-bronze, #a67c52) 8%, transparent)); /* ๐Ÿ–ฑ๏ธ --hover */
49
+ --ab-version-ring: var(--ab-color-accent, var(--ab-color-bronze, #a67c52)); /* โ™ฟ --accent */
50
+ }
51
+ .abVersionRoot { position: relative; display: inline-block; } /* ๐Ÿ“ menu anchor */
52
+ .abVersion {
53
+ display: inline-flex; align-items: center; gap: 4px; /* ๐Ÿ“ */
54
+ box-sizing: border-box; height: var(--ab-version-height); padding: 0 6px 0 10px; /* ๐Ÿ“ฆ */
55
+ border: 1px solid var(--ab-version-border); border-radius: var(--ab-version-radius); /* โž– */
56
+ background: var(--ab-version-background); color: var(--ab-version-color); /* ๐ŸŽจ */
57
+ font: inherit; font-size: 12px; line-height: 1; white-space: nowrap; /* ๐Ÿ”ค */
58
+ cursor: pointer; list-style: none; /* ๐Ÿ–ฑ๏ธ (summary: no marker) */
59
+ }
60
+ .abVersion::-webkit-details-marker { display: none; } /* ๐Ÿงน */
61
+ span.abVersion { cursor: default; } /* ๐Ÿท๏ธ static */
62
+ .abVersion:hover { background: linear-gradient(var(--ab-version-hover), var(--ab-version-hover)), var(--ab-version-background); } /* ๐Ÿ–ฑ๏ธ */
63
+ .abVersion:focus-visible { outline: 2px solid var(--ab-version-ring); outline-offset: 2px; } /* โ™ฟ */
64
+ .abVersionValue { color: var(--ab-version-strong); font-weight: 650; } /* ๐Ÿ’ช */
65
+ .abVersionIcon { width: 16px; height: 16px; } /* โ–พ */
66
+ .abVersionMenu[hidden] { display: none; } /* ๐Ÿ™ˆ AbMenu's own display would beat [hidden] */
67
+ .abVersionMenu { position: absolute; inset-block-start: calc(100% + 4px); inset-inline-start: 0; z-index: 20; min-width: 160px; } /* ๐Ÿ“‹ */
68
+
69
+ /* ๐Ÿšซ no-JS: the details list replaces the button */
70
+ .abVersionNoJs { display: none; }
71
+ .abVersionNoJsList { list-style: none; margin: 4px 0 0; padding: 4px; border: 1px solid var(--ab-version-border); border-radius: 8px; background: var(--ab-version-background); font-size: 13px; }
72
+ .abVersionNoJsList a { display: block; padding: 6px 8px; color: inherit; text-decoration: none; }
73
+ @media (scripting: none) {
74
+ .abVersionJs, .abVersionMenu { display: none; }
75
+ .abVersionNoJs { display: block; }
76
+ }
package/index.ts CHANGED
@@ -130,6 +130,19 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
130
130
  { name: 'AbPackageCard', file: 'ab-package-card/index.tsx', kind: 'server', status: 'Done' },
131
131
  // ๐Ÿ†• 0.1.13 docs shell (AbToc) โ€” server-safe, no hooks
132
132
  { name: 'AbToc', file: 'ab-toc/index.tsx', kind: 'server', status: 'Done' },
133
+ // ๐Ÿ†• 0.1.14 (G53): AbDrawer + presets
134
+ { name: 'AbDrawer', file: 'ab-drawer/index.tsx', kind: 'client', status: 'Done' },
135
+ { name: 'AbDrawerList', file: 'ab-drawer-list/index.tsx', kind: 'client', status: 'Done' },
136
+ { name: 'AbConfirmDrawer', file: 'ab-confirm-drawer/index.tsx', kind: 'client', status: 'Done' },
137
+ { name: 'AbBottomDrawer', file: 'ab-bottom-drawer/index.tsx', kind: 'client', status: 'Done' },
138
+ { name: 'AbMobileHeader', file: 'ab-mobile-header/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ†• 0.2.0 drawers v2
139
+ { name: 'AbSearchDrawer', file: 'ab-search-drawer/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ†• 0.2.0 drawers v2
140
+ { name: 'AbTocDrawer', file: 'ab-toc-drawer/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ†• 0.2.0 drawers v2
141
+ { name: 'AbNavDrawer', file: 'ab-nav-drawer/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ†• 0.2.0 drawers v2
142
+ { name: 'AbSettingsDrawer', file: 'ab-settings-drawer/index.tsx', kind: 'client', status: 'Done' }, // ๐Ÿ†• 0.2.0 drawers v2
143
+ { name: 'AbVersionSwitcher', file: 'ab-version-switcher/index.tsx', kind: 'client', status: 'Done' },
144
+ { name: 'AbBreadcrumbs', file: 'ab-breadcrumbs/index.tsx', kind: 'server', status: 'Done' },
145
+ { name: 'AbList', file: 'ab-list/index.tsx', kind: 'server', status: 'Done' },
133
146
  ]
134
147
 
135
148
  const abComponents = { supportedComponents }
@@ -169,6 +182,43 @@ export { default as AbSidebar } from './ab-sidebar/index.tsx'
169
182
  // ๐Ÿ“‘ 0.1.13 (Joseph): AbToc + the panes main-scroller helpers (also at `ab-nextjs-components/ab-toc`)
170
183
  export { default as AbToc, getAbMainScroller, AB_MAIN_SCROLLER_SELECTOR } from './ab-toc/index.tsx'
171
184
  export type { AbTocItem, AbTocProps } from './ab-toc/index.tsx'
185
+ // ๐Ÿ—„๏ธ 0.1.14 (G53): AbDrawer + useAbDrawer (also at `ab-nextjs-components/ab-drawer`)
186
+ export { default as AbDrawer, useAbDrawer, getAbDrawerHost, AB_DRAWER_DURATION } from './ab-drawer/index.tsx'
187
+ // ๐Ÿค 0.2.0 drawers v2: edge swipes + the swipe / snap rules
188
+ export { useAbEdgeSwipe, AB_SWIPE, resolveAbSheetRelease, resolveAbSideRelease } from './ab-drawer/index.tsx'
189
+ export type { AbDrawerTier, AbSheetSnap, UseAbEdgeSwipeOptions } from './ab-drawer/index.tsx'
190
+ export type { AbDrawerProps, AbDrawerSide, AbDrawerScope, UseAbDrawer } from './ab-drawer/index.tsx'
191
+ export { default as AbDrawerList } from './ab-drawer-list/index.tsx'
192
+ export type { AbDrawerListItem, AbDrawerListProps } from './ab-drawer-list/index.tsx'
193
+ export { default as AbConfirmDrawer } from './ab-confirm-drawer/index.tsx'
194
+ export type { AbConfirmDrawerProps } from './ab-confirm-drawer/index.tsx'
195
+ // ๐Ÿ“ฑ 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
196
+ export { default as AbBottomDrawer } from './ab-bottom-drawer/index.tsx'
197
+ export type { AbBottomDrawerProps } from './ab-bottom-drawer/index.tsx'
198
+ // ๐Ÿ†• 0.2.0 drawers v2: AbMobileHeader
199
+ export { default as AbMobileHeader } from './ab-mobile-header/index.tsx'
200
+ export type { AbMobileHeaderProps } from './ab-mobile-header/index.tsx'
201
+ // ๐Ÿ†• 0.2.0 drawers v2: AbSearchDrawer
202
+ export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY } from './ab-search-drawer/index.tsx'
203
+ export type { AbSearchDrawerProps, AbSearchDrawerItem, AbSearchDrawerGroup, AbSearchDrawerLabels } from './ab-search-drawer/index.tsx'
204
+ // ๐Ÿ†• 0.2.0 drawers v2: AbTocDrawer
205
+ export { default as AbTocDrawer } from './ab-toc-drawer/index.tsx'
206
+ export type { AbTocDrawerProps, AbTocDrawerLink } from './ab-toc-drawer/index.tsx'
207
+ // ๐Ÿ†• 0.2.0 drawers v2: AbNavDrawer
208
+ export { default as AbNavDrawer } from './ab-nav-drawer/index.tsx'
209
+ export type { AbNavDrawerProps, AbNavDrawerItem, AbNavDrawerSection } from './ab-nav-drawer/index.tsx'
210
+ // ๐Ÿ†• 0.2.0 drawers v2: AbSettingsDrawer
211
+ export { default as AbSettingsDrawer } from './ab-settings-drawer/index.tsx'
212
+ export type { AbSettingsDrawerProps, AbSettingsDrawerLabels, AbSettingsLocale, AbSettingsTheme } from './ab-settings-drawer/index.tsx'
213
+ // ๐Ÿท๏ธ 0.1.14 (P9): AbVersionSwitcher
214
+ export { default as AbVersionSwitcher } from './ab-version-switcher/index.tsx'
215
+ export type { AbVersionOption, AbVersionSwitcherProps } from './ab-version-switcher/index.tsx'
216
+ // ๐Ÿž 0.1.14 (P2): AbBreadcrumbs
217
+ export { default as AbBreadcrumbs } from './ab-breadcrumbs/index.tsx'
218
+ export type { AbBreadcrumbItem, AbBreadcrumbsProps } from './ab-breadcrumbs/index.tsx'
219
+ // ๐Ÿ“‹ 0.1.14 (P13): AbList + AbListItem
220
+ export { default as AbList, AbListItem } from './ab-list/index.tsx'
221
+ export type { AbListProps, AbListItemProps } from './ab-list/index.tsx'
172
222
  export { default as AbText } from './ab-text/index.tsx'
173
223
  export { default as AbTestHello } from './ab-test-hello/index.tsx'
174
224
  export { default as AbKeyFeature } from './ab-key-feature/index.tsx'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-nextjs-components",
3
- "version": "0.1.13",
3
+ "version": "0.2.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",
@@ -43,7 +43,7 @@
43
43
  "ab-nextjs-animations": "^0.2.4",
44
44
  "ab-nextjs-hooks": "^0.1.7",
45
45
  "ab-nextjs-icons": "^0.2.4",
46
- "ab-nextjs-theme": "^0.3.4",
46
+ "ab-nextjs-theme": "^0.3.6",
47
47
  "clsx": "^2",
48
48
  "next": "^16.3.4",
49
49
  "react": "^19",
@@ -56,7 +56,7 @@
56
56
  "ab-nextjs-animations": "^0.2.4",
57
57
  "ab-nextjs-hooks": "^0.1.7",
58
58
  "ab-nextjs-icons": "^0.2.4",
59
- "ab-nextjs-theme": "^0.3.4",
59
+ "ab-nextjs-theme": "^0.3.6",
60
60
  "clsx": "^2.1.1",
61
61
  "esbuild": "^0.28.2",
62
62
  "eslint": "^9.39.0",
@@ -114,6 +114,18 @@
114
114
  "ab-splash",
115
115
  "ab-linear-progress",
116
116
  "ab-carousel",
117
+ "ab-drawer",
118
+ "ab-drawer-list",
119
+ "ab-confirm-drawer",
120
+ "ab-bottom-drawer",
121
+ "ab-mobile-header",
122
+ "ab-search-drawer",
123
+ "ab-toc-drawer",
124
+ "ab-nav-drawer",
125
+ "ab-settings-drawer",
126
+ "ab-version-switcher",
127
+ "ab-breadcrumbs",
128
+ "ab-list",
117
129
  "ab-flow-diagram",
118
130
  "ab-locale-switcher",
119
131
  "ab-install-snippet",
@@ -153,6 +165,19 @@
153
165
  "./ab-locale-switcher": "./ab-locale-switcher/index.tsx",
154
166
  "./ab-flow-diagram": "./ab-flow-diagram/index.tsx",
155
167
  "./ab-flow-diagram/helpers": "./ab-flow-diagram/helpers.ts",
168
+ "./ab-drawer": "./ab-drawer/index.tsx",
169
+ "./ab-drawer/use-ab-drawer": "./ab-drawer/use-ab-drawer.ts",
170
+ "./ab-drawer-list": "./ab-drawer-list/index.tsx",
171
+ "./ab-confirm-drawer": "./ab-confirm-drawer/index.tsx",
172
+ "./ab-bottom-drawer": "./ab-bottom-drawer/index.tsx",
173
+ "./ab-mobile-header": "./ab-mobile-header/index.tsx",
174
+ "./ab-search-drawer": "./ab-search-drawer/index.tsx",
175
+ "./ab-toc-drawer": "./ab-toc-drawer/index.tsx",
176
+ "./ab-nav-drawer": "./ab-nav-drawer/index.tsx",
177
+ "./ab-settings-drawer": "./ab-settings-drawer/index.tsx",
178
+ "./ab-version-switcher": "./ab-version-switcher/index.tsx",
179
+ "./ab-breadcrumbs": "./ab-breadcrumbs/index.tsx",
180
+ "./ab-list": "./ab-list/index.tsx",
156
181
  "./ab-splash/gate": "./ab-splash/gate.ts",
157
182
  "./ab-splash/csp": {
158
183
  "types": "./ab-splash/csp.d.ts",
@@ -48,7 +48,7 @@ import {
48
48
  getAbButtonSrReason,
49
49
  type AbButtonBadgeTone,
50
50
  type AbButtonColor,
51
- type AbButtonType,
51
+ type AbButtonType, type AbButtonShape, type AbButtonSize,
52
52
  } from '../../ab-button/helpers';
53
53
 
54
54
  // ๐Ÿ“ฆ shared types
@@ -63,6 +63,8 @@ export interface AbButtonProps {
63
63
  hidden?: boolean; // ๐Ÿ™ˆ
64
64
  style?: CSSProperties; // ๐ŸŽจ
65
65
  rounded?: boolean; // ๐Ÿ’Š
66
+ shape?: AbButtonShape; // ๐Ÿ”ท 0.1.14 (P16)
67
+ size?: AbButtonSize; // ๐Ÿ“ 0.1.14 (P16)
66
68
  raised?: boolean; // ๐Ÿ”๏ธ
67
69
  shrinks?: boolean; // ๐Ÿค
68
70
  expands?: boolean; // ๐Ÿ”
@@ -84,7 +86,7 @@ export interface AbButtonProps {
84
86
 
85
87
  /** ๐Ÿ–ฅ๏ธ Server AbButton: no onClick. Use href for links or htmlType for form submit. No-JS safe. */
86
88
  const AbButton = ({
87
- id, type = 'contained', htmlType = 'button', className, hidden = false, style, rounded = true, raised = false,
89
+ id, type = 'contained', htmlType = 'button', className, hidden = false, style, rounded = true, shape, size, raised = false,
88
90
  shrinks = false, expands = false, withIcon = false, disabled = false, iconPosition = 'left', label, icon,
89
91
  color = 'primary', href, children, startIcon, endIcon, badge, badgeTone = 'neutral', disabledReason, focusableWhenDisabled,
90
92
  }: AbButtonProps): ReactElement => {
@@ -106,6 +108,8 @@ const AbButton = ({
106
108
  'data-iconpos': iconPosition, // โ†”๏ธ
107
109
  'data-color': color, // ๐ŸŽจ
108
110
  'data-disabled-mode': mode, // ๐Ÿšฆ
111
+ 'data-shape': shape, // ๐Ÿ”ท P16
112
+ 'data-size': size, // ๐Ÿ“ P16
109
113
  } as const;
110
114
 
111
115
  // ๐Ÿ”ฃ legacy icon (decorative)
@@ -150,3 +150,42 @@
150
150
  white-space: nowrap; /* ๐Ÿšซ */
151
151
  border: 0; /* ๐Ÿงน */
152
152
  }
153
+
154
+ /* ===== ๐Ÿ”ท 0.1.14 (P16, Home fidelity spec ยง4 CTAs): shape="rounded" ยท size="md" ยท type="secondary" =====
155
+ * Doubled class (0,3,0+) beats the theme's `button[data-type="filled"]` (0,1,1) and its :hover (0,3,1 โ†’ we use 0,5,0). */
156
+ .abButton.abButton[data-shape="rounded"] {
157
+ gap: 6px; /* ๐Ÿงฑ icon โ†” label */
158
+ border-radius: var(--ab-radius-button, 10px); /* ๐Ÿ”ท */
159
+ padding: 0 var(--ab-button-padding-inline, 16px); /* ๐Ÿ“ฆ */
160
+ font-size: 14px; font-weight: 650; line-height: 1; white-space: nowrap; /* ๐Ÿ”ค */
161
+ overflow: visible; /* ๐ŸŒ— the primary shadow must show */
162
+ }
163
+ .abButton.abButton[data-size="md"] { height: var(--ab-button-height, 40px); box-sizing: border-box; } /* ๐Ÿ“ */
164
+ .abButton.abButton[data-shape="rounded"] .abButtonSlot { width: 18px; height: 18px; } /* ๐Ÿ–ผ๏ธ 18px icons */
165
+ .abButton.abButton[data-shape="rounded"] .abButtonSlot svg { width: 100%; height: 100%; }
166
+ /* ๐Ÿฅ‰ primary (filled) */
167
+ .abButton.abButton[data-shape="rounded"][data-type="filled"] {
168
+ background: var(--ab-color-btn, #8b6340); color: var(--ab-color-btn-text, #fff); /* ๐ŸŽจ AA (theme 0.3.5) */
169
+ border: 0; box-shadow: var(--ab-shadow-button, 0 1px 0 rgb(255 255 255 / 0.2) inset, 0 4px 12px rgb(139 99 64 / 0.25)); /* โœจ */
170
+ }
171
+ .abButton.abButton[data-shape="rounded"][data-type="filled"]:not(:disabled, [aria-disabled="true"]):hover {
172
+ background: color-mix(in srgb, var(--ab-color-btn, #8b6340) 90%, #000); /* ๐Ÿ–ฑ๏ธ */
173
+ }
174
+ /* โšช secondary */
175
+ .abButton.abButton[data-type="secondary"] {
176
+ border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); background: var(--ab-color-card, #fff); color: var(--ab-color-text, #211a16); /* ๐ŸŽจ */
177
+ box-sizing: border-box;
178
+ }
179
+ .abButton.abButton[data-type="secondary"]:not(:disabled, [aria-disabled="true"]):hover {
180
+ background: linear-gradient(var(--ab-color-hover, rgb(166 124 82 / 0.08)), var(--ab-color-hover, rgb(166 124 82 / 0.08))), var(--ab-color-card, #fff); /* ๐Ÿ–ฑ๏ธ tint over the card */
181
+ }
182
+ .abButton.abButton[data-shape="rounded"]:not(:disabled, [aria-disabled="true"]):active { transform: translateY(1px); } /* ๐Ÿ‘‡ */
183
+ .abButton.abButton[data-shape="rounded"]:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; } /* โ™ฟ */
184
+ /* ๐Ÿ“ฑ touch widths: 44px, 14.5px (mock .M .btn; the app sets flex: 1) */
185
+ @media (max-width: 767px) {
186
+ .abButton.abButton[data-size="md"] { height: var(--ab-button-height-touch, 44px); }
187
+ .abButton.abButton[data-shape="rounded"][data-size="md"] { font-size: 14.5px; }
188
+ }
189
+ @media (prefers-reduced-motion: reduce) {
190
+ .abButton.abButton[data-shape="rounded"]:active { transform: none; } /* โ™ฟ no nudge */
191
+ }
package/types/index.d.ts CHANGED
@@ -78,6 +78,43 @@ export { default as AbSidebar } from '../ab-sidebar/index.tsx';
78
78
  // ๐Ÿ“‘ 0.1.13 (Joseph): AbToc + the panes main-scroller helpers (also at `ab-nextjs-components/ab-toc`)
79
79
  export { default as AbToc, getAbMainScroller, AB_MAIN_SCROLLER_SELECTOR } from '../ab-toc/index.tsx';
80
80
  export type { AbTocItem, AbTocProps } from '../ab-toc/index.tsx';
81
+ // ๐Ÿ—„๏ธ 0.1.14 (G53): AbDrawer + useAbDrawer (also at `ab-nextjs-components/ab-drawer`)
82
+ export { default as AbDrawer, useAbDrawer, getAbDrawerHost, AB_DRAWER_DURATION } from '../ab-drawer/index.tsx';
83
+ // ๐Ÿค 0.2.0 drawers v2: edge swipes + the swipe / snap rules
84
+ export { useAbEdgeSwipe, AB_SWIPE, resolveAbSheetRelease, resolveAbSideRelease } from '../ab-drawer/index.tsx';
85
+ export type { AbDrawerTier, AbSheetSnap, UseAbEdgeSwipeOptions } from '../ab-drawer/index.tsx';
86
+ export type { AbDrawerProps, AbDrawerSide, AbDrawerScope, UseAbDrawer } from '../ab-drawer/index.tsx';
87
+ export { default as AbDrawerList } from '../ab-drawer-list/index.tsx';
88
+ export type { AbDrawerListItem, AbDrawerListProps } from '../ab-drawer-list/index.tsx';
89
+ export { default as AbConfirmDrawer } from '../ab-confirm-drawer/index.tsx';
90
+ export type { AbConfirmDrawerProps } from '../ab-confirm-drawer/index.tsx';
91
+ // ๐Ÿ“ฑ 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
92
+ export { default as AbBottomDrawer } from '../ab-bottom-drawer/index.tsx';
93
+ export type { AbBottomDrawerProps } from '../ab-bottom-drawer/index.tsx';
94
+ // ๐Ÿ†• 0.2.0 drawers v2: AbMobileHeader
95
+ export { default as AbMobileHeader } from '../ab-mobile-header/index.tsx';
96
+ export type { AbMobileHeaderProps } from '../ab-mobile-header/index.tsx';
97
+ // ๐Ÿ†• 0.2.0 drawers v2: AbSearchDrawer
98
+ export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY } from '../ab-search-drawer/index.tsx';
99
+ export type { AbSearchDrawerProps, AbSearchDrawerItem, AbSearchDrawerGroup, AbSearchDrawerLabels } from '../ab-search-drawer/index.tsx';
100
+ // ๐Ÿ†• 0.2.0 drawers v2: AbTocDrawer
101
+ export { default as AbTocDrawer } from '../ab-toc-drawer/index.tsx';
102
+ export type { AbTocDrawerProps, AbTocDrawerLink } from '../ab-toc-drawer/index.tsx';
103
+ // ๐Ÿ†• 0.2.0 drawers v2: AbNavDrawer
104
+ export { default as AbNavDrawer } from '../ab-nav-drawer/index.tsx';
105
+ export type { AbNavDrawerProps, AbNavDrawerItem, AbNavDrawerSection } from '../ab-nav-drawer/index.tsx';
106
+ // ๐Ÿ†• 0.2.0 drawers v2: AbSettingsDrawer
107
+ export { default as AbSettingsDrawer } from '../ab-settings-drawer/index.tsx';
108
+ export type { AbSettingsDrawerProps, AbSettingsDrawerLabels, AbSettingsLocale, AbSettingsTheme } from '../ab-settings-drawer/index.tsx';
109
+ // ๐Ÿท๏ธ 0.1.14 (P9): AbVersionSwitcher
110
+ export { default as AbVersionSwitcher } from '../ab-version-switcher/index.tsx';
111
+ export type { AbVersionOption, AbVersionSwitcherProps } from '../ab-version-switcher/index.tsx';
112
+ // ๐Ÿž 0.1.14 (P2): AbBreadcrumbs
113
+ export { default as AbBreadcrumbs } from '../ab-breadcrumbs/index.tsx';
114
+ export type { AbBreadcrumbItem, AbBreadcrumbsProps } from '../ab-breadcrumbs/index.tsx';
115
+ // ๐Ÿ“‹ 0.1.14 (P13): AbList + AbListItem
116
+ export { default as AbList, AbListItem } from '../ab-list/index.tsx';
117
+ export type { AbListProps, AbListItemProps } from '../ab-list/index.tsx';
81
118
  export { default as AbText } from '../ab-text/index.tsx';
82
119
  export { default as AbTestHello } from '../ab-test-hello/index.tsx';
83
120
  export { default as AbKeyFeature } from '../ab-key-feature/index.tsx';