ab-nextjs-components 0.1.12 โ 0.1.14
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 +64 -0
- package/README.md +52 -0
- package/ab-app-bar/index.tsx +210 -0
- package/ab-app-bar/styles.module.css +158 -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-bottom-drawer/index.tsx +71 -0
- package/ab-bottom-drawer/styles.module.css +66 -0
- package/ab-brand/index.tsx +1 -1
- package/ab-breadcrumbs/index.tsx +92 -0
- package/ab-breadcrumbs/styles.module.css +54 -0
- package/ab-button/helpers.ts +6 -1
- package/ab-button/index.tsx +23 -4
- package/ab-button/styles.module.css +70 -0
- package/ab-card/index.tsx +89 -0
- package/ab-card/styles.module.css +68 -0
- package/ab-carousel/styles.module.css +1 -1
- package/ab-chip/index.tsx +16 -4
- package/ab-chip/styles.module.css +12 -1
- package/ab-collapsible/index.tsx +1 -1
- package/ab-color/index.tsx +1 -0
- package/ab-color/styles.module.css +32 -0
- package/ab-confirm-drawer/index.tsx +97 -0
- package/ab-confirm-drawer/styles.module.css +41 -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-drawer/index.tsx +307 -0
- package/ab-drawer/styles.module.css +127 -0
- package/ab-drawer/use-ab-drawer.ts +89 -0
- package/ab-drawer-list/index.tsx +118 -0
- package/ab-drawer-list/styles.module.css +65 -0
- package/ab-flow-diagram/styles.module.css +2 -2
- package/ab-icon/builtin.ts +19 -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 +19 -3
- package/ab-icon-button/styles.module.css +1 -1
- 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/index.tsx +51 -29
- package/ab-install-snippet/styles.module.css +50 -4
- 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-list/index.tsx +107 -0
- package/ab-list/styles.module.css +82 -0
- package/ab-locale-switcher/index.tsx +59 -10
- package/ab-locale-switcher/styles.module.css +15 -4
- 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 +102 -28
- package/ab-navbar/view.tsx +166 -0
- package/ab-package-card/index.tsx +141 -0
- package/ab-package-card/styles.module.css +81 -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 +157 -0
- package/ab-search-trigger/styles.module.css +96 -0
- package/ab-sidebar/index.tsx +91 -49
- package/ab-sidebar/styles.module.css +179 -31
- package/ab-sidebar/view.tsx +192 -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-theme-toggle/index.tsx +21 -6
- package/ab-theme-toggle/styles.module.css +18 -3
- package/ab-toc/index.tsx +131 -0
- package/ab-toc/styles.module.css +66 -0
- package/ab-version-switcher/index.tsx +143 -0
- package/ab-version-switcher/styles.module.css +76 -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 +45 -0
- package/package.json +42 -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 +6 -2
- package/server/ab-button/styles.module.css +39 -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 +54 -0
- package/server/ab-navbar/styles.module.css +0 -35
- package/server/ab-sidebar/styles.module.css +0 -41
|
@@ -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: AbDrawerList styles
|
|
28
|
+
* @file: ab-drawer-list/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
|
+
|
|
40
|
+
.abDrawerList { list-style: none; margin: 0 -12px; padding: 0; display: grid; gap: 2px; } /* ๐ */
|
|
41
|
+
.abDrawerListItem {
|
|
42
|
+
display: flex; /* ๐ icon ยท text ยท check */
|
|
43
|
+
align-items: center; /* โ๏ธ */
|
|
44
|
+
gap: 12px; /* โ๏ธ */
|
|
45
|
+
inline-size: 100%; /* โ๏ธ */
|
|
46
|
+
min-block-size: 48px; /* ๐ touch target */
|
|
47
|
+
padding: 8px 12px; /* ๐ฆ */
|
|
48
|
+
border: 0; /* ๐งน */
|
|
49
|
+
border-radius: 8px; /* ๐ฒ = the Home nav rows */
|
|
50
|
+
background: transparent; /* ๐จ */
|
|
51
|
+
color: inherit; /* ๐๏ธ */
|
|
52
|
+
font: inherit; /* ๐ค */
|
|
53
|
+
text-align: start; /* โฌ
๏ธ */
|
|
54
|
+
text-decoration: none; /* ๐ซ */
|
|
55
|
+
cursor: pointer; /* ๐ฑ๏ธ */
|
|
56
|
+
box-sizing: border-box; /* ๐ฆ */
|
|
57
|
+
}
|
|
58
|
+
.abDrawerListItem:hover { background: var(--ab-color-hover, rgb(166 124 82 / 0.08)); } /* ๐ฑ๏ธ --hover */
|
|
59
|
+
.abDrawerListItem[data-active='true'] { background: var(--ab-color-tint, #f4e7db); color: var(--ab-color-accent-text, #8b6340); font-weight: 650; } /* ๐ฏ = the Home active nav (--tint, --accent-t, 650) */
|
|
60
|
+
.abDrawerListItem:focus-visible { outline: 2px solid var(--ab-color-accent, #a67c52); outline-offset: -2px; } /* โฟ --accent */
|
|
61
|
+
.abDrawerListItem:disabled { opacity: 0.5; cursor: not-allowed; } /* ๐ซ */
|
|
62
|
+
.abDrawerListIcon { flex: none; display: inline-flex; } /* ๐ฃ */
|
|
63
|
+
.abDrawerListText { flex: 1 1 auto; min-width: 0; display: grid; } /* ๐ท๏ธ */
|
|
64
|
+
.abDrawerListDescription { font-size: 0.875rem; opacity: 0.75; } /* ๐ */
|
|
65
|
+
.abDrawerListCheck { flex: none; inline-size: 1.25em; text-align: center; } /* โ */
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
width: 100%; /* โ๏ธ */
|
|
44
44
|
aspect-ratio: 760 / 600; /* ๐ mock card */
|
|
45
45
|
border-radius: 1.25rem; /* ๐ฒ */
|
|
46
|
-
border: 1px solid var(--ab-color-outline-variant, rgb(0 0 0 / 0.12)); /* ๐๏ธ */
|
|
46
|
+
border: 1px solid var(--ab-color-border, var(--ab-color-outline-variant, rgb(0 0 0 / 0.12))); /* ๐๏ธ */
|
|
47
47
|
background: var(--ab-color-surface-container, transparent); /* ๐จ */
|
|
48
48
|
overflow: hidden; /* โ๏ธ */
|
|
49
49
|
color: var(--ab-color-on-surface, currentColor); /* ๐จ */
|
|
@@ -127,7 +127,7 @@
|
|
|
127
127
|
/* ๐ scales with the card (cqi = 1% of its width): 760px card โ 13px text, 390px โ 11px; clamped both ways */
|
|
128
128
|
padding: clamp(0.25rem, 0.8cqi, 0.375rem) clamp(0.4375rem, 1.4cqi, 0.625rem); /* ๐งฑ */
|
|
129
129
|
border-radius: clamp(0.5rem, 1.4cqi, 0.625rem); /* ๐ฒ */
|
|
130
|
-
border: 1px solid var(--ab-color-outline-variant, rgb(0 0 0 / 0.12)); /* ๐๏ธ */
|
|
130
|
+
border: 1px solid var(--ab-color-border, var(--ab-color-outline-variant, rgb(0 0 0 / 0.12))); /* ๐๏ธ */
|
|
131
131
|
background: var(--ab-color-surface, #fff); /* ๐จ */
|
|
132
132
|
font-size: clamp(0.6875rem, 1.75cqi, 0.8125rem); /* ๐ก */
|
|
133
133
|
white-space: nowrap; /* ๐ซ wrap */
|
package/ab-icon/builtin.ts
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
|
-
// ๐ฃ one module per icon (ab-nextjs-icons โฅ 0.2.3): bundlers keep only these
|
|
39
|
+
// ๐ฃ one module per icon (ab-nextjs-icons โฅ 0.2.3): bundlers keep only these 15
|
|
40
40
|
import arrowBack from 'ab-nextjs-icons/ab-icons/icons/arrow_back'; // โฎ๏ธ AbCarouselPrev
|
|
41
41
|
import arrowForward from 'ab-nextjs-icons/ab-icons/icons/arrow_forward'; // โญ๏ธ AbCarouselNext
|
|
42
42
|
import lightMode from 'ab-nextjs-icons/ab-icons/icons/light_mode'; // ๐ AbThemeToggle
|
|
@@ -45,6 +45,15 @@ import computer from 'ab-nextjs-icons/ab-icons/icons/computer'; // ๐ฅ๏ธ AbThe
|
|
|
45
45
|
import language from 'ab-nextjs-icons/ab-icons/icons/language'; // ๐ AbLocaleSwitcher
|
|
46
46
|
import contentCopy from 'ab-nextjs-icons/ab-icons/icons/content_copy'; // ๐ AbInstallSnippet
|
|
47
47
|
import check from 'ab-nextjs-icons/ab-icons/icons/check'; // โ
AbInstallSnippet (copied)
|
|
48
|
+
import chevronLeft from 'ab-nextjs-icons/ab-icons/icons/chevron_left'; // โ๏ธ AbSidebar collapse (0.1.13)
|
|
49
|
+
import chevronRight from 'ab-nextjs-icons/ab-icons/icons/chevron_right'; // โถ๏ธ AbSidebar expand (0.1.13)
|
|
50
|
+
import menu from 'ab-nextjs-icons/ab-icons/icons/menu'; // โฐ AbAppBar (0.1.13)
|
|
51
|
+
import moreVert from 'ab-nextjs-icons/ab-icons/icons/more_vert'; // โฎ AbAppBar "More" (0.1.13)
|
|
52
|
+
import search from 'ab-nextjs-icons/ab-icons/icons/search'; // ๐ AbSearchTrigger (0.1.13)
|
|
53
|
+
import close from 'ab-nextjs-icons/ab-icons/icons/close'; // โ๏ธ AbPage aside close (0.1.13)
|
|
54
|
+
import expandMore from 'ab-nextjs-icons/ab-icons/icons/expand_more'; // ๐ฝ AbLocaleSwitcher no-JS list (0.1.13)
|
|
55
|
+
import doubleLeft from 'ab-nextjs-icons/ab-icons/icons/keyboard_double_arrow_left'; // โช AbSidebar outlined collapse (0.1.14, P9)
|
|
56
|
+
import doubleRight from 'ab-nextjs-icons/ab-icons/icons/keyboard_double_arrow_right'; // โฉ AbSidebar outlined expand (0.1.14, P9)
|
|
48
57
|
// ๐งพ shape
|
|
49
58
|
import type { AbIconSvgData } from './helpers';
|
|
50
59
|
|
|
@@ -58,4 +67,13 @@ export const AB_ICON_BUILTINS: Record<string, AbIconSvgData> = {
|
|
|
58
67
|
language, // ๐
|
|
59
68
|
content_copy: contentCopy, // ๐
|
|
60
69
|
check, // โ
|
|
70
|
+
chevron_left: chevronLeft, // โ๏ธ
|
|
71
|
+
chevron_right: chevronRight, // โถ๏ธ
|
|
72
|
+
menu, // โฐ
|
|
73
|
+
more_vert: moreVert, // โฎ
|
|
74
|
+
search, // ๐
|
|
75
|
+
close, // โ๏ธ
|
|
76
|
+
expand_more: expandMore, // ๐ฝ
|
|
77
|
+
keyboard_double_arrow_left: doubleLeft, // โช
|
|
78
|
+
keyboard_double_arrow_right: doubleRight, // โฉ
|
|
61
79
|
};
|
package/ab-icon/helpers.ts
CHANGED
|
@@ -100,3 +100,40 @@ export function toAbIconSize(size: number | string | undefined): string {
|
|
|
100
100
|
if (size == null) return '24px'; // ๐งญ default 24
|
|
101
101
|
return typeof size === 'number' ? `${size}px` : size; // ๐
|
|
102
102
|
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
// ๐ names we already warned about (one warning per name per page load)
|
|
106
|
+
const warned = new Set<string>()
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* โ ๏ธ 0.1.13 (G2): warns once in development when a name isn't an AbIcon (registered, explicit `svg`, or in
|
|
110
|
+
* the map). It falls back to the Material Symbols ligature, which shows the NAME as text once the font is gone.
|
|
111
|
+
* Register it with `registerAbIcons({ name: icon })` from `ab-nextjs-icons/ab-icons/icons/<name>`.
|
|
112
|
+
*/
|
|
113
|
+
export function warnAbIconMissing(name: string): void {
|
|
114
|
+
if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') return // ๐คซ silent in prod
|
|
115
|
+
if (warned.has(name)) return // ๐ once
|
|
116
|
+
warned.add(name) // ๐
|
|
117
|
+
console.warn(`[AbIcon] "${name}" is not a registered AbIcon. Register it: registerAbIcons({ ${name} }) from 'ab-nextjs-icons/ab-icons/icons/${name}'. (Falling back to the Material Symbols font ligature.)`) // โ ๏ธ
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* ๐ 0.1.13 (Joseph): scopeAbIconIds โ suffix every `id` in the markup, plus the `url(#โฆ)` / `href="#โฆ"`
|
|
122
|
+
* refs that point at it, so two filled Homes on one page (bottom bar + sidebar) never share a mask.
|
|
123
|
+
* Same rules as ab-nextjs-icons 0.2.4 `scopeAbIconSvgIds` (copied: importing it is fine, but the client
|
|
124
|
+
* bundle rule above says no icon-package imports here). `AbIcon` calls it with React `useId()`.
|
|
125
|
+
*/
|
|
126
|
+
export function scopeAbIconIds(markup: string, scope: string): string {
|
|
127
|
+
const ids = Array.from(markup.matchAll(/\sid="([^"]+)"/g), (m) => m[1]); // ๐ declared ids
|
|
128
|
+
if (ids.length === 0) return markup; // ๐
most outlined icons
|
|
129
|
+
const suffix = `-${scope.replace(/[^A-Za-z0-9_-]/g, '') || 'x'}`; // ๐งผ `:r1:` / `ยซr1ยป` โ `-r1`
|
|
130
|
+
let out = markup;
|
|
131
|
+
for (const id of new Set(ids)) {
|
|
132
|
+
const esc = id.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // ๐ก๏ธ regex-escape
|
|
133
|
+
out = out
|
|
134
|
+
.replace(new RegExp(`(\\sid=")${esc}(")`, 'g'), `$1${id}${suffix}$2`) // ๐
|
|
135
|
+
.replace(new RegExp(`url\\(#${esc}\\)`, 'g'), `url(#${id}${suffix})`) // ๐ญ
|
|
136
|
+
.replace(new RegExp(`(href=")#${esc}(")`, 'g'), `$1#${id}${suffix}$2`); // ๐
|
|
137
|
+
}
|
|
138
|
+
return out; // โ
|
|
139
|
+
}
|
package/ab-icon/index.tsx
CHANGED
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
'use client';
|
|
44
44
|
|
|
45
45
|
// โ๏ธ types
|
|
46
|
-
import type
|
|
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
|
|
@@ -86,6 +90,12 @@ export interface AbIconButtonProps {
|
|
|
86
90
|
title?: string;
|
|
87
91
|
// ๐งพ button type
|
|
88
92
|
type?: 'button' | 'submit' | 'reset';
|
|
93
|
+
// โฟ 0.1.14: disclosure state for menus / drawers / the TOC toggle (button variant)
|
|
94
|
+
'aria-expanded'?: boolean;
|
|
95
|
+
// โฟ 0.1.14: id of the element this button opens
|
|
96
|
+
'aria-controls'?: string;
|
|
97
|
+
// ๐ 0.1.14: glyph size in px (default: AbIcon's 24), e.g. 16 for the terminal copy button
|
|
98
|
+
iconSize?: number;
|
|
89
99
|
}
|
|
90
100
|
|
|
91
101
|
const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function AbIconButton(props, ref) {
|
|
@@ -107,6 +117,10 @@ const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function A
|
|
|
107
117
|
label, // โฟ
|
|
108
118
|
title, // ๐ฌ
|
|
109
119
|
type = 'button', // ๐งพ
|
|
120
|
+
iconFilled, // โฌ
|
|
121
|
+
'aria-expanded': ariaExpanded, // โฟ 0.1.14
|
|
122
|
+
'aria-controls': ariaControls, // โฟ 0.1.14
|
|
123
|
+
iconSize, // ๐ 0.1.14
|
|
110
124
|
} = props;
|
|
111
125
|
|
|
112
126
|
// โฟ G6: one accessible name for both variants, ON the interactive element (not the wrapper span)
|
|
@@ -115,8 +129,8 @@ const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function A
|
|
|
115
129
|
const tooltip = title ?? label;
|
|
116
130
|
// ๐ท๏ธ classes
|
|
117
131
|
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 = <
|
|
132
|
+
// ๐ฃ the glyph is decoration (the button carries the name): AbIcon without a label is aria-hidden
|
|
133
|
+
const glyph = <AbIcon name={icon} variant={(iconFilled ?? active) ? 'filled' : 'outlined'} className="icon" size={iconSize} />;
|
|
120
134
|
|
|
121
135
|
// ๐ link variant
|
|
122
136
|
if (href && !isLoading) {
|
|
@@ -153,6 +167,8 @@ const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function A
|
|
|
153
167
|
aria-label={name} // โฟ accessible name
|
|
154
168
|
title={tooltip} // ๐ฌ tooltip on the button itself
|
|
155
169
|
aria-busy={isLoading || undefined} // โณ announce loading
|
|
170
|
+
aria-expanded={ariaExpanded} // โฟ open / closed (omitted when undefined)
|
|
171
|
+
aria-controls={ariaControls} // โฟ what it opens
|
|
156
172
|
data-active={String(active)} // โ
|
|
157
173
|
data-naked={String(naked)} // ๐ซฅ
|
|
158
174
|
data-expands={String(expands)} // ๐
|
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
|
@@ -76,6 +76,7 @@ export interface AbInstallSnippetProps {
|
|
|
76
76
|
dev?: boolean; // ๐ ๏ธ dev dependency flag
|
|
77
77
|
className?: string; // ๐ท๏ธ
|
|
78
78
|
style?: CSSProperties; // ๐จ
|
|
79
|
+
variant?: 'card' | 'terminal'; // ๐ป 0.1.14 (P12): 'terminal' = the Home dark block (underline tabs, copy in the tab row, no clipping). Default 'card'
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
// ๐ง state source: persisted (shared across instances) or local
|
|
@@ -96,7 +97,7 @@ function LocalSnippet(props: AbInstallSnippetProps) {
|
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
/** ๐ผ๏ธ the actual UI */
|
|
99
|
-
function SnippetView({ pkg, labels, managers = AB_PACKAGE_MANAGERS, dev = false, className, style, state }: AbInstallSnippetProps & { state: PmState }) {
|
|
100
|
+
function SnippetView({ pkg, labels, managers = AB_PACKAGE_MANAGERS, dev = false, className, style, state, variant = 'card' }: AbInstallSnippetProps & { state: PmState }) {
|
|
100
101
|
const [pm, setPm] = state; // ๐๏ธ
|
|
101
102
|
const current = managers.includes(pm) ? pm : managers[0]; // ๐งฏ stored pm not offered here
|
|
102
103
|
const command = getAbInstallCommand(current, pkg, dev); // ๐งพ
|
|
@@ -122,38 +123,59 @@ function SnippetView({ pkg, labels, managers = AB_PACKAGE_MANAGERS, dev = false,
|
|
|
122
123
|
tabs.current[j]?.focus(); // ๐ฏ
|
|
123
124
|
};
|
|
124
125
|
|
|
126
|
+
const terminal = variant === 'terminal'; // ๐ป P12
|
|
127
|
+
// ๐ the copy button (card: in the command row ยท terminal: at the end of the tab row, always visible)
|
|
128
|
+
const copyButton = (
|
|
129
|
+
<AbIconButton
|
|
130
|
+
icon={copied ? 'check' : 'content_copy'} // ๐ / โ
|
|
131
|
+
label={labels.copy} // โฟ name stays "Copy command"
|
|
132
|
+
naked // ๐ซฅ
|
|
133
|
+
iconSize={terminal ? 16 : undefined} // ๐ P12: 16px in the terminal tab row
|
|
134
|
+
className={styles.copy} // ๐จ
|
|
135
|
+
onClick={() => { void copy(command); }} // ๐
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
138
|
+
// ๐๏ธ terminal: "$ pnpm add <pkg>" with the package highlighted (the text stays one copyable string)
|
|
139
|
+
const at = command.lastIndexOf(pkg); // ๐
|
|
140
|
+
const highlighted = at >= 0 ? <>{command.slice(0, at)}<span className={styles.termPkg}>{pkg}</span>{command.slice(at + pkg.length)}</> : command;
|
|
141
|
+
|
|
142
|
+
// ๐๏ธ manager tabs
|
|
143
|
+
const tablist = (
|
|
144
|
+
<div role="tablist" aria-label={labels.group} className={styles.tabs} onKeyDown={onKeyDown}>
|
|
145
|
+
{managers.map((m, i) => (
|
|
146
|
+
<button
|
|
147
|
+
key={m} // ๐
|
|
148
|
+
ref={(el) => { tabs.current[i] = el; }} // ๐
|
|
149
|
+
id={`${base}-tab-${m}`} // ๐
|
|
150
|
+
type="button" // ๐งพ
|
|
151
|
+
role="tab" // โฟ
|
|
152
|
+
aria-selected={m === current} // โ
|
|
153
|
+
aria-controls={`${base}-panel`} // ๐
|
|
154
|
+
tabIndex={m === current ? 0 : -1} // โจ๏ธ roving
|
|
155
|
+
className={styles.tab} // ๐จ
|
|
156
|
+
onClick={() => setPm(m)} // ๐ฑ๏ธ
|
|
157
|
+
>
|
|
158
|
+
{m}
|
|
159
|
+
</button>
|
|
160
|
+
))}
|
|
161
|
+
</div>
|
|
162
|
+
);
|
|
163
|
+
|
|
125
164
|
return (
|
|
126
|
-
<div className={clsx('AbInstallSnippet', styles.root, className)} style={style} data-ab-part="install-snippet" data-ab-swipe-ignore="">
|
|
127
|
-
{/* ๐๏ธ manager tabs */}
|
|
128
|
-
|
|
129
|
-
{
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
role="tab" // โฟ
|
|
136
|
-
aria-selected={m === current} // โ
|
|
137
|
-
aria-controls={`${base}-panel`} // ๐
|
|
138
|
-
tabIndex={m === current ? 0 : -1} // โจ๏ธ roving
|
|
139
|
-
className={styles.tab} // ๐จ
|
|
140
|
-
onClick={() => setPm(m)} // ๐ฑ๏ธ
|
|
141
|
-
>
|
|
142
|
-
{m}
|
|
143
|
-
</button>
|
|
144
|
-
))}
|
|
145
|
-
</div>
|
|
165
|
+
<div className={clsx('AbInstallSnippet', styles.root, terminal && styles.terminal, className)} style={style} data-ab-part="install-snippet" data-variant={terminal ? 'terminal' : undefined} data-ab-swipe-ignore="">
|
|
166
|
+
{/* ๐๏ธ manager tabs (๐ป terminal: tabs + copy share one row; the copy button stays OUTSIDE the tablist) */}
|
|
167
|
+
{terminal ? (
|
|
168
|
+
<div className={styles.termHead}>
|
|
169
|
+
{tablist}
|
|
170
|
+
<span className={styles.termGrow} aria-hidden="true" />
|
|
171
|
+
{copyButton}
|
|
172
|
+
</div>
|
|
173
|
+
) : tablist}
|
|
146
174
|
{/* ๐งพ command panel */}
|
|
147
175
|
<div id={`${base}-panel`} role="tabpanel" aria-labelledby={`${base}-tab-${current}`} className={styles.panel}>
|
|
148
176
|
<span className={styles.prompt} aria-hidden="true">$</span>{/* ๐ฒ decorative prompt */}
|
|
149
|
-
<code className={styles.code}>{command}</code>
|
|
150
|
-
|
|
151
|
-
icon={copied ? 'check' : 'content_copy'} // ๐ / โ
|
|
152
|
-
label={labels.copy} // โฟ name stays "Copy command"
|
|
153
|
-
naked // ๐ซฅ
|
|
154
|
-
className={styles.copy} // ๐จ
|
|
155
|
-
onClick={() => { void copy(command); }} // ๐
|
|
156
|
-
/>
|
|
177
|
+
<code className={styles.code}>{terminal ? highlighted : command}</code>
|
|
178
|
+
{!terminal && copyButton}
|
|
157
179
|
</div>
|
|
158
180
|
{/* ๐ฃ own polite live region */}
|
|
159
181
|
<span className={styles.srOnly} aria-live="polite" role="status">{copied ? labels.copied : ''}</span>
|