ab-nextjs-components 0.4.2 โ†’ 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +81 -17
  2. package/README.md +16 -2
  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/focus.tsx +63 -0
  19. package/ab-code-block/index.tsx +55 -28
  20. package/ab-code-block/styles.module.css +4 -3
  21. package/ab-content-tabs/index.tsx +25 -3
  22. package/ab-demo-box/index.tsx +45 -7
  23. package/ab-demo-box/styles.module.css +19 -7
  24. package/ab-demo-code/index.tsx +38 -34
  25. package/ab-demo-code/styles.module.css +3 -41
  26. package/ab-doc-pager/index.tsx +1 -1
  27. package/ab-drawer/gestures.ts +1 -1
  28. package/ab-drawer/index.tsx +12 -4
  29. package/ab-drawer/kit.module.css +13 -13
  30. package/ab-drawer/styles.module.css +2 -2
  31. package/ab-drawer/use-ab-edge-swipe.ts +2 -2
  32. package/ab-flow-diagram/helpers.ts +2 -2
  33. package/ab-flow-diagram/index.tsx +2 -2
  34. package/ab-flow-diagram/styles.module.css +3 -3
  35. package/ab-icon/builtin.ts +4 -0
  36. package/ab-icon/helpers.ts +1 -1
  37. package/ab-icon/index.tsx +3 -3
  38. package/ab-icon/registrar.tsx +1 -1
  39. package/ab-icon-button/index.tsx +1 -1
  40. package/ab-install-snippet/styles.module.css +1 -1
  41. package/ab-link/index.tsx +2 -2
  42. package/ab-link/locale.ts +1 -1
  43. package/ab-list/styles.module.css +1 -1
  44. package/ab-locale-switcher/index.tsx +6 -6
  45. package/ab-locale-switcher/styles.module.css +5 -5
  46. package/ab-mobile-header/index.tsx +6 -6
  47. package/ab-nav-drawer/index.tsx +11 -6
  48. package/ab-navbar/index.tsx +1 -1
  49. package/ab-navbar/styles.module.css +1 -1
  50. package/ab-navbar/view.tsx +1 -1
  51. package/ab-package-card/index.tsx +3 -3
  52. package/ab-package-card/previews.tsx +1 -1
  53. package/ab-package-card/styles.module.css +2 -2
  54. package/ab-playground-scene/i18n.module.css +1 -1
  55. package/ab-playground-scene/icons.tsx +1 -1
  56. package/ab-playground-scene/index.tsx +4 -4
  57. package/ab-playground-scene/labels.ts +3 -3
  58. package/ab-playground-scene/scenes.tsx +4 -4
  59. package/ab-playground-scene/styles.module.css +6 -6
  60. package/ab-playground-scene/upgraded.tsx +3 -3
  61. package/ab-playground-scene/welcome.tsx +1 -1
  62. package/ab-preview-code/index.tsx +115 -0
  63. package/ab-preview-code/stage.tsx +153 -0
  64. package/ab-preview-code/styles.module.css +43 -0
  65. package/ab-progress-chips/index.tsx +1 -1
  66. package/ab-search-drawer/index.tsx +4 -4
  67. package/ab-search-trigger/index.tsx +5 -5
  68. package/ab-search-trigger/styles.module.css +3 -3
  69. package/ab-settings-drawer/index.tsx +2 -2
  70. package/ab-sidebar/active.ts +105 -0
  71. package/ab-sidebar/index.tsx +10 -6
  72. package/ab-sidebar/profile-button.tsx +2 -2
  73. package/ab-sidebar/styles.module.css +4 -4
  74. package/ab-sidebar/view.tsx +16 -8
  75. package/ab-theme-mode/index.tsx +3 -3
  76. package/ab-theme-toggle/index.tsx +6 -6
  77. package/ab-theme-toggle/styles.module.css +2 -2
  78. package/ab-toc/index.tsx +3 -3
  79. package/ab-toc/promo.tsx +2 -2
  80. package/ab-toc/styles.module.css +1 -1
  81. package/ab-toc-drawer/index.tsx +1 -1
  82. package/ab-version-switcher/index.tsx +2 -2
  83. package/css/dialog.css +1 -1
  84. package/index.ts +29 -18
  85. package/package.json +3 -1
  86. package/server/ab-button/index.tsx +1 -1
  87. package/server/ab-icon/index.tsx +2 -2
  88. package/server/ab-sidebar/index.tsx +3 -2
  89. package/types/index.d.ts +8 -7
@@ -39,7 +39,7 @@
39
39
  // โš›๏ธ types
40
40
  import type { ReactElement } from 'react';
41
41
 
42
- // ๐Ÿ–ผ๏ธ John's tiny line icons (welcome-v6 scenes.py `MS` + v5 common.py package icons), decorative only
42
+ // ๐Ÿ–ผ๏ธ the tiny line icons (welcome-v6 scenes.py `MS` + v5 common.py package icons), decorative only
43
43
  const MS: Record<string, ReactElement> = {
44
44
  home: <path d="M4 11 12 4l8 7v9h-5v-6H9v6H4z" />,
45
45
  search: <><circle cx="11" cy="11" r="6" /><path d="m20 20-4.5-4.5" /></>,
@@ -42,7 +42,7 @@ import type { CSSProperties, ReactElement, ReactNode } from 'react';
42
42
  import clsx from 'clsx';
43
43
  // ใ€ฐ๏ธ the engine: AbFlowDiagram's v6 frame mode
44
44
  import AbFlowDiagram from '../ab-flow-diagram';
45
- // ๐Ÿงฑ John's scene data
45
+ // ๐Ÿงฑ the scene data
46
46
  import { AB_PLAYGROUND_SCENE_PACKAGES, buildAbPlaygroundCompactScene, buildAbPlaygroundFullScene } from './scenes';
47
47
  // ๐ŸŒ labels
48
48
  import { AB_PLAYGROUND_LOCALES, resolveAbPlaygroundSceneLabels, type AbPlaygroundSceneLabelsInput, type AbPlaygroundSceneName } from './labels';
@@ -65,10 +65,10 @@ export const AB_PLAYGROUND_FRAMES = {
65
65
 
66
66
  // โš™๏ธ props
67
67
  export interface AbPlaygroundSceneProps {
68
- /** ๐Ÿ—‚๏ธ which package scene (John's v6 1โ€“7, and illustration 8 `i18n`). */
68
+ /** ๐Ÿ—‚๏ธ which package scene (the v6 1โ€“7, and illustration 8 `i18n`). */
69
69
  name: AbPlaygroundSceneName;
70
70
  /** ๐Ÿ“ `'full'` = 760ร—600 laptop scene, `'compact'` = 350ร—276 mobile scene. Default `'full'`.
71
- * ๐Ÿ†• 0.2.3 (Joseph 02:55) `'auto'` = SSR-safe: BOTH are rendered and a CSS media query shows compact below 768px
71
+ * ๐Ÿ†• 0.2.3 `'auto'` = SSR-safe: BOTH are rendered and a CSS media query shows compact below 768px
72
72
  * and full from 768px, so phones never flash the full scene and there is no hydration mismatch (no JS decides). */
73
73
  variant?: 'full' | 'compact' | 'auto';
74
74
  /** โ–ถ๏ธ animate only while its slide is active (default true); reduced motion is always respected. */
@@ -91,7 +91,7 @@ export interface AbPlaygroundSceneProps {
91
91
  }
92
92
 
93
93
  /**
94
- * ๐ŸŽจ AbPlaygroundScene โ€” the Welcome "Live Playground" scenes from John's welcome-v6 mock, faithfully: same rects,
94
+ * ๐ŸŽจ AbPlaygroundScene โ€” the Welcome "Live Playground" scenes from the welcome-v6 mock, faithfully: same rects,
95
95
  * same auto-routed wires (route() + rounded()), dotted surface, anchors, travelling pulses, card + header.
96
96
  * Server-compatible (AbFlowDiagram's tiny scale island is the only client code). One accessible image (translated alt).
97
97
  */
@@ -39,8 +39,8 @@
39
39
  // ๐ŸŒ every visible WORD in the scenes (code, package names and file names stay as they are, like the mock).
40
40
  // Pass `labels={{ ... }}` (e.g. from next-intl / the Welcome messages) to translate; missing keys fall back to English.
41
41
 
42
- /** ๐Ÿ—‚๏ธ the 8 scene names (John's v6 1โ€“7 + illustration 8 `i18n`) */
43
- /** ๐Ÿ—‚๏ธ 0.2.3 (Joseph 02:35): + `welcome` (v6 s01, every package around the Ab mark) and `all` (v6 s09, the final slide) */
42
+ /** ๐Ÿ—‚๏ธ the 8 scene names (the v6 1โ€“7 + illustration 8 `i18n`) */
43
+ /** ๐Ÿ—‚๏ธ 0.2.3: + `welcome` (v6 s01, every package around the Ab mark) and `all` (v6 s09, the final slide) */
44
44
  export type AbPlaygroundSceneName = 'core' | 'components' | 'theme' | 'icons' | 'fonts' | 'animations' | 'hooks' | 'i18n' | 'welcome' | 'all';
45
45
 
46
46
  /** ๐ŸŒ the 4 demo locales of the i18n scene, in cycle order (EN โ†’ FR โ†’ ES โ†’ RU, 0.6s each) */
@@ -83,7 +83,7 @@ export const AB_PLAYGROUND_SCENE_LABELS = {
83
83
  reduceAnimations: 'reduce animations', list: 'list', stagger: 'stagger', transition: 'transition', fadeSlide: 'fade ยท slide',
84
84
  // ๐Ÿช hooks
85
85
  keyboard: 'keyboard', storage: 'storage', copy: 'copy', hooks: 'Hooks', scrollSpy: 'scroll spy',
86
- // ๐ŸŒ i18n (John's illustration 8)
86
+ // ๐ŸŒ i18n (the illustration 8)
87
87
  messages: 'messages', switcher: 'switcher', translations: 'translations', provider: 'provider', prefix: 'prefix',
88
88
  intlFormat: 'Intl format',
89
89
  // ๐ŸŽ  welcome + all (v6 s01 / s09)
@@ -46,7 +46,7 @@ import type { AbPlaygroundSceneLabels, AbPlaygroundSceneName } from './labels';
46
46
  import { buildI18nCompact, buildI18nFull } from './i18n';
47
47
  // ๐ŸŽ  0.2.3: v6 s01 (welcome) + s09 (all)
48
48
  import { buildAllCompact, buildAllFull, buildWelcomeCompact, buildWelcomeFull } from './welcome';
49
- // ๐ŸŽจ 0.2.3 (God 03:02): John's upgraded package scenes
49
+ // ๐ŸŽจ 0.2.3: the upgraded package scenes
50
50
  import { buildAnimationsUp, buildComponentsUp, buildCoreUp, buildFontsUp, buildHooksUp, buildIconsUp, buildThemeUp } from './upgraded';
51
51
 
52
52
  // ๐Ÿ“ฆ v6 PKG
@@ -68,7 +68,7 @@ const N = (x: number, y: number, w: number, h: number, content: ReactNode, capti
68
68
  export function buildAbPlaygroundFullScene(name: AbPlaygroundSceneName, L: AbPlaygroundSceneLabels, logo: ReactNode, still = 0): AbPlaygroundSceneData {
69
69
  seq = 0;
70
70
  switch (name) {
71
- // ๐ŸŽจ 0.2.3 (God 03:02): John's Welcome v6 UPGRADED scenes (playground-spec.md rev 2): real export captions,
71
+ // ๐ŸŽจ 0.2.3: the Welcome v6 UPGRADED scenes (playground-spec.md rev 2): real export captions,
72
72
  // 4 states ร— 0.6s, reduced-motion still = state 0. Motion = ab-nextjs-animations' state cycle (upgraded.tsx)
73
73
  case 'core': return { nodes: buildCoreUp(N, false) };
74
74
  case 'components': return { nodes: buildComponentsUp(N, false, logo) };
@@ -79,7 +79,7 @@ export function buildAbPlaygroundFullScene(name: AbPlaygroundSceneName, L: AbPla
79
79
  case 'hooks': return { nodes: buildHooksUp(N, false, logo) };
80
80
  case 'welcome': return buildWelcomeFull(N, L, logo); // ๐ŸŽ  v6 s01
81
81
  case 'all': return buildAllFull(N, L, logo); // ๐ŸŽ  v6 s09
82
- default: return { nodes: buildI18nFull(N, L, still) }; // ๐ŸŒ John's illustration 8 (`still` = the reduced-motion locale)
82
+ default: return { nodes: buildI18nFull(N, L, still) }; // ๐ŸŒ the illustration 8 (`still` = the reduced-motion locale)
83
83
  }
84
84
  }
85
85
 
@@ -88,7 +88,7 @@ export function buildAbPlaygroundCompactScene(name: AbPlaygroundSceneName, L: Ab
88
88
  seq = 0;
89
89
  const sc = (...n: AbFlowNode[]): AbPlaygroundSceneData => ({ nodes: n });
90
90
  switch (name) {
91
- // ๐ŸŽจ 0.2.3 (God 03:02): upgraded mobile scenes (3 nodes + hub at y 122 / h 58; bottom caption right of the wire)
91
+ // ๐ŸŽจ 0.2.3: upgraded mobile scenes (3 nodes + hub at y 122 / h 58; bottom caption right of the wire)
92
92
  case 'core': return sc(...buildCoreUp(N, true));
93
93
  case 'components': return sc(...buildComponentsUp(N, true, logo));
94
94
  case 'theme': return sc(...buildThemeUp(N, true));
@@ -37,9 +37,9 @@
37
37
  */
38
38
 
39
39
  /* ===== AB PLAYGROUND SCENE STYLES ===== */
40
- /* ๐ŸŽจ John's welcome-v6 scene content classes (scenes.py css()), scoped to this module. No motion here:
40
+ /* ๐ŸŽจ the welcome-v6 scene content classes (scenes.py css()), scoped to this module. No motion here:
41
41
  wires, pulses and the ease dot all ride ab-nextjs-animations' wire classes (reduced motion included). */
42
- /* ๐ŸŽ  0.2.3 (God 02:26): the card is v6's ORIGINAL --card via theme โ‰ฅ 0.3.7 `--ab-color-welcome-card`, so the white /
42
+ /* ๐ŸŽ  0.2.3: the card is v6's ORIGINAL --card via theme โ‰ฅ 0.3.7 `--ab-color-welcome-card`, so the white /
43
43
  warmer gapped-desktop card tokens never leak in (fallbacks = the v6 values) */
44
44
  .scene { --ab-flow-card: var(--ab-color-welcome-card, #fff); }
45
45
  :global(:is(.dark, [data-theme="dark"])) .scene { --ab-flow-card: var(--ab-color-welcome-card, #241a12); }
@@ -97,7 +97,7 @@
97
97
  .pnode { display: flex; flex-direction: column; gap: 9px; align-items: flex-start; width: 100%; padding: 0 14px; box-sizing: border-box; } /* ๐Ÿ“ฆ v6 pnode */
98
98
  .swSm { display: block; width: 18px; height: 24px; border-radius: 5px; border: 1px solid var(--ab-flow-line, rgb(107 79 53 / 0.16)); box-sizing: border-box; } /* ๐ŸŽจ */
99
99
  .mchip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; } /* ๐Ÿ’Š v6 .mchip */
100
- /* ๐ŸŽจ 0.2.3 (God 03:02) John's Welcome v6 UPGRADED scenes (upgraded.tsx). Layout + colour only: every bit of motion is
100
+ /* ๐ŸŽจ 0.2.3 the Welcome v6 UPGRADED scenes (upgraded.tsx). Layout + colour only: every bit of motion is
101
101
  ab-nextjs-animations' .ab-state-cycle-* (4 states ร— 600ms = 2.4s), which also owns the still frame + reduced motion. */
102
102
  .scene { --ab-state-cycle-duration: var(--ab-wire-pulse-duration, 2400ms); --ab-state-cycle-on-fg: #fff8f5; --ab-state-cycle-off-fg: var(--ab-flow-muted, rgb(33 26 22 / 0.62)); --ab-state-cycle-switch-off: var(--pg-chip); --ab-state-cycle-knob-travel: 22px; }
103
103
  .ic { display: inline-flex; flex: none; } /* ๐Ÿ”ฃ real ab-nextjs-icons SVG */
@@ -107,7 +107,7 @@
107
107
  .cyCentre { right: 0; display: flex; justify-content: center; } /* โ†”๏ธ centred without transform (the cycle owns transform) */
108
108
  .segCycle > span { white-space: nowrap; } /* ๐ŸŽš๏ธ chips: colours come from .ab-state-cycle-chip */
109
109
  .wts { display: flex; gap: 2px; } /* โญ weight picker */
110
- .wt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 4px; border-radius: 7px; border: 1px solid transparent; --ab-state-cycle-hl-border: transparent; } /* โญ John: tint only */
110
+ .wt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 3px 4px; border-radius: 7px; border: 1px solid transparent; --ab-state-cycle-hl-border: transparent; } /* โญ tint only */
111
111
  .tog2 { width: 50px; height: 28px; border-radius: 999px; position: relative; flex: none; display: block; } /* ๐Ÿ”€ track (colour = the cycle) */
112
112
  .knob { position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff8f5; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); } /* โšช */
113
113
  .lpTrack { display: block; height: 4px; border-radius: 2px; background: var(--pg-chip); overflow: hidden; } /* โž– */
@@ -137,8 +137,8 @@
137
137
  .radiusTile { display: block; width: 30px; height: 28px; border: 2px solid var(--pg-bronze); box-sizing: border-box; } /* ๐Ÿ”ฒ */
138
138
  /* ๐Ÿ”ฃ icons */
139
139
  .icGrid { display: grid; grid-template-columns: repeat(6, 38px); gap: 8px 10px; } /* ๐Ÿ”ฃ */
140
- .icCell { display: flex; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid transparent; box-sizing: border-box; --ab-state-cycle-hl-border: transparent; } /* ๐Ÿ”ฃ John: tint only (his cells have no border) */
141
- /* ๐Ÿ“ 0.2.3 (Joseph 02:55) variant="auto": both scenes ship, CSS picks one (SSR-safe, no flash, no hydration mismatch) */
140
+ .icCell { display: flex; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid transparent; box-sizing: border-box; --ab-state-cycle-hl-border: transparent; } /* ๐Ÿ”ฃ tint only (his cells have no border) */
141
+ /* ๐Ÿ“ 0.2.3 variant="auto": both scenes ship, CSS picks one (SSR-safe, no flash, no hydration mismatch) */
142
142
  .auto { display: contents; } /* ๐Ÿซฅ no extra box */
143
143
  .autoCompact.autoCompact { display: none; } /* ๐Ÿ–ฅ๏ธ โ‰ฅ 768px: full */
144
144
  @media (width < 768px) {
@@ -36,7 +36,7 @@
36
36
  * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
37
  */
38
38
 
39
- // ๐ŸŽจ 0.2.3 (God 03:02, John's Welcome v6 "upgraded" designs): the 7 package scenes, 1:1 with
39
+ // ๐ŸŽจ 0.2.3 (the Welcome v6 "upgraded" designs): the 7 package scenes, 1:1 with
40
40
  // ai-mocks/welcome-v6/upgraded/_src/build_upgraded.py + playground-spec.md rev 2 (real export names as captions,
41
41
  // 4 states ร— 0.6s = one 2.4s loop, reduced-motion still = state 0). ALL motion = ab-nextjs-animations' state cycle.
42
42
 
@@ -65,7 +65,7 @@ import article from 'ab-nextjs-icons/ab-icons/icons/article';
65
65
  // ๐ŸŽจ mock content classes
66
66
  import s from './styles.module.css';
67
67
 
68
- // ๐Ÿฅ‰ John's bronze
68
+ // ๐Ÿฅ‰ the bronze
69
69
  const BRONZE = '#A67C52';
70
70
  // ๐ŸŒ the 4 locale chips
71
71
  const LOC = ['EN', 'FR', 'ES', 'RU'];
@@ -236,7 +236,7 @@ export function buildIconsUp(N: AbPgMk, compact: boolean): AbFlowNode[] {
236
236
  const wts: Array<[number, number]> = [[100, 0.7], [200, 1.25], [400, 1.9], [700, 2.8]];
237
237
  return [
238
238
  N(220, 262, 320, 124, <span className={s.icGrid}>{names.map((n, i) => cell(n, i, 22, 38))}</span>, 'abIconNames', true),
239
- // โญ John's weight picker steps with a soft highlight (his `[data-on]` has no chip fill here), same as the grid
239
+ // โญ the weight picker steps with a soft highlight (his `[data-on]` has no chip fill here), same as the grid
240
240
  N(40, 100, 210, 96, <span className={s.wts}>{wts.map(([w, sw], i) => <span key={w} {...hl(i, s.wt, 'transparent')}><Ic n="star" sz={22} sw={sw} /><span className={s.m} style={{ fontSize: 9.5 }}>{w}</span></span>)}</span>, 'abIconWeights'),
241
241
  N(290, 112, 180, 64, <M><Br>200</Br></M>, 'abIconDefaultWeight'),
242
242
  N(510, 104, 210, 84, <M><Br>getAbIconSvg</Br>(<Sg>&quot;anchor&quot;</Sg>)</M>, 'getAbIconSvg()'),
@@ -47,7 +47,7 @@ import type { AbPlaygroundSceneLabels } from './labels';
47
47
  // ๐ŸŽจ shared mock classes (.m, .br, .b1, .tog, .t13โ€ฆ)
48
48
  import s from './styles.module.css';
49
49
 
50
- // ๐Ÿฅ‰ John's bronze
50
+ // ๐Ÿฅ‰ the bronze
51
51
  const BRONZE = '#A67C52';
52
52
  // ๐ŸŽจ v6 palette (theme swatches)
53
53
  const PALETTE = ['#6B4F35', '#A67C52', '#D9BE9C', '#FFF8F5', '#19120C'];
@@ -0,0 +1,115 @@
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: AbPreviewCode (G16, 0.6.0)
28
+ * @file: ab-preview-code/index.tsx
29
+ * @type: Server component (AbContentTabs + the copy button are the only client islands)
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ *
32
+ * Example usage (MDX):
33
+ * 1+|> <AbPreviewCode label="Button" code={`<AbButton label="Save" />`}>
34
+ * -|> <AbButton label="Save" />
35
+ * -|> </AbPreviewCode>
36
+ */
37
+
38
+ /*
39
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
40
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
41
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
42
+ */
43
+
44
+ // โš›๏ธ React
45
+ import type { ReactElement, ReactNode } from 'react';
46
+ // ๐Ÿงต classes
47
+ import clsx from 'clsx';
48
+ // ๐Ÿ—‚๏ธ WAI-ARIA tabs (client island)
49
+ import AbContentTabs, { AbContentTab } from '../ab-content-tabs';
50
+ // ๐Ÿงช the preview scope's scheme type
51
+ import type { AbDemoBoxScheme } from '../ab-demo-box';
52
+ // ๐Ÿงฐ 0.6.0: the toolbar + preview (a small client island; this file stays server-safe)
53
+ import AbPreviewStage from './stage';
54
+ // ๐Ÿ’ป the source half
55
+ import AbDemoCode from '../ab-demo-code';
56
+ // ๐ŸŽจ styles
57
+ import styles from './styles.module.css';
58
+
59
+ /** ๐ŸŒ translatable strings */
60
+ export interface AbPreviewCodeLabels {
61
+ preview?: string; // ๐Ÿงช the Preview tab (default "Preview")
62
+ code?: string; // ๐Ÿ’ป the Code tab (default "Code")
63
+ copy?: string; // ๐Ÿ“‹ the copy button (default "Copy code")
64
+ copied?: string; // โœ… announced after a copy (default "Copied")
65
+ toolbar?: string; // ๐Ÿงฐ 0.6.0: names the preview toolbar (default "Preview tools")
66
+ dark?: string; // ๐ŸŒ™ 0.6.0: the scheme toggle (default "Dark preview", aria-pressed = dark)
67
+ reload?: string; // ๐Ÿ”„ 0.6.0: the remount button (default "Reload preview")
68
+ open?: string; // โ†—๏ธ 0.6.0: the open-in-new-tab link (default "Open preview in a new tab")
69
+ }
70
+
71
+ /** โš™๏ธ props */
72
+ export interface AbPreviewCodeProps {
73
+ children: ReactNode; // ๐Ÿงช the live preview: real JSX with package components (D-c: no eval, no live editor)
74
+ code: string; // ๐Ÿ“‹ the matching source: shown plain when there is no `trustedHtml` / `highlighted`, always what Copy copies
75
+ trustedHtml?: string; // ๐Ÿงพ Shiki `codeToHtml(code)` output, โš ๏ธ NOT sanitized: trusted HTML only, never user input (prefer `highlighted`)
76
+ highlighted?: ReactNode; // ๐Ÿ–๏ธ OR an already highlighted <pre> (e.g. an MDX fenced block)
77
+ language?: string; // ๐Ÿ”ค default 'tsx'
78
+ filename?: string; // ๐Ÿ“„ shown in the code header
79
+ label?: string; // โ™ฟ names the tablist, e.g. "Button example" (default "Example")
80
+ labels?: AbPreviewCodeLabels; // ๐ŸŒ
81
+ defaultTab?: 'preview' | 'code'; // ๐ŸŽฏ default 'preview'
82
+ scheme?: AbDemoBoxScheme; // ๐ŸŒ— force the preview's scheme (default: follow the page)
83
+ align?: 'center' | 'start' | 'stretch'; // ๐Ÿ“ the preview's alignment (default 'center')
84
+ toolbar?: boolean; // ๐Ÿงฐ 0.6.0: the preview toolbar (light/dark toggle + reload [+ open]); default true
85
+ href?: string; // โ†—๏ธ 0.6.0: a standalone page for this example โ†’ an open-in-new-tab link in the toolbar
86
+ className?: string; // ๐Ÿท๏ธ
87
+ }
88
+
89
+ /**
90
+ * ๐Ÿงช๐Ÿ’ป AbPreviewCode โ€” the docs Preview / Code pair (G16): AbContentTabs over an AbDemoBox preview scope and an
91
+ * AbDemoCode source block. Both panels are in the server HTML (the inactive one `hidden`), so the preview's
92
+ * markup and the code are crawlable and work before hydration. The preview is the children you pass, rendered
93
+ * as-is: nothing is parsed or evaluated from `code`, so keep the two in sync (a test can compare them).
94
+ */
95
+ const AbPreviewCode = ({ children, code, trustedHtml, highlighted, language = 'tsx', filename, label = 'Example', labels = {}, defaultTab = 'preview', scheme, align, toolbar = true, href, className }: AbPreviewCodeProps): ReactElement => {
96
+ const L = { preview: 'Preview', code: 'Code', copy: 'Copy code', copied: 'Copied', ...labels }; // ๐ŸŒ
97
+ const stageLabels = { toolbar: L.toolbar, dark: L.dark, reload: L.reload, open: L.open }; // ๐Ÿงฐ undefined โ†’ the island's defaults
98
+ return (
99
+ <div className={clsx('AbPreviewCode', styles.abPreviewCode, className)} data-ab-part="preview-code">
100
+ <AbContentTabs label={label} defaultValue={defaultTab}>
101
+ <AbContentTab label={L.preview} value="preview">
102
+ {/* ๐Ÿงช the tabpanel already names it (aria-labelledby the tab), so the box needs no region role */}
103
+ <AbPreviewStage scheme={scheme} align={align} href={href} toolbar={toolbar} labels={stageLabels} className={styles.abPreviewCodeBox}>{children}</AbPreviewStage>
104
+ </AbContentTab>
105
+ <AbContentTab label={L.code} value="code">
106
+ <AbDemoCode code={code} trustedHtml={trustedHtml} language={language} filename={filename} copyLabel={L.copy} copiedLabel={L.copied}>{highlighted}</AbDemoCode>
107
+ </AbContentTab>
108
+ </AbContentTabs>
109
+ </div>
110
+ );
111
+ };
112
+
113
+ // ๐Ÿ“ฆ exports
114
+ export default AbPreviewCode;
115
+ export { AbPreviewCode };
@@ -0,0 +1,153 @@
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: AbPreviewStage (0.6.0)
28
+ * @file: ab-preview-code/stage.tsx
29
+ * @type: Client component (island)
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+ */
32
+
33
+ /*
34
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
35
+ * MOTTO: We'll always do more ๐Ÿ˜œ!!!
36
+ * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37
+ */
38
+
39
+ 'use client';
40
+
41
+ 'use client';
42
+
43
+ // โš›๏ธ React
44
+ import { useRef, useState, type KeyboardEvent, type ReactElement, type ReactNode } from 'react';
45
+ // ๐Ÿงต classes
46
+ import clsx from 'clsx';
47
+ // ๐Ÿ”ฃ icons (ab-nextjs-icons built-ins: dark_mode, light_mode, refresh, open_in_new)
48
+ import AbIcon from '../ab-icon';
49
+ // ๐Ÿงช the preview scope (server-safe, fine inside a client island)
50
+ import AbDemoBox, { type AbDemoBoxScheme } from '../ab-demo-box';
51
+ // ๐ŸŽจ styles
52
+ import styles from './styles.module.css';
53
+
54
+ /** ๐ŸŒ the toolbar's translatable names */
55
+ export interface AbPreviewStageLabels {
56
+ toolbar?: string; // โ™ฟ names the toolbar (default "Preview tools")
57
+ dark?: string; // ๐ŸŒ™ the scheme toggle, a pressed-state button (default "Dark preview")
58
+ reload?: string; // ๐Ÿ”„ the remount button (default "Reload preview")
59
+ open?: string; // โ†—๏ธ the open-in-new-tab link (default "Open preview in a new tab")
60
+ }
61
+
62
+ /** โš™๏ธ props */
63
+ export interface AbPreviewStageProps {
64
+ children?: ReactNode; // ๐Ÿงช the live preview (server-rendered JSX passes straight through)
65
+ scheme?: AbDemoBoxScheme; // ๐ŸŒ— the starting scheme (default 'inherit'); the toggle then forces light / dark
66
+ align?: 'center' | 'start' | 'stretch'; // ๐Ÿ“ forwarded to AbDemoBox
67
+ href?: string; // โ†—๏ธ shows an "open in a new tab" link (target _blank, rel noopener noreferrer)
68
+ toolbar?: boolean; // ๐Ÿงฐ show the toolbar (default true); false = just the box
69
+ labels?: AbPreviewStageLabels; // ๐ŸŒ
70
+ className?: string; // ๐Ÿท๏ธ on the AbDemoBox
71
+ }
72
+
73
+ /**
74
+ * ๐Ÿงฐ AbPreviewStage โ€” the small client island behind AbPreviewCode's preview: a WAI-ARIA toolbar (one tab stop,
75
+ * โ†/โ†’/Home/End move between tools) over an AbDemoBox.
76
+ * - ๐ŸŒ— a light/dark toggle (`aria-pressed` = dark) that changes ONLY this preview's scheme (AbDemoBox `data-theme`)
77
+ * - ๐Ÿ”„ reload: remounts the preview with a key bump (state, timers and animations start fresh)
78
+ * - โ†—๏ธ with `href`: an open-in-new-tab link
79
+ * Every tool is a โ‰ฅ44px target with an overridable aria-label. No motion here (motion lives in ab-nextjs-animations).
80
+ */
81
+ const AbPreviewStage = ({ children, scheme = 'inherit', align, href, toolbar = true, labels = {}, className }: AbPreviewStageProps): ReactElement => {
82
+ const L = { toolbar: 'Preview tools', dark: 'Dark preview', reload: 'Reload preview', open: 'Open preview in a new tab', ...Object.fromEntries(Object.entries(labels).filter(([, v]) => v != null)) }; // ๐ŸŒ undefined keeps the default
83
+ const [current, setCurrent] = useState<AbDemoBoxScheme>(scheme); // ๐ŸŒ— this preview only
84
+ const [key, setKey] = useState(0); // ๐Ÿ”„ bumped โ†’ AbDemoBox remounts
85
+ const [active, setActive] = useState(0); // ๐ŸŽฏ roving tab stop (index of the focusable tool)
86
+ const bar = useRef<HTMLDivElement>(null); // ๐Ÿงฐ
87
+ const dark = current === 'dark'; // ๐ŸŒ™ pressed?
88
+
89
+ /** โŒจ๏ธ APG toolbar keys: โ†/โ†’ wrap, Home/End jump; only the active tool is in the tab order */
90
+ const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {
91
+ const tools = Array.from(bar.current?.querySelectorAll<HTMLElement>('[data-ab-tool]') ?? []); // ๐Ÿ”˜ the tools
92
+ const i = tools.indexOf(document.activeElement as HTMLElement); // ๐Ÿ“
93
+ if (i < 0) return; // ๐Ÿ™… focus is elsewhere
94
+ const n = tools.length; // ๐Ÿ”ข
95
+ const next = e.key === 'ArrowRight' ? (i + 1) % n : e.key === 'ArrowLeft' ? (i - 1 + n) % n : e.key === 'Home' ? 0 : e.key === 'End' ? n - 1 : -1; // ๐Ÿงญ
96
+ if (next < 0) return; // โญ๏ธ other keys pass through
97
+ e.preventDefault(); // ๐Ÿ›‘ no page scroll
98
+ setActive(next); // ๐ŸŽฏ
99
+ tools[next]?.focus(); // โŒจ๏ธ
100
+ };
101
+ const tab = (i: number) => (i === active ? 0 : -1); // ๐ŸŽฏ roving tabindex
102
+
103
+ return (
104
+ <div className={styles.abPreviewStage} data-ab-part="preview-stage">
105
+ {toolbar && (
106
+ <div ref={bar} role="toolbar" aria-label={L.toolbar} className={styles.abPreviewToolbar} data-ab-part="preview-toolbar" onKeyDown={onKeyDown}>
107
+ <button
108
+ type="button"
109
+ data-ab-tool="scheme" // ๐ŸŒ—
110
+ className={styles.abPreviewTool}
111
+ aria-label={L.dark} // โ™ฟ the name stays; the state is aria-pressed
112
+ aria-pressed={dark} // ๐ŸŒ™ true = dark preview
113
+ tabIndex={tab(0)}
114
+ onFocus={() => setActive(0)}
115
+ onClick={() => setCurrent(dark ? 'light' : 'dark')} // ๐Ÿ” light โ‡„ dark (from 'inherit' โ†’ dark first)
116
+ >
117
+ <AbIcon name={dark ? 'dark_mode' : 'light_mode'} size={20} /> {/* ๐ŸŒž/๐ŸŒ™ decorative */}
118
+ </button>
119
+ <button
120
+ type="button"
121
+ data-ab-tool="reload" // ๐Ÿ”„
122
+ className={styles.abPreviewTool}
123
+ aria-label={L.reload}
124
+ tabIndex={tab(1)}
125
+ onFocus={() => setActive(1)}
126
+ onClick={() => setKey((k) => k + 1)} // ๐Ÿ”‘ key bump โ†’ remount
127
+ >
128
+ <AbIcon name="refresh" size={20} />
129
+ </button>
130
+ {href && (
131
+ <a
132
+ href={href}
133
+ target="_blank" // โ†—๏ธ new tab
134
+ rel="noopener noreferrer" // ๐Ÿ” no window.opener, no referrer
135
+ data-ab-tool="open"
136
+ className={styles.abPreviewTool}
137
+ aria-label={L.open}
138
+ tabIndex={tab(2)}
139
+ onFocus={() => setActive(2)}
140
+ >
141
+ <AbIcon name="open_in_new" size={20} />
142
+ </a>
143
+ )}
144
+ </div>
145
+ )}
146
+ <AbDemoBox key={key} scheme={current} align={align} className={className}>{children}</AbDemoBox>
147
+ </div>
148
+ );
149
+ };
150
+
151
+ // ๐Ÿ“ฆ exports
152
+ export default AbPreviewStage;
153
+ export { AbPreviewStage };
@@ -0,0 +1,43 @@
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-preview-code/styles.module.css
29
+ * @type: CSS Stylesheet
30
+ * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
+
32
+ /* ๐Ÿงช๐Ÿ’ป the pair: one block in the prose rhythm; the tabs' own bottom margin is dropped inside it */
33
+ .abPreviewCode { margin: 0 0 1.25em; min-inline-size: 0; } /* โ†•๏ธ + โ†”๏ธ never widens the page */
34
+ .abPreviewCode > :global(.AbContentTabs) { margin: 0; } /* โ†•๏ธ */
35
+ .abPreviewCodeBox { min-block-size: 180px; } /* ๐Ÿ“ room for a menu / drawer demo */
36
+
37
+ /* ๐Ÿงฐ 0.6.0: the preview toolbar (AbPreviewStage) โ€” tools end-aligned above the box */
38
+ .abPreviewStage { display: grid; min-inline-size: 0; } /* ๐Ÿ“ */
39
+ .abPreviewToolbar { display: flex; justify-content: flex-end; gap: 4px; padding: 2px; } /* ๐Ÿงฐ */
40
+ .abPreviewTool { display: inline-flex; align-items: center; justify-content: center; min-inline-size: 44px; min-block-size: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: inherit; cursor: pointer; } /* ๐Ÿ”˜ โ‰ฅ44px targets */
41
+ .abPreviewTool:hover { background: var(--ab-color-hover, rgb(92 64 48 / 0.08)); } /* ๐Ÿ–ฑ๏ธ */
42
+ .abPreviewTool:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: 2px; } /* โ™ฟ */
43
+ .abPreviewTool[aria-pressed='true'] { background: var(--ab-color-selected, rgb(92 64 48 / 0.14)); } /* ๐ŸŒ™ pressed */
@@ -68,7 +68,7 @@ export interface AbProgressChipsProps {
68
68
 
69
69
  const DEFAULT_CHIPS: AbProgressChip[] = [
70
70
  { id: 1, code: 'A', name: 'Prep', duration: 20 },
71
- { id: 2, code: 'B', name: 'Cook', duration: 40 },
71
+ { id: 2, code: 'B', name: 'Simmer', duration: 40 },
72
72
  { id: 3, code: 'C', name: 'Plate', duration: 15 },
73
73
  ];
74
74
 
@@ -94,7 +94,7 @@ export interface AbSearchDrawerProps {
94
94
  defaultQuery?: string; // ๐ŸŒฑ the query on open (default '')
95
95
  recentKey?: string | null; // ๐Ÿ•˜ localStorage key (default `ab:search:recent`; null = no recents)
96
96
  recentLimit?: number; // ๐Ÿ•˜ default 4
97
- recentWhen?: 'always' | 'empty'; // ๐Ÿ•˜ 'always' = above the results (John's frames, default); 'empty' = only with no query
97
+ recentWhen?: 'always' | 'empty'; // ๐Ÿ•˜ 'always' = above the results (the frames, default); 'empty' = only with no query
98
98
  labels?: AbSearchDrawerLabels; // ๐ŸŒ
99
99
  returnFocus?: string; // โ†ฉ๏ธ
100
100
  id?: string; // ๐Ÿ†”
@@ -128,7 +128,7 @@ export function highlightAbSearch(text: string, q: string): ReactNode {
128
128
  }
129
129
 
130
130
  /**
131
- * ๐Ÿ”Ž AbSearchDrawer โ€” John's search drawer (drawers v2 ยง4), a bottom-drawer variant.
131
+ * ๐Ÿ”Ž AbSearchDrawer โ€” the search drawer (drawers v2 ยง4), a bottom-drawer variant.
132
132
  *
133
133
  * - ๐Ÿ“ฑ below 768px: straight to full height (no 70% stop: the keyboard is up); a hard swipe down closes
134
134
  * - ๐Ÿ’ป 768px and up: centred in the main pane, min(640px, main width), 70% tall; results scroll inside with a 48px fade
@@ -149,7 +149,7 @@ const AbSearchDrawer = ({ open, onClose, search, suggest, onOpenResult, defaultQ
149
149
  }; // ๐ŸŒ
150
150
  const auto = useId().replace(/[^A-Za-z0-9_-]/g, ''); // ๐Ÿ†”
151
151
  const base = id ?? `ab-search-${auto}`;
152
- // ๐Ÿ†” James P2: group ids come from app data ("@scope/pkg", "a b"); keep only id-safe characters, and the index keeps them unique
152
+ // ๐Ÿ†” review P2: group ids come from app data ("@scope/pkg", "a b"); keep only id-safe characters, and the index keeps them unique
153
153
  const groupId = (g: AbSearchDrawerGroup, i: number) => `${base}-g-${i}-${String(g.id).replace(/[^A-Za-z0-9_-]/g, '_')}`;
154
154
  const input = useRef<HTMLInputElement>(null); // ๐Ÿ”ค
155
155
  const list = useRef<HTMLDivElement>(null); // ๐Ÿ“œ
@@ -172,7 +172,7 @@ const AbSearchDrawer = ({ open, onClose, search, suggest, onOpenResult, defaultQ
172
172
  const t = setTimeout(() => {
173
173
  Promise.resolve().then(() => latest.current(q)) // ๐Ÿงฏ a sync throw becomes a rejection too
174
174
  .then((g) => { if (live) { setGroups(g); setActive(g.some((x) => x.items.length) ? 0 : -1); } })
175
- .catch(() => { if (live) { setGroups([]); setActive(-1); } }); // ๐Ÿงฏ James P2: a failed search shows "no results", never the previous query's results
175
+ .catch(() => { if (live) { setGroups([]); setActive(-1); } }); // ๐Ÿงฏ review P2: a failed search shows "no results", never the previous query's results
176
176
  }, 150);
177
177
  return () => { live = false; clearTimeout(t); };
178
178
  }, [query, open]);
@@ -59,12 +59,12 @@ export interface AbSearchTriggerProps {
59
59
  onOpen?: () => void; // ๐Ÿ”” opens your search dialog (button mode)
60
60
  href?: string; // ๐Ÿ”— no onOpen โ†’ a link to a search page (also the JS-off path)
61
61
  hotkey?: boolean; // โŒจ๏ธ listen for โŒ˜K / Ctrl+K (default true when onOpen is set)
62
- shortcut?: boolean; // โŒจ๏ธ alias of `hotkey` (Joseph's spec name); `hotkey` wins when both are set
62
+ shortcut?: boolean; // โŒจ๏ธ alias of `hotkey` (the spec name); `hotkey` wins when both are set
63
63
  compact?: boolean; // ๐Ÿ“ฑ icon-only pill (the label stays for screen readers), e.g. the mobile app bar
64
64
  comingSoon?: boolean; // ๐Ÿšง visible but inert: aria-disabled, no hotkey
65
65
  comingSoonLabel?: string; // ๐Ÿท๏ธ default "Coming soon"
66
66
  variant?: 'pill' | 'field'; // ๐Ÿ”Ž 0.1.14 (P6): 'field' = the Home 300ร—36 bordered field (default 'pill', the legacy look)
67
- /** ๐Ÿ“ฑ 0.1.15 (God 00:08): a shorter label (e.g. "Search") that a compact AbAppBar shows below 768px instead of `label`
67
+ /** ๐Ÿ“ฑ 0.1.15: a shorter label (e.g. "Search") that a compact AbAppBar shows below 768px instead of `label`
68
68
  * (CSS picks; only one is ever displayed, so the accessible name stays single). Home field only. */
69
69
  compactLabel?: string;
70
70
  size?: 'md' | 'sm' | 'lg'; // ๐Ÿ“ฑ 0.1.14 (P6): 'sm' = the mobile 34px "Search โŒ˜K" pill (label + key cap stay visible)
@@ -124,7 +124,7 @@ const AbSearchTrigger = ({ label = 'Search', onOpen, href, hotkey, shortcut, com
124
124
  <>
125
125
  <AbIcon name="search" size={20} className={styles.abSearchTriggerIcon} />
126
126
  <span className={clsx(styles.abSearchTriggerLabel, compact && styles.abSearchTriggerSrOnly)}>{label}</span>
127
- {/* ๐Ÿšง coming soon tag, or โŒจ๏ธ the key hint ONLY while a hotkey is really listening (James #3, D24a) */}
127
+ {/* ๐Ÿšง coming soon tag, or โŒจ๏ธ the key hint ONLY while a hotkey is really listening (#3, D24a) */}
128
128
  {comingSoon
129
129
  ? !compact && <span className={styles.abSearchTriggerSoon}>{comingSoonLabel}</span>
130
130
  : listen && !compact && <AbKbd keys={[apple ? 'โŒ˜' : 'Ctrl', 'K']} className={styles.abSearchTriggerKbd} />}
@@ -133,7 +133,7 @@ const AbSearchTrigger = ({ label = 'Search', onOpen, href, hotkey, shortcut, com
133
133
  const common = {
134
134
  className: clsx('AbSearchTrigger', styles.abSearchTrigger, !comingSoon && 'ab-motion-interactive', className), // ๐Ÿท๏ธ
135
135
  'data-ab-part': 'search-trigger', // ๐Ÿงฉ
136
- 'aria-keyshortcuts': listen ? 'Meta+K Control+K' : undefined, // โ™ฟ only announced when bound (James #3)
136
+ 'aria-keyshortcuts': listen ? 'Meta+K Control+K' : undefined, // โ™ฟ only announced when bound (#3)
137
137
  'data-compact': compact ? 'true' : undefined, // ๐Ÿ“ฑ
138
138
  'data-variant': variant === 'field' ? 'field' : undefined, // ๐Ÿ”Ž P6
139
139
  'data-size': size === 'sm' || size === 'lg' ? size : undefined, // ๐Ÿ“ฑ P6 ยท ๐Ÿ” 404 gaps: lg
@@ -143,7 +143,7 @@ const AbSearchTrigger = ({ label = 'Search', onOpen, href, hotkey, shortcut, com
143
143
  // ๐Ÿšง coming soon: focusable, announced, inert
144
144
  if (comingSoon) return <button type="button" {...common} aria-disabled="true" data-coming-soon="true">{inner}</button>;
145
145
  // ๐Ÿ”— href โ†’ ALWAYS a real link, so it works with JS off (D24a: /docs). With onOpen too, JS intercepts
146
- // the click and opens the dialog instead (James #4); modified clicks (new tab, โ€ฆ) keep the link.
146
+ // the click and opens the dialog instead (#4); modified clicks (new tab, โ€ฆ) keep the link.
147
147
  if (href) {
148
148
  const onClick = onOpen
149
149
  ? (e: MouseEvent<HTMLAnchorElement>) => {
@@ -64,7 +64,7 @@
64
64
  .abSearchTriggerIcon { flex: none; } /* ๐Ÿ”ฃ */
65
65
  .abSearchTriggerSoon { font-size: 12px; opacity: 0.8; } /* ๐Ÿšง */
66
66
 
67
- /* ๐Ÿ“ฑ compact (Joseph #3/#16): icon-only round pill for small app bars, no overflow at 390px */
67
+ /* ๐Ÿ“ฑ compact (#3/#16): icon-only round pill for small app bars, no overflow at 390px */
68
68
  .abSearchTrigger[data-compact='true'] { flex: none; width: 40px; min-width: 40px; padding: 0; justify-content: center; } /* ๐Ÿ”˜ */
69
69
  /* ๐Ÿ•ถ๏ธ visually hidden, still read by screen readers */
70
70
  .abSearchTriggerSrOnly { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; flex: none; }
@@ -76,7 +76,7 @@
76
76
  border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); border-radius: var(--ab-radius-button, 10px); /* ๐Ÿ”ฒ */
77
77
  background: var(--ab-color-card, #fff); color: var(--ab-color-faint, #807062); /* ๐ŸŽจ */
78
78
  font-size: 13.5px; line-height: 1; box-shadow: var(--ab-shadow-card, 0 1px 2px rgb(33 26 22 / 0.05)); /* ๐Ÿ”ค ๐ŸŒ— */
79
- flex: 0 8 auto; min-width: var(--ab-search-trigger-min-width, 160px); /* ๐Ÿ”Ž 0.4.1 (Joseph 0.2.24, gap 4): its own space in a flex row; v2: shrinks first (flex-shrink 8) down to 160px, never under */
79
+ flex: 0 8 auto; min-width: var(--ab-search-trigger-min-width, 160px); /* ๐Ÿ”Ž 0.4.1 (0.2.24, gap 4): its own space in a flex row; v2: shrinks first (flex-shrink 8) down to 160px, never under */
80
80
  }
81
81
  .abSearchTrigger[data-size='sm'] {
82
82
  flex: none; width: auto; max-width: none; height: 34px; /* ๐Ÿ“ the pill still LOOKS 34px (mock) */
@@ -85,7 +85,7 @@
85
85
  border: 1px solid var(--ab-color-border, rgb(92 64 48 / 0.13)); border-radius: var(--ab-radius-pill, 999px); /* ๐Ÿ’Š */
86
86
  background: var(--ab-color-card, #fff); color: var(--ab-color-faint, #807062); font-size: 13px; line-height: 1; /* ๐ŸŽจ ๐Ÿ”ค */
87
87
  }
88
- /* ๐Ÿ‘† 0.3.2 (God, 0.2.23 gaps): an invisible 44px-tall hit area around the 34px pill (0.3.3: 6px above + below), so the
88
+ /* ๐Ÿ‘† 0.3.2 (0.2.23 gaps): an invisible 44px-tall hit area around the 34px pill (0.3.3: 6px above + below), so the
89
89
  tap target is โ‰ฅ 44px (WCAG 2.5.5) without changing the look */
90
90
  .abSearchTrigger[data-size='sm']::after { content: ''; position: absolute; inset: -6px 0; } /* ๐Ÿซฅ hit area: 0.3.3 6px above + below โ†’ 46px, safely โ‰ฅ 44 */
91
91
  .abSearchTrigger[data-variant='field']:hover, .abSearchTrigger[data-size='sm']:hover { border-color: color-mix(in srgb, var(--ab-color-accent, #a67c52) 40%, transparent); } /* ๐Ÿ–ฑ๏ธ */
@@ -86,7 +86,7 @@ export interface AbSettingsDrawerProps {
86
86
  onLocaleChange: (code: string) => void; // ๐Ÿ“ฃ
87
87
  labels?: AbSettingsDrawerLabels; // ๐Ÿท๏ธ
88
88
  themes?: readonly AbSettingsTheme[]; // ๐ŸŽš๏ธ default light, dark, system
89
- // ๐Ÿ‘ค 0.2.1 (God 02:44): the account section is back, on top. `account` = signed in (avatar, name, email);
89
+ // ๐Ÿ‘ค 0.2.1: the account section is back, on top. `account` = signed in (avatar, name, email);
90
90
  // signed out, pass `onSignIn` for a "Sign in" row. Neither = no section.
91
91
  account?: AbProfileUser | null;
92
92
  onAccount?: () => void; // ๐Ÿ‘ค tap the signed-in row (e.g. open the profile page)
@@ -117,7 +117,7 @@ function radioKeys<T>(e: KeyboardEvent, items: readonly T[], current: T, pick: (
117
117
  }
118
118
 
119
119
  /**
120
- * โš™๏ธ AbSettingsDrawer โ€” John's Settings bottom drawer (drawers v2, spec ยง1): the default bottom sheet, holding
120
+ * โš™๏ธ AbSettingsDrawer โ€” the Settings bottom drawer (drawers v2, spec ยง1): the default bottom sheet, holding
121
121
  * ACCOUNT (0.2.1, optional), THEME (a Light / Dark / System segmented radiogroup, 48px) and LANGUAGE (48px radio rows, each label in its
122
122
  * own `lang`, the checked one tinted with a check), then optional Help / About rows (0.2.1).
123
123
  *