ab-nextjs-components 0.4.2 → 0.5.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 (80) hide show
  1. package/CHANGELOG.md +66 -17
  2. package/README.md +1 -0
  3. package/ab-app-bar/index.tsx +5 -5
  4. package/ab-app-bar/styles.module.css +5 -5
  5. package/ab-bottom-drawer/index.tsx +3 -3
  6. package/ab-bottom-drawer/styles.module.css +2 -2
  7. package/ab-bottom-drawer/use-ab-swipe-down.ts +1 -1
  8. package/ab-breadcrumbs/index.tsx +1 -1
  9. package/ab-breadcrumbs/styles.module.css +5 -5
  10. package/ab-button/index.tsx +1 -1
  11. package/ab-button/styles.module.css +5 -5
  12. package/ab-callout/index.tsx +1 -1
  13. package/ab-callout/styles.module.css +1 -1
  14. package/ab-carousel/helpers.ts +1 -1
  15. package/ab-carousel/index.tsx +4 -4
  16. package/ab-carousel/styles.module.css +2 -2
  17. package/ab-chip/styles.module.css +1 -1
  18. package/ab-code-block/index.tsx +2 -2
  19. package/ab-code-block/styles.module.css +1 -1
  20. package/ab-content-tabs/index.tsx +1 -1
  21. package/ab-doc-pager/index.tsx +1 -1
  22. package/ab-drawer/gestures.ts +1 -1
  23. package/ab-drawer/index.tsx +3 -3
  24. package/ab-drawer/kit.module.css +13 -13
  25. package/ab-drawer/styles.module.css +2 -2
  26. package/ab-drawer/use-ab-edge-swipe.ts +2 -2
  27. package/ab-flow-diagram/helpers.ts +2 -2
  28. package/ab-flow-diagram/index.tsx +2 -2
  29. package/ab-flow-diagram/styles.module.css +3 -3
  30. package/ab-icon/helpers.ts +1 -1
  31. package/ab-icon/index.tsx +3 -3
  32. package/ab-icon/registrar.tsx +1 -1
  33. package/ab-icon-button/index.tsx +1 -1
  34. package/ab-install-snippet/styles.module.css +1 -1
  35. package/ab-link/index.tsx +2 -2
  36. package/ab-link/locale.ts +1 -1
  37. package/ab-list/styles.module.css +1 -1
  38. package/ab-locale-switcher/index.tsx +6 -6
  39. package/ab-locale-switcher/styles.module.css +5 -5
  40. package/ab-mobile-header/index.tsx +6 -6
  41. package/ab-nav-drawer/index.tsx +11 -6
  42. package/ab-navbar/index.tsx +1 -1
  43. package/ab-navbar/styles.module.css +1 -1
  44. package/ab-navbar/view.tsx +1 -1
  45. package/ab-package-card/index.tsx +3 -3
  46. package/ab-package-card/previews.tsx +1 -1
  47. package/ab-package-card/styles.module.css +2 -2
  48. package/ab-playground-scene/i18n.module.css +1 -1
  49. package/ab-playground-scene/icons.tsx +1 -1
  50. package/ab-playground-scene/index.tsx +4 -4
  51. package/ab-playground-scene/labels.ts +3 -3
  52. package/ab-playground-scene/scenes.tsx +4 -4
  53. package/ab-playground-scene/styles.module.css +6 -6
  54. package/ab-playground-scene/upgraded.tsx +3 -3
  55. package/ab-playground-scene/welcome.tsx +1 -1
  56. package/ab-progress-chips/index.tsx +1 -1
  57. package/ab-search-drawer/index.tsx +4 -4
  58. package/ab-search-trigger/index.tsx +5 -5
  59. package/ab-search-trigger/styles.module.css +3 -3
  60. package/ab-settings-drawer/index.tsx +2 -2
  61. package/ab-sidebar/active.ts +105 -0
  62. package/ab-sidebar/index.tsx +10 -6
  63. package/ab-sidebar/profile-button.tsx +2 -2
  64. package/ab-sidebar/styles.module.css +4 -4
  65. package/ab-sidebar/view.tsx +16 -8
  66. package/ab-theme-mode/index.tsx +3 -3
  67. package/ab-theme-toggle/index.tsx +6 -6
  68. package/ab-theme-toggle/styles.module.css +2 -2
  69. package/ab-toc/index.tsx +3 -3
  70. package/ab-toc/promo.tsx +2 -2
  71. package/ab-toc/styles.module.css +1 -1
  72. package/ab-toc-drawer/index.tsx +1 -1
  73. package/ab-version-switcher/index.tsx +2 -2
  74. package/css/dialog.css +1 -1
  75. package/index.ts +17 -14
  76. package/package.json +1 -1
  77. package/server/ab-button/index.tsx +1 -1
  78. package/server/ab-icon/index.tsx +2 -2
  79. package/server/ab-sidebar/index.tsx +3 -2
  80. package/types/index.d.ts +7 -7
@@ -66,7 +66,7 @@ export interface AbThemeToggleLabels {
66
66
  light: string; // 🌞 "Light"
67
67
  dark: string; // 🌙 "Dark"
68
68
  system: string; // 🖥️ "System"
69
- // 🎯 0.1.14 (John): action names for the icon button when it shows the target mode,
69
+ // 🎯 0.1.14: action names for the icon button when it shows the target mode,
70
70
  // e.g. { dark: 'Switch to dark theme', light: 'Switch to light theme' }. Falls back to "Theme: Dark"
71
71
  switchTo?: Partial<Record<AbThemeMode, string>>;
72
72
  }
@@ -82,15 +82,15 @@ export interface AbThemeToggleProps {
82
82
  icons?: Partial<Record<AbThemeMode, ReactNode>>; // 🖼️ override glyphs
83
83
  size?: 'sm' | 'md'; // 📏 sm = 32px, md = 40px segments (hit area ≥ 24px either way)
84
84
  appearance?: 'fill' | 'thumb'; // 🌗 0.1.14 (P7): 'thumb' = the Home pill (28px segments, raised card thumb, filled active glyph). Default 'fill'
85
- // 🎯 0.1.14 (John): icon variant only. 'target' = glyph + name of the mode a click switches TO
86
- // (moon in light, sun in dark, like the Home mock). 0.3.2 (God): default 'target' for every appearance (was 'current' for fill)
85
+ // 🎯 0.1.14: icon variant only. 'target' = glyph + name of the mode a click switches TO
86
+ // (moon in light, sun in dark, like the Home mock). 0.3.2: default 'target' for every appearance (was 'current' for fill)
87
87
  iconShows?: 'current' | 'target';
88
88
  className?: string; // 🏷️
89
89
  style?: CSSProperties; // 🎨
90
90
  }
91
91
 
92
92
  // 🔣 default glyphs (AbIcons names)
93
- // 🔗 0.3.2 (Joseph): the shared map, so the glyphs match AbMobileHeader's theme button
93
+ // 🔗 0.3.2: the shared map, so the glyphs match AbMobileHeader's theme button
94
94
  const DEFAULT_ICON_NAMES: Readonly<Record<AbThemeMode, string>> = AB_THEME_MODE_ICONS;
95
95
 
96
96
  /**
@@ -144,7 +144,7 @@ function AbThemeToggleView(props: AbThemeToggleProps & { engine: Pick<AbThemeMod
144
144
 
145
145
  // 🖼️ glyph for a mode (decorative: the label names it)
146
146
  // P7 thumb: 17px segments, filled while active (spec §2 icons)
147
- // 0.3.2 (Joseph): variant="icon" uses the header's 24px glyph (was 22 thumb / 20), so it matches AbMobileHeader
147
+ // 0.3.2: variant="icon" uses the header's 24px glyph (was 22 thumb / 20), so it matches AbMobileHeader
148
148
  const glyphSize = variant === 'icon' ? AB_THEME_ICON_BUTTON_GLYPH : thumb ? 17 : 20; // 📏
149
149
  const glyph = (mode: AbThemeMode, active = false) =>
150
150
  icons?.[mode] ?? <AbIcon name={DEFAULT_ICON_NAMES[mode]} size={glyphSize} variant={thumb && active ? 'filled' : undefined} />;
@@ -152,7 +152,7 @@ function AbThemeToggleView(props: AbThemeToggleProps & { engine: Pick<AbThemeMod
152
152
  // 🔘 single cycling button variant
153
153
  if (variant === 'icon') {
154
154
  const next = modes[(Math.max(0, modes.indexOf(current)) + 1) % modes.length]; // ⏭️
155
- const target = (iconShows ?? 'target') === 'target'; // 🎯 0.3.2 (God): always the target by default, like AbMobileHeader (was 'current' for fill)
155
+ const target = (iconShows ?? 'target') === 'target'; // 🎯 0.3.2: always the target by default, like AbMobileHeader (was 'current' for fill)
156
156
  const name = target ? (labels.switchTo?.[next] ?? `${labels.group}: ${labels[next]}`) : `${labels.group}: ${labels[current]}`; // ♿
157
157
  return (
158
158
  <button
@@ -61,7 +61,7 @@
61
61
  cursor: pointer; /* 👆 */
62
62
  --ab-motion-duration: var(--ab-motion-duration-short, 160ms); /* 🎞️ colour fade = .ab-motion-colors (ab-nextjs-animations) */
63
63
  }
64
- /* 👆 0.3.2 (God, 0.2.23 gaps): the single icon button is a 44px tap target (was 40px), the same 44×44 as
64
+ /* 👆 0.3.2 (0.2.23 gaps): the single icon button is a 44px tap target (was 40px), the same 44×44 as
65
65
  AbMobileHeader's theme button; the segments keep 40/32px (radios inside one pill) */
66
66
  .icon {
67
67
  width: 44px; /* 📏 */
@@ -73,7 +73,7 @@
73
73
  height: 32px; /* 📏 */
74
74
  }
75
75
 
76
- /* 👆 0.3.2 (God): every radio segment and the sm icon button get an invisible 44×44 hit area centred on them, so
76
+ /* 👆 0.3.2: every radio segment and the sm icon button get an invisible 44×44 hit area centred on them, so
77
77
  the 40/32/28px visuals stay while the tap target is ≥ 44px (WCAG 2.5.5). Neighbouring areas overlap by a few px;
78
78
  the later segment wins there, which is fine for adjacent radios */
79
79
  .segment,
package/ab-toc/index.tsx CHANGED
@@ -62,7 +62,7 @@ export const AB_MAIN_SCROLLER_SELECTOR = '[data-ab-part="main-content"]';
62
62
  * Use it as `useAbScrollSpy({ root })` / `scrollToAbSection(id, { container })`.
63
63
  *
64
64
  * ⚠️ Call it only in an effect or an event handler, **never during render**: it reads the DOM, so a render
65
- * call returns `null` on the server and the element on the client (hydration mismatch). (James nit)
65
+ * call returns `null` on the server and the element on the client (hydration mismatch). (nit)
66
66
  */
67
67
  export function getAbMainScroller(from?: Element | null): HTMLElement | null {
68
68
  if (typeof document === 'undefined') return null; // 🖥️ SSR
@@ -86,7 +86,7 @@ export interface AbTocProps {
86
86
  items: AbTocItem[]; // 📑
87
87
  activeId?: string | null; // 🎯 e.g. from useAbScrollSpy (hooks 0.1.7)
88
88
  title?: string; // 🏷️ default "On this page"
89
- label?: string; // 🏷️ 0.1.13 (Joseph #16): alias of `title`; `title` wins when both are set
89
+ label?: string; // 🏷️ 0.1.13 (#16): alias of `title`; `title` wins when both are set
90
90
  onNavigate?: (id: string) => void; // 🔔 e.g. scrollToAbSection(id, { container }) (hooks 0.1.7); without it a plain #id jump, which scrolls the nearest scroller (the main pane in core 0.1.6 panes)
91
91
  id?: string; // 🆔 root id (default "ab-toc"); the title gets `${id}-title`
92
92
  className?: string; // 🏷️
@@ -158,5 +158,5 @@ const AbToc = ({ items, activeId, label, title = label ?? 'On this page', onNavi
158
158
  export default AbToc;
159
159
  export { AbToc };
160
160
 
161
- // 🆕 0.2.1 (God 02:44): the aside "New" card
161
+ // 🆕 0.2.1: the aside "New" card
162
162
  export { AbTocPromo, type AbTocPromoProps } from './promo';
package/ab-toc/promo.tsx CHANGED
@@ -24,7 +24,7 @@
24
24
  * SOFTWARE.
25
25
  *
26
26
  * @project: ab-nextjs-components
27
- * @name: AbTocPromo (0.2.1, God 02:44, mock .toc-card)
27
+ * @name: AbTocPromo (0.2.1, approved, mock .toc-card)
28
28
  * @file: ab-toc/promo.tsx
29
29
  * @type: React Component (no hooks: client + server)
30
30
  * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
@@ -54,7 +54,7 @@ export interface AbTocPromoProps {
54
54
  children?: ReactNode; // 📝 the 11.5px muted subtitle (a `<code>` inside is 10.5px)
55
55
  badge?: ReactNode; // 🆕 the small chip (default "New"; `null` = none)
56
56
  href?: string; // 🔗 makes the title a link (the whole card clicks)
57
- // ♿ 0.3.2 (God, 0.2.23 gaps): the card sits INSIDE the page aside, so by default its root is a plain <div> (no
57
+ // ♿ 0.3.2 (0.2.23 gaps): the card sits INSIDE the page aside, so by default its root is a plain <div> (no
58
58
  // unnamed nested <aside> landmark). With `label` it becomes a NAMED <aside aria-label={label}> instead
59
59
  label?: string;
60
60
  className?: string; // 🏷️
@@ -65,7 +65,7 @@
65
65
  .abTocFooter a svg { flex: none; width: 15px; height: 15px; color: var(--ab-color-faint, inherit); } /* 🔣 GitHub · north_east */
66
66
  .abTocFooter > ul { list-style: none; margin: 0; padding: 0; }
67
67
 
68
- /* 🆕 0.2.1 (God 02:44): AbTocPromo, the aside "New" card (mock .toc-card), theme tokens only */
68
+ /* 🆕 0.2.1: AbTocPromo, the aside "New" card (mock .toc-card), theme tokens only */
69
69
  .abTocPromo {
70
70
  position: relative; /* 📌 the stretched link */
71
71
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; /* 📐 */
@@ -77,7 +77,7 @@ export interface AbTocDrawerProps {
77
77
  }
78
78
 
79
79
  /**
80
- * ➡️ AbTocDrawer — John's right drawer (drawers v2 §3): the page aside ("On this page") on mobile.
80
+ * ➡️ AbTocDrawer — the right drawer (drawers v2 §3): the page aside ("On this page") on mobile.
81
81
  *
82
82
  * - 🧭 Only for routes whose layout has an aside: render it (and enable the right edge swipe) there, nowhere else
83
83
  * - 📐 296px, 16 0 0 16 radius, title Mulish 800 20px; 44px outline rows on a 2px rail, level 3 indented 16px,
@@ -62,7 +62,7 @@ export interface AbVersionOption {
62
62
 
63
63
  /** ⚙️ props */
64
64
  export interface AbVersionSwitcherProps {
65
- label?: string; // 🏷️ text before the version; default none (0.2.0, God 01:27: the app IS the docs, so no "Docs" prefix)
65
+ label?: string; // 🏷️ text before the version; default none (0.2.0, the app IS the docs, so no "Docs" prefix)
66
66
  version: string; // ✅ current version (shown bold), e.g. 'v0.2.x'
67
67
  versions?: readonly AbVersionOption[]; // 📋 the choices (none / one = a static label, no menu)
68
68
  onSelect?: (value: string) => void; // 📣 button items
@@ -80,7 +80,7 @@ const AbVersionSwitcher = ({ label = '', version, versions = [], onSelect, menuL
80
80
  const menuId = `ab-version-menu-${useId().replace(/:/g, '')}`; // 🆔
81
81
  const wrap = useRef<HTMLDivElement>(null); // 📍
82
82
  const btn = useRef<HTMLButtonElement>(null); // 📍
83
- const name = menuLabel ?? (label ? `${label} ${version}` : `Version ${version}`); // ♿ WCAG 2.5.3 label-in-name (James); no label → "Version v0.2.x" (James P2, still contains the visible text)
83
+ const name = menuLabel ?? (label ? `${label} ${version}` : `Version ${version}`); // ♿ WCAG 2.5.3 label-in-name; no label → "Version v0.2.x" (P2, still contains the visible text)
84
84
  const hasMenu = versions.length > 1; // 📋
85
85
 
86
86
  // ⎋ Escape + outside click close it
package/css/dialog.css CHANGED
@@ -138,7 +138,7 @@ li.dialog-list-item {
138
138
  transform-origin: left;
139
139
  opacity: var(--opacity-dialog-list-item, 0.68);
140
140
  user-select: none;
141
- /* ⚠️ named motion exception (James review): consumer-rendered markup, no component can add an ab-motion-* class; pinned in __tests__/motion-from-animations.test.tsx */
141
+ /* ⚠️ named motion exception (review): consumer-rendered markup, no component can add an ab-motion-* class; pinned in __tests__/motion-from-animations.test.tsx */
142
142
  transition: all 0.2s ease-in-out;
143
143
  }
144
144
 
package/index.ts CHANGED
@@ -142,11 +142,11 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
142
142
  { name: 'AbProfileAvatar', file: 'ab-profile-avatar/index.tsx', kind: 'server', status: 'Done' }, // 🆕 0.2.1 initials / photo / glyph circle (no hooks: client + server)
143
143
  { name: 'AbVersionSwitcher', file: 'ab-version-switcher/index.tsx', kind: 'client', status: 'Done' },
144
144
  { name: 'AbBreadcrumbs', file: 'ab-breadcrumbs/index.tsx', kind: 'server', status: 'Done' },
145
- { name: 'AbDocPager', file: 'ab-doc-pager/index.tsx', kind: 'server', status: 'Done' }, // ⏮️⏭️ 0.3.4 (Joseph, 0.2.24 MDX docs): AbDocPager
146
- { name: 'AbContentTabs', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // 🗂️ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
147
- { name: 'AbContentTab', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // 🗂️ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
148
- { name: 'AbCodeBlock', file: 'ab-code-block/index.tsx', kind: 'server', status: 'Done' }, // 💻 0.3.4 (Joseph, 0.2.24 MDX docs): AbCodeBlock (+ its copy island)
149
- { name: 'AbCallout', file: 'ab-callout/index.tsx', kind: 'server', status: 'Done' }, // 💡 0.3.4 (Joseph, 0.2.24 MDX docs): AbCallout
145
+ { name: 'AbDocPager', file: 'ab-doc-pager/index.tsx', kind: 'server', status: 'Done' }, // ⏮️⏭️ 0.3.4 (0.2.24 MDX docs): AbDocPager
146
+ { name: 'AbContentTabs', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // 🗂️ 0.3.4 (0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
147
+ { name: 'AbContentTab', file: 'ab-content-tabs/index.tsx', kind: 'client', status: 'Done' }, // 🗂️ 0.3.4 (0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
148
+ { name: 'AbCodeBlock', file: 'ab-code-block/index.tsx', kind: 'server', status: 'Done' }, // 💻 0.3.4 (0.2.24 MDX docs): AbCodeBlock (+ its copy island)
149
+ { name: 'AbCallout', file: 'ab-callout/index.tsx', kind: 'server', status: 'Done' }, // 💡 0.3.4 (0.2.24 MDX docs): AbCallout
150
150
  { name: 'AbList', file: 'ab-list/index.tsx', kind: 'server', status: 'Done' },
151
151
  ]
152
152
 
@@ -184,12 +184,15 @@ export { default as AbBrand } from './ab-brand/index.tsx'
184
184
  export { default as AbName } from './ab-name/index.tsx'
185
185
  export { default as AbNavbar } from './ab-navbar/index.tsx'
186
186
  export { default as AbSidebar } from './ab-sidebar/index.tsx'
187
- // 👤 0.2.1 (God 02:44): the bottom-left sidebar profile button → AbSettingsDrawer (laptop + wide)
187
+ // 🎯 0.5.0: active-item matching shared by AbSidebar + AbNavDrawer (`activeMatch`, per-item `exact`)
188
+ export { getAbActiveHrefs, matchAbHref, normalizeAbHref, flattenAbNavItems } from './ab-sidebar/active.ts'
189
+ export type { AbActiveMatch, AbActiveMatchable, AbActiveMatchOptions } from './ab-sidebar/active.ts'
190
+ // 👤 0.2.1: the bottom-left sidebar profile button → AbSettingsDrawer (laptop + wide)
188
191
  export { default as AbSidebarProfileButton } from './ab-sidebar/profile-button.tsx'
189
192
  export type { AbSidebarProfileButtonProps } from './ab-sidebar/profile-button.tsx'
190
- // 📑 0.1.13 (Joseph): AbToc + the panes main-scroller helpers (also at `ab-nextjs-components/ab-toc`)
193
+ // 📑 0.1.13: AbToc + the panes main-scroller helpers (also at `ab-nextjs-components/ab-toc`)
191
194
  export { default as AbToc, getAbMainScroller, AB_MAIN_SCROLLER_SELECTOR } from './ab-toc/index.tsx'
192
- // 🆕 0.2.1 (God 02:44): the aside "New" card
195
+ // 🆕 0.2.1: the aside "New" card
193
196
  export { default as AbTocPromo } from './ab-toc/promo.tsx'
194
197
  export type { AbTocPromoProps } from './ab-toc/promo.tsx'
195
198
  export type { AbTocItem, AbTocProps } from './ab-toc/index.tsx'
@@ -209,14 +212,14 @@ export type { AbConfirmDrawerProps } from './ab-confirm-drawer/index.tsx'
209
212
  // 📱 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
210
213
  export { default as AbBottomDrawer } from './ab-bottom-drawer/index.tsx'
211
214
  export type { AbBottomDrawerProps } from './ab-bottom-drawer/index.tsx'
212
- // 👇 0.2.3 (Joseph, Welcome 0.2.21): swipe a bottom sheet down to close
215
+ // 👇 0.2.3 (Welcome 0.2.21): swipe a bottom sheet down to close
213
216
  export { useAbSwipeDown, isAbScrolledInside } from './ab-bottom-drawer/use-ab-swipe-down.ts'
214
217
  export type { UseAbSwipeDownOptions } from './ab-bottom-drawer/use-ab-swipe-down.ts'
215
218
  // 🆕 0.2.0 drawers v2: AbMobileHeader
216
219
  export { default as AbMobileHeader } from './ab-mobile-header/index.tsx'
217
220
  export type { AbMobileHeaderProps, AbMobileHeaderThemeMode, AbMobileHeaderLanguage } from './ab-mobile-header/index.tsx'
218
221
  export { AB_MOBILE_HEADER_THEME_CYCLE } from './ab-mobile-header/index.tsx' // 🌗 0.2.3
219
- // 🌗 0.2.3 (Joseph, Welcome 0.2.21): one shared theme mode for every toggle
222
+ // 🌗 0.2.3 (Welcome 0.2.21): one shared theme mode for every toggle
220
223
  export { AbThemeModeProvider, useAbThemeModeContext, AB_THEME_MODE_ICONS, AB_THEME_ICON_BUTTON_GLYPH } from './ab-theme-mode/index.tsx' // 🔣 0.3.2: + the shared theme glyphs
221
224
  export type { AbThemeModeProviderProps, AbThemeModeContextValue } from './ab-theme-mode/index.tsx'
222
225
  // 🆕 0.2.0 drawers v2: AbSearchDrawer
@@ -249,17 +252,17 @@ export { default as AbProductItem } from './ab-product-item/index.tsx'
249
252
  export { default as AbDemoBox } from './ab-demo-box/index.tsx'
250
253
  export { default as AbDemoCode } from './ab-demo-code/index.tsx'
251
254
  export { default as AbPolygon } from './server/ab-polygon/index.tsx'
252
- // 💡 0.3.4 (Joseph, 0.2.24 MDX docs): AbCallout
255
+ // 💡 0.3.4 (0.2.24 MDX docs): AbCallout
253
256
  export { default as AbCallout, AB_CALLOUT_ICONS } from './ab-callout/index.tsx'
254
257
  export type { AbCalloutProps, AbCalloutVariant } from './ab-callout/index.tsx'
255
- // 💻 0.3.4 (Joseph, 0.2.24 MDX docs): AbCodeBlock (+ its copy island)
258
+ // 💻 0.3.4 (0.2.24 MDX docs): AbCodeBlock (+ its copy island)
256
259
  export { default as AbCodeBlock } from './ab-code-block/index.tsx'
257
260
  export { default as AbCodeBlockCopy } from './ab-code-block/copy.tsx'
258
261
  export type { AbCodeBlockCopyProps } from './ab-code-block/copy.tsx'
259
262
  export type { AbCodeBlockProps } from './ab-code-block/index.tsx'
260
- // 🗂️ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
263
+ // 🗂️ 0.3.4 (0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
261
264
  export { default as AbContentTabs, AbContentTab } from './ab-content-tabs/index.tsx'
262
265
  export type { AbContentTabsProps, AbContentTabProps } from './ab-content-tabs/index.tsx'
263
- // ⏮️⏭️ 0.3.4 (Joseph, 0.2.24 MDX docs): AbDocPager
266
+ // ⏮️⏭️ 0.3.4 (0.2.24 MDX docs): AbDocPager
264
267
  export { default as AbDocPager } from './ab-doc-pager/index.tsx'
265
268
  export type { AbDocPagerProps, AbDocPagerLink } from './ab-doc-pager/index.tsx'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-nextjs-components",
3
- "version": "0.4.2",
3
+ "version": "0.5.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 @@ import clsx from 'clsx';
43
43
  // 🔗 404 gaps: the provider-aware link (client component, fine to render from a server twin)
44
44
  import AbLink from '../../ab-link';
45
45
  // 🎨 styles (server copy)
46
- // 🧬 0.2.3 (Joseph 03:41): ONE source for the button box — the client module's CSS (no server copy to drift)
46
+ // 🧬 0.2.3: ONE source for the button box — the client module's CSS (no server copy to drift)
47
47
  import styles from '../../ab-button/styles.module.css';
48
48
  // 🧮 the SAME rules as the client twin
49
49
  import {
@@ -67,7 +67,7 @@ const AbIcon = ({ name, variant, filled = false, weight, size, label, title, svg
67
67
  const want: AbIconVariant = variant ?? (filled ? 'filled' : 'outlined');
68
68
  // 🔍 explicit → registered → whole map (weight is applied by CSS, so ask for the raw markup)
69
69
  const markup = pickAbIconMarkup(svg ?? getRegisteredAbIcon(name), want) ?? getAbIconSvg(name, want);
70
- // 🆔 one id per rendered instance (Joseph: a hidden twin's mask broke the active Home)
70
+ // 🆔 one id per rendered instance (a hidden twin's mask broke the active Home)
71
71
  const uid = useId();
72
72
  // 🎚️ legacy `filled` → variant
73
73
  const v: AbIconVariant = variant ?? (filled ? 'filled' : 'outlined');
@@ -94,7 +94,7 @@ const AbIcon = ({ name, variant, filled = false, weight, size, label, title, svg
94
94
  );
95
95
  }
96
96
 
97
- // 🕰️ 0.1.13 (James review): NON-breaking fallback for unregistered names. A patch must not blank icons,
97
+ // 🕰️ 0.1.13 (review): NON-breaking fallback for unregistered names. A patch must not blank icons,
98
98
  // so an unknown name still renders the pre-G2 Material Symbols ligature (needs the app's font), and
99
99
  // warns once in development so the missing registration gets fixed before the app drops the font.
100
100
  warnAbIconMissing(name);
@@ -41,7 +41,7 @@ import type { ReactElement } from 'react';
41
41
  // 🔣 server AbIcon (full AbIcons map; no JS shipped)
42
42
  import AbIcon from '../ab-icon';
43
43
  // 🖼️ shared view (same markup as the client twin)
44
- import { AbSidebarView, isAbSidebarActive, type AbSidebarBaseProps } from '../../ab-sidebar/view';
44
+ import { AbSidebarView, createAbSidebarActive, toAbSidebarSections, type AbSidebarBaseProps } from '../../ab-sidebar/view';
45
45
  // 🌍 0.1.13: strip `/fr` from activeHref when `locales` is given (pure helper, server-safe)
46
46
  import { stripAbLocalePrefix } from '../../ab-link/locale';
47
47
 
@@ -54,7 +54,8 @@ export type AbSidebarProps = AbSidebarBaseProps;
54
54
  /** 🧭 AbSidebar (server, G40): same markup as the client twin; active state from `activeHref` / legacy `page`. */
55
55
  const AbSidebar = (props: AbSidebarProps): ReactElement => {
56
56
  const { page, activeHref } = props;
57
- const active = (href: string, value?: string) => (page ? page === value : isAbSidebarActive(href, activeHref && stripAbLocalePrefix(activeHref, props.locales))); // 🎯
57
+ const isOn = createAbSidebarActive(toAbSidebarSections(props.sections, props.links), activeHref && stripAbLocalePrefix(activeHref, props.locales), props.activeMatch); // 🥇 0.5.0: deepest match by default
58
+ const active = (href: string, value?: string) => (page ? page === value : isOn(href)); // 🎯
58
59
  return <AbSidebarView props={props} Icon={AbIcon} active={active} />;
59
60
  };
60
61
 
package/types/index.d.ts CHANGED
@@ -75,7 +75,7 @@ export { default as AbBrand } from '../ab-brand/index.tsx';
75
75
  export { default as AbName } from '../ab-name/index.tsx';
76
76
  export { default as AbNavbar } from '../ab-navbar/index.tsx';
77
77
  export { default as AbSidebar } from '../ab-sidebar/index.tsx';
78
- // 📑 0.1.13 (Joseph): AbToc + the panes main-scroller helpers (also at `ab-nextjs-components/ab-toc`)
78
+ // 📑 0.1.13: 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
  // 🆕 0.2.1: the aside "New" card
81
81
  export { default as AbTocPromo } from '../ab-toc/promo.tsx';
@@ -97,14 +97,14 @@ export type { AbConfirmDrawerProps } from '../ab-confirm-drawer/index.tsx';
97
97
  // 📱 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
98
98
  export { default as AbBottomDrawer } from '../ab-bottom-drawer/index.tsx';
99
99
  export type { AbBottomDrawerProps } from '../ab-bottom-drawer/index.tsx';
100
- // 👇 0.2.3 (Joseph, Welcome 0.2.21): swipe a bottom sheet down to close
100
+ // 👇 0.2.3 (Welcome 0.2.21): swipe a bottom sheet down to close
101
101
  export { useAbSwipeDown, isAbScrolledInside } from '../ab-bottom-drawer/use-ab-swipe-down.ts';
102
102
  export type { UseAbSwipeDownOptions } from '../ab-bottom-drawer/use-ab-swipe-down.ts';
103
103
  // 🆕 0.2.0 drawers v2: AbMobileHeader
104
104
  export { default as AbMobileHeader } from '../ab-mobile-header/index.tsx';
105
105
  export type { AbMobileHeaderProps, AbMobileHeaderThemeMode, AbMobileHeaderLanguage } from '../ab-mobile-header/index.tsx';
106
106
  export { AB_MOBILE_HEADER_THEME_CYCLE } from '../ab-mobile-header/index.tsx'; // 🌗 0.2.3
107
- // 🌗 0.2.3 (Joseph, Welcome 0.2.21): one shared theme mode for every toggle
107
+ // 🌗 0.2.3 (Welcome 0.2.21): one shared theme mode for every toggle
108
108
  export { AbThemeModeProvider, useAbThemeModeContext, AB_THEME_MODE_ICONS, AB_THEME_ICON_BUTTON_GLYPH } from '../ab-theme-mode/index.tsx';
109
109
  export type { AbThemeModeProviderProps, AbThemeModeContextValue } from '../ab-theme-mode/index.tsx';
110
110
  // 🆕 0.2.0 drawers v2: AbSearchDrawer
@@ -139,17 +139,17 @@ export { default as AbProductItem } from '../ab-product-item/index.tsx';
139
139
  export { default as AbDemoBox } from '../ab-demo-box/index.tsx';
140
140
  export { default as AbDemoCode } from '../ab-demo-code/index.tsx';
141
141
  export { default as AbPolygon } from '../server/ab-polygon/index.tsx';
142
- // 💡 0.3.4 (Joseph, 0.2.24 MDX docs): AbCallout
142
+ // 💡 0.3.4 (0.2.24 MDX docs): AbCallout
143
143
  export { default as AbCallout, AB_CALLOUT_ICONS } from '../ab-callout/index.tsx';
144
144
  export type { AbCalloutProps, AbCalloutVariant } from '../ab-callout/index.tsx';
145
- // 💻 0.3.4 (Joseph, 0.2.24 MDX docs): AbCodeBlock (+ its copy island)
145
+ // 💻 0.3.4 (0.2.24 MDX docs): AbCodeBlock (+ its copy island)
146
146
  export { default as AbCodeBlock } from '../ab-code-block/index.tsx';
147
147
  export { default as AbCodeBlockCopy } from '../ab-code-block/copy.tsx';
148
148
  export type { AbCodeBlockCopyProps } from '../ab-code-block/copy.tsx';
149
149
  export type { AbCodeBlockProps } from '../ab-code-block/index.tsx';
150
- // 🗂️ 0.3.4 (Joseph, 0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
150
+ // 🗂️ 0.3.4 (0.2.24 MDX docs): AbContentTabs + AbContentTab (MDX <Tabs>/<Tab>)
151
151
  export { default as AbContentTabs, AbContentTab } from '../ab-content-tabs/index.tsx';
152
152
  export type { AbContentTabsProps, AbContentTabProps } from '../ab-content-tabs/index.tsx';
153
- // ⏮️⏭️ 0.3.4 (Joseph, 0.2.24 MDX docs): AbDocPager
153
+ // ⏮️⏭️ 0.3.4 (0.2.24 MDX docs): AbDocPager
154
154
  export { default as AbDocPager } from '../ab-doc-pager/index.tsx';
155
155
  export type { AbDocPagerProps, AbDocPagerLink } from '../ab-doc-pager/index.tsx';