@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,614 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ResultCard is one result, complete: what was measured, the number, where it
|
|
4
|
+
* sits against the range somebody supplied, what that means in words, and what
|
|
5
|
+
* to do next.
|
|
6
|
+
*
|
|
7
|
+
* THIS FILE COMPOSES AND IT DOES NOT RE-IMPLEMENT. Every number goes through
|
|
8
|
+
* `Value`, every level goes through `StatusPill`, every comparison against an
|
|
9
|
+
* interval goes through `RangeBar`, every instant goes through `RelativeTime`,
|
|
10
|
+
* every control that acts goes through `Button`, and every control that
|
|
11
|
+
* navigates goes through `Link`.
|
|
12
|
+
* Nothing here formats a number, draws a level, positions a tick or decides
|
|
13
|
+
* when a reading is old. A composite that re-implemented any of those would be
|
|
14
|
+
* a second copy of a rule, and the two colour axes are the one thing in this
|
|
15
|
+
* system that must never say two different things in two places.
|
|
16
|
+
*
|
|
17
|
+
* WHAT IT ASSERTS. That a measurement was taken, at an instant, in a unit; and,
|
|
18
|
+
* where the product supplied them, which interval it is being compared with and
|
|
19
|
+
* which level of attention the product has assigned to it. Each of those is a
|
|
20
|
+
* separate claim, each may be absent on its own, and an absent one renders as
|
|
21
|
+
* an absence rather than as a substituted default.
|
|
22
|
+
*
|
|
23
|
+
* IT DERIVES NO LEVEL. `status` is an input. There is no comparison in this
|
|
24
|
+
* file between a reading and a bound, and there will not be one: turning
|
|
25
|
+
* "outside the range" into "needs attention" needs a clinician or a validated
|
|
26
|
+
* rule, and it belongs to whoever owns the range. Most people sit outside at
|
|
27
|
+
* least one reference interval at any moment.
|
|
28
|
+
*
|
|
29
|
+
* THE TWO AXES SIT ON DIFFERENT ELEMENTS, and this component is the worked
|
|
30
|
+
* example of that rule. The card's surface is neutral at every level. A card
|
|
31
|
+
* whose whole background turns amber converts one measurement into an emotional
|
|
32
|
+
* event, and a screen of four of them is unreadable. The status axis reaches
|
|
33
|
+
* exactly one element, the pill, which is a child of the header. The category
|
|
34
|
+
* axis reaches exactly one element, the title, which is its sibling. No element
|
|
35
|
+
* resolves both, so there is nothing here for `axisConflict()` to report.
|
|
36
|
+
* Calling it on the props object would be the mistake, because a card given a
|
|
37
|
+
* category AND a level is the correct shape rather than the collision.
|
|
38
|
+
*
|
|
39
|
+
* IT OWNS NO CLINICAL NUMBER. No interval, no staleness boundary, no
|
|
40
|
+
* plausibility bound, no precision default. `staleAfterHours` is passed
|
|
41
|
+
* straight through to `RelativeTime`, which is where the boundary is applied;
|
|
42
|
+
* omit it and there is no staleness treatment at all, which is the honest
|
|
43
|
+
* output when nobody has said what old means for this measurement.
|
|
44
|
+
*
|
|
45
|
+
* AND IT SHIPS NO DISCLAIMER. The specification's part list asks the footnote
|
|
46
|
+
* to carry a not-medical-advice note "by rule"; this file renders provenance
|
|
47
|
+
* there and nothing else. Default legal text is the one string opsinjs may
|
|
48
|
+
* never ship. It is jurisdictional, it is the product's to write, and a
|
|
49
|
+
* sentence supplied by a design system is a sentence nobody reviewed. The
|
|
50
|
+
* component for it is `DisclaimerNote`, placed by the product.
|
|
51
|
+
*
|
|
52
|
+
* NOTHING ANIMATES. Not the number, not the bar, not the card's arrival. A
|
|
53
|
+
* health value that comes in by animation has displayed, for every frame of the
|
|
54
|
+
* journey, a figure that is not true.
|
|
55
|
+
*/
|
|
56
|
+
import { Fragment } from "react";
|
|
57
|
+
import { HEALTH_CATEGORIES, isDevelopment, isHealthCategory, warnOnce } from "../opsinjs.js";
|
|
58
|
+
import { cn } from "../utils.js";
|
|
59
|
+
import { Button, cardActionClassName } from "./button.js";
|
|
60
|
+
import { Link } from "./link.js";
|
|
61
|
+
import { RangeBar } from "./range-bar.js";
|
|
62
|
+
import { RelativeTime } from "./relative-time.js";
|
|
63
|
+
import { StatusPill } from "./status-pill.js";
|
|
64
|
+
import { Value } from "./value.js";
|
|
65
|
+
/**
|
|
66
|
+
* Development warnings, said once per distinct offender.
|
|
67
|
+
*
|
|
68
|
+
* `warnOnce` in the substrate is keyed to an `OpsinErrorCode`, and those codes
|
|
69
|
+
* describe mistakes a consumer makes with the CLINICAL api. Most of what this
|
|
70
|
+
* file complains about is a composition mistake instead, such as three actions,
|
|
71
|
+
* a range with no unit to read it in, or a reading supplied twice. A component
|
|
72
|
+
* may not mint a code: the table is generated from `tokens/errors.json` and is
|
|
73
|
+
* a versioned contract. So this file keeps its own small set, keyed on the
|
|
74
|
+
* offender rather than on the message, because a warning that repeats on every
|
|
75
|
+
* render is a channel somebody switches off, and switching it off costs the
|
|
76
|
+
* real warnings too. Under Strict Mode that warning repeats twice per render.
|
|
77
|
+
*
|
|
78
|
+
* Declared rather than allocated. In a production bundle `isDevelopment()` is
|
|
79
|
+
* statically false, every call below is dead code, and the set is never made.
|
|
80
|
+
*/
|
|
81
|
+
let warned;
|
|
82
|
+
function warnDev(key, message) {
|
|
83
|
+
if (!isDevelopment())
|
|
84
|
+
return;
|
|
85
|
+
warned ??= new Set();
|
|
86
|
+
if (warned.has(key))
|
|
87
|
+
return;
|
|
88
|
+
warned.add(key);
|
|
89
|
+
console.warn(message);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The one form of a timestamp `RelativeTime` will actually render: an RFC 3339
|
|
93
|
+
* instant that carries an offset, `Z` included. It is a verbatim copy of the
|
|
94
|
+
* pattern `relative-time.tsx` enforces, kept local on purpose. That file
|
|
95
|
+
* refuses a floating local time because `new Date("2026-03-14T08:12")` is read
|
|
96
|
+
* in whichever zone the code runs in, so one reading becomes two different ages
|
|
97
|
+
* on a server and on a phone, and it renders nothing rather than a plausible
|
|
98
|
+
* wrong instant.
|
|
99
|
+
*
|
|
100
|
+
* Lifting the parser into the shared substrate is a larger change than this card
|
|
101
|
+
* should make, and two other files already carry a local copy of a guard for
|
|
102
|
+
* the same reason, so a third is the established pattern rather than a new
|
|
103
|
+
* inconsistency.
|
|
104
|
+
*/
|
|
105
|
+
const RFC_3339_WITH_OFFSET = /^(\d{4})-(\d{2})-(\d{2})[Tt ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:([Zz])|([+-])(\d{2}):?(\d{2}))$/;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the header will actually put this instant on the screen. The card may
|
|
108
|
+
* delegate the reading's recency to the bar only when this holds, because the
|
|
109
|
+
* header renders nothing for a timestamp `RelativeTime` cannot locate, and a
|
|
110
|
+
* delegated bar prints nothing either. An offset-less `measuredAt` that passed
|
|
111
|
+
* unguarded would leave a number on a health surface with no time beside it,
|
|
112
|
+
* which every reader takes as now, and that is the exact failure delegation
|
|
113
|
+
* must not cause. The numeric checks mirror `parseInstant` so this answers the
|
|
114
|
+
* same question the header does rather than a looser one.
|
|
115
|
+
*/
|
|
116
|
+
function statesInstant(measuredAt) {
|
|
117
|
+
const match = RFC_3339_WITH_OFFSET.exec(measuredAt);
|
|
118
|
+
if (match === null)
|
|
119
|
+
return false;
|
|
120
|
+
const fields = match;
|
|
121
|
+
const year = Number(fields[1]);
|
|
122
|
+
const month = Number(fields[2]);
|
|
123
|
+
const day = Number(fields[3]);
|
|
124
|
+
const hour = Number(fields[4]);
|
|
125
|
+
const minute = Number(fields[5]);
|
|
126
|
+
const second = fields[6] === undefined ? 0 : Number(fields[6]);
|
|
127
|
+
if (month < 1 || month > 12 || day < 1 || day > 31)
|
|
128
|
+
return false;
|
|
129
|
+
if (hour > 23 || minute > 59 || second > 59)
|
|
130
|
+
return false;
|
|
131
|
+
if (fields[8] === undefined) {
|
|
132
|
+
const offsetHours = Number(fields[10]);
|
|
133
|
+
const offsetRest = Number(fields[11]);
|
|
134
|
+
if (offsetHours > 23 || offsetRest > 59)
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
const wallClock = Date.UTC(year, month - 1, day, hour, minute, second);
|
|
138
|
+
if (!Number.isFinite(wallClock))
|
|
139
|
+
return false;
|
|
140
|
+
const check = new Date(wallClock);
|
|
141
|
+
return (check.getUTCFullYear() === year &&
|
|
142
|
+
check.getUTCMonth() === month - 1 &&
|
|
143
|
+
check.getUTCDate() === day);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The category tint, on the title and on nothing else.
|
|
147
|
+
*
|
|
148
|
+
* Written out as literal class strings because Tailwind reads class names out
|
|
149
|
+
* of source as text: `text-category-${category}-ink` generates no CSS at all
|
|
150
|
+
* and the title renders in the inherited colour, which is the failure that
|
|
151
|
+
* looks like nothing happening.
|
|
152
|
+
*
|
|
153
|
+
* `-ink` rather than the bare name, which is the ACCENT role on this axis. The
|
|
154
|
+
* ACCENT role is the identity fill, chosen for recognition rather than for
|
|
155
|
+
* contrast, and never text. The asymmetry between the axes is real and is worth
|
|
156
|
+
* restating: the bare status name is the LINE role, the bare category name is
|
|
157
|
+
* the ACCENT role.
|
|
158
|
+
*
|
|
159
|
+
* Category colour is identity. It says what this reading is about, and never a
|
|
160
|
+
* verdict, so no word accompanies it. In greyscale it says nothing, and nothing
|
|
161
|
+
* is what it is entitled to say: the title beside it already names the
|
|
162
|
+
* measurement in full.
|
|
163
|
+
*/
|
|
164
|
+
const CATEGORY_INK = {
|
|
165
|
+
sleep: "text-category-sleep-ink",
|
|
166
|
+
heart: "text-category-heart-ink",
|
|
167
|
+
activity: "text-category-activity-ink",
|
|
168
|
+
nutrition: "text-category-nutrition-ink",
|
|
169
|
+
mind: "text-category-mind-ink",
|
|
170
|
+
labs: "text-category-labs-ink",
|
|
171
|
+
};
|
|
172
|
+
export function ResultCard({ title, titleLevel = 3, value, segments, unit, precision, locale, timeZone, measuredAt, now, staleAfterHours, range, status, category, meaning, summary, actions, provenance, className, }) {
|
|
173
|
+
const heading = typeof title === "string" ? title.trim() : "";
|
|
174
|
+
if (heading === "") {
|
|
175
|
+
warnDev("no-title", "[opsinjs] <ResultCard> was given no title. The title is the card's " +
|
|
176
|
+
"accessible name and its heading, and a result nobody can name is a " +
|
|
177
|
+
"number on a page. There is no fallback for it: a card headed " +
|
|
178
|
+
"'Result' tells a reader nothing they did not already know.");
|
|
179
|
+
}
|
|
180
|
+
/* The category, checked rather than trusted. This file ships as source into
|
|
181
|
+
JavaScript projects where a type is advice, and a seventh category is a
|
|
182
|
+
seventh colour ramp that does not exist. So an unknown one is reported and
|
|
183
|
+
the title is left in the inherited colour rather than tinted from a ramp
|
|
184
|
+
picked at random. */
|
|
185
|
+
let tint;
|
|
186
|
+
if (category !== undefined) {
|
|
187
|
+
if (isHealthCategory(category)) {
|
|
188
|
+
tint = category;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
warnOnce("OPSIN-0010", {
|
|
192
|
+
category: String(category),
|
|
193
|
+
known: HEALTH_CATEGORIES.join(", "),
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
/* THE COMPOUND READING WINS, AND IT SAYS SO. Two readings for one result is a
|
|
198
|
+
contradiction rather than a preference, and the more specific of the two is
|
|
199
|
+
the one the caller had to build deliberately. Rendering both would put two
|
|
200
|
+
different numbers on one card under one title. */
|
|
201
|
+
/* A LABEL IS THE WHOLE REASON A SEGMENT IS A SEGMENT, so a blank one is
|
|
202
|
+
dropped rather than announced. `{ label: "", value: 128 }` renders an
|
|
203
|
+
sr-only ", " and a listener hears ", 128 millimetres of mercury". That is
|
|
204
|
+
a bare number in a health context, which is the ambiguity the label exists
|
|
205
|
+
to prevent. Trimmed like `title`, `provenance` and an action's label, which
|
|
206
|
+
were already checked for content rather than for type. */
|
|
207
|
+
const offered = segments ?? [];
|
|
208
|
+
const parts = offered.filter((segment) => typeof segment?.label === "string" && segment.label.trim() !== "");
|
|
209
|
+
if (parts.length < offered.length) {
|
|
210
|
+
warnDev(`segment-no-label:${heading}`, `[opsinjs] <ResultCard> titled "${heading}" was given a segment with no ` +
|
|
211
|
+
"label. On screen the parts of a compound reading are separated by a " +
|
|
212
|
+
"solidus; read aloud, the label is the only thing that says which part " +
|
|
213
|
+
"is which, and \"128 over 78\" means nothing without one. The unlabelled " +
|
|
214
|
+
"segments were dropped.");
|
|
215
|
+
}
|
|
216
|
+
const compound = parts.length > 0;
|
|
217
|
+
if (compound && value !== undefined && value !== null) {
|
|
218
|
+
warnDev(`two-readings:${heading}`, `[opsinjs] <ResultCard> titled "${heading}" was given both \`value\` and ` +
|
|
219
|
+
"`segments`. They are two answers to one question, and the card cannot " +
|
|
220
|
+
"show a result twice under one title. The segments were rendered and " +
|
|
221
|
+
"the single value was not; pass one or the other.");
|
|
222
|
+
}
|
|
223
|
+
/* A BAR NEEDS A SCALE, AND A SCALE NEEDS A UNIT TO BE READ IN. Three separate
|
|
224
|
+
reasons to draw nothing, and each of them prints rather than being repaired
|
|
225
|
+
with a guess: a compound reading has no single position on one line; a bar
|
|
226
|
+
with no unit would label its bounds with bare numbers, which is the exact
|
|
227
|
+
ambiguity OPSIN-0003 exists for; and RangeBar refuses an unattributed range
|
|
228
|
+
itself, which is where OPSIN-0004 is reported rather than here. */
|
|
229
|
+
const barReadable = range !== undefined && unit !== undefined && !compound;
|
|
230
|
+
/* Whether the header actually puts the reading's instant on the screen. Only
|
|
231
|
+
then may the bar be told the recency is already stated; otherwise the bar
|
|
232
|
+
keeps stating it, so the fact is never lost. */
|
|
233
|
+
const instantStated = statesInstant(measuredAt);
|
|
234
|
+
if (range !== undefined && unit === undefined) {
|
|
235
|
+
warnDev(`range-no-unit:${heading}`, `[opsinjs] <ResultCard> titled "${heading}" was given a \`range\` and no ` +
|
|
236
|
+
"`unit`. A comparison drawn without one labels its bounds with bare " +
|
|
237
|
+
"numbers, and the same digits are one interval in mmol/L and a very " +
|
|
238
|
+
"different one in mg/dL. No bar was drawn. Pass the unit the reading " +
|
|
239
|
+
"was measured in.");
|
|
240
|
+
}
|
|
241
|
+
if (range !== undefined && compound) {
|
|
242
|
+
warnDev(`range-compound:${heading}`, `[opsinjs] <ResultCard> titled "${heading}" was given a \`range\` and a ` +
|
|
243
|
+
"compound reading. Two numbers have no single position on one line, so " +
|
|
244
|
+
"no bar was drawn. A compound reading compared against an interval " +
|
|
245
|
+
"needs one bar per part, which is a layout this component does not " +
|
|
246
|
+
"have and a caller can build from RangeBar directly.");
|
|
247
|
+
}
|
|
248
|
+
/* At most two, and the third is dropped rather than drawn. A card is the
|
|
249
|
+
surface where a reader decides what to do next, and a list of choices is
|
|
250
|
+
the shape that stops them deciding. */
|
|
251
|
+
const supplied = actions?.filter((action) => typeof action?.label === "string") ?? [];
|
|
252
|
+
if (supplied.length > 2) {
|
|
253
|
+
warnDev(`too-many-actions:${heading}`, `[opsinjs] <ResultCard> titled "${heading}" was given ${String(supplied.length)} ` +
|
|
254
|
+
"actions. At most two are rendered: more than two is a screen rather " +
|
|
255
|
+
"than a card, and a row of equal-weight choices is how a reader ends up " +
|
|
256
|
+
"taking none of them. The rest were dropped.");
|
|
257
|
+
}
|
|
258
|
+
const steps = supplied.slice(0, 2);
|
|
259
|
+
if (steps.filter((action) => action.recommended === true).length > 1) {
|
|
260
|
+
warnDev(`two-recommended:${heading}`, `[opsinjs] <ResultCard> titled "${heading}" marks more than one action as ` +
|
|
261
|
+
"recommended. A recommendation that covers everything recommends " +
|
|
262
|
+
"nothing. The first one was rendered in the fuller treatment.");
|
|
263
|
+
}
|
|
264
|
+
if (steps.length > 1 && steps[0]?.recommended !== true && steps.some((a) => a.recommended)) {
|
|
265
|
+
warnDev(`recommended-not-first:${heading}`, `[opsinjs] <ResultCard> titled "${heading}" puts its recommended action ` +
|
|
266
|
+
"after another one. The order on screen is yours and nothing was " +
|
|
267
|
+
"re-ordered. But a reader takes the first control they reach, and the " +
|
|
268
|
+
"reading order is the one a keyboard and a screen reader follow.");
|
|
269
|
+
}
|
|
270
|
+
const firstRecommended = steps.findIndex((action) => action.recommended === true);
|
|
271
|
+
/* THE LEVEL IS CHECKED, LIKE EVERY OTHER PROP THIS FILE TRUSTS NOBODY ABOUT.
|
|
272
|
+
A type is advice in the JavaScript project this file ships into, and
|
|
273
|
+
`titleLevel={7}` builds `<h7>`. That is an unknown element with no heading
|
|
274
|
+
role at all, so the card's own name silently stops being a heading and
|
|
275
|
+
leaves the outline. `titleLevel={1}` puts a second `h1` on the page. Both
|
|
276
|
+
fall back to the documented default rather than being rendered. */
|
|
277
|
+
const LEVELS = [2, 3, 4, 5, 6];
|
|
278
|
+
let level = titleLevel;
|
|
279
|
+
if (!LEVELS.includes(level)) {
|
|
280
|
+
warnDev(`title-level:${String(titleLevel)}`, `[opsinjs] <ResultCard> was given titleLevel ${String(titleLevel)}. The ` +
|
|
281
|
+
"title is a real heading and the level has to be one a document outline " +
|
|
282
|
+
"has: 2 to 6. An h1 makes a card compete with the page's own name and " +
|
|
283
|
+
"anything outside the range is not a heading element at all. It was " +
|
|
284
|
+
"rendered at the default, 3.");
|
|
285
|
+
level = 3;
|
|
286
|
+
}
|
|
287
|
+
const Heading = `h${String(level)}`;
|
|
288
|
+
/* THE UNIT IS PRINTED AFTER THE LAST PART. That happens only when the last
|
|
289
|
+
part is a number. A `null` one renders `Value`'s absence form, which
|
|
290
|
+
carries no unit element at all, so suppressing the symbol on the parts
|
|
291
|
+
before it would leave a real number on screen with nothing anywhere saying
|
|
292
|
+
what it is measured in. That is OPSIN-0003's exact ambiguity, arrived at by
|
|
293
|
+
layout rather than by a missing prop. */
|
|
294
|
+
const lastPart = parts.length === 0 ? undefined : parts[parts.length - 1];
|
|
295
|
+
const unitPrintedAfterLast = unit !== undefined && typeof lastPart?.value === "number";
|
|
296
|
+
/* TRIMMED, LIKE `title` AND `provenance`. A `meaning` of " " renders a blank
|
|
297
|
+
paragraph, and a blank paragraph is the silence this part exists to refuse:
|
|
298
|
+
the one guarantee this component argues hardest for should not be defeated
|
|
299
|
+
by a space. Only a string is trimmed. A node is taken as supplied, because
|
|
300
|
+
a component this file cannot see inside may render anything. */
|
|
301
|
+
const explained = typeof meaning === "string"
|
|
302
|
+
? meaning.trim() !== ""
|
|
303
|
+
: meaning !== undefined && meaning !== null;
|
|
304
|
+
return (
|
|
305
|
+
/* AN ARTICLE, AND NAMED. `<article>` is the element for a self-contained
|
|
306
|
+
composition and is exposed to a screen reader's rotor whether or not it
|
|
307
|
+
has a name; `<section>` is exposed only when it has one, which is the
|
|
308
|
+
trap a card built from a `<div role="region">` falls into.
|
|
309
|
+
|
|
310
|
+
THE NAME IS THE TITLE AND NOT THE TITLE PLUS THE READING, and the gap is
|
|
311
|
+
stated rather than hidden. The specification asks for a name shaped as
|
|
312
|
+
the measurement's title followed by its reading and its unit. Assembling
|
|
313
|
+
that means either formatting the number here or pointing
|
|
314
|
+
`aria-labelledby` at the title and the reading. Formatting the number
|
|
315
|
+
here is the one thing this file will not do. The pointing needs ids this
|
|
316
|
+
component cannot mint: `useId` is a hook and would put every card in the
|
|
317
|
+
system into the client bundle to buy one string. The reading is the next
|
|
318
|
+
thing announced after the name, and the page says so. */
|
|
319
|
+
_jsxs("article", { "data-slot": "result-card", "aria-label": heading || undefined, className: cn(
|
|
320
|
+
/* The surface is neutral at every level, deliberately and without an
|
|
321
|
+
escape hatch: there is no prop on this component that tints it, and
|
|
322
|
+
the status axis reaches the pill and stops. `bg-card` with a real
|
|
323
|
+
border rather than a Surface, because the border is the boundary a
|
|
324
|
+
printer keeps. A rung paints its edge with an inset shadow, which
|
|
325
|
+
a browser drops when it prints unless the reader has gone looking for
|
|
326
|
+
the setting that keeps it, and a card is how a reading most often
|
|
327
|
+
reaches an appointment. On screen the border is the decorative
|
|
328
|
+
`--edge` and the card is lifted by `shadow-card`, the same drop the
|
|
329
|
+
material card rung paints (ADR 0028); in print the same border takes
|
|
330
|
+
`--border`, which the theme's print block inks, so paper still gets a
|
|
331
|
+
line a printer draws.
|
|
332
|
+
|
|
333
|
+
In dark these are two different fills. `bg-card` measures lab L 8.57
|
|
334
|
+
while the material card rung a Surface paints measures 7.78, so today
|
|
335
|
+
choosing a border over a Surface also shifts the colour a little. The
|
|
336
|
+
chrome-role tokens in tokens/color.json and roles.css are where
|
|
337
|
+
that difference closes: they bring both fills to one neutral step, so
|
|
338
|
+
the border becomes the only difference between the two treatments and
|
|
339
|
+
it costs no colour. That unification lives in those token files, not
|
|
340
|
+
in this class list. */
|
|
341
|
+
"flex w-full flex-col gap-opsin-4 rounded-opsin-md border border-edge shadow-card print:border-border print:shadow-none", "bg-card p-5 text-card-foreground [corner-shape:var(--opsin-corner-shape)]", className), children: [_jsxs("div", { "data-slot": "result-card-header",
|
|
342
|
+
/* `items-start` and `flex-wrap` rather than a row with a fixed height:
|
|
343
|
+
at 200% text the title wraps to three lines and the pill drops
|
|
344
|
+
beneath it, which is the reflow the specification asks for and is
|
|
345
|
+
what a fixed height would clip. */
|
|
346
|
+
className: "flex flex-wrap items-start justify-between gap-opsin-3", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-opsin-0-5", children: [heading === "" ? null : (_jsx(Heading, { "data-slot": "result-card-title", "data-category": tint,
|
|
347
|
+
/* The level is the page's and the size is this component's. Left
|
|
348
|
+
to the browser the same title would be one size in an h2 and
|
|
349
|
+
another in an h4, and the heading level would be carrying visual
|
|
350
|
+
weight it is not entitled to.
|
|
351
|
+
|
|
352
|
+
WHICH IS WHY THIS IS JOINED AND NOT `cn`. `cn` is
|
|
353
|
+
`twMerge(clsx(…))` and tailwind-merge is unconfigured: it has
|
|
354
|
+
never been told that `--text-opsin-*` is a font-size namespace,
|
|
355
|
+
so it filed `text-opsin-headline` and `text-category-<name>-ink`
|
|
356
|
+
in one conflict group and kept the later. A tinted title
|
|
357
|
+
therefore lost the exact type step the paragraph above insists
|
|
358
|
+
on, and only when a category was supplied. That was right in
|
|
359
|
+
review, wrong in the case the component exists for. The two
|
|
360
|
+
utilities set different CSS properties, so passing both
|
|
361
|
+
through applies both. `score-dial.tsx` keeps its own
|
|
362
|
+
type-plus-colour strings whole for the same reason; the repair
|
|
363
|
+
belongs in `../utils.ts` and is reported upward.
|
|
364
|
+
|
|
365
|
+
`wrap-break-word` IS THE REFLOW REPAIR, and it is the same one
|
|
366
|
+
`callout.tsx` and `alert-banner.tsx` carry. `flex-wrap` on the
|
|
367
|
+
header gets the pill out of the title's way and `min-w-0` on the
|
|
368
|
+
column above lets that column shrink, but neither does anything
|
|
369
|
+
about a single word wider than the column it lands in: at 320px
|
|
370
|
+
with text at 200% the pill leaves this column about 121px,
|
|
371
|
+
"measurement" alone paints about 247px, and a word cannot wrap
|
|
372
|
+
at a space that is not there. The line box overflowed while
|
|
373
|
+
every BOX stayed inside the viewport. Only a
|
|
374
|
+
measurement of the text itself found it. The document
|
|
375
|
+
scrolled sideways at 346px against a 320px client width. That is
|
|
376
|
+
WCAG 1.4.10 Reflow, and a result card is where it bites: a long
|
|
377
|
+
single-word measurement name is the ordinary case here, not the
|
|
378
|
+
pathological one. `overflow-wrap: break-word` breaks such a word
|
|
379
|
+
only when it does not otherwise fit, so a title with spaces in it
|
|
380
|
+
still wraps at them and nothing changes below 200%. Not
|
|
381
|
+
`wrap-anywhere`, which would break mid-word while a usable space
|
|
382
|
+
was still available.
|
|
383
|
+
|
|
384
|
+
`hyphens-auto` IS THE OTHER HALF, and the choice it settles is
|
|
385
|
+
not between a hyphen and no break, it is between a hyphen and a
|
|
386
|
+
word cut at an arbitrary character. "Haemoglo-bin" is readable
|
|
387
|
+
back to a clinician where "Haemoglob / in" is not. `hyphens:
|
|
388
|
+
auto` inserts a hyphen only where the language's own rules allow
|
|
389
|
+
one and only at a break that was going to happen anyway, so
|
|
390
|
+
`wrap-break-word` stays as the last resort for a word the
|
|
391
|
+
hyphenation dictionary cannot break. It needs the document's
|
|
392
|
+
`lang`, which the typography foundation already mandates and both
|
|
393
|
+
root layouts set. In a consuming project with no `lang` the
|
|
394
|
+
utility is inert and `wrap-break-word` still catches the
|
|
395
|
+
overflow, so it can never make a project worse than it is today.
|
|
396
|
+
|
|
397
|
+
THE STEP IS `headline`, NOT `title3`. At 200% text the title3
|
|
398
|
+
step rendered about 40px inside a 336px card and `wrap-break-word`
|
|
399
|
+
had to split the lead word mid-character to keep the line inside
|
|
400
|
+
the viewport. `headline` is the step `type-scale.mdx` assigns to
|
|
401
|
+
the emphasised lead line inside a card, so the title comes down
|
|
402
|
+
one step to sit with Card, CareCard and Callout and wraps at a
|
|
403
|
+
space rather than mid-word. */
|
|
404
|
+
className: "m-0 hyphens-auto wrap-break-word text-opsin-headline" +
|
|
405
|
+
(tint === undefined ? "" : ` ${CATEGORY_INK[tint]}`), children: heading })), _jsx("span", { "data-slot": "result-card-time", className: "text-opsin-footnote", children: _jsx(RelativeTime, { at: measuredAt, event: "measured", now: now, staleAfterHours: staleAfterHours, showAbsolute: true, locale: locale, timeZone: timeZone }) })] }), status === undefined ? null : _jsx(StatusPill, { status: status })] }), _jsx("div", { "data-slot": "result-card-reading",
|
|
406
|
+
/* `items-baseline` so a compound reading sits on one line, `flex-wrap`
|
|
407
|
+
so it stops being one line rather than being clipped when the text
|
|
408
|
+
size goes up. */
|
|
409
|
+
className: "flex flex-wrap items-baseline gap-opsin-1", children: compound ? (parts.map((segment, index) => {
|
|
410
|
+
const last = index === parts.length - 1;
|
|
411
|
+
return (_jsxs(Fragment, { children: [index === 0 ? null : (
|
|
412
|
+
/* A sibling of the numbers rather than a child of one, so the
|
|
413
|
+
row's own gap falls on both sides of it and the pair is not
|
|
414
|
+
spaced asymmetrically. That evenness holds only because
|
|
415
|
+
`Value` keeps its no-break space inside the
|
|
416
|
+
`data-slot="value-unit"` span: the class list below
|
|
417
|
+
suppresses that slot on every part but the last, so a
|
|
418
|
+
separator character living outside it would print against
|
|
419
|
+
the first number and not the second and the space before the
|
|
420
|
+
solidus would come back. Anyone who moves the space out of
|
|
421
|
+
the span re-opens this. Same type step and same family as the
|
|
422
|
+
digits, because the solidus is part of how the measurement
|
|
423
|
+
is written rather than punctuation between two of them. */
|
|
424
|
+
_jsx("span", { "aria-hidden": "true", className: "font-opsin-numeric text-opsin-title1", children: "/" })), _jsxs("span", { className: "sr-only", children: [segment.label, ", "] }), _jsx(Value, { value: segment.value, unit: unit, precision: precision, locale: locale, size: "display",
|
|
425
|
+
/* THE UNIT IS PRINTED ONCE AND SPOKEN EVERY TIME. Every
|
|
426
|
+
segment is given the unit, so no `Value` here is a number
|
|
427
|
+
with nothing saying what it is measured in and each one
|
|
428
|
+
carries its own spoken form. A listener hears the unit
|
|
429
|
+
after each part, which is the unambiguous reading. What is
|
|
430
|
+
suppressed is only the visible symbol on every part but the
|
|
431
|
+
last, so the pair renders the way it is written: 12/8 mmHg
|
|
432
|
+
rather than 12 mmHg / 8 mmHg. The selector is the published
|
|
433
|
+
`data-slot` on the part, which is exactly what that contract
|
|
434
|
+
is for.
|
|
435
|
+
|
|
436
|
+
`sr-only` AND NOT `hidden`, WHICH IS THE WHOLE PROMISE.
|
|
437
|
+
`display: none` takes an element out of the accessibility
|
|
438
|
+
tree as well as off the screen. `Value` marks the visible
|
|
439
|
+
symbol `aria-hidden` only when it resolved a spoken form
|
|
440
|
+
from `tokens/units.json`, and leaves it announced when it
|
|
441
|
+
did not. It is "awkward to listen to, and true", in that
|
|
442
|
+
file's own words. Hiding it outright deletes that: for a
|
|
443
|
+
unit the table does not hold there is no sr-only spoken
|
|
444
|
+
sibling to survive, and every part but the last becomes a
|
|
445
|
+
bare number. Visually hidden leaves the symbol where a
|
|
446
|
+
listener can still reach it and renders identically. */
|
|
447
|
+
className: last || !unitPrintedAfterLast
|
|
448
|
+
? undefined
|
|
449
|
+
: "**:data-[slot=value-unit]:sr-only" })] }, `${String(index)}:${segment.label}`));
|
|
450
|
+
})) : (_jsx(Value, { value: value ?? null, unit: unit, precision: precision, locale: locale, size: "display" })) }), barReadable ? (_jsx(RangeBar, { label: heading, value: value ?? null, unit: unit, precision: precision, locale: locale, range: range, measuredAt: measuredAt, readingRecency: instantStated ? "delegated" : "state",
|
|
451
|
+
/* Undefined leaves RangeBar generating its own position sentence;
|
|
452
|
+
a non-empty string replaces that sentence. Never defaulted, because
|
|
453
|
+
a default would take the generated sentence away from every card
|
|
454
|
+
that did not ask to. */
|
|
455
|
+
summary: summary,
|
|
456
|
+
/* Mute the bar's own summary sentence so it reads as a caption to the
|
|
457
|
+
picture rather than as a peer of the `meaning` paragraph beneath it.
|
|
458
|
+
The `**:` descendant variant belongs to no tailwind-merge conflict
|
|
459
|
+
group, which is why it is spelled here rather than passed as a colour
|
|
460
|
+
to the bar, exactly as the label is suppressed one class over. The bar's
|
|
461
|
+
sentence is the component's own body copy on its own page and on the
|
|
462
|
+
MetricTile surface, so it is not muted globally in range-bar.tsx: the
|
|
463
|
+
competition with `meaning` exists only inside this card. The
|
|
464
|
+
`--muted-foreground` on `--card` pair is the one the footnote below
|
|
465
|
+
already uses at 13px, so a 17px line in it is a smaller ask. */
|
|
466
|
+
className: "**:data-[slot=range-bar-label]:hidden " +
|
|
467
|
+
"**:data-[slot=range-bar-summary]:text-muted-foreground" })) : null, _jsx("div", { "data-slot": "result-card-meaning", className: "max-w-(--opsin-measure-comfortable,66ch) text-opsin-body", children: explained ? (meaning) : (
|
|
468
|
+
/* THE ABSENCE IS SAID OUT LOUD. A card with no explanation and no
|
|
469
|
+
statement that there is none reads as a result nobody thought worth
|
|
470
|
+
explaining, which a reader hears as reassurance. This sentence is
|
|
471
|
+
the smallest honest thing that can go here: it says what is missing
|
|
472
|
+
and it does not say what the result means. Where the product has
|
|
473
|
+
somewhere that does explain the test, that is an action rather than
|
|
474
|
+
a sentence this component could write. */
|
|
475
|
+
_jsx("p", { className: "m-0 text-opsin-body text-muted-foreground", children: "We do not have an explanation for this result yet." })) }), steps.length === 0 ? null : (_jsx("div", { "data-slot": "result-card-actions",
|
|
476
|
+
/* The separation is a fixed token rather than a density-scaled step:
|
|
477
|
+
the gap between two touch targets is a measurement that carries
|
|
478
|
+
meaning, and it must not shrink because somebody asked for a denser
|
|
479
|
+
list. */
|
|
480
|
+
className: "flex flex-wrap gap-(--opsin-target-separation,0.5rem)", children: steps.map((action, index) => (_jsx(ResultCardAction, { action: action, emphasis: index === firstRecommended ? "recommended" : "alternative", owner: heading }, `${String(index)}:${action.label}`))) })), typeof provenance === "string" && provenance.trim() !== "" ? (
|
|
481
|
+
/* Provenance, and nothing else. There is no default disclaimer here and
|
|
482
|
+
there will not be one: a not-medical-advice note is jurisdictional,
|
|
483
|
+
it is the product's to write, and a sentence supplied by a design
|
|
484
|
+
system is a sentence nobody reviewed. DisclaimerNote is the component
|
|
485
|
+
for it, placed once by the product where the product decides. */
|
|
486
|
+
_jsx("p", { "data-slot": "result-card-footnote", className: "m-0 text-opsin-footnote text-muted-foreground", children: provenance })) : null] }));
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* One next step, rendered as a link, as a control, or as nothing at all.
|
|
490
|
+
*
|
|
491
|
+
* Returning nothing rather than rendering something is the point. A control
|
|
492
|
+
* with no name is unreachable by voice and announced as "button"; a control
|
|
493
|
+
* with neither a destination nor a handler acknowledges a press and then does
|
|
494
|
+
* nothing, which reads as a card that is out of order.
|
|
495
|
+
*
|
|
496
|
+
* Not exported. A component file's public surface is the props interface and
|
|
497
|
+
* the component, and a part a caller cannot place is not a part a caller needs
|
|
498
|
+
* to name.
|
|
499
|
+
*/
|
|
500
|
+
function ResultCardAction({ action, emphasis, owner, }) {
|
|
501
|
+
const label = action.label?.trim() ? action.label.trim() : "";
|
|
502
|
+
/* The destination is captured rather than tested, because a boolean does not
|
|
503
|
+
narrow the optional `href` for the compiler and the link form needs the
|
|
504
|
+
string itself. `navigates` stays the name the two warnings below read. */
|
|
505
|
+
const destination = typeof action.href === "string" && action.href.trim() !== ""
|
|
506
|
+
? action.href
|
|
507
|
+
: null;
|
|
508
|
+
const navigates = destination !== null;
|
|
509
|
+
const acts = typeof action.onSelect === "function";
|
|
510
|
+
if (label === "") {
|
|
511
|
+
warnDev(`action-no-label:${emphasis}:${owner}`, `[opsinjs] <ResultCard> titled "${owner}" was given an action with no ` +
|
|
512
|
+
"label. The visible label is the accessible name, and a next step " +
|
|
513
|
+
"nobody can read is not a next step. Nothing was rendered for it.");
|
|
514
|
+
return null;
|
|
515
|
+
}
|
|
516
|
+
if (!navigates && !acts) {
|
|
517
|
+
warnDev(`action-inert:${label}`, `[opsinjs] <ResultCard> was given the action "${label}" with neither ` +
|
|
518
|
+
"`href` nor `onSelect`, so there is nothing for it to do. Nothing was " +
|
|
519
|
+
"rendered for it.");
|
|
520
|
+
return null;
|
|
521
|
+
}
|
|
522
|
+
if (navigates && acts) {
|
|
523
|
+
warnDev(`action-both:${label}`, `[opsinjs] <ResultCard> was given the action "${label}" with both ` +
|
|
524
|
+
"`href` and `onSelect`. It rendered as a link, because a destination " +
|
|
525
|
+
"survives a new tab, a copied address and a screen reader's list of " +
|
|
526
|
+
"links and a handler survives none of them. Move the work to the page " +
|
|
527
|
+
"the link goes to, or drop the `href`.");
|
|
528
|
+
}
|
|
529
|
+
if (destination !== null) {
|
|
530
|
+
return (
|
|
531
|
+
/* THE LINK FORM GOES THROUGH THE SHARED `Link`. The anchor used to carry a
|
|
532
|
+
private class string of its own, byte-identical to the one in
|
|
533
|
+
`alert-banner.tsx` and `empty-state.tsx`. The treatment now lives once
|
|
534
|
+
in `Link` and the card action recipe it calls, so a banner's action and
|
|
535
|
+
a card's action are the same control on one screen. `recommended` maps
|
|
536
|
+
to Link's `action` emphasis and `alternative` to its `secondary` one,
|
|
537
|
+
and the ground is neutral, which is this card's own at every level.
|
|
538
|
+
|
|
539
|
+
STAMPED, BECAUSE THE OTHER FORM IS. `Button` puts `data-slot="button"`
|
|
540
|
+
on the handler form, and an anchor carrying nothing would leave the two
|
|
541
|
+
forms of one prop selectable by different means, so a print stylesheet
|
|
542
|
+
or a test written against the published attribute table could not reach
|
|
543
|
+
half of them. `data-slot="result-card-action"` rides through `Link` and
|
|
544
|
+
wins over its own `link` slot, which the anatomy block and every
|
|
545
|
+
consumer selector depend on.
|
|
546
|
+
|
|
547
|
+
BE PRECISE ABOUT THE FILL. The recipe's recommended arm carries
|
|
548
|
+
`bg-card`, which on a ResultCard is the card's own ground and so paints
|
|
549
|
+
no visible fill at all. It is the explicit surface that keeps the link
|
|
550
|
+
readable only if a caller gives the card a different ground. The
|
|
551
|
+
boundary, the box and the type step are the difference a reader can
|
|
552
|
+
see, and all of it is argued rather than measured. */
|
|
553
|
+
_jsx(Link, { href: destination, emphasis: emphasis === "recommended" ? "action" : "secondary", "data-slot": "result-card-action",
|
|
554
|
+
/* THE QUIET ACTION IS PULLED FLUSH WITH THE CARD CONTENT EDGE, AND THE
|
|
555
|
+
PULL LIVES HERE RATHER THAN IN THE RECIPE. The shared quiet arm of
|
|
556
|
+
`cardActionClassName` carries `px-opsin-2` so the bare label keeps a
|
|
557
|
+
hit area on both inline sides, which is right on every surface the
|
|
558
|
+
recipe serves: on a tinted card that same arm sits against a boundary,
|
|
559
|
+
and on a handler-form action it is a Button with padding of its own.
|
|
560
|
+
On this neutral card the quiet action draws no boundary, so that
|
|
561
|
+
leading padding reads as an eight-pixel indent of the label from the
|
|
562
|
+
card's content box, out of line with the reading, the meaning and the
|
|
563
|
+
recommended action above it. The compensation cannot move into the
|
|
564
|
+
recipe without breaking the surfaces where the padding is correct, so
|
|
565
|
+
it belongs at the call site that knows the label is bare on a neutral
|
|
566
|
+
ground. This is the handoff the earlier private-anchor fix recorded:
|
|
567
|
+
when the shared recipe replaced the local ALTERNATIVE_LINK constant,
|
|
568
|
+
the negative inline-start margin that constant carried had to move
|
|
569
|
+
onto the anchor here. `-ms-opsin-2` is the exact negative of the arm's
|
|
570
|
+
`px-opsin-2`, so it cancels the leading padding at every text size and
|
|
571
|
+
leaves the trailing hit area intact, and margin and padding sit in
|
|
572
|
+
different tailwind-merge groups, so Link's `cn` keeps both. The
|
|
573
|
+
recommended action keeps its padding, because its boundary is what the
|
|
574
|
+
reader aligns to and its box edge is already flush. */
|
|
575
|
+
className: emphasis === "recommended" ? undefined : "-ms-opsin-2", children: label }));
|
|
576
|
+
}
|
|
577
|
+
return (
|
|
578
|
+
/* NO BRAND FILL FOR THE RECOMMENDED ACTION, SO THE TWO TRANSPORTS MATCH.
|
|
579
|
+
`Button variant="primary"` is `bg-primary` on `text-primary-foreground`:
|
|
580
|
+
the biggest control on the screen. The `href` form of the same
|
|
581
|
+
recommended action is the recipe's neutral bordered capsule link on
|
|
582
|
+
`bg-card`. So one semantic step would read as a faint link or as a loud
|
|
583
|
+
blue button purely by which prop the product happened to pass, a
|
|
584
|
+
difference the reader cannot see. `secondary` is `border-border bg-card
|
|
585
|
+
text-foreground` (button.tsx TONE), which is the same neutral bordered
|
|
586
|
+
pair the link form draws, so the recommended action renders at one weight
|
|
587
|
+
on both transports. This is also what the page already promises:
|
|
588
|
+
result-card.mdx says the recommended action is bordered and on a larger
|
|
589
|
+
target, and is not carried by a fill.
|
|
590
|
+
|
|
591
|
+
THE CLASS DELTA COMES FROM THE SHARED RECIPE, NOT A LOCAL STRING. Button
|
|
592
|
+
already brings the box, the fill and the type step through its TONE and
|
|
593
|
+
SIZE, so `cardActionClassName(..., { as: "button" })` returns only what is
|
|
594
|
+
left, which on this card's neutral ground is nothing for either weight.
|
|
595
|
+
Routing it through the recipe is what keeps the handler form and the link
|
|
596
|
+
form from drifting, and it is why this file now holds no private action
|
|
597
|
+
class string of its own. Neither form is underlined: the recommended one
|
|
598
|
+
is a bordered capsule and the quiet one is set in the accent ink (ADR
|
|
599
|
+
0029), so neither reads as a paragraph. */
|
|
600
|
+
_jsx(Button, { variant: emphasis === "recommended" ? "secondary" : "quiet",
|
|
601
|
+
/* THE SIZE FOLLOWS THE WEIGHT ON BOTH TRANSPORTS. Button with no size
|
|
602
|
+
defaults to `md`, whose SIZE step is `text-opsin-headline` (17px), while
|
|
603
|
+
the quiet link arm takes the `subheadline` step (15px). Leaving the
|
|
604
|
+
default here would make the same alternative action 15px as a link and
|
|
605
|
+
17px as a handler control. `sm` puts the handler form back at the
|
|
606
|
+
subheadline step, so the quiet action reads at one size whichever prop
|
|
607
|
+
the product passed. AlertBanner passes size for exactly this reason. */
|
|
608
|
+
size: emphasis === "recommended" ? "md" : "sm", className: cardActionClassName({
|
|
609
|
+
weight: emphasis === "recommended" ? "recommended" : "quiet",
|
|
610
|
+
ground: "neutral",
|
|
611
|
+
as: "button",
|
|
612
|
+
}), onClick: action.onSelect, children: label }));
|
|
613
|
+
}
|
|
614
|
+
//# sourceMappingURL=result-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-card.js","sourceRoot":"","sources":["../../src/components/result-card.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,QAAQ,EAAiE,MAAM,eAAe,CAAA;AAC3J,OAA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