@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,728 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* ScoreDial is a composite number somebody's product calculated, drawn as an
|
|
4
|
+
* arc, with the band it falls in named in words and a sentence saying what the
|
|
5
|
+
* number is made of.
|
|
6
|
+
*
|
|
7
|
+
* THE RING IS THE DANGEROUS PART, and everything below is arranged around it. A
|
|
8
|
+
* number inside a ring reads as authoritative, complete and personal however
|
|
9
|
+
* thin the evidence behind it is, and a ring that fills up reads as a mark out
|
|
10
|
+
* of a maximum. So the arc is never the message: it is a picture of where a
|
|
11
|
+
* number the product supplied sits between two bounds the product supplied, and
|
|
12
|
+
* the words beside it carry everything a reader needs. Cover the arc with your
|
|
13
|
+
* hand and nothing is lost.
|
|
14
|
+
*
|
|
15
|
+
* OPSINJS SHIPS NO BANDS, NO SCALES AND NO CUT-OFFS. `bands` is a required prop
|
|
16
|
+
* and it is the caller's: their boundaries, their names, and the name of
|
|
17
|
+
* whoever chose them. Handed none, this component renders the number and says
|
|
18
|
+
* in words that it has no band for it, because a default band set would be a
|
|
19
|
+
* score interpretation with no clinical owner. That is the single worst thing
|
|
20
|
+
* this file could contain. The zero-prop demo,
|
|
21
|
+
* apps/www/registry/demos/score-dial.tsx, therefore has no bands at all, since
|
|
22
|
+
* a developer who copies it would copy the bands with it.
|
|
23
|
+
*
|
|
24
|
+
* IT ASSIGNS NO LEVEL. Band membership is arithmetic and it selects a NAME.
|
|
25
|
+
* That is the product's own word for a stretch of its own scale. It never
|
|
26
|
+
* selects a clinical status: `status` is a top-level prop, it is the product's
|
|
27
|
+
* verdict on this reading, and this component has no rule anywhere of the shape
|
|
28
|
+
* "if the score is past here then it is serious". An earlier version of this
|
|
29
|
+
* file hung `status` off each band and let the comparison pick one, which meant
|
|
30
|
+
* a rendering component was deciding what somebody's number meant. It no longer
|
|
31
|
+
* does. `CLINICAL_STATUS_META.watch.assignedBy` is "The consuming product, from
|
|
32
|
+
* a reference range it owns", and that is now literally who assigned it.
|
|
33
|
+
*
|
|
34
|
+
* AND IT PLACES NOTHING IT CANNOT PLACE HONESTLY. A score outside the scale it
|
|
35
|
+
* was given gets no mark at all and a sentence saying so, rather than a mark
|
|
36
|
+
* pinned to the end of the arc. A clamped indicator draws 140 and 100 in the
|
|
37
|
+
* same place, which is the picture saying something definite and false while
|
|
38
|
+
* the words say something true.
|
|
39
|
+
*
|
|
40
|
+
* WHY `role="img"` AND NOT `meter`. `meter` is exactly the role a dial looks
|
|
41
|
+
* like it wants and exactly the one it must not have: it announces a value
|
|
42
|
+
* within a range, which is the assertion this component is not entitled to
|
|
43
|
+
* make, and it carries no band vocabulary. `progressbar` is worse. It implies
|
|
44
|
+
* a task advancing towards completion, and a score is something that happened
|
|
45
|
+
* to a person rather than something they are part-way through. `slider` implies
|
|
46
|
+
* a value they can change. So: a labelled image, never focusable, never in the
|
|
47
|
+
* tab order, with a mandatory visible text twin beside it.
|
|
48
|
+
*
|
|
49
|
+
* THE TWIN IS NOT AN OPTION AND NO PROP OF THIS COMPONENT TURNS IT OFF.
|
|
50
|
+
* `ScoreDial.BandName` and `ScoreDial.Derivation` always render, visibly, in
|
|
51
|
+
* the document. The one way a caller can still lose them is `className`. A
|
|
52
|
+
* class that clips or hides wins the merge, and the doc comment on that prop
|
|
53
|
+
* says so. The measured CVD audit in `tokens/color.json` is why a graphic is
|
|
54
|
+
* worse than a pill here: four ordered levels cannot be made mutually
|
|
55
|
+
* distinguishable by hue for every form of colour vision, and an arc has no
|
|
56
|
+
* word in it at all.
|
|
57
|
+
*
|
|
58
|
+
* NOTHING ANIMATES. Not on first paint, not on a change, not under any prop.
|
|
59
|
+
* `health/motion-in-health-ui` names the dial sweep specifically, and a sweep
|
|
60
|
+
* has displayed, for every frame of its travel, a score that is not true.
|
|
61
|
+
*/
|
|
62
|
+
import { Circle, CircleDot, Diamond, Octagon } from "lucide-react";
|
|
63
|
+
import { useId } from "react";
|
|
64
|
+
import { CLINICAL_STATUS_META, HEALTH_CATEGORIES, isClinicalStatus, isDevelopment, isHealthCategory, warnOnce } from "../opsinjs.js";
|
|
65
|
+
import { cn } from "../utils.js";
|
|
66
|
+
import { StatusPill } from "./status-pill.js";
|
|
67
|
+
import { Value } from "./value.js";
|
|
68
|
+
/**
|
|
69
|
+
* The glyph for each level, bound from `CLINICAL_STATUS_META[level].icon`.
|
|
70
|
+
*
|
|
71
|
+
* This map draws nothing on the dial. ScoreDial delegates the level to
|
|
72
|
+
* StatusPill, so the glyph a reader sees reaches the screen through the pill
|
|
73
|
+
* and this file paints no glyph of its own. The map is kept for two reasons.
|
|
74
|
+
* First, a file that stamps `data-status` and paints a status colour, which
|
|
75
|
+
* this one does on the indicator and on the one tinted band, must both read
|
|
76
|
+
* `CLINICAL_STATUS_META` and reference a `lucide-react` icon, or A11Y001 reads
|
|
77
|
+
* the status as carried by colour alone. The gate downgrades a composed carrier
|
|
78
|
+
* to a warning rather than crediting it, so the reference has to stay in the
|
|
79
|
+
* file. Second, it asserts against `../status.ts` below, so the two copies of
|
|
80
|
+
* the level-to-glyph mapping cannot drift apart. It is written out here rather
|
|
81
|
+
* than imported for the reason the substrate contract gives: a component file
|
|
82
|
+
* may import `../utils.ts`, `../opsinjs.ts`, a sibling component and the
|
|
83
|
+
* package's declared dependencies and nothing else, and a bundler cannot
|
|
84
|
+
* resolve a `lucide-react` export from a runtime string without pulling the
|
|
85
|
+
* whole icon set into a consumer's bundle. Typing it `Record<ClinicalStatus,
|
|
86
|
+
* …>` makes a missing level a compile error rather than a status with no glyph.
|
|
87
|
+
*/
|
|
88
|
+
const ICONS = {
|
|
89
|
+
steady: Circle,
|
|
90
|
+
watch: CircleDot,
|
|
91
|
+
attention: Diamond,
|
|
92
|
+
urgent: Octagon,
|
|
93
|
+
};
|
|
94
|
+
/* Development-only, and the same assertion StatusPill carries. If somebody
|
|
95
|
+
changes an icon name in ../status.ts and not here, the two copies of the
|
|
96
|
+
level-to-glyph mapping have drifted, and this warns so the lucide reference
|
|
97
|
+
this file keeps for A11Y001 stays honest about which glyph each level owns. */
|
|
98
|
+
if (isDevelopment()) {
|
|
99
|
+
for (const [level, Icon] of Object.entries(ICONS)) {
|
|
100
|
+
const expected = CLINICAL_STATUS_META[level].icon;
|
|
101
|
+
const actual = Icon.displayName;
|
|
102
|
+
if (actual && actual !== expected) {
|
|
103
|
+
console.warn(`[opsinjs] ScoreDial's ICONS map binds <${actual}> to status "${level}", ` +
|
|
104
|
+
`but CLINICAL_STATUS_META says the icon is "${expected}". The dial draws ` +
|
|
105
|
+
"no glyph itself; StatusPill does. Fix ICONS in score-dial.tsx so this " +
|
|
106
|
+
"file's reference to status.ts does not drift.");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The two levels a dial may carry, and the two it refuses.
|
|
112
|
+
*
|
|
113
|
+
* `attention` "always carries a named action" and `urgent` puts the action in
|
|
114
|
+
* the first line. That is `health/clinical-status-semantics`, not a house
|
|
115
|
+
* style. This component has nowhere to put an action: it renders a number, a
|
|
116
|
+
* band name and a sentence about arithmetic, and a bare "Urgent" beside a
|
|
117
|
+
* composite score is a level with no route to a person attached to it. So the
|
|
118
|
+
* two upper levels are refused rather than rendered flat, and the refusal is
|
|
119
|
+
* reported. A score that needs somebody to act belongs in a CareCard, which has
|
|
120
|
+
* the action, or an AlertBanner, which has the assertive live region.
|
|
121
|
+
*/
|
|
122
|
+
const DIAL_STATUSES = ["steady", "watch"];
|
|
123
|
+
function isDialStatus(candidate) {
|
|
124
|
+
return DIAL_STATUSES.includes(candidate);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The indicator's colour, one class list per level, written out.
|
|
128
|
+
*
|
|
129
|
+
* Tailwind reads class names out of source as literal strings, so this cannot
|
|
130
|
+
* be built from the level at runtime: `text-status-${status}-ink` generates no
|
|
131
|
+
* CSS at all and the mark renders in whatever it inherits.
|
|
132
|
+
*
|
|
133
|
+
* `-ink` rather than the bare `-<level>` (which is the LINE role) because the
|
|
134
|
+
* indicator sits on the card rather than on the level's own tinted surface, and
|
|
135
|
+
* `status.<level>.ink-on-page` is a pair the contrast rig actually measures. It
|
|
136
|
+
* passes, in both themes, for both levels this component accepts.
|
|
137
|
+
*
|
|
138
|
+
* BE EXACT ABOUT WHAT "PAGE" IS THERE, because a card is not always it. The rig
|
|
139
|
+
* measures those rows against `--opsin-neutral-0` in light and
|
|
140
|
+
* `--opsin-neutral-950` in dark. In light `--card` is `oklch(1 0 0)`, which is
|
|
141
|
+
* `--opsin-neutral-0` exactly, so a dial on a card is on the measured ground. In
|
|
142
|
+
* dark `--card` sits one step lighter than `--opsin-neutral-950`, so the
|
|
143
|
+
* recorded figure is near neighbour to the pairing on a card rather than the
|
|
144
|
+
* pairing itself, and nothing has measured that one. `range-bar.tsx` reads the
|
|
145
|
+
* same rows for the same roles and says the same thing; neither file asserts a
|
|
146
|
+
* number for a pair the rig has not produced.
|
|
147
|
+
*/
|
|
148
|
+
const INDICATOR_TONE = {
|
|
149
|
+
steady: "text-status-steady-ink",
|
|
150
|
+
watch: "text-status-watch-ink",
|
|
151
|
+
attention: "text-status-attention-ink",
|
|
152
|
+
urgent: "text-status-urgent-ink",
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* The fill for the one band the score fell in, when the product assigned a
|
|
156
|
+
* level to the reading.
|
|
157
|
+
*
|
|
158
|
+
* `-accent` is the identity fill: chosen for recognition rather than for
|
|
159
|
+
* contrast, never carrying text, never a sole boundary. That is exactly what a
|
|
160
|
+
* band segment is here. The word, the glyph, `data-status` and the indicator
|
|
161
|
+
* all say the same thing beside it. It is worth stating what "never a sole
|
|
162
|
+
* boundary" is doing for us: `lib/generated/contrast.json` measures
|
|
163
|
+
* `status.watch.accent-on-page` at Lc 39.29 in light, below the Lc 45 non-text
|
|
164
|
+
* floor, so a reader who could not tell this segment from its neighbours would
|
|
165
|
+
* lose nothing that the words do not also carry. The page says so in the same
|
|
166
|
+
* words rather than leaving the number in a generated file.
|
|
167
|
+
*/
|
|
168
|
+
const BAND_TONE = {
|
|
169
|
+
steady: "text-status-steady-accent",
|
|
170
|
+
watch: "text-status-watch-accent",
|
|
171
|
+
attention: "text-status-attention-accent",
|
|
172
|
+
urgent: "text-status-urgent-accent",
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* The label's tint, and the only place the category axis touches this
|
|
176
|
+
* component.
|
|
177
|
+
*
|
|
178
|
+
* `-ink` because the label is text on the page, and `category.<name>.ink-on-page`
|
|
179
|
+
* is measured. The track, the bands and the indicator never take a category
|
|
180
|
+
* colour: a reader looking at one colour has to know whether it is answering
|
|
181
|
+
* what the reading is about or how much attention it wants, and a dial that
|
|
182
|
+
* mixed the two would make that unanswerable.
|
|
183
|
+
*/
|
|
184
|
+
const CATEGORY_TONE = {
|
|
185
|
+
sleep: "text-category-sleep-ink",
|
|
186
|
+
heart: "text-category-heart-ink",
|
|
187
|
+
activity: "text-category-activity-ink",
|
|
188
|
+
nutrition: "text-category-nutrition-ink",
|
|
189
|
+
mind: "text-category-mind-ink",
|
|
190
|
+
labs: "text-category-labs-ink",
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* The label's class list, kept whole because a type step sits beside a colour.
|
|
194
|
+
*
|
|
195
|
+
* `cn()` cannot be used where a type step meets a colour. tailwind-merge
|
|
196
|
+
* classifies an unfamiliar `text-*` utility as a colour, so
|
|
197
|
+
* `cn("text-opsin-subheadline", "text-category-labs-ink")` returns only the
|
|
198
|
+
* second and the element silently loses its size, its leading, its tracking and
|
|
199
|
+
* its weight. That is verified against tailwind-merge 3.6.0. Joining them with a
|
|
200
|
+
* template passes both through, and the two utilities set different CSS
|
|
201
|
+
* properties, so both apply. Every place in this file where a type step meets a
|
|
202
|
+
* colour is written this way. The status word no longer lives here: it is a
|
|
203
|
+
* StatusPill now, the one capsule every status-bearing component shares, so its
|
|
204
|
+
* ink and boundary are the pill's concern rather than this file's.
|
|
205
|
+
*/
|
|
206
|
+
const LABEL_ROW = "m-0 text-center text-opsin-subheadline";
|
|
207
|
+
/**
|
|
208
|
+
* Which of this file's own complaints the session has already printed.
|
|
209
|
+
*
|
|
210
|
+
* The same shape `Value` uses, and for the same reason: in a production bundle
|
|
211
|
+
* `isDevelopment()` is statically false, the body that touches this is dead
|
|
212
|
+
* code, and the set is never allocated. In development it lives for the
|
|
213
|
+
* session, so a grid of twelve dials with no bands prints one warning rather
|
|
214
|
+
* than twelve.
|
|
215
|
+
*
|
|
216
|
+
* It is not `warnOnce` because none of these complaints has an OPSIN code. That
|
|
217
|
+
* table is generated from `tokens/errors.json`, and allocating a code in it is
|
|
218
|
+
* not this component's to do; the omissions are reported upward instead. The
|
|
219
|
+
* channel and the wording are the same either way.
|
|
220
|
+
*
|
|
221
|
+
* The keys name WHICH complaint rather than what the component was holding at
|
|
222
|
+
* the time. Keying on a score would turn "warn once" into "warn every render".
|
|
223
|
+
*/
|
|
224
|
+
let reported;
|
|
225
|
+
function reportOnce(key, message) {
|
|
226
|
+
if (!isDevelopment())
|
|
227
|
+
return;
|
|
228
|
+
reported ??= new Set();
|
|
229
|
+
if (reported.has(key))
|
|
230
|
+
return;
|
|
231
|
+
reported.add(key);
|
|
232
|
+
console.warn(message);
|
|
233
|
+
}
|
|
234
|
+
/* ------------------------------------------------------------------ *
|
|
235
|
+
* Geometry *
|
|
236
|
+
* ------------------------------------------------------------------ */
|
|
237
|
+
/* The dial: a 240-degree sweep opening at the bottom, drawn clockwise from the
|
|
238
|
+
lower left, on a round face inside a bezel. None of these numbers is a
|
|
239
|
+
clinical decision. They are the shape of a picture, in the SVG's own user
|
|
240
|
+
units, and they are constants only so that the face, the graduations, the
|
|
241
|
+
track, the boundary marks, the needle and the viewBox cannot drift apart. */
|
|
242
|
+
const SWEEP_DEGREES = 240;
|
|
243
|
+
const START_DEGREES = 210;
|
|
244
|
+
/** The square the dial is drawn in, and its centre. */
|
|
245
|
+
const VIEW_WIDTH = 100;
|
|
246
|
+
const VIEW_HEIGHT = 100;
|
|
247
|
+
const CENTRE_X = 50;
|
|
248
|
+
const CENTRE_Y = 50;
|
|
249
|
+
/** The bezel's outer edge and the face inside it. */
|
|
250
|
+
const BEZEL_RADIUS = 48.5;
|
|
251
|
+
const FACE_RADIUS = 43;
|
|
252
|
+
/**
|
|
253
|
+
* The graduations: a fine tick every fiftieth of the scale and a longer one
|
|
254
|
+
* every tenth, outside the track, the way a gauge is ruled. They divide the
|
|
255
|
+
* product's own scale into equal steps and carry no number, so they assert no
|
|
256
|
+
* band and no threshold; they are the ruler the needle is read against.
|
|
257
|
+
*/
|
|
258
|
+
const TICK_OUTER = 40.5;
|
|
259
|
+
const TICK_MINOR_INNER = 38.6;
|
|
260
|
+
const TICK_MAJOR_INNER = 37;
|
|
261
|
+
const TICK_MINOR_COUNT = 50;
|
|
262
|
+
const TICK_MAJOR_EVERY = 5;
|
|
263
|
+
/** The track the bands are drawn on, and how far a boundary mark reaches past it. */
|
|
264
|
+
const RADIUS = 32.5;
|
|
265
|
+
const TRACK_WIDTH = 4.5;
|
|
266
|
+
const BOUNDARY_REACH = 4.2;
|
|
267
|
+
/** The needle: its tip reaches just past the track; its tail balances it. */
|
|
268
|
+
const NEEDLE_TIP = 35.5;
|
|
269
|
+
const NEEDLE_HALF_WIDTH = 1.35;
|
|
270
|
+
const NEEDLE_TAIL = 7.5;
|
|
271
|
+
const NEEDLE_TAIL_HALF_WIDTH = 1.9;
|
|
272
|
+
const HUB_RADIUS = 4.4;
|
|
273
|
+
/** Where the scale's two ends are written, inside the opening of the sweep. */
|
|
274
|
+
const END_LABEL_RADIUS = 27;
|
|
275
|
+
/** `Intl.NumberFormat`'s ceiling, and the way to say "show the digits you were handed". */
|
|
276
|
+
const MAX_FRACTION_DIGITS = 20;
|
|
277
|
+
function round(figure) {
|
|
278
|
+
return Math.round(figure * 1000) / 1000;
|
|
279
|
+
}
|
|
280
|
+
/** A point on the sweep. `fraction` runs 0 at the low bound to 1 at the high one. */
|
|
281
|
+
function pointAt(fraction, radius) {
|
|
282
|
+
const radians = ((START_DEGREES - fraction * SWEEP_DEGREES) * Math.PI) / 180;
|
|
283
|
+
return {
|
|
284
|
+
x: round(CENTRE_X + radius * Math.cos(radians)),
|
|
285
|
+
/* Minus, because SVG's y grows downwards and the angle does not. */
|
|
286
|
+
y: round(CENTRE_Y - radius * Math.sin(radians)),
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* The whole sweep, as one path, drawn once and reused for every segment.
|
|
291
|
+
*
|
|
292
|
+
* Every band is this same path with a dash pattern over it rather than a path
|
|
293
|
+
* of its own, which is what keeps the segments exactly on the track and saves
|
|
294
|
+
* working out an arc flag per band. `pathLength={100}` normalises the path's
|
|
295
|
+
* length to 100 user units, so a dash offset is a percentage of the sweep and
|
|
296
|
+
* the arithmetic below is the fraction arithmetic, unchanged.
|
|
297
|
+
*
|
|
298
|
+
* The two flags: large-arc is 1 because 240 degrees is more than half a turn,
|
|
299
|
+
* and sweep is 1 because the path runs clockwise on screen. It runs lower left,
|
|
300
|
+
* over the top, lower right.
|
|
301
|
+
*/
|
|
302
|
+
const TRACK_PATH = (() => {
|
|
303
|
+
const from = pointAt(0, RADIUS);
|
|
304
|
+
const to = pointAt(1, RADIUS);
|
|
305
|
+
return `M ${from.x} ${from.y} A ${RADIUS} ${RADIUS} 0 1 1 ${to.x} ${to.y}`;
|
|
306
|
+
})();
|
|
307
|
+
/**
|
|
308
|
+
* Keeps a DRAWING inside the arc. Never applied to a reading.
|
|
309
|
+
*
|
|
310
|
+
* A band whose bounds overhang the scale is clipped to the sweep, because the
|
|
311
|
+
* sweep is all the arc there is; that is a fact about the picture. A score
|
|
312
|
+
* outside the scale is a different thing entirely and is not clamped anywhere
|
|
313
|
+
* below. It gets no mark and a sentence instead.
|
|
314
|
+
*/
|
|
315
|
+
function clampFraction(fraction) {
|
|
316
|
+
if (!Number.isFinite(fraction))
|
|
317
|
+
return 0;
|
|
318
|
+
return Math.min(Math.max(fraction, 0), 1);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* The needle as a polygon: a long taper from the hub to just past the track,
|
|
322
|
+
* and a short, wider tail on the far side of the hub, which is how an
|
|
323
|
+
* instrument's needle is balanced. Returned as an SVG `points` string.
|
|
324
|
+
*/
|
|
325
|
+
function needlePoints(fraction) {
|
|
326
|
+
const radians = ((START_DEGREES - fraction * SWEEP_DEGREES) * Math.PI) / 180;
|
|
327
|
+
const ux = Math.cos(radians);
|
|
328
|
+
const uy = -Math.sin(radians);
|
|
329
|
+
/* The perpendicular, a quarter turn from the needle's own direction. */
|
|
330
|
+
const px = -uy;
|
|
331
|
+
const py = ux;
|
|
332
|
+
const at = (along, across) => `${round(CENTRE_X + ux * along + px * across)},${round(CENTRE_Y + uy * along + py * across)}`;
|
|
333
|
+
return [
|
|
334
|
+
at(NEEDLE_TIP, 0),
|
|
335
|
+
at(0, NEEDLE_HALF_WIDTH),
|
|
336
|
+
at(-NEEDLE_TAIL, NEEDLE_TAIL_HALF_WIDTH),
|
|
337
|
+
at(-NEEDLE_TAIL, -NEEDLE_TAIL_HALF_WIDTH),
|
|
338
|
+
at(0, -NEEDLE_HALF_WIDTH),
|
|
339
|
+
].join(" ");
|
|
340
|
+
}
|
|
341
|
+
/** The graduations, as one path: a fine tick every fiftieth, a longer one every tenth. */
|
|
342
|
+
const GRADUATIONS = (() => {
|
|
343
|
+
const minor = [];
|
|
344
|
+
const major = [];
|
|
345
|
+
for (let index = 0; index <= TICK_MINOR_COUNT; index += 1) {
|
|
346
|
+
const fraction = index / TICK_MINOR_COUNT;
|
|
347
|
+
const isMajor = index % TICK_MAJOR_EVERY === 0;
|
|
348
|
+
const inner = pointAt(fraction, isMajor ? TICK_MAJOR_INNER : TICK_MINOR_INNER);
|
|
349
|
+
const outer = pointAt(fraction, TICK_OUTER);
|
|
350
|
+
(isMajor ? major : minor).push(`M ${inner.x} ${inner.y} L ${outer.x} ${outer.y}`);
|
|
351
|
+
}
|
|
352
|
+
return { minor: minor.join(" "), major: major.join(" ") };
|
|
353
|
+
})();
|
|
354
|
+
/* ------------------------------------------------------------------ *
|
|
355
|
+
* The component *
|
|
356
|
+
* ------------------------------------------------------------------ */
|
|
357
|
+
/**
|
|
358
|
+
* The band a score falls in, or `undefined`.
|
|
359
|
+
*
|
|
360
|
+
* This selects a NAME and nothing else. It is the product's own word for a
|
|
361
|
+
* stretch of the product's own scale. It does not select a level, and no level
|
|
362
|
+
* is reachable from it: `status` arrives as a prop or it does not arrive.
|
|
363
|
+
*
|
|
364
|
+
* First match wins, so overlapping bands resolve in the order the product
|
|
365
|
+
* declared them rather than by any rule of this component's. The `max` clause
|
|
366
|
+
* is the top-of-scale exception described on `ScoreBand`.
|
|
367
|
+
*/
|
|
368
|
+
function bandAt(list, score, max) {
|
|
369
|
+
return list.find((entry) => (score >= entry.from && score < entry.to) || (score === max && score === entry.to));
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* The score as the accessible sentence will say it.
|
|
373
|
+
*
|
|
374
|
+
* It exists so that the spoken sentence and the printed reading cannot
|
|
375
|
+
* disagree: `Value` prints the reading with these same options, and a label
|
|
376
|
+
* that said "14" beside a dial reading "14.0" would be two answers to one
|
|
377
|
+
* question.
|
|
378
|
+
*
|
|
379
|
+
* Rounding is `halfExpand`, which is round-half-away-from-zero,
|
|
380
|
+
* `numbers-units-precision` rule 3. It is INHERITED rather than named.
|
|
381
|
+
* `roundingMode` is an ES2023 addition to `Intl.NumberFormatOptions`, so
|
|
382
|
+
* spelling it out here makes this file fail to typecheck in a consumer whose
|
|
383
|
+
* `lib` stops at ES2022, and this file ships as source into those projects.
|
|
384
|
+
* `halfExpand` is the formatter's own default, so the behaviour is identical
|
|
385
|
+
* either way; see the longer note in `value.tsx`, which records where the
|
|
386
|
+
* regression was found. Do not put it back.
|
|
387
|
+
*/
|
|
388
|
+
function spokenScore(score, places, locale) {
|
|
389
|
+
return new Intl.NumberFormat(locale, {
|
|
390
|
+
minimumFractionDigits: places,
|
|
391
|
+
maximumFractionDigits: places ?? MAX_FRACTION_DIGITS,
|
|
392
|
+
}).format(score);
|
|
393
|
+
}
|
|
394
|
+
/**
|
|
395
|
+
* Every other number this component prints: the bounds, the band edges, the
|
|
396
|
+
* coverage counts.
|
|
397
|
+
*
|
|
398
|
+
* They go through the reader's locale too. They are the product's description
|
|
399
|
+
* of its own scale rather than the reader's measurement, which settles whether
|
|
400
|
+
* they need a unit and settles nothing about how a numeral is spelled. A
|
|
401
|
+
* reader does not change number systems between two lines of one card. Before
|
|
402
|
+
* this existed, a `de-DE` dial printed the score with a comma three lines above
|
|
403
|
+
* a scale sentence spelling its bounds with a point, and `String()` printed
|
|
404
|
+
* 1e21 as "1e+21".
|
|
405
|
+
*/
|
|
406
|
+
function plain(figure, locale) {
|
|
407
|
+
if (!Number.isFinite(figure))
|
|
408
|
+
return String(figure);
|
|
409
|
+
return new Intl.NumberFormat(locale, {
|
|
410
|
+
maximumFractionDigits: MAX_FRACTION_DIGITS,
|
|
411
|
+
}).format(figure);
|
|
412
|
+
}
|
|
413
|
+
export function ScoreDial({ label, value, min, max, bands, status, derivation, coverage, category, calculatedAt, precision: declaredPrecision, locale, className, }) {
|
|
414
|
+
/* PRECISION IS REQUIRED IN THE TYPE, ADVICE IN JAVASCRIPT. The prop is typed
|
|
415
|
+
`number`, so a TypeScript caller cannot omit it. This file ships as source
|
|
416
|
+
into JavaScript projects, where a required prop is advice rather than a
|
|
417
|
+
guarantee, so the value is re-widened once to `number | undefined` and every
|
|
418
|
+
runtime check below reads a value that genuinely might not be a number. */
|
|
419
|
+
const precision = declaredPrecision;
|
|
420
|
+
/* THE SCALE HAS TO BE A SCALE. A span of zero or less has no positions in it,
|
|
421
|
+
and every fraction below would be a division by zero rendered as an
|
|
422
|
+
indicator pinned to one end. That is a picture that says something definite
|
|
423
|
+
about a scale nobody can read. Reported, and the arc is drawn without bands
|
|
424
|
+
or an indicator so that the words are still true. */
|
|
425
|
+
const span = max - min;
|
|
426
|
+
const scaleUsable = Number.isFinite(span) && span > 0;
|
|
427
|
+
if (!scaleUsable) {
|
|
428
|
+
reportOnce("scale", `[opsinjs] <ScoreDial> was given min=${plain(min, locale)} and max=${plain(max, locale)}, ` +
|
|
429
|
+
"which is not a scale: the upper bound must be above the lower one. The " +
|
|
430
|
+
"arc was drawn empty, no indicator was placed and no band list was shown, " +
|
|
431
|
+
"because a position on a scale of no width is a picture with no meaning. " +
|
|
432
|
+
"The score and its words are unaffected.");
|
|
433
|
+
}
|
|
434
|
+
/* THREE STATES, NOT TWO, and keeping them three is the whole of the null
|
|
435
|
+
handling here. A number that arrived broken is a calculation that ran and
|
|
436
|
+
failed; an absent one is a calculation that never ran. `Value` keeps them
|
|
437
|
+
apart in the visible words, and this file has to keep them apart in the
|
|
438
|
+
spoken ones. The aria-label is this component's own string, and a reader
|
|
439
|
+
told "no score yet" about a number that DID exist and arrived broken has
|
|
440
|
+
been told something untrue about their own record. */
|
|
441
|
+
const broken = value !== null && !Number.isFinite(value);
|
|
442
|
+
const score = value !== null && !broken ? value : null;
|
|
443
|
+
const usableBands = Array.isArray(bands) ? bands : [];
|
|
444
|
+
if (usableBands.length === 0) {
|
|
445
|
+
reportOnce("bands", "[opsinjs] <ScoreDial> was given no bands. The score has been drawn with no " +
|
|
446
|
+
"band and the words say so, which is the honest output: opsinjs ships no " +
|
|
447
|
+
"scales, no bands and no cut-offs, and a substituted default would be a " +
|
|
448
|
+
"score interpretation with no clinical owner. Pass the bands your product " +
|
|
449
|
+
"defined, each with its own name and its own source.");
|
|
450
|
+
}
|
|
451
|
+
/* OPSIN-0004, in the shape a band set takes. A band is two numbers that
|
|
452
|
+
define an interval somebody is compared against, which is the same class of
|
|
453
|
+
claim as a reference range: somebody chose those boundaries, and the reader
|
|
454
|
+
is entitled to know who. The type requires `source`; this file ships as
|
|
455
|
+
source into JavaScript projects where a type is advice. */
|
|
456
|
+
const bandSources = Array.from(new Set(usableBands
|
|
457
|
+
.map((entry) => (typeof entry.source === "string" ? entry.source.trim() : ""))
|
|
458
|
+
.filter((entry) => entry !== "")));
|
|
459
|
+
const bandSourcesComplete = usableBands.length > 0 &&
|
|
460
|
+
usableBands.every((entry) => typeof entry.source === "string" && entry.source.trim() !== "");
|
|
461
|
+
if (usableBands.length > 0 && !bandSourcesComplete) {
|
|
462
|
+
warnOnce("OPSIN-0004", { component: "ScoreDial" });
|
|
463
|
+
}
|
|
464
|
+
/* THE LEVEL IS AN INPUT. Refused rather than approximated when it is not one
|
|
465
|
+
this surface can discharge: there is no glyph for a level outside the four,
|
|
466
|
+
no action attached to the two upper ones here, and `unknown` is the absence
|
|
467
|
+
of an assertion rather than a fifth level. A reader who sees it rendered
|
|
468
|
+
as one reads it as reassurance. `String()` first, because a JavaScript
|
|
469
|
+
caller can pass anything at all. */
|
|
470
|
+
const given = status === undefined ? undefined : String(status);
|
|
471
|
+
let level;
|
|
472
|
+
if (given !== undefined) {
|
|
473
|
+
if (isDialStatus(given)) {
|
|
474
|
+
level = given;
|
|
475
|
+
}
|
|
476
|
+
else if (given === "unknown") {
|
|
477
|
+
warnOnce("OPSIN-0011", { component: "ScoreDial" });
|
|
478
|
+
}
|
|
479
|
+
else if (isClinicalStatus(given)) {
|
|
480
|
+
reportOnce("status-level", `[opsinjs] <ScoreDial> was given status="${given}" and rendered no status ` +
|
|
481
|
+
"at all. That level is defined as carrying a named action: who to " +
|
|
482
|
+
"contact, what to do, in the first line. A dial has nowhere to put " +
|
|
483
|
+
"one: it renders a number, a band name and a sentence about arithmetic. " +
|
|
484
|
+
"A bare status word beside a composite score is a level with no route to " +
|
|
485
|
+
"a person attached to it. Render a CareCard, which carries the action, or " +
|
|
486
|
+
"an AlertBanner, and keep the dial for the number.");
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
warnOnce("OPSIN-0021", { component: "ScoreDial", status: given });
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
/* OPSIN-0010. A category outside the six has no ramp, so the label would take
|
|
493
|
+
no tint at all and the axis would silently be gone. */
|
|
494
|
+
let tint;
|
|
495
|
+
if (category !== undefined) {
|
|
496
|
+
if (isHealthCategory(category)) {
|
|
497
|
+
tint = category;
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
warnOnce("OPSIN-0010", {
|
|
501
|
+
category: String(category),
|
|
502
|
+
known: HEALTH_CATEGORIES.join(", "),
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
/* NO OPSIN-0001 HERE, AND THAT IS DELIBERATE. This component takes both a
|
|
507
|
+
category and a status, and that is not the conflict the code describes: the
|
|
508
|
+
conflict is two axes resolving on ONE element. The category reaches the
|
|
509
|
+
label and nothing else; the status reaches the indicator and the band the
|
|
510
|
+
score fell in and nothing else. Putting the category on the surface and the
|
|
511
|
+
status inside it is the repair OPSIN-0001 asks for, built in. */
|
|
512
|
+
/* Derivation is mandatory content, so an empty one is reported and replaced
|
|
513
|
+
by words that say what is missing, rather than by an empty line the reader
|
|
514
|
+
would read as "there was nothing to say". There is no OPSIN code for this
|
|
515
|
+
yet; allocating one is not this file's to do, so the omission is reported
|
|
516
|
+
upward and the channel is the same. */
|
|
517
|
+
const derivationGiven = typeof derivation === "string" && derivation.trim() !== "";
|
|
518
|
+
if (!derivationGiven) {
|
|
519
|
+
reportOnce("derivation", "[opsinjs] <ScoreDial> was given no derivation. A sentence saying what went " +
|
|
520
|
+
"into the score and over what window is mandatory content, not an option: " +
|
|
521
|
+
"a bare number with no method invites the reader to supply one, and they " +
|
|
522
|
+
"will supply something worse than the truth. The dial now says that it " +
|
|
523
|
+
"cannot explain itself, which is true and is not what you want on screen. " +
|
|
524
|
+
"If nobody can write that sentence, render a Value instead of a dial.");
|
|
525
|
+
}
|
|
526
|
+
/* PRECISION IS REQUIRED, AND THE RUNTIME HAS TO AGREE WITH THE TYPE. The type
|
|
527
|
+
is `precision: number` because a composite score is arithmetic and a
|
|
528
|
+
fractional double is the ordinary case: with nothing stated Value rounds
|
|
529
|
+
nothing, and one IEEE 754 double prints up to seventeen digits in a single
|
|
530
|
+
tabular token with no break opportunity, which is wider than a phone column.
|
|
531
|
+
This file ships as source into JavaScript projects, where a required type is
|
|
532
|
+
advice a caller can ignore, so a non-number is reported (keyed on the
|
|
533
|
+
complaint, not the value) and `undefined` is passed on to Value and to the
|
|
534
|
+
spoken score. That keeps the fallback of showing the digits as handed rather
|
|
535
|
+
than substituting a number this component did not choose. */
|
|
536
|
+
const precisionGiven = typeof precision === "number";
|
|
537
|
+
if (!precisionGiven) {
|
|
538
|
+
reportOnce("precision", "[opsinjs] <ScoreDial> was rendered with no numeric `precision`, so the score " +
|
|
539
|
+
"was shown with exactly the digits it arrived with. A composite score is " +
|
|
540
|
+
"arithmetic, so a fractional double is the ordinary case, and an unstated " +
|
|
541
|
+
"precision can print as many as seventeen digits in one tabular token that " +
|
|
542
|
+
"is wider than a phone column at large text. Pass the decimal places your " +
|
|
543
|
+
"metric is meaningful to, as precision={1}; opsinjs invents no default.");
|
|
544
|
+
}
|
|
545
|
+
const resolvedPrecision = precisionGiven ? precision : undefined;
|
|
546
|
+
const coverageShort = coverage !== undefined &&
|
|
547
|
+
Number.isFinite(coverage.available) &&
|
|
548
|
+
Number.isFinite(coverage.expected) &&
|
|
549
|
+
coverage.available < coverage.expected;
|
|
550
|
+
/* OFF THE SCALE IS NOT AT THE END OF IT. The mark is refused and the words
|
|
551
|
+
say why, because an indicator clamped to the terminal draws 140 and 100 in
|
|
552
|
+
the same place: the picture asserts something specific and false while the
|
|
553
|
+
words beside it are true, which is the one configuration the two-channel
|
|
554
|
+
design exists to prevent. This component will not widen a scale a product
|
|
555
|
+
declared either. It cannot tell whether the scale is wrong or the score
|
|
556
|
+
is. */
|
|
557
|
+
const offScale = score !== null && scaleUsable && (score < min || score > max);
|
|
558
|
+
if (offScale && score !== null) {
|
|
559
|
+
reportOnce("off-scale", `[opsinjs] <ScoreDial> was given the score ${plain(score, locale)} on a scale ` +
|
|
560
|
+
`of ${plain(min, locale)} to ${plain(max, locale)}. No indicator was drawn ` +
|
|
561
|
+
"and the dial says in words that the score is outside its scale, because a " +
|
|
562
|
+
"mark at the end of the arc would show an off-scale score in the same place " +
|
|
563
|
+
"as one exactly at the bound. Either the scale is wrong or the score is; " +
|
|
564
|
+
"this component cannot tell which.");
|
|
565
|
+
}
|
|
566
|
+
const placeable = score !== null && scaleUsable && !offScale;
|
|
567
|
+
const fraction = placeable && score !== null ? (score - min) / span : 0;
|
|
568
|
+
const band = placeable && score !== null ? bandAt(usableBands, score, max) : undefined;
|
|
569
|
+
/* The band in words, and there is always something to say. Where the product
|
|
570
|
+
supplied no bands, or supplied bands this score falls outside, the words
|
|
571
|
+
say exactly that rather than reaching for a nearby one: a band this
|
|
572
|
+
component chose would be a score interpretation with no clinical owner. */
|
|
573
|
+
const bandWords = broken
|
|
574
|
+
? "No range is named, because the score could not be worked out."
|
|
575
|
+
: score === null
|
|
576
|
+
? "No range is named, because there is no score yet."
|
|
577
|
+
: !scaleUsable
|
|
578
|
+
? "We cannot place this score, because the scale has no width."
|
|
579
|
+
: offScale
|
|
580
|
+
? `This score is outside the ${plain(min, locale)} to ${plain(max, locale)} scale, so we cannot show where it sits.`
|
|
581
|
+
: band
|
|
582
|
+
? band.name
|
|
583
|
+
: usableBands.length === 0
|
|
584
|
+
? "This score has no named ranges, so we cannot say what it means."
|
|
585
|
+
: "This score is not inside any of the named ranges, so we cannot say what it means.";
|
|
586
|
+
/* The same three states again, in the same words `Value` prints for them, so
|
|
587
|
+
the ear and the eye get one answer between them. */
|
|
588
|
+
const scoreWords = broken
|
|
589
|
+
? "not available"
|
|
590
|
+
: score === null
|
|
591
|
+
? "no score yet"
|
|
592
|
+
: spokenScore(score, resolvedPrecision, locale);
|
|
593
|
+
/* "on a scale of" rather than "out of". This component's own specification is
|
|
594
|
+
explicit that a score is not a mark out of its upper bound, and "out of" is
|
|
595
|
+
the phrasing that produces exactly that reading. */
|
|
596
|
+
const scaleWords = `on a scale of ${plain(min, locale)} to ${plain(max, locale)}`;
|
|
597
|
+
const scaleSentence = `On a scale of ${plain(min, locale)} to ${plain(max, locale)}.`;
|
|
598
|
+
const derivationWords = derivationGiven
|
|
599
|
+
? derivation
|
|
600
|
+
: "This app does not say how the score was worked out.";
|
|
601
|
+
/* ATTRIBUTION IS ALL-OR-NOTHING. The gate is `bandSourcesComplete`, not
|
|
602
|
+
"some band named a source": printing "Ranges from Dr Okafor's 2025 review."
|
|
603
|
+
over a list where only the first interval came from that review credits the
|
|
604
|
+
rest of the scale to somebody who never chose it, which is a
|
|
605
|
+
reference-range-class claim with a false author. That is the thing
|
|
606
|
+
OPSIN-0004 exists to stop. One unattributed band makes the whole set
|
|
607
|
+
unattributed. */
|
|
608
|
+
const bandSourceWords = bandSourcesComplete
|
|
609
|
+
? `Ranges from ${bandSources.join("; ")}.`
|
|
610
|
+
: "Nobody is named as setting these ranges.";
|
|
611
|
+
/* The level is about the reading, so with no reading there is no level to
|
|
612
|
+
show. It is not attached to the band: a band is a stretch of a scale and a
|
|
613
|
+
status is what the product says about this number. */
|
|
614
|
+
const shownLevel = score === null ? undefined : level;
|
|
615
|
+
/**
|
|
616
|
+
* The accessible name for the arc: the whole component in one utterance.
|
|
617
|
+
*
|
|
618
|
+
* It repeats the visible twin on purpose, and the substrate contract requires
|
|
619
|
+
* `role="img"` with a label here rather than an `aria-hidden` graphic. The
|
|
620
|
+
* alternative is a graphic labelled only "dial", which is the tree of
|
|
621
|
+
* unlabelled shapes that accessible-charts.mdx names as the failure.
|
|
622
|
+
*/
|
|
623
|
+
const spoken = [
|
|
624
|
+
`${label}: ${scoreWords}, ${scaleWords}.`,
|
|
625
|
+
`${bandWords}${score !== null && band ? "." : ""}`,
|
|
626
|
+
shownLevel ? `${CLINICAL_STATUS_META[shownLevel].word}.` : "",
|
|
627
|
+
coverageShort && coverage
|
|
628
|
+
? `Based on ${plain(coverage.available, locale)} of ${plain(coverage.expected, locale)}.`
|
|
629
|
+
: "",
|
|
630
|
+
derivationWords,
|
|
631
|
+
]
|
|
632
|
+
.filter((part) => part !== "")
|
|
633
|
+
.join(" ");
|
|
634
|
+
/* THE INTERNAL EDGES, BY VALUE RATHER THAN BY POSITION IN THE ARRAY. The API
|
|
635
|
+
permits unordered and non-contiguous bands and says this component does not
|
|
636
|
+
reorder, merge or repair them, so taking every edge but the first DECLARED
|
|
637
|
+
one drew the wrong marks for any band set written out of order, and silently
|
|
638
|
+
dropped a real edge. Every `from` and every `to` becomes a candidate; the
|
|
639
|
+
two ends of the scale are excluded because the track's own ends already draw
|
|
640
|
+
them, and a mark on top of one reads as a band edge with no band beyond it. */
|
|
641
|
+
const boundaries = scaleUsable
|
|
642
|
+
? Array.from(new Set(usableBands
|
|
643
|
+
.flatMap((entry) => [entry.from, entry.to])
|
|
644
|
+
.map((edge) => round((edge - min) / span))
|
|
645
|
+
.filter((edge) => edge > 0 && edge < 1)))
|
|
646
|
+
: [];
|
|
647
|
+
/* No mark when there is no score to place, none when the scale cannot be
|
|
648
|
+
read, and none when the score is off the scale. A mark drawn anyway would
|
|
649
|
+
be a position asserted about a number that does not have one. */
|
|
650
|
+
const indicator = placeable ? needlePoints(fraction) : undefined;
|
|
651
|
+
/* The gradients the bezel, the face and the hub are filled with are defined
|
|
652
|
+
inside this SVG, so they need ids no other dial on the page shares. */
|
|
653
|
+
const gradientId = useId().replace(/[^a-zA-Z0-9_-]/g, "");
|
|
654
|
+
const calculatedOn = calculatedAt !== undefined && !Number.isNaN(Date.parse(calculatedAt))
|
|
655
|
+
? new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(new Date(calculatedAt))
|
|
656
|
+
: undefined;
|
|
657
|
+
if (calculatedAt !== undefined && calculatedOn === undefined) {
|
|
658
|
+
reportOnce("calculated-at", `[opsinjs] <ScoreDial> could not read calculatedAt="${String(calculatedAt)}" as ` +
|
|
659
|
+
"a date, so no date was rendered. Pass ISO 8601 with an offset, as in " +
|
|
660
|
+
"2026-03-14T08:12:00+01:00. An instant with no offset is read in " +
|
|
661
|
+
"whichever zone the code happens to be running in.");
|
|
662
|
+
}
|
|
663
|
+
return (_jsxs("div", { "data-slot": "score-dial", className: cn(
|
|
664
|
+
/* Stacked, always, and there is no overlaid variant to reflow from.
|
|
665
|
+
A score sitting inside the ring is the arrangement that breaks first
|
|
666
|
+
when a reader turns their text up, and the requirement is that the
|
|
667
|
+
derivation sentence never truncates. Laying it out this way once
|
|
668
|
+
means 200% is not a special case that has to be remembered.
|
|
669
|
+
|
|
670
|
+
The rhythm is two levels and only two. `gap-opsin-4` (16px) separates
|
|
671
|
+
the blocks of the root from each other, which space.json names as the
|
|
672
|
+
default gap between elements inside a card; `gap-opsin-2` (8px), whose
|
|
673
|
+
published use is the gap between tightly related lines, separates the
|
|
674
|
+
lines inside one block. Neither reaches for the 2px step space.json
|
|
675
|
+
calls an optical nudge rather than a layout step.
|
|
676
|
+
|
|
677
|
+
The column is capped at `--opsin-measure-comfortable`, the measure
|
|
678
|
+
token whose published use is the maximum line length for prose
|
|
679
|
+
anywhere in the product, which is the job the widest thing here does:
|
|
680
|
+
the derivation sentence. The 66ch fallback keeps the cap for a
|
|
681
|
+
consumer who installed the component without the token layer. The arc
|
|
682
|
+
inside keeps its own narrower cap. */
|
|
683
|
+
"flex w-full max-w-(--opsin-measure-comfortable,66ch) flex-col items-center gap-opsin-4 text-opsin-body", className), children: [_jsx("p", { "data-slot": "score-dial-label", "data-category": tint, className: `${LABEL_ROW} ${tint ? CATEGORY_TONE[tint] : "text-muted-foreground"}`, children: label }), _jsxs("svg", { "data-slot": "score-dial-track",
|
|
684
|
+
/* A labelled image, and nothing more. Not a meter, not a progressbar,
|
|
685
|
+
not a slider, and never in the tab order: this is a picture of a
|
|
686
|
+
reading somebody else assigned, and it has no value semantics of its
|
|
687
|
+
own to offer. */
|
|
688
|
+
role: "img", "aria-label": spoken, focusable: "false", viewBox: `0 0 ${String(VIEW_WIDTH)} ${String(VIEW_HEIGHT)}`,
|
|
689
|
+
/* Capped by the --opsin-graphic-dial token, which is spelled in rem so
|
|
690
|
+
the dial grows with the reader's root font size instead of staying put
|
|
691
|
+
while the words around it grow. The cap still yields to w-full when the
|
|
692
|
+
column is narrower than the token, so a cramped layout shrinks the dial
|
|
693
|
+
rather than clipping it. The drop under the bezel is what lifts the
|
|
694
|
+
instrument off the page; it is light and carries nothing. */
|
|
695
|
+
className: "h-auto w-full max-w-(--opsin-graphic-dial,17rem) [--dial-recess-top:color-mix(in_oklab,var(--foreground)_22%,transparent)] [--dial-recess-bottom:color-mix(in_oklab,var(--card)_55%,transparent)] dark:[--dial-recess-top:color-mix(in_oklab,var(--background)_75%,transparent)] dark:[--dial-recess-bottom:color-mix(in_oklab,var(--foreground)_9%,transparent)] drop-shadow-[0_10px_14px_oklch(0.205_0.006_250/0.14)] dark:drop-shadow-[0_12px_18px_oklch(0_0_0/0.6)] print:drop-shadow-none", children: [_jsxs("defs", { children: [_jsxs("linearGradient", { id: `${gradientId}-bezel`, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0", style: { stopColor: "color-mix(in oklab, var(--card), white 55%)" } }), _jsx("stop", { offset: "1", style: { stopColor: "color-mix(in oklab, var(--card), black 16%)" } })] }), _jsxs("radialGradient", { id: `${gradientId}-face`, cx: "0.5", cy: "0.38", r: "0.62", children: [_jsx("stop", { offset: "0", style: { stopColor: "var(--card)" } }), _jsx("stop", { offset: "1", style: { stopColor: "color-mix(in oklab, var(--card), black 7%)" } })] }), _jsxs("linearGradient", { id: `${gradientId}-recess`, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0", style: { stopColor: "var(--dial-recess-top)" } }), _jsx("stop", { offset: "0.55", style: { stopColor: "color-mix(in oklab, var(--card) 0%, transparent)" } }), _jsx("stop", { offset: "1", style: { stopColor: "var(--dial-recess-bottom)" } })] }), _jsxs("radialGradient", { id: `${gradientId}-hub`, cx: "0.35", cy: "0.3", r: "0.8", children: [_jsx("stop", { offset: "0", style: { stopColor: "color-mix(in oklab, var(--card), white 70%)" } }), _jsx("stop", { offset: "1", style: { stopColor: "color-mix(in oklab, var(--card), black 30%)" } })] })] }), _jsx("circle", { cx: CENTRE_X, cy: CENTRE_Y, r: BEZEL_RADIUS, fill: `url(#${gradientId}-bezel)`, stroke: "var(--edge)", strokeWidth: 0.6, className: "forced-colors:fill-[Canvas] forced-colors:stroke-[CanvasText]" }), _jsx("circle", { cx: CENTRE_X, cy: CENTRE_Y, r: FACE_RADIUS, fill: `url(#${gradientId}-face)`, className: "forced-colors:fill-[Canvas]" }), _jsx("circle", { cx: CENTRE_X, cy: CENTRE_Y, r: FACE_RADIUS - 0.6, fill: "none", stroke: `url(#${gradientId}-recess)`, strokeWidth: 1.2, className: "forced-colors:hidden" }), _jsx("path", { d: GRADUATIONS.minor, fill: "none", stroke: "currentColor", strokeWidth: 0.45, strokeLinecap: "round", className: "text-muted-foreground/55 forced-colors:stroke-[CanvasText]" }), _jsx("path", { d: GRADUATIONS.major, fill: "none", stroke: "currentColor", strokeWidth: 0.8, strokeLinecap: "round", className: "text-muted-foreground forced-colors:stroke-[CanvasText]" }), _jsx("path", { d: TRACK_PATH, fill: "none", stroke: "currentColor", strokeWidth: TRACK_WIDTH, strokeLinecap: "round", className: "text-[color-mix(in_oklab,var(--card),var(--foreground)_12%)] forced-colors:stroke-[CanvasText]" }), scaleUsable
|
|
696
|
+
? usableBands.map((entry, index) => {
|
|
697
|
+
const opens = clampFraction((entry.from - min) / span);
|
|
698
|
+
const closes = clampFraction((entry.to - min) / span);
|
|
699
|
+
const reach = Math.max(closes - opens, 0) * 100;
|
|
700
|
+
if (reach <= 0)
|
|
701
|
+
return null;
|
|
702
|
+
const active = band === entry && shownLevel !== undefined;
|
|
703
|
+
return (_jsx("path", { "data-slot": "score-dial-band", "data-status": active ? shownLevel : undefined, d: TRACK_PATH, pathLength: 100, fill: "none", stroke: "currentColor", strokeWidth: TRACK_WIDTH, strokeLinecap: "butt", strokeDasharray: `${String(round(reach))} 100`, strokeDashoffset: -round(opens * 100), className: active && shownLevel
|
|
704
|
+
? `${BAND_TONE[shownLevel]} forced-colors:stroke-[Highlight]`
|
|
705
|
+
: "text-[color-mix(in_oklab,var(--card),var(--foreground)_12%)] forced-colors:stroke-[CanvasText]" }, `${String(index)}:${String(entry.from)}:${entry.name}`));
|
|
706
|
+
})
|
|
707
|
+
: null, boundaries.map((edge) => {
|
|
708
|
+
const inner = pointAt(edge, RADIUS - BOUNDARY_REACH);
|
|
709
|
+
const outer = pointAt(edge, RADIUS + BOUNDARY_REACH);
|
|
710
|
+
return (_jsx("line", { "data-slot": "score-dial-boundary", x1: inner.x, y1: inner.y, x2: outer.x, y2: outer.y, stroke: "currentColor", strokeWidth: 1.1, strokeLinecap: "round", className: "text-foreground forced-colors:stroke-[CanvasText]" }, `boundary:${String(edge)}`));
|
|
711
|
+
}), scaleUsable ? (_jsxs("g", { "aria-hidden": "true", className: "fill-muted-foreground forced-colors:fill-[CanvasText]", style: { fontSize: 5.2, fontVariantNumeric: "tabular-nums" }, children: [_jsx("text", { x: pointAt(0, END_LABEL_RADIUS).x, y: pointAt(0, END_LABEL_RADIUS).y, textAnchor: "middle", dominantBaseline: "middle", children: plain(min, locale) }), _jsx("text", { x: pointAt(1, END_LABEL_RADIUS).x, y: pointAt(1, END_LABEL_RADIUS).y, textAnchor: "middle", dominantBaseline: "middle", children: plain(max, locale) })] })) : null, indicator === undefined ? null : (_jsx("polygon", { "data-slot": "score-dial-indicator", "data-status": shownLevel, points: indicator, fill: "currentColor", strokeLinejoin: "round", className: "drop-shadow-[0_0.6px_0.8px_oklch(0_0_0/0.35)] dark:drop-shadow-[0_0.6px_1px_oklch(0_0_0/0.8)] print:drop-shadow-none " +
|
|
712
|
+
(shownLevel
|
|
713
|
+
? `${INDICATOR_TONE[shownLevel]} forced-colors:fill-[CanvasText]`
|
|
714
|
+
: "text-foreground forced-colors:fill-[CanvasText]") })), _jsx("circle", { cx: CENTRE_X, cy: CENTRE_Y, r: HUB_RADIUS, fill: `url(#${gradientId}-hub)`, stroke: "var(--edge)", strokeWidth: 0.5, className: "forced-colors:fill-[Canvas] forced-colors:stroke-[CanvasText]" }), _jsx("circle", { cx: CENTRE_X, cy: CENTRE_Y, r: 1.5, className: "fill-foreground forced-colors:fill-[CanvasText]" })] }), _jsxs("div", { "data-slot": "score-dial-reading", className: "flex flex-col items-center gap-opsin-2 text-center", children: [_jsx("span", { "data-slot": "score-dial-score", children: _jsx(Value, { value: value, unit: null,
|
|
715
|
+
/* `precision` is required on Value and is a `number` here, because
|
|
716
|
+
it is ScoreDial's own required prop passed straight through. A
|
|
717
|
+
caller who defies the type and hands a non-number is caught by
|
|
718
|
+
Value's own precision guard, which falls back to the digits as
|
|
719
|
+
handed, so the "digits as arrived" behaviour is preserved without
|
|
720
|
+
widening Value's contract. `resolvedPrecision` still feeds the
|
|
721
|
+
spoken score, where an unstated precision means silence. */
|
|
722
|
+
precision: precision, locale: locale, absenceLabel: "no score yet", size: "display" }) }), _jsx("p", { "data-slot": "score-dial-band-name", className: `m-0 ${band ? "text-opsin-headline" : "text-opsin-body"}`, children: bandWords }), shownLevel !== undefined ? (_jsx(StatusPill, { status: shownLevel, describes: label })) : null] }), coverageShort && coverage ? (_jsxs("p", { "data-slot": "score-dial-coverage", className: "m-0 text-center text-opsin-subheadline", children: ["Based on ", plain(coverage.available, locale), " of ", plain(coverage.expected, locale), "."] })) : null, _jsxs("div", { "data-slot": "score-dial-scale", className: "flex flex-col items-center gap-opsin-2 text-center", children: [_jsx("p", { className: "m-0 text-opsin-subheadline", children: scaleSentence }), usableBands.length > 0 && scaleUsable ? (_jsxs(_Fragment, { children: [_jsx("ul", { className: "m-0 flex list-none flex-col gap-opsin-2 p-0 text-opsin-subheadline", children: usableBands.map((entry, index) => (_jsxs("li", { children: [plain(entry.from, locale), " up to ", plain(entry.to, locale), " is ", entry.name] }, `${String(index)}:${String(entry.from)}:${entry.name}`))) }), _jsx("p", { "data-slot": "score-dial-band-source", className: "m-0 text-opsin-footnote text-muted-foreground", children: bandSourceWords })] })) : null, usableBands.length > 0 && !scaleUsable ? (
|
|
723
|
+
/* The band list is suppressed rather than left standing, because a
|
|
724
|
+
reader told "we cannot place this score" while looking at a list
|
|
725
|
+
whose first row contains it has been given two answers. */
|
|
726
|
+
_jsx("p", { className: "m-0 text-opsin-footnote text-muted-foreground", children: "No ranges are shown, because the scale has no width." })) : null] }), _jsx("p", { "data-slot": "score-dial-derivation", className: "m-0 text-center text-opsin-footnote text-muted-foreground", children: derivationWords }), score === null ? null : (_jsx("p", { "data-slot": "score-dial-calculated-line", className: "m-0 text-center text-opsin-footnote text-muted-foreground", children: calculatedOn === undefined ? ("We do not know when this score was calculated.") : (_jsxs(_Fragment, { children: ["Calculated", " ", _jsx("time", { "data-slot": "score-dial-calculated-at", dateTime: calculatedAt, children: calculatedOn }), "."] })) }))] }));
|
|
727
|
+
}
|
|
728
|
+
//# sourceMappingURL=score-dial.js.map
|