@opsinjs/react 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +21 -0
  3. package/README.md +114 -2
  4. package/dist/components/accordion.d.ts +82 -0
  5. package/dist/components/accordion.d.ts.map +1 -0
  6. package/dist/components/accordion.js +154 -0
  7. package/dist/components/accordion.js.map +1 -0
  8. package/dist/components/alert-banner.d.ts +291 -0
  9. package/dist/components/alert-banner.d.ts.map +1 -0
  10. package/dist/components/alert-banner.js +529 -0
  11. package/dist/components/alert-banner.js.map +1 -0
  12. package/dist/components/avatar.d.ts +45 -0
  13. package/dist/components/avatar.d.ts.map +1 -0
  14. package/dist/components/avatar.js +159 -0
  15. package/dist/components/avatar.js.map +1 -0
  16. package/dist/components/badge.d.ts +78 -0
  17. package/dist/components/badge.d.ts.map +1 -0
  18. package/dist/components/badge.js +32 -0
  19. package/dist/components/badge.js.map +1 -0
  20. package/dist/components/body-map.d.ts +51 -0
  21. package/dist/components/body-map.d.ts.map +1 -0
  22. package/dist/components/body-map.js +190 -0
  23. package/dist/components/body-map.js.map +1 -0
  24. package/dist/components/button.d.ts +260 -0
  25. package/dist/components/button.d.ts.map +1 -0
  26. package/dist/components/button.js +609 -0
  27. package/dist/components/button.js.map +1 -0
  28. package/dist/components/callout.d.ts +99 -0
  29. package/dist/components/callout.d.ts.map +1 -0
  30. package/dist/components/callout.js +285 -0
  31. package/dist/components/callout.js.map +1 -0
  32. package/dist/components/card.d.ts +156 -0
  33. package/dist/components/card.d.ts.map +1 -0
  34. package/dist/components/card.js +396 -0
  35. package/dist/components/card.js.map +1 -0
  36. package/dist/components/care-card.d.ts +182 -0
  37. package/dist/components/care-card.d.ts.map +1 -0
  38. package/dist/components/care-card.js +544 -0
  39. package/dist/components/care-card.js.map +1 -0
  40. package/dist/components/checkbox.d.ts +58 -0
  41. package/dist/components/checkbox.d.ts.map +1 -0
  42. package/dist/components/checkbox.js +167 -0
  43. package/dist/components/checkbox.js.map +1 -0
  44. package/dist/components/combobox.d.ts +71 -0
  45. package/dist/components/combobox.d.ts.map +1 -0
  46. package/dist/components/combobox.js +204 -0
  47. package/dist/components/combobox.js.map +1 -0
  48. package/dist/components/consent-sheet.d.ts +186 -0
  49. package/dist/components/consent-sheet.d.ts.map +1 -0
  50. package/dist/components/consent-sheet.js +452 -0
  51. package/dist/components/consent-sheet.js.map +1 -0
  52. package/dist/components/dialog.d.ts +108 -0
  53. package/dist/components/dialog.d.ts.map +1 -0
  54. package/dist/components/dialog.js +573 -0
  55. package/dist/components/dialog.js.map +1 -0
  56. package/dist/components/disclaimer-note.d.ts +144 -0
  57. package/dist/components/disclaimer-note.d.ts.map +1 -0
  58. package/dist/components/disclaimer-note.js +486 -0
  59. package/dist/components/disclaimer-note.js.map +1 -0
  60. package/dist/components/divider.d.ts +76 -0
  61. package/dist/components/divider.d.ts.map +1 -0
  62. package/dist/components/divider.js +101 -0
  63. package/dist/components/divider.js.map +1 -0
  64. package/dist/components/dose-tracker.d.ts +137 -0
  65. package/dist/components/dose-tracker.d.ts.map +1 -0
  66. package/dist/components/dose-tracker.js +154 -0
  67. package/dist/components/dose-tracker.js.map +1 -0
  68. package/dist/components/empty-state.d.ts +171 -0
  69. package/dist/components/empty-state.d.ts.map +1 -0
  70. package/dist/components/empty-state.js +387 -0
  71. package/dist/components/empty-state.js.map +1 -0
  72. package/dist/components/field.d.ts +195 -0
  73. package/dist/components/field.d.ts.map +1 -0
  74. package/dist/components/field.js +282 -0
  75. package/dist/components/field.js.map +1 -0
  76. package/dist/components/goal-ring.d.ts +114 -0
  77. package/dist/components/goal-ring.d.ts.map +1 -0
  78. package/dist/components/goal-ring.js +254 -0
  79. package/dist/components/goal-ring.js.map +1 -0
  80. package/dist/components/icon-button.d.ts +124 -0
  81. package/dist/components/icon-button.d.ts.map +1 -0
  82. package/dist/components/icon-button.js +113 -0
  83. package/dist/components/icon-button.js.map +1 -0
  84. package/dist/components/link.d.ts +122 -0
  85. package/dist/components/link.d.ts.map +1 -0
  86. package/dist/components/link.js +164 -0
  87. package/dist/components/link.js.map +1 -0
  88. package/dist/components/log-sheet.d.ts +259 -0
  89. package/dist/components/log-sheet.d.ts.map +1 -0
  90. package/dist/components/log-sheet.js +437 -0
  91. package/dist/components/log-sheet.js.map +1 -0
  92. package/dist/components/menu.d.ts +69 -0
  93. package/dist/components/menu.d.ts.map +1 -0
  94. package/dist/components/menu.js +190 -0
  95. package/dist/components/menu.js.map +1 -0
  96. package/dist/components/metric-tile.d.ts +301 -0
  97. package/dist/components/metric-tile.d.ts.map +1 -0
  98. package/dist/components/metric-tile.js +533 -0
  99. package/dist/components/metric-tile.js.map +1 -0
  100. package/dist/components/number-field.d.ts +62 -0
  101. package/dist/components/number-field.d.ts.map +1 -0
  102. package/dist/components/number-field.js +134 -0
  103. package/dist/components/number-field.js.map +1 -0
  104. package/dist/components/popover.d.ts +70 -0
  105. package/dist/components/popover.d.ts.map +1 -0
  106. package/dist/components/popover.js +174 -0
  107. package/dist/components/popover.js.map +1 -0
  108. package/dist/components/progress.d.ts +83 -0
  109. package/dist/components/progress.d.ts.map +1 -0
  110. package/dist/components/progress.js +140 -0
  111. package/dist/components/progress.js.map +1 -0
  112. package/dist/components/questionnaire.d.ts +123 -0
  113. package/dist/components/questionnaire.d.ts.map +1 -0
  114. package/dist/components/questionnaire.js +148 -0
  115. package/dist/components/questionnaire.js.map +1 -0
  116. package/dist/components/radio-group.d.ts +66 -0
  117. package/dist/components/radio-group.d.ts.map +1 -0
  118. package/dist/components/radio-group.js +186 -0
  119. package/dist/components/radio-group.js.map +1 -0
  120. package/dist/components/range-bar.d.ts +172 -0
  121. package/dist/components/range-bar.d.ts.map +1 -0
  122. package/dist/components/range-bar.js +578 -0
  123. package/dist/components/range-bar.js.map +1 -0
  124. package/dist/components/range-legend.d.ts +97 -0
  125. package/dist/components/range-legend.d.ts.map +1 -0
  126. package/dist/components/range-legend.js +166 -0
  127. package/dist/components/range-legend.js.map +1 -0
  128. package/dist/components/reading-input.d.ts +225 -0
  129. package/dist/components/reading-input.d.ts.map +1 -0
  130. package/dist/components/reading-input.js +651 -0
  131. package/dist/components/reading-input.js.map +1 -0
  132. package/dist/components/relative-time.d.ts +177 -0
  133. package/dist/components/relative-time.d.ts.map +1 -0
  134. package/dist/components/relative-time.js +603 -0
  135. package/dist/components/relative-time.js.map +1 -0
  136. package/dist/components/result-card.d.ts +319 -0
  137. package/dist/components/result-card.d.ts.map +1 -0
  138. package/dist/components/result-card.js +614 -0
  139. package/dist/components/result-card.js.map +1 -0
  140. package/dist/components/scale-input.d.ts +58 -0
  141. package/dist/components/scale-input.d.ts.map +1 -0
  142. package/dist/components/scale-input.js +170 -0
  143. package/dist/components/scale-input.js.map +1 -0
  144. package/dist/components/score-dial.d.ts +205 -0
  145. package/dist/components/score-dial.d.ts.map +1 -0
  146. package/dist/components/score-dial.js +728 -0
  147. package/dist/components/score-dial.js.map +1 -0
  148. package/dist/components/scroll-area.d.ts +38 -0
  149. package/dist/components/scroll-area.d.ts.map +1 -0
  150. package/dist/components/scroll-area.js +138 -0
  151. package/dist/components/scroll-area.js.map +1 -0
  152. package/dist/components/segmented-control.d.ts +69 -0
  153. package/dist/components/segmented-control.d.ts.map +1 -0
  154. package/dist/components/segmented-control.js +259 -0
  155. package/dist/components/segmented-control.js.map +1 -0
  156. package/dist/components/select.d.ts +72 -0
  157. package/dist/components/select.d.ts.map +1 -0
  158. package/dist/components/select.js +205 -0
  159. package/dist/components/select.js.map +1 -0
  160. package/dist/components/sheet.d.ts +192 -0
  161. package/dist/components/sheet.d.ts.map +1 -0
  162. package/dist/components/sheet.js +952 -0
  163. package/dist/components/sheet.js.map +1 -0
  164. package/dist/components/skeleton.d.ts +104 -0
  165. package/dist/components/skeleton.d.ts.map +1 -0
  166. package/dist/components/skeleton.js +266 -0
  167. package/dist/components/skeleton.js.map +1 -0
  168. package/dist/components/slider.d.ts +55 -0
  169. package/dist/components/slider.d.ts.map +1 -0
  170. package/dist/components/slider.js +170 -0
  171. package/dist/components/slider.js.map +1 -0
  172. package/dist/components/source-citation.d.ts +127 -0
  173. package/dist/components/source-citation.d.ts.map +1 -0
  174. package/dist/components/source-citation.js +391 -0
  175. package/dist/components/source-citation.js.map +1 -0
  176. package/dist/components/spinner.d.ts +86 -0
  177. package/dist/components/spinner.d.ts.map +1 -0
  178. package/dist/components/spinner.js +97 -0
  179. package/dist/components/spinner.js.map +1 -0
  180. package/dist/components/status-pill.d.ts +90 -0
  181. package/dist/components/status-pill.d.ts.map +1 -0
  182. package/dist/components/status-pill.js +259 -0
  183. package/dist/components/status-pill.js.map +1 -0
  184. package/dist/components/stepper.d.ts +99 -0
  185. package/dist/components/stepper.d.ts.map +1 -0
  186. package/dist/components/stepper.js +152 -0
  187. package/dist/components/stepper.js.map +1 -0
  188. package/dist/components/surface.d.ts +92 -0
  189. package/dist/components/surface.d.ts.map +1 -0
  190. package/dist/components/surface.js +261 -0
  191. package/dist/components/surface.js.map +1 -0
  192. package/dist/components/switch.d.ts +48 -0
  193. package/dist/components/switch.d.ts.map +1 -0
  194. package/dist/components/switch.js +152 -0
  195. package/dist/components/switch.js.map +1 -0
  196. package/dist/components/symptom-picker.d.ts +69 -0
  197. package/dist/components/symptom-picker.d.ts.map +1 -0
  198. package/dist/components/symptom-picker.js +170 -0
  199. package/dist/components/symptom-picker.js.map +1 -0
  200. package/dist/components/tab-bar.d.ts +110 -0
  201. package/dist/components/tab-bar.d.ts.map +1 -0
  202. package/dist/components/tab-bar.js +118 -0
  203. package/dist/components/tab-bar.js.map +1 -0
  204. package/dist/components/table.d.ts +117 -0
  205. package/dist/components/table.d.ts.map +1 -0
  206. package/dist/components/table.js +65 -0
  207. package/dist/components/table.js.map +1 -0
  208. package/dist/components/tabs.d.ts +106 -0
  209. package/dist/components/tabs.d.ts.map +1 -0
  210. package/dist/components/tabs.js +136 -0
  211. package/dist/components/tabs.js.map +1 -0
  212. package/dist/components/term.d.ts +243 -0
  213. package/dist/components/term.d.ts.map +1 -0
  214. package/dist/components/term.js +562 -0
  215. package/dist/components/term.js.map +1 -0
  216. package/dist/components/textarea.d.ts +157 -0
  217. package/dist/components/textarea.d.ts.map +1 -0
  218. package/dist/components/textarea.js +66 -0
  219. package/dist/components/textarea.js.map +1 -0
  220. package/dist/components/timeline-entry.d.ts +99 -0
  221. package/dist/components/timeline-entry.d.ts.map +1 -0
  222. package/dist/components/timeline-entry.js +47 -0
  223. package/dist/components/timeline-entry.js.map +1 -0
  224. package/dist/components/toast.d.ts +80 -0
  225. package/dist/components/toast.d.ts.map +1 -0
  226. package/dist/components/toast.js +266 -0
  227. package/dist/components/toast.js.map +1 -0
  228. package/dist/components/tooltip.d.ts +48 -0
  229. package/dist/components/tooltip.d.ts.map +1 -0
  230. package/dist/components/tooltip.js +159 -0
  231. package/dist/components/tooltip.js.map +1 -0
  232. package/dist/components/trend-sparkline.d.ts +188 -0
  233. package/dist/components/trend-sparkline.d.ts.map +1 -0
  234. package/dist/components/trend-sparkline.js +796 -0
  235. package/dist/components/trend-sparkline.js.map +1 -0
  236. package/dist/components/value.d.ts +150 -0
  237. package/dist/components/value.d.ts.map +1 -0
  238. package/dist/components/value.js +402 -0
  239. package/dist/components/value.js.map +1 -0
  240. package/dist/components/visually-hidden.d.ts +61 -0
  241. package/dist/components/visually-hidden.d.ts.map +1 -0
  242. package/dist/components/visually-hidden.js +172 -0
  243. package/dist/components/visually-hidden.js.map +1 -0
  244. package/dist/index.d.ts +63 -0
  245. package/dist/index.d.ts.map +1 -0
  246. package/dist/index.js +72 -0
  247. package/dist/index.js.map +1 -0
  248. package/dist/opsinjs.d.ts +443 -0
  249. package/dist/opsinjs.d.ts.map +1 -0
  250. package/dist/opsinjs.js +906 -0
  251. package/dist/opsinjs.js.map +1 -0
  252. package/dist/status.d.ts +111 -0
  253. package/dist/status.d.ts.map +1 -0
  254. package/dist/status.js +125 -0
  255. package/dist/status.js.map +1 -0
  256. package/dist/styles.css +2 -0
  257. package/dist/utils.d.ts +20 -0
  258. package/dist/utils.d.ts.map +1 -0
  259. package/dist/utils.js +82 -0
  260. package/dist/utils.js.map +1 -0
  261. package/package.json +86 -3
  262. package/styles/base.css +132 -0
  263. package/styles/roles.css +412 -0
  264. package/styles/standalone.css +20 -0
  265. package/styles/tailwind.css +18 -0
  266. package/styles/theme.css +309 -0
@@ -0,0 +1,291 @@
1
+ /**
2
+ * AlertBanner puts a message at the top of a surface, at one of the four
3
+ * levels, because something has changed that the reader needs to know about
4
+ * before they carry on with what they came to do.
5
+ *
6
+ * THIS IS THE ONE COMPONENT IN OPSINJS ENTITLED TO `role="alert"`, AND ONLY AT
7
+ * `urgent`. Every other surface in the system announces politely or not at all,
8
+ * and none of them may mount a live region on a caller's behalf. The whole of
9
+ * the announcement contract is these four rows, and it is the reason the
10
+ * component exists as a governed surface rather than as a div with a red
11
+ * border:
12
+ *
13
+ * steady no role, no live region. Ordinary content in the reading order.
14
+ * watch the same.
15
+ * attention `aria-live="polite"` and `aria-atomic="true"` on an inner
16
+ * wrapper. It waits for a gap in whatever the reader is listening
17
+ * to.
18
+ * urgent `role="alert"` on that same wrapper, which implies assertive and
19
+ * atomic, with `aria-atomic="true"` written out anyway. It
20
+ * interrupts.
21
+ *
22
+ * THE LIVE REGION IS AN INNER WRAPPER, NOT THE ROOT. It holds only the heading
23
+ * and the body, so an announcement carries the level and the sentence and
24
+ * nothing else. The actions, the dismiss control and any timestamp are direct
25
+ * children of the section after it and sit outside the region, so a reader
26
+ * reaches them as controls rather than hearing them read out inside an atomic
27
+ * string, and a control or a timestamp that changes re-announces nothing.
28
+ *
29
+ * A BANNER PRESENT WHEN THE PAGE LOADS SHOULD NOT BE ANNOUNCED AS A CHANGE, and
30
+ * this file implements exactly none of that. Screen readers do not announce
31
+ * live regions that were in the document at load; they announce what arrives
32
+ * afterwards. So the behaviour the specification asks for is a behaviour we
33
+ * inherit rather than one we wrote, and the honest way to record that is to say
34
+ * so here and on the page rather than to claim it. The alternative is to mount
35
+ * the role after a frame, so the component can be sure. That moves an
36
+ * announcement decision into a timer, and a timer is the thing that fires while
37
+ * somebody is mid-sentence.
38
+ *
39
+ * THE WORD AND THE GLYPH ARE DELEGATED TO StatusPill, WHICH IS WHY THIS FILE
40
+ * DRAWS NO STATUS OF ITS OWN. It paints the fill, the ink and the boundary of a
41
+ * status surface, and then renders a pill inside the heading for the level's
42
+ * word and its distinct silhouette. `scripts/check-a11y.mts` used to report an
43
+ * A11Y001 WARNING for this file for that reason: it reads one file at a time,
44
+ * it could see `data-status` and a status fill here and no
45
+ * `CLINICAL_STATUS_META` and no lucide import, and it did not follow the import
46
+ * to find where the word went. That repair is now in place. For the A11Y001
47
+ * status surface the check follows the one import it can vouch for, reading the
48
+ * sibling it imports as `./status-pill.tsx` one hop, and it clears this file
49
+ * because StatusPill is itself a proven carrier that reads
50
+ * `CLINICAL_STATUS_META` and imports lucide. The delegation is confirmed in
51
+ * code rather than by a second copy of the four words in this file.
52
+ *
53
+ * WHY THE PILL SITS INSIDE THE HEADING. The specification requires the level's
54
+ * word to be in the heading so that grayscale, colour-vision deficiency and
55
+ * text-only rendering all keep the meaning. It also asks the CALLER to put it
56
+ * there, in a `heading` string that "must contain the level's word". A rule a
57
+ * caller can break silently is not a rule: a heading reading *Urgent* over
58
+ * `status="watch"` is two different verdicts on one surface, and nothing catches
59
+ * it. Rendering the pill as the heading's first child makes the word structural.
60
+ * Heading navigation lands on "Needs attention, your example measurement is
61
+ * outside the range your clinic set", the word cannot disagree with the level,
62
+ * and the caller's sentence is free to name the subject, which is the half only
63
+ * they know.
64
+ *
65
+ * IT DERIVES NOTHING. `status` is assigned by the consuming product from a
66
+ * reference range or a clinically reviewed threshold that the product owns.
67
+ * There is no comparison in this file, no threshold, no default staleness and
68
+ * no rule that raises or lowers a level.
69
+ *
70
+ * IT IS A SERVER COMPONENT. No state, no hook, no timer, no Base UI primitive,
71
+ * and no entrance animation to schedule. `onSelect` and `onAcknowledge` do not
72
+ * change that: a function cannot cross the server/client boundary, so a banner
73
+ * given one is already being rendered by a client component and this file joins
74
+ * that graph without a directive of its own. The `href` form of an action stays
75
+ * server-rendered, and it is the form to prefer.
76
+ */
77
+ import type { ReactNode } from "react";
78
+ import { type ClinicalStatus } from "../opsinjs.ts";
79
+ /**
80
+ * The heading levels a banner may take. There is no `h1`: a banner is never a
81
+ * page.
82
+ *
83
+ * DECLARED, NOT EXPORTED. A component file's public surface is the props
84
+ * interface and the component, and every symbol beyond those is one more name
85
+ * @opsinjs/react publishes and this system has to keep stable. A caller who
86
+ * needs to name the union writes `AlertBannerProps["headingLevel"]`, which is
87
+ * the same union and cannot drift from it. Callout declares its variant union
88
+ * the same way for the same reason.
89
+ */
90
+ type AlertHeadingLevel = 2 | 3 | 4 | 5 | 6;
91
+ /**
92
+ * One thing the reader can do about the message.
93
+ *
94
+ * EXPORTED, unlike the union above, because a caller assembling actions
95
+ * somewhere other than the JSX needs to name the element type, and
96
+ * `AlertBannerProps["actions"]` is `AlertAction[] | undefined`, which is the
97
+ * wrong shape for that. The declaration itself reads
98
+ * `const actions: AlertAction[] = …`. ScoreDial exports `ScoreBand` for the
99
+ * same reason. The generated props table only covers interfaces named
100
+ * `<Pascal>Props`, so this one is documented by hand on the specification page.
101
+ */
102
+ export interface AlertAction {
103
+ /**
104
+ * Imperative and concrete, naming what happens: *Contact your clinic*, not
105
+ * *Learn more*. It is the accessible name of the control and the thing a
106
+ * voice-control user has to say out loud.
107
+ */
108
+ label: string;
109
+ /**
110
+ * Where it goes. Renders an anchor, which survives a new tab, a copied
111
+ * address and a screen reader's list of links.
112
+ */
113
+ href?: string;
114
+ /**
115
+ * What it does. Renders a Button. Supply one of `href` and `onSelect`: an
116
+ * action with neither is a control that acknowledges a press and then does
117
+ * nothing, which reads as a broken screen.
118
+ */
119
+ onSelect?: () => void;
120
+ /**
121
+ * Marks the action the product recommends. Emphasis follows POSITION rather
122
+ * than this flag. The first action is the recommended one, because a
123
+ * screen-reader user meets the actions in DOM order and the recommended one
124
+ * has to be the one they meet first. Set on any action but the first, it is
125
+ * refused and reported: reading order and visual emphasis disagreeing is the
126
+ * defect, not the flag.
127
+ */
128
+ recommended?: boolean;
129
+ }
130
+ export interface AlertBannerProps {
131
+ /**
132
+ * The level, assigned by the product. Required, and it drives the role, the
133
+ * announcement and the affordances rather than only the colour.
134
+ *
135
+ * `steady` is legal, and it is the level worth being careful with. Its one
136
+ * honest use is de-escalation. That means saying that a condition the
137
+ * product raised earlier has resolved, which is news the reader is owed and
138
+ * which no other component in the system delivers. It is not a place to put a
139
+ * message that needs nothing: a banner that can say "nothing needs
140
+ * attention" is a banner a product will reach for whenever it wants to be
141
+ * noticed, and it still spends one of the two the screen is allowed. If
142
+ * nothing has changed, the component is a Callout.
143
+ *
144
+ * There is no `unknown`. It is the absence of an assertion rather than a fifth
145
+ * level, and an interruption with no level is an interruption with no meaning.
146
+ *
147
+ * ESCALATE BY REMOUNTING, NOT BY RE-RENDERING. Raising the level on a banner
148
+ * that is already on the screen patches `role` and `aria-live` onto a DOM
149
+ * node assistive technology has already registered, and a live region is
150
+ * registered when its node is inserted: adding the role afterwards commonly
151
+ * announces nothing at all, which on the way up to `urgent` is the one
152
+ * failure this component exists to prevent. Give the element a key that
153
+ * contains the level, so React replaces the node instead of patching it. That
154
+ * key is `key={status}`. Nobody has confirmed this with a screen reader; it
155
+ * is the conservative reading of the live-region model and it is written
156
+ * here rather than left implicit, because the recipe this component appears
157
+ * in escalates exactly this way.
158
+ */
159
+ status: ClinicalStatus;
160
+ /**
161
+ * What happened, in the reader's words, naming the subject in under eight
162
+ * words. Sentence case, and no exclamation marks.
163
+ *
164
+ * It does NOT need to contain the level's word, and should not repeat it: the
165
+ * component renders the level as a StatusPill inside this heading, so the word
166
+ * is there whatever the caller writes and cannot disagree with `status`. The
167
+ * specification asked the caller to write it in; making it structural is the
168
+ * one change this implementation makes to that contract.
169
+ */
170
+ heading: string;
171
+ /**
172
+ * One or two sentences: what happened, then what it means for this reader, in
173
+ * that order and in the second person. Longer than that and the message is an
174
+ * instruction with steps, which is a CareCard.
175
+ */
176
+ children: ReactNode;
177
+ /**
178
+ * Which heading element the banner's heading renders as. Defaults to `h2`.
179
+ *
180
+ * The component cannot know where it sits, and a heading at the wrong level
181
+ * makes an outline that skips a level on one screen and repeats one on the
182
+ * next. Pass the level below the heading of the surface the banner is on.
183
+ * Inside a section that already has an `h2`, pass `h3`.
184
+ */
185
+ headingLevel?: AlertHeadingLevel;
186
+ /**
187
+ * When the condition was detected, ISO 8601 with an offset. The instant the
188
+ * product's rules found the condition, not the instant this rendered. A
189
+ * banner stamped with its own render time tells the reader something that is
190
+ * true of the page and false of their data.
191
+ *
192
+ * IT IS CARRIED AS `data-detected-at` ON THE ROOT AND IS NOT RENDERED AS A
193
+ * PHRASE. RelativeTime has no word for an instant a product's rules produced,
194
+ * and the three obvious candidates, 'detected', 'flagged' and 'triggered',
195
+ * are banned as machine register by the content doctrine. Built from one of
196
+ * RelativeTime's five near words, "Recorded 1 hour ago" over a sentence about
197
+ * a reading would be taken for the age of the reading, which it is not: a rule
198
+ * that ran an hour ago may have found a reading taken days before it, and that
199
+ * pair of separately-true statements is what RelativeTime's own file calls
200
+ * the most consequential error in health dashboards. So the instant stays in
201
+ * the DOM for a stylesheet, a test and an export, and the banner asserts
202
+ * nothing about it in words. If the reader needs to know how old the reading
203
+ * is, show that where the reading is.
204
+ */
205
+ detectedAt?: string;
206
+ /**
207
+ * The instant `detectedAt` would be measured against, in the same form. It
208
+ * renders no phrase today, because RelativeTime has no word for an instant a
209
+ * product's rules produced and the obvious candidates are banned as machine
210
+ * register. The one thing it drives is a development warning: passing it says
211
+ * you expected a rendered relative phrase, so the component tells you none is
212
+ * rendered rather than swallowing the prop in silence. The prop is retained
213
+ * for the day that grammar gains such a word, so a caller already passing the
214
+ * pair does not have to change when the phrase returns. A component that read the
215
+ * clock itself would be impure and would make two timestamps on one screen
216
+ * disagree across a minute boundary, so where it is passed, read it once where
217
+ * the screen is rendered as `new Date().toISOString()` and pass the same value
218
+ * to every timestamp on it.
219
+ */
220
+ now?: string;
221
+ /**
222
+ * At most two. Required at `attention` and `urgent`. At those two levels a
223
+ * banner with nothing to do about it is the most common way a health product
224
+ * creates anxiety it cannot resolve, and this component reports the omission
225
+ * rather than quietly rendering it.
226
+ */
227
+ actions?: AlertAction[];
228
+ /**
229
+ * Whether the reader may take the banner away. It needs `onAcknowledge` to do
230
+ * anything at any level: this component never removes itself, so the product
231
+ * is what stops rendering it, and a dismiss control with nowhere to report to
232
+ * is a control that does nothing.
233
+ */
234
+ dismissible?: boolean;
235
+ /**
236
+ * Called when the reader dismisses the banner. At `urgent` it is the whole of
237
+ * the affordance: an urgent banner may only be taken away by an
238
+ * acknowledgement the product records, because a reader who swipes a banner
239
+ * away on a bus has not been informed and nothing downstream can tell
240
+ * dismissal apart from understanding.
241
+ */
242
+ onAcknowledge?: () => void;
243
+ /**
244
+ * The dismiss control's visible word. Defaults to *Dismiss*, and the heading
245
+ * is appended to the accessible name so it says what it dismisses rather than
246
+ * standing alone. Override it to translate, or to say what acknowledgement
247
+ * means in this product. One product might say *I have read this*.
248
+ */
249
+ dismissLabel?: string;
250
+ /**
251
+ * BCP 47 language tag for a formatted value. The banner has none to format
252
+ * today: the timestamp was the one formatted thing on the surface and it is
253
+ * withdrawn, because RelativeTime has no word for an instant a product's rules
254
+ * produced. Like `now`, passing it beside `detectedAt` raises the development
255
+ * warning that no phrase is rendered. The prop is retained for the day a
256
+ * formatted value returns, and when one does, omitted, the reader's own
257
+ * environment decides. It does not translate the dismiss control;
258
+ * `dismissLabel` is the override for that word.
259
+ */
260
+ locale?: string;
261
+ /**
262
+ * IANA time zone name (for example `Europe/London`) for a formatted absolute
263
+ * time. The banner has none to format today, for the reason `locale` gives:
264
+ * the timestamp was the one formatted thing on the surface and it is
265
+ * withdrawn. It is retained beside `now` and `locale` so a caller who is
266
+ * already forwarding the reading's zone does not have to change on the day a
267
+ * formatted value returns, and when one does return this is the prop that
268
+ * decides the reader's wall clock rather than the instant's stored offset.
269
+ * Like `now` and `locale`, passing it beside `detectedAt` raises the
270
+ * development warning that no phrase is rendered. Pass an IANA name rather
271
+ * than an offset such as `+01:00`: an offset cannot name a place and does not
272
+ * survive a daylight-saving boundary, which is the trap RelativeTime's own
273
+ * `timeZone` guard rejects.
274
+ */
275
+ timeZone?: string;
276
+ /**
277
+ * Merged onto the root, and a class passed here WINS over the component's own
278
+ * where the two conflict. A banner sets no width and no margin, because both
279
+ * belong to the surface it sits at the top of.
280
+ *
281
+ * It is also the one way left to hide what this component insists on: a
282
+ * `sr-only`, a zeroed type size or a `truncate` passed here reaches the root
283
+ * and takes the heading, the body or the actions off the screen while leaving
284
+ * them in the tree. The component says so rather than pretending the hole is
285
+ * not there.
286
+ */
287
+ className?: string;
288
+ }
289
+ export declare function AlertBanner({ status, heading, children, headingLevel, detectedAt, now, locale, timeZone, actions, dismissible, onAcknowledge, dismissLabel, className, }: AlertBannerProps): import("react").JSX.Element | null;
290
+ export {};
291
+ //# sourceMappingURL=alert-banner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-banner.d.ts","sourceRoot":"","sources":["../../src/components/alert-banner.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,eAAe,CAAA;AAwNtB;;;;;;;;;;GAUG;AACH,KAAK,iBAAiB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,MAAM,EAAE,cAAc,CAAA;IACtB;;;;;;;;;OASG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,iBAAiB,CAAA;IAChC;;;;;;;;;;;;;;;;;;OAkBG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;;;;;;;;OAaG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;;OAKG;IACH,OAAO,CAAC,EAAE,WAAW,EAAE,CAAA;IACvB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAoID,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,OAAO,EACP,QAAQ,EACR,YAAgB,EAChB,UAAU,EACV,GAAG,EACH,MAAM,EACN,QAAQ,EACR,OAAO,EACP,WAAmB,EACnB,aAAa,EACb,YAAY,EACZ,SAAS,GACV,EAAE,gBAAgB,sCA4alB"}