ab-nextjs-components 0.1.12 → 0.1.13

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 (119) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +22 -0
  3. package/ab-app-bar/index.tsx +181 -0
  4. package/ab-app-bar/styles.module.css +119 -0
  5. package/ab-avatar/index.tsx +2 -1
  6. package/ab-avatar/styles.module.css +32 -0
  7. package/ab-balloon/index.tsx +134 -23
  8. package/ab-balloon/styles.module.css +84 -7
  9. package/ab-brand/index.tsx +1 -1
  10. package/ab-button/index.tsx +15 -2
  11. package/ab-button/styles.module.css +31 -0
  12. package/ab-card/index.tsx +89 -0
  13. package/ab-card/styles.module.css +68 -0
  14. package/ab-collapsible/index.tsx +1 -1
  15. package/ab-color/index.tsx +1 -0
  16. package/ab-color/styles.module.css +32 -0
  17. package/ab-demo-box/index.tsx +1 -0
  18. package/ab-demo-box/styles.module.css +32 -0
  19. package/ab-demo-code/index.tsx +1 -0
  20. package/ab-demo-code/styles.module.css +32 -0
  21. package/ab-icon/builtin.ts +15 -1
  22. package/ab-icon/helpers.ts +37 -0
  23. package/ab-icon/index.tsx +14 -8
  24. package/ab-icon/registrar.tsx +68 -0
  25. package/ab-icon-button/index.tsx +8 -3
  26. package/ab-image/index.tsx +1 -0
  27. package/ab-image/styles.module.css +32 -0
  28. package/ab-info/index.tsx +2 -1
  29. package/ab-info/styles.module.css +32 -0
  30. package/ab-input/index.tsx +1 -0
  31. package/ab-input/styles.module.css +1 -0
  32. package/ab-install-snippet/styles.module.css +16 -2
  33. package/ab-kbd/index.tsx +65 -0
  34. package/ab-kbd/styles.module.css +55 -0
  35. package/ab-key-feature/index.tsx +2 -1
  36. package/ab-key-feature/styles.module.css +32 -0
  37. package/ab-like-button/index.tsx +1 -1
  38. package/ab-link/index.tsx +112 -0
  39. package/ab-link/locale.ts +53 -0
  40. package/ab-locale-switcher/index.tsx +17 -0
  41. package/ab-locale-switcher/styles.module.css +11 -0
  42. package/ab-main-headline/index.tsx +1 -0
  43. package/ab-main-headline/styles.module.css +32 -0
  44. package/ab-menu/index.tsx +6 -5
  45. package/ab-menu/styles.module.css +32 -0
  46. package/ab-name/index.tsx +1 -0
  47. package/ab-name/styles.module.css +32 -0
  48. package/ab-navbar/index.tsx +54 -46
  49. package/ab-navbar/styles.module.css +84 -28
  50. package/ab-navbar/view.tsx +163 -0
  51. package/ab-package-card/index.tsx +94 -0
  52. package/ab-package-card/styles.module.css +41 -0
  53. package/ab-page-paginator/index.tsx +1 -0
  54. package/ab-page-paginator/styles.module.css +32 -0
  55. package/ab-page-switcher/index.tsx +1 -0
  56. package/ab-page-switcher/styles.module.css +32 -0
  57. package/ab-preview/index.tsx +1 -0
  58. package/ab-preview/styles.module.css +32 -0
  59. package/ab-price/index.tsx +1 -0
  60. package/ab-price/styles.module.css +32 -0
  61. package/ab-price-tag/index.tsx +1 -0
  62. package/ab-price-tag/styles.module.css +32 -0
  63. package/ab-product/index.tsx +1 -0
  64. package/ab-product/styles.module.css +32 -0
  65. package/ab-product-item/index.tsx +1 -0
  66. package/ab-product-item/styles.module.css +32 -0
  67. package/ab-search-result/index.tsx +1 -0
  68. package/ab-search-result/styles.module.css +32 -0
  69. package/ab-search-trigger/index.tsx +142 -0
  70. package/ab-search-trigger/styles.module.css +70 -0
  71. package/ab-sidebar/index.tsx +88 -49
  72. package/ab-sidebar/styles.module.css +136 -31
  73. package/ab-sidebar/view.tsx +182 -0
  74. package/ab-switch-back/index.tsx +2 -1
  75. package/ab-switch-back/styles.module.css +32 -0
  76. package/ab-tab/index.tsx +2 -1
  77. package/ab-tab/styles.module.css +32 -0
  78. package/ab-tabs/index.tsx +1 -0
  79. package/ab-tabs/styles.module.css +32 -0
  80. package/ab-test-hello/index.tsx +1 -0
  81. package/ab-test-hello/styles.module.css +32 -0
  82. package/ab-text/index.tsx +1 -0
  83. package/ab-text/styles.module.css +32 -0
  84. package/ab-toc/index.tsx +124 -0
  85. package/ab-toc/styles.module.css +54 -0
  86. package/css/chrome-mq.css +32 -0
  87. package/css/doodle.css +32 -0
  88. package/css/logo.css +32 -0
  89. package/css/spinner.css +32 -0
  90. package/css/toast.css +32 -0
  91. package/index.ts +18 -0
  92. package/package.json +27 -10
  93. package/server/ab-avatar/index.tsx +2 -1
  94. package/server/ab-avatar/styles.module.css +32 -0
  95. package/server/ab-badge/index.tsx +1 -0
  96. package/server/ab-badge/styles.module.css +32 -0
  97. package/server/ab-brand/index.tsx +1 -1
  98. package/server/ab-icon/index.tsx +13 -8
  99. package/server/ab-key-feature/index.tsx +2 -1
  100. package/server/ab-key-feature/styles.module.css +32 -0
  101. package/server/ab-name/index.tsx +1 -0
  102. package/server/ab-name/styles.module.css +32 -0
  103. package/server/ab-nav-link/index.tsx +2 -1
  104. package/server/ab-nav-link/styles.module.css +32 -0
  105. package/server/ab-navbar/index.tsx +44 -45
  106. package/server/ab-polygon/index.tsx +1 -0
  107. package/server/ab-polygon/styles.module.css +32 -0
  108. package/server/ab-sidebar/index.tsx +44 -49
  109. package/server/ab-switch-back/index.tsx +2 -1
  110. package/server/ab-switch-back/styles.module.css +32 -0
  111. package/server/ab-test-hello/index.tsx +1 -0
  112. package/server/ab-test-hello/styles.module.css +32 -0
  113. package/server/ab-text/index.tsx +1 -0
  114. package/server/ab-text/styles.module.css +32 -0
  115. package/server/index.ts +1 -0
  116. package/styles.css +32 -0
  117. package/types/index.d.ts +35 -0
  118. package/server/ab-navbar/styles.module.css +0 -35
  119. package/server/ab-sidebar/styles.module.css +0 -41
@@ -1,12 +1,89 @@
1
- /* AbBalloon — title= Adapt (no hover chrome; native tooltip only) */
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: AbBalloon - Styles
28
+ * @file: ab-balloon/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
+ /* 🎈 wrapper: positions the tip */
2
40
  .abBalloon {
3
- display: inline-flex;
4
- align-items: center;
5
- justify-content: center;
6
- box-sizing: border-box;
7
- max-width: 100%;
41
+ position: relative; /* 📍 */
42
+ display: inline-flex; /* 📐 */
43
+ align-items: center; /* ↕️ */
44
+ justify-content: center; /* ↔️ */
45
+ box-sizing: border-box; /* 📦 */
46
+ max-width: 100%; /* 📏 */
47
+ --pop-in-animation-duration: 160ms; /* 🎬 quick pop (package keyframes) */
8
48
  }
9
49
 
10
50
  .abBalloon[data-disabled='true'] {
11
- pointer-events: none;
51
+ pointer-events: none; /* 🚫 */
52
+ }
53
+
54
+ /* 💬 the tip: hidden until open (JS) or focus/hover (no JS, see below) */
55
+ .abBalloonTip {
56
+ position: absolute; /* 📍 */
57
+ z-index: 50; /* ⬆️ */
58
+ display: none; /* 🙈 */
59
+ width: max-content; /* 📏 */
60
+ max-width: 240px; /* 📏 */
61
+ padding: 4px 8px; /* 📦 */
62
+ border-radius: 8px; /* 🟢 */
63
+ background: var(--ab-color-inverse-surface, rgb(54 47 43)); /* 🎨 */
64
+ color: var(--ab-color-inverse-on-surface, rgb(251 238 233)); /* 🖋️ */
65
+ font: 500 12px/16px var(--ab-font-sans, system-ui, sans-serif); /* 🔤 */
66
+ pointer-events: none; /* 🖱️ never steals hover */
67
+ white-space: normal; /* ↩️ */
68
+ }
69
+
70
+ /* 👁️ open */
71
+ .abBalloon[data-open='true'] .abBalloonTip {
72
+ display: block;
73
+ }
74
+
75
+ /* 🚫 JS off: plain CSS focus / hover */
76
+ @media (scripting: none) {
77
+ .abBalloon:focus-within .abBalloonTip,
78
+ .abBalloon:hover .abBalloonTip {
79
+ display: block;
80
+ }
12
81
  }
82
+
83
+ /* 🧭 placement */
84
+ .abBalloon[data-placement='top'] .abBalloonTip { bottom: calc(100% + 6px); left: 50%; translate: -50% 0; }
85
+ .abBalloon[data-placement='bottom'] .abBalloonTip { top: calc(100% + 6px); left: 50%; translate: -50% 0; }
86
+ .abBalloon[data-placement='start'] .abBalloonTip { inset-inline-end: calc(100% + 6px); top: 50%; translate: 0 -50%; }
87
+ .abBalloon[data-placement='end'] .abBalloonTip { inset-inline-start: calc(100% + 6px); top: 50%; translate: 0 -50%; }
88
+
89
+ /* ♿ reduced motion: the component skips the popIn class (pop-in has no reduced-motion rule of its own) */
@@ -40,7 +40,7 @@
40
40
  'use client';
41
41
 
42
42
  import type { CSSProperties, ReactElement } from 'react';
43
- import Link from 'next/link';
43
+ import Link from '../ab-link'; // 🔗 G42: injectable via AbLinkProvider (default next/link)
44
44
  import Image from 'next/image';
45
45
  import clsx from 'clsx';
46
46
  import styles from './styles.module.css';
@@ -91,6 +91,18 @@ export interface AbButtonProps {
91
91
  badgeTone?: AbButtonBadgeTone; // 🎨 NEW: 'neutral' (default) | 'accent'
92
92
  disabledReason?: string; // 💬 NEW: SR-only reason, appended to the name while blocked
93
93
  focusableWhenDisabled?: boolean; // ⌨️ NEW: force aria-disabled (true) or native disabled (false)
94
+ // ===== 0.1.13 (Joseph #7) =====
95
+ // ♿ any aria-* / data-* attribute is passed to the <button>/<a>, e.g. useAbAsideToggle().props
96
+ // (`aria-expanded`, `aria-controls`) or `data-testid`. Our own data-* (type, color, …) still win.
97
+ [aria: `aria-${string}`]: string | number | boolean | undefined;
98
+ [data: `data-${string}`]: string | number | boolean | undefined;
99
+ }
100
+
101
+ /** 🔍 pick the aria-* / data-* props to forward (0.1.13) */
102
+ function pickAbButtonPassThrough(props: object): Record<string, unknown> {
103
+ const out: Record<string, unknown> = {}; // 📦
104
+ for (const [k, v] of Object.entries(props)) if (k.startsWith('aria-') || k.startsWith('data-')) out[k] = v; // ♿ 🗂️
105
+ return out;
94
106
  }
95
107
 
96
108
  const AbButton = forwardRef<HTMLButtonElement | HTMLAnchorElement, AbButtonProps>(function AbButton(props, ref) {
@@ -144,8 +156,9 @@ const AbButton = forwardRef<HTMLButtonElement | HTMLAnchorElement, AbButtonProps
144
156
  mode === 'native' && styles.isDisabled, // 🚫
145
157
  );
146
158
 
147
- // 🗂️ data attributes for styling/tests
159
+ // 🗂️ data attributes for styling/tests (forwarded aria-* / data-* first, so ours win)
148
160
  const dataAttrs = {
161
+ ...pickAbButtonPassThrough(props), // ♿ 0.1.13
149
162
  'data-type': type, // 🎨
150
163
  'data-raised': raised ? 'true' : 'false', // 🏔️
151
164
  'data-shrinks': shrinks ? 'true' : 'false', // 🤏
@@ -154,7 +167,7 @@ const AbButton = forwardRef<HTMLButtonElement | HTMLAnchorElement, AbButtonProps
154
167
  'data-iconpos': iconPosition, // ↔️
155
168
  'data-color': color, // 🎨
156
169
  'data-disabled-mode': mode, // 🚦
157
- } as const;
170
+ };
158
171
 
159
172
  // 🔣 legacy Material icon (decorative)
160
173
  const legacyIcon = withIcon && icon
@@ -150,3 +150,34 @@
150
150
  white-space: nowrap; /* 🚫 */
151
151
  border: 0; /* 🧹 */
152
152
  }
153
+
154
+ /* 🔗 0.1.13 (Joseph #7): link mode. The theme paints `button[data-type]` and `a[role="button"][data-type]`,
155
+ * but a real link (no role=button: it navigates) matched neither, so it rendered at 20px with no padding.
156
+ * These mirror the theme's box rules for <a>, using the same --ab-button-* overrides. */
157
+ a.abButton[data-type="contained"],
158
+ a.abButton[data-type="text"] {
159
+ padding: var(--ab-button-padding, 6px 12px); /* 📦 */
160
+ border-radius: 8px; /* 🔲 */
161
+ font-size: 18px; /* 🔤 */
162
+ line-height: 32px; /* 📏 40px tall */
163
+ }
164
+ a.abButton[data-type="contained"] {
165
+ background: var(--ab-button-background-color, var(--primary-container-color)); /* 🎨 */
166
+ color: var(--ab-button-text-color, var(--on-primary-container-color)); /* 🖋️ */
167
+ }
168
+ a.abButton[data-type="filled"] {
169
+ background: var(--ab-button-background-color, var(--md-sys-color-primary)); /* 🥉 */
170
+ color: var(--ab-button-text-color, var(--md-sys-color-on-primary)); /* 🖋️ */
171
+ padding: var(--ab-button-padding, 6px 16px); /* 📦 */
172
+ border-radius: var(--ab-button-radius, 999px); /* 💊 */
173
+ font-size: 18px; /* 🔤 */
174
+ line-height: 32px; /* 📏 */
175
+ }
176
+ a.abButton[data-type="outlined"] {
177
+ border: 2px solid var(--ab-button-outline-color, var(--outline-color)); /* ➖ */
178
+ border-radius: 8px; /* 🔲 */
179
+ padding: 8px 16px; /* 📦 */
180
+ font-size: 18px; /* 🔤 */
181
+ line-height: 32px; /* 📏 */
182
+ }
183
+ a.abButton.abButtonRounded { border-radius: 9999px; } /* 💊 */
@@ -0,0 +1,89 @@
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: AbCard (G45)
28
+ * @file: ab-card/index.tsx
29
+ * @type: React Component (server-safe)
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ *
32
+ * Example usage:
33
+ * <AbCard href="/docs/hooks" title="Hooks" description="State, media queries and more." />
34
+ */
35
+
36
+ /*
37
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
38
+ * MOTTO: We'll always do more 😜!!!
39
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40
+ */
41
+
42
+ // ⚛️ React
43
+ import type { ComponentType, ReactElement, ReactNode } from 'react';
44
+ // 🧵 classes
45
+ import clsx from 'clsx';
46
+ // 🔗 G42 link
47
+ import Link from '../ab-link';
48
+ // 🎬 hover colours + transform timing from the package (reduced motion → no transition)
49
+ import 'ab-nextjs-animations/motion/styles.css';
50
+ // 🎨 styles
51
+ import styles from './styles.module.css';
52
+
53
+ /** ⚙️ props */
54
+ export interface AbCardProps {
55
+ title: ReactNode; // 🏷️ also the link text (one link per card)
56
+ href?: string; // 🔗 the whole card is clickable via the title link's overlay
57
+ description?: ReactNode; // 📝
58
+ eyebrow?: ReactNode; // 🔝 small label above the title
59
+ media?: ReactNode; // 🖼️ icon / image slot
60
+ footer?: ReactNode; // 🔚 meta row (must not contain other links: one link per card)
61
+ headingLevel?: 2 | 3 | 4; // ♿ default 3
62
+ className?: string; // 🏷️
63
+ as?: 'article' | 'div' | 'li'; // 🧱 default article
64
+ id?: string; // 🆔 0.1.13: e.g. an in-page anchor target
65
+ }
66
+
67
+ /**
68
+ * 🃏 AbCard (G45): ONE link (the title) stretched over the card, so screen readers hear one link, not a
69
+ * nested block of them. Hover lift is 2px, laptop and up only, and none under prefers-reduced-motion.
70
+ */
71
+ const AbCard = ({ title, href, description, eyebrow, media, footer, headingLevel = 3, className, as = 'article', id }: AbCardProps): ReactElement => {
72
+ const H = `h${headingLevel}` as unknown as ComponentType<{ className?: string; children?: ReactNode }>; // ♿
73
+ const Root = as as unknown as ComponentType<Record<string, unknown>>; // 🧱
74
+ return (
75
+ <Root id={id} className={clsx('AbCard', styles.abCard, 'ab-motion-interactive', className)} data-ab-part="card" data-linked={href ? 'true' : 'false'}>
76
+ {media && <div className={styles.abCardMedia} aria-hidden="true">{media}</div>}
77
+ {eyebrow && <p className={styles.abCardEyebrow}>{eyebrow}</p>}
78
+ <H className={styles.abCardTitle}>
79
+ {href ? <Link href={href} className={styles.abCardLink}>{title}</Link> : title}
80
+ </H>
81
+ {description && <p className={styles.abCardDescription}>{description}</p>}
82
+ {footer && <div className={styles.abCardFooter}>{footer}</div>}
83
+ </Root>
84
+ );
85
+ };
86
+
87
+ // 📦 exports
88
+ export default AbCard;
89
+ export { AbCard };
@@ -0,0 +1,68 @@
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: AbCard - Styles (G45)
28
+ * @file: ab-card/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
+ /* 🃏 card */
40
+ .abCard {
41
+ position: relative; /* 📍 overlay anchor */
42
+ display: flex; /* 📐 */
43
+ flex-direction: column; /* ⬇️ */
44
+ gap: 8px; /* ↕️ */
45
+ padding: 20px; /* 📦 */
46
+ border-radius: var(--ab-pane-radius, 16px); /* 🟢 theme 0.3.4 */
47
+ background: var(--ab-color-surface-container-low, rgb(0 0 0 / 0.03)); /* 🎨 */
48
+ color: var(--ab-color-on-surface, inherit); /* 🖋️ */
49
+ box-sizing: border-box; /* 📦 */
50
+ }
51
+ .abCardMedia { display: flex; color: var(--ab-color-primary, inherit); } /* 🖼️ */
52
+ .abCardEyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.75; } /* 🔝 */
53
+ .abCardTitle { margin: 0; font-size: 18px; font-weight: 600; line-height: 24px; } /* 🏷️ */
54
+ .abCardDescription { margin: 0; font-size: 14px; line-height: 20px; color: var(--ab-color-on-surface-variant, inherit); } /* 📝 */
55
+ .abCardFooter { margin-top: auto; display: flex; gap: 8px; align-items: center; font-size: 12px; } /* 🔚 */
56
+ /* 🔗 single link stretched over the card */
57
+ .abCardLink { color: inherit; text-decoration: none; } /* 🔗 */
58
+ .abCardLink::after { content: ''; position: absolute; inset: 0; border-radius: inherit; } /* 🧲 whole card clickable */
59
+ .abCard[data-linked='true']:hover { background: var(--ab-color-surface-container, rgb(0 0 0 / 0.06)); } /* 🖱️ */
60
+ .abCard:focus-within:has(.abCardLink:focus-visible) {
61
+ outline: var(--ab-focus-ring-width, 2px) solid var(--ab-color-primary, #8f4c38); /* ♿ ring on the card */
62
+ outline-offset: var(--ab-focus-ring-offset, 2px); /* ♿ */
63
+ }
64
+ .abCardLink:focus-visible { outline: none; } /* ♿ the card shows the ring */
65
+ /* 🎈 2px lift: laptop+ with a real pointer, and only when motion is OK (gap-review: no motion when reduced) */
66
+ @media (min-width: 1024px) and (hover: hover) and (prefers-reduced-motion: no-preference) {
67
+ .abCard[data-linked='true']:hover { transform: translateY(-2px); } /* 🎈 */
68
+ }
@@ -41,7 +41,7 @@
41
41
 
42
42
  import type { CSSProperties, ReactElement, ReactNode } from 'react';
43
43
  import { useState } from 'react';
44
- import Link from 'next/link';
44
+ import Link from '../ab-link'; // 🔗 G42: injectable via AbLinkProvider (default next/link)
45
45
  import clsx from 'clsx';
46
46
  import styles from './styles.module.css';
47
47
  import { AB_MOTION } from 'ab-nextjs-animations/motion'; // 🎬 transition class names (ab-nextjs-animations >= 0.2.4)
@@ -8,6 +8,7 @@
8
8
  * @project: ab-nextjs-components
9
9
  * @name: AbColor - Client (port of lyd-color)
10
10
  * @file: ab-color/index.tsx
11
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
11
12
  */
12
13
 
13
14
  'use client';
@@ -1,3 +1,35 @@
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: styles.module.css
28
+ * @file: ab-color/styles.module.css
29
+ * @type: CSS Stylesheet
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
1
33
  .abColor {
2
34
  display: inline-flex;
3
35
  flex-direction: column;
@@ -8,6 +8,7 @@
8
8
  * @project: ab-nextjs-components
9
9
  * @name: AbDemoBox - Client (port of lyd-demo-box)
10
10
  * @file: ab-demo-box/index.tsx
11
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
11
12
  */
12
13
 
13
14
  'use client';
@@ -1,3 +1,35 @@
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: styles.module.css
28
+ * @file: ab-demo-box/styles.module.css
29
+ * @type: CSS Stylesheet
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
1
33
  .abDemoBox {
2
34
  position: relative;
3
35
  display: flex;
@@ -8,6 +8,7 @@
8
8
  * @project: ab-nextjs-components
9
9
  * @name: AbDemoCode - Client (port of lyd-demo-code; prism soft-optional)
10
10
  * @file: ab-demo-code/index.tsx
11
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
11
12
  */
12
13
 
13
14
  'use client';
@@ -1,3 +1,35 @@
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: styles.module.css
28
+ * @file: ab-demo-code/styles.module.css
29
+ * @type: CSS Stylesheet
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
1
33
  .abDemoCode {
2
34
  position: relative;
3
35
  border-radius: 0.75rem;
@@ -36,7 +36,7 @@
36
36
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
37
  */
38
38
 
39
- // 🔣 one module per icon (ab-nextjs-icons ≥ 0.2.3): bundlers keep only these 8
39
+ // 🔣 one module per icon (ab-nextjs-icons ≥ 0.2.3): bundlers keep only these 15
40
40
  import arrowBack from 'ab-nextjs-icons/ab-icons/icons/arrow_back'; // ⏮️ AbCarouselPrev
41
41
  import arrowForward from 'ab-nextjs-icons/ab-icons/icons/arrow_forward'; // ⏭️ AbCarouselNext
42
42
  import lightMode from 'ab-nextjs-icons/ab-icons/icons/light_mode'; // 🌞 AbThemeToggle
@@ -45,6 +45,13 @@ import computer from 'ab-nextjs-icons/ab-icons/icons/computer'; // 🖥️ AbThe
45
45
  import language from 'ab-nextjs-icons/ab-icons/icons/language'; // 🌐 AbLocaleSwitcher
46
46
  import contentCopy from 'ab-nextjs-icons/ab-icons/icons/content_copy'; // 📋 AbInstallSnippet
47
47
  import check from 'ab-nextjs-icons/ab-icons/icons/check'; // ✅ AbInstallSnippet (copied)
48
+ import chevronLeft from 'ab-nextjs-icons/ab-icons/icons/chevron_left'; // ◀️ AbSidebar collapse (0.1.13)
49
+ import chevronRight from 'ab-nextjs-icons/ab-icons/icons/chevron_right'; // ▶️ AbSidebar expand (0.1.13)
50
+ import menu from 'ab-nextjs-icons/ab-icons/icons/menu'; // ☰ AbAppBar (0.1.13)
51
+ import moreVert from 'ab-nextjs-icons/ab-icons/icons/more_vert'; // ⋮ AbAppBar "More" (0.1.13)
52
+ import search from 'ab-nextjs-icons/ab-icons/icons/search'; // 🔎 AbSearchTrigger (0.1.13)
53
+ import close from 'ab-nextjs-icons/ab-icons/icons/close'; // ✖️ AbPage aside close (0.1.13)
54
+ import expandMore from 'ab-nextjs-icons/ab-icons/icons/expand_more'; // 🔽 AbLocaleSwitcher no-JS list (0.1.13)
48
55
  // 🧾 shape
49
56
  import type { AbIconSvgData } from './helpers';
50
57
 
@@ -58,4 +65,11 @@ export const AB_ICON_BUILTINS: Record<string, AbIconSvgData> = {
58
65
  language, // 🌐
59
66
  content_copy: contentCopy, // 📋
60
67
  check, // ✅
68
+ chevron_left: chevronLeft, // ◀️
69
+ chevron_right: chevronRight, // ▶️
70
+ menu, // ☰
71
+ more_vert: moreVert, // ⋮
72
+ search, // 🔎
73
+ close, // ✖️
74
+ expand_more: expandMore, // 🔽
61
75
  };
@@ -100,3 +100,40 @@ export function toAbIconSize(size: number | string | undefined): string {
100
100
  if (size == null) return '24px'; // 🧭 default 24
101
101
  return typeof size === 'number' ? `${size}px` : size; // 📏
102
102
  }
103
+
104
+
105
+ // 🔕 names we already warned about (one warning per name per page load)
106
+ const warned = new Set<string>()
107
+
108
+ /**
109
+ * ⚠️ 0.1.13 (G2): warns once in development when a name isn't an AbIcon (registered, explicit `svg`, or in
110
+ * the map). It falls back to the Material Symbols ligature, which shows the NAME as text once the font is gone.
111
+ * Register it with `registerAbIcons({ name: icon })` from `ab-nextjs-icons/ab-icons/icons/<name>`.
112
+ */
113
+ export function warnAbIconMissing(name: string): void {
114
+ if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') return // 🤫 silent in prod
115
+ if (warned.has(name)) return // 🔕 once
116
+ warned.add(name) // 📝
117
+ console.warn(`[AbIcon] "${name}" is not a registered AbIcon. Register it: registerAbIcons({ ${name} }) from 'ab-nextjs-icons/ab-icons/icons/${name}'. (Falling back to the Material Symbols font ligature.)`) // ⚠️
118
+ }
119
+
120
+ /**
121
+ * 🆔 0.1.13 (Joseph): scopeAbIconIds — suffix every `id` in the markup, plus the `url(#…)` / `href="#…"`
122
+ * refs that point at it, so two filled Homes on one page (bottom bar + sidebar) never share a mask.
123
+ * Same rules as ab-nextjs-icons 0.2.4 `scopeAbIconSvgIds` (copied: importing it is fine, but the client
124
+ * bundle rule above says no icon-package imports here). `AbIcon` calls it with React `useId()`.
125
+ */
126
+ export function scopeAbIconIds(markup: string, scope: string): string {
127
+ const ids = Array.from(markup.matchAll(/\sid="([^"]+)"/g), (m) => m[1]); // 🔎 declared ids
128
+ if (ids.length === 0) return markup; // 🙅 most outlined icons
129
+ const suffix = `-${scope.replace(/[^A-Za-z0-9_-]/g, '') || 'x'}`; // 🧼 `:r1:` / `«r1»` → `-r1`
130
+ let out = markup;
131
+ for (const id of new Set(ids)) {
132
+ const esc = id.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // 🛡️ regex-escape
133
+ out = out
134
+ .replace(new RegExp(`(\\sid=")${esc}(")`, 'g'), `$1${id}${suffix}$2`) // 🆔
135
+ .replace(new RegExp(`url\\(#${esc}\\)`, 'g'), `url(#${id}${suffix})`) // 🎭
136
+ .replace(new RegExp(`(href=")#${esc}(")`, 'g'), `$1#${id}${suffix}$2`); // 🔗
137
+ }
138
+ return out; // ✅
139
+ }
package/ab-icon/index.tsx CHANGED
@@ -43,11 +43,11 @@
43
43
  'use client';
44
44
 
45
45
  // ⚛️ types
46
- import type { CSSProperties, ReactElement } from 'react';
46
+ import { useId, type CSSProperties, type ReactElement } from 'react';
47
47
  // 🧵 classes
48
48
  import clsx from 'clsx';
49
49
  // 🧮 shared helpers (NO icon map import: client bundles stay small)
50
- import { getAbIconStroke, getRegisteredAbIcon, pickAbIconMarkup, registerAbIcons, toAbIconSize, type AbIconSvgData, type AbIconVariant, type AbIconWeight } from './helpers';
50
+ import { scopeAbIconIds, warnAbIconMissing, getAbIconStroke, getRegisteredAbIcon, pickAbIconMarkup, registerAbIcons, toAbIconSize, type AbIconSvgData, type AbIconVariant, type AbIconWeight } from './helpers';
51
51
  // 🗂️ the 8 glyphs components draw themselves (per-icon modules, not the map)
52
52
  import { AB_ICON_BUILTINS } from './builtin';
53
53
  // 🎨 styles
@@ -56,13 +56,14 @@ import styles from './styles.module.css';
56
56
  // 📦 helpers for consumers (registerAbIcons, types)
57
57
  export * from './helpers';
58
58
  export { AB_ICON_BUILTINS } from './builtin';
59
+ export { AbIconRegistrar, type AbIconRegistrarProps } from './registrar'; // 🗂️ server-safe registration (Joseph #11)
59
60
 
60
61
  // 🗂️ register built-ins at module scope (same on server render + hydration → no mismatch)
61
62
  registerAbIcons(AB_ICON_BUILTINS);
62
63
 
63
64
  // ⚙️ props
64
65
  export interface AbIconProps {
65
- name: string; // 🗂️ AbIcons name (snake_case); Material ligature fallback if unknown
66
+ name: string; // 🗂️ AbIcons name (snake_case); AbIcons name (registered / svg / map); unknown = Material ligature fallback + dev warning
66
67
  variant?: AbIconVariant; // 🎚️ outlined (default) | filled
67
68
  filled?: boolean; // 🕰️ legacy alias for variant="filled"
68
69
  weight?: AbIconWeight | number; // 📏 100–700 (outlined), default 200
@@ -74,10 +75,12 @@ export interface AbIconProps {
74
75
  style?: CSSProperties; // 🎨
75
76
  }
76
77
 
77
- /** 🔣 AbIcons SVG icon (client): `svg` prop → registry → Material ligature fallback. */
78
+ /** 🔣 AbIcons SVG icon (client): `svg` prop → registry → Material ligature fallback + dev warning. */
78
79
  const AbIcon = ({ name, variant, filled = false, weight, size, label, title, svg, className, style }: AbIconProps): ReactElement => {
79
80
  // 🔍 resolve markup without the full map
80
81
  const markup = pickAbIconMarkup(svg ?? getRegisteredAbIcon(name), variant ?? (filled ? 'filled' : 'outlined'));
82
+ // 🆔 one id per rendered instance (Joseph: a hidden twin's mask broke the active Home)
83
+ const uid = useId();
81
84
  // 🎚️ legacy `filled` → variant
82
85
  const v: AbIconVariant = variant ?? (filled ? 'filled' : 'outlined');
83
86
  // 🏷️ accessible name: `label` (new) or `title` (legacy)
@@ -98,18 +101,21 @@ const AbIcon = ({ name, variant, filled = false, weight, size, label, title, svg
98
101
  title={title} // 💬 legacy tooltip only
99
102
  {...a11y} // ♿
100
103
  // 🔒 trusted, package-generated static markup (never user input)
101
- dangerouslySetInnerHTML={{ __html: markup }}
104
+ dangerouslySetInnerHTML={{ __html: scopeAbIconIds(markup, uid) }}
102
105
  />
103
106
  );
104
107
  }
105
108
 
106
- // 🕰️ fallback: Material Symbols ligature (pre-G2 behaviour) for names not in AbIcons
109
+ // 🕰️ 0.1.13 (James review): NON-breaking fallback for unregistered names. A patch must not blank icons,
110
+ // so an unknown name still renders the pre-G2 Material Symbols ligature (needs the app's font), and
111
+ // warns once in development so the missing registration gets fixed before the app drops the font.
112
+ warnAbIconMissing(name);
107
113
  return (
108
114
  <span
109
- className={clsx('material-symbols-rounded', 'icon', styles.abIconFont, className)} // 🏷️
115
+ className={clsx('AbIcon', 'material-symbols-rounded', 'icon', styles.abIconFont, className)} // 🏷️ legacy font class
110
116
  style={{ ...style, fontSize: toAbIconSize(size) }} // 📏
111
- data-filled={v === 'filled' ? 'true' : 'false'} // 🎚️
112
117
  data-icon={name} // 🗂️
118
+ data-filled={v === 'filled' ? 'true' : 'false'} // 🎚️
113
119
  data-ab-icon-fallback="font" // 🔎 easy to audit
114
120
  title={title} // 💬
115
121
  {...a11y} // ♿