@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,260 @@
1
+ /**
2
+ * Button is the control you press to make something happen.
3
+ *
4
+ * THE LEAST CLINICAL COMPONENT, AND THE ONE WITH THE FEWEST PLACES TO HIDE. It
5
+ * asserts nothing about a person, so every decision in this file is about the
6
+ * two things a control owes everybody: a name you can read and a target you can
7
+ * hit. Both are easier to get wrong here than anywhere else, because a button
8
+ * is the component people copy first and read last.
9
+ *
10
+ * IT IS ALWAYS A REAL <button>. There is no `href`, no `as` and no `render`
11
+ * escape hatch, and that is a refusal rather than an omission. A control that
12
+ * produces a new URL is a link: it can be opened in a new tab, copied, and
13
+ * found in a screen reader's list of links, and none of that survives being
14
+ * reimplemented as a button with a click handler. The specification's anatomy
15
+ * says "a real <button>, or an <a> only when it navigates" and this file
16
+ * implements the first half; the second half belongs to `link`, which is a
17
+ * separate component and is not this one wearing a different tag.
18
+ *
19
+ * The refusal is enforced rather than only typed. `render` and `nativeButton`
20
+ * are Base UI's own props and are absent from `ButtonProps`, which stops a
21
+ * TypeScript caller. This file nevertheless ships as source into JavaScript
22
+ * projects where a type is advice, and `{...rest}` would carry either of them
23
+ * straight through to the primitive. So both are pinned below, after the
24
+ * spread. Checked by rendering the primitive: `render={<a href="/x" />}` emits
25
+ * a <button>.
26
+ *
27
+ * WHY BASE UI RATHER THAN A BARE <button>. Exactly one prop needs it. `busy`
28
+ * has to make the control unactivatable WITHOUT removing it from the
29
+ * accessibility tree. The native `disabled` attribute does both at once, and
30
+ * losing the control mid-save loses the reader's place. Base UI's `useButton`
31
+ * gives that combination directly: with `disabled` and `focusableWhenDisabled`
32
+ * together it sets `aria-disabled`, leaves the native attribute off, keeps the
33
+ * element in the tab order, and swallows activation. Rebuilding that by hand
34
+ * means merging the caller's own onClick and onKeyDown with ours, which is the
35
+ * kind of code that works until somebody passes a handler we did not expect.
36
+ *
37
+ * WHAT BASE UI COSTS, AND IT IS NOT NOTHING. `useButton` merges `type: 'button'`
38
+ * into every native button before the caller's own props
39
+ * (`internals/use-button/useButton.js`), so this component does NOT inherit the
40
+ * platform's implicit `type="submit"`. A Button at the foot of a form needs
41
+ * `type="submit"` written on it or the form will not submit. That is the
42
+ * opposite of a bare <button> and it is the single most surprising thing about
43
+ * this file, which is why `type` is redeclared in `ButtonProps` below with the
44
+ * real default on it rather than left to be inherited silently. `useButton`
45
+ * also stamps `tabIndex={0}` on every button. That is harmless, because 0 is
46
+ * the value a button already has. It does mean, though, that "this component
47
+ * adds no tabindex" is not a true sentence about the rendered DOM.
48
+ *
49
+ * THERE IS NO DESTRUCTIVE COLOUR IN THIS SYSTEM, AND THIS FILE DOES NOT INVENT
50
+ * ONE. The product palette is the two axes plus eleven neutral roles; the
51
+ * status axis is reserved for what a reading means. The guide to moving from
52
+ * shadcn/ui, `migrating`, gives `variant="destructive"` no equivalent and keeps
53
+ * `status="urgent"` for a clinical status only, because a delete button is not
54
+ * a clinical status and mapping one onto the other is the fastest way to
55
+ * contaminate the axis. So `destructive` is separated from `secondary` by its
56
+ * boundary ink rather than by hue. The boundary is drawn in `--foreground`, the
57
+ * page's own near-black ink, with no fill. The label and the confirmation step
58
+ * around it stay the signal a reader relies on, because in opsinjs there is no
59
+ * colour available to carry a delete.
60
+ *
61
+ * THE EMPHASIS WIDTH WAS GIVEN UP ON PURPOSE. A 2px grey boundary said two
62
+ * things at once, "this deletes" on this control and "act now" on the status
63
+ * axis, and a width that the status axis already owns as its own carrier
64
+ * cannot also be the whole of a delete signal. The boundary ink is measured
65
+ * by hand against both surfaces this button sits on: `--foreground` reaches
66
+ * 18.12:1 on `--background` and 18.61:1 on `--card` in light, and 17.53:1 on
67
+ * `--background` and 15.96:1 on `--card` in dark, so every rung clears the 3:1
68
+ * non-text floor with room. Measured, not gated: `scripts/check-contrast.mts`
69
+ * reads only tokens/color.json and tokens/material.json and has never seen a
70
+ * product surface role, so it cannot check this pair, and the page says so
71
+ * rather than promising a gate that does not exist.
72
+ *
73
+ * WHAT IT DOES NOT DO. It does not derive anything, does not animate anything
74
+ * but the busy spinner, does not move focus, and does not mount a live region.
75
+ * `busy` is EXPOSED on the control as `aria-busy` and `aria-disabled`; whether
76
+ * anything is spoken about it is a question of screen-reader behaviour that
77
+ * nobody here has tested, and whether a save is worth announcing is the
78
+ * product's call and not a decision a button is entitled to make.
79
+ */
80
+ import { type ButtonHTMLAttributes, type ReactNode } from "react";
81
+ /**
82
+ * Four variants, in descending emphasis.
83
+ *
84
+ * Deliberately few, and deliberately NOT exported: the substrate contract fixes
85
+ * a component file at two public exports: the props interface and the
86
+ * component. A consumer therefore names this union as `ButtonProps["variant"]`
87
+ * rather than importing a third symbol. The specification writes it as an
88
+ * export; that difference is recorded on the page rather than resolved in
89
+ * favour of a wider surface.
90
+ */
91
+ type ButtonVariant = "primary" | "secondary" | "quiet" | "destructive";
92
+ export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
93
+ /**
94
+ * Emphasis. Four values, in descending order: `primary`, `secondary`,
95
+ * `quiet`, `destructive`. One primary per surface. The hierarchy is the
96
+ * answer to "what should I do here?", and three primaries answer it with a
97
+ * shrug. Defaults to `secondary`, because the safe default is the one that
98
+ * does not claim to be the most important thing on the screen.
99
+ */
100
+ variant?: ButtonVariant;
101
+ /**
102
+ * Visual weight only. Both sizes clear the 44pt target floor; `sm` is
103
+ * narrower and takes a smaller type step at the same weight, and is never
104
+ * shorter. Defaults to `md`.
105
+ */
106
+ size?: "sm" | "md";
107
+ /**
108
+ * Required. The label, and there is no way to remove it: no `iconOnly` prop
109
+ * and no size at which the icon stands alone. An icon-only control needs its
110
+ * accessible name supplied some other way and a different target treatment,
111
+ * which makes it a different component.
112
+ */
113
+ children: ReactNode;
114
+ /**
115
+ * Inherited from `button`, redeclared here because its default is the
116
+ * surprising one. **Defaults to `button`, not to `submit`.** Base UI's
117
+ * `useButton` merges `type: "button"` into every native button, so this
118
+ * component does not inherit the platform's implicit submit behaviour: a
119
+ * control at the foot of a form needs `type="submit"` written on it. The
120
+ * value you pass wins, so submitting is one word away. It is a word you have
121
+ * to write, though.
122
+ */
123
+ type?: "button" | "submit" | "reset";
124
+ /**
125
+ * An optional glyph beside the label. Always decorative and always hidden
126
+ * from assistive technology. The label carries the meaning, and an announced
127
+ * icon makes a screen reader say the action twice.
128
+ */
129
+ icon?: ReactNode;
130
+ /**
131
+ * Which side the icon sits on. Defaults to `leading`. Use `trailing` for a
132
+ * control that moves the reader forward through a flow, so the glyph points
133
+ * the way the action goes.
134
+ */
135
+ iconPosition?: "leading" | "trailing";
136
+ /**
137
+ * In-place loading. The label stays visible and unchanged, and the button
138
+ * stays in the accessibility tree and in the tab order rather than
139
+ * disappearing. What a sighted reader sees is the press tone, the same fill a
140
+ * tap gives, held for the duration and paired with a busy glyph in the icon
141
+ * slot, so a busy control reads as working rather than as a live control that
142
+ * does nothing when pressed. What assistive technology is told is EXPOSED on
143
+ * the control as `aria-busy` plus `aria-disabled`; whether any screen reader
144
+ * says anything about it has not been tested here, and `aria-busy` on a
145
+ * control that is not a live region is a hint rather than a promise. The glyph
146
+ * replaces the icon slot, so a button that has no icon grows by one glyph when
147
+ * it becomes busy; give a button an icon if its width must not move. An icon
148
+ * settles the glyph alone: a `busyLabel` adds its word to the same slot beside
149
+ * the glyph, so a control that passes one widens on becoming busy whatever its
150
+ * icon, and only `fullWidth` or a container that fixes the width holds it
151
+ * steady then.
152
+ */
153
+ busy?: boolean;
154
+ /**
155
+ * The product's own word for what a busy control is doing, `Saving` or
156
+ * `Sending`, supplied by the product and never invented or translated by
157
+ * opsinjs. When `busy` is set and this is a non-empty string, it renders as a
158
+ * visible word beside the busy glyph and, unlike the glyph, reaches the
159
+ * accessibility tree. That word is the state's static carrier: a reader who
160
+ * turned motion off sees a still glyph and the word rather than a spin, and a
161
+ * reader who cannot see the glyph at all still has the word. Leave it unset
162
+ * and a busy control shows the glyph alone, which under reduced motion is a
163
+ * still glyph and the unchanged label with no word for what is happening. The
164
+ * word occupies the busy slot beside the glyph, so a control that passes it
165
+ * grows wider when it becomes busy, an icon notwithstanding; give the control
166
+ * `fullWidth`, or a container that fixes its width, if that width must not
167
+ * move under the reader's thumb.
168
+ */
169
+ busyLabel?: string;
170
+ /**
171
+ * Fills its container. For the bottom of a sheet or a form, where the primary
172
+ * action should be as wide as the thumb's reach. Not for a row of buttons,
173
+ * because two full-width buttons stacked read as two primary actions.
174
+ */
175
+ fullWidth?: boolean;
176
+ }
177
+ export declare function Button({ variant, size, children, icon, iconPosition, busy, busyLabel, fullWidth, className, style, ...rest }: ButtonProps): import("react").JSX.Element;
178
+ /**
179
+ * The card action recipe: the class list for a single action rendered on a
180
+ * card, a banner or an empty state, spelled once so the surfaces that draw one
181
+ * cannot drift.
182
+ *
183
+ * WHY IT LIVES IN BUTTON.TSX. A card action is either an anchor or a Button,
184
+ * and the `as: "button"` arms return only the delta Button does not already
185
+ * bring, so the recipe and the control have to share a file to stay in step.
186
+ * The alternative homes are worse. A new file in
187
+ * `packages/react/src/components/` is read by
188
+ * `apps/www/scripts/build-registry.mts` as a component id, exported from the
189
+ * package entry point and published as its own `@opsinjs/react/<id>` subpath,
190
+ * which a module of class strings is not. `../opsinjs.ts` is published beside
191
+ * every component but holds runtime data and pure functions and no
192
+ * presentation, so a class recipe does not belong there either. `button.tsx` is
193
+ * already imported by all four action-bearing cards, so this export costs no
194
+ * new import, no new package subpath and no catalogue row.
195
+ *
196
+ * WHY THE EXPORT AT ALL. The substrate contract fixes a component file at two
197
+ * public exports, the props interface and the component, now that the zero-prop
198
+ * demo lives in `apps/www/registry/demos/`, and several component files state
199
+ * the rule. This is a departure, and what buys it is real: the `ACTION_LINK`
200
+ * constant was byte-identical in `alert-banner.tsx`, `result-card.tsx` and
201
+ * `empty-state.tsx`, `disclaimer-note.tsx` carried a fifth anchor, and
202
+ * `care-card.tsx` re-spelled Button's own fills by hand because Button's `TONE`
203
+ * is private. One recipe replaces all of them, so a change to how an action
204
+ * looks is made here and nowhere else.
205
+ *
206
+ * WHY IT CONCATENATES RATHER THAN MERGES. `cn` is `twMerge(clsx(...))` with
207
+ * tailwind-merge unconfigured, so a `text-*` colour class and a `text-opsin-*`
208
+ * type step land in one conflict group and one of them is deleted, which is the
209
+ * trap the `TONE` comment above spells out. The four original `ACTION_LINK`
210
+ * constants were template-joined for exactly this reason, and so is this. Every
211
+ * ink here is an arbitrary property for the same reason.
212
+ *
213
+ * WHICH INK EACH ARM CARRIES. The recommended neutral link is foreground ink in
214
+ * a bordered capsule, the same pair `Button`'s `secondary` rung draws, so the
215
+ * recommended action reads at one weight on both transports. The quiet neutral
216
+ * link is the accent ink, `[color:var(--brand-ink)]` (ADR 0029), at the
217
+ * subheadline step and weight 600, which is exactly what `Button`'s `quiet` rung
218
+ * at `sm` draws, so its handler twin needs no delta at all. A tinted arm asserts
219
+ * no ink and no fill: on a status tint the ink is the level's own `-ink` role,
220
+ * which the caller's surface supplies, and an accent there would put a chrome
221
+ * colour on a status surface nothing has measured. A tinted caller supplies that
222
+ * ink above a single class, which `alert-banner.tsx`'s `[&_button]:` selector
223
+ * does. Nothing here names a status colour, so the two colour axes never meet on
224
+ * one class list.
225
+ *
226
+ * NO ARM IS UNDERLINED. An underline is how a link inside running text says it
227
+ * is a link, and `Link`'s `inline` emphasis keeps it for exactly that. A card
228
+ * action is never in running text: it stands in a row of actions, and each arm
229
+ * already says it is a control by its shape or its colour. The recommended arms
230
+ * have a capsule boundary, the quiet neutral arm has the accent ink, and the
231
+ * quiet tinted arm, which can carry neither an accent nor a fill on a status
232
+ * tint, draws a hairline capsule in the surrounding ink instead.
233
+ *
234
+ * WHY THE WEIGHT UNION HAS NO BRAND OPTION. The `weight` union is
235
+ * `"recommended" | "quiet"` and carries no brand-filled arm, because a card's
236
+ * primary action is neutral and bordered rather than brand-filled. The argument
237
+ * is already written in the tree in two places, and both are load-bearing.
238
+ * `alert-banner.tsx:545-558` refuses a brand fill on a status surface, because
239
+ * `Button variant="primary"` would need a measured contrast pair on each of the
240
+ * four tints in two themes, which is eight measurements for one control that
241
+ * nobody has taken, so the link branch was given a neutral opaque fill instead.
242
+ * `result-card.tsx:155-160` refuses a fill for a different reason: `bg-primary`
243
+ * sits on the card's own ground, so the fill that is meant to mark the action
244
+ * out is the card's ground and marks nothing. A brand-for-everything rule would
245
+ * have to exempt AlertBanner, and a rule with an exemption that large is not a
246
+ * rule, so the recipe makes a brand card action unreachable at the type level.
247
+ *
248
+ * `ButtonVariant` is untouched, and this restriction is not a deprecation of
249
+ * Button `primary`. `primary` is still available for a form submit inside a
250
+ * Dialog or a Sheet, where the ground is neutral and the control is the only
251
+ * action on the surface. The restriction on a brand fill is on the card action,
252
+ * not on Button.
253
+ */
254
+ export declare function cardActionClassName(options: {
255
+ weight: "recommended" | "quiet";
256
+ ground?: "neutral" | "tinted";
257
+ as: "link" | "button";
258
+ }): string;
259
+ export {};
260
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components/button.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AAIH,OAAO,EAAY,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAK3E;;;;;;;;;GASG;AACH,KAAK,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,aAAa,CAAA;AAsPtE,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IACjE;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB;;;;;OAKG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAA;IACpC;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;IACrC;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,wBAAgB,MAAM,CAAC,EACrB,OAAqB,EACrB,IAAW,EACX,QAAQ,EACR,IAAI,EACJ,YAAwB,EACxB,IAAY,EACZ,SAAS,EACT,SAAiB,EACjB,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,WAAW,+BA6Sb;AAaD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2EG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAC3C,MAAM,EAAE,aAAa,GAAG,OAAO,CAAA;IAC/B,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC7B,EAAE,EAAE,MAAM,GAAG,QAAQ,CAAA;CACtB,GAAG,MAAM,CA0CT"}