@opsinjs/react 0.0.0-stage → 0.1.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/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +114 -2
- package/dist/components/accordion.d.ts +82 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +154 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-banner.d.ts +291 -0
- package/dist/components/alert-banner.d.ts.map +1 -0
- package/dist/components/alert-banner.js +529 -0
- package/dist/components/alert-banner.js.map +1 -0
- package/dist/components/avatar.d.ts +45 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +159 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +78 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +32 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/body-map.d.ts +51 -0
- package/dist/components/body-map.d.ts.map +1 -0
- package/dist/components/body-map.js +190 -0
- package/dist/components/body-map.js.map +1 -0
- package/dist/components/button.d.ts +260 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +609 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/callout.d.ts +99 -0
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +285 -0
- package/dist/components/callout.js.map +1 -0
- package/dist/components/card.d.ts +156 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +396 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/care-card.d.ts +182 -0
- package/dist/components/care-card.d.ts.map +1 -0
- package/dist/components/care-card.js +544 -0
- package/dist/components/care-card.js.map +1 -0
- package/dist/components/checkbox.d.ts +58 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +167 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/combobox.d.ts +71 -0
- package/dist/components/combobox.d.ts.map +1 -0
- package/dist/components/combobox.js +204 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/consent-sheet.d.ts +186 -0
- package/dist/components/consent-sheet.d.ts.map +1 -0
- package/dist/components/consent-sheet.js +452 -0
- package/dist/components/consent-sheet.js.map +1 -0
- package/dist/components/dialog.d.ts +108 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +573 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/disclaimer-note.d.ts +144 -0
- package/dist/components/disclaimer-note.d.ts.map +1 -0
- package/dist/components/disclaimer-note.js +486 -0
- package/dist/components/disclaimer-note.js.map +1 -0
- package/dist/components/divider.d.ts +76 -0
- package/dist/components/divider.d.ts.map +1 -0
- package/dist/components/divider.js +101 -0
- package/dist/components/divider.js.map +1 -0
- package/dist/components/dose-tracker.d.ts +137 -0
- package/dist/components/dose-tracker.d.ts.map +1 -0
- package/dist/components/dose-tracker.js +154 -0
- package/dist/components/dose-tracker.js.map +1 -0
- package/dist/components/empty-state.d.ts +171 -0
- package/dist/components/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state.js +387 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/field.d.ts +195 -0
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +282 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/goal-ring.d.ts +114 -0
- package/dist/components/goal-ring.d.ts.map +1 -0
- package/dist/components/goal-ring.js +254 -0
- package/dist/components/goal-ring.js.map +1 -0
- package/dist/components/icon-button.d.ts +124 -0
- package/dist/components/icon-button.d.ts.map +1 -0
- package/dist/components/icon-button.js +113 -0
- package/dist/components/icon-button.js.map +1 -0
- package/dist/components/link.d.ts +122 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/link.js +164 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/log-sheet.d.ts +259 -0
- package/dist/components/log-sheet.d.ts.map +1 -0
- package/dist/components/log-sheet.js +437 -0
- package/dist/components/log-sheet.js.map +1 -0
- package/dist/components/menu.d.ts +69 -0
- package/dist/components/menu.d.ts.map +1 -0
- package/dist/components/menu.js +190 -0
- package/dist/components/menu.js.map +1 -0
- package/dist/components/metric-tile.d.ts +301 -0
- package/dist/components/metric-tile.d.ts.map +1 -0
- package/dist/components/metric-tile.js +533 -0
- package/dist/components/metric-tile.js.map +1 -0
- package/dist/components/number-field.d.ts +62 -0
- package/dist/components/number-field.d.ts.map +1 -0
- package/dist/components/number-field.js +134 -0
- package/dist/components/number-field.js.map +1 -0
- package/dist/components/popover.d.ts +70 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +174 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +83 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +140 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/questionnaire.d.ts +123 -0
- package/dist/components/questionnaire.d.ts.map +1 -0
- package/dist/components/questionnaire.js +148 -0
- package/dist/components/questionnaire.js.map +1 -0
- package/dist/components/radio-group.d.ts +66 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +186 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/range-bar.d.ts +172 -0
- package/dist/components/range-bar.d.ts.map +1 -0
- package/dist/components/range-bar.js +578 -0
- package/dist/components/range-bar.js.map +1 -0
- package/dist/components/range-legend.d.ts +97 -0
- package/dist/components/range-legend.d.ts.map +1 -0
- package/dist/components/range-legend.js +166 -0
- package/dist/components/range-legend.js.map +1 -0
- package/dist/components/reading-input.d.ts +225 -0
- package/dist/components/reading-input.d.ts.map +1 -0
- package/dist/components/reading-input.js +651 -0
- package/dist/components/reading-input.js.map +1 -0
- package/dist/components/relative-time.d.ts +177 -0
- package/dist/components/relative-time.d.ts.map +1 -0
- package/dist/components/relative-time.js +603 -0
- package/dist/components/relative-time.js.map +1 -0
- package/dist/components/result-card.d.ts +319 -0
- package/dist/components/result-card.d.ts.map +1 -0
- package/dist/components/result-card.js +614 -0
- package/dist/components/result-card.js.map +1 -0
- package/dist/components/scale-input.d.ts +58 -0
- package/dist/components/scale-input.d.ts.map +1 -0
- package/dist/components/scale-input.js +170 -0
- package/dist/components/scale-input.js.map +1 -0
- package/dist/components/score-dial.d.ts +205 -0
- package/dist/components/score-dial.d.ts.map +1 -0
- package/dist/components/score-dial.js +728 -0
- package/dist/components/score-dial.js.map +1 -0
- package/dist/components/scroll-area.d.ts +38 -0
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +138 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/segmented-control.d.ts +69 -0
- package/dist/components/segmented-control.d.ts.map +1 -0
- package/dist/components/segmented-control.js +259 -0
- package/dist/components/segmented-control.js.map +1 -0
- package/dist/components/select.d.ts +72 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +205 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/sheet.d.ts +192 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +952 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/skeleton.d.ts +104 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +266 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +55 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +170 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/source-citation.d.ts +127 -0
- package/dist/components/source-citation.d.ts.map +1 -0
- package/dist/components/source-citation.js +391 -0
- package/dist/components/source-citation.js.map +1 -0
- package/dist/components/spinner.d.ts +86 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +97 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/status-pill.d.ts +90 -0
- package/dist/components/status-pill.d.ts.map +1 -0
- package/dist/components/status-pill.js +259 -0
- package/dist/components/status-pill.js.map +1 -0
- package/dist/components/stepper.d.ts +99 -0
- package/dist/components/stepper.d.ts.map +1 -0
- package/dist/components/stepper.js +152 -0
- package/dist/components/stepper.js.map +1 -0
- package/dist/components/surface.d.ts +92 -0
- package/dist/components/surface.d.ts.map +1 -0
- package/dist/components/surface.js +261 -0
- package/dist/components/surface.js.map +1 -0
- package/dist/components/switch.d.ts +48 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +152 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/symptom-picker.d.ts +69 -0
- package/dist/components/symptom-picker.d.ts.map +1 -0
- package/dist/components/symptom-picker.js +170 -0
- package/dist/components/symptom-picker.js.map +1 -0
- package/dist/components/tab-bar.d.ts +110 -0
- package/dist/components/tab-bar.d.ts.map +1 -0
- package/dist/components/tab-bar.js +118 -0
- package/dist/components/tab-bar.js.map +1 -0
- package/dist/components/table.d.ts +117 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +65 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +106 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +136 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/term.d.ts +243 -0
- package/dist/components/term.d.ts.map +1 -0
- package/dist/components/term.js +562 -0
- package/dist/components/term.js.map +1 -0
- package/dist/components/textarea.d.ts +157 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +66 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/timeline-entry.d.ts +99 -0
- package/dist/components/timeline-entry.d.ts.map +1 -0
- package/dist/components/timeline-entry.js +47 -0
- package/dist/components/timeline-entry.js.map +1 -0
- package/dist/components/toast.d.ts +80 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +266 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/tooltip.d.ts +48 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +159 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/trend-sparkline.d.ts +188 -0
- package/dist/components/trend-sparkline.d.ts.map +1 -0
- package/dist/components/trend-sparkline.js +796 -0
- package/dist/components/trend-sparkline.js.map +1 -0
- package/dist/components/value.d.ts +150 -0
- package/dist/components/value.d.ts.map +1 -0
- package/dist/components/value.js +402 -0
- package/dist/components/value.js.map +1 -0
- package/dist/components/visually-hidden.d.ts +61 -0
- package/dist/components/visually-hidden.d.ts.map +1 -0
- package/dist/components/visually-hidden.js +172 -0
- package/dist/components/visually-hidden.js.map +1 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/opsinjs.d.ts +443 -0
- package/dist/opsinjs.d.ts.map +1 -0
- package/dist/opsinjs.js +906 -0
- package/dist/opsinjs.js.map +1 -0
- package/dist/status.d.ts +111 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +125 -0
- package/dist/status.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +82 -0
- package/dist/utils.js.map +1 -0
- package/package.json +86 -3
- package/styles/base.css +132 -0
- package/styles/roles.css +412 -0
- package/styles/standalone.css +20 -0
- package/styles/tailwind.css +18 -0
- package/styles/theme.css +309 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ResultCard is one result, complete: what was measured, the number, where it
|
|
3
|
+
* sits against the range somebody supplied, what that means in words, and what
|
|
4
|
+
* to do next.
|
|
5
|
+
*
|
|
6
|
+
* THIS FILE COMPOSES AND IT DOES NOT RE-IMPLEMENT. Every number goes through
|
|
7
|
+
* `Value`, every level goes through `StatusPill`, every comparison against an
|
|
8
|
+
* interval goes through `RangeBar`, every instant goes through `RelativeTime`,
|
|
9
|
+
* every control that acts goes through `Button`, and every control that
|
|
10
|
+
* navigates goes through `Link`.
|
|
11
|
+
* Nothing here formats a number, draws a level, positions a tick or decides
|
|
12
|
+
* when a reading is old. A composite that re-implemented any of those would be
|
|
13
|
+
* a second copy of a rule, and the two colour axes are the one thing in this
|
|
14
|
+
* system that must never say two different things in two places.
|
|
15
|
+
*
|
|
16
|
+
* WHAT IT ASSERTS. That a measurement was taken, at an instant, in a unit; and,
|
|
17
|
+
* where the product supplied them, which interval it is being compared with and
|
|
18
|
+
* which level of attention the product has assigned to it. Each of those is a
|
|
19
|
+
* separate claim, each may be absent on its own, and an absent one renders as
|
|
20
|
+
* an absence rather than as a substituted default.
|
|
21
|
+
*
|
|
22
|
+
* IT DERIVES NO LEVEL. `status` is an input. There is no comparison in this
|
|
23
|
+
* file between a reading and a bound, and there will not be one: turning
|
|
24
|
+
* "outside the range" into "needs attention" needs a clinician or a validated
|
|
25
|
+
* rule, and it belongs to whoever owns the range. Most people sit outside at
|
|
26
|
+
* least one reference interval at any moment.
|
|
27
|
+
*
|
|
28
|
+
* THE TWO AXES SIT ON DIFFERENT ELEMENTS, and this component is the worked
|
|
29
|
+
* example of that rule. The card's surface is neutral at every level. A card
|
|
30
|
+
* whose whole background turns amber converts one measurement into an emotional
|
|
31
|
+
* event, and a screen of four of them is unreadable. The status axis reaches
|
|
32
|
+
* exactly one element, the pill, which is a child of the header. The category
|
|
33
|
+
* axis reaches exactly one element, the title, which is its sibling. No element
|
|
34
|
+
* resolves both, so there is nothing here for `axisConflict()` to report.
|
|
35
|
+
* Calling it on the props object would be the mistake, because a card given a
|
|
36
|
+
* category AND a level is the correct shape rather than the collision.
|
|
37
|
+
*
|
|
38
|
+
* IT OWNS NO CLINICAL NUMBER. No interval, no staleness boundary, no
|
|
39
|
+
* plausibility bound, no precision default. `staleAfterHours` is passed
|
|
40
|
+
* straight through to `RelativeTime`, which is where the boundary is applied;
|
|
41
|
+
* omit it and there is no staleness treatment at all, which is the honest
|
|
42
|
+
* output when nobody has said what old means for this measurement.
|
|
43
|
+
*
|
|
44
|
+
* AND IT SHIPS NO DISCLAIMER. The specification's part list asks the footnote
|
|
45
|
+
* to carry a not-medical-advice note "by rule"; this file renders provenance
|
|
46
|
+
* there and nothing else. Default legal text is the one string opsinjs may
|
|
47
|
+
* never ship. It is jurisdictional, it is the product's to write, and a
|
|
48
|
+
* sentence supplied by a design system is a sentence nobody reviewed. The
|
|
49
|
+
* component for it is `DisclaimerNote`, placed by the product.
|
|
50
|
+
*
|
|
51
|
+
* NOTHING ANIMATES. Not the number, not the bar, not the card's arrival. A
|
|
52
|
+
* health value that comes in by animation has displayed, for every frame of the
|
|
53
|
+
* journey, a figure that is not true.
|
|
54
|
+
*/
|
|
55
|
+
import { type ReactNode } from "react";
|
|
56
|
+
import { type ClinicalStatus, type HealthCategory, type ReferenceRange } from "../opsinjs.ts";
|
|
57
|
+
/**
|
|
58
|
+
* One part of a compound reading. A compound reading is the two numbers that
|
|
59
|
+
* are one measurement.
|
|
60
|
+
*
|
|
61
|
+
* THIS IS THE RESOLUTION OF A CONTRADICTION IN THE SPECIFICATION, and it is
|
|
62
|
+
* recorded here as well as on the page. The proposed interface typed `value` as
|
|
63
|
+
* `number | string | null` so that "128/78" could be passed as text, while the
|
|
64
|
+
* part tree routed every reading through `Value`, whose `value` is
|
|
65
|
+
* `number | null`. A string has nowhere to go: it cannot be formatted to the
|
|
66
|
+
* measurement's precision, cannot be shaped for a locale, cannot have its unit
|
|
67
|
+
* spoken, and cannot be published as a machine-readable datum. Each of those is
|
|
68
|
+
* a thing `Value` exists to do, and each is a promise the rest of this system
|
|
69
|
+
* has already made about numbers. So the compound reading is a list of numbers,
|
|
70
|
+
* each of which is a real `Value`, which is the same shape `ReadingInput` uses
|
|
71
|
+
* to take one in.
|
|
72
|
+
*
|
|
73
|
+
* Each segment carries a `label` because "128 over 78" is meaningless read
|
|
74
|
+
* aloud without one, and the labels are the product's words rather than this
|
|
75
|
+
* component's: opsinjs does not know which measurements are compound, and a
|
|
76
|
+
* built-in list of them would be a clinical vocabulary shipped as a default.
|
|
77
|
+
*/
|
|
78
|
+
export interface ResultSegment {
|
|
79
|
+
/**
|
|
80
|
+
* What this part of the reading is, in the reader's language. This is the
|
|
81
|
+
* word a listener needs before the number for the pair to mean anything. It
|
|
82
|
+
* is announced and is not drawn: on screen the two numbers are separated by a
|
|
83
|
+
* solidus, the way the measurement is written.
|
|
84
|
+
*/
|
|
85
|
+
label: string;
|
|
86
|
+
/**
|
|
87
|
+
* This part's number. `null` is a first-class state meaning this part is
|
|
88
|
+
* missing, and it is never rendered as `0`. Half a compound reading is not
|
|
89
|
+
* a compound reading of zero.
|
|
90
|
+
*/
|
|
91
|
+
value: number | null;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A next step attached to a result.
|
|
95
|
+
*
|
|
96
|
+
* `href` navigates and renders an anchor; `onSelect` acts and renders a button.
|
|
97
|
+
* Supply one. A card given both renders the link, because a destination
|
|
98
|
+
* survives a new tab, a copied address and a screen reader's list of links, and
|
|
99
|
+
* a handler survives none of those.
|
|
100
|
+
*/
|
|
101
|
+
export interface ResultAction {
|
|
102
|
+
/**
|
|
103
|
+
* Imperative, specific, and honest about who is asking. The visible label is
|
|
104
|
+
* the accessible name, so "Book a repeat test" is an action and "learn more"
|
|
105
|
+
* is a link pretending to be one.
|
|
106
|
+
*/
|
|
107
|
+
label: string;
|
|
108
|
+
/** Where it goes. Preferred over `onSelect` wherever the step has an address. */
|
|
109
|
+
href?: string;
|
|
110
|
+
/**
|
|
111
|
+
* What it does, where there is nowhere to go. A function cannot cross the
|
|
112
|
+
* server/client boundary, so a card given one is being rendered by a client
|
|
113
|
+
* component already. See the note on the client boundary at the foot of
|
|
114
|
+
* this file.
|
|
115
|
+
*/
|
|
116
|
+
onSelect?: () => void;
|
|
117
|
+
/**
|
|
118
|
+
* At most one action per card. The recommended one is rendered in the fuller
|
|
119
|
+
* treatment and is expected to be first; a card whose recommended action is
|
|
120
|
+
* not the first one is reported in development rather than silently
|
|
121
|
+
* re-ordered, because the order on screen is the caller's to decide.
|
|
122
|
+
*/
|
|
123
|
+
recommended?: boolean;
|
|
124
|
+
}
|
|
125
|
+
export interface ResultCardProps {
|
|
126
|
+
/**
|
|
127
|
+
* What was measured, in the reader's language rather than an internal code.
|
|
128
|
+
* It is the card's accessible name and the card's heading, and it is the one
|
|
129
|
+
* part with no honest fallback.
|
|
130
|
+
*/
|
|
131
|
+
title: string;
|
|
132
|
+
/**
|
|
133
|
+
* The heading level for the title, so the card fits the outline of the page
|
|
134
|
+
* it is on rather than imposing one. Appearance does not follow it: the type
|
|
135
|
+
* step is set explicitly, so an `h4` card and an `h2` card look identical.
|
|
136
|
+
*
|
|
137
|
+
* @default 3
|
|
138
|
+
*/
|
|
139
|
+
titleLevel?: 2 | 3 | 4 | 5 | 6;
|
|
140
|
+
/**
|
|
141
|
+
* The reading. `null` renders the absence form. That form is in words, never
|
|
142
|
+
* as `0` and never as a bare dash, because zero is a real measurement for
|
|
143
|
+
* several metrics and a missing one is not a measurement at all.
|
|
144
|
+
*
|
|
145
|
+
* Omit it only when the reading is compound and arrives through `segments`.
|
|
146
|
+
*/
|
|
147
|
+
value?: number | null;
|
|
148
|
+
/**
|
|
149
|
+
* A compound reading: two or more numbers that are one measurement, such as
|
|
150
|
+
* the pair in a blood-pressure result. Each segment is a real `Value`, so
|
|
151
|
+
* each is formatted, shaped and spoken like every other number in the system.
|
|
152
|
+
* When this is supplied, `value` is not read.
|
|
153
|
+
*/
|
|
154
|
+
segments?: ResultSegment[];
|
|
155
|
+
/**
|
|
156
|
+
* Display symbol exactly as `tokens/units.json` spells it, as in "kg",
|
|
157
|
+
* "mmol/L" or "mmHg". It reaches every number on the card, so one card cannot
|
|
158
|
+
* show two units. `Value` resolves the spoken form from that table, which is
|
|
159
|
+
* why a listener hears "millimoles per mole" rather than the symbol read out
|
|
160
|
+
* letter by letter, and why a unit the table does not hold is rendered as
|
|
161
|
+
* written rather than pronounced by guesswork.
|
|
162
|
+
*/
|
|
163
|
+
unit?: string;
|
|
164
|
+
/**
|
|
165
|
+
* DECIMAL PLACES, from the precision of the measurement. That is the
|
|
166
|
+
* resolution of the device, or the number of places the laboratory reported.
|
|
167
|
+
* Not significant figures: the same metric shown to a different number of
|
|
168
|
+
* decimal places at different magnitudes cannot be compared at a glance.
|
|
169
|
+
*
|
|
170
|
+
* It reaches the reading, every segment of a compound one, and both boundary
|
|
171
|
+
* labels on the bar, because a reading and the bound it is compared with are
|
|
172
|
+
* the same metric. It is required, so a TypeScript caller cannot omit it and
|
|
173
|
+
* the omission that once printed a raw double is a compile error rather than a
|
|
174
|
+
* development warning. This file ships as source into JavaScript projects,
|
|
175
|
+
* where a required prop is advice and not a guarantee, so a value that still
|
|
176
|
+
* arrives without one is forwarded to `Value` unchanged and `Value` decides
|
|
177
|
+
* what an unstated precision does.
|
|
178
|
+
*/
|
|
179
|
+
precision: number;
|
|
180
|
+
/**
|
|
181
|
+
* BCP 47 locale for separators, digit shaping and the dates. It reaches every
|
|
182
|
+
* number and every instant on the card, so one card cannot show two
|
|
183
|
+
* conventions. Omitted, the reader's own environment decides.
|
|
184
|
+
*/
|
|
185
|
+
locale?: string;
|
|
186
|
+
/**
|
|
187
|
+
* IANA time zone name, as in `Europe/London`, handed straight through to
|
|
188
|
+
* `RelativeTime` for the absolute date and time. Supply it and the reading is
|
|
189
|
+
* put on that zone's wall clock with no zone label, because it is then the
|
|
190
|
+
* reader's own clock and there is nothing to disambiguate. Omit it and the
|
|
191
|
+
* absolute time is the wall clock the reading was written in, with its offset
|
|
192
|
+
* named. This card always shows the absolute time, so a wrong wall clock is
|
|
193
|
+
* most visible here: a product that knows the reader's zone should pass it,
|
|
194
|
+
* and one that does not must omit it rather than guess, because a guessed zone
|
|
195
|
+
* is a wrong time carrying a confident label. An offset such as `+01:00` is
|
|
196
|
+
* not accepted, and an unrecognised or ambiguous name falls back to the offset
|
|
197
|
+
* form; `RelativeTime` owns that guard and this prop only forwards.
|
|
198
|
+
*/
|
|
199
|
+
timeZone?: string;
|
|
200
|
+
/**
|
|
201
|
+
* When the measurement was taken, ISO 8601 with an offset. The time of
|
|
202
|
+
* MEASUREMENT, never of retrieval, of sync or of render: a fetch timestamp
|
|
203
|
+
* here tells a reader their four-month-old reading was taken this morning.
|
|
204
|
+
*
|
|
205
|
+
* REQUIRED, AND WITH NO ABSENCE FORM. That is a known gap rather than a
|
|
206
|
+
* decision. Every other claim on this card degrades to a stated absence, and
|
|
207
|
+
* this one cannot: a card given `value={null}` still renders an instant at
|
|
208
|
+
* which that missing reading was measured. Do not invent one to satisfy the
|
|
209
|
+
* type. `RelativeTime`, which owns every instant in this system, has no
|
|
210
|
+
* absence form either, and inventing a sentence here would be a second copy
|
|
211
|
+
* of a rule that belongs there. Until it has one, a card whose reading is
|
|
212
|
+
* absent should not be given a measurement time the product does not have.
|
|
213
|
+
*/
|
|
214
|
+
measuredAt: string;
|
|
215
|
+
/**
|
|
216
|
+
* The instant the card is being read against, in the same form as
|
|
217
|
+
* `measuredAt`. Required, because a component that read the clock itself
|
|
218
|
+
* would read it once per card rather than once per screen and make a page of
|
|
219
|
+
* results disagree with itself across a minute boundary. Read it once where
|
|
220
|
+
* the screen is rendered. Use `new Date().toISOString()` and pass the same
|
|
221
|
+
* value to every card on it.
|
|
222
|
+
*/
|
|
223
|
+
now: string;
|
|
224
|
+
/**
|
|
225
|
+
* Hours after which the card shows its staleness treatment. The product owns
|
|
226
|
+
* this number because it is clinical rather than visual, and it differs
|
|
227
|
+
* completely by measurement. There is no default: omit it and there is no
|
|
228
|
+
* staleness treatment at all, which is the honest output when nobody has said
|
|
229
|
+
* what old means here.
|
|
230
|
+
*/
|
|
231
|
+
staleAfterHours?: number;
|
|
232
|
+
/**
|
|
233
|
+
* The interval this reading is being compared with, and whose it is. Omit it
|
|
234
|
+
* when there is none: the bar is then not drawn at all and nothing is
|
|
235
|
+
* substituted. Never defaulted, in any population, for any metric.
|
|
236
|
+
*
|
|
237
|
+
* It is drawn only where there is also a `unit` and a single `value`. A bar
|
|
238
|
+
* needs a scale, a scale needs a unit to be read in, and a compound reading
|
|
239
|
+
* has no single position on one line.
|
|
240
|
+
*/
|
|
241
|
+
range?: ReferenceRange;
|
|
242
|
+
/**
|
|
243
|
+
* The level of attention the PRODUCT has assigned to this result. Never
|
|
244
|
+
* derived here from `value` and `range`, and the derivation is not missing.
|
|
245
|
+
* It is refused. Omitted, no pill is rendered and no level is stated, which
|
|
246
|
+
* is what "nobody has made a judgement about this" looks like rather than a
|
|
247
|
+
* quiet reassurance.
|
|
248
|
+
*/
|
|
249
|
+
status?: ClinicalStatus;
|
|
250
|
+
/**
|
|
251
|
+
* What the reading is ABOUT, for finding the heart results among the sleep
|
|
252
|
+
* results. It tints the title and nothing else: never the card's surface,
|
|
253
|
+
* never the pill, never the bar. Typed to the six rather than to `string`,
|
|
254
|
+
* because a component that accepts an arbitrary category accepts a seventh
|
|
255
|
+
* colour ramp that does not exist.
|
|
256
|
+
*/
|
|
257
|
+
category?: HealthCategory;
|
|
258
|
+
/**
|
|
259
|
+
* The plain-English paragraph: what the test looks at, what this result means
|
|
260
|
+
* in context, what usually happens next. Absent, the card says in words that
|
|
261
|
+
* there is no explanation rather than rendering nothing. Silence reads as
|
|
262
|
+
* reassurance, and it is the default nobody chose.
|
|
263
|
+
*/
|
|
264
|
+
meaning?: ReactNode;
|
|
265
|
+
/**
|
|
266
|
+
* The one-line position sentence for the bar, handed straight through to
|
|
267
|
+
* `RangeBar`. It replaces the sentence the bar would generate from the reading
|
|
268
|
+
* and its interval, for a unit whose phrasing the template does not fit or a
|
|
269
|
+
* reader whose language is not English. It cannot remove the sentence: an
|
|
270
|
+
* empty string is refused by `RangeBar`, which renders its own line and reports
|
|
271
|
+
* the misuse rather than drawing a bar with no words.
|
|
272
|
+
*
|
|
273
|
+
* This is the BAR'S sentence, not the card's `meaning`. A product that wants
|
|
274
|
+
* the card to say less about the position says less here; deleting the
|
|
275
|
+
* explanation the reader came for is not what this prop is for, and it cannot
|
|
276
|
+
* do it. Omitted, the bar writes its own sentence, which is the default nobody
|
|
277
|
+
* has to choose.
|
|
278
|
+
*
|
|
279
|
+
* A replacement sentence replaces the attribution along with everything else.
|
|
280
|
+
* The generated sentence ends by naming whose interval this is, taken from
|
|
281
|
+
* `ReferenceRange.source`, and a supplied `summary` prints in its place and
|
|
282
|
+
* carries no attribution unless you write one into it. The card shows the
|
|
283
|
+
* source nowhere else, so a `summary` that omits it leaves a reading compared
|
|
284
|
+
* against an interval whose owner is named nowhere, which is the case
|
|
285
|
+
* `ReferenceRange.source` is required to prevent. State whose range it is
|
|
286
|
+
* inside the sentence you pass, or carry it in `provenance`.
|
|
287
|
+
*/
|
|
288
|
+
summary?: string;
|
|
289
|
+
/**
|
|
290
|
+
* The next steps, at most two. More than two is a screen rather than a card,
|
|
291
|
+
* and a third is dropped with a warning rather than rendered.
|
|
292
|
+
*/
|
|
293
|
+
actions?: ResultAction[];
|
|
294
|
+
/**
|
|
295
|
+
* Who measured it, with what device or assay, and where the range came from
|
|
296
|
+
* when that is not already on the bar. Rendered as the footnote. Omitted,
|
|
297
|
+
* there is no footnote: this component ships no default provenance and no
|
|
298
|
+
* default disclaimer.
|
|
299
|
+
*
|
|
300
|
+
* FREE TEXT, WITH NO PROVENANCE CLASS, AND THAT LIMITS WHAT A `status` HERE
|
|
301
|
+
* MAY MEAN. Data provenance and device accuracy sorts every value into four
|
|
302
|
+
* classes, which are clinically measured, device measured, device estimated
|
|
303
|
+
* and self-reported. It bounds what an interface may assert by the class: a
|
|
304
|
+
* device-estimated or self-reported value may not carry a clinical status on
|
|
305
|
+
* its own. This card cannot tell those apart, because nothing in the system
|
|
306
|
+
* carries the class yet. So the rule is the caller's to keep: do not pass a
|
|
307
|
+
* `status` derived from an estimated or self-reported value.
|
|
308
|
+
*/
|
|
309
|
+
provenance?: string;
|
|
310
|
+
/**
|
|
311
|
+
* Merged onto the root. Layout belongs here. A card sets no width and no
|
|
312
|
+
* place in a grid, because those are decisions of the screen it is on. A
|
|
313
|
+
* class passed here wins where the two conflict, `truncate` included, which
|
|
314
|
+
* is the one way to make a reading come back to somebody with digits missing.
|
|
315
|
+
*/
|
|
316
|
+
className?: string;
|
|
317
|
+
}
|
|
318
|
+
export declare function ResultCard({ title, titleLevel, value, segments, unit, precision, locale, timeZone, measuredAt, now, staleAfterHours, range, status, category, meaning, summary, actions, provenance, className, }: ResultCardProps): import("react").JSX.Element;
|
|
319
|
+
//# sourceMappingURL=result-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-card.d.ts","sourceRoot":"","sources":["../../src/components/result-card.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAgE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAqH3J;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;IACb,iFAAiF;IACjF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC9B;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,aAAa,EAAE,CAAA;IAC1B;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;;;;;;;;OAcG;IACH,SAAS,EAAE,MAAM,CAAA;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;;;;;;;;;OAaG;IACH,UAAU,EAAE,MAAM,CAAA;IAClB;;;;;;;OAOG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,cAAc,CAAA;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAA;IACzB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB;;;;;;;;;;;;;;OAcG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,UAAc,EACd,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,UAAU,EACV,GAAG,EACH,eAAe,EACf,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,OAAO,EACP,OAAO,EACP,UAAU,EACV,SAAS,GACV,EAAE,eAAe,+BAsjBjB"}
|