ab-nextjs-components 0.2.2 → 0.3.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 (47) hide show
  1. package/README.md +4 -12
  2. package/ab-bottom-drawer/index.tsx +35 -4
  3. package/ab-bottom-drawer/use-ab-swipe-down.ts +125 -0
  4. package/ab-button/helpers.ts +2 -2
  5. package/ab-button/index.tsx +1 -1
  6. package/ab-button/styles.module.css +86 -20
  7. package/ab-carousel/index.tsx +202 -31
  8. package/ab-carousel/styles.module.css +22 -1
  9. package/ab-drawer/kit.module.css +27 -0
  10. package/ab-flow-diagram/frame-scale.tsx +65 -0
  11. package/ab-flow-diagram/helpers.ts +89 -3
  12. package/ab-flow-diagram/index.tsx +116 -3
  13. package/ab-flow-diagram/styles.module.css +112 -1
  14. package/ab-mobile-header/index.tsx +151 -12
  15. package/ab-playground-scene/i18n.module.css +54 -0
  16. package/ab-playground-scene/i18n.tsx +141 -0
  17. package/ab-playground-scene/icons.tsx +96 -0
  18. package/ab-playground-scene/index.tsx +138 -0
  19. package/ab-playground-scene/labels.ts +103 -0
  20. package/ab-playground-scene/scenes.tsx +103 -0
  21. package/ab-playground-scene/styles.module.css +148 -0
  22. package/ab-playground-scene/upgraded.tsx +315 -0
  23. package/ab-playground-scene/welcome.tsx +120 -0
  24. package/ab-theme-mode/index.tsx +82 -0
  25. package/ab-theme-toggle/index.tsx +22 -3
  26. package/index.ts +11 -14
  27. package/package.json +9 -18
  28. package/server/ab-button/index.tsx +3 -2
  29. package/server/index.ts +0 -3
  30. package/types/index.d.ts +8 -6
  31. package/ab-key-feature/index.tsx +0 -61
  32. package/ab-key-feature/styles.module.css +0 -79
  33. package/ab-main-headline/index.tsx +0 -58
  34. package/ab-main-headline/styles.module.css +0 -56
  35. package/ab-preview/index.tsx +0 -79
  36. package/ab-preview/styles.module.css +0 -58
  37. package/ab-switch-back/index.tsx +0 -73
  38. package/ab-switch-back/styles.module.css +0 -77
  39. package/ab-test-hello/index.tsx +0 -38
  40. package/ab-test-hello/styles.module.css +0 -57
  41. package/server/ab-button/styles.module.css +0 -191
  42. package/server/ab-key-feature/index.tsx +0 -60
  43. package/server/ab-key-feature/styles.module.css +0 -79
  44. package/server/ab-switch-back/index.tsx +0 -72
  45. package/server/ab-switch-back/styles.module.css +0 -77
  46. package/server/ab-test-hello/index.tsx +0 -36
  47. package/server/ab-test-hello/styles.module.css +0 -54
@@ -0,0 +1,82 @@
1
+ /*
2
+ * @license MIT
3
+ * ~~~~~~~~~~~~
4
+ * ab-nextjs-components
5
+ * ~~~~~~~~~~~~
6
+ * Copyright (c) 2026 Abraham Ukachi. The abElements Project.
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * of this software and associated documentation files (the 'Software'), to deal
10
+ * in the Software without restriction, including without limitation the rights
11
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * copies of the Software, and to permit persons to whom the Software is
13
+ * furnished to do so, subject to the following conditions:
14
+ *
15
+ * The above copyright notice and this permission notice shall be included in all
16
+ * copies or substantial portions of the Software.
17
+ *
18
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * SOFTWARE.
25
+ *
26
+ * @project: ab-nextjs-components
27
+ * @name: AbThemeModeProvider (one shared light / dark / system state)
28
+ * @file: ab-theme-mode/index.tsx
29
+ * @type: Client component + hook
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
+ // ⚛️ React
42
+ import { createContext, useContext, type ReactElement, type ReactNode } from 'react';
43
+ // 🌗 the theme engine (hooks ≥ 0.1.6): persisted in localStorage, applied to <html>, follows the OS in 'system'
44
+ import { useAbThemeMode, type AbThemeMode, type AbThemeModeResult } from 'ab-nextjs-hooks/useAbTheme';
45
+
46
+ /** 🧠 what the provider shares: the chosen mode, what paints, and the setter */
47
+ export interface AbThemeModeContextValue {
48
+ mode: AbThemeMode | string; // 🎚️ 'light' | 'dark' | 'system'
49
+ resolvedTheme: AbThemeModeResult['resolvedTheme']; // 🎨 what paints ('system' → light / dark)
50
+ setMode: (mode: AbThemeMode | string) => void; // ✍️ persists + applies (through the engine)
51
+ }
52
+
53
+ // 🧠 null outside a provider (each toggle then keeps its own engine, exactly like before)
54
+ const AbThemeModeContext = createContext<AbThemeModeContextValue | null>(null);
55
+
56
+ /** ⚙️ props */
57
+ export interface AbThemeModeProviderProps {
58
+ defaultMode?: AbThemeMode; // 🌱 before hydration / nothing saved (default 'light', the engine's default)
59
+ children?: ReactNode; // 🧩 the app
60
+ }
61
+
62
+ /**
63
+ * 🌗 AbThemeModeProvider — 0.2.3 (Joseph, Welcome 0.2.21): ONE theme state for the whole app. Each AbThemeToggle
64
+ * (laptop sidebar, Settings sheet) and AbMobileHeader's 3-state button used to run its own engine, so they drifted
65
+ * across 768px. Under this provider they all read and write this one engine (still persisted under the `theme`
66
+ * key, still following the OS in 'system'). Put it once, high in the tree (e.g. around AbAppLayout).
67
+ *
68
+ * 🧭 Why components and not hooks / theme: the engine already lives in ab-nextjs-hooks; this is only the sharing
69
+ * glue, and the consumers that must read it are components, so the release set stays core + components.
70
+ */
71
+ export function AbThemeModeProvider({ defaultMode = 'light', children }: AbThemeModeProviderProps): ReactElement {
72
+ const engine = useAbThemeMode(defaultMode); // 🌗 the ONE engine
73
+ return <AbThemeModeContext.Provider value={engine}>{children}</AbThemeModeContext.Provider>;
74
+ }
75
+
76
+ /** 🪝 useAbThemeModeContext — the shared state, or `null` outside an AbThemeModeProvider. */
77
+ export function useAbThemeModeContext(): AbThemeModeContextValue | null {
78
+ return useContext(AbThemeModeContext); // 🔍
79
+ }
80
+
81
+ // 📦 exports
82
+ export default AbThemeModeProvider;
@@ -52,6 +52,8 @@ import { useAbThemeMode, AB_THEME_MODES, type AbThemeMode } from 'ab-nextjs-hook
52
52
  import AbIcon from '../ab-icon';
53
53
  // 🎨 styles
54
54
  import styles from './styles.module.css';
55
+ // 🌗 0.2.3: the shared theme state (AbThemeModeProvider), when there is one
56
+ import { useAbThemeModeContext, type AbThemeModeContextValue } from '../ab-theme-mode';
55
57
  import { AB_MOTION } from 'ab-nextjs-animations/motion'; // 🎬 transition class names (ab-nextjs-animations >= 0.2.4)
56
58
  import 'ab-nextjs-animations/motion/styles.css'; // 🎨 .ab-motion-*
57
59
 
@@ -105,12 +107,29 @@ export function getNextAbThemeMode(modes: readonly AbThemeMode[], current: AbThe
105
107
  return null; // 🙅
106
108
  }
107
109
 
110
+ /**
111
+ * 🌗 AbThemeToggle — 0.2.3: under an AbThemeModeProvider every toggle reads and writes the ONE shared engine (no
112
+ * drift between the laptop and mobile toggles); without a provider it runs its own engine, as before. The branch is
113
+ * between two components, so each keeps a fixed hook order.
114
+ */
108
115
  export function AbThemeToggle(props: AbThemeToggleProps) {
116
+ const shared = useAbThemeModeContext(); // 🧠 the provider's state, or null
117
+ return shared ? <AbThemeToggleView {...props} engine={shared} /> : <AbThemeToggleOwn {...props} />;
118
+ }
119
+
120
+ // 🔧 no provider: this toggle's own engine (the pre-0.2.3 behaviour)
121
+ function AbThemeToggleOwn(props: AbThemeToggleProps) {
122
+ const engine = useAbThemeMode(props.defaultMode ?? 'light'); // 🌗 persists + applies to <html>
123
+ return <AbThemeToggleView {...props} engine={engine} />;
124
+ }
125
+
126
+ // 🖼️ the markup, fed by either engine
127
+ function AbThemeToggleView(props: AbThemeToggleProps & { engine: Pick<AbThemeModeContextValue, 'mode' | 'setMode'> }) {
109
128
  // 🧩 props
110
- const { labels, variant = 'segmented', modes = AB_THEME_MODES, value, onChange, defaultMode = 'light', icons, size = 'md', appearance = 'fill', iconShows, className, style } = props;
129
+ const { labels, variant = 'segmented', modes = AB_THEME_MODES, value, onChange, icons, size = 'md', appearance = 'fill', iconShows, className, style } = props;
111
130
  const thumb = appearance === 'thumb'; // 🌗 P7
112
- // 🌗 engine: persists + applies to <html>
113
- const engine = useAbThemeMode(defaultMode);
131
+ // 🌗 engine: the shared one (provider) or this toggle's own; both persist + apply to <html>
132
+ const { engine } = props;
114
133
  // 🎛️ controlled or engine-driven
115
134
  const current = (value ?? engine.mode) as AbThemeMode;
116
135
  // 📍 refs to move focus with the selection
package/index.ts CHANGED
@@ -78,13 +78,8 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
78
78
  { name: 'AbNavbar', file: 'ab-navbar/index.tsx', kind: 'client', status: 'Done' },
79
79
  { name: 'AbSidebar', file: 'ab-sidebar/index.tsx', kind: 'client', status: 'Done' },
80
80
  { name: 'AbText', file: 'ab-text/index.tsx', kind: 'client', status: 'Done' },
81
- { name: 'AbTestHello', file: 'ab-test-hello/index.tsx', kind: 'client', status: 'Done' },
82
- { name: 'AbKeyFeature', file: 'ab-key-feature/index.tsx', kind: 'client', status: 'Done' },
83
- { name: 'AbMainHeadline', file: 'ab-main-headline/index.tsx', kind: 'client', status: 'Done' },
84
- { name: 'AbPreview', file: 'ab-preview/index.tsx', kind: 'client', status: 'Done' },
85
81
  { name: 'AbProduct', file: 'ab-product/index.tsx', kind: 'client', status: 'Done' },
86
82
  { name: 'AbProductItem', file: 'ab-product-item/index.tsx', kind: 'client', status: 'Done' },
87
- { name: 'AbSwitchBack', file: 'ab-switch-back/index.tsx', kind: 'client', status: 'Done' },
88
83
  { name: 'AbDemoBox', file: 'ab-demo-box/index.tsx', kind: 'client', status: 'Done' },
89
84
  { name: 'AbDemoCode', file: 'ab-demo-code/index.tsx', kind: 'client', status: 'Done' },
90
85
 
@@ -101,9 +96,6 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
101
96
  { name: 'AbSidebar', file: 'server/ab-sidebar/index.tsx', kind: 'server', status: 'Done' },
102
97
  { name: 'AbNavLink', file: 'server/ab-nav-link/index.tsx', kind: 'server', status: 'Done' },
103
98
  { name: 'AbText', file: 'server/ab-text/index.tsx', kind: 'server', status: 'Done' },
104
- { name: 'AbTestHello', file: 'server/ab-test-hello/index.tsx', kind: 'server', status: 'Done' },
105
- { name: 'AbKeyFeature', file: 'server/ab-key-feature/index.tsx', kind: 'server', status: 'Done' },
106
- { name: 'AbSwitchBack', file: 'server/ab-switch-back/index.tsx', kind: 'server', status: 'Done' },
107
99
  // 🆕 Welcome v6 (AbThemeToggle)
108
100
  { name: 'AbThemeToggle', file: 'ab-theme-toggle/index.tsx', kind: 'client', status: 'Done' },
109
101
  // 🆕 Welcome v6 (AbChip)
@@ -116,6 +108,8 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
116
108
  { name: 'AbLocaleSwitcher', file: 'ab-locale-switcher/index.tsx', kind: 'client', status: 'Done' },
117
109
  // 🆕 Welcome v6 (AbFlowDiagram)
118
110
  { name: 'AbFlowDiagram', file: 'ab-flow-diagram/index.tsx', kind: 'server', status: 'Done' },
111
+ // 🆕 0.2.3 Welcome v6 playground (AbPlaygroundScene)
112
+ { name: 'AbPlaygroundScene', file: 'ab-playground-scene/index.tsx', kind: 'server', status: 'Done' },
119
113
  // 🆕 0.1.13 docs shell (AbLink)
120
114
  { name: 'AbLink', file: 'ab-link/index.tsx', kind: 'client', status: 'Done' },
121
115
  // 🆕 0.1.13 docs shell (AbKbd) — server-safe, no hooks
@@ -137,6 +131,7 @@ const supportedComponents: Array<ComponentCatalogEntry> = [
137
131
  { name: 'AbConfirmDrawer', file: 'ab-confirm-drawer/index.tsx', kind: 'client', status: 'Done' },
138
132
  { name: 'AbBottomDrawer', file: 'ab-bottom-drawer/index.tsx', kind: 'client', status: 'Done' },
139
133
  { name: 'AbMobileHeader', file: 'ab-mobile-header/index.tsx', kind: 'client', status: 'Done' }, // 🆕 0.2.0 drawers v2
134
+ { name: 'AbThemeModeProvider', file: 'ab-theme-mode/index.tsx', kind: 'client', status: 'Done' }, // 🌗 0.2.3 shared theme mode
140
135
  { name: 'AbSearchDrawer', file: 'ab-search-drawer/index.tsx', kind: 'client', status: 'Done' }, // 🆕 0.2.0 drawers v2
141
136
  { name: 'AbTocDrawer', file: 'ab-toc-drawer/index.tsx', kind: 'client', status: 'Done' }, // 🆕 0.2.0 drawers v2
142
137
  { name: 'AbNavDrawer', file: 'ab-nav-drawer/index.tsx', kind: 'client', status: 'Done' }, // 🆕 0.2.0 drawers v2
@@ -204,9 +199,16 @@ export type { AbConfirmDrawerProps } from './ab-confirm-drawer/index.tsx'
204
199
  // 📱 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
205
200
  export { default as AbBottomDrawer } from './ab-bottom-drawer/index.tsx'
206
201
  export type { AbBottomDrawerProps } from './ab-bottom-drawer/index.tsx'
202
+ // 👇 0.2.3 (Joseph, Welcome 0.2.21): swipe a bottom sheet down to close
203
+ export { useAbSwipeDown, isAbScrolledInside } from './ab-bottom-drawer/use-ab-swipe-down.ts'
204
+ export type { UseAbSwipeDownOptions } from './ab-bottom-drawer/use-ab-swipe-down.ts'
207
205
  // 🆕 0.2.0 drawers v2: AbMobileHeader
208
206
  export { default as AbMobileHeader } from './ab-mobile-header/index.tsx'
209
- export type { AbMobileHeaderProps } from './ab-mobile-header/index.tsx'
207
+ export type { AbMobileHeaderProps, AbMobileHeaderThemeMode, AbMobileHeaderLanguage } from './ab-mobile-header/index.tsx'
208
+ export { AB_MOBILE_HEADER_THEME_CYCLE } from './ab-mobile-header/index.tsx' // 🌗 0.2.3
209
+ // 🌗 0.2.3 (Joseph, Welcome 0.2.21): one shared theme mode for every toggle
210
+ export { AbThemeModeProvider, useAbThemeModeContext } from './ab-theme-mode/index.tsx'
211
+ export type { AbThemeModeProviderProps, AbThemeModeContextValue } from './ab-theme-mode/index.tsx'
210
212
  // 🆕 0.2.0 drawers v2: AbSearchDrawer
211
213
  export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY } from './ab-search-drawer/index.tsx'
212
214
  export type { AbSearchDrawerProps, AbSearchDrawerItem, AbSearchDrawerGroup, AbSearchDrawerLabels } from './ab-search-drawer/index.tsx'
@@ -232,13 +234,8 @@ export type { AbBreadcrumbItem, AbBreadcrumbsProps } from './ab-breadcrumbs/inde
232
234
  export { default as AbList, AbListItem } from './ab-list/index.tsx'
233
235
  export type { AbListProps, AbListItemProps } from './ab-list/index.tsx'
234
236
  export { default as AbText } from './ab-text/index.tsx'
235
- export { default as AbTestHello } from './ab-test-hello/index.tsx'
236
- export { default as AbKeyFeature } from './ab-key-feature/index.tsx'
237
- export { default as AbMainHeadline } from './ab-main-headline/index.tsx'
238
- export { default as AbPreview } from './ab-preview/index.tsx'
239
237
  export { default as AbProduct } from './ab-product/index.tsx'
240
238
  export { default as AbProductItem } from './ab-product-item/index.tsx'
241
- export { default as AbSwitchBack } from './ab-switch-back/index.tsx'
242
239
  export { default as AbDemoBox } from './ab-demo-box/index.tsx'
243
240
  export { default as AbDemoCode } from './ab-demo-code/index.tsx'
244
241
  export { default as AbPolygon } from './server/ab-polygon/index.tsx'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ab-nextjs-components",
3
- "version": "0.2.2",
3
+ "version": "0.3.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",
@@ -40,10 +40,10 @@
40
40
  },
41
41
  "license": "MIT",
42
42
  "peerDependencies": {
43
- "ab-nextjs-animations": "^0.2.4",
43
+ "ab-nextjs-animations": "^0.2.5",
44
44
  "ab-nextjs-hooks": "^0.1.7",
45
45
  "ab-nextjs-icons": "^0.2.4",
46
- "ab-nextjs-theme": "^0.3.6",
46
+ "ab-nextjs-theme": "^0.3.7",
47
47
  "clsx": "^2",
48
48
  "next": "^16.3.4",
49
49
  "react": "^19",
@@ -53,10 +53,10 @@
53
53
  "@testing-library/react": "^16.3.3",
54
54
  "@types/node": "^20",
55
55
  "@types/react": "^19",
56
- "ab-nextjs-animations": "^0.2.4",
56
+ "ab-nextjs-animations": "^0.2.5",
57
57
  "ab-nextjs-hooks": "^0.1.7",
58
58
  "ab-nextjs-icons": "^0.2.4",
59
- "ab-nextjs-theme": "^0.3.6",
59
+ "ab-nextjs-theme": "^0.3.7",
60
60
  "clsx": "^2.1.1",
61
61
  "esbuild": "^0.28.2",
62
62
  "eslint": "^9.39.0",
@@ -102,13 +102,8 @@
102
102
  "ab-navbar",
103
103
  "ab-sidebar",
104
104
  "ab-text",
105
- "ab-test-hello",
106
- "ab-key-feature",
107
- "ab-main-headline",
108
- "ab-preview",
109
105
  "ab-product",
110
106
  "ab-product-item",
111
- "ab-switch-back",
112
107
  "ab-demo-box",
113
108
  "ab-demo-code",
114
109
  "ab-splash",
@@ -128,11 +123,13 @@
128
123
  "ab-breadcrumbs",
129
124
  "ab-list",
130
125
  "ab-flow-diagram",
126
+ "ab-playground-scene",
131
127
  "ab-locale-switcher",
132
128
  "ab-install-snippet",
133
129
  "ab-pill",
134
130
  "ab-chip",
135
131
  "ab-theme-toggle",
132
+ "ab-theme-mode",
136
133
  "ab-logo/ab-logo.svg",
137
134
  "styles.css",
138
135
  "css",
@@ -159,6 +156,7 @@
159
156
  "./ab-carousel": "./ab-carousel/index.tsx",
160
157
  "./ab-carousel/helpers": "./ab-carousel/helpers.ts",
161
158
  "./ab-theme-toggle": "./ab-theme-toggle/index.tsx",
159
+ "./ab-theme-mode": "./ab-theme-mode/index.tsx",
162
160
  "./ab-chip": "./ab-chip/index.tsx",
163
161
  "./ab-pill": "./ab-pill/index.tsx",
164
162
  "./ab-install-snippet": "./ab-install-snippet/index.tsx",
@@ -166,6 +164,7 @@
166
164
  "./ab-locale-switcher": "./ab-locale-switcher/index.tsx",
167
165
  "./ab-flow-diagram": "./ab-flow-diagram/index.tsx",
168
166
  "./ab-flow-diagram/helpers": "./ab-flow-diagram/helpers.ts",
167
+ "./ab-playground-scene": "./ab-playground-scene/index.tsx",
169
168
  "./ab-drawer": "./ab-drawer/index.tsx",
170
169
  "./ab-drawer/use-ab-drawer": "./ab-drawer/use-ab-drawer.ts",
171
170
  "./ab-drawer-list": "./ab-drawer-list/index.tsx",
@@ -219,13 +218,8 @@
219
218
  "./ab-navbar": "./ab-navbar/index.tsx",
220
219
  "./ab-sidebar": "./ab-sidebar/index.tsx",
221
220
  "./ab-text": "./ab-text/index.tsx",
222
- "./ab-test-hello": "./ab-test-hello/index.tsx",
223
- "./ab-key-feature": "./ab-key-feature/index.tsx",
224
- "./ab-main-headline": "./ab-main-headline/index.tsx",
225
- "./ab-preview": "./ab-preview/index.tsx",
226
221
  "./ab-product": "./ab-product/index.tsx",
227
222
  "./ab-product-item": "./ab-product-item/index.tsx",
228
- "./ab-switch-back": "./ab-switch-back/index.tsx",
229
223
  "./ab-demo-box": "./ab-demo-box/index.tsx",
230
224
  "./ab-demo-code": "./ab-demo-code/index.tsx",
231
225
  "./server/ab-brand": "./server/ab-brand/index.tsx",
@@ -234,9 +228,6 @@
234
228
  "./server/ab-sidebar": "./server/ab-sidebar/index.tsx",
235
229
  "./server/ab-nav-link": "./server/ab-nav-link/index.tsx",
236
230
  "./server/ab-text": "./server/ab-text/index.tsx",
237
- "./server/ab-test-hello": "./server/ab-test-hello/index.tsx",
238
- "./server/ab-key-feature": "./server/ab-key-feature/index.tsx",
239
- "./server/ab-switch-back": "./server/ab-switch-back/index.tsx",
240
231
  "./styles.css": "./styles.css",
241
232
  "./css/*": "./css/*",
242
233
  "./assets/*": "./assets/*",
@@ -41,7 +41,8 @@ import type { CSSProperties, ReactElement, ReactNode } from 'react';
41
41
  // 🧵 class joiner
42
42
  import clsx from 'clsx';
43
43
  // 🎨 styles (server copy)
44
- import styles from './styles.module.css';
44
+ // 🧬 0.2.3 (Joseph 03:41): ONE source for the button box — the client module's CSS (no server copy to drift)
45
+ import styles from '../../ab-button/styles.module.css';
45
46
  // 🧮 the SAME rules as the client twin
46
47
  import {
47
48
  getAbButtonDisabledMode,
@@ -96,7 +97,7 @@ const AbButton = ({
96
97
  const srReason = getAbButtonSrReason({ disabled, disabledReason });
97
98
 
98
99
  // 🏷️ classes
99
- const classNames = clsx('AbButton', styles.abButton, className, rounded && styles.abButtonRounded, type === 'filled' && styles.isFilled /* 🥉 */, mode === 'native' && styles.isDisabled);
100
+ const classNames = clsx('AbButton', styles.abButton, className, rounded && styles.abButtonRounded, type === 'contained' && styles.isContained /* 🎨 mirrors client */, type === 'filled' && styles.isFilled /* 🥉 */, mode === 'native' && styles.isDisabled);
100
101
 
101
102
  // 🗂️ data attributes
102
103
  const dataAttrs = {
package/server/index.ts CHANGED
@@ -23,6 +23,3 @@ export { default as AbNavbar } from './ab-navbar/index.tsx'
23
23
  export { default as AbSidebar } from './ab-sidebar/index.tsx'
24
24
  export { default as AbNavLink } from './ab-nav-link/index.tsx'
25
25
  export { default as AbText } from './ab-text/index.tsx'
26
- export { default as AbTestHello } from './ab-test-hello/index.tsx'
27
- export { default as AbKeyFeature } from './ab-key-feature/index.tsx'
28
- export { default as AbSwitchBack } from './ab-switch-back/index.tsx'
package/types/index.d.ts CHANGED
@@ -94,9 +94,16 @@ export type { AbConfirmDrawerProps } from '../ab-confirm-drawer/index.tsx';
94
94
  // 📱 0.1.14 (D40): AbBottomDrawer, the mobile bottom drawer
95
95
  export { default as AbBottomDrawer } from '../ab-bottom-drawer/index.tsx';
96
96
  export type { AbBottomDrawerProps } from '../ab-bottom-drawer/index.tsx';
97
+ // 👇 0.2.3 (Joseph, Welcome 0.2.21): swipe a bottom sheet down to close
98
+ export { useAbSwipeDown, isAbScrolledInside } from '../ab-bottom-drawer/use-ab-swipe-down.ts';
99
+ export type { UseAbSwipeDownOptions } from '../ab-bottom-drawer/use-ab-swipe-down.ts';
97
100
  // 🆕 0.2.0 drawers v2: AbMobileHeader
98
101
  export { default as AbMobileHeader } from '../ab-mobile-header/index.tsx';
99
- export type { AbMobileHeaderProps } from '../ab-mobile-header/index.tsx';
102
+ export type { AbMobileHeaderProps, AbMobileHeaderThemeMode, AbMobileHeaderLanguage } from '../ab-mobile-header/index.tsx';
103
+ export { AB_MOBILE_HEADER_THEME_CYCLE } from '../ab-mobile-header/index.tsx'; // 🌗 0.2.3
104
+ // 🌗 0.2.3 (Joseph, Welcome 0.2.21): one shared theme mode for every toggle
105
+ export { AbThemeModeProvider, useAbThemeModeContext } from '../ab-theme-mode/index.tsx';
106
+ export type { AbThemeModeProviderProps, AbThemeModeContextValue } from '../ab-theme-mode/index.tsx';
100
107
  // 🆕 0.2.0 drawers v2: AbSearchDrawer
101
108
  export { default as AbSearchDrawer, addAbSearchRecent, highlightAbSearch, AB_SEARCH_RECENT_KEY } from '../ab-search-drawer/index.tsx';
102
109
  export type { AbSearchDrawerProps, AbSearchDrawerItem, AbSearchDrawerGroup, AbSearchDrawerLabels } from '../ab-search-drawer/index.tsx';
@@ -124,13 +131,8 @@ export type { AbBreadcrumbItem, AbBreadcrumbsProps } from '../ab-breadcrumbs/ind
124
131
  export { default as AbList, AbListItem } from '../ab-list/index.tsx';
125
132
  export type { AbListProps, AbListItemProps } from '../ab-list/index.tsx';
126
133
  export { default as AbText } from '../ab-text/index.tsx';
127
- export { default as AbTestHello } from '../ab-test-hello/index.tsx';
128
- export { default as AbKeyFeature } from '../ab-key-feature/index.tsx';
129
- export { default as AbMainHeadline } from '../ab-main-headline/index.tsx';
130
- export { default as AbPreview } from '../ab-preview/index.tsx';
131
134
  export { default as AbProduct } from '../ab-product/index.tsx';
132
135
  export { default as AbProductItem } from '../ab-product-item/index.tsx';
133
- export { default as AbSwitchBack } from '../ab-switch-back/index.tsx';
134
136
  export { default as AbDemoBox } from '../ab-demo-box/index.tsx';
135
137
  export { default as AbDemoCode } from '../ab-demo-code/index.tsx';
136
138
  export { default as AbPolygon } from '../server/ab-polygon/index.tsx';
@@ -1,61 +0,0 @@
1
- /*
2
- * @license MIT
3
- * ~~~~~~~~~~~~
4
- * ab-nextjs-components
5
- * ~~~~~~~~~~~~
6
- * Copyright (c) 2026 Abraham Ukachi. The abElements Project.
7
- *
8
- * @project: ab-nextjs-components
9
- * @name: AbKeyFeature - Client (port of lyd-key-feature)
10
- * @file: ab-key-feature/index.tsx
11
- * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
12
- */
13
-
14
- 'use client';
15
-
16
- import type { ReactElement } from 'react';
17
- import Link from '../ab-link'; // 🔗 G42: injectable via AbLinkProvider (default next/link)
18
- import clsx from 'clsx';
19
- import styles from './styles.module.css';
20
-
21
- export interface AbKeyFeatureProps {
22
- className?: string;
23
- hidden?: boolean;
24
- icon: string;
25
- name: string;
26
- title: string;
27
- description?: string;
28
- linkHidden?: boolean;
29
- linkLabel?: string;
30
- link?: string;
31
- watermark?: string;
32
- }
33
-
34
- const AbKeyFeature = ({
35
- className,
36
- hidden = false,
37
- icon,
38
- name,
39
- title,
40
- description,
41
- linkHidden = false,
42
- linkLabel = 'Learn more',
43
- link,
44
- watermark,
45
- }: AbKeyFeatureProps): ReactElement => {
46
- return (
47
- <article hidden={hidden} className={clsx('AbKeyFeature', styles.abKeyFeature, className)}>
48
- <span className={clsx('material-symbols-rounded', styles.abKeyFeatureIcon)} aria-hidden>{icon}</span>
49
- <span className={styles.abKeyFeatureName}>{name}</span>
50
- <h3 className={styles.abKeyFeatureTitle}>{title}</h3>
51
- {description ? <p className={styles.abKeyFeatureDesc}>{description}</p> : null}
52
- {!linkHidden && link ? (
53
- <Link href={link} className={styles.abKeyFeatureLink}>{linkLabel}</Link>
54
- ) : null}
55
- {watermark ? <span className={styles.abKeyFeatureWatermark} aria-hidden>{watermark}</span> : null}
56
- </article>
57
- );
58
- };
59
-
60
- export default AbKeyFeature;
61
- export { AbKeyFeature };
@@ -1,79 +0,0 @@
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-key-feature/styles.module.css
29
- * @type: CSS Stylesheet
30
- * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
- */
32
-
33
- .abKeyFeature {
34
- display: flex;
35
- flex-direction: column;
36
- gap: 0.5rem;
37
- padding: 1rem;
38
- border-radius: 1rem;
39
- position: relative;
40
- overflow: hidden;
41
- background: color-mix(in srgb, var(--ab-surface-container, #f3edf7) 85%, transparent);
42
- }
43
- .abKeyFeatureIcon {
44
- font-size: 2rem;
45
- color: var(--ab-primary, #6750a4);
46
- }
47
- .abKeyFeatureName {
48
- font-size: 0.75rem;
49
- font-weight: 700;
50
- text-transform: uppercase;
51
- letter-spacing: 0.06em;
52
- opacity: 0.7;
53
- }
54
- .abKeyFeatureTitle {
55
- margin: 0;
56
- font-size: 1.25rem;
57
- font-weight: 700;
58
- }
59
- .abKeyFeatureDesc {
60
- margin: 0;
61
- font-size: 0.9375rem;
62
- opacity: 0.8;
63
- }
64
- .abKeyFeatureLink {
65
- margin-top: 0.5rem;
66
- align-self: flex-start;
67
- color: var(--ab-primary, #6750a4);
68
- font-weight: 600;
69
- text-decoration: none;
70
- }
71
- .abKeyFeatureWatermark {
72
- position: absolute;
73
- right: -0.5rem;
74
- bottom: -0.5rem;
75
- font-size: 5rem;
76
- opacity: 0.06;
77
- pointer-events: none;
78
- user-select: none;
79
- }
@@ -1,58 +0,0 @@
1
- /*
2
- * @license MIT
3
- * ~~~~~~~~~~~~
4
- * ab-nextjs-components
5
- * ~~~~~~~~~~~~
6
- * Copyright (c) 2026 Abraham Ukachi. The abElements Project.
7
- *
8
- * @project: ab-nextjs-components
9
- * @name: AbMainHeadline - Client (port of lyd-main-headline; providers stripped)
10
- * @file: ab-main-headline/index.tsx
11
- * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
12
- */
13
-
14
- 'use client';
15
-
16
- import type { ReactElement } from 'react';
17
- import clsx from 'clsx';
18
- import styles from './styles.module.css';
19
-
20
- export interface AbMainHeadlineProps {
21
- className?: string;
22
- timePeriod?: 'morning' | 'afternoon' | 'evening' | 'night';
23
- title: string;
24
- commaHidden?: boolean;
25
- subtitle: string;
26
- isFirstNameBold?: boolean;
27
- hasExclamationMark?: boolean;
28
- }
29
-
30
- const AbMainHeadline = ({
31
- className,
32
- timePeriod,
33
- title,
34
- commaHidden = false,
35
- subtitle,
36
- isFirstNameBold = false,
37
- hasExclamationMark = false,
38
- }: AbMainHeadlineProps): ReactElement => {
39
- const parts = title.trim().split(/\s+/);
40
- const first = parts[0] ?? '';
41
- const rest = parts.slice(1).join(' ');
42
-
43
- return (
44
- <header className={clsx('AbMainHeadline', styles.abMainHeadline, className)}>
45
- {timePeriod ? <span className={styles.abMainHeadlinePeriod}>{timePeriod}</span> : null}
46
- <h1 className={styles.abMainHeadlineTitle}>
47
- {isFirstNameBold ? <strong>{first}</strong> : first}
48
- {rest ? ` ${rest}` : ''}
49
- {!commaHidden ? ',' : ''}
50
- {hasExclamationMark ? '!' : ''}
51
- </h1>
52
- <p className={styles.abMainHeadlineSubtitle}>{subtitle}</p>
53
- </header>
54
- );
55
- };
56
-
57
- export default AbMainHeadline;
58
- export { AbMainHeadline };
@@ -1,56 +0,0 @@
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-main-headline/styles.module.css
29
- * @type: CSS Stylesheet
30
- * @authors: Abraham Ukachi <abrahamukachi@gmail.com>
31
- */
32
-
33
- .abMainHeadline {
34
- display: flex;
35
- flex-direction: column;
36
- gap: 0.35rem;
37
- }
38
- .abMainHeadlineTitle {
39
- margin: 0;
40
- font-size: clamp(1.75rem, 4vw, 2.75rem);
41
- font-weight: 700;
42
- line-height: 1.15;
43
- }
44
- .abMainHeadlineTitle strong { font-weight: 900; }
45
- .abMainHeadlineSubtitle {
46
- margin: 0;
47
- font-size: 1.05rem;
48
- opacity: 0.75;
49
- }
50
- .abMainHeadlinePeriod {
51
- font-size: 0.75rem;
52
- font-weight: 700;
53
- text-transform: uppercase;
54
- letter-spacing: 0.08em;
55
- opacity: 0.55;
56
- }