ab-nextjs-components 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/README.md +30 -0
- package/ab-app-bar/index.tsx +181 -0
- package/ab-app-bar/styles.module.css +119 -0
- package/ab-avatar/index.tsx +2 -1
- package/ab-avatar/styles.module.css +32 -0
- package/ab-balloon/index.tsx +134 -23
- package/ab-balloon/styles.module.css +84 -7
- package/ab-brand/index.tsx +1 -1
- package/ab-button/helpers.ts +3 -1
- package/ab-button/index.tsx +17 -3
- package/ab-button/styles.module.css +42 -0
- package/ab-card/index.tsx +89 -0
- package/ab-card/styles.module.css +68 -0
- package/ab-collapsible/index.tsx +1 -1
- package/ab-color/index.tsx +1 -0
- package/ab-color/styles.module.css +32 -0
- package/ab-demo-box/index.tsx +1 -0
- package/ab-demo-box/styles.module.css +32 -0
- package/ab-demo-code/index.tsx +1 -0
- package/ab-demo-code/styles.module.css +32 -0
- package/ab-icon/builtin.ts +15 -1
- package/ab-icon/helpers.ts +37 -0
- package/ab-icon/index.tsx +14 -8
- package/ab-icon/registrar.tsx +68 -0
- package/ab-icon-button/index.tsx +8 -3
- package/ab-image/index.tsx +1 -0
- package/ab-image/styles.module.css +32 -0
- package/ab-info/index.tsx +2 -1
- package/ab-info/styles.module.css +32 -0
- package/ab-input/index.tsx +1 -0
- package/ab-input/styles.module.css +1 -0
- package/ab-install-snippet/styles.module.css +32 -8
- package/ab-kbd/index.tsx +65 -0
- package/ab-kbd/styles.module.css +55 -0
- package/ab-key-feature/index.tsx +2 -1
- package/ab-key-feature/styles.module.css +32 -0
- package/ab-like-button/index.tsx +1 -1
- package/ab-link/index.tsx +112 -0
- package/ab-link/locale.ts +53 -0
- package/ab-locale-switcher/index.tsx +17 -0
- package/ab-locale-switcher/styles.module.css +11 -0
- package/ab-main-headline/index.tsx +1 -0
- package/ab-main-headline/styles.module.css +32 -0
- package/ab-menu/index.tsx +6 -5
- package/ab-menu/styles.module.css +32 -0
- package/ab-name/index.tsx +1 -0
- package/ab-name/styles.module.css +32 -0
- package/ab-navbar/index.tsx +54 -46
- package/ab-navbar/styles.module.css +84 -28
- package/ab-navbar/view.tsx +163 -0
- package/ab-package-card/index.tsx +94 -0
- package/ab-package-card/styles.module.css +41 -0
- package/ab-page-paginator/index.tsx +1 -0
- package/ab-page-paginator/styles.module.css +32 -0
- package/ab-page-switcher/index.tsx +1 -0
- package/ab-page-switcher/styles.module.css +32 -0
- package/ab-preview/index.tsx +1 -0
- package/ab-preview/styles.module.css +32 -0
- package/ab-price/index.tsx +1 -0
- package/ab-price/styles.module.css +32 -0
- package/ab-price-tag/index.tsx +1 -0
- package/ab-price-tag/styles.module.css +32 -0
- package/ab-product/index.tsx +1 -0
- package/ab-product/styles.module.css +32 -0
- package/ab-product-item/index.tsx +1 -0
- package/ab-product-item/styles.module.css +32 -0
- package/ab-search-result/index.tsx +1 -0
- package/ab-search-result/styles.module.css +32 -0
- package/ab-search-trigger/index.tsx +142 -0
- package/ab-search-trigger/styles.module.css +70 -0
- package/ab-sidebar/index.tsx +88 -49
- package/ab-sidebar/styles.module.css +136 -31
- package/ab-sidebar/view.tsx +182 -0
- package/ab-switch-back/index.tsx +2 -1
- package/ab-switch-back/styles.module.css +32 -0
- package/ab-tab/index.tsx +2 -1
- package/ab-tab/styles.module.css +32 -0
- package/ab-tabs/index.tsx +1 -0
- package/ab-tabs/styles.module.css +32 -0
- package/ab-test-hello/index.tsx +1 -0
- package/ab-test-hello/styles.module.css +32 -0
- package/ab-text/index.tsx +1 -0
- package/ab-text/styles.module.css +32 -0
- package/ab-toc/index.tsx +124 -0
- package/ab-toc/styles.module.css +54 -0
- package/css/chrome-mq.css +32 -0
- package/css/doodle.css +32 -0
- package/css/logo.css +32 -0
- package/css/spinner.css +32 -0
- package/css/toast.css +32 -0
- package/index.ts +18 -0
- package/package.json +27 -10
- package/server/ab-avatar/index.tsx +2 -1
- package/server/ab-avatar/styles.module.css +32 -0
- package/server/ab-badge/index.tsx +1 -0
- package/server/ab-badge/styles.module.css +32 -0
- package/server/ab-brand/index.tsx +1 -1
- package/server/ab-button/index.tsx +1 -1
- package/server/ab-button/styles.module.css +11 -0
- package/server/ab-icon/index.tsx +13 -8
- package/server/ab-key-feature/index.tsx +2 -1
- package/server/ab-key-feature/styles.module.css +32 -0
- package/server/ab-name/index.tsx +1 -0
- package/server/ab-name/styles.module.css +32 -0
- package/server/ab-nav-link/index.tsx +2 -1
- package/server/ab-nav-link/styles.module.css +32 -0
- package/server/ab-navbar/index.tsx +44 -45
- package/server/ab-polygon/index.tsx +1 -0
- package/server/ab-polygon/styles.module.css +32 -0
- package/server/ab-sidebar/index.tsx +44 -49
- package/server/ab-switch-back/index.tsx +2 -1
- package/server/ab-switch-back/styles.module.css +32 -0
- package/server/ab-test-hello/index.tsx +1 -0
- package/server/ab-test-hello/styles.module.css +32 -0
- package/server/ab-text/index.tsx +1 -0
- package/server/ab-text/styles.module.css +32 -0
- package/server/index.ts +1 -0
- package/styles.css +32 -0
- package/types/index.d.ts +35 -0
- package/server/ab-navbar/styles.module.css +0 -35
- package/server/ab-sidebar/styles.module.css +0 -41
package/ab-icon/index.tsx
CHANGED
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
'use client';
|
|
44
44
|
|
|
45
45
|
// ⚛️ types
|
|
46
|
-
import type
|
|
46
|
+
import { useId, type CSSProperties, type ReactElement } from 'react';
|
|
47
47
|
// 🧵 classes
|
|
48
48
|
import clsx from 'clsx';
|
|
49
49
|
// 🧮 shared helpers (NO icon map import: client bundles stay small)
|
|
50
|
-
import { getAbIconStroke, getRegisteredAbIcon, pickAbIconMarkup, registerAbIcons, toAbIconSize, type AbIconSvgData, type AbIconVariant, type AbIconWeight } from './helpers';
|
|
50
|
+
import { scopeAbIconIds, warnAbIconMissing, getAbIconStroke, getRegisteredAbIcon, pickAbIconMarkup, registerAbIcons, toAbIconSize, type AbIconSvgData, type AbIconVariant, type AbIconWeight } from './helpers';
|
|
51
51
|
// 🗂️ the 8 glyphs components draw themselves (per-icon modules, not the map)
|
|
52
52
|
import { AB_ICON_BUILTINS } from './builtin';
|
|
53
53
|
// 🎨 styles
|
|
@@ -56,13 +56,14 @@ import styles from './styles.module.css';
|
|
|
56
56
|
// 📦 helpers for consumers (registerAbIcons, types)
|
|
57
57
|
export * from './helpers';
|
|
58
58
|
export { AB_ICON_BUILTINS } from './builtin';
|
|
59
|
+
export { AbIconRegistrar, type AbIconRegistrarProps } from './registrar'; // 🗂️ server-safe registration (Joseph #11)
|
|
59
60
|
|
|
60
61
|
// 🗂️ register built-ins at module scope (same on server render + hydration → no mismatch)
|
|
61
62
|
registerAbIcons(AB_ICON_BUILTINS);
|
|
62
63
|
|
|
63
64
|
// ⚙️ props
|
|
64
65
|
export interface AbIconProps {
|
|
65
|
-
name: string; // 🗂️ AbIcons name (snake_case); Material ligature fallback
|
|
66
|
+
name: string; // 🗂️ AbIcons name (snake_case); AbIcons name (registered / svg / map); unknown = Material ligature fallback + dev warning
|
|
66
67
|
variant?: AbIconVariant; // 🎚️ outlined (default) | filled
|
|
67
68
|
filled?: boolean; // 🕰️ legacy alias for variant="filled"
|
|
68
69
|
weight?: AbIconWeight | number; // 📏 100–700 (outlined), default 200
|
|
@@ -74,10 +75,12 @@ export interface AbIconProps {
|
|
|
74
75
|
style?: CSSProperties; // 🎨
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
/** 🔣 AbIcons SVG icon (client): `svg` prop → registry → Material ligature fallback. */
|
|
78
|
+
/** 🔣 AbIcons SVG icon (client): `svg` prop → registry → Material ligature fallback + dev warning. */
|
|
78
79
|
const AbIcon = ({ name, variant, filled = false, weight, size, label, title, svg, className, style }: AbIconProps): ReactElement => {
|
|
79
80
|
// 🔍 resolve markup without the full map
|
|
80
81
|
const markup = pickAbIconMarkup(svg ?? getRegisteredAbIcon(name), variant ?? (filled ? 'filled' : 'outlined'));
|
|
82
|
+
// 🆔 one id per rendered instance (Joseph: a hidden twin's mask broke the active Home)
|
|
83
|
+
const uid = useId();
|
|
81
84
|
// 🎚️ legacy `filled` → variant
|
|
82
85
|
const v: AbIconVariant = variant ?? (filled ? 'filled' : 'outlined');
|
|
83
86
|
// 🏷️ accessible name: `label` (new) or `title` (legacy)
|
|
@@ -98,18 +101,21 @@ const AbIcon = ({ name, variant, filled = false, weight, size, label, title, svg
|
|
|
98
101
|
title={title} // 💬 legacy tooltip only
|
|
99
102
|
{...a11y} // ♿
|
|
100
103
|
// 🔒 trusted, package-generated static markup (never user input)
|
|
101
|
-
dangerouslySetInnerHTML={{ __html: markup }}
|
|
104
|
+
dangerouslySetInnerHTML={{ __html: scopeAbIconIds(markup, uid) }}
|
|
102
105
|
/>
|
|
103
106
|
);
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
// 🕰️
|
|
109
|
+
// 🕰️ 0.1.13 (James review): NON-breaking fallback for unregistered names. A patch must not blank icons,
|
|
110
|
+
// so an unknown name still renders the pre-G2 Material Symbols ligature (needs the app's font), and
|
|
111
|
+
// warns once in development so the missing registration gets fixed before the app drops the font.
|
|
112
|
+
warnAbIconMissing(name);
|
|
107
113
|
return (
|
|
108
114
|
<span
|
|
109
|
-
className={clsx('material-symbols-rounded', 'icon', styles.abIconFont, className)} // 🏷️
|
|
115
|
+
className={clsx('AbIcon', 'material-symbols-rounded', 'icon', styles.abIconFont, className)} // 🏷️ legacy font class
|
|
110
116
|
style={{ ...style, fontSize: toAbIconSize(size) }} // 📏
|
|
111
|
-
data-filled={v === 'filled' ? 'true' : 'false'} // 🎚️
|
|
112
117
|
data-icon={name} // 🗂️
|
|
118
|
+
data-filled={v === 'filled' ? 'true' : 'false'} // 🎚️
|
|
113
119
|
data-ab-icon-fallback="font" // 🔎 easy to audit
|
|
114
120
|
title={title} // 💬
|
|
115
121
|
{...a11y} // ♿
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: AbIconRegistrar (0.1.13)
|
|
28
|
+
* @file: ab-icon/registrar.tsx
|
|
29
|
+
* @type: Client Component — server-safe icon registration
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* 1+|> import home from 'ab-nextjs-icons/ab-icons/icons/home'
|
|
34
|
+
* -|> <AbIconRegistrar icons={{ home }} /> // 🗂️ in a Server Component layout
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
39
|
+
* MOTTO: We'll always do more 😜!!!
|
|
40
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
'use client';
|
|
44
|
+
|
|
45
|
+
// 🗂️ the shared client registry
|
|
46
|
+
import { registerAbIcons, type AbIconSvgData } from './helpers';
|
|
47
|
+
|
|
48
|
+
/** ⚙️ props: the icons to register (plain strings, so a Server Component can pass them) */
|
|
49
|
+
export interface AbIconRegistrarProps {
|
|
50
|
+
icons: Record<string, AbIconSvgData>; // 🗂️ e.g. { home, home_filled } from ab-nextjs-icons/ab-icons/icons/*
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 🗂️ AbIconRegistrar (0.1.13, Joseph #11): the SERVER-SAFE way to register icons.
|
|
55
|
+
* `registerAbIcons` is client-only state, so a Server Component (e.g. app/[locale]/layout.tsx) can't call it.
|
|
56
|
+
* Render this once, ABOVE the icons, and pass the svg data as a prop (it is serializable):
|
|
57
|
+
* import home from 'ab-nextjs-icons/ab-icons/icons/home';
|
|
58
|
+
* <AbIconRegistrar icons={{ home }} />
|
|
59
|
+
* It registers DURING render (idempotent: same name → same markup), so the server render and hydration see
|
|
60
|
+
* the same set: no mismatch, no effect delay. It renders nothing.
|
|
61
|
+
*/
|
|
62
|
+
export function AbIconRegistrar({ icons }: AbIconRegistrarProps): null {
|
|
63
|
+
registerAbIcons(icons); // ➕ every render (cheap Map.set, same values)
|
|
64
|
+
return null; // 🫥
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 📦 exports
|
|
68
|
+
export default AbIconRegistrar;
|
package/ab-icon-button/index.tsx
CHANGED
|
@@ -49,6 +49,8 @@ import { forwardRef } from 'react';
|
|
|
49
49
|
import clsx from 'clsx';
|
|
50
50
|
// 🎨 package-shipped CSS module
|
|
51
51
|
import styles from './styles.module.css';
|
|
52
|
+
// 🔣 0.1.13 (G2, Joseph #6): the glyph is an AbIcon SVG, not the Material Symbols font
|
|
53
|
+
import AbIcon from '../ab-icon';
|
|
52
54
|
import { AB_MOTION } from 'ab-nextjs-animations/motion'; // 🎬 transition class names (ab-nextjs-animations >= 0.2.4)
|
|
53
55
|
import 'ab-nextjs-animations/motion/styles.css'; // 🎨 .ab-motion-*
|
|
54
56
|
|
|
@@ -60,8 +62,10 @@ export interface AbIconButtonProps {
|
|
|
60
62
|
style?: CSSProperties;
|
|
61
63
|
// 🙈 hide the whole button
|
|
62
64
|
hidden?: boolean;
|
|
63
|
-
// 🔣
|
|
65
|
+
// 🔣 AbIcons name (rendered with AbIcon; unregistered names fall back to the font ligature)
|
|
64
66
|
icon: string;
|
|
67
|
+
// ⬛ 0.1.13: filled variant (default: filled while `active`)
|
|
68
|
+
iconFilled?: boolean;
|
|
65
69
|
// 🚫 disabled (button: native `disabled`; link: `aria-disabled` + no href)
|
|
66
70
|
disabled?: boolean;
|
|
67
71
|
// 🔍 grow a little on hover
|
|
@@ -107,6 +111,7 @@ const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function A
|
|
|
107
111
|
label, // ♿
|
|
108
112
|
title, // 💬
|
|
109
113
|
type = 'button', // 🧾
|
|
114
|
+
iconFilled, // ⬛
|
|
110
115
|
} = props;
|
|
111
116
|
|
|
112
117
|
// ♿ G6: one accessible name for both variants, ON the interactive element (not the wrapper span)
|
|
@@ -115,8 +120,8 @@ const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function A
|
|
|
115
120
|
const tooltip = title ?? label;
|
|
116
121
|
// 🏷️ classes
|
|
117
122
|
const classNames = clsx('AbIconButton', 'icon-button', styles.abIconButton, AB_MOTION.interactive, expands && AB_MOTION.lift, shrinks && AB_MOTION.press, className); // 🎬 hover lift / press from ab-nextjs-animations
|
|
118
|
-
// 🔣 the glyph is decoration
|
|
119
|
-
const glyph = <
|
|
123
|
+
// 🔣 the glyph is decoration (the button carries the name): AbIcon without a label is aria-hidden
|
|
124
|
+
const glyph = <AbIcon name={icon} variant={(iconFilled ?? active) ? 'filled' : 'outlined'} className="icon" />;
|
|
120
125
|
|
|
121
126
|
// 🔗 link variant
|
|
122
127
|
if (href && !isLoading) {
|
package/ab-image/index.tsx
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: styles.module.css
|
|
28
|
+
* @file: ab-image/styles.module.css
|
|
29
|
+
* @type: CSS Stylesheet
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*/
|
|
32
|
+
|
|
1
33
|
.abImage {
|
|
2
34
|
position: relative;
|
|
3
35
|
display: flex;
|
package/ab-info/index.tsx
CHANGED
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
* @project: ab-nextjs-components
|
|
9
9
|
* @name: AbInfo - Client (port of lyd-info)
|
|
10
10
|
* @file: ab-info/index.tsx
|
|
11
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
'use client';
|
|
14
15
|
|
|
15
16
|
import type { ReactElement } from 'react';
|
|
16
|
-
import Link from 'next/link
|
|
17
|
+
import Link from '../ab-link'; // 🔗 G42: injectable via AbLinkProvider (default next/link)
|
|
17
18
|
import clsx from 'clsx';
|
|
18
19
|
import styles from './styles.module.css';
|
|
19
20
|
|
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: styles.module.css
|
|
28
|
+
* @file: ab-info/styles.module.css
|
|
29
|
+
* @type: CSS Stylesheet
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*/
|
|
32
|
+
|
|
1
33
|
.abInfo {
|
|
2
34
|
position: relative;
|
|
3
35
|
display: flex;
|
package/ab-input/index.tsx
CHANGED
|
@@ -45,6 +45,9 @@
|
|
|
45
45
|
border: 1px solid var(--ab-color-outline-variant, rgb(0 0 0 / 0.12)); /* 🖊️ */
|
|
46
46
|
background: var(--ab-color-surface-container, transparent); /* 🎨 */
|
|
47
47
|
max-width: 100%; /* 📏 */
|
|
48
|
+
min-width: 0; /* 🚫 overflow in narrow columns (0.1.13) */
|
|
49
|
+
box-sizing: border-box; /* 📦 the 1px border stays inside 100% */
|
|
50
|
+
grid-template-columns: minmax(0, 1fr); /* 🚫 the nowrap command can't widen the card */
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
/* 🗂️ tabs row */
|
|
@@ -53,21 +56,31 @@
|
|
|
53
56
|
gap: 0.25rem; /* 🧱 */
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
/* 🔘 tab
|
|
59
|
+
/* 🔘 tab
|
|
60
|
+
* ♿ 0.1.12: every state is an explicit text/background pair from the live
|
|
61
|
+
* Material palette, so it is ≥ 4.5:1 in light AND dark (tested in
|
|
62
|
+
* __tests__/ab-install-snippet-contrast.test.ts). Fallbacks are the light
|
|
63
|
+
* bronze palette, for apps that don't load the theme 🎨 */
|
|
57
64
|
.tab {
|
|
58
65
|
min-height: 28px; /* 📏 ≥ 24px target */
|
|
59
66
|
padding: 0.25rem 0.625rem; /* 🧱 */
|
|
60
67
|
border: 0; /* 🧹 */
|
|
61
68
|
border-radius: 9999px; /* 💊 */
|
|
62
|
-
background:
|
|
63
|
-
color: var(--ab-color-on-surface-variant,
|
|
69
|
+
background: var(--ab-color-surface-container, var(--md-sys-color-surface-container, rgb(252 235 226))); /* 🫥 inactive = card surface */
|
|
70
|
+
color: var(--ab-color-on-surface-variant, var(--md-sys-color-on-surface-variant, rgb(80 69 58))); /* 🎨 inactive label */
|
|
64
71
|
font: inherit; /* 🔤 */
|
|
65
72
|
font-size: 0.8125rem; /* 🔡 */
|
|
66
73
|
cursor: pointer; /* 👆 */
|
|
67
74
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
background: color-mix(in srgb, var(--ab-color-
|
|
75
|
+
/* 🖱️ hover (inactive): 8% on-surface state layer + full on-surface label */
|
|
76
|
+
.tab:hover {
|
|
77
|
+
background: color-mix(in srgb, var(--ab-color-on-surface, var(--md-sys-color-on-surface, rgb(34 26 21))) 8%, var(--ab-color-surface-container, var(--md-sys-color-surface-container, rgb(252 235 226))));
|
|
78
|
+
color: var(--ab-color-on-surface, var(--md-sys-color-on-surface, rgb(34 26 21)));
|
|
79
|
+
}
|
|
80
|
+
/* ✅ active (and active + hover): solid bronze container + its on-colour */
|
|
81
|
+
.tab[aria-selected='true'], .tab[aria-selected='true']:hover {
|
|
82
|
+
background: var(--md-sys-color-primary-container, rgb(255 220 189)); /* 🥉 */
|
|
83
|
+
color: var(--md-sys-color-on-primary-container, rgb(44 22 0)); /* ♿ */
|
|
71
84
|
font-weight: 600; /* 💪 */
|
|
72
85
|
}
|
|
73
86
|
.tab:focus-visible {
|
|
@@ -81,20 +94,26 @@
|
|
|
81
94
|
align-items: center; /* ↕️ */
|
|
82
95
|
gap: 0.5rem; /* 🧱 */
|
|
83
96
|
min-width: 0; /* 🚫 overflow */
|
|
97
|
+
/* 💻 0.1.13 (Joseph #13): the command sits on the theme 0.3.4 code surface (dark in both themes) */
|
|
98
|
+
padding: 0.375rem 0.375rem 0.375rem 0.75rem; /* 🧱 */
|
|
99
|
+
border-radius: 0.625rem; /* 🔲 */
|
|
100
|
+
background: var(--ab-color-code-surface, rgb(35 28 23)); /* 💻 */
|
|
101
|
+
color: var(--ab-color-on-code-surface, rgb(240 223 215)); /* 🖋️ ≥ 4.5:1 */
|
|
84
102
|
}
|
|
85
103
|
.prompt {
|
|
86
104
|
opacity: 0.5; /* 🌫️ */
|
|
87
|
-
font-family: var(--ab-font-mono, ui-monospace, monospace); /*
|
|
105
|
+
font-family: var(--ab-font-code, var(--ab-font-mono, ui-monospace, monospace)); /* ⌨️ code font (Roboto Mono via theme 0.3.4) */
|
|
88
106
|
}
|
|
89
107
|
.code {
|
|
90
108
|
flex: 1; /* ↔️ */
|
|
91
109
|
overflow-x: auto; /* 📜 long commands scroll */
|
|
92
110
|
white-space: nowrap; /* 🚫 wrap */
|
|
93
|
-
font-family: var(--ab-font-mono, ui-monospace, monospace); /*
|
|
111
|
+
font-family: var(--ab-font-code, var(--ab-font-mono, ui-monospace, monospace)); /* ⌨️ code font (Roboto Mono via theme 0.3.4) */
|
|
94
112
|
font-size: 0.875rem; /* 🔡 */
|
|
95
113
|
}
|
|
96
114
|
.copy {
|
|
97
115
|
flex: none; /* 🚫 squash */
|
|
116
|
+
color: inherit; /* 🖋️ on-code-surface */
|
|
98
117
|
}
|
|
99
118
|
|
|
100
119
|
/* 🙈 visually hidden */
|
|
@@ -102,3 +121,8 @@
|
|
|
102
121
|
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; /* 📏 */
|
|
103
122
|
overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; /* ✂️ */
|
|
104
123
|
}
|
|
124
|
+
|
|
125
|
+
/* 🚫 JS off (0.1.13, gap-review): the command shows the pnpm default; copying needs JS, so hide the button */
|
|
126
|
+
@media (scripting: none) {
|
|
127
|
+
.copy { display: none; } /* 🙈 */
|
|
128
|
+
}
|
package/ab-kbd/index.tsx
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: AbKbd (G44)
|
|
28
|
+
* @file: ab-kbd/index.tsx
|
|
29
|
+
* @type: React Component (server-safe)
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* <AbKbd keys={['⌘', 'K']} />
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
38
|
+
* MOTTO: We'll always do more 😜!!!
|
|
39
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
// ⚛️ React
|
|
43
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
44
|
+
// 🧵 classes
|
|
45
|
+
import clsx from 'clsx';
|
|
46
|
+
// 🎨 styles
|
|
47
|
+
import styles from './styles.module.css';
|
|
48
|
+
|
|
49
|
+
/** ⚙️ props */
|
|
50
|
+
export interface AbKbdProps {
|
|
51
|
+
keys?: string[]; // ⌨️ e.g. ['⌘', 'K'] → one <kbd> per key, nested in an outer <kbd>
|
|
52
|
+
children?: ReactNode; // ✍️ or plain content
|
|
53
|
+
className?: string; // 🏷️
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** ⌨️ AbKbd: a keyboard hint (`<kbd>`), no hooks, so it renders on the server too. */
|
|
57
|
+
const AbKbd = ({ keys, children, className }: AbKbdProps): ReactElement => (
|
|
58
|
+
<kbd className={clsx('AbKbd', styles.abKbd, className)} data-ab-part="kbd">
|
|
59
|
+
{keys ? keys.map((k, i) => <kbd key={`${k}-${i}`} className={styles.abKbdKey}>{k}</kbd>) : children}
|
|
60
|
+
</kbd>
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
// 📦 exports
|
|
64
|
+
export default AbKbd;
|
|
65
|
+
export { AbKbd };
|
|
@@ -0,0 +1,55 @@
|
|
|
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: AbKbd - Styles (G44)
|
|
28
|
+
* @file: ab-kbd/styles.module.css
|
|
29
|
+
* @type: CSS Module
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/*
|
|
34
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
35
|
+
* MOTTO: We'll always do more 😜!!!
|
|
36
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/* ⌨️ outer hint */
|
|
40
|
+
.abKbd {
|
|
41
|
+
display: inline-flex; /* 📐 */
|
|
42
|
+
gap: 2px; /* ↔️ */
|
|
43
|
+
font: 500 12px/1 var(--ab-font-code, var(--ab-font-mono, ui-monospace, monospace)); /* 🔤 theme 0.3.4 code font */
|
|
44
|
+
color: var(--ab-color-on-surface-variant, inherit); /* 🖋️ */
|
|
45
|
+
}
|
|
46
|
+
/* 🔑 one key */
|
|
47
|
+
.abKbdKey {
|
|
48
|
+
min-width: 20px; /* 📏 */
|
|
49
|
+
padding: 3px 5px; /* 📦 */
|
|
50
|
+
border: 1px solid var(--ab-color-outline-variant, rgb(0 0 0 / 0.15)); /* 🖼️ */
|
|
51
|
+
border-radius: 6px; /* 🟢 */
|
|
52
|
+
box-sizing: border-box; /* 📦 */
|
|
53
|
+
text-align: center; /* ↔️ */
|
|
54
|
+
font: inherit; /* 🔤 */
|
|
55
|
+
}
|
package/ab-key-feature/index.tsx
CHANGED
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
* @project: ab-nextjs-components
|
|
9
9
|
* @name: AbKeyFeature - Client (port of lyd-key-feature)
|
|
10
10
|
* @file: ab-key-feature/index.tsx
|
|
11
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
11
12
|
*/
|
|
12
13
|
|
|
13
14
|
'use client';
|
|
14
15
|
|
|
15
16
|
import type { ReactElement } from 'react';
|
|
16
|
-
import Link from 'next/link
|
|
17
|
+
import Link from '../ab-link'; // 🔗 G42: injectable via AbLinkProvider (default next/link)
|
|
17
18
|
import clsx from 'clsx';
|
|
18
19
|
import styles from './styles.module.css';
|
|
19
20
|
|
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @license MIT
|
|
3
|
+
* ~~~~~~~~~~~~
|
|
4
|
+
* ab-nextjs-components
|
|
5
|
+
* ~~~~~~~~~~~~
|
|
6
|
+
* Copyright (c) 2026 Abraham Ukachi. The abElements Project.
|
|
7
|
+
*
|
|
8
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
|
+
* of this software and associated documentation files (the 'Software'), to deal
|
|
10
|
+
* in the Software without restriction, including without limitation the rights
|
|
11
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
12
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
13
|
+
* furnished to do so, subject to the following conditions:
|
|
14
|
+
*
|
|
15
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
16
|
+
* copies or substantial portions of the Software.
|
|
17
|
+
*
|
|
18
|
+
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
19
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
20
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
21
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
22
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
23
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
24
|
+
* SOFTWARE.
|
|
25
|
+
*
|
|
26
|
+
* @project: ab-nextjs-components
|
|
27
|
+
* @name: styles.module.css
|
|
28
|
+
* @file: ab-key-feature/styles.module.css
|
|
29
|
+
* @type: CSS Stylesheet
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*/
|
|
32
|
+
|
|
1
33
|
.abKeyFeature {
|
|
2
34
|
display: flex;
|
|
3
35
|
flex-direction: column;
|
package/ab-like-button/index.tsx
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
'use client';
|
|
41
41
|
|
|
42
42
|
import type { CSSProperties, MouseEvent, ReactElement } from 'react';
|
|
43
|
-
import Link from 'next/link
|
|
43
|
+
import Link from '../ab-link'; // 🔗 G42: injectable via AbLinkProvider (default next/link)
|
|
44
44
|
import clsx from 'clsx';
|
|
45
45
|
import styles from './styles.module.css';
|
|
46
46
|
import { AB_MOTION } from 'ab-nextjs-animations/motion'; // 🎬 transition class names (ab-nextjs-animations >= 0.2.4)
|