@lotics/ui 28.2.1 → 28.3.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/docs/catalog.md +5 -0
- package/package.json +1 -1
- package/src/record_summary.tsx +29 -5
package/docs/catalog.md
CHANGED
|
@@ -922,6 +922,11 @@ source (`src/<module>.tsx`/`.ts`) is the API reference.
|
|
|
922
922
|
`metric` {label,value,tone,note} pinned right, the band's ONE accent. The record's FIELDS
|
|
923
923
|
never live in the header: compose them as `DetailTable`s in the sections below. Replaces
|
|
924
924
|
hand-rolled record headers (mixed scales, several competing figures, color noise).
|
|
925
|
+
`metric.value` also takes a NODE, for the one case of a figure that has not loaded yet — pass
|
|
926
|
+
a `Skeleton` and it renders in place of the styled figure, in a slot holding that figure's own
|
|
927
|
+
line box, so the band is the same height either way and a loading record's header does not
|
|
928
|
+
move when the number lands. Still ONE number: a node is a stand-in for it, not a licence to
|
|
929
|
+
put a control in the slot.
|
|
925
930
|
- **`ledger`** — `Ledger` + `LedgerGroup` + `LedgerBasis` + `LedgerRow` + `LedgerTotal` — the
|
|
926
931
|
record-level money list: every figure on ONE right-aligned tabular column, `peek` turns a row
|
|
927
932
|
into a pressable door floating its particulars in an anchored popover (put links INSIDE the
|
package/package.json
CHANGED
package/src/record_summary.tsx
CHANGED
|
@@ -5,8 +5,20 @@ import { Text } from "./text";
|
|
|
5
5
|
export interface RecordSummaryMetric {
|
|
6
6
|
/** Caption above the number ("Outstanding", "Total value"). */
|
|
7
7
|
label: string;
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The headline figure — rendered lg semibold tabular.
|
|
10
|
+
*
|
|
11
|
+
* A NODE is accepted for one reason: the figure is not known yet, and the
|
|
12
|
+
* surface wants a placeholder (a `Skeleton`) in its place while the record
|
|
13
|
+
* loads. It is rendered INSTEAD of the styled `Text`, not inside it — a `View`
|
|
14
|
+
* nested in a `Text` is not a thing React Native supports — into a slot that
|
|
15
|
+
* reserves the figure's own line box, so a placeholder cannot change the
|
|
16
|
+
* band's height and the caller never has to know what that height is.
|
|
17
|
+
*
|
|
18
|
+
* It is still ONE headline number. A node here is a stand-in for the number,
|
|
19
|
+
* never a licence to put a control or a second figure in the slot.
|
|
20
|
+
*/
|
|
21
|
+
value: ReactNode;
|
|
10
22
|
/** Valence of the figure (and its note) — the summary's ONE permitted accent. */
|
|
11
23
|
tone?: "default" | "danger" | "warning" | "success";
|
|
12
24
|
/** One short qualifier under the number ("Overdue 25 days"). */
|
|
@@ -65,9 +77,13 @@ export function RecordSummary(props: RecordSummaryProps) {
|
|
|
65
77
|
<Text size="xs" color="muted" weight="medium" align="right">
|
|
66
78
|
{metric.label}
|
|
67
79
|
</Text>
|
|
68
|
-
|
|
69
|
-
{metric.
|
|
70
|
-
|
|
80
|
+
{typeof metric.value === "string" ? (
|
|
81
|
+
<Text size="lg" weight="semibold" tabular align="right" color={metric.tone === "default" ? undefined : metric.tone}>
|
|
82
|
+
{metric.value}
|
|
83
|
+
</Text>
|
|
84
|
+
) : (
|
|
85
|
+
<View style={styles.metricSlot}>{metric.value}</View>
|
|
86
|
+
)}
|
|
71
87
|
{metric.note ? (
|
|
72
88
|
<Text size="xs" align="right" weight={metric.tone && metric.tone !== "default" ? "medium" : "regular"} color={metric.tone && metric.tone !== "default" ? metric.tone : "muted"}>
|
|
73
89
|
{metric.note}
|
|
@@ -100,4 +116,12 @@ const styles = StyleSheet.create({
|
|
|
100
116
|
alignItems: "flex-end",
|
|
101
117
|
gap: 1,
|
|
102
118
|
},
|
|
119
|
+
// The figure's line box, held open for a non-string value so the band is the
|
|
120
|
+
// same height whether it holds the number or a placeholder. 30 is `Text` size
|
|
121
|
+
// `lg`'s lineHeight (src/text.tsx) — the height the styled figure occupies.
|
|
122
|
+
metricSlot: {
|
|
123
|
+
height: 30,
|
|
124
|
+
justifyContent: "center",
|
|
125
|
+
alignItems: "flex-end",
|
|
126
|
+
},
|
|
103
127
|
});
|