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 CHANGED
@@ -1,4 +1,8 @@
1
- ## 0.2.1 (Unreleased, proposed)
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({ button = 'Button', chip = 'Chip' }: { button?: string; chip?: string }): ReactElement {
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.1",
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",