@kud/ink-ui 0.22.0 → 0.23.0
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/dist/index.d.ts +22 -0
- package/dist/index.js +3 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -267,6 +267,28 @@ type TabItem<T extends string = string> = {
|
|
|
267
267
|
*/
|
|
268
268
|
marker?: string;
|
|
269
269
|
markerColor?: string;
|
|
270
|
+
/**
|
|
271
|
+
* The true size of what `count` is a window onto, drawn as `(count/total)`.
|
|
272
|
+
*
|
|
273
|
+
* A field rather than something a caller folds into `label`, for the same
|
|
274
|
+
* reason `marker` is one — and this one was learned the hard way. A caller
|
|
275
|
+
* with no channel for "there are more than these" smuggled it into the label
|
|
276
|
+
* as `Issues +129 (20)`, and `+` is an operator: it tells the reader to add,
|
|
277
|
+
* with nothing on screen to add it to. The arithmetic even works, which is
|
|
278
|
+
* what makes it vicious — a reader who obeys gets a real number for a question
|
|
279
|
+
* nobody asked, with no signal they have misread anything.
|
|
280
|
+
*
|
|
281
|
+
* A fraction is part-of-whole, the most over-learned notation there is: page 3
|
|
282
|
+
* of 12. Nobody computes with a slash. The distinction rides on a glyph rather
|
|
283
|
+
* than a hue, so it survives dimming, greyscale and colourblindness — and the
|
|
284
|
+
* magnitude survives with it, which is the half that matters most. `(30/37)`
|
|
285
|
+
* and `(20/149)` say very different things about how far a tab can be trusted,
|
|
286
|
+
* where a bare truncation flag says only "incomplete".
|
|
287
|
+
*
|
|
288
|
+
* Omit it when the count IS the whole, so one number keeps meaning "complete"
|
|
289
|
+
* and two always mean "you are looking at a sample".
|
|
290
|
+
*/
|
|
291
|
+
total?: number;
|
|
270
292
|
};
|
|
271
293
|
type TabsProps<T extends string> = {
|
|
272
294
|
active: T;
|
package/dist/index.js
CHANGED
|
@@ -660,7 +660,7 @@ var Tabs = ({ active, items }) => {
|
|
|
660
660
|
key: item.value,
|
|
661
661
|
marker: item.marker ?? "",
|
|
662
662
|
markerColor: item.markerColor,
|
|
663
|
-
text: item.count
|
|
663
|
+
text: item.count === void 0 ? item.label : item.total === void 0 ? `${item.label} (${item.count})` : `${item.label} (${item.count}/${item.total})`,
|
|
664
664
|
isActive: item.value === active
|
|
665
665
|
}));
|
|
666
666
|
const gutterOf = (cell) => [...cell.marker].length;
|
|
@@ -668,7 +668,8 @@ var Tabs = ({ active, items }) => {
|
|
|
668
668
|
let x = 0;
|
|
669
669
|
let rule = { start: 0, width: 0 };
|
|
670
670
|
for (const cell of cells) {
|
|
671
|
-
if (cell.isActive)
|
|
671
|
+
if (cell.isActive)
|
|
672
|
+
rule = { start: x + gutterOf(cell), width: labelOf(cell) };
|
|
672
673
|
x += gutterOf(cell) + labelOf(cell) + GAP;
|
|
673
674
|
}
|
|
674
675
|
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", children: [
|