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,118 @@
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: AbDrawerList (G53 preset)
28
+ * @file: ab-drawer-list/index.tsx
29
+ * @type: Client component
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ *
32
+ * Example usage:
33
+ * 1+|> <AbDrawerList scope="app" side="bottom" open={d.open} onClose={d.close} title="Language"
34
+ * -|> items={[{ value: 'en', label: 'English' }, { value: 'fr', label: 'Français' }]} value="en" onSelect={setLocale} />
35
+ */
36
+
37
+ /*
38
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
39
+ * MOTTO: We'll always do more 😜!!!
40
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
41
+ */
42
+
43
+
44
+ 'use client';
45
+
46
+ // ⚛️ React
47
+ import type { ReactElement, ReactNode } from 'react';
48
+ // 🧵 classes
49
+ import clsx from 'clsx';
50
+ // 🗄️ the drawer
51
+ import AbDrawer, { type AbDrawerProps } from '../ab-drawer';
52
+ import type { ComponentType } from 'react';
53
+ // 🔗 links go through AbLinkProvider (locale-aware apps)
54
+ import Link from '../ab-link';
55
+ // 🎨 styles
56
+ import styles from './styles.module.css';
57
+
58
+ /** 📋 one choice */
59
+ export interface AbDrawerListItem {
60
+ value: string; // 🆔 e.g. a locale code
61
+ label: ReactNode; // 🏷️
62
+ description?: ReactNode; // 📝 a second line
63
+ icon?: ReactNode; // 🔣 leading, decorative
64
+ href?: string; // 🔗 render a link (e.g. the same page in another locale) instead of a button
65
+ lang?: string; // 🌍 e.g. 'fr' for "Français" (screen readers pronounce it right)
66
+ disabled?: boolean; // 🚫
67
+ }
68
+
69
+ /** ⚙️ props: every AbDrawer prop, plus the list */
70
+ export interface AbDrawerListProps extends Omit<AbDrawerProps, 'children'> {
71
+ as?: ComponentType<AbDrawerProps>; // 🧱 the drawer to render in (default AbDrawer; e.g. AbBottomDrawer)
72
+ items: AbDrawerListItem[]; // 📋
73
+ value?: string | null; // 🎯 the selected item (`aria-current="true"` + a check mark)
74
+ onSelect?: (value: string) => void; // 🔔
75
+ closeOnSelect?: boolean; // 🚪 default true
76
+ listLabel?: string; // ♿ the list's name when the title isn't enough
77
+ }
78
+
79
+ /**
80
+ * 📋 AbDrawerList — AbDrawer with one selectable list (languages, sort orders, …). D40: the mobile
81
+ * language picker is `<AbDrawerList scope="app" side="bottom" />`. Items are buttons (or links with
82
+ * `href`), the selected one carries `aria-current="true"`. No-JS: the links still work in the fallback.
83
+ */
84
+ const AbDrawerList = ({ as: Drawer = AbDrawer, items, value, onSelect, closeOnSelect = true, listLabel, onClose, className, ...drawer }: AbDrawerListProps): ReactElement => {
85
+ const pick = (v: string) => { onSelect?.(v); if (closeOnSelect) onClose(); }; // 🔔 then 🚪
86
+ return (
87
+ <Drawer {...drawer} onClose={onClose} className={clsx('AbDrawerList', className)}>
88
+ <ul className={styles.abDrawerList} aria-label={listLabel} data-ab-part="drawer-list">
89
+ {items.map((it) => {
90
+ const on = it.value === value; // 🎯
91
+ const inner = (
92
+ <>
93
+ {it.icon != null && <span className={styles.abDrawerListIcon} aria-hidden="true">{it.icon}</span>}
94
+ <span className={styles.abDrawerListText}>
95
+ <span lang={it.lang}>{it.label}</span>
96
+ {it.description != null && <span className={styles.abDrawerListDescription}>{it.description}</span>}
97
+ </span>
98
+ <span className={styles.abDrawerListCheck} aria-hidden="true">{on ? '✓' : ''}</span>
99
+ </>
100
+ );
101
+ return (
102
+ <li key={it.value}>
103
+ {it.href && !it.disabled ? (
104
+ <Link href={it.href} className={styles.abDrawerListItem} data-active={on ? 'true' : 'false'} aria-current={on ? 'true' : undefined} hrefLang={it.lang} onClick={() => pick(it.value)}>{inner}</Link>
105
+ ) : (
106
+ <button type="button" className={styles.abDrawerListItem} data-active={on ? 'true' : 'false'} aria-current={on ? 'true' : undefined} disabled={it.disabled} onClick={() => pick(it.value)}>{inner}</button>
107
+ )}
108
+ </li>
109
+ );
110
+ })}
111
+ </ul>
112
+ </Drawer>
113
+ );
114
+ };
115
+
116
+ // 📦 exports
117
+ export default AbDrawerList;
118
+ export { AbDrawerList };
@@ -0,0 +1,65 @@
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: AbDrawerList styles
28
+ * @file: ab-drawer-list/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
+ .abDrawerList { list-style: none; margin: 0 -12px; padding: 0; display: grid; gap: 2px; } /* 📋 */
41
+ .abDrawerListItem {
42
+ display: flex; /* 📐 icon · text · check */
43
+ align-items: center; /* ↕️ */
44
+ gap: 12px; /* ↔️ */
45
+ inline-size: 100%; /* ↔️ */
46
+ min-block-size: 48px; /* 👆 touch target */
47
+ padding: 8px 12px; /* 📦 */
48
+ border: 0; /* 🧹 */
49
+ border-radius: 8px; /* 🔲 = the Home nav rows */
50
+ background: transparent; /* 🎨 */
51
+ color: inherit; /* 🖋️ */
52
+ font: inherit; /* 🔤 */
53
+ text-align: start; /* ⬅️ */
54
+ text-decoration: none; /* 🚫 */
55
+ cursor: pointer; /* 🖱️ */
56
+ box-sizing: border-box; /* 📦 */
57
+ }
58
+ .abDrawerListItem:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); } /* 🖱️ --hover */
59
+ .abDrawerListItem[data-active='true'] { background: var(--ab-color-tint, #f4e7db); color: var(--ab-color-accent-text, #8b6340); font-weight: 650; } /* 🎯 = the Home active nav (--tint, --accent-t, 650) */
60
+ .abDrawerListItem:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: -2px; } /* ♿ --accent */
61
+ .abDrawerListItem:disabled { opacity: 0.5; cursor: not-allowed; } /* 🚫 */
62
+ .abDrawerListIcon { flex: none; display: inline-flex; } /* 🔣 */
63
+ .abDrawerListText { flex: 1 1 auto; min-width: 0; display: grid; } /* 🏷️ */
64
+ .abDrawerListDescription { font-size: 0.875rem; opacity: 0.75; } /* 📝 */
65
+ .abDrawerListCheck { flex: none; inline-size: 1.25em; text-align: center; } /* ✓ */
@@ -43,7 +43,7 @@
43
43
  width: 100%; /* ↔️ */
44
44
  aspect-ratio: 760 / 600; /* 📐 mock card */
45
45
  border-radius: 1.25rem; /* 🔲 */
46
- border: 1px solid var(--ab-color-outline-variant, rgb(0 0 0 / 0.12)); /* 🖊️ */
46
+ border: 1px solid var(--ab-color-border, var(--ab-color-outline-variant, rgb(0 0 0 / 0.12))); /* 🖊️ */
47
47
  background: var(--ab-color-surface-container, transparent); /* 🎨 */
48
48
  overflow: hidden; /* ✂️ */
49
49
  color: var(--ab-color-on-surface, currentColor); /* 🎨 */
@@ -127,7 +127,7 @@
127
127
  /* 📏 scales with the card (cqi = 1% of its width): 760px card → 13px text, 390px → 11px; clamped both ways */
128
128
  padding: clamp(0.25rem, 0.8cqi, 0.375rem) clamp(0.4375rem, 1.4cqi, 0.625rem); /* 🧱 */
129
129
  border-radius: clamp(0.5rem, 1.4cqi, 0.625rem); /* 🔲 */
130
- border: 1px solid var(--ab-color-outline-variant, rgb(0 0 0 / 0.12)); /* 🖊️ */
130
+ border: 1px solid var(--ab-color-border, var(--ab-color-outline-variant, rgb(0 0 0 / 0.12))); /* 🖊️ */
131
131
  background: var(--ab-color-surface, #fff); /* 🎨 */
132
132
  font-size: clamp(0.6875rem, 1.75cqi, 0.8125rem); /* 🔡 */
133
133
  white-space: nowrap; /* 🚫 wrap */
@@ -52,6 +52,8 @@ import moreVert from 'ab-nextjs-icons/ab-icons/icons/more_vert'; // ⋮ AbAppBar
52
52
  import search from 'ab-nextjs-icons/ab-icons/icons/search'; // 🔎 AbSearchTrigger (0.1.13)
53
53
  import close from 'ab-nextjs-icons/ab-icons/icons/close'; // ✖️ AbPage aside close (0.1.13)
54
54
  import expandMore from 'ab-nextjs-icons/ab-icons/icons/expand_more'; // 🔽 AbLocaleSwitcher no-JS list (0.1.13)
55
+ import doubleLeft from 'ab-nextjs-icons/ab-icons/icons/keyboard_double_arrow_left'; // ⏪ AbSidebar outlined collapse (0.1.14, P9)
56
+ import doubleRight from 'ab-nextjs-icons/ab-icons/icons/keyboard_double_arrow_right'; // ⏩ AbSidebar outlined expand (0.1.14, P9)
55
57
  // 🧾 shape
56
58
  import type { AbIconSvgData } from './helpers';
57
59
 
@@ -72,4 +74,6 @@ export const AB_ICON_BUILTINS: Record<string, AbIconSvgData> = {
72
74
  search, // 🔎
73
75
  close, // ✖️
74
76
  expand_more: expandMore, // 🔽
77
+ keyboard_double_arrow_left: doubleLeft, // ⏪
78
+ keyboard_double_arrow_right: doubleRight, // ⏩
75
79
  };
@@ -31,7 +31,7 @@
31
31
  *
32
32
  * Example usage:
33
33
  * 1+|> <AbIconButton icon="arrow_back" label={t('back')} onClick={prev} />
34
- * -|> <AbIconButton icon="open_in_new" href="/docs" label="Open docs" /> // 🔗 link variant is named too
34
+ * -|> <AbIconButton icon="open_in_new" href="/packages" label="Open packages" /> // 🔗 link variant is named too
35
35
  */
36
36
 
37
37
  /*
@@ -90,6 +90,12 @@ export interface AbIconButtonProps {
90
90
  title?: string;
91
91
  // 🧾 button type
92
92
  type?: 'button' | 'submit' | 'reset';
93
+ // ♿ 0.1.14: disclosure state for menus / drawers / the TOC toggle (button variant)
94
+ 'aria-expanded'?: boolean;
95
+ // ♿ 0.1.14: id of the element this button opens
96
+ 'aria-controls'?: string;
97
+ // 📏 0.1.14: glyph size in px (default: AbIcon's 24), e.g. 16 for the terminal copy button
98
+ iconSize?: number;
93
99
  }
94
100
 
95
101
  const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function AbIconButton(props, ref) {
@@ -112,6 +118,9 @@ const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function A
112
118
  title, // 💬
113
119
  type = 'button', // 🧾
114
120
  iconFilled, // ⬛
121
+ 'aria-expanded': ariaExpanded, // ♿ 0.1.14
122
+ 'aria-controls': ariaControls, // ♿ 0.1.14
123
+ iconSize, // 📏 0.1.14
115
124
  } = props;
116
125
 
117
126
  // ♿ G6: one accessible name for both variants, ON the interactive element (not the wrapper span)
@@ -121,7 +130,7 @@ const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function A
121
130
  // 🏷️ classes
122
131
  const classNames = clsx('AbIconButton', 'icon-button', styles.abIconButton, AB_MOTION.interactive, expands && AB_MOTION.lift, shrinks && AB_MOTION.press, className); // 🎬 hover lift / press from ab-nextjs-animations
123
132
  // 🔣 the glyph is decoration (the button carries the name): AbIcon without a label is aria-hidden
124
- const glyph = <AbIcon name={icon} variant={(iconFilled ?? active) ? 'filled' : 'outlined'} className="icon" />;
133
+ const glyph = <AbIcon name={icon} variant={(iconFilled ?? active) ? 'filled' : 'outlined'} className="icon" size={iconSize} />;
125
134
 
126
135
  // 🔗 link variant
127
136
  if (href && !isLoading) {
@@ -158,6 +167,8 @@ const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function A
158
167
  aria-label={name} // ♿ accessible name
159
168
  title={tooltip} // 💬 tooltip on the button itself
160
169
  aria-busy={isLoading || undefined} // ⏳ announce loading
170
+ aria-expanded={ariaExpanded} // ♿ open / closed (omitted when undefined)
171
+ aria-controls={ariaControls} // ♿ what it opens
161
172
  data-active={String(active)} // ✅
162
173
  data-naked={String(naked)} // 🫥
163
174
  data-expands={String(expands)} // 🔍
@@ -63,7 +63,7 @@
63
63
  }
64
64
 
65
65
  .abIconButton:hover {
66
- background-color: color-mix(in srgb, currentColor 10%, transparent);
66
+ background-color: var(--ab-color-hover, color-mix(in srgb, currentColor 10%, transparent));
67
67
  }
68
68
 
69
69
  .abIconButton[data-naked='true']:hover {
@@ -76,6 +76,7 @@ export interface AbInstallSnippetProps {
76
76
  dev?: boolean; // 🛠️ dev dependency flag
77
77
  className?: string; // 🏷️
78
78
  style?: CSSProperties; // 🎨
79
+ variant?: 'card' | 'terminal'; // 💻 0.1.14 (P12): 'terminal' = the Home dark block (underline tabs, copy in the tab row, no clipping). Default 'card'
79
80
  }
80
81
 
81
82
  // 🧠 state source: persisted (shared across instances) or local
@@ -96,7 +97,7 @@ function LocalSnippet(props: AbInstallSnippetProps) {
96
97
  }
97
98
 
98
99
  /** 🖼️ the actual UI */
99
- function SnippetView({ pkg, labels, managers = AB_PACKAGE_MANAGERS, dev = false, className, style, state }: AbInstallSnippetProps & { state: PmState }) {
100
+ function SnippetView({ pkg, labels, managers = AB_PACKAGE_MANAGERS, dev = false, className, style, state, variant = 'card' }: AbInstallSnippetProps & { state: PmState }) {
100
101
  const [pm, setPm] = state; // 🎚️
101
102
  const current = managers.includes(pm) ? pm : managers[0]; // 🧯 stored pm not offered here
102
103
  const command = getAbInstallCommand(current, pkg, dev); // 🧾
@@ -122,38 +123,59 @@ function SnippetView({ pkg, labels, managers = AB_PACKAGE_MANAGERS, dev = false,
122
123
  tabs.current[j]?.focus(); // 🎯
123
124
  };
124
125
 
126
+ const terminal = variant === 'terminal'; // 💻 P12
127
+ // 📋 the copy button (card: in the command row · terminal: at the end of the tab row, always visible)
128
+ const copyButton = (
129
+ <AbIconButton
130
+ icon={copied ? 'check' : 'content_copy'} // 📋 / ✅
131
+ label={labels.copy} // ♿ name stays "Copy command"
132
+ naked // 🫥
133
+ iconSize={terminal ? 16 : undefined} // 📏 P12: 16px in the terminal tab row
134
+ className={styles.copy} // 🎨
135
+ onClick={() => { void copy(command); }} // 📋
136
+ />
137
+ );
138
+ // 🖍️ terminal: "$ pnpm add <pkg>" with the package highlighted (the text stays one copyable string)
139
+ const at = command.lastIndexOf(pkg); // 📍
140
+ const highlighted = at >= 0 ? <>{command.slice(0, at)}<span className={styles.termPkg}>{pkg}</span>{command.slice(at + pkg.length)}</> : command;
141
+
142
+ // 🗂️ manager tabs
143
+ const tablist = (
144
+ <div role="tablist" aria-label={labels.group} className={styles.tabs} onKeyDown={onKeyDown}>
145
+ {managers.map((m, i) => (
146
+ <button
147
+ key={m} // 🔑
148
+ ref={(el) => { tabs.current[i] = el; }} // 📍
149
+ id={`${base}-tab-${m}`} // 🆔
150
+ type="button" // 🧾
151
+ role="tab" // ♿
152
+ aria-selected={m === current} // ✅
153
+ aria-controls={`${base}-panel`} // 🔗
154
+ tabIndex={m === current ? 0 : -1} // ⌨️ roving
155
+ className={styles.tab} // 🎨
156
+ onClick={() => setPm(m)} // 🖱️
157
+ >
158
+ {m}
159
+ </button>
160
+ ))}
161
+ </div>
162
+ );
163
+
125
164
  return (
126
- <div className={clsx('AbInstallSnippet', styles.root, className)} style={style} data-ab-part="install-snippet" data-ab-swipe-ignore="">
127
- {/* 🗂️ manager tabs */}
128
- <div role="tablist" aria-label={labels.group} className={styles.tabs} onKeyDown={onKeyDown}>
129
- {managers.map((m, i) => (
130
- <button
131
- key={m} // 🔑
132
- ref={(el) => { tabs.current[i] = el; }} // 📍
133
- id={`${base}-tab-${m}`} // 🆔
134
- type="button" // 🧾
135
- role="tab" // ♿
136
- aria-selected={m === current} // ✅
137
- aria-controls={`${base}-panel`} // 🔗
138
- tabIndex={m === current ? 0 : -1} // ⌨️ roving
139
- className={styles.tab} // 🎨
140
- onClick={() => setPm(m)} // 🖱️
141
- >
142
- {m}
143
- </button>
144
- ))}
145
- </div>
165
+ <div className={clsx('AbInstallSnippet', styles.root, terminal && styles.terminal, className)} style={style} data-ab-part="install-snippet" data-variant={terminal ? 'terminal' : undefined} data-ab-swipe-ignore="">
166
+ {/* 🗂️ manager tabs (💻 terminal: tabs + copy share one row; the copy button stays OUTSIDE the tablist) */}
167
+ {terminal ? (
168
+ <div className={styles.termHead}>
169
+ {tablist}
170
+ <span className={styles.termGrow} aria-hidden="true" />
171
+ {copyButton}
172
+ </div>
173
+ ) : tablist}
146
174
  {/* 🧾 command panel */}
147
175
  <div id={`${base}-panel`} role="tabpanel" aria-labelledby={`${base}-tab-${current}`} className={styles.panel}>
148
176
  <span className={styles.prompt} aria-hidden="true">$</span>{/* 💲 decorative prompt */}
149
- <code className={styles.code}>{command}</code>
150
- <AbIconButton
151
- icon={copied ? 'check' : 'content_copy'} // 📋 / ✅
152
- label={labels.copy} // ♿ name stays "Copy command"
153
- naked // 🫥
154
- className={styles.copy} // 🎨
155
- onClick={() => { void copy(command); }} // 📋
156
- />
177
+ <code className={styles.code}>{terminal ? highlighted : command}</code>
178
+ {!terminal && copyButton}
157
179
  </div>
158
180
  {/* 📣 own polite live region */}
159
181
  <span className={styles.srOnly} aria-live="polite" role="status">{copied ? labels.copied : ''}</span>
@@ -42,7 +42,7 @@
42
42
  gap: 0.5rem; /* 🧱 */
43
43
  padding: 0.75rem; /* 🧱 */
44
44
  border-radius: 0.875rem; /* 🔲 */
45
- border: 1px solid var(--ab-color-outline-variant, rgb(0 0 0 / 0.12)); /* 🖊️ */
45
+ border: 1px solid var(--ab-color-border, var(--ab-color-outline-variant, rgb(0 0 0 / 0.12))); /* 🖊️ */
46
46
  background: var(--ab-color-surface-container, transparent); /* 🎨 */
47
47
  max-width: 100%; /* 📏 */
48
48
  min-width: 0; /* 🚫 overflow in narrow columns (0.1.13) */
@@ -84,7 +84,7 @@
84
84
  font-weight: 600; /* 💪 */
85
85
  }
86
86
  .tab:focus-visible {
87
- outline: 2px solid var(--ab-focus-ring, var(--ab-color-primary, #A67C52)); /* 💍 */
87
+ outline: 2px solid var(--ab-color-accent, var(--ab-focus-ring, var(--ab-color-primary, #A67C52))); /* 💍 */
88
88
  outline-offset: 2px; /* ↔️ */
89
89
  }
90
90
 
@@ -126,3 +126,35 @@
126
126
  @media (scripting: none) {
127
127
  .copy { display: none; } /* 🙈 */
128
128
  }
129
+
130
+ /* ===== 💻 0.1.14 (P12, Home spec §4 install block): variant="terminal" (dark in both themes) ===== */
131
+ .root.terminal {
132
+ display: block; gap: 0; padding: 0; overflow: hidden; /* 🧹 no outer card */
133
+ border: 1px solid rgb(255 232 210 / 0.06); border-radius: var(--ab-radius-code, 12px); /* 🔲 */
134
+ background: var(--ab-color-code, #231a14); color: var(--ab-color-code-text, #ede0d4); /* 💻 dark: #110b07 / #e8dacc */
135
+ box-shadow: 0 10px 30px rgb(33 26 22 / 0.14); /* 🌗 */
136
+ }
137
+ .termHead {
138
+ display: flex; align-items: center; padding: 6px 8px 0 10px; /* 📦 tabs · grow · copy */
139
+ border-bottom: 1px solid rgb(255 232 210 / 0.08); /* ➖ */
140
+ }
141
+ .terminal .tabs { gap: 2px; } /* 🗂️ */
142
+ .terminal .tab, .terminal .tab:hover {
143
+ min-height: 0; padding: 6px 8px 8px; border-radius: 0; background: none; /* 🧹 no pills */
144
+ font-size: 12px; font-weight: 600; line-height: 17px; color: rgb(237 224 212 / 0.55); /* 🔤 */
145
+ }
146
+ .terminal .tab:hover { color: rgb(237 224 212 / 0.8); } /* 🖱️ */
147
+ .terminal .tab[aria-selected='true'], .terminal .tab[aria-selected='true']:hover {
148
+ background: none; color: #e7c8a5; box-shadow: inset 0 -2px 0 #c29a6f; /* ✅ underline */
149
+ }
150
+ .terminal .tab:focus-visible { outline-color: #c29a6f; outline-offset: -2px; } /* ♿ inside the block */
151
+ .termGrow { flex: 1; } /* ↔️ */
152
+ .terminal .copy.copy { margin: 0; padding: 4px 4px 6px; border-radius: 6px; color: rgb(237 224 212 / 0.7); } /* 📋 always visible; mock .cp 4/4/6 → a 26px (≥ 24px) target */
153
+ .terminal .panel { display: block; padding: 14px 16px 16px; border-radius: 0; background: none; color: inherit; overflow-x: auto; } /* 📜 scrolls, never clips */
154
+ .terminal .prompt { opacity: 1; color: #8e7a69; margin-inline-end: 0.6em; font-size: 13.5px; } /* 💲 */
155
+ .terminal .code { display: inline; overflow: visible; font-size: 13.5px; line-height: 1.4; white-space: pre; } /* ⌨️ Roboto Mono 13.5/1.4 */
156
+ .termPkg { color: #e7c8a5; } /* 📦 */
157
+ @media (max-width: 767px) {
158
+ .terminal .panel { padding: 12px 14px 13px; } /* 📱 */
159
+ .terminal .prompt, .terminal .code { font-size: 13px; }
160
+ }
@@ -47,7 +47,7 @@
47
47
  .abKbdKey {
48
48
  min-width: 20px; /* 📏 */
49
49
  padding: 3px 5px; /* 📦 */
50
- border: 1px solid var(--ab-color-outline-variant, rgb(0 0 0 / 0.15)); /* 🖼️ */
50
+ border: 1px solid var(--ab-color-border, var(--ab-color-outline-variant, rgb(0 0 0 / 0.15))); /* 🖼️ */
51
51
  border-radius: 6px; /* 🟢 */
52
52
  box-sizing: border-box; /* 📦 */
53
53
  text-align: center; /* ↔️ */
@@ -0,0 +1,107 @@
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: AbList + AbListItem (P13)
28
+ * @file: ab-list/index.tsx
29
+ * @type: Server-safe component
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ *
32
+ * Example usage:
33
+ * 1+|> <AbList><AbListItem href="/guides/install" media={<AbIcon name="rocket_launch" />} title="Install AbElements" meta="Getting started" trailing="chevron" /></AbList>
34
+ */
35
+
36
+ /*
37
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
38
+ * MOTTO: We'll always do more 😜!!!
39
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40
+ */
41
+
42
+
43
+ // ⚛️ React
44
+ import type { ReactElement, ReactNode } from 'react';
45
+ // 🧵 classes
46
+ import clsx from 'clsx';
47
+ // 🔗 the app's link
48
+ import Link from '../ab-link';
49
+ // 🔣 the default chevron
50
+ import AbIcon from '../ab-icon';
51
+ // 🎨 styles
52
+ import styles from './styles.module.css';
53
+
54
+ /** ⚙️ AbList props */
55
+ export interface AbListProps {
56
+ children: ReactNode; // 📋 AbListItem rows
57
+ label?: string; // ♿ optional list name
58
+ className?: string; // 🏷️
59
+ }
60
+
61
+ /** ⚙️ AbListItem props */
62
+ export interface AbListItemProps {
63
+ title: ReactNode; // 💪 13.5/600, one line with ellipsis
64
+ meta?: ReactNode; // 🧾 12px faint subline (`<code>` inside = 11px mono muted)
65
+ media?: ReactNode; // 🖼️ an icon: shown in a 30px tile (card2 bg, accent-text, 18px)
66
+ badge?: ReactNode; // 🏷️ a leading 64×22 badge instead of media ("New", "Improved")
67
+ badgeTone?: 'primary' | 'tonal'; // 🎨 primary = button colours ("New"), tonal = tint ("Improved", default)
68
+ trailing?: 'chevron' | ReactNode; // ➡️ 'chevron' = 18px faint chevron_right
69
+ href?: string; // 🔗 the whole row becomes one link
70
+ className?: string; // 🏷️
71
+ }
72
+
73
+ /**
74
+ * 📋 AbList (P13): one bordered card of rows (Guides, What's new). Radius 14, hairline border, card bg,
75
+ * soft shadow, rows divided by `--div`. Server-safe.
76
+ */
77
+ const AbList = ({ children, label, className }: AbListProps): ReactElement => (
78
+ <ul className={clsx('AbList', styles.abList, className)} aria-label={label} data-ab-part="list">{children}</ul>
79
+ );
80
+
81
+ /**
82
+ * 📄 AbListItem: `media | badge` · title + meta · `trailing`. A row with `href` is a single link (hover
83
+ * `--hover`, focus-visible inset 2px accent ring). Rows are at least 44px tall (touch target).
84
+ */
85
+ const AbListItem = ({ title, meta, media, badge, badgeTone = 'tonal', trailing, href, className }: AbListItemProps): ReactElement => {
86
+ const body = (
87
+ <>
88
+ {badge != null ? <span className={styles.abListBadge} data-tone={badgeTone}>{badge}</span>
89
+ : media != null ? <span className={styles.abListMedia} aria-hidden="true">{media}</span> : null}
90
+ <span className={styles.abListText}>
91
+ <span className={styles.abListTitle}>{title}</span>
92
+ {meta != null && <span className={styles.abListMeta}>{meta}</span>}
93
+ </span>
94
+ {trailing === 'chevron' ? <AbIcon name="chevron_right" size={18} className={styles.abListChevron} />
95
+ : trailing != null ? <span className={styles.abListTrailing}>{trailing}</span> : null}
96
+ </>
97
+ );
98
+ return (
99
+ <li className={clsx('AbListItem', styles.abListItem, className)} data-ab-part="list-item">
100
+ {href ? <Link href={href} className={styles.abListRow} data-link="true">{body}</Link> : <div className={styles.abListRow}>{body}</div>}
101
+ </li>
102
+ );
103
+ };
104
+
105
+ // 📦 exports
106
+ export default AbList;
107
+ export { AbList, AbListItem };
@@ -0,0 +1,82 @@
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: AbList styles
28
+ * @file: ab-list/styles.module.css
29
+ * @type: CSS module
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more 😜!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
39
+
40
+ /* 🎚️ knobs: mock .list / .li-ic / .badge, on the ab-nextjs-theme 0.3.5 home tokens */
41
+ .abList {
42
+ --ab-list-radius: 14px; /* ⭕ */
43
+ --ab-list-background: var(--ab-color-card, #fff); /* 🎨 --card */
44
+ --ab-list-border: var(--ab-color-border, rgb(92 64 48 / 0.13)); /* ➖ --border */
45
+ --ab-list-divider: var(--ab-color-div, rgb(92 64 48 / 0.11)); /* ➖ --div */
46
+ --ab-list-shadow: var(--ab-shadow-card, 0 1px 2px rgb(33 26 22 / 0.05)); /* 🌗 --shadow */
47
+ --ab-list-hover: var(--ab-color-hover, rgb(166 124 82 / 0.08)); /* 🖱️ --hover */
48
+ --ab-list-ring: var(--ab-color-accent, #a67c52); /* ♿ --accent */
49
+ --ab-list-text: var(--ab-color-text, #211a16); /* 🖋️ */
50
+ --ab-list-muted: var(--ab-color-muted, #6b5b50); /* 🖋️ */
51
+ --ab-list-faint: var(--ab-color-faint, #807062); /* 🖋️ --faint ♿ AA fallback (James) */
52
+ --ab-list-tile: var(--ab-color-card2, #fbf3ec); /* 🖼️ --card2 */
53
+ --ab-list-accent-text: var(--ab-color-accent-text, #8b6340); /* 🖋️ --accent-t */
54
+ --ab-list-tint: var(--ab-color-tint, #f4e7db); /* 🎨 --tint */
55
+ --ab-list-btn: var(--ab-color-btn, #a67c52); /* 🎨 --btn */
56
+ --ab-list-btn-text: var(--ab-color-btn-text, #fff); /* 🎨 --btn-t */
57
+ margin: 0; padding: 0; list-style: none; /* 🧹 */
58
+ border: 1px solid var(--ab-list-border); border-radius: var(--ab-list-radius); /* ➖ */
59
+ background: var(--ab-list-background); box-shadow: var(--ab-list-shadow); overflow: hidden; /* 🎨 */
60
+ color: var(--ab-list-text); /* 🖋️ */
61
+ }
62
+ .abListItem { border-top: 1px solid var(--ab-list-divider); } /* ➖ */
63
+ .abListItem:first-child { border-top: 0; } /* 🧹 */
64
+ .abListRow {
65
+ display: flex; align-items: center; gap: 12px; /* 📐 */
66
+ min-height: 44px; box-sizing: border-box; padding: 11px 14px; /* 📦 touch target */
67
+ color: inherit; text-decoration: none; /* 🔗 */
68
+ }
69
+ a.abListRow:hover { background: var(--ab-list-hover); } /* 🖱️ */
70
+ a.abListRow:focus-visible { outline: 2px solid var(--ab-list-ring); outline-offset: -2px; } /* ♿ inset ring */
71
+ .abListItem:first-child a.abListRow:focus-visible { border-radius: calc(var(--ab-list-radius) - 1px) calc(var(--ab-list-radius) - 1px) 0 0; } /* ⭕ */
72
+ .abListItem:last-child a.abListRow:focus-visible { border-radius: 0 0 calc(var(--ab-list-radius) - 1px) calc(var(--ab-list-radius) - 1px); } /* ⭕ */
73
+ .abListMedia { flex: none; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--ab-list-tile); color: var(--ab-list-accent-text); } /* 🖼️ */
74
+ .abListMedia > *, .abListMedia svg { width: 18px; height: 18px; } /* 🔣 18px icon (an AbIcon, or a raw <svg> at any depth) */
75
+ .abListBadge { flex: none; display: flex; align-items: center; justify-content: center; width: 64px; height: 22px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--ab-list-tint); color: var(--ab-list-accent-text); } /* 🏷️ Improved */
76
+ .abListBadge[data-tone='primary'] { background: var(--ab-list-btn); color: var(--ab-list-btn-text); } /* 🏷️ New */
77
+ .abListText { flex: 1; min-width: 0; } /* 📐 */
78
+ .abListTitle { display: block; font-size: 13.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* 💪 */
79
+ .abListMeta { display: block; margin-top: 2px; font-size: 12px; line-height: 1.42; color: var(--ab-list-faint); } /* 🧾 1.42 (~17px): rows are 59px (first) / 60px (with the divider), like the mock */
80
+ .abListMeta code { font-family: var(--ab-font-code, var(--ab-font-mono, ui-monospace, monospace)); font-size: 11px; color: var(--ab-list-muted); } /* 🧾 mono pkg */
81
+ .abListChevron { flex: none; width: 18px; height: 18px; color: var(--ab-list-faint); } /* ➡️ */
82
+ .abListTrailing { flex: none; color: var(--ab-list-faint); } /* ➡️ */