@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 @@
1
+ {"version":3,"file":"slider.js","sourceRoot":"","sources":["../../src/components/slider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA;AAEhC,SAAS,OAAO,CAAC,GAAW,EAAE,OAAe;IAC3C,IAAI,CAAC,aAAa,EAAE,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAM;IAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACf,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACvB,CAAC;AAED;;;;;GAKG;AACH,MAAM,IAAI,GAAG,kCAAkC,CAAA;AAE/C;;;;GAIG;AACH,MAAM,MAAM,GAAG,iDAAiD,CAAA;AAEhE;;;;;;;;;GASG;AACH,MAAM,KAAK,GAAG,8DAA8D,CAAA;AAE5E;;;;GAIG;AACH,MAAM,KAAK,GACT,qEAAqE,CAAA;AAEvE;;;;;;GAMG;AACH,MAAM,OAAO,GACX,2EAA2E;IAC3E,0EAA0E,CAAA;AAE5E;;;GAGG;AACH,MAAM,KAAK,GACT,s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,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAEvE,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,aAE9B,eAAK,SAAS,EAAE,MAAM,aACpB,KAAC,UAAU,CAAC,KAAK,iBAAW,cAAc,EAAC,SAAS,EAAE,KAAK,YACxD,KAAK,GACW,EACnB,KAAC,UAAU,CAAC,KAAK,iBAAW,cAAc,EAAC,SAAS,EAAE,KAAK,GAAI,IAC3D,EACN,KAAC,UAAU,CAAC,OAAO,iBAAW,gBAAgB,EAAC,SAAS,EAAE,OAAO,YAC/D,MAAC,UAAU,CAAC,KAAK,iBAAW,cAAc,EAAC,SAAS,EAAE,KAAK,aACzD,KAAC,UAAU,CAAC,SAAS,iBACT,kBAAkB,EAC5B,SAAS,EAAE,SAAS,GACpB,EACF,KAAC,UAAU,CAAC,KAAK,iBACL,cAAc,EACxB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK,YAEzB,8BAAkB,MAAM,EAAC,SAAS,EAAE,IAAI,GAAI,GAC3B,IACF,GACA,IACL,CACnB,CAAA;AACH,CAAC"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * SourceCitation says where a piece of health information came from, in the
3
+ * reader's own plain words, with an optional link to the fuller citation and an
4
+ * optional date for when it was last checked.
5
+ *
6
+ * THERE IS NO DEFAULT SOURCE IN THIS FILE AND THERE NEVER WILL BE. Not a
7
+ * placeholder, not a vetted variant, not a specimen DOI, not a URL, not a study
8
+ * name, not a date. Provenance is a claim about where a number came from, and a
9
+ * design system knows the number of no product and the source of none. A
10
+ * citation shipped from here would arrive beside a reading its author never
11
+ * measured, attributing that reading to an instrument the product may not own,
12
+ * and it would arrive looking checked because it came from a library. So the
13
+ * missing case says so: a citation with no source supplied renders one unlovely
14
+ * admission line, which is the same refusal `disclaimer-note` makes and for the
15
+ * same reason.
16
+ *
17
+ * IT CARRIES ONLY TWO OF THE TEN PROVENANCE RULES, AND THE PAGE SAYS WHICH.
18
+ * `health/data-provenance-and-device-accuracy` sets ten rules. This component
19
+ * renders rule 2, the plain words of where a value came from, at the value and
20
+ * in the reader's own language, and it gives rule 6 a home, a manufacturer's
21
+ * accuracy claim attributed and linked rather than restated as the product's
22
+ * own. It keeps neither for the caller: it holds no provenance class, it checks
23
+ * no wording against the four classes, and it cannot tell a measurement from a
24
+ * guess. The other eight rules stay the caller's, in the caller's data layer and
25
+ * content, and this component would render a wrong provenance string as readily
26
+ * as a right one. It reports where it can and asserts nothing it cannot.
27
+ *
28
+ * IT CARRIES NEITHER COLOUR AXIS, LIKE DISCLAIMERNOTE. Category colour would
29
+ * make a statement about where a number came from read as a statement about what
30
+ * the number is; status colour would make it read as a level. Provenance is
31
+ * neither. There is no `status` prop, no `category` prop, no fill and no radius,
32
+ * the root carries neither `data-status` nor `data-category`, and the whole
33
+ * treatment is the type step, the ink and the space around it. `data-opsinjs-value`
34
+ * is absent too, because this renders no measurement.
35
+ *
36
+ * IT INVENTS NO DATE. `checkedOn` is formatted from what the caller supplied and
37
+ * from nothing else. A value that does not resolve to a real calendar date is
38
+ * refused rather than guessed at, so the component never prints a confidently
39
+ * wrong "last checked" date, and it never reads the clock to fill one in.
40
+ *
41
+ * IT IS A SERVER COMPONENT. No state, no hook, no timer, no event handler and no
42
+ * Base UI primitive. The one interactive part is the composed `Link`, present
43
+ * only when the caller supplies a destination and a name for it together.
44
+ */
45
+ import { type ReactNode } from "react";
46
+ export interface SourceCitationProps {
47
+ /**
48
+ * Where this piece of health information came from, in the reader's own plain
49
+ * words: "from your cuff", "estimated by your watch from movement and heart
50
+ * rate", "you entered this". It renders inline content rather than a block
51
+ * element.
52
+ *
53
+ * THERE IS NO DEFAULT AND THERE WILL NOT BE ONE. Provenance shipped from a
54
+ * design system attributes a reading to an instrument the product may not own,
55
+ * and it arrives looking checked because it came from a library. Supply none
56
+ * and the citation says on screen that none was supplied, rather than inventing
57
+ * a source. `false` from a `&&` branch, `0` from the same branch on an empty
58
+ * collection, an empty array and a whitespace-only string all count as
59
+ * supplying none. The boundary is words: a caller who wraps the provenance in
60
+ * an element is taken at their word, so an empty string inside a `<strong>` is
61
+ * the one route to a silently sourceless citation.
62
+ *
63
+ * TYPED OPTIONAL AND REQUIRED BY THE CONTRACT, which is the same shape
64
+ * `DisclaimerNote.children` has. Marking it required buys nothing, because
65
+ * `{reading.source}` with an undefined `reading.source` type-checks either way.
66
+ * It costs the ability to render the missing state at all, which is the state a
67
+ * product is most likely to ship by accident and the one that most needs
68
+ * seeing.
69
+ */
70
+ source?: ReactNode;
71
+ /**
72
+ * The fuller citation, for readers who want it: a manufacturer's accuracy
73
+ * document, a reference range's own source, a study you have read. This is
74
+ * where rule 6 of data provenance lands. A manufacturer's accuracy claim is
75
+ * attributed and linked here rather than restated as the product's own, and it
76
+ * is never paraphrased into a stronger claim.
77
+ *
78
+ * BOTH HALVES TOGETHER, and that is why this is one object rather than a bare
79
+ * href. A destination with no label would need a label written here, and the
80
+ * label this system would have to invent is exactly the one the requirement
81
+ * refuses: "learn more" names nothing, and a screen reader's list of links is
82
+ * where that costs somebody the citation they were looking for. The product
83
+ * names its own destination in its own words. `more` mirrors
84
+ * `DisclaimerNote.more` for that reason.
85
+ */
86
+ more?: {
87
+ label: string;
88
+ href: string;
89
+ };
90
+ /**
91
+ * When this provenance was last checked, as a calendar date. A string is a
92
+ * strict `YYYY-MM-DD`; a number is epoch milliseconds. It renders as a plain
93
+ * date in the reader's locale, pinned to UTC so the day does not drift, inside
94
+ * a `<time>` element that carries the machine date. There is no live timer and
95
+ * no clock read: a date not supplied is a date not shown, and a value that is
96
+ * not a real calendar date is refused rather than rendered as a plausible wrong
97
+ * one.
98
+ *
99
+ * It is not a freshness verdict. This component holds no staleness boundary and
100
+ * says nothing about whether the source can still be relied on; it reports the
101
+ * date the product recorded and no more. Deciding a source is out of date
102
+ * belongs to the product.
103
+ */
104
+ checkedOn?: string | number;
105
+ /**
106
+ * BCP 47 language tag for the last-checked date, as in `en-GB`. It formats the
107
+ * date and nothing else, because the source words and the link label are the
108
+ * product's own text in the product's own language and this component neither
109
+ * writes nor translates them. Omit it and the date takes the runtime's default
110
+ * locale, which on a server is the server's language rather than the reader's.
111
+ * A malformed tag is reported in development and falls back to that default.
112
+ */
113
+ locale?: string;
114
+ /**
115
+ * Merged onto the root. Width, margin and place in a layout belong here: they
116
+ * are decisions of the surface the citation stands on rather than of the
117
+ * citation.
118
+ *
119
+ * It is also the one hole in this component's refusal to carry a colour, and
120
+ * the component says so rather than pretending otherwise: a utility from either
121
+ * axis passed through here reaches the root, and in development it raises a
122
+ * warning naming what to use instead.
123
+ */
124
+ className?: string;
125
+ }
126
+ export declare function SourceCitation({ source, more, checkedOn, locale, className, }: SourceCitationProps): import("react").JSX.Element;
127
+ //# sourceMappingURL=source-citation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-citation.d.ts","sourceRoot":"","sources":["../../src/components/source-citation.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AA0PhD,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACtC;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAyED,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,IAAI,EACJ,SAAS,EACT,MAAM,EACN,SAAS,GACV,EAAE,mBAAmB,+BA8HrB"}
@@ -0,0 +1,391 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * SourceCitation says where a piece of health information came from, in the
4
+ * reader's own plain words, with an optional link to the fuller citation and an
5
+ * optional date for when it was last checked.
6
+ *
7
+ * THERE IS NO DEFAULT SOURCE IN THIS FILE AND THERE NEVER WILL BE. Not a
8
+ * placeholder, not a vetted variant, not a specimen DOI, not a URL, not a study
9
+ * name, not a date. Provenance is a claim about where a number came from, and a
10
+ * design system knows the number of no product and the source of none. A
11
+ * citation shipped from here would arrive beside a reading its author never
12
+ * measured, attributing that reading to an instrument the product may not own,
13
+ * and it would arrive looking checked because it came from a library. So the
14
+ * missing case says so: a citation with no source supplied renders one unlovely
15
+ * admission line, which is the same refusal `disclaimer-note` makes and for the
16
+ * same reason.
17
+ *
18
+ * IT CARRIES ONLY TWO OF THE TEN PROVENANCE RULES, AND THE PAGE SAYS WHICH.
19
+ * `health/data-provenance-and-device-accuracy` sets ten rules. This component
20
+ * renders rule 2, the plain words of where a value came from, at the value and
21
+ * in the reader's own language, and it gives rule 6 a home, a manufacturer's
22
+ * accuracy claim attributed and linked rather than restated as the product's
23
+ * own. It keeps neither for the caller: it holds no provenance class, it checks
24
+ * no wording against the four classes, and it cannot tell a measurement from a
25
+ * guess. The other eight rules stay the caller's, in the caller's data layer and
26
+ * content, and this component would render a wrong provenance string as readily
27
+ * as a right one. It reports where it can and asserts nothing it cannot.
28
+ *
29
+ * IT CARRIES NEITHER COLOUR AXIS, LIKE DISCLAIMERNOTE. Category colour would
30
+ * make a statement about where a number came from read as a statement about what
31
+ * the number is; status colour would make it read as a level. Provenance is
32
+ * neither. There is no `status` prop, no `category` prop, no fill and no radius,
33
+ * the root carries neither `data-status` nor `data-category`, and the whole
34
+ * treatment is the type step, the ink and the space around it. `data-opsinjs-value`
35
+ * is absent too, because this renders no measurement.
36
+ *
37
+ * IT INVENTS NO DATE. `checkedOn` is formatted from what the caller supplied and
38
+ * from nothing else. A value that does not resolve to a real calendar date is
39
+ * refused rather than guessed at, so the component never prints a confidently
40
+ * wrong "last checked" date, and it never reads the clock to fill one in.
41
+ *
42
+ * IT IS A SERVER COMPONENT. No state, no hook, no timer, no event handler and no
43
+ * Base UI primitive. The one interactive part is the composed `Link`, present
44
+ * only when the caller supplies a destination and a name for it together.
45
+ */
46
+ import { Children } from "react";
47
+ import { isDevelopment } from "../opsinjs.js";
48
+ import { cn, trimTrailing } from "../utils.js";
49
+ import { Link } from "./link.js";
50
+ /**
51
+ * Development warnings, said once per distinct offender.
52
+ *
53
+ * Nothing this file complains about has an `OpsinErrorCode`. The codes in
54
+ * `tokens/errors.json` describe mistakes a consumer makes with the CLINICAL
55
+ * API, they are a versioned contract, and a component may not mint one. What
56
+ * this keeps is the discipline the substrate is right about: a warning printed
57
+ * on every render, and twice per render under Strict Mode, becomes noise, and a
58
+ * noisy channel is one somebody switches off. `disclaimer-note.tsx` carries the
59
+ * same lines for the same reason, and the shared repair belongs in
60
+ * `../opsinjs.ts` rather than in this component's file.
61
+ */
62
+ const warned = new Set();
63
+ function warnDev(key, message) {
64
+ if (!isDevelopment() || warned.has(key))
65
+ return;
66
+ warned.add(key);
67
+ console.warn(message);
68
+ }
69
+ /**
70
+ * Whether any provenance words actually arrived.
71
+ *
72
+ * TypeScript cannot answer this. `{reading.source}` resolving to `undefined`
73
+ * from a data layer, a content table returning a whitespace-only string for a
74
+ * locale nobody filled in, and `{isCited && "..."}` evaluating to `false` on the
75
+ * day the citation lapsed are the three ways provenance actually goes missing,
76
+ * and none of them is caught by testing for `""` alone. `Children.toArray` drops
77
+ * `null`, `undefined`, booleans and empty arrays; a string of spaces is what it
78
+ * keeps and what must still be refused, and so is a bare number.
79
+ *
80
+ * An element is not text and is not resolvable from here, so a source containing
81
+ * one is taken at its word. That is the right way round: printing "no source was
82
+ * supplied" over a caller's own `<strong>` would be a false accusation on
83
+ * somebody's screen. It is also the one route to a silently sourceless citation
84
+ * that stays open, and the page says so rather than promising a guarantee this
85
+ * function does not make.
86
+ */
87
+ function hasSuppliedSource(source) {
88
+ const parts = Children.toArray(source);
89
+ if (parts.length === 0)
90
+ return false;
91
+ if (!parts.every((part) => typeof part === "string" || typeof part === "number")) {
92
+ return true;
93
+ }
94
+ const text = parts.map((part) => String(part)).join("").trim();
95
+ return text !== "" && !isBareNumber(text);
96
+ }
97
+ /**
98
+ * Whether the whole source is a number rather than words.
99
+ *
100
+ * `{sources.length && sources.text}` on an empty collection passes `0`, and
101
+ * React renders the digit, so a citation's entire statement of where a reading
102
+ * came from becomes the character `0` with no warning. A source that is only a
103
+ * number states no provenance at any value and not at zero alone, so it is
104
+ * refused rather than printed, and the admission line takes its place. `NaN`
105
+ * reaches here the same way from a count that did not parse. `disclaimer-note`
106
+ * refuses a bare-number body in exactly this shape.
107
+ */
108
+ function isBareNumber(text) {
109
+ return text === "NaN" || /^-?\d+(?:[.,]\d+)?$/.test(text);
110
+ }
111
+ /**
112
+ * Link labels that name no destination.
113
+ *
114
+ * A reader using a screen reader can list every link on a page with no sentence
115
+ * around any of them, and this is the one link on the citation that points at
116
+ * the fuller source. "Learn more" and "here" name nowhere in that list. The
117
+ * component warns and still renders: the destination is right even when the
118
+ * label is lazy, and taking somebody's citation link off the screen over its
119
+ * wording would be the larger mistake. Compared case-insensitively against the
120
+ * trimmed label with trailing punctuation removed.
121
+ */
122
+ const UNHELPFUL_LABELS = [
123
+ "learn more",
124
+ "read more",
125
+ "find out more",
126
+ "more",
127
+ "more information",
128
+ "click here",
129
+ "here",
130
+ "details",
131
+ "this link",
132
+ "source",
133
+ "citation",
134
+ "reference",
135
+ ];
136
+ /**
137
+ * The axis names, and the pattern that finds one in a class list.
138
+ *
139
+ * Built from two pieces on purpose, exactly as `disclaimer-note.tsx` and
140
+ * `callout.tsx` build theirs. `scripts/check-a11y.mts` reads this file as text
141
+ * and treats a file that spells a complete axis utility as a status surface
142
+ * owing a word, a glyph and a `data-status`; a detector written the obvious way
143
+ * would report itself. Split like this, the file contains the axis names and the
144
+ * axis prefixes and never the two joined, which is the thing the gate looks for.
145
+ * The pattern still matches every joined form at runtime.
146
+ */
147
+ const AXIS_NAMES = "steady|watch|attention|urgent|unknown|sleep|heart|activity|nutrition|mind|labs";
148
+ const AXIS_TINT = new RegExp(`(?:^|[\\s:-])(?:status|category)-(?:${AXIS_NAMES})(?![a-z])`);
149
+ /**
150
+ * The grid-item floor for the link to the fuller citation.
151
+ *
152
+ * THE LINK TREATMENT ITSELF LIVES IN `Link`, NOT HERE, so this citation's link
153
+ * and any other inline link cannot drift apart: the underline, the `0.25em`
154
+ * offset, the one-pixel press and the focus ring are all `Link`'s. What is left
155
+ * here is the part that was never about the link and always about the citation,
156
+ * which is how large a target the link must be when it stands on its own line.
157
+ *
158
+ * THE FLOOR IS HERE BECAUSE `emphasis="inline"` DROPS IT. `Link`'s inline form
159
+ * is a link inside a sentence, and SC 2.5.8 exempts an inline target, so it
160
+ * carries no floor: a 2.75rem minimum would inflate the line box of any
161
+ * paragraph the link sat in. This link is not inside a sentence. It is a
162
+ * control of its own on its own line, the standing "read the full citation"
163
+ * affordance a reader taps, so it keeps the floor the inline form sheds. The
164
+ * floor is `--opsin-target-minimum` in rem rather than 44px, so it grows when a
165
+ * reader raises their text size. The fallback inside the `var()` is
166
+ * load-bearing: written without one, the declaration is invalid at
167
+ * computed-value time in a project that has not imported
168
+ * `@opsinjs/tokens/tokens.css`, `min-height` reverts to `auto`, and the floor
169
+ * vanishes with no error anywhere. Both axes, because SC 2.5.8 is a 44x44
170
+ * region and a short label in a language with shorter words would otherwise sit
171
+ * under the floor on the inline axis.
172
+ *
173
+ * `justify-self-start` stops the anchor stretching to the width of its row, so a
174
+ * reader tapping the empty space beside a short label is not navigated somewhere
175
+ * they did not aim at. `inline-flex` is what `Link`'s `wrap-anywhere` needs to
176
+ * bite on a long compound label.
177
+ */
178
+ const LINK_FLOOR = "inline-flex min-h-(--opsin-target-minimum,2.75rem) " +
179
+ "min-w-(--opsin-target-minimum,2.75rem) max-w-full items-center " +
180
+ "justify-self-start";
181
+ /**
182
+ * A strict calendar date, `YYYY-MM-DD`.
183
+ *
184
+ * Nothing looser is accepted as a string, because a looser form is where a wrong
185
+ * "last checked" date comes from. `new Date("2026-03-14")` is read as UTC
186
+ * midnight and then formatted in whatever zone the code runs in, so the same
187
+ * string is 14 March on a London server and 13 March for a reader in the
188
+ * Americas. A calendar date pinned to UTC has no such drift.
189
+ */
190
+ const CALENDAR_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
191
+ /** Two-digit, for the machine `dateTime` attribute. */
192
+ function pad2(value) {
193
+ return String(value).padStart(2, "0");
194
+ }
195
+ /**
196
+ * The caller's language tag, or `undefined` where it is not a language tag.
197
+ *
198
+ * `Intl` throws a `RangeError` on a malformed tag, and it throws it during
199
+ * render. A component that takes a health screen down because a locale arrived
200
+ * as `"en_GB"` from a settings table has turned a cosmetic defect into an
201
+ * outage, so the tag is checked once and the runtime's own default is used
202
+ * instead. `relative-time.tsx` guards the same way.
203
+ */
204
+ function usableLocale(locale) {
205
+ if (locale === undefined)
206
+ return undefined;
207
+ try {
208
+ Intl.getCanonicalLocales(locale);
209
+ return locale;
210
+ }
211
+ catch {
212
+ warnDev(`locale-malformed:${locale}`, `[opsinjs] <SourceCitation locale="${locale}"> is not a BCP 47 language ` +
213
+ 'tag, so the last-checked date was formatted with the runtime default ' +
214
+ 'instead. A tag looks like "en-GB", with a hyphen.');
215
+ return undefined;
216
+ }
217
+ }
218
+ /**
219
+ * The last-checked date as a reader's phrase and a machine string, or null.
220
+ *
221
+ * IT INVENTS NOTHING. A number is read as epoch milliseconds, and its own UTC
222
+ * calendar day is rebuilt at UTC midnight so the same instant is the same day on
223
+ * every runtime. A string is a strict `YYYY-MM-DD` calendar date, pinned to UTC
224
+ * for the drift reason above. Anything else, a full timestamp, a free-text date,
225
+ * a value that does not resolve to a real day, is refused rather than rendered as
226
+ * a plausible but wrong date, and the caller is told in development. The round
227
+ * trip through `Date.UTC` is what rejects 31 February: `Date.UTC` rolls an
228
+ * impossible date forward without complaint, and a "last checked" date silently
229
+ * moved is worse than one that did not render.
230
+ */
231
+ function formatChecked(checkedOn, locale) {
232
+ let year;
233
+ let month;
234
+ let day;
235
+ if (typeof checkedOn === "number") {
236
+ if (!Number.isFinite(checkedOn))
237
+ return null;
238
+ const instant = new Date(checkedOn);
239
+ if (Number.isNaN(instant.getTime()))
240
+ return null;
241
+ year = instant.getUTCFullYear();
242
+ month = instant.getUTCMonth() + 1;
243
+ day = instant.getUTCDate();
244
+ }
245
+ else {
246
+ const match = CALENDAR_DATE.exec(checkedOn.trim());
247
+ if (match === null)
248
+ return null;
249
+ year = Number(match[1]);
250
+ month = Number(match[2]);
251
+ day = Number(match[3]);
252
+ }
253
+ if (month < 1 || month > 12 || day < 1 || day > 31)
254
+ return null;
255
+ const midnight = new Date(Date.UTC(year, month - 1, day));
256
+ if (midnight.getUTCFullYear() !== year ||
257
+ midnight.getUTCMonth() !== month - 1 ||
258
+ midnight.getUTCDate() !== day) {
259
+ return null;
260
+ }
261
+ const display = new Intl.DateTimeFormat(locale, {
262
+ dateStyle: "long",
263
+ timeZone: "UTC",
264
+ }).format(midnight);
265
+ return { display, machine: `${year}-${pad2(month)}-${pad2(day)}` };
266
+ }
267
+ /**
268
+ * The escape hatch, reported rather than closed.
269
+ *
270
+ * Not an OPSIN code, for the reason given on `warnDev`. It warns and renders: the
271
+ * class list is the caller's and the words are the product's, and taking a
272
+ * citation off a screen over a styling mistake would be the larger error.
273
+ * `disclaimer-note.tsx` and `callout.tsx` guard the same hole the same way.
274
+ */
275
+ function warnIfTintedFromAnAxis(className) {
276
+ if (!isDevelopment() || className === undefined)
277
+ return;
278
+ if (!AXIS_TINT.test(className))
279
+ return;
280
+ warnDev(`axis-tint:${className}`, `[opsinjs] <SourceCitation className="${className}"> takes a colour from one ` +
281
+ "of the two axes. This component sits outside both. A category tint makes a " +
282
+ "statement about where a number came from read as a statement about what the " +
283
+ "number is, and a status tint makes it read as a level; provenance is " +
284
+ "neither. See /docs/health/two-colour-axes.");
285
+ }
286
+ /**
287
+ * One link, as a control or as nothing.
288
+ *
289
+ * Returning `null` rather than rendering something is the point. A link with no
290
+ * name is announced as "link"; a link with no destination is a promise the
291
+ * citation cannot keep. `disclaimer-note.tsx` renders its `more` link the same
292
+ * way.
293
+ */
294
+ function citationLink(more) {
295
+ const label = typeof more.label === "string" ? more.label.trim() : "";
296
+ const href = typeof more.href === "string" ? more.href.trim() : "";
297
+ if (label === "" || href === "") {
298
+ warnDev(`link-incomplete:${label}|${href}`, "[opsinjs] <SourceCitation> was given `more` without both a label and an " +
299
+ "href, so nothing was rendered for it. The two travel together on " +
300
+ "purpose: a destination with no label would need one invented here, and " +
301
+ "the label a design system would invent names nowhere.");
302
+ return null;
303
+ }
304
+ const plain = trimTrailing(label.toLowerCase(), ".…!?:>»");
305
+ if (UNHELPFUL_LABELS.includes(plain)) {
306
+ warnDev(`link-unhelpful:${plain}`, `[opsinjs] <SourceCitation> has a link labelled "${label}", which names no ` +
307
+ "destination. A screen reader can list every link on a page with no " +
308
+ "sentence around them, and this is the one link that points at the fuller " +
309
+ 'citation. Name it in the reader\'s own language, with a label like "read ' +
310
+ 'how this estimate is worked out" or "see the accuracy document". It was ' +
311
+ "rendered as written.");
312
+ }
313
+ return (_jsx(Link, { href: href, emphasis: "inline", "data-slot": "source-citation-link", className: LINK_FLOOR, children: label }));
314
+ }
315
+ export function SourceCitation({ source, more, checkedOn, locale, className, }) {
316
+ warnIfTintedFromAnAxis(className);
317
+ /* THE ONE PLACE THIS COMPONENT REFUSES TO BE HELPFUL, and the reason it exists
318
+ in a design system rather than in each product's own codebase. A citation
319
+ that quietly rendered empty would pass review, pass every gate here, and ship
320
+ a reading whose provenance had silently gone missing. So the missing case
321
+ prints, in the reader's own words rather than the component's, about the app
322
+ rather than about this component. */
323
+ const supplied = hasSuppliedSource(source);
324
+ if (!supplied) {
325
+ warnDev("source-missing", "[opsinjs] <SourceCitation> was rendered with no `source`, so it says on " +
326
+ "screen that none was supplied. opsinjs ships no provenance: no default, " +
327
+ "no placeholder citation, no specimen DOI and no date. The words are a " +
328
+ "claim about where a reading came from, and a design system knows neither " +
329
+ "the reading nor its source. Write the product's own plain words: \"from " +
330
+ "your cuff\", \"estimated by your watch\", \"you entered this\". `false` " +
331
+ "or `0` from a `&&` branch, an empty array and a whitespace-only string " +
332
+ "all count as writing none.");
333
+ }
334
+ const link = more ? citationLink(more) : null;
335
+ const checked = checkedOn === undefined ? null : formatChecked(checkedOn, usableLocale(locale));
336
+ if (checkedOn !== undefined && checked === null) {
337
+ warnDev(`checked-unparsed:${String(checkedOn)}`, `[opsinjs] <SourceCitation checkedOn={${JSON.stringify(checkedOn)}}> is not ` +
338
+ "a calendar date, so no last-checked date was rendered rather than a " +
339
+ 'guessed one. Pass a string as "2026-03-14" (YYYY-MM-DD) or a number of ' +
340
+ "milliseconds since the epoch. A date this component cannot resolve is one " +
341
+ "it will not invent.");
342
+ }
343
+ return (
344
+ /* NO ROLE, NO FILL, NO BOUNDARY. The citation is ordinary text in the reading
345
+ order, sitting under the value it belongs to: nothing is announced over
346
+ what the reader is doing, and the whole treatment is the type step, the ink
347
+ and the space. A fill or a boundary would be a claim to attention this
348
+ caption does not make, and either would have to be measured on a surface
349
+ nobody has measured it on. Whether a screen-reader user should meet the
350
+ provenance as a named group rather than as loose lines is an open question
351
+ on the page rather than a settled decision here.
352
+
353
+ BODY INK AT THE FOOTNOTE STEP FOR THE SOURCE, AND THE STEP IS NOT
354
+ NEGOTIABLE DOWN INTO A PALER ONE. Rule 2 asks that provenance be visible in
355
+ plain words, so the source is the message and takes the readable foreground
356
+ ink; the smaller step is what keeps it secondary to the value above it
357
+ without making it a paler grey that complies with the letter of the rule
358
+ and none of its purpose. The date takes the quieter secondary ink one line
359
+ down, because it is metadata about the source rather than the source
360
+ itself.
361
+
362
+ THE INK IS AN ARBITRARY PROPERTY AND THAT IS NOT A STYLE CHOICE. `cn` is
363
+ `twMerge(clsx(...))`, tailwind-merge is unconfigured, and it has never been
364
+ told that `--text-opsin-*` is a font-size namespace. So it files
365
+ `text-opsin-footnote` and `text-foreground` in one conflict group and
366
+ silently drops whichever comes first, which would leave the citation at
367
+ whatever size it inherited. `[color:var(--foreground)]` is a different
368
+ conflict group, resolves the same custom property the `text-foreground`
369
+ utility resolves, and keeps both the size and the ink. A Tailwind editor
370
+ plugin will offer to rewrite it as `text-foreground`; do not accept that,
371
+ for the reason `button.tsx` and `disclaimer-note.tsx` give at length.
372
+
373
+ `min-w-0` with `wrap-break-word` and a comfortable measure are the reflow
374
+ repair: at 200% text a long device name or a bare word must break rather
375
+ than widen the citation past the viewport into horizontal scroll. The
376
+ `66ch` inside the `var()` is the cap's only guarantee outside this
377
+ repository, for the reason the fallback on the target floor already
378
+ gives. */
379
+ _jsxs("div", { "data-slot": "source-citation", className: cn("flex min-w-0 max-w-(--opsin-measure-comfortable,66ch) flex-col gap-y-opsin-1 text-opsin-footnote [color:var(--foreground)]", className), children: [_jsx("p", { "data-slot": "source-citation-source", className: "m-0 min-w-0 wrap-break-word", children: supplied
380
+ ? source
381
+ : "This app has not said where this information came from." }), checked ? (
382
+ /* The date is metadata about the source, so it takes the quieter
383
+ secondary ink one step down from the source line. It is a `<time>` so
384
+ the machine date travels with the reader's phrase, and "Last checked
385
+ on" is the component's own English chrome, in the same position as the
386
+ event words `relative-time.tsx` owns and translates for no caller. It
387
+ carries no staleness treatment and no tint, because this component
388
+ holds no boundary to compare the date against. */
389
+ _jsxs("p", { "data-slot": "source-citation-checked", className: "m-0 min-w-0 wrap-break-word [color:var(--muted-foreground)]", children: ["Last checked on", " ", _jsx("time", { dateTime: checked.machine, children: checked.display })] })) : null, link] }));
390
+ }
391
+ //# sourceMappingURL=source-citation.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SAAS,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAA;IAEjF,IAAI,SAAS,KAAK,SAAS,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,CACL,oBAAoB,MAAM,CAAC,SAAS,CAAC,EAAE,EACvC,wCAAwC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,YAAY;YAC3E,sEAAsE;YACtE,yEAAyE;YACzE,4EAA4E;YAC5E,qBAAqB,CACxB,CAAA;IACH,CAAC;IAED,OAAO;IACL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAkCY;IACZ,4BACY,iBAAiB,EAC3B,SAAS,EAAE,EAAE,CACX,4HAA4H,EAC5H,SAAS,CACV,aAED,yBACY,wBAAwB,EAClC,SAAS,EAAC,6BAA6B,YAiBtC,QAAQ;oBACP,CAAC,CAAC,MAAM;oBACR,CAAC,CAAC,yDAAyD,GAC3D,EAEH,OAAO,CAAC,CAAC,CAAC;YACT;;;;;;gEAMoD;YACpD,0BACY,yBAAyB,EACnC,SAAS,EAAC,6DAA6D,gCAEvD,GAAG,EACnB,eAAM,QAAQ,EAAE,OAAO,CAAC,OAAO,YAAG,OAAO,CAAC,OAAO,GAAQ,IACvD,CACL,CAAC,CAAC,CAAC,IAAI,EAEP,IAAI,IACD,CACP,CAAA;AACH,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Spinner is an indeterminate loading indicator: a small ring that turns while a
3
+ * brief, in-place wait resolves, and says nothing about what is arriving or how
4
+ * long it will take.
5
+ *
6
+ * REACH FOR A SKELETON FIRST, AND THAT IS THE WHOLE POSTURE OF THIS COMPONENT. A
7
+ * skeleton says WHAT is arriving, because it is the outline of the thing itself:
8
+ * a reader looking at three grey rows knows a list is coming and roughly how big
9
+ * it will be. A spinner says only THAT something is arriving, which is less
10
+ * information for the same screen space, and a spinner that sits where a shape
11
+ * could have been drawn has thrown that shape away. So the skeleton is the
12
+ * default answer across the system, and a spinner earns its place only where the
13
+ * shape of what is coming is genuinely unknown: a brief wait with no layout to
14
+ * promise, an action whose result has no fixed form, a spot too small for an
15
+ * outline. Everywhere the arriving content has a shape, that shape is a Skeleton.
16
+ *
17
+ * IT IS A SERVER COMPONENT, BECAUSE A TURNING RING HAS NO STATE TO HYDRATE. The
18
+ * rotation is CSS, the ring is SVG, and neither needs JavaScript on the client.
19
+ * Making it a client component would ship a bundle for a graphic that a
20
+ * stylesheet already draws and animates. It holds no timer and starts no work of
21
+ * its own: whether the spinner is on screen at all is the product's decision,
22
+ * driven by the product's own loading state, and this component only draws the
23
+ * ring while it is mounted.
24
+ *
25
+ * IT CARRIES NEITHER COLOUR AXIS. A wait is not a clinical level and not a kind
26
+ * of measurement, so the ring states no status and names no category. It draws in
27
+ * `currentColor`, which means it takes the ink colour of whatever surrounds it: a
28
+ * spinner set in muted footnote text is a quiet grey, and one set in a heading is
29
+ * the heading's ink. A caller who wants the quiet neutral tone on a plain surface
30
+ * sets it through `className` as `[color:var(--muted-foreground)]`; the component
31
+ * forces no colour of its own, and the two-colour-axes rule applies to any class
32
+ * a caller passes in full.
33
+ *
34
+ * THE RING IS DECORATIVE AND THE WAIT IS SPOKEN. The SVG itself is `aria-hidden`,
35
+ * because a turning shape read aloud is noise. The accessible announcement is
36
+ * carried two ways instead: the root is a `role="status"` live region, so a
37
+ * screen reader tells the reader that a wait has begun when the spinner mounts,
38
+ * and it carries the `label` both as its `aria-label` and as a visually hidden
39
+ * copy of the text inside it, so the wait has a name a reader hears rather than a
40
+ * bare "busy". The `label` is required for exactly that reason: a spinner with no
41
+ * name announces a wait for something the reader cannot identify. Name what is
42
+ * being waited for, "Loading your readings" rather than "Loading", where the
43
+ * screen has the room.
44
+ *
45
+ * IT STOPS UNDER REDUCED MOTION. `animate-spin` turns the ring, and
46
+ * `motion-reduce:animate-none` holds it still for a reader who has asked the
47
+ * platform for less movement. The wait is still announced through the live region
48
+ * and the hidden text, so a reader who cannot use the motion loses nothing the
49
+ * ring was carrying: the ring was never the message, only its decoration.
50
+ *
51
+ * IT IS NOT FOCUSABLE AND CAPTURES NO KEY. A spinner is a piece of status, not a
52
+ * control: there is nothing to press, nothing to change, and a tab stop on it
53
+ * would be a stop that does nothing. It takes no target floor and carries no
54
+ * focus ring, because it is never a target and never takes focus.
55
+ */
56
+ export interface SpinnerProps {
57
+ /**
58
+ * The accessible name for the wait, required and read aloud. It is applied as
59
+ * the `aria-label` on the `role="status"` region and rendered as a visually
60
+ * hidden copy inside it, so a screen reader announces the wait with a name
61
+ * rather than a bare "busy". Name what is being waited for where the screen has
62
+ * the room, "Loading your readings" rather than the bare "Loading", so a reader
63
+ * hears which part of the page is not ready yet. There is no default, because a
64
+ * guessed name would describe the wrong wait on most screens.
65
+ */
66
+ label: string;
67
+ /**
68
+ * Visual weight only, and both weights are neutral. `sm` is a ring beside a
69
+ * line of text; `md` is a ring that anchors a small in-place wait on its own.
70
+ * Both are sized in `em`, so the ring scales with the surrounding text rather
71
+ * than pinning at a fixed size. Defaults to `md`.
72
+ */
73
+ size?: "sm" | "md";
74
+ /**
75
+ * Merged onto the root. Placement, margin and the space around the spinner
76
+ * belong here, and it is the one route by which colour can reach the ring: the
77
+ * ring draws in `currentColor`, so a class such as `[color:var(--muted-foreground)]`
78
+ * sets the quiet neutral tone on a plain surface. The two-colour-axes rule
79
+ * applies to a class you pass in full: a spinner takes neither a status nor a
80
+ * category tint, because a wait is on neither axis. A class you pass wins over
81
+ * the root's own where the two conflict, because it is merged last.
82
+ */
83
+ className?: string;
84
+ }
85
+ export declare function Spinner({ label, size, className }: SpinnerProps): import("react").JSX.Element;
86
+ //# sourceMappingURL=spinner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/components/spinner.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAkCH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;OAQG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,IAAW,EAAE,SAAS,EAAE,EAAE,YAAY,+BAwDtE"}