@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.
Files changed (266) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +21 -0
  3. package/README.md +114 -2
  4. package/dist/components/accordion.d.ts +82 -0
  5. package/dist/components/accordion.d.ts.map +1 -0
  6. package/dist/components/accordion.js +154 -0
  7. package/dist/components/accordion.js.map +1 -0
  8. package/dist/components/alert-banner.d.ts +291 -0
  9. package/dist/components/alert-banner.d.ts.map +1 -0
  10. package/dist/components/alert-banner.js +529 -0
  11. package/dist/components/alert-banner.js.map +1 -0
  12. package/dist/components/avatar.d.ts +45 -0
  13. package/dist/components/avatar.d.ts.map +1 -0
  14. package/dist/components/avatar.js +159 -0
  15. package/dist/components/avatar.js.map +1 -0
  16. package/dist/components/badge.d.ts +78 -0
  17. package/dist/components/badge.d.ts.map +1 -0
  18. package/dist/components/badge.js +32 -0
  19. package/dist/components/badge.js.map +1 -0
  20. package/dist/components/body-map.d.ts +51 -0
  21. package/dist/components/body-map.d.ts.map +1 -0
  22. package/dist/components/body-map.js +190 -0
  23. package/dist/components/body-map.js.map +1 -0
  24. package/dist/components/button.d.ts +260 -0
  25. package/dist/components/button.d.ts.map +1 -0
  26. package/dist/components/button.js +609 -0
  27. package/dist/components/button.js.map +1 -0
  28. package/dist/components/callout.d.ts +99 -0
  29. package/dist/components/callout.d.ts.map +1 -0
  30. package/dist/components/callout.js +285 -0
  31. package/dist/components/callout.js.map +1 -0
  32. package/dist/components/card.d.ts +156 -0
  33. package/dist/components/card.d.ts.map +1 -0
  34. package/dist/components/card.js +396 -0
  35. package/dist/components/card.js.map +1 -0
  36. package/dist/components/care-card.d.ts +182 -0
  37. package/dist/components/care-card.d.ts.map +1 -0
  38. package/dist/components/care-card.js +544 -0
  39. package/dist/components/care-card.js.map +1 -0
  40. package/dist/components/checkbox.d.ts +58 -0
  41. package/dist/components/checkbox.d.ts.map +1 -0
  42. package/dist/components/checkbox.js +167 -0
  43. package/dist/components/checkbox.js.map +1 -0
  44. package/dist/components/combobox.d.ts +71 -0
  45. package/dist/components/combobox.d.ts.map +1 -0
  46. package/dist/components/combobox.js +204 -0
  47. package/dist/components/combobox.js.map +1 -0
  48. package/dist/components/consent-sheet.d.ts +186 -0
  49. package/dist/components/consent-sheet.d.ts.map +1 -0
  50. package/dist/components/consent-sheet.js +452 -0
  51. package/dist/components/consent-sheet.js.map +1 -0
  52. package/dist/components/dialog.d.ts +108 -0
  53. package/dist/components/dialog.d.ts.map +1 -0
  54. package/dist/components/dialog.js +573 -0
  55. package/dist/components/dialog.js.map +1 -0
  56. package/dist/components/disclaimer-note.d.ts +144 -0
  57. package/dist/components/disclaimer-note.d.ts.map +1 -0
  58. package/dist/components/disclaimer-note.js +486 -0
  59. package/dist/components/disclaimer-note.js.map +1 -0
  60. package/dist/components/divider.d.ts +76 -0
  61. package/dist/components/divider.d.ts.map +1 -0
  62. package/dist/components/divider.js +101 -0
  63. package/dist/components/divider.js.map +1 -0
  64. package/dist/components/dose-tracker.d.ts +137 -0
  65. package/dist/components/dose-tracker.d.ts.map +1 -0
  66. package/dist/components/dose-tracker.js +154 -0
  67. package/dist/components/dose-tracker.js.map +1 -0
  68. package/dist/components/empty-state.d.ts +171 -0
  69. package/dist/components/empty-state.d.ts.map +1 -0
  70. package/dist/components/empty-state.js +387 -0
  71. package/dist/components/empty-state.js.map +1 -0
  72. package/dist/components/field.d.ts +195 -0
  73. package/dist/components/field.d.ts.map +1 -0
  74. package/dist/components/field.js +282 -0
  75. package/dist/components/field.js.map +1 -0
  76. package/dist/components/goal-ring.d.ts +114 -0
  77. package/dist/components/goal-ring.d.ts.map +1 -0
  78. package/dist/components/goal-ring.js +254 -0
  79. package/dist/components/goal-ring.js.map +1 -0
  80. package/dist/components/icon-button.d.ts +124 -0
  81. package/dist/components/icon-button.d.ts.map +1 -0
  82. package/dist/components/icon-button.js +113 -0
  83. package/dist/components/icon-button.js.map +1 -0
  84. package/dist/components/link.d.ts +122 -0
  85. package/dist/components/link.d.ts.map +1 -0
  86. package/dist/components/link.js +164 -0
  87. package/dist/components/link.js.map +1 -0
  88. package/dist/components/log-sheet.d.ts +259 -0
  89. package/dist/components/log-sheet.d.ts.map +1 -0
  90. package/dist/components/log-sheet.js +437 -0
  91. package/dist/components/log-sheet.js.map +1 -0
  92. package/dist/components/menu.d.ts +69 -0
  93. package/dist/components/menu.d.ts.map +1 -0
  94. package/dist/components/menu.js +190 -0
  95. package/dist/components/menu.js.map +1 -0
  96. package/dist/components/metric-tile.d.ts +301 -0
  97. package/dist/components/metric-tile.d.ts.map +1 -0
  98. package/dist/components/metric-tile.js +533 -0
  99. package/dist/components/metric-tile.js.map +1 -0
  100. package/dist/components/number-field.d.ts +62 -0
  101. package/dist/components/number-field.d.ts.map +1 -0
  102. package/dist/components/number-field.js +134 -0
  103. package/dist/components/number-field.js.map +1 -0
  104. package/dist/components/popover.d.ts +70 -0
  105. package/dist/components/popover.d.ts.map +1 -0
  106. package/dist/components/popover.js +174 -0
  107. package/dist/components/popover.js.map +1 -0
  108. package/dist/components/progress.d.ts +83 -0
  109. package/dist/components/progress.d.ts.map +1 -0
  110. package/dist/components/progress.js +140 -0
  111. package/dist/components/progress.js.map +1 -0
  112. package/dist/components/questionnaire.d.ts +123 -0
  113. package/dist/components/questionnaire.d.ts.map +1 -0
  114. package/dist/components/questionnaire.js +148 -0
  115. package/dist/components/questionnaire.js.map +1 -0
  116. package/dist/components/radio-group.d.ts +66 -0
  117. package/dist/components/radio-group.d.ts.map +1 -0
  118. package/dist/components/radio-group.js +186 -0
  119. package/dist/components/radio-group.js.map +1 -0
  120. package/dist/components/range-bar.d.ts +172 -0
  121. package/dist/components/range-bar.d.ts.map +1 -0
  122. package/dist/components/range-bar.js +578 -0
  123. package/dist/components/range-bar.js.map +1 -0
  124. package/dist/components/range-legend.d.ts +97 -0
  125. package/dist/components/range-legend.d.ts.map +1 -0
  126. package/dist/components/range-legend.js +166 -0
  127. package/dist/components/range-legend.js.map +1 -0
  128. package/dist/components/reading-input.d.ts +225 -0
  129. package/dist/components/reading-input.d.ts.map +1 -0
  130. package/dist/components/reading-input.js +651 -0
  131. package/dist/components/reading-input.js.map +1 -0
  132. package/dist/components/relative-time.d.ts +177 -0
  133. package/dist/components/relative-time.d.ts.map +1 -0
  134. package/dist/components/relative-time.js +603 -0
  135. package/dist/components/relative-time.js.map +1 -0
  136. package/dist/components/result-card.d.ts +319 -0
  137. package/dist/components/result-card.d.ts.map +1 -0
  138. package/dist/components/result-card.js +614 -0
  139. package/dist/components/result-card.js.map +1 -0
  140. package/dist/components/scale-input.d.ts +58 -0
  141. package/dist/components/scale-input.d.ts.map +1 -0
  142. package/dist/components/scale-input.js +170 -0
  143. package/dist/components/scale-input.js.map +1 -0
  144. package/dist/components/score-dial.d.ts +205 -0
  145. package/dist/components/score-dial.d.ts.map +1 -0
  146. package/dist/components/score-dial.js +728 -0
  147. package/dist/components/score-dial.js.map +1 -0
  148. package/dist/components/scroll-area.d.ts +38 -0
  149. package/dist/components/scroll-area.d.ts.map +1 -0
  150. package/dist/components/scroll-area.js +138 -0
  151. package/dist/components/scroll-area.js.map +1 -0
  152. package/dist/components/segmented-control.d.ts +69 -0
  153. package/dist/components/segmented-control.d.ts.map +1 -0
  154. package/dist/components/segmented-control.js +259 -0
  155. package/dist/components/segmented-control.js.map +1 -0
  156. package/dist/components/select.d.ts +72 -0
  157. package/dist/components/select.d.ts.map +1 -0
  158. package/dist/components/select.js +205 -0
  159. package/dist/components/select.js.map +1 -0
  160. package/dist/components/sheet.d.ts +192 -0
  161. package/dist/components/sheet.d.ts.map +1 -0
  162. package/dist/components/sheet.js +952 -0
  163. package/dist/components/sheet.js.map +1 -0
  164. package/dist/components/skeleton.d.ts +104 -0
  165. package/dist/components/skeleton.d.ts.map +1 -0
  166. package/dist/components/skeleton.js +266 -0
  167. package/dist/components/skeleton.js.map +1 -0
  168. package/dist/components/slider.d.ts +55 -0
  169. package/dist/components/slider.d.ts.map +1 -0
  170. package/dist/components/slider.js +170 -0
  171. package/dist/components/slider.js.map +1 -0
  172. package/dist/components/source-citation.d.ts +127 -0
  173. package/dist/components/source-citation.d.ts.map +1 -0
  174. package/dist/components/source-citation.js +391 -0
  175. package/dist/components/source-citation.js.map +1 -0
  176. package/dist/components/spinner.d.ts +86 -0
  177. package/dist/components/spinner.d.ts.map +1 -0
  178. package/dist/components/spinner.js +97 -0
  179. package/dist/components/spinner.js.map +1 -0
  180. package/dist/components/status-pill.d.ts +90 -0
  181. package/dist/components/status-pill.d.ts.map +1 -0
  182. package/dist/components/status-pill.js +259 -0
  183. package/dist/components/status-pill.js.map +1 -0
  184. package/dist/components/stepper.d.ts +99 -0
  185. package/dist/components/stepper.d.ts.map +1 -0
  186. package/dist/components/stepper.js +152 -0
  187. package/dist/components/stepper.js.map +1 -0
  188. package/dist/components/surface.d.ts +92 -0
  189. package/dist/components/surface.d.ts.map +1 -0
  190. package/dist/components/surface.js +261 -0
  191. package/dist/components/surface.js.map +1 -0
  192. package/dist/components/switch.d.ts +48 -0
  193. package/dist/components/switch.d.ts.map +1 -0
  194. package/dist/components/switch.js +152 -0
  195. package/dist/components/switch.js.map +1 -0
  196. package/dist/components/symptom-picker.d.ts +69 -0
  197. package/dist/components/symptom-picker.d.ts.map +1 -0
  198. package/dist/components/symptom-picker.js +170 -0
  199. package/dist/components/symptom-picker.js.map +1 -0
  200. package/dist/components/tab-bar.d.ts +110 -0
  201. package/dist/components/tab-bar.d.ts.map +1 -0
  202. package/dist/components/tab-bar.js +118 -0
  203. package/dist/components/tab-bar.js.map +1 -0
  204. package/dist/components/table.d.ts +117 -0
  205. package/dist/components/table.d.ts.map +1 -0
  206. package/dist/components/table.js +65 -0
  207. package/dist/components/table.js.map +1 -0
  208. package/dist/components/tabs.d.ts +106 -0
  209. package/dist/components/tabs.d.ts.map +1 -0
  210. package/dist/components/tabs.js +136 -0
  211. package/dist/components/tabs.js.map +1 -0
  212. package/dist/components/term.d.ts +243 -0
  213. package/dist/components/term.d.ts.map +1 -0
  214. package/dist/components/term.js +562 -0
  215. package/dist/components/term.js.map +1 -0
  216. package/dist/components/textarea.d.ts +157 -0
  217. package/dist/components/textarea.d.ts.map +1 -0
  218. package/dist/components/textarea.js +66 -0
  219. package/dist/components/textarea.js.map +1 -0
  220. package/dist/components/timeline-entry.d.ts +99 -0
  221. package/dist/components/timeline-entry.d.ts.map +1 -0
  222. package/dist/components/timeline-entry.js +47 -0
  223. package/dist/components/timeline-entry.js.map +1 -0
  224. package/dist/components/toast.d.ts +80 -0
  225. package/dist/components/toast.d.ts.map +1 -0
  226. package/dist/components/toast.js +266 -0
  227. package/dist/components/toast.js.map +1 -0
  228. package/dist/components/tooltip.d.ts +48 -0
  229. package/dist/components/tooltip.d.ts.map +1 -0
  230. package/dist/components/tooltip.js +159 -0
  231. package/dist/components/tooltip.js.map +1 -0
  232. package/dist/components/trend-sparkline.d.ts +188 -0
  233. package/dist/components/trend-sparkline.d.ts.map +1 -0
  234. package/dist/components/trend-sparkline.js +796 -0
  235. package/dist/components/trend-sparkline.js.map +1 -0
  236. package/dist/components/value.d.ts +150 -0
  237. package/dist/components/value.d.ts.map +1 -0
  238. package/dist/components/value.js +402 -0
  239. package/dist/components/value.js.map +1 -0
  240. package/dist/components/visually-hidden.d.ts +61 -0
  241. package/dist/components/visually-hidden.d.ts.map +1 -0
  242. package/dist/components/visually-hidden.js +172 -0
  243. package/dist/components/visually-hidden.js.map +1 -0
  244. package/dist/index.d.ts +63 -0
  245. package/dist/index.d.ts.map +1 -0
  246. package/dist/index.js +72 -0
  247. package/dist/index.js.map +1 -0
  248. package/dist/opsinjs.d.ts +443 -0
  249. package/dist/opsinjs.d.ts.map +1 -0
  250. package/dist/opsinjs.js +906 -0
  251. package/dist/opsinjs.js.map +1 -0
  252. package/dist/status.d.ts +111 -0
  253. package/dist/status.d.ts.map +1 -0
  254. package/dist/status.js +125 -0
  255. package/dist/status.js.map +1 -0
  256. package/dist/styles.css +2 -0
  257. package/dist/utils.d.ts +20 -0
  258. package/dist/utils.d.ts.map +1 -0
  259. package/dist/utils.js +82 -0
  260. package/dist/utils.js.map +1 -0
  261. package/package.json +86 -3
  262. package/styles/base.css +132 -0
  263. package/styles/roles.css +412 -0
  264. package/styles/standalone.css +20 -0
  265. package/styles/tailwind.css +18 -0
  266. 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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