基準値判定ReferenceValueExperimental
A measured value judged against a reference range: classifies it as normal / high (H) / low (L) / critical (HH/LL) and renders the value with a flag code, tone and screen-reader text — the value-vs-range judgement that vitals, lab results, dose safety, SLA/quota and tolerance bands all need. Exports a pure `flagValue()` helper for tables and charts.
プレビュー
Props
表は横にスクロールできます
| プロパティ | 型 | 初期値 | 説明 |
|---|---|---|---|
| value | number | - | The measured value. |
| range | { low?, high?, criticalLow?, criticalHigh? } | - | Reference range. Below low → L, above high → H, at/beyond criticalLow/criticalHigh → LL/HH. Critical bounds win. |
| format | (value: number) => ReactNode | - | Format the value and the range bounds. Default String(value). |
| unit | string | - | Unit suffix (e.g. "℃", "mg", "mEq/L"). |
| labels | Partial<Record<RangeFlag, string>> | - | Localized flag labels (announced + shown when showLabel). Defaults to JA (高値/低値/異常…). |
| showLabel / showRange | boolean | - | Show the flag label visibly / show the normal-range text (基準 36.0–37.5). |
| hideFlag | boolean | - | Hide the flag chip (value stays toned + sr-only flag text kept). Default false. |
| size | "default" | "inline" | "default" | inline is compact for table cells. |
| flagValue(value, range) | () => RangeFlag | - | Exported pure classifier → "normal" | "high" | "low" | "critical-high" | "critical-low". Use to colour table cells / chart points. |
Usage
import { ReferenceValue, flagValue } from "@gunjo/ui"
// value judged against a reference range → flag + tone + sr text
<ReferenceValue value={38.9} unit="℃" range={{ low: 36.0, high: 37.5, criticalHigh: 40.0 }} showRange />
<ReferenceValue value={88} unit="%" range={{ low: 96, criticalLow: 90 }} /> // → 88% LL (異常低値)
// the pure classifier, for colouring table cells / chart points without re-deriving
flagValue(6.8, { low: 3.5, high: 5.0, criticalHigh: 6.0 }) // → "critical-high"