@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,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { isDevelopment } from "../opsinjs.js";
|
|
4
|
+
import { Surface } from "./surface.js";
|
|
5
|
+
/**
|
|
6
|
+
* The nav row. A flex row that spreads the destinations, with the safe-area
|
|
7
|
+
* inset added to a base bottom padding so the bar clears the home indicator
|
|
8
|
+
* on a notched phone and still keeps a base gap where the inset is zero.
|
|
9
|
+
*
|
|
10
|
+
* The list inside it wraps. Each destination is `flex-1 basis-0`, so while
|
|
11
|
+
* they fit they share the row in equal widths, and the row breaks only when a
|
|
12
|
+
* destination would shrink below its own label or the 44pt target floor. At
|
|
13
|
+
* 200% text on a 390px phone four destinations need about 480px, so the bar
|
|
14
|
+
* takes a second row rather than scrolling the page sideways (issue #16).
|
|
15
|
+
*/
|
|
16
|
+
const NAV = "flex items-stretch justify-around gap-opsin-1 px-opsin-2 pt-opsin-1 " +
|
|
17
|
+
"[padding-bottom:calc(env(safe-area-inset-bottom,0px)+0.25rem)]";
|
|
18
|
+
/**
|
|
19
|
+
* One destination. Icon over label, centred, floored at the 44pt target on
|
|
20
|
+
* both axes in rem so it grows with the reader's text size. The ink is the
|
|
21
|
+
* muted role at rest and lifts to the foreground role when the item is
|
|
22
|
+
* current, written as the arbitrary colour property so tailwind-merge does
|
|
23
|
+
* not drop it against a type step further down. The current state is carried
|
|
24
|
+
* by `aria-current="page"`, which every treatment below keys off. The focus
|
|
25
|
+
* ring is carried here rather than left to the product stylesheet.
|
|
26
|
+
*/
|
|
27
|
+
const ITEM = "group relative flex flex-1 basis-0 select-none flex-col items-center justify-center gap-opsin-0-5 " +
|
|
28
|
+
"rounded-opsin-md px-opsin-1 py-opsin-1 text-center no-underline " +
|
|
29
|
+
"min-h-(--opsin-target-minimum,2.75rem) min-w-(--opsin-target-minimum,2.75rem) cursor-pointer " +
|
|
30
|
+
"[color:var(--muted-foreground)] aria-[current=page]:[color:var(--foreground)] " +
|
|
31
|
+
"transition-colors duration-(--opsin-duration-fast) ease-opsin-standard " +
|
|
32
|
+
"hover:bg-state-hover " +
|
|
33
|
+
"focus-visible:outline-[length:var(--opsin-border-focus,2px)] focus-visible:outline-offset-[var(--opsin-border-focus-offset,2px)] focus-visible:outline-ring";
|
|
34
|
+
/**
|
|
35
|
+
* The current-destination indicator. A capsule behind the current item's icon,
|
|
36
|
+
* a wash of the foreground ink so it is neutral chrome and not a category or
|
|
37
|
+
* status tint, and a shape rather than a hairline, so it still reads in
|
|
38
|
+
* greyscale and at a glance (ADR 0028). It is rendered before the icon, so the
|
|
39
|
+
* icon paints over it. It fades in only when the item is current, driven by
|
|
40
|
+
* the `aria-current` state on the group, so the same markup serves every item
|
|
41
|
+
* and no layout shifts. It is decorative and `aria-hidden`, and it deliberately
|
|
42
|
+
* has no `data-slot`, because the closed set is `tab-bar`, `tab-bar-item`,
|
|
43
|
+
* `tab-bar-item-icon` and `tab-bar-item-label`, and this capsule does not mint
|
|
44
|
+
* a fifth.
|
|
45
|
+
*/
|
|
46
|
+
const INDICATOR = "pointer-events-none absolute top-0 left-1/2 h-opsin-8 w-[min(4rem,100%)] -translate-x-1/2 rounded-full " +
|
|
47
|
+
"bg-[color-mix(in_oklab,var(--foreground)_10%,transparent)] " +
|
|
48
|
+
"opacity-0 transition-opacity duration-(--opsin-duration-fast) ease-opsin-standard " +
|
|
49
|
+
"group-aria-[current=page]:opacity-100";
|
|
50
|
+
/** The icon wrapper. Fixed box so the row stays even whatever glyph is passed; the svg inside is sized here. */
|
|
51
|
+
const ICON = "flex size-opsin-6 items-center justify-center [&_svg]:size-opsin-6";
|
|
52
|
+
/** The label. Caption step, and heavier when the item is current so weight is one of the three carriers of the current state. Colour is inherited from the item, so no colour class here. */
|
|
53
|
+
const LABEL = "text-opsin-caption1 group-aria-[current=page]:font-semibold";
|
|
54
|
+
/**
|
|
55
|
+
* Development warnings, said once per distinct offender. Nothing here has an
|
|
56
|
+
* `OpsinErrorCode`: the codes in `tokens/errors.json` describe a mistake a
|
|
57
|
+
* consumer makes with the clinical API, and a tab bar asserts nothing
|
|
58
|
+
* clinical. `segmented-control.tsx` keeps the same small set for the same
|
|
59
|
+
* reason, and the repair, a real code in `../opsinjs.ts`, is not this
|
|
60
|
+
* file's to make.
|
|
61
|
+
*/
|
|
62
|
+
const warned = new Set();
|
|
63
|
+
function warnDev(key, message) {
|
|
64
|
+
if (!isDevelopment() || warned.has(key))
|
|
65
|
+
return;
|
|
66
|
+
warned.add(key);
|
|
67
|
+
console.warn(message);
|
|
68
|
+
}
|
|
69
|
+
export function TabBar({ items, value, onValueChange, label, className }) {
|
|
70
|
+
if (isDevelopment()) {
|
|
71
|
+
if (typeof label !== "string" || label.trim() === "") {
|
|
72
|
+
warnDev("no-label", "[opsinjs] <TabBar> was rendered with no `label`. The bar is a nav " +
|
|
73
|
+
"landmark and needs an accessible name: without one a screen-reader " +
|
|
74
|
+
"user hears an unnamed landmark among several. Pass `label` naming " +
|
|
75
|
+
'what the bar moves between, such as "Main sections".');
|
|
76
|
+
}
|
|
77
|
+
if (!Array.isArray(items) || items.length === 0) {
|
|
78
|
+
warnDev("no-items", "[opsinjs] <TabBar> was rendered with no `items`, so it has nothing to " +
|
|
79
|
+
"draw. Supply two to five destinations through the `items` prop.");
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
if (items.length === 1) {
|
|
83
|
+
warnDev("too-few-items", "[opsinjs] <TabBar> was given a single item, which is not navigation. " +
|
|
84
|
+
"Add the other destinations, or drop the bar and render the one " +
|
|
85
|
+
"screen directly.");
|
|
86
|
+
}
|
|
87
|
+
else if (items.length > 5) {
|
|
88
|
+
warnDev("too-many-items", "[opsinjs] <TabBar> was given more than five items, so the bar no " +
|
|
89
|
+
"longer reads as one glanceable set. Reduce the destinations rather " +
|
|
90
|
+
"than reaching for an overflow, and never hide a safety relevant " +
|
|
91
|
+
"action behind one.");
|
|
92
|
+
}
|
|
93
|
+
const seen = new Set();
|
|
94
|
+
for (const item of items) {
|
|
95
|
+
if (seen.has(item.key)) {
|
|
96
|
+
warnDev(`duplicate-key:${item.key}`, `[opsinjs] <TabBar> has two items with the key "${item.key}", which ` +
|
|
97
|
+
"breaks both the React list and the value match. Give each " +
|
|
98
|
+
"destination a unique key.");
|
|
99
|
+
}
|
|
100
|
+
seen.add(item.key);
|
|
101
|
+
}
|
|
102
|
+
if (!items.some((item) => item.key === value)) {
|
|
103
|
+
warnDev(`value-not-in-items:${String(value)}`, `[opsinjs] <TabBar value="${String(value)}"> does not match any ` +
|
|
104
|
+
"item's key, so the bar renders with nothing current. This is a " +
|
|
105
|
+
"controlled component: pass a `value` equal to one item's `key`.");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (!Array.isArray(items) || items.length === 0) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
return (_jsx(Surface, { rung: "overlay", className: className, children: _jsx("nav", { "data-slot": "tab-bar", "aria-label": label, className: NAV, children: _jsx("ul", { role: "list", className: "m-0 flex w-full list-none flex-wrap items-stretch gap-opsin-1 p-0", children: items.map((item) => {
|
|
113
|
+
const current = item.key === value;
|
|
114
|
+
const inner = (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: INDICATOR }), _jsx("span", { "data-slot": "tab-bar-item-icon", "aria-hidden": "true", className: ICON, children: item.icon }), _jsx("span", { "data-slot": "tab-bar-item-label", className: LABEL, children: item.label })] }));
|
|
115
|
+
return (_jsx("li", { className: "flex flex-1 basis-0", children: item.href === undefined ? (_jsx("button", { type: "button", "data-slot": "tab-bar-item", "aria-current": current ? "page" : undefined, onClick: () => onValueChange?.(item.key), className: ITEM, children: inner })) : (_jsx("a", { href: item.href, "data-slot": "tab-bar-item", "aria-current": current ? "page" : undefined, onClick: () => onValueChange?.(item.key), className: ITEM, children: inner })) }, item.key));
|
|
116
|
+
}) }) }) }));
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=tab-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tab-bar.js","sourceRoot":"","sources":["../../src/components/tab-bar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAuDZ,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAe,CAAA;AAoBvC;;;;;;;;;;GAUG;AACH,MAAM,GAAG,GACP,sEAAsE;IACtE,gEAAgE,CAAA;AAElE;;;;;;;;GAQG;AACH,MAAM,IAAI,GACR,oGAAoG;IACpG,kEAAk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AC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;oBAClB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,KAAK,KAAK,CAAA;oBAClC,MAAM,KAAK,GAAG,CACZ,8BACE,8BAAkB,MAAM,EAAC,SAAS,EAAE,SAAS,GAAI,EACjD,4BAAgB,mBAAmB,iBAAa,MAAM,EAAC,SAAS,EAAE,IAAI,YACnE,IAAI,CAAC,IAAI,GACL,EACP,4BAAgB,oBAAoB,EAAC,SAAS,EAAE,KAAK,YAClD,IAAI,CAAC,KAAK,GACN,IACN,CACJ,CAAA;oBACD,OAAO,CACL,aAAmB,SAAS,EAAC,qBAAqB,YAC/C,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CACzB,iBACE,IAAI,EAAC,QAAQ,eACH,cAAc,kBACV,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC1C,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EACxC,SAAS,EAAE,IAAI,YAEd,KAAK,GACC,CACV,CAAC,CAAC,CAAC,CACF,YACE,IAAI,EAAE,IAAI,CAAC,IAAI,eACL,cAAc,kBACV,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAC1C,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EACxC,SAAS,EAAE,IAAI,YAEd,KAAK,GACJ,CACL,IArBM,IAAI,CAAC,GAAG,CAsBZ,CACN,CAAA;gBACH,CAAC,CAAC,GACC,GACD,GACE,CACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Table is rows and columns of data in a real semantic table, and the readable
|
|
3
|
+
* twin every chart in the system ships beside it.
|
|
4
|
+
*
|
|
5
|
+
* WHAT IT REFUSES TO BE, AND WHY. It refuses to be a data grid. There is no
|
|
6
|
+
* sorting, no row selection, no virtualisation and no per-row menu. A chart
|
|
7
|
+
* needs a twin a screen reader and a keyboard user can read, and that twin is a
|
|
8
|
+
* small, honest table. The moment a table grows a sort control it grows a
|
|
9
|
+
* comparator, a stable-sort guarantee and an announcement of the new order, and
|
|
10
|
+
* it stops being the thing a chart can lean on. Those belong to a product's own
|
|
11
|
+
* grid, built on Base UI, not to this component.
|
|
12
|
+
*
|
|
13
|
+
* IT OWNS THE ACCESSIBILITY INVARIANTS THAT A CALLER MUST NOT BE ABLE TO
|
|
14
|
+
* ASSEMBLE WRONG. This is why the API is data driven and not compound. A
|
|
15
|
+
* caption is required and always rendered. The header cells always carry
|
|
16
|
+
* scope="col", the first body cell carries scope="row" when it is a row
|
|
17
|
+
* header, and the table always sits inside one scroll container. Compound
|
|
18
|
+
* parts would let a caller ship a table with no caption, or two thead
|
|
19
|
+
* elements, or a header cell with no scope, and pass every gate in this
|
|
20
|
+
* repository. So the parts are identified by data-slot for styling and none of
|
|
21
|
+
* them is an export. This is the opposite call to card.tsx, which is compound
|
|
22
|
+
* because a card is a free layout surface with no invariant to protect; a
|
|
23
|
+
* table has several.
|
|
24
|
+
*
|
|
25
|
+
* THE SIDEWAYS SCROLL IS THE COMPONENT'S JOB, NOT THE PAGE'S. The table lives
|
|
26
|
+
* inside an overflow-x-auto container so a table wider than the screen scrolls
|
|
27
|
+
* inside its own box and never pushes the page body sideways. The container is
|
|
28
|
+
* focusable, because a horizontally scrollable region a keyboard reader cannot
|
|
29
|
+
* reach is a region they cannot read. Whether it should also be a named
|
|
30
|
+
* landmark is left open on the page rather than guessed at here.
|
|
31
|
+
*
|
|
32
|
+
* IT CARRIES NEITHER COLOUR AXIS. There is no status prop and no category
|
|
33
|
+
* prop, the elements carry no data-status and no data-category, and there is
|
|
34
|
+
* no fill of any kind. A table is neutral chrome: the reader's own text
|
|
35
|
+
* colour, a hairline between rows, and muted ink on the headers so they read
|
|
36
|
+
* as labels rather than as data. Selection and hover fills are absent because
|
|
37
|
+
* there is no selection and nothing to hover, which is the same reason a
|
|
38
|
+
* neutral surface never borrows a category or status tint.
|
|
39
|
+
*
|
|
40
|
+
* IT DOES NOT OWN THE NUMBERS. A cell is a ReactNode. A numeric column
|
|
41
|
+
* right-aligns its cells and renders them in tabular figures so a column of
|
|
42
|
+
* numbers lines up on its digits, and it stamps data-opsinjs-value on those
|
|
43
|
+
* cells purely as the tabular-figures hook. The empty string is deliberate:
|
|
44
|
+
* Table never holds a magnitude, so it has none to publish, and the real
|
|
45
|
+
* datum, when there is one, lives in the Value a caller nests in the cell.
|
|
46
|
+
*
|
|
47
|
+
* IT IS A SERVER COMPONENT. No hook, no timer, no handler. The focusable
|
|
48
|
+
* container is tabIndex={0}, a static attribute, so nothing here forces a
|
|
49
|
+
* client boundary.
|
|
50
|
+
*/
|
|
51
|
+
import type { ReactNode } from "react";
|
|
52
|
+
/**
|
|
53
|
+
* One column. Local on purpose: a consumer names it as
|
|
54
|
+
* TableProps["columns"][number] rather than importing it, which keeps the
|
|
55
|
+
* file at exactly three exports.
|
|
56
|
+
*/
|
|
57
|
+
interface TableColumn {
|
|
58
|
+
/** Looks up the cell in each row. Distinct across the column list. */
|
|
59
|
+
key: string;
|
|
60
|
+
/** The column's header content, rendered as a th with scope="col". */
|
|
61
|
+
header: ReactNode;
|
|
62
|
+
/** Explicit alignment. Falls back to end when numeric is set, start otherwise. */
|
|
63
|
+
align?: "start" | "center" | "end";
|
|
64
|
+
/** Right-aligns the column, sets tabular figures and stamps the tabular-figures hook. */
|
|
65
|
+
numeric?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface TableProps {
|
|
68
|
+
/**
|
|
69
|
+
* The caption naming what the table holds. Required, and required for
|
|
70
|
+
* accessibility rather than for looks: a screen reader user who lands on a
|
|
71
|
+
* grid of numbers with no caption has no idea what they count. It renders as
|
|
72
|
+
* a real caption element, and captionHidden can take it off the screen but
|
|
73
|
+
* never out of the markup. A string, so it can serve as the visible or the
|
|
74
|
+
* visually hidden caption text without a second prop.
|
|
75
|
+
*/
|
|
76
|
+
caption: string;
|
|
77
|
+
/**
|
|
78
|
+
* Take the caption off the screen while leaving it in the accessibility
|
|
79
|
+
* tree, for the twin that sits under a heading already naming the data. It
|
|
80
|
+
* uses the sr-only pattern, so the caption is still present and still read.
|
|
81
|
+
* Default false: a table on its own keeps its caption visible.
|
|
82
|
+
*/
|
|
83
|
+
captionHidden?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The columns, left to right. Each has a stable key, a header node, an
|
|
86
|
+
* optional alignment and an optional numeric flag. A numeric column
|
|
87
|
+
* right-aligns and renders tabular figures. An empty array renders nothing
|
|
88
|
+
* and warns, because a table with no columns is a caller mistake rather than
|
|
89
|
+
* an empty result.
|
|
90
|
+
*/
|
|
91
|
+
columns: TableColumn[];
|
|
92
|
+
/**
|
|
93
|
+
* The rows, each a record keyed by column key to the node for that cell. A
|
|
94
|
+
* key with no value renders an empty cell rather than warning, because
|
|
95
|
+
* sparse rows are legitimate. Zero rows renders the header over an empty
|
|
96
|
+
* body; for a genuinely empty result reach for EmptyState instead, which
|
|
97
|
+
* says so in words.
|
|
98
|
+
*/
|
|
99
|
+
rows: Array<Record<string, ReactNode>>;
|
|
100
|
+
/**
|
|
101
|
+
* Treat the first column as each row's header cell, a th scope="row", so a
|
|
102
|
+
* screen reader names every row by its first cell. Default true, because in
|
|
103
|
+
* a chart twin the first column is the period or the category that
|
|
104
|
+
* identifies the row. Pass false when the first column is data rather than a
|
|
105
|
+
* label, and every cell becomes a plain td.
|
|
106
|
+
*/
|
|
107
|
+
rowHeader?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Merged onto the scroll container with tailwind-merge, and a class you pass
|
|
110
|
+
* wins where the two conflict. This is where a max width or a top and bottom
|
|
111
|
+
* border goes.
|
|
112
|
+
*/
|
|
113
|
+
className?: string;
|
|
114
|
+
}
|
|
115
|
+
export declare function Table({ caption, captionHidden, columns, rows, rowHeader, className, }: TableProps): import("react").JSX.Element | null;
|
|
116
|
+
export {};
|
|
117
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/components/table.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAKtC;;;;GAIG;AACH,UAAU,WAAW;IACnB,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAA;IACX,sEAAsE;IACtE,MAAM,EAAE,SAAS,CAAA;IACjB,kFAAkF;IAClF,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,yFAAyF;IACzF,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAyBD,MAAM,WAAW,UAAU;IACzB;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;;OAMG;IACH,OAAO,EAAE,WAAW,EAAE,CAAA;IACtB;;;;;;OAMG;IACH,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAA;IACtC;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,KAAK,CAAC,EACpB,OAAO,EACP,aAAqB,EACrB,OAAO,EACP,IAAI,EACJ,SAAgB,EAChB,SAAS,GACV,EAAE,UAAU,sCAmIZ"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isDevelopment } from "../opsinjs.js";
|
|
3
|
+
import { cn } from "../utils.js";
|
|
4
|
+
/**
|
|
5
|
+
* Horizontal alignment, written out because Tailwind reads class names as
|
|
6
|
+
* literal strings. text-${align} generates no CSS.
|
|
7
|
+
*/
|
|
8
|
+
const ALIGN_CLASS = {
|
|
9
|
+
start: "text-left",
|
|
10
|
+
center: "text-center",
|
|
11
|
+
end: "text-right",
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Dev warnings, keyed by the mistake and never by a per-render value, so a
|
|
15
|
+
* wide table warns once rather than once per row.
|
|
16
|
+
*/
|
|
17
|
+
const warned = new Set();
|
|
18
|
+
function warnDev(key, message) {
|
|
19
|
+
if (!isDevelopment() || warned.has(key))
|
|
20
|
+
return;
|
|
21
|
+
warned.add(key);
|
|
22
|
+
console.warn(message); // always starts "[opsinjs] <Table> ..."
|
|
23
|
+
}
|
|
24
|
+
export function Table({ caption, captionHidden = false, columns, rows, rowHeader = true, className, }) {
|
|
25
|
+
if (!Array.isArray(columns) || columns.length === 0) {
|
|
26
|
+
warnDev("empty-columns", "[opsinjs] <Table> was given no columns, so nothing was rendered. A table " +
|
|
27
|
+
"with no columns is a caller mistake rather than an empty result; for an " +
|
|
28
|
+
"empty result render EmptyState, which says in words that there is " +
|
|
29
|
+
"nothing to show.");
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const captionText = typeof caption === "string" ? caption : "";
|
|
33
|
+
if (captionText.trim() === "") {
|
|
34
|
+
warnDev("empty-caption", "[opsinjs] <Table> received an empty caption. A caption is required so a " +
|
|
35
|
+
"screen reader user knows what the table counts, and there is no honest " +
|
|
36
|
+
"caption this component can invent for you. It rendered the empty " +
|
|
37
|
+
"caption you passed. Supply one naming the rows and the columns.");
|
|
38
|
+
}
|
|
39
|
+
if (new Set(columns.map((c) => c.key)).size !== columns.length) {
|
|
40
|
+
warnDev("duplicate-column-key", "[opsinjs] <Table> was given two columns with the same key. Cells are " +
|
|
41
|
+
"looked up by column key, so one column's data shadows the other and " +
|
|
42
|
+
"the two share a React key. Give every column a distinct key.");
|
|
43
|
+
}
|
|
44
|
+
const resolved = columns.map((column) => {
|
|
45
|
+
const align = column.align ?? (column.numeric ? "end" : "start");
|
|
46
|
+
return { column, align };
|
|
47
|
+
});
|
|
48
|
+
return (_jsx("div", { "data-slot": "table-container",
|
|
49
|
+
/* The sideways scroll lives here, so a table wider than the screen never
|
|
50
|
+
pushes the page body sideways. It is focusable so a keyboard reader can
|
|
51
|
+
scroll it; it carries no role and no name of its own because the
|
|
52
|
+
caption already names the table, and whether it should be a labelled
|
|
53
|
+
region is an open question on the page. */
|
|
54
|
+
tabIndex: 0, className: cn("w-full overflow-x-auto", "focus-visible:outline-[length:var(--opsin-border-focus,2px)] focus-visible:outline-offset-[var(--opsin-border-focus-offset,2px)] focus-visible:outline-ring", className), children: _jsxs("table", { "data-slot": "table", className: "w-full border-collapse text-opsin-body [color:var(--foreground)]", children: [_jsx("caption", { "data-slot": "table-caption", className: captionHidden
|
|
55
|
+
? "sr-only"
|
|
56
|
+
: "mb-opsin-2 text-left text-opsin-subheadline [color:var(--foreground)]", children: caption }), _jsx("thead", { "data-slot": "table-header", children: _jsx("tr", { className: "border-b border-border", children: resolved.map(({ column, align }) => (_jsx("th", { "data-slot": "table-head", scope: "col", className: cn("px-opsin-3 py-opsin-2 align-bottom text-opsin-footnote font-medium [color:var(--muted-foreground)]", ALIGN_CLASS[align]), children: column.header }, column.key))) }) }), _jsx("tbody", { "data-slot": "table-body", children: rows.map((row, rowIndex) => (_jsx("tr", { "data-slot": "table-row", className: "border-b border-edge last:border-b-0", children: resolved.map(({ column, align }, columnIndex) => {
|
|
57
|
+
const isRowHeader = rowHeader && columnIndex === 0;
|
|
58
|
+
const cellClass = cn("px-opsin-3 py-opsin-2 align-top", ALIGN_CLASS[align], column.numeric && "tabular-nums", isRowHeader && "font-medium");
|
|
59
|
+
if (isRowHeader) {
|
|
60
|
+
return (_jsx("th", { "data-slot": "table-cell", scope: "row", className: cn(cellClass, "[color:var(--foreground)]"), children: row[column.key] }, column.key));
|
|
61
|
+
}
|
|
62
|
+
return (_jsx("td", { "data-slot": "table-cell", "data-opsinjs-value": column.numeric ? "" : undefined, className: cn(cellClass, "[color:var(--foreground)]"), children: row[column.key] }, column.key));
|
|
63
|
+
}) }, rowIndex))) })] }) }));
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/components/table.tsx"],"names":[],"mappings":";AAqDA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAoBhC;;;GAGG;AACH,MAAM,WAAW,GAAgC;IAC/C,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,aAAa;IACrB,GAAG,EAAE,YAAY;CAClB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA;AAChC,SAAS,OAAO,CAAC,GAAW,EAAE,OAAe;IAC3C,IAAI,CAAC,aAAa,EAAE,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAM;IAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACf,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA,CAAC,wCAAwC;AAChE,CAAC;AAmDD,MAAM,UAAU,KAAK,CAAC,EACpB,OAAO,EACP,aAAa,GAAG,KAAK,EACrB,OAAO,EACP,IAAI,EACJ,SAAS,GAAG,IAAI,EAChB,SAAS,GACE;IACX,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,OAAO,CACL,eAAe,EACf,2EAA2E;YACzE,0EAA0E;YAC1E,oEAAoE;YACpE,kBAAkB,CACrB,CAAA;QACD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,C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
|
|
3
|
+
* One panel is shown at a time, the reader picks which through a row of tabs,
|
|
4
|
+
* and choosing a tab swaps the whole panel underneath. Its home is a screen
|
|
5
|
+
* where two or three bodies of content compete for one region and only one is
|
|
6
|
+
* worth showing at once, an "Overview" and a "History" of the same subject
|
|
7
|
+
* being the case it was built for.
|
|
8
|
+
*
|
|
9
|
+
* IT IS NOT A SegmentedControl, AND THE DIFFERENCE IS WHAT THE CHOICE DOES.
|
|
10
|
+
* A segmented control sets a parameter of one view that stays on the surface:
|
|
11
|
+
* the chart stays the chart and the chosen option redraws it for a different
|
|
12
|
+
* window. Tabs SWAP the content: choosing a tab replaces the panel with a
|
|
13
|
+
* different panel that has its own material. The two look alike and are not
|
|
14
|
+
* alike, so a control that only changes a setting of what stays on screen is a
|
|
15
|
+
* SegmentedControl, and a control that replaces what is on screen is this one.
|
|
16
|
+
* The keyboard contract differs to match, which is set out below.
|
|
17
|
+
*
|
|
18
|
+
* WHY BASE UI'S Tabs RATHER THAN A ROW OF Buttons. The WAI-ARIA tabs pattern is
|
|
19
|
+
* a specific thing: a `role="tablist"` holding `role="tab"` buttons, each
|
|
20
|
+
* `aria-controls` its `role="tabpanel"`, the list is one tab stop with a roving
|
|
21
|
+
* focus moved by the Arrow keys, and the panel is the next tab stop after the
|
|
22
|
+
* list. Base UI's Tabs renders exactly that on its Composite primitive, so the
|
|
23
|
+
* roving focus, the Arrow keys, Home and End, and the panel association are the
|
|
24
|
+
* tested primitive rather than a bespoke one nobody has driven with a screen
|
|
25
|
+
* reader. Building it from a row of shipped Buttons would give one tab stop per
|
|
26
|
+
* button, because Base UI's `useButton` stamps a tab index on every control, so
|
|
27
|
+
* the list would read as three stops where the pattern promises one.
|
|
28
|
+
*
|
|
29
|
+
* NEITHER COLOUR AXIS. A tab names a panel; it states no clinical level and
|
|
30
|
+
* names no category, so the row carries neither `data-status` nor
|
|
31
|
+
* `data-category` and draws only neutral chrome. The active tab is marked three
|
|
32
|
+
* ways with no hue doing the work: the ink lifts from the muted role to the
|
|
33
|
+
* foreground role, the label gains weight, and an indicator bar rides under the
|
|
34
|
+
* active tab in the chrome primary ink. The semantic carrier underneath all
|
|
35
|
+
* three is `aria-selected`, which Base UI sets, so the selection survives
|
|
36
|
+
* greyscale and survives a reader stylesheet that strips fills.
|
|
37
|
+
*
|
|
38
|
+
* IT IS A CLIENT COMPONENT, BECAUSE Base UI's Tabs OWNS ROVING FOCUS AND THE
|
|
39
|
+
* ACTIVE PANEL. Those need the browser, so the directive is required rather
|
|
40
|
+
* than chosen. The value is controlled: this file keeps no selection state of
|
|
41
|
+
* its own, it reports the reader's choice through `onValueChange` and reflects
|
|
42
|
+
* the caller's answer through `value`.
|
|
43
|
+
*/
|
|
44
|
+
import type { ReactNode } from "react";
|
|
45
|
+
/**
|
|
46
|
+
* One tab and its panel. Kept as a local type rather than a fourth public
|
|
47
|
+
* export, for the reason `segmented-control.tsx` gives about its own option
|
|
48
|
+
* shape: the registry contract fixes this file at three public exports, so a
|
|
49
|
+
* consumer names this shape as `TabsProps["items"][number]` rather than
|
|
50
|
+
* importing a fourth symbol.
|
|
51
|
+
*/
|
|
52
|
+
interface TabsItem {
|
|
53
|
+
/** The value this tab selects. Unique within the row, and what `value` matches. Also the React key. */
|
|
54
|
+
value: string;
|
|
55
|
+
/** The visible words on the tab, and its accessible name. One short noun, "Overview" rather than "Show me the overview". */
|
|
56
|
+
label: string;
|
|
57
|
+
/** The panel shown while this tab is active. Any node: a paragraph, a list, a whole composed view. */
|
|
58
|
+
panel: ReactNode;
|
|
59
|
+
/**
|
|
60
|
+
* Whether this tab cannot be chosen. A disabled tab drops to the muted ink
|
|
61
|
+
* and is skipped by the Arrow keys rather than removed, so the reader can
|
|
62
|
+
* still see it is a panel that is not available to them right now.
|
|
63
|
+
*/
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface TabsProps {
|
|
67
|
+
/**
|
|
68
|
+
* The tabs, in the order they appear. Two or more: a single tab is not a
|
|
69
|
+
* choice, and a set with none has nothing to draw. Each item is a value, a
|
|
70
|
+
* visible label, the panel it reveals, and an optional `disabled` flag. A
|
|
71
|
+
* count below two raises a development warning and still renders, so the
|
|
72
|
+
* mistake is visible rather than silent.
|
|
73
|
+
*/
|
|
74
|
+
items: TabsItem[];
|
|
75
|
+
/**
|
|
76
|
+
* The value of the active tab, matching one item's `value`. This is a
|
|
77
|
+
* controlled component with no internal selection state, so a `value` that
|
|
78
|
+
* matches no item renders the row with no tab active, and a development
|
|
79
|
+
* warning names it.
|
|
80
|
+
*/
|
|
81
|
+
value: string;
|
|
82
|
+
/**
|
|
83
|
+
* Called with the new value when the reader chooses a different tab. The
|
|
84
|
+
* caller stores it and passes it back as `value`; the component keeps no
|
|
85
|
+
* state of its own.
|
|
86
|
+
*/
|
|
87
|
+
onValueChange: (value: string) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Optional accessible name for the tab list, applied as `aria-label`. A tab
|
|
90
|
+
* list where every tab has a visible label reads without one, so this is not
|
|
91
|
+
* required, but naming what the tabs switch between, "Reading detail" rather
|
|
92
|
+
* than "tabs", helps a screen-reader user who lands on the list before its
|
|
93
|
+
* tabs. There is no default, because a guessed name would describe the wrong
|
|
94
|
+
* thing on most screens.
|
|
95
|
+
*/
|
|
96
|
+
label?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Merged onto the root. Width, margin and place in a layout belong here. A
|
|
99
|
+
* class you pass wins over the root's own where the two conflict, because it
|
|
100
|
+
* is merged last.
|
|
101
|
+
*/
|
|
102
|
+
className?: string;
|
|
103
|
+
}
|
|
104
|
+
export declare function Tabs({ items, value, onValueChange, label, className }: TabsProps): import("react").JSX.Element | null;
|
|
105
|
+
export {};
|
|
106
|
+
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/components/tabs.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtC;;;;;;GAMG;AACH,UAAU,QAAQ;IAChB,uGAAuG;IACvG,KAAK,EAAE,MAAM,CAAA;IACb,4HAA4H;IAC5H,KAAK,EAAE,MAAM,CAAA;IACb,sGAAsG;IACtG,KAAK,EAAE,SAAS,CAAA;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AA2GD,MAAM,WAAW,SAAS;IACxB;;;;;;OAMG;IACH,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,SAAS,sCAkFhF"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Tabs as BaseTabs } from "@base-ui/react/tabs";
|
|
4
|
+
import { isDevelopment } from "../opsinjs.js";
|
|
5
|
+
import { cn } from "../utils.js";
|
|
6
|
+
/**
|
|
7
|
+
* The tab row, spelled once. A flex row that is `position: relative` so the
|
|
8
|
+
* indicator can be positioned against it, with a hairline rail along its
|
|
9
|
+
* bottom edge so the row reads as one object with the tabs set into it. The
|
|
10
|
+
* rail is the neutral `border-border`, not either colour axis.
|
|
11
|
+
*/
|
|
12
|
+
const LIST = "relative flex flex-wrap items-stretch gap-opsin-1 border-b border-edge";
|
|
13
|
+
/**
|
|
14
|
+
* One tab, spelled once.
|
|
15
|
+
*
|
|
16
|
+
* The active state is carried three ways so none of them is load-bearing
|
|
17
|
+
* alone: `aria-selected` for assistive technology, which Base UI sets; the ink
|
|
18
|
+
* lifting from the muted role to the foreground role for a sighted reader; and
|
|
19
|
+
* the label gaining weight. The indicator bar below is the fourth carrier, and
|
|
20
|
+
* it too is neutral chrome rather than a hue. Every treatment keys off Base
|
|
21
|
+
* UI's `data-active` attribute, so the same class string serves an active and
|
|
22
|
+
* an inactive tab and nothing shifts as the reader moves between them.
|
|
23
|
+
*
|
|
24
|
+
* The ink is written as the arbitrary property `[color:var(--foreground)]` and
|
|
25
|
+
* not `text-foreground`, for the reason `segmented-control.tsx` sets out:
|
|
26
|
+
* tailwind-merge files a `text-*` colour in the same conflict group as the
|
|
27
|
+
* `text-opsin-*` type step and would drop one of them. The arbitrary property
|
|
28
|
+
* lands in the `color` group instead, so the ink and the size both survive.
|
|
29
|
+
*
|
|
30
|
+
* The focus ring is carried here rather than left to the product stylesheet,
|
|
31
|
+
* so a project installed without that stylesheet does not lose it. The 44pt
|
|
32
|
+
* target floor is `--opsin-target-minimum` in rem, so it grows with the
|
|
33
|
+
* reader's text size rather than pinning at a device pixel, with a literal
|
|
34
|
+
* fallback so the declaration stays valid where the generated token sheet was
|
|
35
|
+
* not installed.
|
|
36
|
+
*/
|
|
37
|
+
const TAB = "relative inline-flex select-none items-center justify-center whitespace-nowrap " +
|
|
38
|
+
"rounded-opsin-sm px-opsin-3 py-opsin-2 align-middle text-opsin-headline " +
|
|
39
|
+
"min-h-(--opsin-target-minimum,2.75rem) cursor-pointer bg-transparent " +
|
|
40
|
+
"[color:var(--muted-foreground)] " +
|
|
41
|
+
"transition-colors duration-(--opsin-duration-fast) ease-opsin-standard " +
|
|
42
|
+
"hover:bg-state-hover " +
|
|
43
|
+
"data-[active]:[color:var(--foreground)] data-[active]:font-medium " +
|
|
44
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:[color:var(--muted-foreground)] data-[disabled]:hover:bg-transparent " +
|
|
45
|
+
"focus-visible:outline-[length:var(--opsin-border-focus,2px)] focus-visible:outline-offset-[var(--opsin-border-focus-offset,2px)] focus-visible:outline-ring";
|
|
46
|
+
/**
|
|
47
|
+
* The active indicator, spelled once. A bar pinned to the bottom of the list
|
|
48
|
+
* that rides under the active tab, sized and placed from the CSS variables
|
|
49
|
+
* Base UI writes onto it (`--active-tab-width` and `--active-tab-left`), so it
|
|
50
|
+
* follows the active tab without this file measuring anything. Its thickness is
|
|
51
|
+
* the half-space token rather than a pixel literal, and its fill is the accent
|
|
52
|
+
* ink, `--brand-ink` (ADR 0029), which clears the body floor on the page in every
|
|
53
|
+
* accent theme, so a two-pixel line stays visible where a bright accent fill
|
|
54
|
+
* would not. It is on neither colour axis. It is
|
|
55
|
+
* decorative: `aria-selected` on the tab is the carrier a screen reader reads,
|
|
56
|
+
* and this bar is the sighted echo of it, so it is not the only thing telling
|
|
57
|
+
* the two states apart.
|
|
58
|
+
*
|
|
59
|
+
* GLIDE, the third of the five interaction motions (ADR 0031): the bar moves
|
|
60
|
+
* to the tab chosen next rather than one tab losing its mark and another
|
|
61
|
+
* gaining one, so the choice is seen to move. It travels on `spring-snap`, the
|
|
62
|
+
* spring tokens/motion.json names for a control the reader just chose, and
|
|
63
|
+
* passes its stop by 1.5% of the distance before it settles. A tab is a view
|
|
64
|
+
* and never a reading, so the overshoot is allowed, and it moves only when the
|
|
65
|
+
* reader changes tab, never on first paint.
|
|
66
|
+
*
|
|
67
|
+
* The transition names `translate`, not `transform`. Tailwind 4 writes
|
|
68
|
+
* `translate-x-*` to the individual `translate` property, so the list this
|
|
69
|
+
* file used to carry, `transform` and `width`, animated the width and left
|
|
70
|
+
* the bar's position to jump. It also transitions `width`, which the motion
|
|
71
|
+
* foundation otherwise forbids, under the exception that page names: an
|
|
72
|
+
* absolutely positioned indicator reflows nothing. Under
|
|
73
|
+
* `prefers-reduced-motion: reduce` `spring-snap` collapses to 0ms in the
|
|
74
|
+
* generated sheet, so the bar is under the new tab the frame after the choice.
|
|
75
|
+
*/
|
|
76
|
+
const INDICATOR = "pointer-events-none absolute bottom-0 left-0 h-opsin-0-5 rounded-full bg-brand-ink " +
|
|
77
|
+
"w-[var(--active-tab-width)] translate-x-[var(--active-tab-left)] " +
|
|
78
|
+
"transition-[translate,width] duration-(--opsin-duration-spring-snap) ease-opsin-spring-snap";
|
|
79
|
+
/**
|
|
80
|
+
* One panel, spelled once. The body of content the active tab reveals. It is a
|
|
81
|
+
* tab stop after the list, so it carries the same focus ring as the tabs, and
|
|
82
|
+
* it sits at the body type step in the foreground ink. Padding on the block
|
|
83
|
+
* axis sets it off from the tab row without a border repeating the rail above.
|
|
84
|
+
*/
|
|
85
|
+
const PANEL = "py-opsin-4 text-opsin-body [color:var(--foreground)] " +
|
|
86
|
+
"focus-visible:outline-[length:var(--opsin-border-focus,2px)] focus-visible:outline-offset-[var(--opsin-border-focus-offset,2px)] focus-visible:outline-ring";
|
|
87
|
+
/**
|
|
88
|
+
* Development warnings, said once per distinct offender. Nothing here has an
|
|
89
|
+
* `OpsinErrorCode`: the codes in `tokens/errors.json` describe a mistake a
|
|
90
|
+
* consumer makes with the clinical API, and a tab row asserts nothing
|
|
91
|
+
* clinical. `segmented-control.tsx` and `tab-bar.tsx` keep the same small set
|
|
92
|
+
* for the same reason, and the repair, a real code in `../opsinjs.ts`, is not
|
|
93
|
+
* this file's to make.
|
|
94
|
+
*/
|
|
95
|
+
const warned = new Set();
|
|
96
|
+
function warnDev(key, message) {
|
|
97
|
+
if (!isDevelopment() || warned.has(key))
|
|
98
|
+
return;
|
|
99
|
+
warned.add(key);
|
|
100
|
+
console.warn(message);
|
|
101
|
+
}
|
|
102
|
+
export function Tabs({ items, value, onValueChange, label, className }) {
|
|
103
|
+
if (isDevelopment()) {
|
|
104
|
+
if (!Array.isArray(items) || items.length === 0) {
|
|
105
|
+
warnDev("no-items", "[opsinjs] <Tabs> was rendered with no items, so it has nothing to " +
|
|
106
|
+
"draw. Tabs switch between two or more panels of content; supply them " +
|
|
107
|
+
"through the `items` prop.");
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
if (items.length === 1) {
|
|
111
|
+
warnDev("one-item", "[opsinjs] <Tabs> was given a single item, which is not a choice. Add " +
|
|
112
|
+
"the other panels, or render the one panel directly without a tab row " +
|
|
113
|
+
"the reader cannot use.");
|
|
114
|
+
}
|
|
115
|
+
const seen = new Set();
|
|
116
|
+
for (const item of items) {
|
|
117
|
+
if (seen.has(item.value)) {
|
|
118
|
+
warnDev(`duplicate-value:${item.value}`, `[opsinjs] <Tabs> has two items with the value "${item.value}", which ` +
|
|
119
|
+
"breaks both the React list and the value match. Give each tab a " +
|
|
120
|
+
"unique value.");
|
|
121
|
+
}
|
|
122
|
+
seen.add(item.value);
|
|
123
|
+
}
|
|
124
|
+
if (!items.some((item) => item.value === value)) {
|
|
125
|
+
warnDev(`value-not-in-items:${String(value)}`, `[opsinjs] <Tabs value="${String(value)}"> does not match any item's ` +
|
|
126
|
+
"value, so the row renders with no tab active. This is a controlled " +
|
|
127
|
+
"component: pass a `value` equal to one item's `value`.");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (!Array.isArray(items) || items.length === 0) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
return (_jsxs(BaseTabs.Root, { "data-slot": "tabs", value: value, onValueChange: (next) => onValueChange(String(next)), className: cn("flex flex-col gap-opsin-1", className), children: [_jsxs(BaseTabs.List, { "data-slot": "tabs-list", "aria-label": label, className: LIST, children: [items.map((item) => (_jsx(BaseTabs.Tab, { value: item.value, disabled: item.disabled, "data-slot": "tabs-tab", className: TAB, children: _jsx("span", { className: "[text-box:trim-both_ex_alphabetic]", children: item.label }) }, item.value))), _jsx(BaseTabs.Indicator, { "data-slot": "tabs-indicator", className: INDICATOR })] }), items.map((item) => (_jsx(BaseTabs.Panel, { value: item.value, "data-slot": "tabs-panel", className: PANEL, children: item.panel }, item.value)))] }));
|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