@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.
- package/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +114 -2
- package/dist/components/accordion.d.ts +82 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +154 -0
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/alert-banner.d.ts +291 -0
- package/dist/components/alert-banner.d.ts.map +1 -0
- package/dist/components/alert-banner.js +529 -0
- package/dist/components/alert-banner.js.map +1 -0
- package/dist/components/avatar.d.ts +45 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +159 -0
- package/dist/components/avatar.js.map +1 -0
- package/dist/components/badge.d.ts +78 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +32 -0
- package/dist/components/badge.js.map +1 -0
- package/dist/components/body-map.d.ts +51 -0
- package/dist/components/body-map.d.ts.map +1 -0
- package/dist/components/body-map.js +190 -0
- package/dist/components/body-map.js.map +1 -0
- package/dist/components/button.d.ts +260 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +609 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/callout.d.ts +99 -0
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +285 -0
- package/dist/components/callout.js.map +1 -0
- package/dist/components/card.d.ts +156 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +396 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/care-card.d.ts +182 -0
- package/dist/components/care-card.d.ts.map +1 -0
- package/dist/components/care-card.js +544 -0
- package/dist/components/care-card.js.map +1 -0
- package/dist/components/checkbox.d.ts +58 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +167 -0
- package/dist/components/checkbox.js.map +1 -0
- package/dist/components/combobox.d.ts +71 -0
- package/dist/components/combobox.d.ts.map +1 -0
- package/dist/components/combobox.js +204 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/consent-sheet.d.ts +186 -0
- package/dist/components/consent-sheet.d.ts.map +1 -0
- package/dist/components/consent-sheet.js +452 -0
- package/dist/components/consent-sheet.js.map +1 -0
- package/dist/components/dialog.d.ts +108 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +573 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/disclaimer-note.d.ts +144 -0
- package/dist/components/disclaimer-note.d.ts.map +1 -0
- package/dist/components/disclaimer-note.js +486 -0
- package/dist/components/disclaimer-note.js.map +1 -0
- package/dist/components/divider.d.ts +76 -0
- package/dist/components/divider.d.ts.map +1 -0
- package/dist/components/divider.js +101 -0
- package/dist/components/divider.js.map +1 -0
- package/dist/components/dose-tracker.d.ts +137 -0
- package/dist/components/dose-tracker.d.ts.map +1 -0
- package/dist/components/dose-tracker.js +154 -0
- package/dist/components/dose-tracker.js.map +1 -0
- package/dist/components/empty-state.d.ts +171 -0
- package/dist/components/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state.js +387 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/field.d.ts +195 -0
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +282 -0
- package/dist/components/field.js.map +1 -0
- package/dist/components/goal-ring.d.ts +114 -0
- package/dist/components/goal-ring.d.ts.map +1 -0
- package/dist/components/goal-ring.js +254 -0
- package/dist/components/goal-ring.js.map +1 -0
- package/dist/components/icon-button.d.ts +124 -0
- package/dist/components/icon-button.d.ts.map +1 -0
- package/dist/components/icon-button.js +113 -0
- package/dist/components/icon-button.js.map +1 -0
- package/dist/components/link.d.ts +122 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/link.js +164 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/log-sheet.d.ts +259 -0
- package/dist/components/log-sheet.d.ts.map +1 -0
- package/dist/components/log-sheet.js +437 -0
- package/dist/components/log-sheet.js.map +1 -0
- package/dist/components/menu.d.ts +69 -0
- package/dist/components/menu.d.ts.map +1 -0
- package/dist/components/menu.js +190 -0
- package/dist/components/menu.js.map +1 -0
- package/dist/components/metric-tile.d.ts +301 -0
- package/dist/components/metric-tile.d.ts.map +1 -0
- package/dist/components/metric-tile.js +533 -0
- package/dist/components/metric-tile.js.map +1 -0
- package/dist/components/number-field.d.ts +62 -0
- package/dist/components/number-field.d.ts.map +1 -0
- package/dist/components/number-field.js +134 -0
- package/dist/components/number-field.js.map +1 -0
- package/dist/components/popover.d.ts +70 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +174 -0
- package/dist/components/popover.js.map +1 -0
- package/dist/components/progress.d.ts +83 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +140 -0
- package/dist/components/progress.js.map +1 -0
- package/dist/components/questionnaire.d.ts +123 -0
- package/dist/components/questionnaire.d.ts.map +1 -0
- package/dist/components/questionnaire.js +148 -0
- package/dist/components/questionnaire.js.map +1 -0
- package/dist/components/radio-group.d.ts +66 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +186 -0
- package/dist/components/radio-group.js.map +1 -0
- package/dist/components/range-bar.d.ts +172 -0
- package/dist/components/range-bar.d.ts.map +1 -0
- package/dist/components/range-bar.js +578 -0
- package/dist/components/range-bar.js.map +1 -0
- package/dist/components/range-legend.d.ts +97 -0
- package/dist/components/range-legend.d.ts.map +1 -0
- package/dist/components/range-legend.js +166 -0
- package/dist/components/range-legend.js.map +1 -0
- package/dist/components/reading-input.d.ts +225 -0
- package/dist/components/reading-input.d.ts.map +1 -0
- package/dist/components/reading-input.js +651 -0
- package/dist/components/reading-input.js.map +1 -0
- package/dist/components/relative-time.d.ts +177 -0
- package/dist/components/relative-time.d.ts.map +1 -0
- package/dist/components/relative-time.js +603 -0
- package/dist/components/relative-time.js.map +1 -0
- package/dist/components/result-card.d.ts +319 -0
- package/dist/components/result-card.d.ts.map +1 -0
- package/dist/components/result-card.js +614 -0
- package/dist/components/result-card.js.map +1 -0
- package/dist/components/scale-input.d.ts +58 -0
- package/dist/components/scale-input.d.ts.map +1 -0
- package/dist/components/scale-input.js +170 -0
- package/dist/components/scale-input.js.map +1 -0
- package/dist/components/score-dial.d.ts +205 -0
- package/dist/components/score-dial.d.ts.map +1 -0
- package/dist/components/score-dial.js +728 -0
- package/dist/components/score-dial.js.map +1 -0
- package/dist/components/scroll-area.d.ts +38 -0
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +138 -0
- package/dist/components/scroll-area.js.map +1 -0
- package/dist/components/segmented-control.d.ts +69 -0
- package/dist/components/segmented-control.d.ts.map +1 -0
- package/dist/components/segmented-control.js +259 -0
- package/dist/components/segmented-control.js.map +1 -0
- package/dist/components/select.d.ts +72 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +205 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/sheet.d.ts +192 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +952 -0
- package/dist/components/sheet.js.map +1 -0
- package/dist/components/skeleton.d.ts +104 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +266 -0
- package/dist/components/skeleton.js.map +1 -0
- package/dist/components/slider.d.ts +55 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +170 -0
- package/dist/components/slider.js.map +1 -0
- package/dist/components/source-citation.d.ts +127 -0
- package/dist/components/source-citation.d.ts.map +1 -0
- package/dist/components/source-citation.js +391 -0
- package/dist/components/source-citation.js.map +1 -0
- package/dist/components/spinner.d.ts +86 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +97 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/status-pill.d.ts +90 -0
- package/dist/components/status-pill.d.ts.map +1 -0
- package/dist/components/status-pill.js +259 -0
- package/dist/components/status-pill.js.map +1 -0
- package/dist/components/stepper.d.ts +99 -0
- package/dist/components/stepper.d.ts.map +1 -0
- package/dist/components/stepper.js +152 -0
- package/dist/components/stepper.js.map +1 -0
- package/dist/components/surface.d.ts +92 -0
- package/dist/components/surface.d.ts.map +1 -0
- package/dist/components/surface.js +261 -0
- package/dist/components/surface.js.map +1 -0
- package/dist/components/switch.d.ts +48 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +152 -0
- package/dist/components/switch.js.map +1 -0
- package/dist/components/symptom-picker.d.ts +69 -0
- package/dist/components/symptom-picker.d.ts.map +1 -0
- package/dist/components/symptom-picker.js +170 -0
- package/dist/components/symptom-picker.js.map +1 -0
- package/dist/components/tab-bar.d.ts +110 -0
- package/dist/components/tab-bar.d.ts.map +1 -0
- package/dist/components/tab-bar.js +118 -0
- package/dist/components/tab-bar.js.map +1 -0
- package/dist/components/table.d.ts +117 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +65 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +106 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +136 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/term.d.ts +243 -0
- package/dist/components/term.d.ts.map +1 -0
- package/dist/components/term.js +562 -0
- package/dist/components/term.js.map +1 -0
- package/dist/components/textarea.d.ts +157 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +66 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/timeline-entry.d.ts +99 -0
- package/dist/components/timeline-entry.d.ts.map +1 -0
- package/dist/components/timeline-entry.js +47 -0
- package/dist/components/timeline-entry.js.map +1 -0
- package/dist/components/toast.d.ts +80 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +266 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/tooltip.d.ts +48 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +159 -0
- package/dist/components/tooltip.js.map +1 -0
- package/dist/components/trend-sparkline.d.ts +188 -0
- package/dist/components/trend-sparkline.d.ts.map +1 -0
- package/dist/components/trend-sparkline.js +796 -0
- package/dist/components/trend-sparkline.js.map +1 -0
- package/dist/components/value.d.ts +150 -0
- package/dist/components/value.d.ts.map +1 -0
- package/dist/components/value.js +402 -0
- package/dist/components/value.js.map +1 -0
- package/dist/components/visually-hidden.d.ts +61 -0
- package/dist/components/visually-hidden.d.ts.map +1 -0
- package/dist/components/visually-hidden.js +172 -0
- package/dist/components/visually-hidden.js.map +1 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +72 -0
- package/dist/index.js.map +1 -0
- package/dist/opsinjs.d.ts +443 -0
- package/dist/opsinjs.d.ts.map +1 -0
- package/dist/opsinjs.js +906 -0
- package/dist/opsinjs.js.map +1 -0
- package/dist/status.d.ts +111 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +125 -0
- package/dist/status.js.map +1 -0
- package/dist/styles.css +2 -0
- package/dist/utils.d.ts +20 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +82 -0
- package/dist/utils.js.map +1 -0
- package/package.json +86 -3
- package/styles/base.css +132 -0
- package/styles/roles.css +412 -0
- package/styles/standalone.css +20 -0
- package/styles/tailwind.css +18 -0
- package/styles/theme.css +309 -0
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Button is the control you press to make something happen.
|
|
4
|
+
*
|
|
5
|
+
* THE LEAST CLINICAL COMPONENT, AND THE ONE WITH THE FEWEST PLACES TO HIDE. It
|
|
6
|
+
* asserts nothing about a person, so every decision in this file is about the
|
|
7
|
+
* two things a control owes everybody: a name you can read and a target you can
|
|
8
|
+
* hit. Both are easier to get wrong here than anywhere else, because a button
|
|
9
|
+
* is the component people copy first and read last.
|
|
10
|
+
*
|
|
11
|
+
* IT IS ALWAYS A REAL <button>. There is no `href`, no `as` and no `render`
|
|
12
|
+
* escape hatch, and that is a refusal rather than an omission. A control that
|
|
13
|
+
* produces a new URL is a link: it can be opened in a new tab, copied, and
|
|
14
|
+
* found in a screen reader's list of links, and none of that survives being
|
|
15
|
+
* reimplemented as a button with a click handler. The specification's anatomy
|
|
16
|
+
* says "a real <button>, or an <a> only when it navigates" and this file
|
|
17
|
+
* implements the first half; the second half belongs to `link`, which is a
|
|
18
|
+
* separate component and is not this one wearing a different tag.
|
|
19
|
+
*
|
|
20
|
+
* The refusal is enforced rather than only typed. `render` and `nativeButton`
|
|
21
|
+
* are Base UI's own props and are absent from `ButtonProps`, which stops a
|
|
22
|
+
* TypeScript caller. This file nevertheless ships as source into JavaScript
|
|
23
|
+
* projects where a type is advice, and `{...rest}` would carry either of them
|
|
24
|
+
* straight through to the primitive. So both are pinned below, after the
|
|
25
|
+
* spread. Checked by rendering the primitive: `render={<a href="/x" />}` emits
|
|
26
|
+
* a <button>.
|
|
27
|
+
*
|
|
28
|
+
* WHY BASE UI RATHER THAN A BARE <button>. Exactly one prop needs it. `busy`
|
|
29
|
+
* has to make the control unactivatable WITHOUT removing it from the
|
|
30
|
+
* accessibility tree. The native `disabled` attribute does both at once, and
|
|
31
|
+
* losing the control mid-save loses the reader's place. Base UI's `useButton`
|
|
32
|
+
* gives that combination directly: with `disabled` and `focusableWhenDisabled`
|
|
33
|
+
* together it sets `aria-disabled`, leaves the native attribute off, keeps the
|
|
34
|
+
* element in the tab order, and swallows activation. Rebuilding that by hand
|
|
35
|
+
* means merging the caller's own onClick and onKeyDown with ours, which is the
|
|
36
|
+
* kind of code that works until somebody passes a handler we did not expect.
|
|
37
|
+
*
|
|
38
|
+
* WHAT BASE UI COSTS, AND IT IS NOT NOTHING. `useButton` merges `type: 'button'`
|
|
39
|
+
* into every native button before the caller's own props
|
|
40
|
+
* (`internals/use-button/useButton.js`), so this component does NOT inherit the
|
|
41
|
+
* platform's implicit `type="submit"`. A Button at the foot of a form needs
|
|
42
|
+
* `type="submit"` written on it or the form will not submit. That is the
|
|
43
|
+
* opposite of a bare <button> and it is the single most surprising thing about
|
|
44
|
+
* this file, which is why `type` is redeclared in `ButtonProps` below with the
|
|
45
|
+
* real default on it rather than left to be inherited silently. `useButton`
|
|
46
|
+
* also stamps `tabIndex={0}` on every button. That is harmless, because 0 is
|
|
47
|
+
* the value a button already has. It does mean, though, that "this component
|
|
48
|
+
* adds no tabindex" is not a true sentence about the rendered DOM.
|
|
49
|
+
*
|
|
50
|
+
* THERE IS NO DESTRUCTIVE COLOUR IN THIS SYSTEM, AND THIS FILE DOES NOT INVENT
|
|
51
|
+
* ONE. The product palette is the two axes plus eleven neutral roles; the
|
|
52
|
+
* status axis is reserved for what a reading means. The guide to moving from
|
|
53
|
+
* shadcn/ui, `migrating`, gives `variant="destructive"` no equivalent and keeps
|
|
54
|
+
* `status="urgent"` for a clinical status only, because a delete button is not
|
|
55
|
+
* a clinical status and mapping one onto the other is the fastest way to
|
|
56
|
+
* contaminate the axis. So `destructive` is separated from `secondary` by its
|
|
57
|
+
* boundary ink rather than by hue. The boundary is drawn in `--foreground`, the
|
|
58
|
+
* page's own near-black ink, with no fill. The label and the confirmation step
|
|
59
|
+
* around it stay the signal a reader relies on, because in opsinjs there is no
|
|
60
|
+
* colour available to carry a delete.
|
|
61
|
+
*
|
|
62
|
+
* THE EMPHASIS WIDTH WAS GIVEN UP ON PURPOSE. A 2px grey boundary said two
|
|
63
|
+
* things at once, "this deletes" on this control and "act now" on the status
|
|
64
|
+
* axis, and a width that the status axis already owns as its own carrier
|
|
65
|
+
* cannot also be the whole of a delete signal. The boundary ink is measured
|
|
66
|
+
* by hand against both surfaces this button sits on: `--foreground` reaches
|
|
67
|
+
* 18.12:1 on `--background` and 18.61:1 on `--card` in light, and 17.53:1 on
|
|
68
|
+
* `--background` and 15.96:1 on `--card` in dark, so every rung clears the 3:1
|
|
69
|
+
* non-text floor with room. Measured, not gated: `scripts/check-contrast.mts`
|
|
70
|
+
* reads only tokens/color.json and tokens/material.json and has never seen a
|
|
71
|
+
* product surface role, so it cannot check this pair, and the page says so
|
|
72
|
+
* rather than promising a gate that does not exist.
|
|
73
|
+
*
|
|
74
|
+
* WHAT IT DOES NOT DO. It does not derive anything, does not animate anything
|
|
75
|
+
* but the busy spinner, does not move focus, and does not mount a live region.
|
|
76
|
+
* `busy` is EXPOSED on the control as `aria-busy` and `aria-disabled`; whether
|
|
77
|
+
* anything is spoken about it is a question of screen-reader behaviour that
|
|
78
|
+
* nobody here has tested, and whether a save is worth announcing is the
|
|
79
|
+
* product's call and not a decision a button is entitled to make.
|
|
80
|
+
*/
|
|
81
|
+
import { Button as BaseButton } from "@base-ui/react/button";
|
|
82
|
+
import { Hourglass, LoaderCircle } from "lucide-react";
|
|
83
|
+
import { Children } from "react";
|
|
84
|
+
import { isDevelopment } from "../opsinjs.js";
|
|
85
|
+
import { cn } from "../utils.js";
|
|
86
|
+
/**
|
|
87
|
+
* Development warnings, said once per distinct message.
|
|
88
|
+
*
|
|
89
|
+
* `warnOnce` in the substrate is keyed to an `OpsinErrorCode`, and the codes in
|
|
90
|
+
* tokens/errors.json describe mistakes a consumer makes with the CLINICAL API.
|
|
91
|
+
* "This control shipped with no accessible name" is a mistake anybody can make
|
|
92
|
+
* with any control and there is no code allocated for it. What the substrate is
|
|
93
|
+
* right about is the discipline rather than the registry: a warning channel
|
|
94
|
+
* degrades into noise if it repeats on every render, which under Strict Mode
|
|
95
|
+
* means twice per render. A noisy channel is one somebody switches off. So this
|
|
96
|
+
* file keeps its own small set. Allocating real codes and deleting this is a
|
|
97
|
+
* strict improvement, and belongs in ../opsinjs.ts rather than here.
|
|
98
|
+
*/
|
|
99
|
+
const warned = new Set();
|
|
100
|
+
function warnDev(key, message) {
|
|
101
|
+
if (!isDevelopment() || warned.has(key))
|
|
102
|
+
return;
|
|
103
|
+
warned.add(key);
|
|
104
|
+
console.warn(message);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Whether `children` will render no text at all.
|
|
108
|
+
*
|
|
109
|
+
* TypeScript cannot see this: `children` is required and every value below
|
|
110
|
+
* satisfies a required `ReactNode`. Testing the three sentinels `""`, `null`
|
|
111
|
+
* and `undefined` misses the way it actually happens, which is
|
|
112
|
+
* `{flag && "Save reading"}` evaluating to `false`, or a whitespace-only string
|
|
113
|
+
* arriving from a translation table. `Children.toArray` drops `null`,
|
|
114
|
+
* `undefined`, booleans and empty arrays for us; what it keeps and we must
|
|
115
|
+
* still reject is a string that is all whitespace.
|
|
116
|
+
*
|
|
117
|
+
* `0` is NOT blank, and the distinction is deliberate. It renders the character
|
|
118
|
+
* "0", which is a real accessible name. This is the same null-versus-zero
|
|
119
|
+
* split the rest of this system insists on for values, applied to a label.
|
|
120
|
+
*/
|
|
121
|
+
function hasNoLabel(children) {
|
|
122
|
+
const parts = Children.toArray(children);
|
|
123
|
+
if (parts.length === 0)
|
|
124
|
+
return true;
|
|
125
|
+
return parts.every((part) => typeof part === "string" && part.trim() === "");
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Fill, ink and boundary per variant, written out as literal class strings.
|
|
129
|
+
*
|
|
130
|
+
* Tailwind reads class names out of source as text. `bg-${variant}` generates
|
|
131
|
+
* no CSS whatsoever and the button renders unstyled, which is a defect that
|
|
132
|
+
* reviews miss because the code reads as if it works. So the four are spelled
|
|
133
|
+
* in full, once, here.
|
|
134
|
+
*
|
|
135
|
+
* Note what is NOT reached for. The secondary, accent and destructive roles a
|
|
136
|
+
* shadcn button reaches for first are declared only in the docs chrome and
|
|
137
|
+
* resolve to nothing under the product theme, so an emphasis ladder built from
|
|
138
|
+
* them would look correct in review and arrive colourless in the product. The
|
|
139
|
+
* four rungs below are built from the roles the product stylesheet actually
|
|
140
|
+
* bridges: a strong fill, a soft fill, an outline, and nothing at all.
|
|
141
|
+
*
|
|
142
|
+
* Hover and press are consumed from the theme rather than approximated. Four
|
|
143
|
+
* state roles now exist in `packages/react/styles/roles.css`: `--state-hover`,
|
|
144
|
+
* `--state-press` and the primary pair `--state-primary-hover` and
|
|
145
|
+
* `--state-primary-press`.
|
|
146
|
+
* They are opaque and not alpha, so a state does not resolve to one colour on
|
|
147
|
+
* `--background` and a different one on `--card`, and they move away from the
|
|
148
|
+
* surface in the direction `foundations/interaction-states` specifies, darker
|
|
149
|
+
* in light and lighter in dark, rather than back towards it the way the old
|
|
150
|
+
* `bg-muted` borrow did. Press is a different value from hover, so a tap now
|
|
151
|
+
* reads even without the sink, and the sink set out on `PRESS` below stays as
|
|
152
|
+
* the one press cue that needs no colour at all. The honest figures, named in full
|
|
153
|
+
* rather than by the friendlier one alone: the light neutral hover fill reaches
|
|
154
|
+
* only 1.14:1 against the surfaces and the press fill 1.23:1, both under the
|
|
155
|
+
* 1.5:1 the audit asked for, because `--background` and `--card` sit so near
|
|
156
|
+
* white that no opaque step below them can climb higher without reading as a
|
|
157
|
+
* different fill. Press is distinct from hover, so a tap reads, but the light
|
|
158
|
+
* hover step still sits below the floor the finding set, and that residual
|
|
159
|
+
* belongs to the theme layer that owns the values rather than to this file.
|
|
160
|
+
* These pairs are hand-authored in the theme layer rather than emitted
|
|
161
|
+
* by `scripts/build-tokens.mts`, so `interaction-states.mdx`'s Tokens section
|
|
162
|
+
* is still `<NoDataYet>` and nothing gates them.
|
|
163
|
+
*
|
|
164
|
+
* WHY EVERY RUNG SPELLS ITS INK AS AN ARBITRARY PROPERTY. `cn`
|
|
165
|
+
* is `twMerge(clsx(...))` and tailwind-merge is unconfigured, so it has never
|
|
166
|
+
* been told that `--text-opsin-*` is a font-size namespace: it files
|
|
167
|
+
* `text-opsin-headline` and `text-primary-foreground` in the SAME conflict group
|
|
168
|
+
* and keeps whichever comes last. Written `text-primary-foreground`, the ink was
|
|
169
|
+
* silently deleted by `SIZE[size]` on the line below it in the `cn()` call and
|
|
170
|
+
* every primary button in the system rendered the page's default near-black
|
|
171
|
+
* label on the primary fill. That is a dark ink on a mid-blue ground, on the
|
|
172
|
+
* control that commits a reading. No gate could see it:
|
|
173
|
+
* `scripts/check-contrast.mts` measures the `--primary` / `--primary-foreground`
|
|
174
|
+
* token PAIR and that pair is fine, while the class that would have applied it
|
|
175
|
+
* never reached the DOM. Reordering does not help either: it keeps the ink and
|
|
176
|
+
* drops the type step and its weight instead, which is the regression
|
|
177
|
+
* `care-card.tsx` documents at its own action list. `[color:…]` is an
|
|
178
|
+
* arbitrary property, which tailwind-merge groups by the CSS property rather
|
|
179
|
+
* than by the `text-` prefix, so the two no longer meet and both survive.
|
|
180
|
+
* `disclaimer-note.tsx` answers the identical trap the same way, and its
|
|
181
|
+
* comment is the longer version of this one. A Tailwind editor plugin will
|
|
182
|
+
* offer to rewrite the line as `text-primary-foreground`; do not accept it,
|
|
183
|
+
* because that is exactly the spelling that loses.
|
|
184
|
+
*
|
|
185
|
+
* The cost, stated: because the two no longer conflict, a caller cannot
|
|
186
|
+
* recolour a button by passing a `text-*` class. Both declarations are emitted
|
|
187
|
+
* and source order decides. `style={{ color: … }}` still works and is spread
|
|
188
|
+
* last, so that is the way to do it. This treatment is on all four rungs and
|
|
189
|
+
* not on primary alone, because the trap is on all four. tailwind-merge files
|
|
190
|
+
* `text-foreground` in the same conflict group as `text-opsin-headline`, and
|
|
191
|
+
* `SIZE[size]` is passed after `TONE[variant]` in the `cn()` call below, so a
|
|
192
|
+
* plain `text-foreground` was deleted from `secondary`, `quiet` and
|
|
193
|
+
* `destructive` exactly as `text-primary-foreground` was deleted from
|
|
194
|
+
* `primary`. The string `text-foreground` has never reached the DOM on any
|
|
195
|
+
* button in this system. It looked safe in-repo only because a label with no
|
|
196
|
+
* colour of its own inherits the page colour, and on this repository's surfaces
|
|
197
|
+
* the page colour equals `--foreground`. Published in @opsinjs/react, this file
|
|
198
|
+
* renders in somebody else's app, where an inherited label takes its colour
|
|
199
|
+
* from any ancestor that sets `color`: a Card's `text-card-foreground`, or a
|
|
200
|
+
* status surface carrying `--opsin-status-urgent-ink`. That last case is a
|
|
201
|
+
* route for a status colour to land on a control label, which is the two-axis
|
|
202
|
+
* invariant failing by inheritance rather than by anyone choosing it, so the
|
|
203
|
+
* arbitrary property is what keeps the label's ink its own on any ground.
|
|
204
|
+
* Configuring `extendTailwindMerge` in `../utils.ts` with the `text-opsin-*`
|
|
205
|
+
* namespace would retire this whole comment. That is a change to every
|
|
206
|
+
* component in @opsinjs/react at once and belongs in `../utils.ts`, which this
|
|
207
|
+
* file does not own.
|
|
208
|
+
*
|
|
209
|
+
* QUIET IS THE ONE RUNG WITH NEITHER A FILL NOR A BOUNDARY, so its ink is what
|
|
210
|
+
* tells a reader it is a control. It is the accent ink, `[color:var(--brand-ink)]`
|
|
211
|
+
* (ADR 0029): in every accent theme it is the accent's own hue at a lightness
|
|
212
|
+
* that clears the body floor on the page and on a card, and scripts/build-tokens.mts
|
|
213
|
+
* refuses to emit one that does not, so the label is legible and reads as the
|
|
214
|
+
* one coloured word in a row of ink. No underline: an underline marks a link
|
|
215
|
+
* inside running text, and a control already standing on its own in a row of
|
|
216
|
+
* controls needs only to look pressable, which the accent and the hover fill
|
|
217
|
+
* do. The arbitrary-property spelling is required and not decorative: a plain
|
|
218
|
+
* `text-brand-ink` lands in tailwind-merge's `text-*` group with the type step
|
|
219
|
+
* `SIZE[size]` contributes and is deleted, exactly as `text-foreground` is, so
|
|
220
|
+
* it would never reach the DOM. The accent is neither a category nor a status
|
|
221
|
+
* colour, so this touches neither axis, and a quiet button on a status surface
|
|
222
|
+
* takes that level's own ink from the surface instead, which AlertBanner
|
|
223
|
+
* supplies.
|
|
224
|
+
*/
|
|
225
|
+
/**
|
|
226
|
+
* WHY ONLY PRIMARY OPTS OUT OF FORCED COLOURS. The four rungs differ only in
|
|
227
|
+
* fill and boundary. A forced-colours theme, which is what a Windows
|
|
228
|
+
* high-contrast reader runs, replaces every author fill and every author ink
|
|
229
|
+
* on a native button with the system's own pair, so without the classes on
|
|
230
|
+
* the `primary` entry below all four rungs render as the same outlined box and
|
|
231
|
+
* the emphasis ladder flattens to one level. Primary alone takes `Highlight`
|
|
232
|
+
* as its fill, `HighlightText` as its ink and `Highlight` as its boundary,
|
|
233
|
+
* which is the platform's own selected pair and the one place a component may
|
|
234
|
+
* name a colour it did not measure, because the platform guarantees the pair
|
|
235
|
+
* clears its own contrast floor. `forced-color-adjust-none` is scoped to the
|
|
236
|
+
* primary rung alone: the other three keep the platform's rendering, so the
|
|
237
|
+
* ladder holds two levels rather than one. `background-color` and not the
|
|
238
|
+
* `background` shorthand, because the shorthand would also reset
|
|
239
|
+
* `background-image`.
|
|
240
|
+
*/
|
|
241
|
+
const TONE = {
|
|
242
|
+
primary: "border-primary-edge bg-primary [color:var(--primary-foreground)] shadow-[0_10px_26px_-12px_var(--brand-glow)] not-aria-disabled:active:shadow-[0_4px_12px_-8px_var(--brand-glow)] hover:bg-state-primary-hover active:bg-state-primary-press not-disabled:aria-busy:bg-state-primary-press forced-colors:[background-color:Highlight] forced-colors:[color:HighlightText] forced-colors:border-[Highlight] forced-colors:forced-color-adjust-none",
|
|
243
|
+
secondary: "border-border bg-card [color:var(--foreground)] hover:bg-state-hover active:bg-state-press not-disabled:aria-busy:bg-state-press",
|
|
244
|
+
quiet: "border-transparent bg-transparent [color:var(--brand-ink)] hover:bg-state-hover active:bg-state-press not-disabled:aria-busy:bg-state-press",
|
|
245
|
+
destructive: "border-foreground bg-transparent [color:var(--foreground)] hover:bg-state-hover active:bg-state-press not-disabled:aria-busy:bg-state-press",
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* THE PRESS, the first of the five interaction motions (ADR 0031), spelled once
|
|
249
|
+
* for both transports: Button's own root, and the link arms of the card action
|
|
250
|
+
* recipe at the foot of this file, so a recommended action sinks the same way
|
|
251
|
+
* whether it acts or navigates.
|
|
252
|
+
*
|
|
253
|
+
* It is asymmetric, and the asymmetry is the design. `foundations/states` asks
|
|
254
|
+
* for a press applied on pointer-down on `duration-instant`, and the use
|
|
255
|
+
* tokens/motion.json writes for `spring-snap` names a pressed button settling.
|
|
256
|
+
* CSS takes a transition's timing from the style it is changing TO, so the rest
|
|
257
|
+
* state carries the spring and `:active` carries the instant. Going down runs
|
|
258
|
+
* on the 80ms standard curve; coming back up runs on the snap spring, which
|
|
259
|
+
* passes its rest size by 1.5% of the distance travelled and settles. The
|
|
260
|
+
* fill, the boundary and the primary rung's glow ride the same timing as the
|
|
261
|
+
* scale, so the colour and the shape move as one object rather than the colour
|
|
262
|
+
* landing first. The glow is drawn closer on press in TONE above, as though the
|
|
263
|
+
* capsule had come down towards its own light.
|
|
264
|
+
*
|
|
265
|
+
* 0.97 reads as a press under a thumb and is small enough that the label does
|
|
266
|
+
* not visibly soften. It is `scale`, the individual transform property, and not
|
|
267
|
+
* `transform`, so it composes with anything a caller translates, and it never
|
|
268
|
+
* changes layout. Nothing a press moves displays a value, which is the one
|
|
269
|
+
* thing `spring-snap` is barred from.
|
|
270
|
+
*
|
|
271
|
+
* Under `prefers-reduced-motion: reduce` the generated sheet collapses
|
|
272
|
+
* `spring-snap` to 0ms and the product sheet collapses `instant` to 1ms, so the
|
|
273
|
+
* sink becomes a change of state within one frame, with no travel to watch.
|
|
274
|
+
* That is the cue the old one-pixel shift gave, and nothing here needs a
|
|
275
|
+
* branch of its own. Without the generated sheet the durations are undeclared,
|
|
276
|
+
* the transition is zero, and the press still shows, at once.
|
|
277
|
+
*/
|
|
278
|
+
const PRESS = "transition-[color,background-color,border-color,box-shadow,scale] " +
|
|
279
|
+
"duration-(--opsin-duration-spring-snap) ease-opsin-spring-snap " +
|
|
280
|
+
"active:scale-97 active:duration-(--opsin-duration-instant) active:ease-opsin-standard";
|
|
281
|
+
/**
|
|
282
|
+
* The boundary width per variant, as the token rather than as a number.
|
|
283
|
+
*
|
|
284
|
+
* It is an inline style and not a class on purpose. Tailwind can take a border
|
|
285
|
+
* width from a custom property, but a spelling that fails to compile produces
|
|
286
|
+
* no declaration and no error. The failure mode here is a secondary button
|
|
287
|
+
* that silently loses its only boundary, which is the one thing that keeps it
|
|
288
|
+
* visible in greyscale and under a reader stylesheet that strips backgrounds. A
|
|
289
|
+
* declared `borderStyle` travels with it because the width alone does nothing
|
|
290
|
+
* without it in a project whose reset differs from this one.
|
|
291
|
+
*/
|
|
292
|
+
const EDGE = {
|
|
293
|
+
primary: "var(--opsin-border-hairline, 1px)",
|
|
294
|
+
secondary: "var(--opsin-border-hairline, 1px)",
|
|
295
|
+
quiet: "var(--opsin-border-hairline, 1px)",
|
|
296
|
+
/* Hairline like the rest. The destructive rung is told apart by its
|
|
297
|
+
boundary ink in `--foreground`, not by width; the emphasis width is the
|
|
298
|
+
status axis's own carrier and no longer appears in this file. */
|
|
299
|
+
destructive: "var(--opsin-border-hairline, 1px)",
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Padding and type step per size.
|
|
303
|
+
*
|
|
304
|
+
* `md` takes the headline step, which is body size at weight 600. The ramp
|
|
305
|
+
* carries `subheadlineEmphasis`, which is subheadline's geometry at headline's
|
|
306
|
+
* weight, so `sm` points at it and is narrower and a smaller type step without
|
|
307
|
+
* becoming lighter. A component that reached for `font-medium` here would be
|
|
308
|
+
* authoring a weight the type scale does not own, and pointing at a ramp step
|
|
309
|
+
* is not that.
|
|
310
|
+
*
|
|
311
|
+
* Neither size sets a height. The height floor is the target minimum, applied
|
|
312
|
+
* below, and it is the same for both. `sm` is narrower and quieter, never
|
|
313
|
+
* shorter. `density-and-touch` is unambiguous that compact must not become
|
|
314
|
+
* harder to hit.
|
|
315
|
+
*/
|
|
316
|
+
const SIZE = {
|
|
317
|
+
sm: "gap-opsin-1 px-opsin-3 py-opsin-1 text-opsin-subheadline-emphasis",
|
|
318
|
+
md: "gap-opsin-2 px-opsin-5 py-opsin-2 text-opsin-headline",
|
|
319
|
+
};
|
|
320
|
+
export function Button({ variant = "secondary", size = "md", children, icon, iconPosition = "leading", busy = false, busyLabel, fullWidth = false, className, style, ...rest }) {
|
|
321
|
+
/* An unlabelled button is the exact failure the missing `iconOnly` prop
|
|
322
|
+
exists to prevent, and it is invisible to the type system. */
|
|
323
|
+
if (isDevelopment() && hasNoLabel(children)) {
|
|
324
|
+
warnDev("no-label", "[opsinjs] <Button> was rendered with no label. The visible label is the " +
|
|
325
|
+
'accessible name; without it the control is announced as "button" and ' +
|
|
326
|
+
"nothing else, and it is unreachable by voice control. Note that a " +
|
|
327
|
+
"whitespace-only string and a falsy `&&` branch both count as no label. " +
|
|
328
|
+
"There is no icon-only Button. If the design calls for one, it needs " +
|
|
329
|
+
"its own name and its own target rules.");
|
|
330
|
+
}
|
|
331
|
+
/* Tabindex above zero is banned outright by `accessibility/keyboard-and-focus`:
|
|
332
|
+
it reorders the whole document rather than this control, and the damage
|
|
333
|
+
lands on a page nobody testing this button will have open. `ButtonProps`
|
|
334
|
+
extends ButtonHTMLAttributes, so `tabIndex` is part of the public surface
|
|
335
|
+
and reaches the DOM through the spread below. This file cannot make the
|
|
336
|
+
ban structural without narrowing the type and losing every legitimate
|
|
337
|
+
`tabIndex={-1}`. So it is reported, in the same channel as the other two. */
|
|
338
|
+
if (typeof rest.tabIndex === "number" && rest.tabIndex > 0) {
|
|
339
|
+
warnDev(`tab-index-${rest.tabIndex}`, `[opsinjs] <Button> was given tabIndex={${rest.tabIndex}}. A tabindex above ` +
|
|
340
|
+
"zero moves this control ahead of every element in the natural document " +
|
|
341
|
+
"order, across the whole page, and the resulting tab sequence is one " +
|
|
342
|
+
"nobody can predict from the markup. Use 0 to keep the natural order, or " +
|
|
343
|
+
"-1 to take the control out of the tab sequence, and reorder the DOM " +
|
|
344
|
+
"instead.");
|
|
345
|
+
}
|
|
346
|
+
/* The caller's own `disabled` and our `busy` are different states and the
|
|
347
|
+
first wins. A caller who asked for a genuinely unavailable control gets
|
|
348
|
+
native disabled semantics; `busy` on its own gets `aria-disabled` with the
|
|
349
|
+
element left in the tree. Asking for both at once is a contradiction. The
|
|
350
|
+
native attribute takes the button out of the tab order, so the `aria-busy`
|
|
351
|
+
nobody can reach is exposed to nobody. */
|
|
352
|
+
const nativeDisabled = rest.disabled === true;
|
|
353
|
+
if (busy && nativeDisabled) {
|
|
354
|
+
warnDev("busy-and-disabled", "[opsinjs] <Button> has both `busy` and `disabled`. `disabled` removes the " +
|
|
355
|
+
"control from the tab order and from the accessibility tree, so the busy " +
|
|
356
|
+
"state it is meant to carry reaches nobody. Use `busy` alone: it " +
|
|
357
|
+
"blocks activation and keeps the button reachable and named.");
|
|
358
|
+
}
|
|
359
|
+
/* The icon slot, rendered once and placed on whichever side was asked for.
|
|
360
|
+
Busy REPLACES the icon and never the label. The label is the reader's
|
|
361
|
+
record of what they pressed, and a control whose name disappears while it
|
|
362
|
+
works is a control that has lost their place. */
|
|
363
|
+
const hasBusyLabel = busy && typeof busyLabel === "string" && busyLabel.trim() !== "";
|
|
364
|
+
const slot = busy ? (_jsxs("span", { "data-slot": "button-busy", "aria-hidden": hasBusyLabel ? undefined : "true", className: "inline-flex shrink-0 items-center gap-opsin-1", children: [_jsx(LoaderCircle, { "aria-hidden": "true", className: "size-[1em] animate-spin motion-reduce:hidden" }), _jsx(Hourglass, { "aria-hidden": "true", className: "hidden size-[1em] motion-reduce:block" }), hasBusyLabel ? (_jsx("span", { "data-slot": "button-busy-label", children: busyLabel })) : null] })) : icon ? (_jsx("span", { "data-slot": "button-icon", "aria-hidden": "true", className: "inline-flex shrink-0 items-center [&_svg]:size-[1em]", children: icon })) : null;
|
|
365
|
+
return (_jsxs(BaseButton, { ...rest, "data-slot": "button",
|
|
366
|
+
/* The tag refusal, made structural. Both are Base UI props absent from
|
|
367
|
+
`ButtonProps`, so a TypeScript caller cannot reach them; pinning them
|
|
368
|
+
after the spread is what stops a JavaScript caller from turning this
|
|
369
|
+
into an anchor or into a non-native control with a synthetic role.
|
|
370
|
+
Anything that forwards a props object wholesale is stopped too. */
|
|
371
|
+
render: undefined, nativeButton: true,
|
|
372
|
+
/* `disabled` + `focusableWhenDisabled` is the whole mechanism behind
|
|
373
|
+
`busy`: Base UI sets `aria-disabled`, leaves the native attribute off,
|
|
374
|
+
keeps the tab stop and refuses activation. With a real `disabled` from
|
|
375
|
+
the caller, `focusableWhenDisabled` goes false and the native attribute
|
|
376
|
+
comes back, which is what that caller asked for. */
|
|
377
|
+
disabled: busy || nativeDisabled, focusableWhenDisabled: busy && !nativeDisabled, "aria-busy": busy || undefined, style: { borderStyle: "solid", borderWidth: EDGE[variant], ...style }, className: cn(
|
|
378
|
+
/* `relative` is load-bearing: the hit-area part below is positioned
|
|
379
|
+
against it. `whitespace-normal` and `items-center` rather than a
|
|
380
|
+
fixed height, because at 200% text the label has to wrap and the
|
|
381
|
+
button has to grow with it. A truncated label is unreadable and
|
|
382
|
+
unspeakable, and a fixed height is how it happens. */
|
|
383
|
+
"relative inline-flex items-center justify-center whitespace-normal rounded-full text-center align-middle",
|
|
384
|
+
/* The height floor is the target minimum, set here as well as in the
|
|
385
|
+
product stylesheet, because the label below trims its own line box
|
|
386
|
+
and a project without that stylesheet would otherwise see the button
|
|
387
|
+
shrink to its padding. 2.75rem grows with the reader's text size. */
|
|
388
|
+
"min-h-(--opsin-target-minimum,2.75rem)",
|
|
389
|
+
/* The second piece of motion in this file, and the one that needs no
|
|
390
|
+
branch: the press, which carries the hover and press fills with it
|
|
391
|
+
and is the only state signal here that does not depend on colour.
|
|
392
|
+
`PRESS` above sets out the timing and what a reader who asked for
|
|
393
|
+
reduced motion gets instead. */
|
|
394
|
+
PRESS,
|
|
395
|
+
/* Drawn outside the box with an offset, so it never changes layout.
|
|
396
|
+
It IS clipped by an ancestor that clips. An outline is painted by the
|
|
397
|
+
element and an `overflow: hidden` parent eats it, which is a property
|
|
398
|
+
of outlines and not a defect here; a surface that clips has to leave
|
|
399
|
+
room for it. Declared on the component as well as in the product theme
|
|
400
|
+
because a consumer installs this file without that stylesheet. The
|
|
401
|
+
width and the offset read the generated tokens with a 2px fallback
|
|
402
|
+
each, which is the same discipline `EDGE` uses above, so the ring
|
|
403
|
+
follows a consumer who raises `--opsin-border-focus` for a low-vision
|
|
404
|
+
theme and still draws in a project that installed this file without
|
|
405
|
+
the stylesheet. The `length:` hint inside the `outline-()` value is required:
|
|
406
|
+
without it a bare variable in an outline utility is read as an outline
|
|
407
|
+
colour and the ring silently loses its width. The colour stays a class,
|
|
408
|
+
`outline-ring`, and not a token, because `--ring` is a product surface
|
|
409
|
+
role and is not a generated token. */
|
|
410
|
+
"focus-visible:outline-(length:--opsin-border-focus,2px) focus-visible:outline-offset-(--opsin-border-focus-offset,2px) focus-visible:outline-ring",
|
|
411
|
+
/* THE TWO UNAVAILABLE STATES LOOK DIFFERENT BECAUSE THEY ARE DIFFERENT,
|
|
412
|
+
and the selectors land on exactly one each. Base UI sets the native
|
|
413
|
+
attribute when `focusableWhenDisabled` is off and `aria-disabled`
|
|
414
|
+
when it is on, so `:disabled` is the caller's own disabled and
|
|
415
|
+
`[aria-disabled]` is `busy`. There is no state where both match. That
|
|
416
|
+
partition holds for `:disabled` against `[aria-disabled]`, and it does
|
|
417
|
+
not hold for `:disabled` against `[aria-busy]`: a caller who
|
|
418
|
+
contradicts themselves by passing `busy` and `disabled` together gets
|
|
419
|
+
the native attribute set while `aria-busy` stays on. So the busy fill
|
|
420
|
+
in TONE is scoped `not-disabled:`, which is `:not(:disabled)`, and
|
|
421
|
+
native disabled therefore outranks the busy fill and keeps its measured
|
|
422
|
+
muted pair rather than rendering `--muted-foreground` ink on a press
|
|
423
|
+
fill at near 1:1.
|
|
424
|
+
|
|
425
|
+
Native disabled no longer dims the whole control, and dimming it was
|
|
426
|
+
the bug. A control faded until nobody can read it turns "you cannot do
|
|
427
|
+
this yet" into "you cannot find out what this is", and a group
|
|
428
|
+
`opacity` cannot honour that rule, because it composites the label and
|
|
429
|
+
the fill together over the page and lets both drift towards it: a
|
|
430
|
+
disabled primary's white label fell from 5.58:1 against its own fill to
|
|
431
|
+
2.60:1, and a disabled secondary's boundary to 1.18:1, well under the
|
|
432
|
+
floors the rest of this file clears. So the disabled state swaps in a
|
|
433
|
+
measured neutral pair instead, the `--muted` fill behind
|
|
434
|
+
`--muted-foreground` ink, which reaches 7.04:1 in light and 10.46:1 in
|
|
435
|
+
dark, both clear of the 4.5:1 body floor, inside a `--border` boundary
|
|
436
|
+
at 4.27:1 light and 3.27:1 dark, both clear of the 3:1 non-text floor.
|
|
437
|
+
That is the theme's own body-on-muted pairing, so the control reads as
|
|
438
|
+
unavailable without becoming unreadable, and it holds on every variant
|
|
439
|
+
because each `disabled:` class outranks the rung's own fill, ink and
|
|
440
|
+
boundary at the `:disabled` pseudo-class. Nothing in the corpus renders
|
|
441
|
+
a disabled Button, so this has source-and-token evidence and no
|
|
442
|
+
screenshot, and the page's own "Contrast, for every variant" bullet
|
|
443
|
+
still does not list the disabled state.
|
|
444
|
+
|
|
445
|
+
Busy does NOT take the muted pair, for the reason the fade argument
|
|
446
|
+
gives and a further one: the label is the reader's record of what they
|
|
447
|
+
pressed, so it has to stay at full contrast while the work happens, and
|
|
448
|
+
muting it would say the control is unavailable when the truer thing to
|
|
449
|
+
say is that it is working. So busy takes the press tone instead,
|
|
450
|
+
through the `not-disabled:aria-busy:` fill in TONE. That tone is one of the opaque
|
|
451
|
+
state roles, not an alpha wash, so the label's contrast is measured
|
|
452
|
+
rather than left to whatever sits behind it: `--primary-foreground`
|
|
453
|
+
reaches 7.88:1 on the light primary press fill and 10.47:1 on the dark
|
|
454
|
+
one, both clear of the 4.5:1 body floor. That is why busy also departs
|
|
455
|
+
from the report's `bg-primary/80`, which is an alpha fill that
|
|
456
|
+
composites with the page and drops the label to 3.78:1 on
|
|
457
|
+
`--background` and 3.75:1 on `--card`, below the floor. The busy glyph
|
|
458
|
+
is a second signal, not the only one.
|
|
459
|
+
|
|
460
|
+
They part ways on pointer events. The natively disabled control
|
|
461
|
+
drops them, because it is not a target and a tap on it should mean
|
|
462
|
+
nothing. The busy control keeps them. `pointer-events: none` would
|
|
463
|
+
forward an impatient second tap to whatever sits behind the button,
|
|
464
|
+
and on a card that is a link or a row that navigates that carries the
|
|
465
|
+
reader away in the middle of the save they are still waiting on. The
|
|
466
|
+
class also bought no correctness: Base UI's own `useButton` swallows
|
|
467
|
+
activation while `aria-disabled` is set, so the press was already
|
|
468
|
+
refused without it. What the busy control takes instead is
|
|
469
|
+
`cursor-progress`, so the pointer itself says wait, which
|
|
470
|
+
`pointer-events: none` would have hidden along with the hover it was
|
|
471
|
+
there to suppress. Keeping the events also restores `:active` on a
|
|
472
|
+
control that refuses activation, so `aria-disabled:active:scale-100`
|
|
473
|
+
cancels the sink: the impatient tap is swallowed here rather
|
|
474
|
+
than forwarded, and a control that answers no activation gives no press
|
|
475
|
+
movement either, because there is no press to acknowledge. The hover
|
|
476
|
+
fill is suppressed anyway, because the busy fill in TONE now carries a
|
|
477
|
+
`not-disabled:` guard as well, which lifts it above the plain `hover:`
|
|
478
|
+
fill on specificity, so it wins whether or not the pointer is over the
|
|
479
|
+
control. Neither state touches the tab order. Busy keeps its stop by construction, and a natively disabled
|
|
480
|
+
control loses it to the platform rather than to this rule. */
|
|
481
|
+
"disabled:bg-muted disabled:text-muted-foreground disabled:border-border disabled:pointer-events-none", "aria-disabled:cursor-progress aria-disabled:active:scale-100", TONE[variant], SIZE[size], fullWidth ? "w-full" : null, className), children: [_jsx("span", { "data-slot": "button-target", "aria-hidden": "true", className: "absolute top-1/2 left-1/2 size-full min-h-(--opsin-target-minimum,2.75rem) min-w-(--opsin-target-minimum,2.75rem) -translate-x-1/2 -translate-y-1/2" }), iconPosition === "leading" ? slot : null, _jsx("span", { "data-slot": "button-label", className: "[text-box:trim-both_ex_alphabetic]", children: children }), iconPosition === "trailing" ? slot : null] }));
|
|
482
|
+
}
|
|
483
|
+
/* The three fragments every card action is built from. `FLOOR` is the target
|
|
484
|
+
minimum in both axes, `BOX` is the flex box that carries it, and `RING` is
|
|
485
|
+
the focus outline. They are declared once so the arms below cannot drift in
|
|
486
|
+
the parts they share. Not exported: a caller composes an action through
|
|
487
|
+
`cardActionClassName`, not by reassembling the fragments. */
|
|
488
|
+
const CARD_ACTION_FLOOR = "min-h-(--opsin-target-minimum,2.75rem) min-w-(--opsin-target-minimum,2.75rem)";
|
|
489
|
+
const CARD_ACTION_BOX = `inline-flex ${CARD_ACTION_FLOOR} max-w-full items-center justify-center`;
|
|
490
|
+
const CARD_ACTION_RING = "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring";
|
|
491
|
+
/**
|
|
492
|
+
* The card action recipe: the class list for a single action rendered on a
|
|
493
|
+
* card, a banner or an empty state, spelled once so the surfaces that draw one
|
|
494
|
+
* cannot drift.
|
|
495
|
+
*
|
|
496
|
+
* WHY IT LIVES IN BUTTON.TSX. A card action is either an anchor or a Button,
|
|
497
|
+
* and the `as: "button"` arms return only the delta Button does not already
|
|
498
|
+
* bring, so the recipe and the control have to share a file to stay in step.
|
|
499
|
+
* The alternative homes are worse. A new file in
|
|
500
|
+
* `packages/react/src/components/` is read by
|
|
501
|
+
* `apps/www/scripts/build-registry.mts` as a component id, exported from the
|
|
502
|
+
* package entry point and published as its own `@opsinjs/react/<id>` subpath,
|
|
503
|
+
* which a module of class strings is not. `../opsinjs.ts` is published beside
|
|
504
|
+
* every component but holds runtime data and pure functions and no
|
|
505
|
+
* presentation, so a class recipe does not belong there either. `button.tsx` is
|
|
506
|
+
* already imported by all four action-bearing cards, so this export costs no
|
|
507
|
+
* new import, no new package subpath and no catalogue row.
|
|
508
|
+
*
|
|
509
|
+
* WHY THE EXPORT AT ALL. The substrate contract fixes a component file at two
|
|
510
|
+
* public exports, the props interface and the component, now that the zero-prop
|
|
511
|
+
* demo lives in `apps/www/registry/demos/`, and several component files state
|
|
512
|
+
* the rule. This is a departure, and what buys it is real: the `ACTION_LINK`
|
|
513
|
+
* constant was byte-identical in `alert-banner.tsx`, `result-card.tsx` and
|
|
514
|
+
* `empty-state.tsx`, `disclaimer-note.tsx` carried a fifth anchor, and
|
|
515
|
+
* `care-card.tsx` re-spelled Button's own fills by hand because Button's `TONE`
|
|
516
|
+
* is private. One recipe replaces all of them, so a change to how an action
|
|
517
|
+
* looks is made here and nowhere else.
|
|
518
|
+
*
|
|
519
|
+
* WHY IT CONCATENATES RATHER THAN MERGES. `cn` is `twMerge(clsx(...))` with
|
|
520
|
+
* tailwind-merge unconfigured, so a `text-*` colour class and a `text-opsin-*`
|
|
521
|
+
* type step land in one conflict group and one of them is deleted, which is the
|
|
522
|
+
* trap the `TONE` comment above spells out. The four original `ACTION_LINK`
|
|
523
|
+
* constants were template-joined for exactly this reason, and so is this. Every
|
|
524
|
+
* ink here is an arbitrary property for the same reason.
|
|
525
|
+
*
|
|
526
|
+
* WHICH INK EACH ARM CARRIES. The recommended neutral link is foreground ink in
|
|
527
|
+
* a bordered capsule, the same pair `Button`'s `secondary` rung draws, so the
|
|
528
|
+
* recommended action reads at one weight on both transports. The quiet neutral
|
|
529
|
+
* link is the accent ink, `[color:var(--brand-ink)]` (ADR 0029), at the
|
|
530
|
+
* subheadline step and weight 600, which is exactly what `Button`'s `quiet` rung
|
|
531
|
+
* at `sm` draws, so its handler twin needs no delta at all. A tinted arm asserts
|
|
532
|
+
* no ink and no fill: on a status tint the ink is the level's own `-ink` role,
|
|
533
|
+
* which the caller's surface supplies, and an accent there would put a chrome
|
|
534
|
+
* colour on a status surface nothing has measured. A tinted caller supplies that
|
|
535
|
+
* ink above a single class, which `alert-banner.tsx`'s `[&_button]:` selector
|
|
536
|
+
* does. Nothing here names a status colour, so the two colour axes never meet on
|
|
537
|
+
* one class list.
|
|
538
|
+
*
|
|
539
|
+
* NO ARM IS UNDERLINED. An underline is how a link inside running text says it
|
|
540
|
+
* is a link, and `Link`'s `inline` emphasis keeps it for exactly that. A card
|
|
541
|
+
* action is never in running text: it stands in a row of actions, and each arm
|
|
542
|
+
* already says it is a control by its shape or its colour. The recommended arms
|
|
543
|
+
* have a capsule boundary, the quiet neutral arm has the accent ink, and the
|
|
544
|
+
* quiet tinted arm, which can carry neither an accent nor a fill on a status
|
|
545
|
+
* tint, draws a hairline capsule in the surrounding ink instead.
|
|
546
|
+
*
|
|
547
|
+
* WHY THE WEIGHT UNION HAS NO BRAND OPTION. The `weight` union is
|
|
548
|
+
* `"recommended" | "quiet"` and carries no brand-filled arm, because a card's
|
|
549
|
+
* primary action is neutral and bordered rather than brand-filled. The argument
|
|
550
|
+
* is already written in the tree in two places, and both are load-bearing.
|
|
551
|
+
* `alert-banner.tsx:545-558` refuses a brand fill on a status surface, because
|
|
552
|
+
* `Button variant="primary"` would need a measured contrast pair on each of the
|
|
553
|
+
* four tints in two themes, which is eight measurements for one control that
|
|
554
|
+
* nobody has taken, so the link branch was given a neutral opaque fill instead.
|
|
555
|
+
* `result-card.tsx:155-160` refuses a fill for a different reason: `bg-primary`
|
|
556
|
+
* sits on the card's own ground, so the fill that is meant to mark the action
|
|
557
|
+
* out is the card's ground and marks nothing. A brand-for-everything rule would
|
|
558
|
+
* have to exempt AlertBanner, and a rule with an exemption that large is not a
|
|
559
|
+
* rule, so the recipe makes a brand card action unreachable at the type level.
|
|
560
|
+
*
|
|
561
|
+
* `ButtonVariant` is untouched, and this restriction is not a deprecation of
|
|
562
|
+
* Button `primary`. `primary` is still available for a form submit inside a
|
|
563
|
+
* Dialog or a Sheet, where the ground is neutral and the control is the only
|
|
564
|
+
* action on the surface. The restriction on a brand fill is on the card action,
|
|
565
|
+
* not on Button.
|
|
566
|
+
*/
|
|
567
|
+
export function cardActionClassName(options) {
|
|
568
|
+
const { weight, ground = "neutral", as } = options;
|
|
569
|
+
if (as === "button") {
|
|
570
|
+
/* The caller renders a real <Button>, whose TONE and SIZE supply the box,
|
|
571
|
+
the fill, the ink, the type step and a hairline boundary as an inline
|
|
572
|
+
width. Only the delta is returned here. The tinted quiet arm turns the
|
|
573
|
+
quiet rung's transparent hairline to the surrounding ink, so the action
|
|
574
|
+
reads as a control on a status tint. The tinted recommended arm needs
|
|
575
|
+
nothing from here: its caller passes the level's line colour beside this
|
|
576
|
+
return, which colours the same hairline. The two neutral arms need
|
|
577
|
+
nothing either, because the `secondary` and `quiet` rungs already are what
|
|
578
|
+
the link arms below draw. */
|
|
579
|
+
if (weight === "recommended")
|
|
580
|
+
return "";
|
|
581
|
+
return ground === "tinted" ? "border-current" : "";
|
|
582
|
+
}
|
|
583
|
+
/* as === "link". The anchor brings nothing of its own, so the recipe returns
|
|
584
|
+
the whole class list: the box, the type step, the ink and the ring, plus a
|
|
585
|
+
fill and a boundary on the neutral recommended arm, and a boundary on both
|
|
586
|
+
tinted arms. Every arm sinks on `PRESS`, the same press the handler twin
|
|
587
|
+
gets from Button's root, so the two transports still answer a tap alike. */
|
|
588
|
+
if (weight === "recommended") {
|
|
589
|
+
return ground === "tinted"
|
|
590
|
+
? `${CARD_ACTION_BOX} rounded-full border-2 px-opsin-5 py-opsin-2 ` +
|
|
591
|
+
"text-center text-opsin-headline " +
|
|
592
|
+
`${PRESS} ` +
|
|
593
|
+
`hover:bg-muted ${CARD_ACTION_RING}`
|
|
594
|
+
: `${CARD_ACTION_BOX} rounded-full border border-border bg-card px-opsin-5 py-opsin-2 ` +
|
|
595
|
+
"text-center text-opsin-headline [color:var(--foreground)] " +
|
|
596
|
+
`${PRESS} ` +
|
|
597
|
+
`hover:bg-state-hover ${CARD_ACTION_RING}`;
|
|
598
|
+
}
|
|
599
|
+
return ground === "tinted"
|
|
600
|
+
? `${CARD_ACTION_BOX} rounded-full border border-current px-opsin-4 py-opsin-1 ` +
|
|
601
|
+
"text-center text-opsin-subheadline-emphasis " +
|
|
602
|
+
`${PRESS} ` +
|
|
603
|
+
`hover:bg-muted ${CARD_ACTION_RING}`
|
|
604
|
+
: `${CARD_ACTION_BOX} rounded-full px-opsin-2 py-opsin-1 ` +
|
|
605
|
+
"text-center text-opsin-subheadline-emphasis [color:var(--brand-ink)] " +
|
|
606
|
+
`${PRESS} ` +
|
|
607
|
+
`hover:bg-state-hover ${CARD_ACTION_RING}`;
|
|
608
|
+
}
|
|
609
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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