ab-nextjs-components 0.2.1 โ 0.2.2
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 +5 -1
- package/ab-package-card/index.tsx +1 -1
- package/ab-package-card/previews.tsx +20 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
## 0.2.
|
|
1
|
+
## 0.2.2 (Unreleased, proposed)
|
|
2
|
+
|
|
3
|
+
- ๐ AbPackagePreviewComponents `labels` ({ button, chip, switch }); English defaults unchanged, the 0.2.1 `button` / `chip` props still work
|
|
4
|
+
|
|
5
|
+
## 0.2.1
|
|
2
6
|
|
|
3
7
|
### Sidebar profile (God 02:44)
|
|
4
8
|
- โจ AbSidebar `profile` prop (opt-in): a 40px profile button at the bottom left opens AbSettingsDrawer. Signed out it shows the profile glyph; signed in the initials ("AU") on the container colour, or the photo masked to a circle, plus the name when expanded. Rendered on the server and hidden by CSS below 1180px (no flash); the collapsed rail names it with an AbBalloon tooltip. Label via `labels.profile` (default "Profile and settings")
|
|
@@ -140,4 +140,4 @@ const AbPackageCardLegacy = ({ name, href, description, version, icon, media, id
|
|
|
140
140
|
export default AbPackageCard;
|
|
141
141
|
export { AbPackageCard };
|
|
142
142
|
// ๐ผ๏ธ 0.2.1 (God 02:44): the Home preview tiles (mock .pv-anim / .pv-code / .pv-comp)
|
|
143
|
-
export { AbPackagePreviewCurve, AbPackagePreviewCode, AbPackagePreviewComponents } from './previews';
|
|
143
|
+
export { AbPackagePreviewCurve, AbPackagePreviewCode, AbPackagePreviewComponents, type AbPackagePreviewComponentsLabels, type AbPackagePreviewComponentsProps } from './previews';
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
* <AbPackageCard preview={<AbPackagePreviewCode lines={['*use*Theme()', '*use*Media()']} />} โฆ /> // ๐ช Hooks
|
|
35
35
|
* <AbPackageCard preview={<AbPackagePreviewCode lines={['<*AbProvider*>', '~ {children}']} />} โฆ /> // ๐งฑ Core
|
|
36
36
|
* <AbPackageCard preview={<AbPackagePreviewComponents />} โฆ /> // ๐งฉ Components: button ยท switch ยท chip
|
|
37
|
+
* <AbPackagePreviewComponents labels={{ button: 'Bouton', chip: 'Puce', switch: 'Interrupteur' }} /> // ๐ 0.2.2
|
|
37
38
|
*/
|
|
38
39
|
|
|
39
40
|
/*
|
|
@@ -82,13 +83,28 @@ export function AbPackagePreviewCode({ lines }: { lines: readonly string[] }): R
|
|
|
82
83
|
);
|
|
83
84
|
}
|
|
84
85
|
|
|
86
|
+
/** ๐ 0.2.2: the Components tile's strings (English defaults) */
|
|
87
|
+
export interface AbPackagePreviewComponentsLabels {
|
|
88
|
+
button?: string; // ๐ default "Button"
|
|
89
|
+
chip?: string; // ๐ default "Chip"
|
|
90
|
+
switch?: string; // ๐๏ธ default "Switch" (the switch's name when the tile is used outside an aria-hidden card preview)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** โ๏ธ props: `labels` (0.2.2) wins over the 0.2.1 `button` / `chip` props (kept for back-compat) */
|
|
94
|
+
export interface AbPackagePreviewComponentsProps {
|
|
95
|
+
labels?: AbPackagePreviewComponentsLabels; // ๐
|
|
96
|
+
button?: string; // ๐ฐ๏ธ 0.2.1: prefer `labels.button`
|
|
97
|
+
chip?: string; // ๐ฐ๏ธ 0.2.1: prefer `labels.chip`
|
|
98
|
+
}
|
|
99
|
+
|
|
85
100
|
/** ๐งฉ Components tile: a mini button, an on switch and a pill chip, intrinsic size (no stretch), centred both ways. */
|
|
86
|
-
export function AbPackagePreviewComponents({
|
|
101
|
+
export function AbPackagePreviewComponents({ labels = {}, button, chip }: AbPackagePreviewComponentsProps): ReactElement {
|
|
102
|
+
const L = { button: button ?? 'Button', chip: chip ?? 'Chip', switch: 'Switch', ...labels }; // ๐ defaults < legacy props < labels
|
|
87
103
|
return (
|
|
88
104
|
<span className={styles.pvComp} data-ab-part="preview-components">
|
|
89
|
-
<span className={styles.pvBtn}>{button}</span> {/* ๐ 6px radius (kept) */}
|
|
90
|
-
<span className={styles.pvSw}><i /></span> {/* ๐๏ธ on */}
|
|
91
|
-
<span className={styles.pvChip}>{chip}</span> {/* ๐ pill */}
|
|
105
|
+
<span className={styles.pvBtn}>{L.button}</span> {/* ๐ 6px radius (kept) */}
|
|
106
|
+
<span className={styles.pvSw} role="img" aria-label={L.switch}><i /></span> {/* ๐๏ธ on */}
|
|
107
|
+
<span className={styles.pvChip}>{L.chip}</span> {/* ๐ pill */}
|
|
92
108
|
</span>
|
|
93
109
|
);
|
|
94
110
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ab-nextjs-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "๐ A lightweight collection of server & client React components created by Abraham Ukachi, and optimized for Next.js applications ๐.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|