@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 @@
|
|
|
1
|
+
{"version":3,"file":"score-dial.js","sourceRoot":"","sources":["../../src/components/score-dial.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,aAAa,EAAE,gB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AIL,yBACY,wBAAwB,EAClC,SAAS,EAAC,+CAA+C,YAExD,eAAe,GACd,IACH,CACJ,CAAC,CAAC,CAAC,IAAI,EACP,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;oBACxC;;iFAE6D;oBAC7D,YAAG,SAAS,EAAC,+CAA+C,qEAExD,CACL,CAAC,CAAC,CAAC,IAAI,IACJ,EAQN,yBACY,uBAAuB,EACjC,SAAS,EAAC,2DAA2D,YAEpE,eAAe,GACd,EAkBH,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACvB,yBACY,4BAA4B,EACtC,SAAS,EAAC,2DAA2D,YAEpE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,CAC5B,gDAAgD,CACjD,CAAC,CAAC,CAAC,CACF,4CACa,GAAG,EACd,4BAAgB,0BAA0B,EAAC,QAAQ,EAAE,YAAY,YAC9D,YAAY,GACR,SAEN,CACJ,GACC,CACL,IACG,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface ScrollAreaProps {
|
|
3
|
+
/**
|
|
4
|
+
* The content the region scrolls over. It is ordinary content, and any colour
|
|
5
|
+
* it carries is the caller's to keep off both colour axes; this component adds
|
|
6
|
+
* none of its own.
|
|
7
|
+
*/
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* A CSS length that caps the viewport's height, such as `"16rem"`. This is
|
|
11
|
+
* what gives the region something to overflow, so a vertical scroll area needs
|
|
12
|
+
* either this or a height class merged through `className`. Given neither, the
|
|
13
|
+
* region grows to fit its content and never scrolls, and a development warning
|
|
14
|
+
* names the omission. Use a length that grows with the reader's text, a rem
|
|
15
|
+
* rather than a pixel count, so the region does not clip its content at 200%
|
|
16
|
+
* text.
|
|
17
|
+
*/
|
|
18
|
+
maxHeight?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Which axes may scroll. `vertical` is the common case and the default;
|
|
21
|
+
* `horizontal` is for a wide row such as a set of cards; `both` shows both
|
|
22
|
+
* rails and a corner where they meet. A value outside the three is treated as
|
|
23
|
+
* `vertical`, the case that needs nothing from its container, and a
|
|
24
|
+
* development warning names the mistake.
|
|
25
|
+
*/
|
|
26
|
+
orientation?: "vertical" | "horizontal" | "both";
|
|
27
|
+
/**
|
|
28
|
+
* Merged onto the root. The region's width, its border and rounding, and the
|
|
29
|
+
* height that bounds it when `maxHeight` is not used all belong here. It is
|
|
30
|
+
* unrestricted, so it is the one route by which colour can reach the region,
|
|
31
|
+
* and the two-colour-axes rule applies to it in full: a scroll area takes
|
|
32
|
+
* neither a status nor a category tint. A class you pass wins over the root's
|
|
33
|
+
* own where the two conflict, because it is merged last.
|
|
34
|
+
*/
|
|
35
|
+
className?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function ScrollArea({ children, maxHeight, orientation, className, }: ScrollAreaProps): import("react").JSX.Element;
|
|
38
|
+
//# sourceMappingURL=scroll-area.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-area.d.ts","sourceRoot":"","sources":["../../src/components/scroll-area.tsx"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAiFtC,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,UAAU,GAAG,YAAY,GAAG,MAAM,CAAA;IAChD;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,EACT,WAAwB,EACxB,SAAS,GACV,EAAE,eAAe,+BAuEjB"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* ScrollArea is a bounded region whose overflow scrolls, drawn with a thin
|
|
5
|
+
* neutral scrollbar in place of the platform's default one. Its whole job is to
|
|
6
|
+
* keep a long stretch of content reachable inside a box that is shorter than the
|
|
7
|
+
* content, and to do that without becoming the reason the content stops being
|
|
8
|
+
* reachable.
|
|
9
|
+
*
|
|
10
|
+
* IT IS FOR A BOUNDED INNER REGION, NEVER FOR THE PAGE. The most common and most
|
|
11
|
+
* damaging misuse of a custom scroll container is to wrap the whole page in one.
|
|
12
|
+
* A styled scrollbar that replaces the browser's own is a frequent cause of
|
|
13
|
+
* content becoming unreachable once a reader turns their text size up to 200%,
|
|
14
|
+
* because the region's height was set for one text size and does not grow with
|
|
15
|
+
* the reader's. So the page itself keeps the browser's native scroll, and this
|
|
16
|
+
* component is reached for only where a single card, panel or list has to hold
|
|
17
|
+
* more than it can show: a scrolling region set inside a page that still scrolls
|
|
18
|
+
* on its own.
|
|
19
|
+
*
|
|
20
|
+
* IT MUST NOT TRAP THE CONTENT, AND IT MUST NOT HIDE IT FROM THE KEYBOARD. Base
|
|
21
|
+
* UI renders the viewport with `overflow: scroll`, but it only makes the
|
|
22
|
+
* viewport a tab stop when its scrollbar is visible, and this component draws a
|
|
23
|
+
* thin scrollbar that stays out of the way until hover, so left to Base UI an
|
|
24
|
+
* overflowing region would be reachable by pointer alone. This wrapper gives the
|
|
25
|
+
* viewport its own `tabIndex={0}`, so a keyboard reader can reach the region and
|
|
26
|
+
* scroll it with the arrow keys (WCAG 2.1.1). The tab stop is unconditional
|
|
27
|
+
* rather than measured against live overflow: a region that currently fits its
|
|
28
|
+
* content becomes an extra stop that scrolls nothing, which is a small cost, and
|
|
29
|
+
* the alternative of leaving an overflowing region unreachable is a real one.
|
|
30
|
+
* This wrapper carries the focus ring on the viewport for the same reason, so a
|
|
31
|
+
* keyboard reader can see which region they have entered. Nothing here captures
|
|
32
|
+
* focus, holds it, or moves it: the viewport is one ordinary tab stop that a
|
|
33
|
+
* reader passes through, not a well they fall into.
|
|
34
|
+
*
|
|
35
|
+
* NEITHER COLOUR AXIS. A scrolling region states no clinical level and names no
|
|
36
|
+
* category. It carries neither `data-status` nor `data-category` and draws only
|
|
37
|
+
* neutral chrome: the scrollbar track is transparent so it does not box the
|
|
38
|
+
* content in, and the thumb is the muted-foreground role so it reads as a
|
|
39
|
+
* grabbable rail without reaching for a hue. Whatever the region scrolls over is
|
|
40
|
+
* the caller's content, and any colour it carries is the caller's to keep off
|
|
41
|
+
* both axes.
|
|
42
|
+
*
|
|
43
|
+
* IT NEEDS A BOUNDED HEIGHT TO DO ANYTHING. A viewport with no height ceiling has
|
|
44
|
+
* nothing to overflow, so it never scrolls and the scrollbar never appears. The
|
|
45
|
+
* height comes from `maxHeight`, a CSS length applied to the viewport, or from a
|
|
46
|
+
* height class the caller merges through `className`. Given neither, the region
|
|
47
|
+
* grows to fit its content and behaves as a plain block, and a development
|
|
48
|
+
* warning names the omission rather than leaving the caller to wonder why
|
|
49
|
+
* nothing scrolls.
|
|
50
|
+
*/
|
|
51
|
+
import { ScrollArea as BaseScrollArea } from "@base-ui/react/scroll-area";
|
|
52
|
+
import { isDevelopment } from "../opsinjs.js";
|
|
53
|
+
import { cn } from "../utils.js";
|
|
54
|
+
/*
|
|
55
|
+
* The three, as the object's own list, so the runtime check reads real keys and
|
|
56
|
+
* cannot be answered "yes" by a prototype member the way `in` would be.
|
|
57
|
+
*/
|
|
58
|
+
const ORIENTATIONS = ["vertical", "horizontal", "both"];
|
|
59
|
+
/*
|
|
60
|
+
* The viewport, spelled once. It is the scrollable element: Base UI sets its
|
|
61
|
+
* `overflow: scroll`, the component gives it a tab stop on the element itself,
|
|
62
|
+
* and this class carries the focus ring so a keyboard reader can see which
|
|
63
|
+
* region they have entered. The ring is kept in
|
|
64
|
+
* the component's own classes rather than left to the product stylesheet, for
|
|
65
|
+
* the reason `link.tsx` records: a project installed without that stylesheet
|
|
66
|
+
* would otherwise lose the ring silently. `overscroll-contain` stops a scroll
|
|
67
|
+
* that reaches the end of this region from scrolling the page behind it, which
|
|
68
|
+
* is the behaviour a bounded region owes the page it sits in. The radius is
|
|
69
|
+
* inherited from the root so a caller who rounds the region through `className`
|
|
70
|
+
* gets a viewport that matches.
|
|
71
|
+
*/
|
|
72
|
+
const VIEWPORT = "h-full max-h-[inherit] w-full overscroll-contain rounded-[inherit] " +
|
|
73
|
+
"focus-visible:outline-ring focus-visible:outline-[length:var(--opsin-border-focus,2px)] " +
|
|
74
|
+
// The offset is negated so the ring draws inside the viewport. The viewport
|
|
75
|
+
// fills a container the caller usually rounds and borders, so an outward ring
|
|
76
|
+
// would be clipped at those corners; an inset ring stays whole.
|
|
77
|
+
"focus-visible:outline-offset-[calc(var(--opsin-border-focus-offset,2px)*-1)]";
|
|
78
|
+
/*
|
|
79
|
+
* The scrollbar track per axis, written out per axis because Tailwind reads
|
|
80
|
+
* class names as literal strings. The track itself draws no fill, so it does not
|
|
81
|
+
* box the content in a second border; it is a transparent gutter that the thumb
|
|
82
|
+
* rides in. The opacity transition follows Base UI's hovering and scrolling data
|
|
83
|
+
* attributes, so the rail fades in as chrome rather than sitting as a fixed line
|
|
84
|
+
* competing with the content.
|
|
85
|
+
*/
|
|
86
|
+
const SCROLLBAR_BASE = "flex touch-none select-none p-opsin-0-5 opacity-0 " +
|
|
87
|
+
"transition-opacity duration-(--opsin-duration-fast) ease-opsin-standard " +
|
|
88
|
+
"data-[hovering]:opacity-100 data-[scrolling]:opacity-100";
|
|
89
|
+
const SCROLLBAR_Y = SCROLLBAR_BASE + " w-opsin-3 justify-center";
|
|
90
|
+
const SCROLLBAR_X = SCROLLBAR_BASE + " h-opsin-3 flex-col items-center";
|
|
91
|
+
/*
|
|
92
|
+
* The thumb per axis. Base UI sets the thumb's main-axis length inline from the
|
|
93
|
+
* ratio of content to viewport, so this class sets only the cross-axis size and
|
|
94
|
+
* the fill. The fill is the muted-foreground role, a low-emphasis neutral that
|
|
95
|
+
* reads as a grabbable rail without either colour axis, and it is pill-shaped so
|
|
96
|
+
* it reads as a handle rather than a bar.
|
|
97
|
+
*/
|
|
98
|
+
const THUMB_Y = "w-full rounded-full bg-muted-foreground";
|
|
99
|
+
const THUMB_X = "h-full rounded-full bg-muted-foreground";
|
|
100
|
+
/*
|
|
101
|
+
* Development warnings for uncoded mistakes, said once per distinct offender.
|
|
102
|
+
* Nothing here has an OpsinErrorCode: a scrolling region asserts nothing
|
|
103
|
+
* clinical, so the codes in `tokens/errors.json` do not apply, and minting one
|
|
104
|
+
* is not this file's to do. `divider.tsx` and `segmented-control.tsx` keep the
|
|
105
|
+
* same small set for the same reason.
|
|
106
|
+
*/
|
|
107
|
+
const warned = new Set();
|
|
108
|
+
function warnDev(key, message) {
|
|
109
|
+
if (!isDevelopment() || warned.has(key))
|
|
110
|
+
return;
|
|
111
|
+
warned.add(key);
|
|
112
|
+
console.warn(message);
|
|
113
|
+
}
|
|
114
|
+
export function ScrollArea({ children, maxHeight, orientation = "vertical", className, }) {
|
|
115
|
+
// A value outside the three is treated as vertical, the case that needs
|
|
116
|
+
// nothing from its container. This file ships as source into JavaScript
|
|
117
|
+
// projects where the union is only advice.
|
|
118
|
+
const resolved = ORIENTATIONS.includes(orientation)
|
|
119
|
+
? orientation
|
|
120
|
+
: "vertical";
|
|
121
|
+
if (isDevelopment()) {
|
|
122
|
+
if (resolved !== orientation) {
|
|
123
|
+
warnDev("orientation", `[opsinjs] <ScrollArea> received orientation="${String(orientation)}", which is not "vertical", "horizontal" or "both". It was treated as "vertical".`);
|
|
124
|
+
}
|
|
125
|
+
const boundsVertical = resolved === "vertical" || resolved === "both";
|
|
126
|
+
const hasHeightHint = (typeof maxHeight === "string" && maxHeight.trim() !== "") ||
|
|
127
|
+
(typeof className === "string" && /(?:^|\s)(?:max-)?h-/.test(className));
|
|
128
|
+
if (boundsVertical && !hasHeightHint) {
|
|
129
|
+
warnDev("no-height", "[opsinjs] <ScrollArea> was rendered with no height ceiling, so it has " +
|
|
130
|
+
"nothing to overflow and will not scroll. Give it a `maxHeight` such " +
|
|
131
|
+
'as "16rem", or a height class through `className`.');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const showVertical = resolved === "vertical" || resolved === "both";
|
|
135
|
+
const showHorizontal = resolved === "horizontal" || resolved === "both";
|
|
136
|
+
return (_jsxs(BaseScrollArea.Root, { "data-slot": "scroll-area", className: cn("relative", className), children: [_jsx(BaseScrollArea.Viewport, { "data-slot": "scroll-area-viewport", tabIndex: 0, style: maxHeight ? { maxHeight } : undefined, className: VIEWPORT, children: children }), showVertical ? (_jsx(BaseScrollArea.Scrollbar, { orientation: "vertical", "data-slot": "scroll-area-scrollbar", className: SCROLLBAR_Y, children: _jsx(BaseScrollArea.Thumb, { "data-slot": "scroll-area-thumb", className: THUMB_Y }) })) : null, showHorizontal ? (_jsx(BaseScrollArea.Scrollbar, { orientation: "horizontal", "data-slot": "scroll-area-scrollbar", className: SCROLLBAR_X, children: _jsx(BaseScrollArea.Thumb, { "data-slot": "scroll-area-thumb", className: THUMB_X }) })) : null, resolved === "both" ? (_jsx(BaseScrollArea.Corner, { "data-slot": "scroll-area-corner" })) : null] }));
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=scroll-area.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-area.js","sourceRoot":"","sources":["../../src/components/scroll-area.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAGzE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAWhC;;;GAGG;AACH,MAAM,YAAY,GAA4B,CA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c,CAAC,KAAK,iBAAW,mBAAmB,EAAC,SAAS,EAAE,OAAO,GAAI,GACjD,CAC5B,CAAC,CAAC,CAAC,IAAI,EAEP,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CACrB,KAAC,cAAc,CAAC,MAAM,iBAAW,oBAAoB,GAAG,CACzD,CAAC,CAAC,CAAC,IAAI,IACY,CACvB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One option in the row. Kept as a local type rather than a fourth public
|
|
3
|
+
* export, for the reason `button.tsx` gives about its own `ButtonVariant`: the
|
|
4
|
+
* registry contract fixes a file at three public exports, so a consumer names
|
|
5
|
+
* this shape as `SegmentedControlProps["options"][number]` rather than importing
|
|
6
|
+
* a fourth symbol.
|
|
7
|
+
*/
|
|
8
|
+
interface SegmentedControlOption {
|
|
9
|
+
/** The value this option sets. Unique within the row, and what `value` matches. */
|
|
10
|
+
value: string;
|
|
11
|
+
/** The visible words, and part of what a screen reader reads for the option. */
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Whether this option cannot be chosen. A disabled segment drops to the muted
|
|
15
|
+
* ink and is skipped by the Arrow keys rather than removed, so the reader can
|
|
16
|
+
* still see it is an option that is not available to them right now.
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface SegmentedControlProps {
|
|
21
|
+
/**
|
|
22
|
+
* The options, in the order they appear. Two or more: a control offering one
|
|
23
|
+
* option is not a choice, and a control offering none has nothing to render.
|
|
24
|
+
* Each option is a value, a visible label and an optional `disabled` flag.
|
|
25
|
+
*/
|
|
26
|
+
options: SegmentedControlOption[];
|
|
27
|
+
/**
|
|
28
|
+
* The currently chosen value, matching one option's `value`. This is a
|
|
29
|
+
* controlled component with no internal selection state, so a `value` that
|
|
30
|
+
* matches no option renders the row with nothing chosen, and a development
|
|
31
|
+
* warning names it.
|
|
32
|
+
*/
|
|
33
|
+
value: string;
|
|
34
|
+
/**
|
|
35
|
+
* Called with the new value when the reader chooses a different segment. The
|
|
36
|
+
* caller stores it and passes it back as `value`; the control keeps no state
|
|
37
|
+
* of its own.
|
|
38
|
+
*/
|
|
39
|
+
onValueChange: (value: string) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Required. The accessible name for the group, applied as `aria-label` on the
|
|
42
|
+
* radiogroup, so a screen-reader user hears what the row selects before its
|
|
43
|
+
* options. Name the parameter the row sets, "Chart window" rather than "day,
|
|
44
|
+
* week, month". There is no default, because a guessed name would describe the
|
|
45
|
+
* wrong thing on most screens.
|
|
46
|
+
*/
|
|
47
|
+
label: string;
|
|
48
|
+
/**
|
|
49
|
+
* Visual weight only. `md` sets the label at the headline step; `sm` is
|
|
50
|
+
* narrower and a step quieter. Both clear the target floor, so `sm` is never
|
|
51
|
+
* shorter. Defaults to `md`.
|
|
52
|
+
*/
|
|
53
|
+
size?: "sm" | "md";
|
|
54
|
+
/**
|
|
55
|
+
* Fills the width of its container, with the segments sharing it equally. For
|
|
56
|
+
* a control that spans a card or a toolbar. Defaults to `false`, where the row
|
|
57
|
+
* is only as wide as its options.
|
|
58
|
+
*/
|
|
59
|
+
fullWidth?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Merged onto the root track. Width, margin and place in a layout belong here.
|
|
62
|
+
* A class you pass wins over the track's own where the two conflict, because
|
|
63
|
+
* it is merged last.
|
|
64
|
+
*/
|
|
65
|
+
className?: string;
|
|
66
|
+
}
|
|
67
|
+
export declare function SegmentedControl({ options, value, onValueChange, label, size, fullWidth, className, }: SegmentedControlProps): import("react").JSX.Element | null;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=segmented-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented-control.d.ts","sourceRoot":"","sources":["../../src/components/segmented-control.tsx"],"names":[],"mappings":"AAoDA;;;;;;GAMG;AACH,UAAU,sBAAsB;IAC9B,mFAAmF;IACnF,KAAK,EAAE,MAAM,CAAA;IACb,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AA4KD,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,OAAO,EAAE,sBAAsB,EAAE,CAAA;IACjC;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,KAAK,EACL,aAAa,EACb,KAAK,EACL,IAAW,EACX,SAAiB,EACjB,SAAS,GACV,EAAE,qBAAqB,sCAiGvB"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* SegmentedControl is a row of mutually exclusive options with exactly one
|
|
5
|
+
* chosen at a time. Its home is switching a single view between a small set of
|
|
6
|
+
* windows, a chart's day, week or month range being the case it was built for.
|
|
7
|
+
*
|
|
8
|
+
* IT IS ONE TAB STOP, AND THAT IS THE WHOLE POINT. A reader arrowing along a
|
|
9
|
+
* row of options expects Tab to pass the row rather than to stop on every
|
|
10
|
+
* option in it, and a keyboard user who meets four tab stops where the design
|
|
11
|
+
* promised one has been given a control that reads as four. So the control is a
|
|
12
|
+
* radio group: the group takes the single tab stop, and Arrow keys move a
|
|
13
|
+
* roving focus between the options inside it.
|
|
14
|
+
*
|
|
15
|
+
* WHY BASE UI'S RadioGroup RATHER THAN THE SHIPPED Button. A segmented control
|
|
16
|
+
* looks like a row of buttons, so the first instinct is to build it from four
|
|
17
|
+
* `<Button>`s. That instinct is wrong here for a reason written into `button.tsx`:
|
|
18
|
+
* Base UI's `useButton` stamps `tabIndex={0}` on every control it renders, so a
|
|
19
|
+
* row of four Buttons is four tab stops, which is exactly the contract this
|
|
20
|
+
* control exists to refuse. RadioGroup is built on Base UI's Composite
|
|
21
|
+
* primitive instead, which keeps one roving tab stop across the whole group and
|
|
22
|
+
* moves it with the Arrow keys. It renders `role="radiogroup"`, each Radio
|
|
23
|
+
* renders `role="radio"` with `aria-checked`, and selection follows focus, which
|
|
24
|
+
* is the WAI-ARIA radio group pattern rather than a bespoke one nobody has
|
|
25
|
+
* tested. Home and End are not bound: the RadioGroup primitive disables them,
|
|
26
|
+
* and this file does not reach past it to add them, so the page says so rather
|
|
27
|
+
* than claiming a key that does nothing.
|
|
28
|
+
*
|
|
29
|
+
* WHAT IT COSTS, STATED RATHER THAN SOFTENED. Enter does nothing on a segment:
|
|
30
|
+
* the primitive cancels Enter on a radio so a segmented control at the foot of a
|
|
31
|
+
* form does not submit it by accident, and a segment is chosen with the Arrow
|
|
32
|
+
* keys or Space instead. Each Radio also renders a visually hidden
|
|
33
|
+
* `<input type="radio">` beside its span, for a form value it never carries here
|
|
34
|
+
* because no `name` is passed; it is `aria-hidden` and out of the tab order, so
|
|
35
|
+
* it changes nothing a reader meets, and it is named in the anatomy prose rather
|
|
36
|
+
* than hidden from it.
|
|
37
|
+
*
|
|
38
|
+
* NEITHER COLOUR AXIS. A segmented control sets a parameter of a view; it states
|
|
39
|
+
* no clinical level and names no category, so it carries neither `data-status`
|
|
40
|
+
* nor `data-category` and draws only neutral chrome. The selected segment is
|
|
41
|
+
* lifted with the card surface and a hairline rather than by a hue, so the
|
|
42
|
+
* selection survives greyscale and reads without colour, and the semantic
|
|
43
|
+
* carrier underneath it is `aria-checked` rather than any pixel at all.
|
|
44
|
+
*/
|
|
45
|
+
import { Radio } from "@base-ui/react/radio";
|
|
46
|
+
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
47
|
+
import { useLayoutEffect, useRef } from "react";
|
|
48
|
+
import { isDevelopment } from "../opsinjs.js";
|
|
49
|
+
import { cn } from "../utils.js";
|
|
50
|
+
/**
|
|
51
|
+
* Padding and type step per size, written out as literal class strings because
|
|
52
|
+
* Tailwind reads class names out of source as text and `px-opsin-${n}` generates
|
|
53
|
+
* no CSS. `md` sets the label at the headline step; `sm` is narrower and a step
|
|
54
|
+
* quieter. Neither sets a height: the target floor below is the same for both,
|
|
55
|
+
* so `sm` is narrower and never shorter, which is what density-and-touch asks
|
|
56
|
+
* of a compact control.
|
|
57
|
+
*/
|
|
58
|
+
const SIZE = {
|
|
59
|
+
sm: "px-opsin-3 py-opsin-1 text-opsin-subheadline",
|
|
60
|
+
md: "px-opsin-4 py-opsin-2 text-opsin-headline",
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The track, spelled once. A muted capsule with the decorative edge, so the row
|
|
64
|
+
* reads as one object with the options set into it; the 3:1 boundary is on the
|
|
65
|
+
* selected segment, which is the part that carries state. `inline-flex` becomes `flex w-full` when
|
|
66
|
+
* `fullWidth` is set, and tailwind-merge keeps the later `flex`. It is
|
|
67
|
+
* `relative` so the puck below is placed against it, and the named group
|
|
68
|
+
* `group/track` so the segments and the puck can read `data-glide`.
|
|
69
|
+
*
|
|
70
|
+
* The segments wrap rather than push the page sideways. At 200% text on a
|
|
71
|
+
* 390px phone three segments need about 490px, more than the screen, so the
|
|
72
|
+
* track caps itself at its container's width and breaks onto a second row,
|
|
73
|
+
* where each segment grows to fill its row (issue #39). On one row a track
|
|
74
|
+
* sized to its content has no room to give, so the growth changes nothing
|
|
75
|
+
* there. The puck is placed from both axes of the chosen
|
|
76
|
+
* segment's box, so it follows a choice onto either row. The corner radius is
|
|
77
|
+
* half of one row's height rather than `rounded-full`: on one row the two
|
|
78
|
+
* draw the same capsule, and on two rows a full radius would curve in past
|
|
79
|
+
* the corner segments.
|
|
80
|
+
*/
|
|
81
|
+
const TRACK = "group/track relative inline-flex max-w-full flex-wrap items-stretch justify-center gap-opsin-0-5 " +
|
|
82
|
+
"rounded-[calc(var(--opsin-target-minimum,2.75rem)/2+var(--opsin-space-0-5,0.125rem)+1px)] " +
|
|
83
|
+
"border border-edge bg-muted p-opsin-0-5 align-middle";
|
|
84
|
+
/**
|
|
85
|
+
* One segment, spelled once.
|
|
86
|
+
*
|
|
87
|
+
* The selected state is carried three ways so none of them is load-bearing
|
|
88
|
+
* alone: `aria-checked` for assistive technology, the `--card` surface lifting
|
|
89
|
+
* the segment off the muted track for a sighted reader, and a `--border`
|
|
90
|
+
* hairline around it for greyscale and for a reader stylesheet that strips
|
|
91
|
+
* fills. Every segment carries a transparent border in its rest state so the
|
|
92
|
+
* selected one gaining a visible border shifts nothing. Once the puck below
|
|
93
|
+
* has been placed, the track carries `data-glide` and the chosen segment hands
|
|
94
|
+
* its card, hairline and shadow to the puck, which draws exactly the same
|
|
95
|
+
* three, so the lifted look is the same before and after the script runs.
|
|
96
|
+
*
|
|
97
|
+
* The ink is written as the arbitrary property `[color:var(--foreground)]` and
|
|
98
|
+
* not `text-foreground`, for the reason `button.tsx` sets out at length:
|
|
99
|
+
* tailwind-merge files a `text-*` colour in the same conflict group as the
|
|
100
|
+
* `text-opsin-*` type step and drops one of them. The arbitrary property lands
|
|
101
|
+
* in the `color` group instead, so the ink and the size both survive. The
|
|
102
|
+
* disabled ink is the measured `--muted-foreground` chrome role rather than an
|
|
103
|
+
* opacity wash, because an `opacity` on the segment would composite the label
|
|
104
|
+
* and the fill together and drift both towards the track, which is the contrast
|
|
105
|
+
* trap the same file records.
|
|
106
|
+
*
|
|
107
|
+
* The focus ring is carried here rather than left to the product stylesheet, so
|
|
108
|
+
* a project installed without that stylesheet does not lose it. The 44pt target
|
|
109
|
+
* floor is `--opsin-target-minimum` in rem, so it grows with the reader's text
|
|
110
|
+
* size rather than pinning at a device pixel, with a literal fallback so the
|
|
111
|
+
* declaration stays valid where the generated token sheet was not installed. The
|
|
112
|
+
* floor sits on both axes, so a one-character label or the `sm` size cannot
|
|
113
|
+
* shrink a segment below the minimum hit area.
|
|
114
|
+
*/
|
|
115
|
+
const SEGMENT = "relative inline-flex grow select-none items-center justify-center whitespace-normal " +
|
|
116
|
+
"rounded-full border border-transparent align-middle text-center " +
|
|
117
|
+
"min-h-(--opsin-target-minimum,2.75rem) min-w-(--opsin-target-minimum,2.75rem) cursor-pointer [color:var(--foreground)] " +
|
|
118
|
+
"transition-colors duration-(--opsin-duration-fast) ease-opsin-standard " +
|
|
119
|
+
"data-[unchecked]:hover:bg-state-hover " +
|
|
120
|
+
"data-[checked]:border-border data-[checked]:bg-card data-[checked]:shadow-[0_1px_3px_oklch(0_0_0/0.14)] " +
|
|
121
|
+
"group-data-[glide]/track:data-[checked]:border-transparent group-data-[glide]/track:data-[checked]:bg-transparent group-data-[glide]/track:data-[checked]:shadow-none " +
|
|
122
|
+
"data-[disabled]:cursor-not-allowed data-[disabled]:[color:var(--muted-foreground)] data-[disabled]:hover:bg-transparent " +
|
|
123
|
+
"focus-visible:outline-[length:var(--opsin-border-focus,2px)] focus-visible:outline-offset-[var(--opsin-border-focus-offset,2px)] focus-visible:outline-ring";
|
|
124
|
+
/**
|
|
125
|
+
* GLIDE, the third of the five interaction motions (ADR 0031): the chosen
|
|
126
|
+
* segment's lift is one object, the puck, and it moves to the segment chosen
|
|
127
|
+
* next rather than one segment losing its card and another gaining one. The
|
|
128
|
+
* motion doctrine calls that the difference between a morph and a swap: a
|
|
129
|
+
* swap reads as a different control, and a morph reads as this control's
|
|
130
|
+
* choice moving. It travels on `spring-snap`, the spring tokens/motion.json
|
|
131
|
+
* names for a segmented control, and passes its stop by 1.5% of the distance
|
|
132
|
+
* before it settles. A choice of view is never a reading, so the overshoot is
|
|
133
|
+
* allowed.
|
|
134
|
+
*
|
|
135
|
+
* It draws the same card, hairline and shadow the chosen segment draws on its
|
|
136
|
+
* own, and sits under the labels, which are positioned and come after it, so
|
|
137
|
+
* no label moves. It is `aria-hidden` and takes no pointer events, because the
|
|
138
|
+
* state a reader depends on is still each radio's `aria-checked`.
|
|
139
|
+
*
|
|
140
|
+
* It transitions `width` and `height` as well as `translate`, which the motion
|
|
141
|
+
* foundation otherwise forbids, and this is the exception that page names. The
|
|
142
|
+
* rule exists because animating a box's size reflows everything after it, and
|
|
143
|
+
* an absolutely positioned indicator reflows nothing, while a capsule scaled
|
|
144
|
+
* to a new width would stretch its rounded ends and its hairline instead.
|
|
145
|
+
*
|
|
146
|
+
* It stays `hidden` until it has been measured, because a server render or a
|
|
147
|
+
* reader without the script has no geometry to give it, and the chosen
|
|
148
|
+
* segment draws its own lift until then. Going from `hidden` to shown starts
|
|
149
|
+
* no transition, so a row that mounts with a choice shows the puck already in
|
|
150
|
+
* place with no slide. Under `prefers-reduced-motion: reduce` `spring-snap`
|
|
151
|
+
* collapses to 0ms in the generated sheet, so the puck is under the new choice
|
|
152
|
+
* the frame after it is made.
|
|
153
|
+
*/
|
|
154
|
+
const PUCK = "pointer-events-none absolute top-0 left-0 hidden group-data-[glide]/track:block " +
|
|
155
|
+
"rounded-full border border-border bg-card shadow-[0_1px_3px_oklch(0_0_0/0.14)] " +
|
|
156
|
+
"transition-[translate,width,height] duration-(--opsin-duration-spring-snap) ease-opsin-spring-snap";
|
|
157
|
+
/**
|
|
158
|
+
* Move the puck onto the chosen segment, or hide it when nothing is chosen.
|
|
159
|
+
*
|
|
160
|
+
* It writes the geometry straight onto the element rather than through React
|
|
161
|
+
* state, because it is a measurement of what React has just laid out and
|
|
162
|
+
* setting state from a layout effect would render the row twice for nothing.
|
|
163
|
+
* The rectangles are divided by the track's own rendered scale, so a row
|
|
164
|
+
* measured while an ancestor is mid-transform, a dialog arriving from 0.95
|
|
165
|
+
* for one, is still placed in the track's own coordinates rather than shrunk
|
|
166
|
+
* by the ancestor's scale. With `animate` false the move is committed with the
|
|
167
|
+
* transition switched off, which is how a change of size, such as the reader
|
|
168
|
+
* raising their text size, re-seats the puck without a slide.
|
|
169
|
+
*/
|
|
170
|
+
function placePuck(track, puck, animate) {
|
|
171
|
+
if (!track || !puck)
|
|
172
|
+
return;
|
|
173
|
+
const chosen = track.querySelector('[data-slot="segmented-control-segment"][data-checked]');
|
|
174
|
+
if (!chosen) {
|
|
175
|
+
track.removeAttribute("data-glide");
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const from = track.getBoundingClientRect();
|
|
179
|
+
const to = chosen.getBoundingClientRect();
|
|
180
|
+
const scaleX = track.offsetWidth > 0 ? from.width / track.offsetWidth : 1;
|
|
181
|
+
const scaleY = track.offsetHeight > 0 ? from.height / track.offsetHeight : 1;
|
|
182
|
+
if (!animate)
|
|
183
|
+
puck.style.transition = "none";
|
|
184
|
+
puck.style.width = `${to.width / scaleX}px`;
|
|
185
|
+
puck.style.height = `${to.height / scaleY}px`;
|
|
186
|
+
puck.style.translate =
|
|
187
|
+
`${(to.left - from.left) / scaleX - track.clientLeft}px ` +
|
|
188
|
+
`${(to.top - from.top) / scaleY - track.clientTop}px`;
|
|
189
|
+
track.setAttribute("data-glide", "");
|
|
190
|
+
if (!animate) {
|
|
191
|
+
/* Reading layout here commits the jump before the transition comes back. */
|
|
192
|
+
puck.getBoundingClientRect();
|
|
193
|
+
puck.style.transition = "";
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Development warnings, said once per distinct offender. Nothing here has an
|
|
198
|
+
* `OpsinErrorCode`: the codes in `tokens/errors.json` describe mistakes a
|
|
199
|
+
* consumer makes with the clinical API, and a segmented control asserts nothing
|
|
200
|
+
* clinical. `button.tsx` and `disclaimer-note.tsx` keep the same small set for
|
|
201
|
+
* the same reason, and the repair, real codes in `../opsinjs.ts`, is not this
|
|
202
|
+
* file's to make.
|
|
203
|
+
*/
|
|
204
|
+
const warned = new Set();
|
|
205
|
+
function warnDev(key, message) {
|
|
206
|
+
if (!isDevelopment() || warned.has(key))
|
|
207
|
+
return;
|
|
208
|
+
warned.add(key);
|
|
209
|
+
console.warn(message);
|
|
210
|
+
}
|
|
211
|
+
export function SegmentedControl({ options, value, onValueChange, label, size = "md", fullWidth = false, className, }) {
|
|
212
|
+
const trackRef = useRef(null);
|
|
213
|
+
const puckRef = useRef(null);
|
|
214
|
+
/* Re-seat the puck, without a slide, whenever the row changes size: the
|
|
215
|
+
reader's text size, a container query or a wrapping label. */
|
|
216
|
+
useLayoutEffect(() => {
|
|
217
|
+
const track = trackRef.current;
|
|
218
|
+
if (!track || typeof ResizeObserver === "undefined")
|
|
219
|
+
return;
|
|
220
|
+
const observer = new ResizeObserver(() => placePuck(track, puckRef.current, false));
|
|
221
|
+
observer.observe(track);
|
|
222
|
+
return () => observer.disconnect();
|
|
223
|
+
}, []);
|
|
224
|
+
/* Glide to the new choice. The options, the size and the width are listed
|
|
225
|
+
because each can move the chosen segment without the row changing size. */
|
|
226
|
+
useLayoutEffect(() => {
|
|
227
|
+
placePuck(trackRef.current, puckRef.current, true);
|
|
228
|
+
}, [value, options, size, fullWidth]);
|
|
229
|
+
if (isDevelopment()) {
|
|
230
|
+
if (!Array.isArray(options) || options.length === 0) {
|
|
231
|
+
warnDev("no-options", "[opsinjs] <SegmentedControl> was rendered with no options, so it has " +
|
|
232
|
+
"nothing to draw. A segmented control is a choice between two or more " +
|
|
233
|
+
"mutually exclusive options; supply them through the `options` prop.");
|
|
234
|
+
}
|
|
235
|
+
else if (options.length === 1) {
|
|
236
|
+
warnDev("one-option", "[opsinjs] <SegmentedControl> was given a single option, which is not a " +
|
|
237
|
+
"choice. Either add the other options, or render the one thing as a " +
|
|
238
|
+
"label rather than a control the reader cannot change.");
|
|
239
|
+
}
|
|
240
|
+
if (typeof label !== "string" || label.trim() === "") {
|
|
241
|
+
warnDev("no-label", "[opsinjs] <SegmentedControl> was rendered with no `label`. The group is " +
|
|
242
|
+
"a radiogroup and needs an accessible name: without one a screen-reader " +
|
|
243
|
+
"user hears a set of radios with no idea what they select. Pass `label` " +
|
|
244
|
+
'with the name of the parameter the row sets, such as "Chart window".');
|
|
245
|
+
}
|
|
246
|
+
if (Array.isArray(options) &&
|
|
247
|
+
options.length > 0 &&
|
|
248
|
+
!options.some((option) => option.value === value)) {
|
|
249
|
+
warnDev(`value-not-in-options:${String(value)}`, `[opsinjs] <SegmentedControl value="${String(value)}"> does not match any ` +
|
|
250
|
+
"option's value, so the row renders with nothing chosen. This is a " +
|
|
251
|
+
"controlled component: pass a `value` equal to one option's `value`.");
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (!Array.isArray(options) || options.length === 0) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
return (_jsxs(RadioGroup, { ref: trackRef, "data-slot": "segmented-control", "aria-label": label, value: value, onValueChange: (next) => onValueChange(String(next)), className: cn(TRACK, fullWidth ? "flex w-full" : null, className), children: [_jsx("span", { ref: puckRef, "aria-hidden": "true", "data-slot": "segmented-control-indicator", className: PUCK }), options.map((option) => (_jsx(Radio.Root, { value: option.value, disabled: option.disabled, "data-slot": "segmented-control-segment", className: cn(SEGMENT, SIZE[size], fullWidth ? "flex-1 basis-0" : null), children: _jsx("span", { "data-slot": "segmented-control-label", className: "[text-box:trim-both_ex_alphabetic]", children: option.label }) }, option.value)))] }));
|
|
258
|
+
}
|
|
259
|
+
//# sourceMappingURL=segmented-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"segmented-control.js","sourceRoot":"","sources":["../../src/components/segmented-control.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,EAAY,MAAM,OAAO,CAAA;AAEz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