@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,529 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { isClinicalStatus, isDevelopment, warnOnce, } from "../opsinjs.js";
3
+ import { cn } from "../utils.js";
4
+ import { Button, cardActionClassName } from "./button.js";
5
+ import { Link } from "./link.js";
6
+ import { StatusPill } from "./status-pill.js";
7
+ /**
8
+ * Development warnings, said once per distinct offender.
9
+ *
10
+ * `warnOnce` in the substrate is keyed to an `OpsinErrorCode`, and the codes in
11
+ * `tokens/errors.json` describe mistakes a consumer makes with the clinical
12
+ * API. Two of the complaints below have one. A status outside the four levels
13
+ * and `unknown` used as a fifth both go through `warnOnce`. The rest are
14
+ * mistakes with THIS component's own API, no code exists for them, and a
15
+ * component may not mint one: the codes are a versioned contract and the table
16
+ * on the errors page is generated from that file. So this file keeps a small
17
+ * set of its own, keyed the way `warnOnce` keys its own, because a warning
18
+ * printed on every render degrades into noise, and it prints twice per render
19
+ * under Strict Mode. A noisy channel is one somebody switches off.
20
+ *
21
+ * The key is coarser than "once per call site", because a call site is not
22
+ * observable from inside a function. Two banners with the same heading and the
23
+ * same mistake share one warning. That is the most this can honestly promise.
24
+ */
25
+ const MAX_WARNED_KEYS = 500;
26
+ /** Not a real key. It only records that the cap notice has been printed. */
27
+ const CAP_KEY = "\u0000cap";
28
+ /* Allocated on first use rather than at module scope, so a production bundle,
29
+ where `warnDev` returns before it reads anything, carries no set at all. */
30
+ let warned;
31
+ function warnDev(key, message) {
32
+ if (!isDevelopment())
33
+ return;
34
+ if (warned === undefined)
35
+ warned = new Set();
36
+ if (warned.has(key))
37
+ return;
38
+ /* BOUNDED, BECAUSE EVERY KEY HERE CONTAINS CALLER-SUPPLIED HEADING TEXT. The
39
+ set is never cleared and a development session runs for days, so a screen
40
+ rendering a banner per subject grows it without a ceiling. At the cap the
41
+ channel says so once and then goes quiet, rather than either leaking or
42
+ reverting to warning on every render. `warnOnce` in the substrate caps its
43
+ own shared channel at the same number for the same reason: a warning
44
+ channel that degrades into noise is one somebody switches off. */
45
+ if (warned.size >= MAX_WARNED_KEYS) {
46
+ if (!warned.has(CAP_KEY)) {
47
+ warned.add(CAP_KEY);
48
+ console.warn(`[opsinjs] <AlertBanner> has reported ${MAX_WARNED_KEYS} distinct ` +
49
+ "development warnings and will not report new ones for the rest of " +
50
+ "this session. Fix the ones already printed and reload.");
51
+ }
52
+ return;
53
+ }
54
+ warned.add(key);
55
+ console.warn(message);
56
+ }
57
+ /**
58
+ * Tailwind reads class names out of source as literal strings, so these cannot
59
+ * be assembled from the level at runtime. `bg-status-${status}-surface`
60
+ * generates no CSS at all and the banner renders unstyled on a white page with
61
+ * no boundary. Written out, once, exactly as StatusPill writes its own.
62
+ *
63
+ * Which role does which job matters more here than anywhere else in the system,
64
+ * because this is the only surface in opsinjs that takes a status fill. `-ink`
65
+ * is the text guaranteed legible on `-surface`. The LINE role rides as
66
+ * `--banner-line` and draws the boundary at a little over a third of its
67
+ * strength on screen and at full strength on paper. `-accent` is absent on purpose: it is
68
+ * the identity fill, chosen for recognition rather than contrast, and it is
69
+ * never text and never a sole boundary.
70
+ *
71
+ * ONE TREATMENT AND FOUR TINTS, with no extra weight at the top of the ladder.
72
+ * A thicker edge or a heavier fill for `urgent` is the obvious next idea and it
73
+ * is the wrong one: the measured CVD audit in `tokens/color.json` finds
74
+ * `steady` and `attention` identical under deuteranopia and in greyscale, so a
75
+ * second visual axis would have to carry the level on its own for those
76
+ * readers. A border width cannot say which of four levels this is. The word
77
+ * does that, in the heading, where it cannot be lost. Colour is the scanning
78
+ * aid for the readers who have it.
79
+ */
80
+ const TONE = {
81
+ steady: "bg-status-steady-surface text-status-steady-ink [--banner-line:var(--opsin-status-steady-line)]",
82
+ watch: "bg-status-watch-surface text-status-watch-ink [--banner-line:var(--opsin-status-watch-line)]",
83
+ attention: "bg-status-attention-surface text-status-attention-ink [--banner-line:var(--opsin-status-attention-line)]",
84
+ urgent: "bg-status-urgent-surface text-status-urgent-ink [--banner-line:var(--opsin-status-urgent-line)]",
85
+ };
86
+ /**
87
+ * The recommended action, filled with the level's own ink and labelled in the
88
+ * level's own surface colour. It is the measured `-ink` on `-surface` pair
89
+ * turned inside out, so it needs no new colour and stays on the status axis:
90
+ * measured with `@opsinjs/color`, the surface on the ink reads APCA Lc 91.5 to
91
+ * 92.8 and 9.62 to 10.58:1 in light, and Lc 80.2 to 82.7 and 12.52 to 12.58:1
92
+ * in dark, across the four levels. Hover, press and busy move the fill away
93
+ * from the label, darker by day and lighter by night, so a state never costs
94
+ * the label contrast; a fill mixed towards the label instead measured Lc 61 in
95
+ * dark, under the floor. The four levels get the same treatment, so the top of
96
+ * the ladder gains no extra weight.
97
+ *
98
+ * Every class is an arbitrary property or an arbitrary value, so the action's
99
+ * own `cn()` files each one against the matching class of the rung or the
100
+ * recipe it lands on and keeps this one, because a caller's classes come last.
101
+ */
102
+ const FILLED_ACTION = {
103
+ steady: "border-transparent bg-[var(--opsin-status-steady-ink)] [color:var(--opsin-status-steady-surface)] " +
104
+ "hover:bg-[color-mix(in_oklab,var(--opsin-status-steady-ink),black_16%)] active:bg-[color-mix(in_oklab,var(--opsin-status-steady-ink),black_28%)] not-disabled:aria-busy:bg-[color-mix(in_oklab,var(--opsin-status-steady-ink),black_28%)] " +
105
+ "dark:hover:bg-[color-mix(in_oklab,var(--opsin-status-steady-ink),white_30%)] dark:active:bg-[color-mix(in_oklab,var(--opsin-status-steady-ink),white_50%)] dark:not-disabled:aria-busy:bg-[color-mix(in_oklab,var(--opsin-status-steady-ink),white_50%)]",
106
+ watch: "border-transparent bg-[var(--opsin-status-watch-ink)] [color:var(--opsin-status-watch-surface)] " +
107
+ "hover:bg-[color-mix(in_oklab,var(--opsin-status-watch-ink),black_16%)] active:bg-[color-mix(in_oklab,var(--opsin-status-watch-ink),black_28%)] not-disabled:aria-busy:bg-[color-mix(in_oklab,var(--opsin-status-watch-ink),black_28%)] " +
108
+ "dark:hover:bg-[color-mix(in_oklab,var(--opsin-status-watch-ink),white_30%)] dark:active:bg-[color-mix(in_oklab,var(--opsin-status-watch-ink),white_50%)] dark:not-disabled:aria-busy:bg-[color-mix(in_oklab,var(--opsin-status-watch-ink),white_50%)]",
109
+ attention: "border-transparent bg-[var(--opsin-status-attention-ink)] [color:var(--opsin-status-attention-surface)] " +
110
+ "hover:bg-[color-mix(in_oklab,var(--opsin-status-attention-ink),black_16%)] active:bg-[color-mix(in_oklab,var(--opsin-status-attention-ink),black_28%)] not-disabled:aria-busy:bg-[color-mix(in_oklab,var(--opsin-status-attention-ink),black_28%)] " +
111
+ "dark:hover:bg-[color-mix(in_oklab,var(--opsin-status-attention-ink),white_30%)] dark:active:bg-[color-mix(in_oklab,var(--opsin-status-attention-ink),white_50%)] dark:not-disabled:aria-busy:bg-[color-mix(in_oklab,var(--opsin-status-attention-ink),white_50%)]",
112
+ urgent: "border-transparent bg-[var(--opsin-status-urgent-ink)] [color:var(--opsin-status-urgent-surface)] " +
113
+ "hover:bg-[color-mix(in_oklab,var(--opsin-status-urgent-ink),black_16%)] active:bg-[color-mix(in_oklab,var(--opsin-status-urgent-ink),black_28%)] not-disabled:aria-busy:bg-[color-mix(in_oklab,var(--opsin-status-urgent-ink),black_28%)] " +
114
+ "dark:hover:bg-[color-mix(in_oklab,var(--opsin-status-urgent-ink),white_30%)] dark:active:bg-[color-mix(in_oklab,var(--opsin-status-urgent-ink),white_50%)] dark:not-disabled:aria-busy:bg-[color-mix(in_oklab,var(--opsin-status-urgent-ink),white_50%)]",
115
+ };
116
+ /**
117
+ * The boundary role per level, for a control that draws its own edge on the
118
+ * banner. It is the bare `-<level>` LINE role, written out as literals because
119
+ * Tailwind reads class names as literal strings and `border-status-${status}`
120
+ * generates no CSS at all.
121
+ *
122
+ * `lib/generated/contrast.json` records line-on-surface at WCAG 4.45 to 5.09 in
123
+ * light and 7.99 to 8.17 in dark for the four levels, all above the 3:1
124
+ * non-text floor, so a control drawn with it needs no new measurement. It is
125
+ * the same role `TONE` already uses for the banner's own edge; here it is
126
+ * handed to a control that is not the banner.
127
+ */
128
+ const LINE_EDGE = {
129
+ steady: "border-status-steady",
130
+ watch: "border-status-watch",
131
+ attention: "border-status-attention",
132
+ urgent: "border-status-urgent",
133
+ };
134
+ /**
135
+ * The ink for a composed Button, addressed at the wrapper as a `[&_button]`
136
+ * selector so it reaches every Button the banner draws: the `onSelect` form of
137
+ * an action and the dismiss control. The `href` form is an anchor rather than a
138
+ * Button, so the selector leaves it alone and it takes the same level ink
139
+ * straight from the surface's inherited TONE. No control on this surface brings
140
+ * an opaque fill of its own any more, so each one inherits whatever colour
141
+ * cascades in, and on a status tint that has to be the level's own `-ink`.
142
+ *
143
+ * The override is load-bearing because `Button variant="quiet"` asserts the
144
+ * accent ink, `[color:var(--brand-ink)]` (ADR 0029), rather than inheriting.
145
+ * Left alone a quiet Button would paint the accent on a clinical tint, a
146
+ * cross-axis pair nothing has measured. `-ink` on `-surface` is the pair the ramps are built to
147
+ * guarantee, recorded at WCAG 9.62 to 12.74 in `lib/generated/contrast.json`,
148
+ * so the wrapper hands the level's ink down and the quiet default never shows.
149
+ *
150
+ * IT IS ADDRESSED AT THE WRAPPER AS A DESCENDANT SELECTOR, AND THAT IS A
151
+ * REPAIR RATHER THAN A PREFERENCE. Passed through Button's own `className`,
152
+ * which is what this file did first, `cn()` files `text-status-<level>-ink` in
153
+ * the same tailwind-merge conflict group as the `text-opsin-subheadline` that
154
+ * `size="sm"` contributes, and keeps only the later of the two: the colour
155
+ * arrived and the type step silently vanished, so the dismiss control did not
156
+ * render at the size Button documents. Reproduced against tailwind-merge 3.6.0,
157
+ * which is what this repository pins. A descendant selector belongs to no
158
+ * conflict group, so both survive, and `relative-time` made the identical
159
+ * repair for the identical reason.
160
+ */
161
+ const ON_SURFACE_INK = {
162
+ steady: "[&_button]:text-status-steady-ink",
163
+ watch: "[&_button]:text-status-watch-ink",
164
+ attention: "[&_button]:text-status-attention-ink",
165
+ urgent: "[&_button]:text-status-urgent-ink",
166
+ };
167
+ /**
168
+ * The heading tag per level.
169
+ *
170
+ * A `Record` rather than a template string, so a level with no tag is a compile
171
+ * error rather than a `<h7>` the browser renders as an unstyled inline element
172
+ * with no place in the outline.
173
+ *
174
+ * THE TYPE IS NOT THE GUARD, AND THAT DISTINCTION COST A WHOLE SCREEN. A
175
+ * `Record` lookup that misses returns `undefined`, and `undefined` in element
176
+ * position is React's "Element type is invalid". That is a throw rather than a
177
+ * heading at the wrong depth, which takes the banner, the clinical message and
178
+ * whatever else shared the subtree down with it. `null` is the shape a JSON-
179
+ * or CMS-driven caller passes to mean "no override"; `1` is what a caller
180
+ * reaches for after reading that there is no `h1`; and this file ships as
181
+ * source into JavaScript projects where a type is advice. So the level is
182
+ * checked at runtime the way `status` is, with one difference: the fallback is
183
+ * `h2` rather than a refusal. A banner at the wrong outline depth is
184
+ * recoverable and a banner that throws is not, and unlike an unrecognised
185
+ * `status` an unrecognised heading level invents no verdict about anybody.
186
+ */
187
+ const HEADING_TAGS = {
188
+ 2: "h2",
189
+ 3: "h3",
190
+ 4: "h4",
191
+ 5: "h5",
192
+ 6: "h6",
193
+ };
194
+ function isAlertHeadingLevel(value) {
195
+ return value === 2 || value === 3 || value === 4 || value === 5 || value === 6;
196
+ }
197
+ /**
198
+ * Turn one action into a control, or into nothing.
199
+ *
200
+ * Returning `null` rather than rendering something is the point. A control with
201
+ * no name is unreachable by voice and announced as "button"; a control with
202
+ * neither a destination nor a handler is a promise the banner cannot keep, and
203
+ * at `attention` or `urgent` a broken action is worse than a missing one,
204
+ * because the reader has been told there is something to do.
205
+ */
206
+ function actionControl(action, emphasis, status, owner, id) {
207
+ const label = action.label?.trim() ? action.label.trim() : "";
208
+ const navigates = typeof action.href === "string" && action.href.trim() !== "";
209
+ const acts = typeof action.onSelect === "function";
210
+ if (label === "") {
211
+ warnDev(`action-no-label:${owner}:${emphasis}`, "[opsinjs] <AlertBanner> was given an action with no label. The visible " +
212
+ "label is the accessible name, and without it the control is announced " +
213
+ 'as "button" and nothing else. Nothing was rendered for it.');
214
+ return null;
215
+ }
216
+ if (!navigates && !acts) {
217
+ warnDev(`action-inert:${owner}:${label}`, `[opsinjs] <AlertBanner> action "${label}" has neither \`href\` nor ` +
218
+ "`onSelect`, so there is nothing for it to do. Give it a destination or " +
219
+ "a handler. Nothing was rendered for it.");
220
+ return null;
221
+ }
222
+ if (navigates && acts) {
223
+ warnDev(`action-both:${owner}:${label}`, `[opsinjs] <AlertBanner> action "${label}" has both \`href\` and ` +
224
+ "`onSelect`. It renders as a link, because a destination survives a new " +
225
+ "tab, a copied address and a screen reader's list of links and a handler " +
226
+ "does not. Move the work to the page the link goes to, or drop the " +
227
+ "`href`.");
228
+ }
229
+ /* THE WRAPPER IS WHERE THE PART'S SLOT LIVES, AND IT IS NOT TIDINESS.
230
+ `Button` writes `data-slot="button"` AFTER spreading the caller's props
231
+ (button.tsx:378-381), so a `data-slot` passed to it is silently replaced.
232
+ That was found by rendering this component to markup, which is the only way
233
+ to find it. A composed component owning its own slot is correct; what it
234
+ means here is that the part's slot has to go on the element around it.
235
+ EmptyState solves the identical problem the identical way. The alternative
236
+ is one slot name on the link branch and another on the button branch, which
237
+ is a DOM contract that describes two different components depending on
238
+ which prop the caller passed. */
239
+ /* ONE LADDER FOR BOTH TRANSPORTS, AND NO NEUTRAL ROLE ON A STATUS SURFACE.
240
+ `Button variant="primary"` is the accent's fill and `variant="secondary"`
241
+ is a neutral `bg-card` island; both would sit on the four tints unmeasured,
242
+ and the neutral island in particular is no boundary against them,
243
+ measuring 1.07 to 1.22 in both themes. So both transports are built from
244
+ the level's own two colours.
245
+
246
+ The recommended action is FILLED_ACTION: the level's ink as the fill and
247
+ its surface as the label, a pair measured above. It is the one solid
248
+ object on the banner, which is what a reader scanning an interruption
249
+ needs to find first. The second action is a hairline capsule in the
250
+ level's ink, from the recipe's tinted quiet arm, so it reads as a control
251
+ and as the lesser one. Neither is underlined.
252
+
253
+ Both transports draw from `cardActionClassName({..., ground: "tinted"})` in
254
+ `button.tsx`, the same recipe the `href` form takes through `Link`, with
255
+ FILLED_ACTION laid over the recommended arm, so the two transports of one
256
+ action cannot drift. The size follows the weight: recommended takes `md`
257
+ at the headline step and the second takes `sm`. The second action's
258
+ Button takes the level's ink from ON_SURFACE_INK on its wrapper; the
259
+ recommended one carries its own label colour and takes no wrapper ink,
260
+ which would otherwise paint ink on ink. */
261
+ const size = emphasis === "primary" ? "md" : "sm";
262
+ const buttonDelta = emphasis === "primary"
263
+ ? cn(cardActionClassName({ weight: "recommended", ground: "tinted", as: "button" }), FILLED_ACTION[status])
264
+ : cardActionClassName({ weight: "quiet", ground: "tinted", as: "button" });
265
+ return (_jsx("div", { "data-slot": "alert-banner-action", className: cn("min-w-0", !navigates && emphasis !== "primary" && ON_SURFACE_INK[status]), children: navigates ? (
266
+ /* The `href` form is the shared `Link`, so the anchor and the
267
+ handler-form Button above are the same control drawn from one recipe.
268
+ `ground="tinted"` selects the arms that bring no neutral fill: the
269
+ second action inherits the level's ink from TONE for its words and
270
+ its hairline, and the recommended one takes FILLED_ACTION. The quiet
271
+ arm keeps `hover:bg-muted`, which puts a neutral fill under status
272
+ ink for the duration of a hover; that is a cross-scope pair nothing
273
+ has measured, and it is disclosed on the page beside the focus ring
274
+ rather than left to be found. */
275
+ _jsx(Link, { href: action.href, emphasis: emphasis === "primary" ? "action" : "secondary", ground: "tinted", className: emphasis === "primary" ? FILLED_ACTION[status] : undefined, children: label })) : (_jsx(Button, { variant: "quiet", size: size, className: buttonDelta, onClick: action.onSelect, children: label })) }, id));
276
+ }
277
+ export function AlertBanner({ status, heading, children, headingLevel = 2, detectedAt, now, locale, timeZone, actions, dismissible = false, onAcknowledge, dismissLabel, className, }) {
278
+ /* THE FIFTH LEVEL IS REFUSED, NOT APPROXIMATED, and here the refusal costs
279
+ more than it does on a pill: nothing is rendered, so the product's message
280
+ does not reach the reader at all. That is the right way round. This file
281
+ ships as source into JavaScript projects where a type is advice, and a
282
+ value outside the vocabulary has no fill, no word and no announcement
283
+ contract. Those three things are what make this component different from a
284
+ paragraph. Rendering it as a neutral notice would silently move a clinical
285
+ message onto a surface with no level, no budget and no reviewer, which is
286
+ the leak the two-axis rule exists to stop; rendering it as a plausible
287
+ level would be this component inventing a verdict about somebody's health.
288
+ `unknown` gets its own code because it is the likeliest wrong answer and the
289
+ most dangerous: it is the absence of an assertion, and a reader who meets it
290
+ rendered as a level reads it as "probably fine". */
291
+ if (!isClinicalStatus(status)) {
292
+ warnOnce(status === "unknown" ? "OPSIN-0011" : "OPSIN-0021", {
293
+ component: "AlertBanner",
294
+ status: String(status),
295
+ });
296
+ return null;
297
+ }
298
+ const headingText = heading?.trim() ? heading.trim() : "";
299
+ /* The key for this banner's own warnings. The heading is the only thing that
300
+ distinguishes one banner from another from inside this function, so it is
301
+ what makes two mistakes on two banners two warnings instead of one. */
302
+ const owner = headingText === "" ? `<${status}>` : headingText;
303
+ if (headingText === "") {
304
+ warnDev(`no-heading:${status}`, "[opsinjs] <AlertBanner> was given an empty `heading`. The heading is what " +
305
+ "a screen-reader user finds by heading navigation and what names the " +
306
+ "subject the level applies to; without it the banner announces a level " +
307
+ "floating free. The level's own word is still rendered, and nothing else " +
308
+ "is.");
309
+ }
310
+ /* THE SAME THREAT MODEL AS `status` AND `headingLevel`. A non-array here
311
+ reaches `.map` and throws "supplied.map is not a function", and a throw is
312
+ the one failure in this file that is not scoped to the banner: it takes the
313
+ screen the message was on. Treated as no actions, which at `attention` and
314
+ `urgent` is then reported by the check below as the composition error it
315
+ is. */
316
+ const supplied = Array.isArray(actions) ? actions : [];
317
+ if (actions !== undefined && !Array.isArray(actions)) {
318
+ warnDev(`actions-not-an-array:${owner}`, "[opsinjs] <AlertBanner> was given an `actions` value that is not an " +
319
+ "array. It expects `AlertAction[]`; a single object is the usual " +
320
+ "mistake, and wrapping it in an array is the fix. Nothing was rendered " +
321
+ "for it.");
322
+ }
323
+ const needsAction = status === "attention" || status === "urgent";
324
+ /* Built before the warnings below rather than in the JSX, so that "this
325
+ banner has no action" means what a reader would mean by it. An action with
326
+ no label, or with neither a destination nor a handler, is refused by
327
+ `actionControl` and renders nothing. A banner whose only action was
328
+ refused is a banner with no action, which at `attention` and `urgent` is
329
+ the composition error worth reporting. Counting the array instead would
330
+ report the shape of the props and not the shape of the screen. */
331
+ const controls = supplied
332
+ .map((action, index) => actionControl(action, index === 0 ? "primary" : "secondary", status, owner, `${index}-${action.label}`))
333
+ .filter((control) => control !== null);
334
+ /* A COMPOSITION ERROR, REPORTED AND THEN RENDERED. Telling somebody that
335
+ something needs action without offering one is the most common way a health
336
+ product creates anxiety it cannot resolve. The sentence is nevertheless
337
+ still the most useful thing on the screen, and taking it away over a
338
+ missing button would be the larger mistake. */
339
+ if (needsAction && controls.length === 0) {
340
+ warnDev(`no-actions:${owner}`, `[opsinjs] <AlertBanner status="${status}"> has no actions. At this level ` +
341
+ "the banner asserts there is something specific to do, and a banner that " +
342
+ "says so with nothing attached leaves the reader with the alarm and no " +
343
+ "route out of it. Give it one action, or lower the level.");
344
+ }
345
+ if (supplied.length > 2) {
346
+ warnDev(`too-many-actions:${owner}`, `[opsinjs] <AlertBanner> was given ${supplied.length} actions. The ceiling ` +
347
+ "is two: a banner with a menu on it is a screen, and a reader scanning " +
348
+ "an interruption reads the first control and rarely the third. All of " +
349
+ "them were rendered. The choice of which to drop is the product's.");
350
+ }
351
+ if (supplied.some((action, index) => action.recommended === true && index > 0)) {
352
+ warnDev(`recommended-not-first:${owner}`, "[opsinjs] <AlertBanner> marks an action `recommended` that is not the " +
353
+ "first one. Emphasis follows position here, because a screen-reader user " +
354
+ "meets the actions in DOM order and the recommended one has to be the " +
355
+ "one they meet first. Reorder the array; the flag on a later action was " +
356
+ "ignored.");
357
+ }
358
+ const acknowledges = typeof onAcknowledge === "function";
359
+ /* DISMISSAL NEEDS SOMEWHERE TO REPORT TO, AT EVERY LEVEL. The specification
360
+ makes acknowledgement a condition at `urgent` only, and the reason it gives
361
+ is that the product cannot tell dismissal apart from understanding, which
362
+ is not a property of urgency. It is a property of this component never
363
+ removing itself: the caller decides what is on screen, so a dismiss control
364
+ with no callback is a control that acknowledges a press and changes
365
+ nothing. The condition is therefore the same at all four levels, and the
366
+ difference at `urgent` is what the callback is FOR: recording, rather than
367
+ remembering a preference. */
368
+ const dismisses = dismissible && acknowledges;
369
+ if (dismissible && !acknowledges) {
370
+ warnDev(`dismiss-without-callback:${owner}`, "[opsinjs] <AlertBanner> has `dismissible` and no `onAcknowledge`. This " +
371
+ "component never takes itself off the screen, so the control would have " +
372
+ "nowhere to report to and nothing would happen when it was pressed. No " +
373
+ "dismiss control was rendered. At `urgent` the callback is also the " +
374
+ "record: an urgent banner may only be removed by an acknowledgement the " +
375
+ "product keeps.");
376
+ }
377
+ const hasDetected = typeof detectedAt === "string" && detectedAt.trim() !== "";
378
+ /* The warning fires on the intent, not on `detectedAt` alone. Carrying the
379
+ instant as `data-detected-at` for a stylesheet, a test or an export is the
380
+ endorsed use and never warns. Passing `now`, `locale` or `timeZone` is the
381
+ signal that a caller expected a rendered relative phrase, because those
382
+ three props do nothing else on this surface, so that is the only case worth
383
+ a word. */
384
+ if (hasDetected &&
385
+ (now !== undefined || locale !== undefined || timeZone !== undefined)) {
386
+ warnDev(`time-props-not-rendered:${owner}`, "[opsinjs] <AlertBanner> was given `now`, `locale` or `timeZone` beside " +
387
+ "`detectedAt`, which reads as expecting a rendered relative phrase. " +
388
+ "None is rendered, because RelativeTime has no word for an instant a " +
389
+ "product's rules produced and the three obvious candidates, " +
390
+ "'detected', 'flagged' and 'triggered', are banned as machine " +
391
+ "register. The instant is still carried on the root as " +
392
+ "`data-detected-at` for a stylesheet, a test or an export, so drop " +
393
+ "`now`, `locale` and `timeZone` until the phrase returns. The age of " +
394
+ "the READING belongs where the reading is, not on the banner.");
395
+ }
396
+ /* See HEADING_TAGS. Outside 2-6 this lookup returns `undefined`, which in
397
+ element position is a render error rather than a wrong heading. */
398
+ const level = isAlertHeadingLevel(headingLevel) ? headingLevel : 2;
399
+ if (!isAlertHeadingLevel(headingLevel)) {
400
+ warnDev(`heading-level:${owner}`, `[opsinjs] <AlertBanner> was given headingLevel={${String(headingLevel)}}. ` +
401
+ "The levels are 2 to 6. There is no `h1`, because a banner is never a " +
402
+ "page. It was rendered as `h2`, which may be the wrong depth for where " +
403
+ "this banner sits: pass the level below the heading of the surface it " +
404
+ "is on.");
405
+ }
406
+ const Heading = HEADING_TAGS[level];
407
+ return (
408
+ /* THE ROLE FOLLOWS THE LEVEL, AND NOTHING ELSE. Not the styling, not the
409
+ position on the screen, and not a prop. A caller who could ask for
410
+ `role="alert"` at `watch` would have the whole of the escalation ladder
411
+ available as an attribute.
412
+
413
+ `role="alert"` carries assertive and atomic with it, so `aria-live` is
414
+ not written out at `urgent`. `aria-atomic` IS written out at both levels
415
+ that have a region, and the redundancy is deliberate: `aria-live` alone
416
+ announces only the part that changed and a banner means nothing in
417
+ fragments, and the implicit value is the one with the weaker record
418
+ across assistive-technology and browser pairs. Nobody has listened to
419
+ this component, so the level that can least afford a partial announcement
420
+ is the level that should carry the fewest untested assumptions.
421
+
422
+ THE REGION IS AN INNER WRAPPER, AND THE CONTROLS AND THE TIMESTAMP SIT
423
+ OUTSIDE IT. An atomic region announces its whole subtree as one string,
424
+ so a link inside one is read as prose rather than offered as a link, and
425
+ any part of it that re-renders, a ticking timestamp most of all, re-runs
426
+ the whole announcement, assertively at `urgent`. The wrapper holds only
427
+ the heading and the body. The actions row, the dismiss control and any
428
+ timestamp are direct children of the section after it, so they stay
429
+ navigable controls and their changes announce nothing.
430
+
431
+ AT `steady` AND `watch` THE ELEMENT HAS NO ROLE AT ALL, and that is a
432
+ departure from doctrine rather than an implementation of it.
433
+ `clinical-status-semantics` rule 6 asks for a polite announcement at
434
+ those two levels. What it is describing is a status CHANGING on a
435
+ surface; a banner is a surface that arrives, and a `steady` banner that
436
+ announced itself would be an interruption whose whole content is that
437
+ nothing needs attention. That is the shape `alarm-fatigue` spends its
438
+ length arguing against. The cost is real and is named on the page
439
+ rather than left here: a reader already on the screen when a
440
+ de-escalation banner appears is not told, and the sentence that
441
+ withdraws an earlier alert is the one a listening reader most needs.
442
+
443
+ ESCALATING IN PLACE IS THE CASE THIS ELEMENT CANNOT COVER FROM INSIDE
444
+ ITSELF. A caller who re-renders the same `<AlertBanner>` with a higher
445
+ `status` gets these attributes patched onto the DOM node that is already
446
+ there, and assistive technology registers a live region when the node is
447
+ inserted. Adding `aria-live` to, or swapping `role="alert"` onto, a node
448
+ already in the document commonly announces nothing. A component cannot
449
+ key itself, so the remedy belongs to the caller and is written down in
450
+ the `status` prop below: escalate by remounting.
451
+
452
+ WHAT IS NOT HERE IS AS DELIBERATE AS WHAT IS. No `aria-label` and no
453
+ `aria-labelledby`, so the root is not a named landmark. Naming it would
454
+ need a generated id, which needs `useId`, which would make every banner
455
+ in every product a client component for the sake of a name that duplicates
456
+ the heading directly beneath it. On a live region an accessible name
457
+ can displace the content in the announcement, which is the one thing this
458
+ element exists to deliver. The cost is real and is listed on the page
459
+ rather than left for somebody to discover: a screen-reader user gets no
460
+ landmark boundary, only a heading.
461
+
462
+ No focus management either, at any level. A banner never moves focus on
463
+ appearance: focus belongs to whatever the reader was doing, and if the
464
+ product needs a response before anything else can happen, that is a
465
+ Dialog and it should say so.
466
+
467
+ No entrance animation, and therefore nothing to remove under
468
+ `prefers-reduced-motion`. Urgency is never carried by motion, at any
469
+ level and under any circumstances. There is no pulse, no flash, no shake
470
+ and no colour cycle, and the honest way to hold that line is to ship no
471
+ transition at all rather than one that has to be switched off. */
472
+ _jsxs("section", { "data-slot": "alert-banner", "data-status": status, "data-detected-at": hasDetected ? detectedAt : undefined, className: cn(
473
+ /* A stacked column at every width. There is no side-by-side arrangement
474
+ to reflow away from, so 200% text grows the banner rather than
475
+ truncating anything in it, and the actions wrap onto their own lines
476
+ instead of shrinking below the target floor.
477
+
478
+ `p-4` is the density-scaled step rather than `p-opsin-4`: padding
479
+ inside a box is the canonical use of the scaled scale, so a reader who
480
+ has asked for a denser interface gets one. The gaps between the parts
481
+ are fixed steps, because their job is to keep the heading off the body
482
+ and the actions apart, and neither should close up because somebody
483
+ asked for a denser list. */
484
+ "flex flex-col gap-opsin-4 p-5",
485
+ /* A SHEET WITH DEPTH, TINTED BY ITS LEVEL. The fill is the level's
486
+ measured surface, and everything else about the box is light rather
487
+ than colour: a boundary in the level's line at a little over a third
488
+ of its strength, a line of light along the top and a soft wash of it
489
+ down the first half, and a drop tinted with the level. The wash only
490
+ lightens the surface by day, so the ink's measured contrast can only
491
+ rise there, and by night it is four per cent of white, which moves
492
+ the ink pair by less than the rounding of the published figure. The
493
+ four levels take the same treatment, so `urgent` gains no weight
494
+ here; the word in the heading carries the level. */
495
+ "rounded-opsin-lg border [corner-shape:var(--opsin-corner-shape)]", "border-[color-mix(in_oklab,var(--banner-line)_36%,transparent)]", "bg-[linear-gradient(180deg,color-mix(in_oklab,var(--card)_40%,transparent),transparent_45%)] dark:bg-[linear-gradient(180deg,color-mix(in_oklab,var(--foreground)_4%,transparent),transparent_45%)]", "shadow-[inset_0_1px_0_oklch(1_0_0/0.65),0_1px_2px_color-mix(in_oklab,var(--banner-line)_14%,transparent),0_18px_40px_-22px_color-mix(in_oklab,var(--banner-line)_55%,transparent)]", "dark:shadow-[inset_0_1px_0_oklch(1_0_0/0.06),0_1px_2px_oklch(0_0_0/0.4),0_18px_40px_-22px_oklch(0_0_0/0.75)]",
496
+ /* Print drops background colours by default and keeps border and text
497
+ colours, so on paper the banner is a box defined by its status-coloured
498
+ edge with the level's word inside it. The fill is dropped explicitly
499
+ rather than left to the reader's print settings, so the page looks the
500
+ same whichever way that setting is left. */
501
+ "print:bg-transparent print:bg-none print:shadow-none print:border-[var(--banner-line)]", TONE[status], className), children: [_jsxs("div", { "data-slot": "alert-banner-announcement", role: status === "urgent" ? "alert" : undefined, "aria-live": status === "attention" ? "polite" : undefined, "aria-atomic": status === "attention" || status === "urgent" ? true : undefined, className: "flex flex-col gap-opsin-3 min-w-0", children: [_jsxs(Heading, { "data-slot": "alert-banner-heading", className: "m-0 flex flex-col items-start gap-opsin-2 text-opsin-headline", children: [_jsx(StatusPill, { status: status, size: "lg" }), headingText === "" ? null : (_jsxs(_Fragment, { children: [_jsx("span", { className: "sr-only", children: ", " }), _jsx("span", { "data-slot": "alert-banner-heading-text", className: "min-w-0", children: headingText })] }))] }), _jsx("div", { "data-slot": "alert-banner-body", className: "min-w-0 wrap-break-word text-opsin-body *:first:mt-0 *:last:mb-0", children: children })] }), controls.length > 0 ? (
502
+ /* The separation between two targets is the token that names the rule
503
+ rather than the space step that happens to equal it today. `flex-wrap`
504
+ is what keeps the floor honest at 200% text: two controls that cannot
505
+ both fit stack, rather than one of them shrinking under 44×44. */
506
+ _jsx("div", { "data-slot": "alert-banner-actions", className: "flex flex-wrap items-center gap-(--opsin-target-separation,0.5rem)", children: controls })) : null, dismisses ? (
507
+ /* LAST IN THE DOM, AND LAST ON THE SCREEN. A dismiss control floated to
508
+ the top corner is the usual arrangement and it puts the way out ahead
509
+ of the message in the reading order, for the reader least able to
510
+ skip back. Nothing here is re-arranged by CSS against the DOM, so the
511
+ order announced is the order seen: heading, body, actions, then the
512
+ way out.
513
+
514
+ THE BOUNDARY IS THE LEVEL'S LINE ROLE, PASSED TO THE BUTTON AS
515
+ `LINE_EDGE[status]`. Left as a bare quiet Button the control has no
516
+ border, no fill and no underline, so beneath a boxed action it reads
517
+ as a stray sentence rather than the one control whose press is the
518
+ record. `Button variant="secondary"` was refused because it is a
519
+ neutral `bg-card` island whose fill measures 1.07 to 1.22 against the
520
+ four tints in both themes, which is no boundary in either direction,
521
+ and it would make the way out look like the one action. The line role
522
+ is a boundary `lib/generated/contrast.json` already records as
523
+ passing, so it needs no new measurement, and the caller's className
524
+ lands last in Button's `cn`, so it wins over the quiet variant's own
525
+ `border-transparent` in the border-colour group while the width stays
526
+ the inline `borderWidth` style Button always renders. */
527
+ _jsx("div", { "data-slot": "alert-banner-dismiss", className: cn("self-start", ON_SURFACE_INK[status]), children: _jsxs(Button, { variant: "quiet", size: "sm", className: LINE_EDGE[status], onClick: onAcknowledge, children: [dismissLabel?.trim() ? dismissLabel.trim() : "Dismiss", headingText === "" ? null : (_jsxs("span", { className: "sr-only", children: [", ", headingText] }))] }) })) : null] }));
528
+ }
529
+ //# sourceMappingURL=alert-banner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alert-banner.js","sourceRoot":"","sources":["../../src/components/alert-banner.tsx"],"names":[],"mappings":";AA+EA,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,QAAQ,GAET,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,aAAc,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAY,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAmB,CAAA;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,eAAe,GAAG,GAAG,CAAA;AAE3B,4EAA4E;AAC5E,MAAM,OAAO,GAAG,WAAW,CAAA;AAE3B;8EAC8E;AAC9E,IAAI,MAA+B,CAAA;AAEnC,SAAS,OAAO,CAAC,GAAW,EAAE,OAAe;IAC3C,IAAI,CAAC,aAAa,EAAE;QAAE,OAAM;IAC5B,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA;IACpD,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAM;IAE3B;;;;;;wEAMoE;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EAEP,SAAS,CAAC,CAAC,CAAC;YACX;;;;;;;;;;;;;;;;;;;uEAmB2D;YAC3D,2BACY,sBAAsB,EAChC,SAAS,EAAE,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,YAEnD,MAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,IAAI,EACT,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,EAC5B,OAAO,EAAE,aAAa,aAErB,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,EAetD,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAC3B,gBAAM,SAAS,EAAC,SAAS,mBAAI,WAAW,IAAQ,CACjD,IACM,GACL,CACP,CAAC,CAAC,CAAC,IAAI,IACA,CACX,CAAA;AACH,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The three diameters. Kept as a local type rather than a fourth public
3
+ * export, for the reason `segmented-control.tsx` gives about its own option
4
+ * shape: the registry contract fixes a file at three public exports, so a
5
+ * consumer names this union as `AvatarProps["size"]` rather than importing a
6
+ * fourth symbol.
7
+ */
8
+ type AvatarSize = "sm" | "md" | "lg";
9
+ export interface AvatarProps {
10
+ /**
11
+ * Required. The person this avatar stands for. It is the picture's alt text
12
+ * and the source of the initials at once, so it can never say one thing to
13
+ * a screen reader and another on screen. An empty or whitespace only name
14
+ * is the mistake a data layer ships by accident: it warns in development
15
+ * and falls back to a neutral person glyph rather than an unlabelled
16
+ * circle.
17
+ */
18
+ name: string;
19
+ /**
20
+ * The picture, when the product has one. opsinjs ships none: no default
21
+ * image, no placeholder face. When it is absent, or when it does not load,
22
+ * the avatar falls back to the initials and then to the person glyph. The
23
+ * URL is used as given, so its trust and the content behind it are the
24
+ * product's to own and to moderate.
25
+ */
26
+ src?: string;
27
+ /**
28
+ * Diameter only. Three sizes, "sm", "md" and "lg", sized in rem so the
29
+ * circle grows with the reader's text size. Defaults to "md". A value
30
+ * outside the three is repaired to "md" and warned in development, because
31
+ * an avatar is decorative chrome and there is no honest smaller or larger
32
+ * reading to guess.
33
+ */
34
+ size?: AvatarSize;
35
+ /**
36
+ * Merged onto the root. For layout only, such as a margin in a stack. A
37
+ * category or status colour passed here is refused by the design rather
38
+ * than by code: the chrome is neutral, and tinting a person from either
39
+ * health axis is the bug the two-axes rule names.
40
+ */
41
+ className?: string;
42
+ }
43
+ export declare function Avatar({ name, src, size, className }: AvatarProps): import("react").JSX.Element;
44
+ export {};
45
+ //# sourceMappingURL=avatar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"avatar.d.ts","sourceRoot":"","sources":["../../src/components/avatar.tsx"],"names":[],"mappings":"AAyEA;;;;;;GAMG;AACH,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAgEpC,MAAM,WAAW,WAAW;IAC1B;;;;;;;OAOG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,WAAW,+BA6EjE"}