@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,243 @@
1
+ /**
2
+ * Term shows a clinical word with its everyday meaning attached, so a sentence
3
+ * can be read without leaving it.
4
+ *
5
+ * A DEFINITION SAYS WHAT A THING IS. It does not say what the reader should do
6
+ * about theirs, and this file has no way to make it. There is no `status`, no
7
+ * `severity`, no action slot and no `href`: everything Term can render is the
8
+ * word, its full form, and one sentence of plain English that came out of a
9
+ * glossary somebody reviewed. *Chronic means long-lasting* is a translation;
10
+ * *chronic means you will have this for life* is a prognosis, and the shape of
11
+ * the API is the only thing that reliably keeps the second one out.
12
+ *
13
+ * THE THREE PRIMITIVES THAT LOOK RIGHT AND ARE NOT. `term.mdx:118-120` says the
14
+ * definition "is never removed from the accessibility tree by a presentation
15
+ * choice… a reader using speech has no way to know something is there to open",
16
+ * and `term.mdx:205-206` says the word "is never split from its definition in
17
+ * the reading order". Those two sentences rule out every disclosure primitive in
18
+ * `@base-ui/react`, and they rule them out for different reasons:
19
+ *
20
+ * - `preview-card` opens on hover. This is a phone-first system and there is
21
+ * no hover on a phone, which is also why `present` has no `hover` value.
22
+ * - `popover` portals its content to the end of the document and hides it
23
+ * from assistive technology while closed. Both halves fail: the definition
24
+ * leaves the sentence, and a speech reader meets a control with nothing
25
+ * behind it until they guess to press it.
26
+ * - `collapsible` keeps the panel adjacent, which fixes the reading order, but
27
+ * its closed panel carries the `hidden` attribute even with `keepMounted`.
28
+ * `hidden` is exactly what "removed from the accessibility tree" means.
29
+ *
30
+ * So the disclosure here is hand-built, and it is built the other way round: the
31
+ * definition is ALWAYS in the accessibility tree, and the control changes only
32
+ * whether it is on the screen. Collapsed, it is `display: none` and reaches the
33
+ * reader as the trigger's accessible DESCRIPTION. A node referenced by
34
+ * `aria-describedby` is included in the name-and-description computation whether
35
+ * or not it is displayed, which is the one hiding mechanism that keeps a promise
36
+ * instead of breaking it.
37
+ *
38
+ * IT IS A CLIENT COMPONENT, ALL OF IT, AND THAT IS A COST RATHER THAN A CHOICE.
39
+ * Only the disclosure needs state; the inline presentation is a span and two
40
+ * strings. But `"use client"` is a file-level directive and a component is one
41
+ * flat file in `packages/react/src/components/`, so the boundary lands on the
42
+ * whole component or on none of it. Splitting the leaf into a second file would
43
+ * put a non-component into that directory, where the generator registers every
44
+ * file as a component, exports it from the package entry point and publishes it
45
+ * as its own subpath, so half of this one would ship as a component of its own.
46
+ *
47
+ * WHERE THE DEFINITIONS COME FROM, AND WHY NOT FROM A PROP. `term.mdx:155-158`
48
+ * refuses a per-call-site definition outright: definitions live in a glossary so
49
+ * they are consistent across every screen, reviewable in one place, translatable
50
+ * and countable. A product can then ask *how many words are we asking our
51
+ * readers to learn?* and get an answer. So the glossary arrives once, through
52
+ * <TermGlossaryProvider>, and `id` is a key into it.
53
+ *
54
+ * A CONFLICT WITH THE AUTHORED GLOSSARY, PART NOW SETTLED AND PART STILL OPEN.
55
+ * `tokens/glossary.json`'s `policy.rule` reads: "Plain wording is the
56
+ * default and the clinical term is the annotation, never the other way around.
57
+ * `<Term>` renders the plain wording as the visible text and exposes the
58
+ * clinical term on demand; it must not render a clinical term with a tooltip
59
+ * and call that plain English." This file does the reverse: the visible text is
60
+ * the clinical word, and the plain wording is either attached in parentheses or
61
+ * put behind a control. The argument for the implemented direction is the one
62
+ * in `GlossaryEntry.word` below, and the same policy block makes it itself when
63
+ * it explains why `showBoth: "always"` exists. A reader holding a printout has
64
+ * to be able to match it to the screen. Both statements are in the same file and
65
+ * they contradict each other, and neither this component nor the glossary may
66
+ * settle the whole of it alone. The narrower half is now settled: where a call
67
+ * site expresses no preference and leaves the presentation to `auto`, the
68
+ * glossary's `always` governs, so both readings go on the screen inline rather
69
+ * than the plain wording being hidden behind a press. What stays open is the
70
+ * shape itself, whether the visible text should be the plain wording with the
71
+ * clinical spelling as the annotation rather than the other way around. That is
72
+ * a change to this component and to `policy.rule` together, so it is recorded
73
+ * here and on `term.mdx` rather than settled quietly.
74
+ */
75
+ import { type ReactNode } from "react";
76
+ /**
77
+ * One word the product has decided its readers should not have to look up.
78
+ *
79
+ * The shape is the shape of `tokens/glossary.json` in this repository, minus
80
+ * the authoring fields, so a product that already keeps its vocabulary in that
81
+ * form can hand it straight to the provider. It is deliberately not imported
82
+ * from anywhere: this file is published in @opsinjs/react for other people's
83
+ * products, the glossary is theirs, and a component that arrived with 36
84
+ * opinions about what English words mean would be opsinjs writing clinical
85
+ * content for a product it has never seen.
86
+ */
87
+ export interface GlossaryEntry {
88
+ /** The key a call site writes: `<Term id="egfr">`. Unique in the glossary. */
89
+ id: string;
90
+ /**
91
+ * The clinical word, spelt the way it appears on the reader's own paperwork.
92
+ * That spelling is the point of showing it at all. A reader holding a printed
93
+ * result and looking at a screen has to be able to match the two.
94
+ */
95
+ word: string;
96
+ /**
97
+ * The everyday meaning. One sentence, and it says what the word IS. It is
98
+ * never what to do, never what it means for this reader, and never a
99
+ * reassurance.
100
+ */
101
+ plain: string;
102
+ /**
103
+ * The full form, when `word` is an abbreviation. An expansion is a different
104
+ * thing from a definition and most readers need both: expanding *eGFR* to
105
+ * *estimated glomerular filtration rate* still explains nothing on its own.
106
+ */
107
+ expansion?: string;
108
+ /**
109
+ * How the word is spoken, when speech synthesis would otherwise read it as a
110
+ * word: `SpO2` is said as its letters and is not *spoh-two*. Write it as the
111
+ * letters separated by spaces. Omitted means the written form is the spoken
112
+ * form, which is true of nearly every entry.
113
+ */
114
+ speech?: string;
115
+ /**
116
+ * The glossary's own policy for this entry, carried through unchanged from
117
+ * `tokens/glossary.json`. The three values are the glossary's, not this
118
+ * component's, and only one of them reaches the rendering.
119
+ *
120
+ * `plain-only` is the one that changes what is rendered, and it changes it
121
+ * completely: that value means the clinical word is never shown to the reader
122
+ * and the entry exists so an author can look up what to write instead. With no
123
+ * children, Term honours it by rendering the plain wording as ordinary text
124
+ * and marking nothing, because there is no clinical word on the screen to
125
+ * explain. When a call site does supply `children`, Term renders them, because
126
+ * a runtime cannot rewrite a sentence, and it warns in development that the
127
+ * entry says the clinical word should not reach a reader. See
128
+ * `TermProps.children`.
129
+ *
130
+ * `always` GOVERNS THE `auto` PATH. The glossary defines it as showing the
131
+ * clinical word and the plain wording together every time, for matching a
132
+ * printout, and where a call site leaves the presentation to `auto` that is
133
+ * what it gets: the definition is shown inline whatever its length. What
134
+ * `always` does not do is overrule the call site. An explicit `present` and
135
+ * `once` still win over it, because they are the surface's own statements about
136
+ * this occurrence and a component does not overrule the surface it stands on.
137
+ * An `always` entry that a call site puts behind a press by naming
138
+ * `present="disclosure"` on a first appearance warns in development.
139
+ *
140
+ * `first-use` is likewise the caller's to express, through `once`: opsinjs
141
+ * cannot see where one surface ends and the next begins, which is the same
142
+ * reason `once` is a prop rather than a count.
143
+ *
144
+ * There is no default. An entry that omits the field takes the budget path: it
145
+ * is shown inline when it is short enough to share the line and behind a
146
+ * control when it is not, which is not the same as `always`, since `always` is
147
+ * shown inline whatever its length.
148
+ */
149
+ showBoth?: "always" | "first-use" | "plain-only";
150
+ }
151
+ export interface TermGlossaryProviderProps {
152
+ /**
153
+ * Every term this subtree can name. Hoist it to a module constant: it is
154
+ * rebuilt into a lookup whenever its identity changes, and an array literal
155
+ * written inline in JSX is a new identity on every render.
156
+ *
157
+ * It may be handed straight across the server/client boundary. A plain array
158
+ * of plain objects is serialisable, so the definitions can be read from a file
159
+ * on the server and never reach the browser as code.
160
+ */
161
+ glossary: readonly GlossaryEntry[];
162
+ children: ReactNode;
163
+ }
164
+ /**
165
+ * Mount this once, around everything that reads.
166
+ *
167
+ * A React context rather than a module-level registry, for two reasons that
168
+ * both matter in a Next.js application. A module singleton exists once per
169
+ * module graph, so a glossary registered on the server is not the glossary a
170
+ * client component sees, and the failure is invisible until a term goes blank in
171
+ * the browser. And a provider nests: a specialist area of a product can supply a
172
+ * second, narrower glossary for its own subtree without editing the first.
173
+ */
174
+ export declare function TermGlossaryProvider({ glossary, children, }: TermGlossaryProviderProps): import("react").JSX.Element;
175
+ export interface TermProps {
176
+ /**
177
+ * The glossary key. Resolved against the glossary supplied by
178
+ * <TermGlossaryProvider>.
179
+ *
180
+ * `term.mdx:132-134` asks for an unknown id to be a build error. A component
181
+ * cannot fail somebody else's build from inside a render, so what happens
182
+ * instead is stated rather than implied: the word is rendered unmarked, no
183
+ * affordance is drawn, and development gets a warning naming the id. Marking a
184
+ * word whose explanation does not exist is the one outcome that is worse than
185
+ * leaving it plain. The build-time half of that promise belongs in a lint rule
186
+ * over the product's own source, and it does not exist yet.
187
+ */
188
+ id: string;
189
+ /**
190
+ * The word as it should read in this sentence, where a plural, a tense or a
191
+ * capitalisation makes it differ from the glossary's headword. It changes
192
+ * what is printed and nothing else: the definition and the expansion still
193
+ * come from the entry, and so does the spoken form of an abbreviation, which
194
+ * is appended to the control's name rather than replacing what is written
195
+ * there.
196
+ *
197
+ * Every path that can render prints it when a call site supplied it, because
198
+ * the author's sentence is the only grammatical one available and a runtime
199
+ * cannot rewrite it. A `plain-only` entry is the case where doing so is a
200
+ * contradiction rather than a convenience: `children` is where a call site
201
+ * writes the clinical word inflected for its sentence, and that entry's whole
202
+ * content is that the clinical word is never shown, so the component renders
203
+ * the children and warns loudly in development that the two disagree. Only
204
+ * when no children are supplied does that path fall back to the entry's plain
205
+ * wording. An `id` that is not in the glossary prints children gratefully,
206
+ * because there it is the only real word available and without it the raw key
207
+ * appears in the sentence instead.
208
+ */
209
+ children?: ReactNode;
210
+ /**
211
+ * How the definition is presented. `inline` puts it in parentheses after the
212
+ * word; `disclosure` puts it behind a control. `auto` chooses by the length of
213
+ * the definition.
214
+ *
215
+ * There is no `hover` value, on purpose. A hover-only definition does not
216
+ * exist on a phone, does not exist for a keyboard, and is unreliable for
217
+ * anybody with a tremor.
218
+ *
219
+ * @default "auto"
220
+ */
221
+ present?: "auto" | "inline" | "disclosure";
222
+ /**
223
+ * Suppress the repeat. Set it on the second and later appearances of a term on
224
+ * one surface: the word is still marked, the definition is still one press
225
+ * away and still in the accessibility tree, and it is not printed again on
226
+ * screen or on paper.
227
+ *
228
+ * opsinjs does not count the appearances for you. It cannot see where one
229
+ * surface ends and the next begins, and a component that guessed would either
230
+ * repeat itself down a page or silently drop a definition the reader had not
231
+ * yet met. Repetition is noise and absence is a barrier; this is the
232
+ * compromise, and the caller is the only party that can make it.
233
+ */
234
+ once?: boolean;
235
+ /**
236
+ * Merged onto the root. Layout belongs here; the mark, the control and the
237
+ * definition's own treatment do not, because each of them is an accessibility
238
+ * claim this component makes on the page.
239
+ */
240
+ className?: string;
241
+ }
242
+ export declare function Term({ id, children, present, once, className, }: TermProps): import("react").JSX.Element;
243
+ //# sourceMappingURL=term.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"term.d.ts","sourceRoot":"","sources":["../../src/components/term.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AAEH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAKd;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,8EAA8E;IAC9E,EAAE,EAAE,MAAM,CAAA;IACV;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,YAAY,CAAA;CACjD;AAcD,MAAM,WAAW,yBAAyB;IACxC;;;;;;;;OAQG;IACH,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAA;IAClC,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,QAAQ,GACT,EAAE,yBAAyB,+BA0B3B;AAoPD,MAAM,WAAW,SAAS;IACxB;;;;;;;;;;;OAWG;IACH,EAAE,EAAE,MAAM,CAAA;IACV;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;;;;;;;OAUG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAA;IAC1C;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AA2CD,wBAAgB,IAAI,CAAC,EACnB,EAAE,EACF,QAAQ,EACR,OAAgB,EAChB,IAAY,EACZ,SAAS,GACV,EAAE,SAAS,+BA2SX"}