ab-nextjs-components 0.1.13 โ 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 +35 -0
- package/README.md +30 -0
- package/ab-app-bar/index.tsx +39 -10
- package/ab-app-bar/styles.module.css +43 -4
- package/ab-bottom-drawer/index.tsx +71 -0
- package/ab-bottom-drawer/styles.module.css +66 -0
- 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 +8 -2
- package/ab-button/styles.module.css +39 -0
- package/ab-card/styles.module.css +1 -1
- 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-confirm-drawer/index.tsx +97 -0
- package/ab-confirm-drawer/styles.module.css +41 -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 +4 -0
- package/ab-icon-button/index.tsx +12 -1
- package/ab-icon-button/styles.module.css +1 -1
- package/ab-install-snippet/index.tsx +51 -29
- package/ab-install-snippet/styles.module.css +34 -2
- package/ab-kbd/styles.module.css +1 -1
- package/ab-list/index.tsx +107 -0
- package/ab-list/styles.module.css +82 -0
- package/ab-locale-switcher/index.tsx +42 -10
- package/ab-locale-switcher/styles.module.css +4 -4
- package/ab-navbar/styles.module.css +20 -2
- package/ab-navbar/view.tsx +7 -4
- package/ab-package-card/index.tsx +49 -2
- package/ab-package-card/styles.module.css +40 -0
- package/ab-search-trigger/index.tsx +17 -2
- package/ab-search-trigger/styles.module.css +27 -1
- package/ab-sidebar/index.tsx +5 -2
- package/ab-sidebar/styles.module.css +48 -5
- package/ab-sidebar/view.tsx +14 -4
- package/ab-theme-toggle/index.tsx +21 -6
- package/ab-theme-toggle/styles.module.css +18 -3
- package/ab-toc/index.tsx +9 -2
- package/ab-toc/styles.module.css +20 -8
- package/ab-version-switcher/index.tsx +143 -0
- package/ab-version-switcher/styles.module.css +76 -0
- package/index.ts +27 -0
- package/package.json +18 -3
- package/server/ab-button/index.tsx +6 -2
- package/server/ab-button/styles.module.css +39 -0
- package/types/index.d.ts +19 -0
|
@@ -0,0 +1,127 @@
|
|
|
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: AbDrawer styles (G53)
|
|
28
|
+
* @file: ab-drawer/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
|
+
/* ๐ the anchor is layout-neutral: the drawer itself lives in the scope's layer */
|
|
41
|
+
.abDrawerAnchor { display: contents; }
|
|
42
|
+
|
|
43
|
+
/* ๐งฑ the layer: absolute `inset: 0` INSIDE the scope box (app / main / aside), so a drawer is clipped
|
|
44
|
+
by its scope and never makes the document scroll (D34). Clicks pass through when no drawer is open. */
|
|
45
|
+
.abDrawerLayer {
|
|
46
|
+
position: absolute; /* ๐ inside the scope box */
|
|
47
|
+
inset: 0; /* ๐ the whole scope */
|
|
48
|
+
z-index: 60; /* โฌ๏ธ above the panes and the aside sheet (30) */
|
|
49
|
+
overflow: hidden; /* โ๏ธ a sliding panel never leaks out */
|
|
50
|
+
pointer-events: none; /* ๐ฑ๏ธ idle layer = transparent to clicks */
|
|
51
|
+
contain: layout paint; /* ๐ */
|
|
52
|
+
}
|
|
53
|
+
.abDrawerLayer[data-host='body'] { position: fixed; } /* ๐ no AbAppLayout: cover the viewport */
|
|
54
|
+
|
|
55
|
+
.abDrawerFrame { position: absolute; inset: 0; pointer-events: auto; } /* ๐ฑ๏ธ a drawer is up */
|
|
56
|
+
|
|
57
|
+
/* ๐ซ๏ธ scrim */
|
|
58
|
+
.abDrawerScrim {
|
|
59
|
+
position: absolute; /* ๐ */
|
|
60
|
+
inset: 0; /* ๐ */
|
|
61
|
+
background: var(--ab-scrim-color, rgb(25 18 12 / 0.4)); /* ๐ซ๏ธ theme 0.3.5: 40% light / 60% dark (John) */
|
|
62
|
+
opacity: 0; /* ๐ซฅ */
|
|
63
|
+
--ab-motion-duration: var(--ab-drawer-duration, 240ms); /* ๐๏ธ fade = .ab-motion-colors (ab-nextjs-animations) */
|
|
64
|
+
}
|
|
65
|
+
.abDrawerFrame[data-state='open'] > .abDrawerScrim { opacity: 1; } /* ๐ซ๏ธ */
|
|
66
|
+
|
|
67
|
+
/* ๐๏ธ the panel */
|
|
68
|
+
.abDrawer {
|
|
69
|
+
--ab-drawer-shift: 100%; /* ๐ how far it starts off-screen */
|
|
70
|
+
position: absolute; /* ๐ */
|
|
71
|
+
display: flex; /* ๐ header ยท body ยท footer */
|
|
72
|
+
flex-direction: column; /* โ๏ธ */
|
|
73
|
+
box-sizing: border-box; /* ๐ฆ */
|
|
74
|
+
margin: 0; /* ๐งน */
|
|
75
|
+
min-width: 0; /* ๐ซ overflow */
|
|
76
|
+
min-height: 0; /* ๐ซ overflow */
|
|
77
|
+
background: var(--ab-color-surface-container-low, var(--surface-color, Canvas)); /* ๐จ */
|
|
78
|
+
color: var(--ab-color-on-surface, var(--on-surface-color, CanvasText)); /* ๐๏ธ */
|
|
79
|
+
box-shadow: 0 8px 32px rgb(0 0 0 / 0.24); /* ๐ */
|
|
80
|
+
outline: none; /* ๐ฏ the panel itself is only a fallback focus target */
|
|
81
|
+
overscroll-behavior: contain; /* ๐ซ scroll chaining (G54) */
|
|
82
|
+
--ab-motion-duration: var(--ab-drawer-duration, 240ms); /* ๐๏ธ the panes slide = .ab-motion-transform (ab-nextjs-animations) */
|
|
83
|
+
--ab-motion-easing: cubic-bezier(0.2, 0, 0, 1); /* ๐ */
|
|
84
|
+
}
|
|
85
|
+
.abDrawer[data-side='bottom'] { inset: auto 0 0 0; max-height: min(85%, var(--ab-drawer-size, 480px)); border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); transform: translateY(var(--ab-drawer-shift)); } /* โฌ๏ธ */
|
|
86
|
+
.abDrawer[data-side='top'] { inset: 0 0 auto 0; max-height: min(85%, var(--ab-drawer-size, 480px)); border-radius: 0 0 16px 16px; padding-top: env(safe-area-inset-top, 0px); transform: translateY(calc(-1 * var(--ab-drawer-shift))); } /* โฌ๏ธ */
|
|
87
|
+
.abDrawer[data-side='left'] { inset: 0 auto 0 0; width: min(85%, var(--ab-drawer-size, 360px)); transform: translateX(calc(-1 * var(--ab-drawer-shift))); } /* โก๏ธ */
|
|
88
|
+
.abDrawer[data-side='right'] { inset: 0 0 0 auto; width: min(85%, var(--ab-drawer-size, 360px)); transform: translateX(var(--ab-drawer-shift)); } /* โฌ
๏ธ */
|
|
89
|
+
/* ๐ logical sides follow the writing direction */
|
|
90
|
+
.abDrawer[data-side='start'] { inset-block: 0; inset-inline-start: 0; width: min(85%, var(--ab-drawer-size, 360px)); transform: translateX(calc(-1 * var(--ab-drawer-shift))); }
|
|
91
|
+
.abDrawer[data-side='end'] { inset-block: 0; inset-inline-end: 0; width: min(85%, var(--ab-drawer-size, 360px)); transform: translateX(var(--ab-drawer-shift)); }
|
|
92
|
+
.abDrawer[data-side='start']:dir(rtl) { transform: translateX(var(--ab-drawer-shift)); } /* ๐ RTL */
|
|
93
|
+
.abDrawer[data-side='end']:dir(rtl) { transform: translateX(calc(-1 * var(--ab-drawer-shift))); } /* ๐ RTL */
|
|
94
|
+
.abDrawerFrame[data-state='open'] > .abDrawer { transform: none; } /* ๐ฌ slid in */
|
|
95
|
+
|
|
96
|
+
.abDrawerHeader { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 8px 4px 20px; } /* ๐ */
|
|
97
|
+
.abDrawerTitle { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1.125rem; font-weight: 600; } /* ๐ท๏ธ */
|
|
98
|
+
.abDrawerClose {
|
|
99
|
+
flex: none; /* ๐ */
|
|
100
|
+
inline-size: 40px; /* ๐ */
|
|
101
|
+
block-size: 40px; /* ๐ */
|
|
102
|
+
border: 0; /* ๐งน */
|
|
103
|
+
border-radius: 999px; /* ๐ข */
|
|
104
|
+
background: transparent; /* ๐จ */
|
|
105
|
+
color: inherit; /* ๐๏ธ */
|
|
106
|
+
font: inherit; /* ๐ค */
|
|
107
|
+
cursor: pointer; /* ๐ฑ๏ธ */
|
|
108
|
+
}
|
|
109
|
+
.abDrawerClose:hover { background: var(--ab-color-surface-container-high, rgb(0 0 0 / 0.06)); } /* ๐ฑ๏ธ */
|
|
110
|
+
.abDrawerClose:focus-visible { outline: var(--ab-focus-ring-width, 2px) solid var(--ab-color-accent, var(--ab-color-primary, #8f4c38)); outline-offset: 2px; } /* โฟ */
|
|
111
|
+
.abDrawerBody { flex: 1 1 auto; min-height: 0; overflow: hidden auto; overscroll-behavior: contain; padding: 8px 20px 16px; } /* ๐ its own scroller */
|
|
112
|
+
.abDrawerFooter { flex: none; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; } /* ๐ */
|
|
113
|
+
|
|
114
|
+
/* โฟ reduced motion: no slide, no fade (handled by ab-nextjs-animations .ab-motion-*) */
|
|
115
|
+
|
|
116
|
+
/* ๐งฉ D41 no-JS fallback: an in-flow section; hidden as soon as scripting runs (hydration swaps in the drawer) */
|
|
117
|
+
.abDrawerFallback { display: block; margin-block: 16px; border: var(--ab-divider-hairline, 1px solid rgb(0 0 0 / 0.12)); border-radius: 12px; }
|
|
118
|
+
.abDrawerFallback .abDrawerTitle { padding: 12px 20px 0; }
|
|
119
|
+
.abDrawerFallback .abDrawerBody { overflow: visible; }
|
|
120
|
+
@media (scripting: enabled) {
|
|
121
|
+
.abDrawerFallback { display: none; }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* ๐ the scope box (.AbAppLayout / main / aside pane) is the layer's containing block while a drawer uses it.
|
|
125
|
+
:where() = zero specificity, so a host that is already positioned (fixed / absolute aside) keeps its own.
|
|
126
|
+
The local class inside :has() keeps CSS-modules "pure" mode happy. (A core rule could own this later.) */
|
|
127
|
+
:where([data-ab-drawer-host]:has(> .abDrawerLayer)) { position: relative; }
|
|
@@ -0,0 +1,89 @@
|
|
|
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: useAbDrawer (G53)
|
|
28
|
+
* @file: ab-drawer/use-ab-drawer.ts
|
|
29
|
+
* @type: Client hook
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* 1+|> const drawer = useAbDrawer('app')
|
|
34
|
+
* -|> <button {...drawer.triggerProps}>Language</button>
|
|
35
|
+
* -|> <AbDrawer {...drawer.drawerProps} title="Language">โฆ</AbDrawer>
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
40
|
+
* MOTTO: We'll always do more ๐!!!
|
|
41
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
'use client';
|
|
46
|
+
|
|
47
|
+
// โ๏ธ React
|
|
48
|
+
import { useCallback, useId, useMemo, useState } from 'react';
|
|
49
|
+
|
|
50
|
+
/** ๐บ๏ธ which box clips the drawer (G53): the whole app, the main pane or the aside pane */
|
|
51
|
+
export type AbDrawerScope = 'app' | 'main' | 'aside';
|
|
52
|
+
|
|
53
|
+
/** ๐๏ธ what useAbDrawer returns */
|
|
54
|
+
export interface UseAbDrawer {
|
|
55
|
+
scope: AbDrawerScope; // ๐บ๏ธ
|
|
56
|
+
id: string; // ๐ the drawer id (`aria-controls` target)
|
|
57
|
+
open: boolean; // ๐ช is it open?
|
|
58
|
+
show: () => void; // โ open it
|
|
59
|
+
close: () => void; // โ close it (Escape / scrim / buttons)
|
|
60
|
+
toggle: () => void; // ๐
|
|
61
|
+
setOpen: (open: boolean) => void; // ๐๏ธ controlled setter
|
|
62
|
+
/** ๐ spread on the trigger button: aria-expanded / aria-controls / aria-haspopup / onClick */
|
|
63
|
+
triggerProps: { 'aria-expanded': boolean; 'aria-controls': string; 'aria-haspopup': 'dialog'; onClick: () => void };
|
|
64
|
+
/** ๐๏ธ spread on the drawer: id / scope / open / onClose */
|
|
65
|
+
drawerProps: { id: string; scope: AbDrawerScope; open: boolean; onClose: () => void };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* ๐๏ธ useAbDrawer(scope) โ one drawer's open state + the trigger / drawer prop bags (G53).
|
|
70
|
+
*
|
|
71
|
+
* ๐งญ Lives in **components** (next to AbDrawer), not in core: it holds no layout state, only `open`,
|
|
72
|
+
* and components doesn't depend on core. Focus return is handled by AbDrawer itself.
|
|
73
|
+
*/
|
|
74
|
+
export function useAbDrawer(scope: AbDrawerScope = 'app', options: { defaultOpen?: boolean; id?: string } = {}): UseAbDrawer {
|
|
75
|
+
const auto = `ab-drawer-${useId().replace(/[^A-Za-z0-9_-]/g, '')}`; // ๐ stable across SSR + hydration
|
|
76
|
+
const id = options.id ?? auto; // ๐
|
|
77
|
+
const [open, setOpen] = useState<boolean>(options.defaultOpen ?? false); // ๐ช
|
|
78
|
+
const show = useCallback(() => setOpen(true), []); // โ
|
|
79
|
+
const close = useCallback(() => setOpen(false), []); // โ
|
|
80
|
+
const toggle = useCallback(() => setOpen((o) => !o), []); // ๐
|
|
81
|
+
return useMemo(() => ({
|
|
82
|
+
scope, id, open, show, close, toggle, setOpen,
|
|
83
|
+
triggerProps: { 'aria-expanded': open, 'aria-controls': id, 'aria-haspopup': 'dialog' as const, onClick: toggle },
|
|
84
|
+
drawerProps: { id, scope, open, onClose: close },
|
|
85
|
+
}), [scope, id, open, show, close, toggle]);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ๐ฆ default export
|
|
89
|
+
export default useAbDrawer;
|
|
@@ -0,0 +1,118 @@
|
|
|
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 (G53 preset)
|
|
28
|
+
* @file: ab-drawer-list/index.tsx
|
|
29
|
+
* @type: Client component
|
|
30
|
+
* @authors: Abraham Ukachi <abrahamukachi@gmail.com>
|
|
31
|
+
*
|
|
32
|
+
* Example usage:
|
|
33
|
+
* 1+|> <AbDrawerList scope="app" side="bottom" open={d.open} onClose={d.close} title="Language"
|
|
34
|
+
* -|> items={[{ value: 'en', label: 'English' }, { value: 'fr', label: 'Franรงais' }]} value="en" onSelect={setLocale} />
|
|
35
|
+
*/
|
|
36
|
+
|
|
37
|
+
/*
|
|
38
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
39
|
+
* MOTTO: We'll always do more ๐!!!
|
|
40
|
+
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
'use client';
|
|
45
|
+
|
|
46
|
+
// โ๏ธ React
|
|
47
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
48
|
+
// ๐งต classes
|
|
49
|
+
import clsx from 'clsx';
|
|
50
|
+
// ๐๏ธ the drawer
|
|
51
|
+
import AbDrawer, { type AbDrawerProps } from '../ab-drawer';
|
|
52
|
+
import type { ComponentType } from 'react';
|
|
53
|
+
// ๐ links go through AbLinkProvider (locale-aware apps)
|
|
54
|
+
import Link from '../ab-link';
|
|
55
|
+
// ๐จ styles
|
|
56
|
+
import styles from './styles.module.css';
|
|
57
|
+
|
|
58
|
+
/** ๐ one choice */
|
|
59
|
+
export interface AbDrawerListItem {
|
|
60
|
+
value: string; // ๐ e.g. a locale code
|
|
61
|
+
label: ReactNode; // ๐ท๏ธ
|
|
62
|
+
description?: ReactNode; // ๐ a second line
|
|
63
|
+
icon?: ReactNode; // ๐ฃ leading, decorative
|
|
64
|
+
href?: string; // ๐ render a link (e.g. the same page in another locale) instead of a button
|
|
65
|
+
lang?: string; // ๐ e.g. 'fr' for "Franรงais" (screen readers pronounce it right)
|
|
66
|
+
disabled?: boolean; // ๐ซ
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** โ๏ธ props: every AbDrawer prop, plus the list */
|
|
70
|
+
export interface AbDrawerListProps extends Omit<AbDrawerProps, 'children'> {
|
|
71
|
+
as?: ComponentType<AbDrawerProps>; // ๐งฑ the drawer to render in (default AbDrawer; e.g. AbBottomDrawer)
|
|
72
|
+
items: AbDrawerListItem[]; // ๐
|
|
73
|
+
value?: string | null; // ๐ฏ the selected item (`aria-current="true"` + a check mark)
|
|
74
|
+
onSelect?: (value: string) => void; // ๐
|
|
75
|
+
closeOnSelect?: boolean; // ๐ช default true
|
|
76
|
+
listLabel?: string; // โฟ the list's name when the title isn't enough
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* ๐ AbDrawerList โ AbDrawer with one selectable list (languages, sort orders, โฆ). D40: the mobile
|
|
81
|
+
* language picker is `<AbDrawerList scope="app" side="bottom" />`. Items are buttons (or links with
|
|
82
|
+
* `href`), the selected one carries `aria-current="true"`. No-JS: the links still work in the fallback.
|
|
83
|
+
*/
|
|
84
|
+
const AbDrawerList = ({ as: Drawer = AbDrawer, items, value, onSelect, closeOnSelect = true, listLabel, onClose, className, ...drawer }: AbDrawerListProps): ReactElement => {
|
|
85
|
+
const pick = (v: string) => { onSelect?.(v); if (closeOnSelect) onClose(); }; // ๐ then ๐ช
|
|
86
|
+
return (
|
|
87
|
+
<Drawer {...drawer} onClose={onClose} className={clsx('AbDrawerList', className)}>
|
|
88
|
+
<ul className={styles.abDrawerList} aria-label={listLabel} data-ab-part="drawer-list">
|
|
89
|
+
{items.map((it) => {
|
|
90
|
+
const on = it.value === value; // ๐ฏ
|
|
91
|
+
const inner = (
|
|
92
|
+
<>
|
|
93
|
+
{it.icon != null && <span className={styles.abDrawerListIcon} aria-hidden="true">{it.icon}</span>}
|
|
94
|
+
<span className={styles.abDrawerListText}>
|
|
95
|
+
<span lang={it.lang}>{it.label}</span>
|
|
96
|
+
{it.description != null && <span className={styles.abDrawerListDescription}>{it.description}</span>}
|
|
97
|
+
</span>
|
|
98
|
+
<span className={styles.abDrawerListCheck} aria-hidden="true">{on ? 'โ' : ''}</span>
|
|
99
|
+
</>
|
|
100
|
+
);
|
|
101
|
+
return (
|
|
102
|
+
<li key={it.value}>
|
|
103
|
+
{it.href && !it.disabled ? (
|
|
104
|
+
<Link href={it.href} className={styles.abDrawerListItem} data-active={on ? 'true' : 'false'} aria-current={on ? 'true' : undefined} hrefLang={it.lang} onClick={() => pick(it.value)}>{inner}</Link>
|
|
105
|
+
) : (
|
|
106
|
+
<button type="button" className={styles.abDrawerListItem} data-active={on ? 'true' : 'false'} aria-current={on ? 'true' : undefined} disabled={it.disabled} onClick={() => pick(it.value)}>{inner}</button>
|
|
107
|
+
)}
|
|
108
|
+
</li>
|
|
109
|
+
);
|
|
110
|
+
})}
|
|
111
|
+
</ul>
|
|
112
|
+
</Drawer>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// ๐ฆ exports
|
|
117
|
+
export default AbDrawerList;
|
|
118
|
+
export { AbDrawerList };
|
|
@@ -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
|
@@ -52,6 +52,8 @@ import moreVert from 'ab-nextjs-icons/ab-icons/icons/more_vert'; // โฎ AbAppBar
|
|
|
52
52
|
import search from 'ab-nextjs-icons/ab-icons/icons/search'; // ๐ AbSearchTrigger (0.1.13)
|
|
53
53
|
import close from 'ab-nextjs-icons/ab-icons/icons/close'; // โ๏ธ AbPage aside close (0.1.13)
|
|
54
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)
|
|
55
57
|
// ๐งพ shape
|
|
56
58
|
import type { AbIconSvgData } from './helpers';
|
|
57
59
|
|
|
@@ -72,4 +74,6 @@ export const AB_ICON_BUILTINS: Record<string, AbIconSvgData> = {
|
|
|
72
74
|
search, // ๐
|
|
73
75
|
close, // โ๏ธ
|
|
74
76
|
expand_more: expandMore, // ๐ฝ
|
|
77
|
+
keyboard_double_arrow_left: doubleLeft, // โช
|
|
78
|
+
keyboard_double_arrow_right: doubleRight, // โฉ
|
|
75
79
|
};
|
package/ab-icon-button/index.tsx
CHANGED
|
@@ -90,6 +90,12 @@ export interface AbIconButtonProps {
|
|
|
90
90
|
title?: string;
|
|
91
91
|
// ๐งพ button type
|
|
92
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;
|
|
93
99
|
}
|
|
94
100
|
|
|
95
101
|
const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function AbIconButton(props, ref) {
|
|
@@ -112,6 +118,9 @@ const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function A
|
|
|
112
118
|
title, // ๐ฌ
|
|
113
119
|
type = 'button', // ๐งพ
|
|
114
120
|
iconFilled, // โฌ
|
|
121
|
+
'aria-expanded': ariaExpanded, // โฟ 0.1.14
|
|
122
|
+
'aria-controls': ariaControls, // โฟ 0.1.14
|
|
123
|
+
iconSize, // ๐ 0.1.14
|
|
115
124
|
} = props;
|
|
116
125
|
|
|
117
126
|
// โฟ G6: one accessible name for both variants, ON the interactive element (not the wrapper span)
|
|
@@ -121,7 +130,7 @@ const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function A
|
|
|
121
130
|
// ๐ท๏ธ classes
|
|
122
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
|
|
123
132
|
// ๐ฃ 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" />;
|
|
133
|
+
const glyph = <AbIcon name={icon} variant={(iconFilled ?? active) ? 'filled' : 'outlined'} className="icon" size={iconSize} />;
|
|
125
134
|
|
|
126
135
|
// ๐ link variant
|
|
127
136
|
if (href && !isLoading) {
|
|
@@ -158,6 +167,8 @@ const AbIconButton = forwardRef<HTMLButtonElement, AbIconButtonProps>(function A
|
|
|
158
167
|
aria-label={name} // โฟ accessible name
|
|
159
168
|
title={tooltip} // ๐ฌ tooltip on the button itself
|
|
160
169
|
aria-busy={isLoading || undefined} // โณ announce loading
|
|
170
|
+
aria-expanded={ariaExpanded} // โฟ open / closed (omitted when undefined)
|
|
171
|
+
aria-controls={ariaControls} // โฟ what it opens
|
|
161
172
|
data-active={String(active)} // โ
|
|
162
173
|
data-naked={String(naked)} // ๐ซฅ
|
|
163
174
|
data-expands={String(expands)} // ๐
|
|
@@ -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>
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
gap: 0.5rem; /* ๐งฑ */
|
|
43
43
|
padding: 0.75rem; /* ๐งฑ */
|
|
44
44
|
border-radius: 0.875rem; /* ๐ฒ */
|
|
45
|
-
border: 1px solid var(--ab-color-outline-variant, rgb(0 0 0 / 0.12)); /* ๐๏ธ */
|
|
45
|
+
border: 1px solid var(--ab-color-border, 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
48
|
min-width: 0; /* ๐ซ overflow in narrow columns (0.1.13) */
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
font-weight: 600; /* ๐ช */
|
|
85
85
|
}
|
|
86
86
|
.tab:focus-visible {
|
|
87
|
-
outline: 2px solid var(--ab-focus-ring, var(--ab-color-primary, #A67C52)); /* ๐ */
|
|
87
|
+
outline: 2px solid var(--ab-color-accent, var(--ab-focus-ring, var(--ab-color-primary, #A67C52))); /* ๐ */
|
|
88
88
|
outline-offset: 2px; /* โ๏ธ */
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -126,3 +126,35 @@
|
|
|
126
126
|
@media (scripting: none) {
|
|
127
127
|
.copy { display: none; } /* ๐ */
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
/* ===== ๐ป 0.1.14 (P12, Home spec ยง4 install block): variant="terminal" (dark in both themes) ===== */
|
|
131
|
+
.root.terminal {
|
|
132
|
+
display: block; gap: 0; padding: 0; overflow: hidden; /* ๐งน no outer card */
|
|
133
|
+
border: 1px solid rgb(255 232 210 / 0.06); border-radius: var(--ab-radius-code, 12px); /* ๐ฒ */
|
|
134
|
+
background: var(--ab-color-code, #231a14); color: var(--ab-color-code-text, #ede0d4); /* ๐ป dark: #110b07 / #e8dacc */
|
|
135
|
+
box-shadow: 0 10px 30px rgb(33 26 22 / 0.14); /* ๐ */
|
|
136
|
+
}
|
|
137
|
+
.termHead {
|
|
138
|
+
display: flex; align-items: center; padding: 6px 8px 0 10px; /* ๐ฆ tabs ยท grow ยท copy */
|
|
139
|
+
border-bottom: 1px solid rgb(255 232 210 / 0.08); /* โ */
|
|
140
|
+
}
|
|
141
|
+
.terminal .tabs { gap: 2px; } /* ๐๏ธ */
|
|
142
|
+
.terminal .tab, .terminal .tab:hover {
|
|
143
|
+
min-height: 0; padding: 6px 8px 8px; border-radius: 0; background: none; /* ๐งน no pills */
|
|
144
|
+
font-size: 12px; font-weight: 600; line-height: 17px; color: rgb(237 224 212 / 0.55); /* ๐ค */
|
|
145
|
+
}
|
|
146
|
+
.terminal .tab:hover { color: rgb(237 224 212 / 0.8); } /* ๐ฑ๏ธ */
|
|
147
|
+
.terminal .tab[aria-selected='true'], .terminal .tab[aria-selected='true']:hover {
|
|
148
|
+
background: none; color: #e7c8a5; box-shadow: inset 0 -2px 0 #c29a6f; /* โ
underline */
|
|
149
|
+
}
|
|
150
|
+
.terminal .tab:focus-visible { outline-color: #c29a6f; outline-offset: -2px; } /* โฟ inside the block */
|
|
151
|
+
.termGrow { flex: 1; } /* โ๏ธ */
|
|
152
|
+
.terminal .copy.copy { margin: 0; padding: 4px 4px 6px; border-radius: 6px; color: rgb(237 224 212 / 0.7); } /* ๐ always visible; mock .cp 4/4/6 โ a 26px (โฅ 24px) target */
|
|
153
|
+
.terminal .panel { display: block; padding: 14px 16px 16px; border-radius: 0; background: none; color: inherit; overflow-x: auto; } /* ๐ scrolls, never clips */
|
|
154
|
+
.terminal .prompt { opacity: 1; color: #8e7a69; margin-inline-end: 0.6em; font-size: 13.5px; } /* ๐ฒ */
|
|
155
|
+
.terminal .code { display: inline; overflow: visible; font-size: 13.5px; line-height: 1.4; white-space: pre; } /* โจ๏ธ Roboto Mono 13.5/1.4 */
|
|
156
|
+
.termPkg { color: #e7c8a5; } /* ๐ฆ */
|
|
157
|
+
@media (max-width: 767px) {
|
|
158
|
+
.terminal .panel { padding: 12px 14px 13px; } /* ๐ฑ */
|
|
159
|
+
.terminal .prompt, .terminal .code { font-size: 13px; }
|
|
160
|
+
}
|
package/ab-kbd/styles.module.css
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
.abKbdKey {
|
|
48
48
|
min-width: 20px; /* ๐ */
|
|
49
49
|
padding: 3px 5px; /* ๐ฆ */
|
|
50
|
-
border: 1px solid var(--ab-color-outline-variant, rgb(0 0 0 / 0.15)); /* ๐ผ๏ธ */
|
|
50
|
+
border: 1px solid var(--ab-color-border, var(--ab-color-outline-variant, rgb(0 0 0 / 0.15))); /* ๐ผ๏ธ */
|
|
51
51
|
border-radius: 6px; /* ๐ข */
|
|
52
52
|
box-sizing: border-box; /* ๐ฆ */
|
|
53
53
|
text-align: center; /* โ๏ธ */
|