@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,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DisclaimerNote is the standing note about what a product is and is not,
|
|
3
|
+
* placed by rule so it is always in the same place and never in the way.
|
|
4
|
+
*
|
|
5
|
+
* THERE IS NO DISCLAIMER TEXT IN THIS FILE AND THERE NEVER WILL BE. Not a
|
|
6
|
+
* default, not a placeholder, not a vetted variant, not an i18n key with a
|
|
7
|
+
* fallback, not an emergency number, not a jurisdiction, not a product name.
|
|
8
|
+
* A disclaimer is a legal and clinical statement with somebody's name behind
|
|
9
|
+
* it, and a design system has neither a legal owner nor a reader. A sentence
|
|
10
|
+
* shipped from here would arrive in a product whose author never read it,
|
|
11
|
+
* describing limits that product may not have and omitting ones it does. It
|
|
12
|
+
* would arrive looking reviewed, because it came from a library.
|
|
13
|
+
*
|
|
14
|
+
* SO THE MISSING CASE SAYS SO. A note with no words supplied renders one
|
|
15
|
+
* unlovely line admitting that none were, which is the same refusal
|
|
16
|
+
* `empty-state` makes and for the same reason: the alternative is a friendly
|
|
17
|
+
* sentence about somebody's health data that nobody signed off. An author who
|
|
18
|
+
* sees the line fixes it, and a reader who sees it has at least not been told
|
|
19
|
+
* something untrue by a library that does not know them.
|
|
20
|
+
*
|
|
21
|
+
* IT IS NOT AN ALERT, AND THE API IS WHAT KEEPS IT FROM BECOMING ONE. Styling
|
|
22
|
+
* a disclaimer as a warning is the most common mistake with this component, so
|
|
23
|
+
* there is no `status` prop, no `severity` prop, no `variant` prop, no fill, no
|
|
24
|
+
* role, no live region, and the glyph is the component's rather than the
|
|
25
|
+
* caller's. A standing note tinted from the status axis is a permanent false
|
|
26
|
+
* alarm: it says *watch* on every screen, from the first launch to the last,
|
|
27
|
+
* about nothing in particular. A reader learns within a week to see past
|
|
28
|
+
* it, taking the real alerts with it. The two `data-*` attributes that carry
|
|
29
|
+
* colour meaning, `data-status` and `data-category`, appear nowhere below.
|
|
30
|
+
*
|
|
31
|
+
* NEITHER AXIS, WHICH IS THE ONE PLACE THE TWO-AXIS RULE IS ANSWERED BY
|
|
32
|
+
* ABSENCE. Category colour would make a statement about the product look like a
|
|
33
|
+
* statement about a topic; status colour would make it look like a level. The
|
|
34
|
+
* note is typographic, and its whole treatment is a hairline above it and the
|
|
35
|
+
* space it stands in.
|
|
36
|
+
*
|
|
37
|
+
* PLACEMENT IS SPACE AND NOTHING ELSE. `inline` and `footer` differ by how much
|
|
38
|
+
* room is above the hairline. That is deliberately unimpressive: every part
|
|
39
|
+
* that could be added here is a part that could be used to make the note
|
|
40
|
+
* louder, and a component whose two placements looked different would invite a
|
|
41
|
+
* third that looked louder still.
|
|
42
|
+
*
|
|
43
|
+
* IT IS A SERVER COMPONENT. No state, no hook, no timer, no event handler, no
|
|
44
|
+
* Base UI primitive. There is no dismiss control. Whether the note may be
|
|
45
|
+
* dismissed, whether it returns, and whether the product records that it was
|
|
46
|
+
* seen are open questions on the specification page, and each of them needs a
|
|
47
|
+
* memory that outlives a render.
|
|
48
|
+
*/
|
|
49
|
+
import { type ReactNode } from "react";
|
|
50
|
+
export interface DisclaimerNoteProps {
|
|
51
|
+
/**
|
|
52
|
+
* The product's own words. One or two sentences: what this product does, then
|
|
53
|
+
* what it does not do. It renders a paragraph, so it takes text or inline
|
|
54
|
+
* content rather than a block element.
|
|
55
|
+
*
|
|
56
|
+
* There is no default text and there will not be one. Legal copy shipped from
|
|
57
|
+
* a design system puts words into products whose authors never read them, and
|
|
58
|
+
* it arrives looking reviewed because it came from a library. Supply none and
|
|
59
|
+
* the note says on screen that none was supplied, rather than inventing a
|
|
60
|
+
* sentence. `false` from a `&&` branch, `0` from the same branch on an empty
|
|
61
|
+
* collection, an empty array and a whitespace-only string all count as
|
|
62
|
+
* supplying none. The boundary is words: a caller who wraps the copy in an
|
|
63
|
+
* element is taken at their word, so an empty string inside a `<strong>` is
|
|
64
|
+
* the one route to a silently empty note that stays open.
|
|
65
|
+
*
|
|
66
|
+
* TYPED OPTIONAL AND REQUIRED BY THE CONTRACT, which is the same shape
|
|
67
|
+
* `EmptyState.children` has. Marking it required buys nothing, because
|
|
68
|
+
* `{copy.text}` with an undefined `copy.text` type-checks either way. It
|
|
69
|
+
* costs the ability to render the state at all, which is the state that most
|
|
70
|
+
* needs seeing.
|
|
71
|
+
*/
|
|
72
|
+
children?: ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Where it sits. `inline` goes under the content it qualifies; `footer` goes
|
|
75
|
+
* once at the end of a surface. There is no `banner` value and there is no
|
|
76
|
+
* `top` value: a reader who came to see a number sees the number first.
|
|
77
|
+
*
|
|
78
|
+
* The two differ by the space above the note and by nothing else. Neither
|
|
79
|
+
* changes the type size, the ink or the boundary.
|
|
80
|
+
*
|
|
81
|
+
* @default "inline"
|
|
82
|
+
*/
|
|
83
|
+
placement?: "inline" | "footer";
|
|
84
|
+
/**
|
|
85
|
+
* The fuller statement, for readers who want it.
|
|
86
|
+
*
|
|
87
|
+
* BOTH HALVES TOGETHER, and that is why this is one object rather than a bare
|
|
88
|
+
* href. A destination with no label would need a label written here, and the
|
|
89
|
+
* label this system would have to invent is the exact one the specification
|
|
90
|
+
* refuses: *learn more* names nothing, and a screen reader's list of links is
|
|
91
|
+
* where that costs somebody the page they were looking for. The product names
|
|
92
|
+
* its own destination in its own words, in its reader's language.
|
|
93
|
+
*/
|
|
94
|
+
more?: {
|
|
95
|
+
label: string;
|
|
96
|
+
href: string;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* The id of this note's wording, so a product can record which version a
|
|
100
|
+
* reader was shown. Legal text changes, and a record should say which one
|
|
101
|
+
* applied.
|
|
102
|
+
*
|
|
103
|
+
* It renders as visible text, exactly as it is written here. An attribute
|
|
104
|
+
* would be tidier and would be a record only the product that already had the
|
|
105
|
+
* value could read: it survives no screenshot, no printout and no support
|
|
106
|
+
* ticket, and the data-attribute vocabulary is closed at four in any case. So
|
|
107
|
+
* write something a reader could quote back in a support conversation rather
|
|
108
|
+
* than an internal identifier, and write it in their language: no word is
|
|
109
|
+
* added around it, because any word added here would be English.
|
|
110
|
+
*
|
|
111
|
+
* It renders one step down in the secondary ink, at the footnote size, so a
|
|
112
|
+
* reader can tell it apart from the statement rather than parse it as a third
|
|
113
|
+
* sentence about their health. It is still rendered exactly as written, with
|
|
114
|
+
* no word added around it.
|
|
115
|
+
*/
|
|
116
|
+
textVersion?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Whether to show the informational glyph. The glyph itself is not
|
|
119
|
+
* configurable, and that is the point: an icon prop taking a `ReactNode`
|
|
120
|
+
* would accept a warning triangle, and a triangle sets the register before a
|
|
121
|
+
* word of the note is read. It is decorative, hidden from assistive
|
|
122
|
+
* technology, and sized in `em` so it grows with the text.
|
|
123
|
+
*
|
|
124
|
+
* The default is off. The quietest form of this component is the one to
|
|
125
|
+
* prefer, and a glyph is the first step towards a note that competes with the
|
|
126
|
+
* reading above it.
|
|
127
|
+
*
|
|
128
|
+
* @default false
|
|
129
|
+
*/
|
|
130
|
+
icon?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Merged onto the root. Width, margin and place in a layout belong here: they
|
|
133
|
+
* are decisions of the surface the note is standing on rather than of the
|
|
134
|
+
* note.
|
|
135
|
+
*
|
|
136
|
+
* It is also the one hole in this component's refusal to carry a colour, and
|
|
137
|
+
* the component says so rather than pretending otherwise: a utility from
|
|
138
|
+
* either axis passed through here reaches the root, and in development it
|
|
139
|
+
* raises a warning naming what to use instead.
|
|
140
|
+
*/
|
|
141
|
+
className?: string;
|
|
142
|
+
}
|
|
143
|
+
export declare function DisclaimerNote({ children, placement, more, textVersion, icon, className, }: DisclaimerNoteProps): import("react").JSX.Element;
|
|
144
|
+
//# sourceMappingURL=disclaimer-note.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disclaimer-note.d.ts","sourceRoot":"","sources":["../../src/components/disclaimer-note.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAGH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAsOhD,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC/B;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;IACtC;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAyFD,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,SAAoB,EACpB,IAAI,EACJ,WAAW,EACX,IAAY,EACZ,SAAS,GACV,EAAE,mBAAmB,+BAyNrB"}
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* DisclaimerNote is the standing note about what a product is and is not,
|
|
4
|
+
* placed by rule so it is always in the same place and never in the way.
|
|
5
|
+
*
|
|
6
|
+
* THERE IS NO DISCLAIMER TEXT IN THIS FILE AND THERE NEVER WILL BE. Not a
|
|
7
|
+
* default, not a placeholder, not a vetted variant, not an i18n key with a
|
|
8
|
+
* fallback, not an emergency number, not a jurisdiction, not a product name.
|
|
9
|
+
* A disclaimer is a legal and clinical statement with somebody's name behind
|
|
10
|
+
* it, and a design system has neither a legal owner nor a reader. A sentence
|
|
11
|
+
* shipped from here would arrive in a product whose author never read it,
|
|
12
|
+
* describing limits that product may not have and omitting ones it does. It
|
|
13
|
+
* would arrive looking reviewed, because it came from a library.
|
|
14
|
+
*
|
|
15
|
+
* SO THE MISSING CASE SAYS SO. A note with no words supplied renders one
|
|
16
|
+
* unlovely line admitting that none were, which is the same refusal
|
|
17
|
+
* `empty-state` makes and for the same reason: the alternative is a friendly
|
|
18
|
+
* sentence about somebody's health data that nobody signed off. An author who
|
|
19
|
+
* sees the line fixes it, and a reader who sees it has at least not been told
|
|
20
|
+
* something untrue by a library that does not know them.
|
|
21
|
+
*
|
|
22
|
+
* IT IS NOT AN ALERT, AND THE API IS WHAT KEEPS IT FROM BECOMING ONE. Styling
|
|
23
|
+
* a disclaimer as a warning is the most common mistake with this component, so
|
|
24
|
+
* there is no `status` prop, no `severity` prop, no `variant` prop, no fill, no
|
|
25
|
+
* role, no live region, and the glyph is the component's rather than the
|
|
26
|
+
* caller's. A standing note tinted from the status axis is a permanent false
|
|
27
|
+
* alarm: it says *watch* on every screen, from the first launch to the last,
|
|
28
|
+
* about nothing in particular. A reader learns within a week to see past
|
|
29
|
+
* it, taking the real alerts with it. The two `data-*` attributes that carry
|
|
30
|
+
* colour meaning, `data-status` and `data-category`, appear nowhere below.
|
|
31
|
+
*
|
|
32
|
+
* NEITHER AXIS, WHICH IS THE ONE PLACE THE TWO-AXIS RULE IS ANSWERED BY
|
|
33
|
+
* ABSENCE. Category colour would make a statement about the product look like a
|
|
34
|
+
* statement about a topic; status colour would make it look like a level. The
|
|
35
|
+
* note is typographic, and its whole treatment is a hairline above it and the
|
|
36
|
+
* space it stands in.
|
|
37
|
+
*
|
|
38
|
+
* PLACEMENT IS SPACE AND NOTHING ELSE. `inline` and `footer` differ by how much
|
|
39
|
+
* room is above the hairline. That is deliberately unimpressive: every part
|
|
40
|
+
* that could be added here is a part that could be used to make the note
|
|
41
|
+
* louder, and a component whose two placements looked different would invite a
|
|
42
|
+
* third that looked louder still.
|
|
43
|
+
*
|
|
44
|
+
* IT IS A SERVER COMPONENT. No state, no hook, no timer, no event handler, no
|
|
45
|
+
* Base UI primitive. There is no dismiss control. Whether the note may be
|
|
46
|
+
* dismissed, whether it returns, and whether the product records that it was
|
|
47
|
+
* seen are open questions on the specification page, and each of them needs a
|
|
48
|
+
* memory that outlives a render.
|
|
49
|
+
*/
|
|
50
|
+
import { Info } from "lucide-react";
|
|
51
|
+
import { Children } from "react";
|
|
52
|
+
import { isDevelopment } from "../opsinjs.js";
|
|
53
|
+
import { cn, trimTrailing } from "../utils.js";
|
|
54
|
+
import { Link } from "./link.js";
|
|
55
|
+
/**
|
|
56
|
+
* Development warnings, said once per distinct offender.
|
|
57
|
+
*
|
|
58
|
+
* Nothing this file complains about has an `OpsinErrorCode`. The codes in
|
|
59
|
+
* `tokens/errors.json` describe mistakes a consumer makes with the CLINICAL
|
|
60
|
+
* API, they are a versioned contract, and the table on the errors page is
|
|
61
|
+
* generated from that file. So a component may not mint one. What `warnOnce`
|
|
62
|
+
* is right about is the discipline rather than the registry: a warning printed
|
|
63
|
+
* on every render, and twice per render under Strict Mode, becomes noise, and a
|
|
64
|
+
* noisy channel is one somebody switches off. So this keeps its own small set,
|
|
65
|
+
* keyed on the complaint plus whatever names the offender.
|
|
66
|
+
*
|
|
67
|
+
* `empty-state.tsx` carries the same twelve lines for the same reason. Two
|
|
68
|
+
* copies is one too many and the repair belongs in `../opsinjs.ts`, which is
|
|
69
|
+
* not this component's file to edit; it is reported rather than duplicated
|
|
70
|
+
* quietly.
|
|
71
|
+
*/
|
|
72
|
+
const warned = new Set();
|
|
73
|
+
function warnDev(key, message) {
|
|
74
|
+
if (!isDevelopment() || warned.has(key))
|
|
75
|
+
return;
|
|
76
|
+
warned.add(key);
|
|
77
|
+
console.warn(message);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Whether any words actually arrived.
|
|
81
|
+
*
|
|
82
|
+
* TypeScript cannot answer this. Testing the three sentinels `""`, `null` and
|
|
83
|
+
* `undefined` misses how legal copy actually goes missing, which is
|
|
84
|
+
* `{consent.text}` resolving to `undefined` from a content service, a
|
|
85
|
+
* translation table returning a whitespace-only string for a locale nobody
|
|
86
|
+
* filled in, or `{isReviewed && "…"}` evaluating to `false` on the day the
|
|
87
|
+
* review lapsed. `Children.toArray` drops `null`, `undefined`, booleans and
|
|
88
|
+
* empty arrays; a string of spaces is what it keeps and what must still be
|
|
89
|
+
* refused. So is a bare number, which is the case below.
|
|
90
|
+
*
|
|
91
|
+
* An element is not text and is not resolvable from here, so a body containing
|
|
92
|
+
* one is taken at its word. That is the right way round: this function decides
|
|
93
|
+
* when to print *nothing was supplied*, and printing it over a caller's
|
|
94
|
+
* `<strong>` would be a false accusation on somebody's screen. It is also the
|
|
95
|
+
* one route to a silently empty note that stays open, and the specification
|
|
96
|
+
* page says so rather than promising a guarantee this function does not make.
|
|
97
|
+
*/
|
|
98
|
+
function hasSuppliedText(children) {
|
|
99
|
+
const parts = Children.toArray(children);
|
|
100
|
+
if (parts.length === 0)
|
|
101
|
+
return false;
|
|
102
|
+
if (!parts.every((part) => typeof part === "string" || typeof part === "number")) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
const text = parts.map((part) => String(part)).join("").trim();
|
|
106
|
+
return text !== "" && !isBareNumber(text);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Whether the whole body is a number rather than words.
|
|
110
|
+
*
|
|
111
|
+
* `{wording.sentences.length && wording.text}` on an empty collection passes
|
|
112
|
+
* `0`, and React renders the digit. So a note's entire standing statement
|
|
113
|
+
* about what the product is becomes the character `0`, no development warning
|
|
114
|
+
* fires, and the absence this component exists to make visible is rendered as a
|
|
115
|
+
* measurement of nothing. It is the numeric sibling of the `false` case the
|
|
116
|
+
* `children` documentation already names, and it arrives by the same idiom.
|
|
117
|
+
* `NaN` reaches here by the same route from a count that did not parse: it is a
|
|
118
|
+
* number, `Children.toArray` keeps it, and React renders the three letters.
|
|
119
|
+
*
|
|
120
|
+
* `empty-state` refuses a bare-number body in exactly this shape, and cites
|
|
121
|
+
* [numbers-units-precision] rule 13 and safety checklist A4 for it: zero, none
|
|
122
|
+
* and unknown are three different things, and an absence never renders as a
|
|
123
|
+
* digit. A body that is only a number is a caller mistake at every value and
|
|
124
|
+
* not only at zero, because it states nothing about the product's limits. So
|
|
125
|
+
* it is refused rather than printed, and the missing-words line takes its place
|
|
126
|
+
* along with the development warning that names how to fix it.
|
|
127
|
+
*/
|
|
128
|
+
function isBareNumber(text) {
|
|
129
|
+
return text === "NaN" || /^-?\d+(?:[.,]\d+)?$/.test(text);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Link labels that name no destination.
|
|
133
|
+
*
|
|
134
|
+
* Every one of these is a label a reader hears out of context, and none of
|
|
135
|
+
* them says where it goes. A screen reader's list of links is exactly that
|
|
136
|
+
* context. The specification asks for *read our full statement* rather than
|
|
137
|
+
* *learn more*, and this is that requirement made checkable. It warns and
|
|
138
|
+
* renders: the destination is right even when the label is lazy, and removing
|
|
139
|
+
* somebody's link over its wording would be the larger mistake.
|
|
140
|
+
*
|
|
141
|
+
* Compared case-insensitively against the trimmed label with trailing
|
|
142
|
+
* punctuation removed, so "Learn more…" and "LEARN MORE" are caught too.
|
|
143
|
+
*/
|
|
144
|
+
const UNHELPFUL_LABELS = [
|
|
145
|
+
"learn more",
|
|
146
|
+
"read more",
|
|
147
|
+
"find out more",
|
|
148
|
+
"more",
|
|
149
|
+
"more information",
|
|
150
|
+
"click here",
|
|
151
|
+
"here",
|
|
152
|
+
"details",
|
|
153
|
+
"this link",
|
|
154
|
+
];
|
|
155
|
+
/**
|
|
156
|
+
* The axis names, and the pattern that finds one in a class list.
|
|
157
|
+
*
|
|
158
|
+
* Built from two pieces on purpose. `scripts/check-a11y.mts` reads this file as
|
|
159
|
+
* text and treats any file that spells a complete axis utility as a status
|
|
160
|
+
* surface owing a word, a glyph and a `data-status`; a detector written the
|
|
161
|
+
* obvious way would report itself and there would be no repair short of
|
|
162
|
+
* deleting the check. Split like this, the file contains the axis names and the
|
|
163
|
+
* axis prefixes and never the two joined, which is the thing the gate looks
|
|
164
|
+
* for. The pattern still matches every joined form at runtime.
|
|
165
|
+
*
|
|
166
|
+
* `callout.tsx` carries the identical construction, and for the identical
|
|
167
|
+
* reason: both components sit outside both axes, and `className` is the one
|
|
168
|
+
* hole in that refusal.
|
|
169
|
+
*/
|
|
170
|
+
const AXIS_NAMES = "steady|watch|attention|urgent|unknown|sleep|heart|activity|nutrition|mind|labs";
|
|
171
|
+
const AXIS_TINT = new RegExp(`(?:^|[\\s:-])(?:status|category)-(?:${AXIS_NAMES})(?![a-z])`);
|
|
172
|
+
/**
|
|
173
|
+
* The two placements, written out rather than assembled.
|
|
174
|
+
*
|
|
175
|
+
* Tailwind reads class names out of source as literal strings, so
|
|
176
|
+
* `pt-opsin-${placement === "footer" ? 6 : 3}` would generate no CSS at all and
|
|
177
|
+
* the note would render with no space above it. Written out, once.
|
|
178
|
+
*
|
|
179
|
+
* The hairline is common to both because the note has to be findable in the
|
|
180
|
+
* same place every time, and an edge is what makes it findable at a glance.
|
|
181
|
+
* What differs is the room above it: `inline` sits close under the content it
|
|
182
|
+
* qualifies, because it is about that content's surface; `footer` ends a
|
|
183
|
+
* surface and is given the air that says so. Both steps are from the FIXED
|
|
184
|
+
* scale rather than the density-scaled one. The separation between the note
|
|
185
|
+
* and the reading above it is the placement rule made visible, and it should
|
|
186
|
+
* not close up because somebody asked for a denser list.
|
|
187
|
+
*/
|
|
188
|
+
const PLACEMENT = {
|
|
189
|
+
inline: "pt-opsin-3",
|
|
190
|
+
footer: "pt-opsin-6",
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Two layouts, and the column the content sits in under each.
|
|
194
|
+
*
|
|
195
|
+
* A grid rather than a flex row with a wrapper around the text, because the
|
|
196
|
+
* anatomy has Icon, Text, Link and Version as siblings under the root, and a
|
|
197
|
+
* wrapper would be an element the part tree does not name. With no icon the
|
|
198
|
+
* grid is a single column, rather than a two-column grid whose empty first
|
|
199
|
+
* track still contributes its gap and shifts every line of the note to the
|
|
200
|
+
* right by a space step nothing occupies.
|
|
201
|
+
*/
|
|
202
|
+
const LAYOUT = {
|
|
203
|
+
withIcon: "grid grid-cols-[auto_1fr] gap-x-opsin-2",
|
|
204
|
+
withoutIcon: "grid grid-cols-1",
|
|
205
|
+
};
|
|
206
|
+
const CONTENT_COLUMN = {
|
|
207
|
+
withIcon: "col-start-2",
|
|
208
|
+
withoutIcon: "col-start-1",
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* The grid-item floor for the link to the fuller statement.
|
|
212
|
+
*
|
|
213
|
+
* THE LINK TREATMENT ITSELF NOW LIVES IN `Link`, NOT HERE. The underline, the
|
|
214
|
+
* `0.25em` offset, the one-pixel press, the focus ring and `wrap-anywhere` were
|
|
215
|
+
* this file's own class string once, one of the five private anchors the roster
|
|
216
|
+
* finding names. `Link` is now the single place the underline, the `0.25em`
|
|
217
|
+
* offset, the press and the focus ring are decided, so this note and any future
|
|
218
|
+
* inline link cannot drift apart again. The offset stays `0.25em` rather than
|
|
219
|
+
* the `underline-offset-4` step, and the focus ring travels with the link
|
|
220
|
+
* rather than the theme, both for reasons `link.tsx` now carries. Two choices
|
|
221
|
+
* are this control's own rather than the theme's. The press is a transform and
|
|
222
|
+
* not one of the D6 `--state-*` fills, because a fill is wrong on a text link.
|
|
223
|
+
* Hover adds nothing, because the underline is already the rest state and there
|
|
224
|
+
* is no quieter state for hover to lift from; disabled, selected and loading do
|
|
225
|
+
* not apply, because a note's link is never turned off, chosen or pending. What
|
|
226
|
+
* is left in this file is the part that was never about the link and always
|
|
227
|
+
* about the note: where the anchor sits in the note's grid, and how large a
|
|
228
|
+
* target it must be there.
|
|
229
|
+
*
|
|
230
|
+
* IT IS A REAL ANCHOR AND IT IS NOT A BUTTON. A control that produces a new URL
|
|
231
|
+
* is a link however it is styled, and rebuilding it as a button loses the new
|
|
232
|
+
* tab, the copied address and the screen reader's list of links. `Link` refuses
|
|
233
|
+
* to be a button for that reason, which is why the note reaches for `Link`
|
|
234
|
+
* rather than for `Button`.
|
|
235
|
+
*
|
|
236
|
+
* THE FLOOR STAYS HERE BECAUSE `emphasis="inline"` DROPS IT. `Link`'s inline
|
|
237
|
+
* form is a link inside a sentence, and SC 2.5.8 exempts an inline target, so
|
|
238
|
+
* it carries no floor: a 2.75rem minimum would inflate the line box of any
|
|
239
|
+
* paragraph the link sat in. This anchor is not inside a sentence. It is a grid
|
|
240
|
+
* item of its own, the standing "read the full statement" control a reader
|
|
241
|
+
* taps, so it keeps the floor the inline form sheds. The floor is
|
|
242
|
+
* `--opsin-target-minimum` in rem rather than 44px, so it grows when a reader
|
|
243
|
+
* raises their text size instead of pinning while the label doubles. THE
|
|
244
|
+
* FALLBACK INSIDE THE `var()` IS LOAD-BEARING: written without one,
|
|
245
|
+
* `min-h-(--opsin-target-minimum)` compiles to a bare reference, and in a
|
|
246
|
+
* project that has not imported `@opsinjs/tokens/tokens.css` that declaration
|
|
247
|
+
* is invalid at computed-value time. `min-height` reverts to `auto` and the
|
|
248
|
+
* floor vanishes with no error anywhere. Both axes, because SC 2.5.8 is a 44x44
|
|
249
|
+
* region and not a 44-tall strip, and a short label in a language with shorter
|
|
250
|
+
* words would otherwise sit under the floor on the inline axis.
|
|
251
|
+
*
|
|
252
|
+
* `justify-self-start` is what stops the anchor stretching to the width of its
|
|
253
|
+
* grid track. Without it the whole line is clickable, and a reader who taps the
|
|
254
|
+
* empty space beside a short label is navigated somewhere they did not aim at.
|
|
255
|
+
*
|
|
256
|
+
* `inline-flex` is what `Link`'s `wrap-anywhere` needs to bite. The anchor is a
|
|
257
|
+
* grid item, so `inline-flex` blockifies to `flex` and the label becomes an
|
|
258
|
+
* anonymous flex item; `overflow-wrap: break-word` does not reduce a box's
|
|
259
|
+
* min-content size, so only `wrap-anywhere`, which `Link` carries, keeps a long
|
|
260
|
+
* compound label reflowing with the note rather than widening the document at
|
|
261
|
+
* 200% text on a narrow viewport.
|
|
262
|
+
*/
|
|
263
|
+
const LINK_FLOOR = "inline-flex min-h-(--opsin-target-minimum,2.75rem) " +
|
|
264
|
+
"min-w-(--opsin-target-minimum,2.75rem) max-w-full items-center " +
|
|
265
|
+
"justify-self-start";
|
|
266
|
+
/**
|
|
267
|
+
* The escape hatch, reported rather than closed.
|
|
268
|
+
*
|
|
269
|
+
* Not an OPSIN code, for the reason given on `warnDev` above. That is also
|
|
270
|
+
* why it goes THROUGH `warnDev` rather than round it. This runs in a render
|
|
271
|
+
* body, so a bare `console.warn` here would print on every render and twice
|
|
272
|
+
* again under Strict Mode, and a disclaimer sits at the foot of a surface that
|
|
273
|
+
* re-renders whenever anything above it changes. The key is the offending class
|
|
274
|
+
* list, because two different tinted notes are two different mistakes in two
|
|
275
|
+
* different places. `callout.tsx` guards its own copy of this warning the same
|
|
276
|
+
* way.
|
|
277
|
+
*
|
|
278
|
+
* It warns and renders: the class list is the caller's and the words are the
|
|
279
|
+
* product's, and taking a legal statement off a screen over a styling mistake
|
|
280
|
+
* would be the larger error.
|
|
281
|
+
*/
|
|
282
|
+
function warnIfTintedFromAnAxis(className) {
|
|
283
|
+
/* `isDevelopment()` first, and again inside `warnDev`. The second check is the
|
|
284
|
+
one that gates the print; this one keeps the regular expression off the
|
|
285
|
+
production render path, where it would run against every note's class list
|
|
286
|
+
to reach a branch that can never be taken. */
|
|
287
|
+
if (!isDevelopment() || className === undefined)
|
|
288
|
+
return;
|
|
289
|
+
if (!AXIS_TINT.test(className))
|
|
290
|
+
return;
|
|
291
|
+
warnDev(`axis-tint:${className}`, `[opsinjs] <DisclaimerNote className="${className}"> takes a colour from one ` +
|
|
292
|
+
"of the two axes. This component sits outside both, and that is the whole " +
|
|
293
|
+
"of it: a standing note tinted from the status ramps says the same level on " +
|
|
294
|
+
"every screen about nothing in particular, which is a permanent false alarm " +
|
|
295
|
+
"and teaches a reader to see past the ramp that the real alerts use. A " +
|
|
296
|
+
"category tint makes a statement about the product read as a statement " +
|
|
297
|
+
"about a topic. If the message is about this reader's own data and carries " +
|
|
298
|
+
"a level, the component is <AlertBanner>. See " +
|
|
299
|
+
"/docs/health/two-colour-axes.");
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* One link, as a control or as nothing.
|
|
303
|
+
*
|
|
304
|
+
* Returning `null` rather than rendering something is the point. A link with no
|
|
305
|
+
* name is unreachable by voice and announced as "link"; a link with no
|
|
306
|
+
* destination is a promise the note cannot keep.
|
|
307
|
+
*/
|
|
308
|
+
function statementLink(more, column) {
|
|
309
|
+
const label = typeof more.label === "string" ? more.label.trim() : "";
|
|
310
|
+
const href = typeof more.href === "string" ? more.href.trim() : "";
|
|
311
|
+
if (label === "" || href === "") {
|
|
312
|
+
warnDev(`link-incomplete:${label}|${href}`, "[opsinjs] <DisclaimerNote> was given `more` without both a label and an " +
|
|
313
|
+
"href, so nothing was rendered for it. The two travel together on " +
|
|
314
|
+
"purpose: a destination with no label would need one invented here, and " +
|
|
315
|
+
"the label a design system would invent names nowhere.");
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
const plain = trimTrailing(label.toLowerCase(), ".…!?:>»");
|
|
319
|
+
if (UNHELPFUL_LABELS.includes(plain)) {
|
|
320
|
+
warnDev(`link-unhelpful:${plain}`, `[opsinjs] <DisclaimerNote> has a link labelled "${label}", which names no ` +
|
|
321
|
+
"destination. A screen reader can list every link on a page with no " +
|
|
322
|
+
"sentence around them, and this is the one link on the surface that says " +
|
|
323
|
+
"where the product's full statement lives. Name it in the reader's own " +
|
|
324
|
+
"language, with a label like \"read the full statement\" or \"how this " +
|
|
325
|
+
"app uses your readings\". It was rendered as written.");
|
|
326
|
+
}
|
|
327
|
+
return (_jsx(Link, { href: href, emphasis: "inline", "data-slot": "disclaimer-note-link", className: cn(column, LINK_FLOOR), children: label }));
|
|
328
|
+
}
|
|
329
|
+
export function DisclaimerNote({ children, placement = "inline", more, textVersion, icon = false, className, }) {
|
|
330
|
+
warnIfTintedFromAnAxis(className);
|
|
331
|
+
/* THE ONE PLACE THIS COMPONENT REFUSES TO BE HELPFUL, and the reason it
|
|
332
|
+
exists in a design system rather than in each product's own codebase. Every
|
|
333
|
+
other absence in this file is a part that leaves the DOM; this one prints,
|
|
334
|
+
because a note that quietly rendered empty would pass review, pass every
|
|
335
|
+
gate here, and ship a surface whose standing statement about what the
|
|
336
|
+
product is had silently gone missing. */
|
|
337
|
+
const supplied = hasSuppliedText(children);
|
|
338
|
+
if (!supplied) {
|
|
339
|
+
warnDev(`text-missing:${placement}`, `[opsinjs] <DisclaimerNote placement="${placement}"> was rendered with no ` +
|
|
340
|
+
"words, so it says on screen that none were supplied. opsinjs ships no " +
|
|
341
|
+
"disclaimer text: no default, no placeholder and no vetted variant. " +
|
|
342
|
+
"That is because the words are a legal and clinical statement with an " +
|
|
343
|
+
"owner, and a design system is not it. Write the product's own two " +
|
|
344
|
+
"sentences: what " +
|
|
345
|
+
"it does, then what it does not do. `false` or `0` from a `&&` branch, " +
|
|
346
|
+
"an empty array and a whitespace-only string all count as writing none.");
|
|
347
|
+
}
|
|
348
|
+
const key = icon ? "withIcon" : "withoutIcon";
|
|
349
|
+
const column = CONTENT_COLUMN[key];
|
|
350
|
+
const link = more ? statementLink(more, column) : null;
|
|
351
|
+
const version = typeof textVersion === "string" ? textVersion.trim() : "";
|
|
352
|
+
return (
|
|
353
|
+
/* NO ROLE, AND THE COST OF THAT IS REAL RATHER THAN NIL.
|
|
354
|
+
"Ordinary text in the reading order" is a plain element: nothing is
|
|
355
|
+
announced over what the reader is doing, nothing is announced twice, and
|
|
356
|
+
the note is read when it is reached, which is after the thing the reader
|
|
357
|
+
came for. `role="alert"` is what this component exists not to be, and
|
|
358
|
+
`aria-live` in any form would make a standing sentence speak on every
|
|
359
|
+
render that mounted it.
|
|
360
|
+
|
|
361
|
+
What a plain element also costs is a boundary, so a screen-reader user
|
|
362
|
+
meets the note as two loose sentences rather than as a thing. There is no
|
|
363
|
+
start, no end and no accessible name. `role="note"`, or `<aside>` with a
|
|
364
|
+
name, would supply one, and both were left out on the same grounds
|
|
365
|
+
`callout.tsx` gives: nobody has listened to this component in a screen
|
|
366
|
+
reader, and `<aside>` in particular publishes a `complementary` landmark
|
|
367
|
+
that would appear in the landmark list of every screen in a product. A
|
|
368
|
+
landmark per screen for a sentence that never changes is its own kind of
|
|
369
|
+
noise. It is an open question on the specification page rather than a
|
|
370
|
+
settled decision. */
|
|
371
|
+
_jsxs("div", { "data-slot": "disclaimer-note", className: cn(
|
|
372
|
+
/* BODY SIZE AND BODY INK FOR THE STATEMENT AND THE LINK, AND NEITHER IS
|
|
373
|
+
NEGOTIABLE. Legal text set one step down in pale grey complies with
|
|
374
|
+
the letter of a requirement and none of its purpose, and it is the
|
|
375
|
+
single most common way this component is got wrong. So the statement
|
|
376
|
+
and the link are body size in body ink, and both are set here on the
|
|
377
|
+
root so that both inherit them.
|
|
378
|
+
|
|
379
|
+
The version marker is the one exception, and it is not the same thing.
|
|
380
|
+
It is an identifier beside the statement rather than a part of it, and
|
|
381
|
+
a reader who parses it as a third sentence about their own health is
|
|
382
|
+
the failure this exception prevents. It takes the footnote step in the
|
|
383
|
+
secondary ink that `Card.Description` already uses for exactly this
|
|
384
|
+
role, set on its own span rather than here. That ink is
|
|
385
|
+
`--muted-foreground`, a chrome role the theme layer owns, and both
|
|
386
|
+
themes clear the 4.5:1 body floor at the 0.8125rem footnote size on
|
|
387
|
+
the page and on a card. The four measured pairs are not typed here,
|
|
388
|
+
because a token move would silently falsify them: the theme
|
|
389
|
+
layer owns the colour, and the page's `<ContrastReport
|
|
390
|
+
component="disclaimer-note">` is where the measured pairs are
|
|
391
|
+
published instead. The next editor's instinct will be to write that
|
|
392
|
+
ink as
|
|
393
|
+
`text-muted-foreground`; do not, for the tailwind-merge reason set out
|
|
394
|
+
below, which silently drops the footnote size. The escape is the same:
|
|
395
|
+
`[color:var(--muted-foreground)]` is an arbitrary property in its own
|
|
396
|
+
conflict group and keeps both the size and the ink.
|
|
397
|
+
|
|
398
|
+
THE COLOUR IS AN ARBITRARY PROPERTY AND THAT IS NOT A STYLE CHOICE.
|
|
399
|
+
`cn` is `twMerge(clsx(…))`, tailwind-merge is unconfigured, and it has
|
|
400
|
+
never been told that `--text-opsin-*` is a font-size namespace. So it
|
|
401
|
+
files `text-opsin-body` and `text-foreground` in one conflict group
|
|
402
|
+
and silently drops whichever comes first. Verified: `twMerge(
|
|
403
|
+
"text-opsin-body text-foreground")` returns `"text-foreground"`, and
|
|
404
|
+
reversing the order returns `"text-opsin-body"`. There is no ordering
|
|
405
|
+
that keeps both, and the failure is silent. The note renders in
|
|
406
|
+
whatever size it inherits, which on a card footer is the size legal
|
|
407
|
+
text is not allowed to be. `field.tsx` hit the same trap and answered
|
|
408
|
+
it by dropping the colour and inheriting one; that is the wrong answer
|
|
409
|
+
HERE, because inheriting the colour is precisely how a note ends up
|
|
410
|
+
pale grey inside a muted footer. `[color:var(--foreground)]` is a
|
|
411
|
+
different conflict group, resolves the same custom property the
|
|
412
|
+
`text-foreground` utility resolves, and keeps both. A Tailwind editor
|
|
413
|
+
plugin will offer to rewrite it as `text-foreground`; do not accept
|
|
414
|
+
that, because it is the one change that silently returns this line to
|
|
415
|
+
the wrong size and no gate in this repository would report it.
|
|
416
|
+
|
|
417
|
+
No fill and no radius. The boundary is a hairline above, which is the
|
|
418
|
+
whole treatment. It is also what makes print work with nothing
|
|
419
|
+
extra: a browser drops background colours on paper unless the reader
|
|
420
|
+
has gone looking for the setting that keeps them, and a component
|
|
421
|
+
with no fill has nothing to lose. Nothing here is `print:hidden`.
|
|
422
|
+
|
|
423
|
+
Under `prefers-contrast: more` the treatment does not change its
|
|
424
|
+
kind, only its weight: the same top hairline is drawn at
|
|
425
|
+
`--opsin-border-emphasis`, which is 2px. The comma fallback is
|
|
426
|
+
load-bearing for the reason the two `var()` fallbacks above
|
|
427
|
+
already give. A consumer whose app has not imported
|
|
428
|
+
`@opsinjs/tokens/tokens.css` gets a bare
|
|
429
|
+
`var(--opsin-border-emphasis)`, the `border-top-width` declaration
|
|
430
|
+
is then invalid at computed-value time, and the rule is dropped
|
|
431
|
+
with no error anywhere. This is a WIDTH change and not a colour change. A wider
|
|
432
|
+
line at the same colour is easier to find, but it does not move
|
|
433
|
+
the measured contrast ratio. That ratio is a property of the
|
|
434
|
+
`--border` colour, which the theme layer owns and this file does
|
|
435
|
+
not, so the measured hairline pairs are not typed here, because a token
|
|
436
|
+
move would silently falsify them: the page's `<ContrastReport
|
|
437
|
+
component="disclaimer-note">` is where they are published
|
|
438
|
+
instead. This line answers the width and leaves the colour to the
|
|
439
|
+
layer that owns it.
|
|
440
|
+
|
|
441
|
+
`wrap-break-word` with `min-w-0` on the content cells is the reflow
|
|
442
|
+
repair. `1fr` is `minmax(auto, 1fr)`, so the text track's floor is the
|
|
443
|
+
longest unbreakable token in `children`; at 200% text on a phone one
|
|
444
|
+
long word or a bare URL would widen the grid past the viewport, which
|
|
445
|
+
is horizontal scroll on the document and an SC 1.4.10 failure. The
|
|
446
|
+
link needs `wrap-anywhere` instead, which `Link` carries and
|
|
447
|
+
`LINK_FLOOR` explains: its label is an anonymous flex item that
|
|
448
|
+
neither of those two reaches. */
|
|
449
|
+
"gap-y-opsin-2 border-t border-border text-opsin-body [color:var(--foreground)] contrast-more:[border-top-width:var(--opsin-border-emphasis,2px)]", LAYOUT[key], PLACEMENT[placement], className), children: [icon ? (
|
|
450
|
+
/* Decorative, and hidden because it is a duplicate rather than because
|
|
451
|
+
it is unimportant: it is a scanning aid that lets a reader who has
|
|
452
|
+
read the note once find it again without reading it again.
|
|
453
|
+
|
|
454
|
+
THE GLYPH IS NOT A PROP, and that is the accessibility requirement
|
|
455
|
+
enforced rather than documented. "If an icon is present it is never a
|
|
456
|
+
warning triangle" cannot be met by a component that accepts an
|
|
457
|
+
arbitrary node, because the shape sets the register before a word is
|
|
458
|
+
read and nothing in a `ReactNode` type says which shape arrived.
|
|
459
|
+
`Info` is the one glyph in this system that means "this is
|
|
460
|
+
information about what you are reading" and carries no level; it is
|
|
461
|
+
deliberately the same glyph `Callout` uses for a note, because the
|
|
462
|
+
two say the same thing about themselves and a distinct silhouette
|
|
463
|
+
here would only be a claim to more attention. The status axis carries
|
|
464
|
+
`Circle`, `CircleDot`, `Diamond` and `Octagon`, an abstract ordinal
|
|
465
|
+
set whose implied weight rises with the level, and `Minus` for an
|
|
466
|
+
absence; none of them is this note's glyph, because a note carries no
|
|
467
|
+
level. The never-a-warning-triangle rule above does not rest on that
|
|
468
|
+
roster: a triangle raises an alarm register the moment its shape is
|
|
469
|
+
read, and this component raises no alarm, so a triangle would be wrong
|
|
470
|
+
here even if it belonged to no set at all. */
|
|
471
|
+
_jsx(Info, { "data-slot": "disclaimer-note-icon", "aria-hidden": "true", className: "col-start-1 row-start-1 mt-[0.2em] size-[1em] shrink-0" })) : null, _jsx("p", { "data-slot": "disclaimer-note-text", className: cn(column,
|
|
472
|
+
/* The measure is capped because this is prose rather than a label,
|
|
473
|
+
and a line of legal text run to the full width of a desktop card
|
|
474
|
+
loses the reader's return sweep on the one paragraph they are least
|
|
475
|
+
motivated to finish. The `66ch` inside the `var()` is the cap's
|
|
476
|
+
only guarantee outside this repository: `--opsin-measure-comfortable`
|
|
477
|
+
is declared in `@opsinjs/tokens/tokens.css`, which reaches a page
|
|
478
|
+
only when the app imports it, and a bare reference to an
|
|
479
|
+
undeclared property is invalid at computed-value time.
|
|
480
|
+
`max-width` would revert to `none` and the cap would be gone with
|
|
481
|
+
no error anywhere. */
|
|
482
|
+
"m-0 min-w-0 max-w-(--opsin-measure-comfortable,66ch) wrap-break-word"), children: supplied
|
|
483
|
+
? children
|
|
484
|
+
: "This app has not added its notice about what it can and cannot do." }), link, version === "" ? null : (_jsx("span", { "data-slot": "disclaimer-note-version", className: cn(column, "min-w-0 text-opsin-footnote wrap-break-word [color:var(--muted-foreground)]"), children: version }))] }));
|
|
485
|
+
}
|
|
486
|
+
//# sourceMappingURL=disclaimer-note.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disclaimer-note.js","sourceRoot":"","sources":["../../src/components/disclaimer-note.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAA;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAY,CAAA;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA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