@hideyukimori/nene2-ui 0.18.1 → 0.19.1

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.
@@ -21,4 +21,19 @@ export interface BadgeProps {
21
21
  * `<Badge color="red">` becomes a lie the moment the theme changes, and there is no way to
22
22
  * find every such lie afterwards except by reading every screen.
23
23
  */
24
+ /**
25
+ * 🔮 `whitespace-nowrap` is load-bearing (#477). A badge is a label, not body copy — but the
26
+ * kit had no opinion on wrapping, so in a narrow flex row the label wrapped. In CJK that is
27
+ * not a word-boundary break: 「あăȘた」 came apart into three stacked characters and the badge
28
+ * grew from 26.5px tall to 43px (measured, nene-deal /users at 375px).
29
+ *
30
+ * Two holes were open at once — the label could *wrap* (`white-space: normal`) and the badge
31
+ * could *shrink* (`flex-shrink: 1`) — and either one alone produces the failure. `shrink-0`
32
+ * would close it too, but only while the badge is a flex item: measured in a 50px block
33
+ * container, `shrink-0` still wrapped (50 × 43) while `nowrap` did not (51 × 26.5). `nowrap`
34
+ * also stops the shrink, because a flex item's automatic minimum size is its min-content
35
+ * width and nowrap makes that the whole label. One class, both holes, any context.
36
+ *
37
+ * A badge that already fits is unchanged (35.88 × 26.5 before and after, measured).
38
+ */
24
39
  export declare function Badge({ tone, className, children }: BadgeProps): import("react").JSX.Element;
@@ -15,7 +15,22 @@ const TONE_CLASS = {
15
15
  * `<Badge color="red">` becomes a lie the moment the theme changes, and there is no way to
16
16
  * find every such lie afterwards except by reading every screen.
17
17
  */
18
+ /**
19
+ * 🔮 `whitespace-nowrap` is load-bearing (#477). A badge is a label, not body copy — but the
20
+ * kit had no opinion on wrapping, so in a narrow flex row the label wrapped. In CJK that is
21
+ * not a word-boundary break: 「あăȘた」 came apart into three stacked characters and the badge
22
+ * grew from 26.5px tall to 43px (measured, nene-deal /users at 375px).
23
+ *
24
+ * Two holes were open at once — the label could *wrap* (`white-space: normal`) and the badge
25
+ * could *shrink* (`flex-shrink: 1`) — and either one alone produces the failure. `shrink-0`
26
+ * would close it too, but only while the badge is a flex item: measured in a 50px block
27
+ * container, `shrink-0` still wrapped (50 × 43) while `nowrap` did not (51 × 26.5). `nowrap`
28
+ * also stops the shrink, because a flex item's automatic minimum size is its min-content
29
+ * width and nowrap makes that the whole label. One class, both holes, any context.
30
+ *
31
+ * A badge that already fits is unchanged (35.88 × 26.5 before and after, measured).
32
+ */
18
33
  export function Badge({ tone = 'neutral', className, children }) {
19
- return (_jsx("span", { className: cx('inline-flex items-center rounded-x-slot-badge border px-x-slot-badge-pad-x py-x-slot-badge-pad-y font-sans', TONE_CLASS[tone], className), children: children }));
34
+ return (_jsx("span", { className: cx('inline-flex items-center whitespace-nowrap gap-x-slot-badge-gap rounded-x-slot-badge border px-x-slot-badge-pad-x py-x-slot-badge-pad-y font-sans text-x-slot-badge font-x-slot-badge', TONE_CLASS[tone], className), children: children }));
20
35
  }
21
36
  //# sourceMappingURL=Badge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/feedback/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAkBlC,MAAM,UAAU,GAAoD;IAClE,OAAO,EACL,4FAA4F;IAC9F,MAAM,EAAE,yFAAyF;IACjG,MAAM,EAAE,yFAAyF;IACjG,OAAO,EACL,4FAA4F;IAC9F,IAAI,EAAE,mFAAmF;IACzF,IAAI,EAAE,mFAAmF;CAC1F,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,IAAI,GAAG,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAc;IACzE,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,4GAA4G,EAC5G,UAAU,CAAC,IAAI,CAAC,EAChB,SAAS,CACV,YAEA,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"Badge.js","sourceRoot":"","sources":["../../src/feedback/Badge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAkBlC,MAAM,UAAU,GAAoD;IAClE,OAAO,EACL,4FAA4F;IAC9F,MAAM,EAAE,yFAAyF;IACjG,MAAM,EAAE,yFAAyF;IACjG,OAAO,EACL,4FAA4F;IAC9F,IAAI,EAAE,mFAAmF;IACzF,IAAI,EAAE,mFAAmF;CAC1F,CAAC;AAEF;;;;;;GAMG;AACH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,IAAI,GAAG,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAc;IACzE,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,uLAAuL,EACvL,UAAU,CAAC,IAAI,CAAC,EAChB,SAAS,CACV,YAEA,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hideyukimori/nene2-ui",
3
- "version": "0.18.1",
3
+ "version": "0.19.1",
4
4
  "description": "NeNe fleet shared React UI kit — token-driven primitives on Tailwind v4 @theme. Components carry no design of their own; themes do.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -164,6 +164,12 @@
164
164
  --spacing-x-slot-choice-box: var(--spacing-x-sm);
165
165
  --spacing-x-slot-badge-pad-x: var(--spacing-x-2xs);
166
166
  --spacing-x-slot-badge-pad-y: var(--spacing-x-3xs);
167
+ /* 🔮 Between a badge's icon and its label (#463). Unlike every other slot added so far,
168
+ * this one **changes what a Badge already renders**: the current default is *nothing
169
+ * specified*, so an icon sits flush against its text. Both consumers — nene-vault and
170
+ * nene-deal — were already correcting that independently, so the painting this replaces
171
+ * is one no consumer used. */
172
+ --spacing-x-slot-badge-gap: var(--spacing-x-3xs);
167
173
  --spacing-x-slot-switch-pad-x: var(--spacing-x-2xs);
168
174
  --spacing-x-slot-switch-pad-y: var(--spacing-x-3xs);
169
175
  --spacing-x-slot-alert-pad: var(--spacing-x-2xs);
@@ -185,6 +191,10 @@
185
191
  --radius-x-slot-button: var(--radius-x-md);
186
192
  --radius-x-slot-control: var(--radius-x-md);
187
193
  --radius-x-slot-badge: var(--radius-x-md);
194
+ /* A badge is a label, not body copy (#463). Inherited type made it the size and weight of
195
+ * whatever it sat in; both consumers overrode both. Same caveat as the gap above: this
196
+ * changes the current render. */
197
+ --text-x-slot-badge: var(--text-x-2xs);
188
198
  --radius-x-slot-switch: var(--radius-x-md);
189
199
  --radius-x-slot-alert: var(--radius-x-md);
190
200
  --radius-x-slot-toast: var(--radius-x-md);
@@ -410,7 +420,15 @@
410
420
  --spacing-x-slot-button-icon: var(--spacing-x-lg);
411
421
 
412
422
  /* ── Weight slots ─────────────────────────────────────────────────────────────
413
- * `font-medium` appeared inline in four components. Same rule, same reason as colour. */
423
+ * `font-medium` appeared inline in four components. Same rule, same reason as colour.
424
+ *
425
+ * 🔮 The badge is `semibold`, and it is the one slot here that is not preserving an
426
+ * existing inline weight — it had none, which is why #463 exists. So the reason the other
427
+ * six are `medium` (that is what they already rendered) does not reach it, and the only
428
+ * evidence left is the consumers: nene-vault ships `font-semibold` and nene-deal measures
429
+ * 600 in production. **Nothing ships 500.** A badge also carries its weight at 11px, where
430
+ * the others sit at body size — the weight is doing work the size cannot. */
431
+ --font-weight-x-slot-badge: var(--font-weight-semibold);
414
432
  --font-weight-x-slot-button: var(--font-weight-medium);
415
433
  --font-weight-x-slot-table-header: var(--font-weight-medium);
416
434
  --font-weight-x-slot-detail-term: var(--font-weight-medium);