@charcuterie/ui 3.32.0 → 3.34.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/README.md +30 -0
- package/dist/AdaptiveGrid/useAdaptiveColumns.d.ts +16 -0
- package/dist/AdaptiveGrid/useAdaptiveColumns.d.ts.map +1 -1
- package/dist/AdaptiveGrid/useAdaptiveColumns.js +1 -0
- package/dist/AdaptiveGrid/useAdaptiveColumns.js.map +1 -1
- package/dist/Board/Board.d.ts.map +1 -1
- package/dist/Board/Board.js +2 -2
- package/dist/Board/Board.js.map +1 -1
- package/dist/RangeSlider/RangeSlider.d.ts +117 -0
- package/dist/RangeSlider/RangeSlider.d.ts.map +1 -0
- package/dist/RangeSlider/RangeSlider.js +242 -0
- package/dist/RangeSlider/RangeSlider.js.map +1 -0
- package/dist/RangeSlider/rangeSliderValue.d.ts +102 -0
- package/dist/RangeSlider/rangeSliderValue.d.ts.map +1 -0
- package/dist/RangeSlider/rangeSliderValue.js +116 -0
- package/dist/RangeSlider/rangeSliderValue.js.map +1 -0
- package/dist/SegmentedControl/SegmentedControl.d.ts +12 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +3 -3
- package/dist/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/SegmentedControl/SegmentedOption.d.ts +2 -1
- package/dist/SegmentedControl/SegmentedOption.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedOption.js +7 -2
- package/dist/SegmentedControl/SegmentedOption.js.map +1 -1
- package/dist/Slider/Slider.d.ts +6 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +8 -22
- package/dist/Slider/Slider.js.map +1 -1
- package/dist/TimecodeInput/TimecodeInput.d.ts +88 -0
- package/dist/TimecodeInput/TimecodeInput.d.ts.map +1 -0
- package/dist/TimecodeInput/TimecodeInput.js +258 -0
- package/dist/TimecodeInput/TimecodeInput.js.map +1 -0
- package/dist/TimecodeInput/timecode.d.ts +132 -0
- package/dist/TimecodeInput/timecode.d.ts.map +1 -0
- package/dist/TimecodeInput/timecode.js +246 -0
- package/dist/TimecodeInput/timecode.js.map +1 -0
- package/dist/VirtualizedGrid/VirtualizedGrid.d.ts +35 -0
- package/dist/VirtualizedGrid/VirtualizedGrid.d.ts.map +1 -1
- package/dist/VirtualizedGrid/VirtualizedGrid.js +37 -1
- package/dist/VirtualizedGrid/VirtualizedGrid.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/sliderStyles.d.ts +39 -0
- package/dist/sliderStyles.d.ts.map +1 -0
- package/dist/sliderStyles.js +50 -0
- package/dist/sliderStyles.js.map +1 -0
- package/package.json +1 -1
- package/src/AdaptiveGrid/useAdaptiveColumns.ts +17 -0
- package/src/Board/Board.test.tsx +8 -0
- package/src/Board/Board.tsx +7 -1
- package/src/RangeSlider/RangeSlider.mdx +85 -0
- package/src/RangeSlider/RangeSlider.stories.tsx +346 -0
- package/src/RangeSlider/RangeSlider.test.tsx +452 -0
- package/src/RangeSlider/RangeSlider.tsx +595 -0
- package/src/RangeSlider/rangeSliderValue.test.ts +217 -0
- package/src/RangeSlider/rangeSliderValue.ts +185 -0
- package/src/SegmentedControl/SegmentedControl.stories.tsx +50 -0
- package/src/SegmentedControl/SegmentedControl.test.tsx +36 -1
- package/src/SegmentedControl/SegmentedControl.tsx +14 -0
- package/src/SegmentedControl/SegmentedOption.tsx +7 -0
- package/src/Slider/Slider.tsx +23 -29
- package/src/TimecodeInput/TimecodeInput.mdx +155 -0
- package/src/TimecodeInput/TimecodeInput.stories.tsx +304 -0
- package/src/TimecodeInput/TimecodeInput.test.tsx +279 -0
- package/src/TimecodeInput/TimecodeInput.tsx +493 -0
- package/src/TimecodeInput/timecode.test.ts +236 -0
- package/src/TimecodeInput/timecode.ts +391 -0
- package/src/VirtualizedGrid/VirtualizedGrid.mdx +21 -0
- package/src/VirtualizedGrid/VirtualizedGrid.stories.tsx +64 -0
- package/src/VirtualizedGrid/VirtualizedGrid.test.tsx +122 -3
- package/src/VirtualizedGrid/VirtualizedGrid.tsx +37 -1
- package/src/index.ts +18 -0
- package/src/sliderStyles.ts +69 -0
- package/src/sourceRules.test.ts +25 -1
package/README.md
CHANGED
|
@@ -96,6 +96,36 @@ it — the class really was in the DOM, tsc never reads the CSS, and unstyled ma
|
|
|
96
96
|
axe
|
|
97
97
|
([decision](../../docs/decisions/2026-09-01-a-tile-that-acts-is-its-own-component-and-shares-only-the-box.md)).
|
|
98
98
|
|
|
99
|
+
**`TimecodeInput` is the first field the fleet could not write down twice the same way.**
|
|
100
|
+
QueuePilot is adding "play only this section of a video", and the *printing* half of a
|
|
101
|
+
timecode already exists five times — queuepilot's `clock` and `toClock`, castkit's
|
|
102
|
+
`formatTime`, and mux-magic's two modal formatters — with three different answers to whether
|
|
103
|
+
the hour is shown and two to whether the minute is padded, so the same position renders
|
|
104
|
+
differently in two panels of one app. The *reading* half exists nowhere. It is a text field
|
|
105
|
+
rather than an `<input type="time">` for the reason `Select` is deprecated and `Slider` is a
|
|
106
|
+
`div`: the platform widget is OS-painted, and it cannot carry a millisecond anyway. The
|
|
107
|
+
grammar is ordered, anchored and total — `90` is ninety seconds, `90:00` is ninety minutes,
|
|
108
|
+
and `1:90` is refused by name rather than carried into `2:30`, which is the `1:60` trap
|
|
109
|
+
mux-magic wrote down in 2023. `isRange` edits a section whose **two ends are independently
|
|
110
|
+
optional**; an inverted section swaps, and a zero-length one is refused, because a section
|
|
111
|
+
with no length plays nothing
|
|
112
|
+
([decision](../../docs/decisions/2026-09-01-a-timecode-is-milliseconds-and-a-section-is-a-mode.md)).
|
|
113
|
+
**`RangeSlider` is the two-thumb range**, and it exists because
|
|
114
|
+
[the Slider record](../../docs/decisions/2026-08-22-the-slider-is-a-div-with-role-slider-not-an-input-range.md)
|
|
115
|
+
said one would be a different widget: QueuePilot plays *only a section* of a video, so a
|
|
116
|
+
user drags two handles over a film's runtime and reads the result beside a `TimecodeInput`.
|
|
117
|
+
`Slider` puts `role="slider"`, the tab stop and the pointer target on the **track**, and two
|
|
118
|
+
values cannot live on one accessible object — so here the role moves to the thumbs, the
|
|
119
|
+
track becomes a `role="group"` carrying the label, and one tab stop becomes two. That is why
|
|
120
|
+
it is a component rather than an `isRange` mode: both halves of the test that made
|
|
121
|
+
`Combobox`'s `isMultiple` and `DatePicker`'s `isRange` modes — *the role does not change,
|
|
122
|
+
and the shared part is everything* — are false here. The thumbs **clamp** rather than swap,
|
|
123
|
+
so the handle under the pointer keeps its identity and each thumb reports the other as its
|
|
124
|
+
own `aria-valuemin`/`aria-valuemax`. What is genuinely shared is the arithmetic
|
|
125
|
+
(`Slider/sliderValue.ts`, called rather than copied) and the bar (`sliderStyles.ts`, the
|
|
126
|
+
same extraction `tileStyles.ts` is), compared as **computed** styles in the test
|
|
127
|
+
([decision](../../docs/decisions/2026-09-01-a-two-thumb-range-is-its-own-component-and-shares-the-bar.md)).
|
|
128
|
+
|
|
99
129
|
**The unified app shell adds four**: `Shell`, `Header`, `Rail`, `Main` — the fleet's largest
|
|
100
130
|
single duplication, where ten of twelve UI repos hand-roll the page chrome and three of them
|
|
101
131
|
have a file named `AppShell.tsx` (two of those headers are a *byte-identical* class string,
|
|
@@ -148,6 +148,22 @@ export declare const useAdaptiveColumns: <ContainerElement extends HTMLElement =
|
|
|
148
148
|
* ⚠️ Never the element `contentMaxInlineSize` is applied to.
|
|
149
149
|
*/
|
|
150
150
|
containerRef: RefObject<ContainerElement | null>;
|
|
151
|
+
/**
|
|
152
|
+
* Has the container been given a box yet?
|
|
153
|
+
*
|
|
154
|
+
* False in two situations that look identical from here and are
|
|
155
|
+
* both "no measurement has happened": the frame before
|
|
156
|
+
* `ResizeObserver` delivers its first record, and any time the
|
|
157
|
+
* container sits inside a `display: none` ancestor — which is
|
|
158
|
+
* what the `hidden` attribute is, and what a tab panel, a
|
|
159
|
+
* collapsed disclosure and a closed `<details>` all use.
|
|
160
|
+
*
|
|
161
|
+
* The distinction matters because a zero inline size is not a
|
|
162
|
+
* measurement of zero. It is the absence of one, and a consumer
|
|
163
|
+
* that treats it as a number lays out for a 0px container and
|
|
164
|
+
* then reads the correction as a change.
|
|
165
|
+
*/
|
|
166
|
+
isLaidOut: boolean;
|
|
151
167
|
/** What was picked, `"auto"` included. */
|
|
152
168
|
choice: ColumnChoice;
|
|
153
169
|
setChoice: (choice: ColumnChoice) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAdaptiveColumns.d.ts","sourceRoot":"","sources":["../../src/AdaptiveGrid/useAdaptiveColumns.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAStC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAStD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,MAAM,MAAM,CAAA;IACjB,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAA;CAChD,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;IACzB,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B,CAAA;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,QAChC,iBAgBF,CAAA;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,GACxC,KAAK,MAAM,KACV,iBAeD,CAAA;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,8BAG9B;IACD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,iBAA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AG;IACtB,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC5B,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,CAAA;IAC/B,KAAK,EAAE,SAAS,SAAS,EAAE,CAAA;IAC3B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;CACnC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,eAAO,MAAM,KAAK,GAAI,yFASnB,UAAU,KAAG,SAmOf,CAAA"}
|
package/dist/Board/Board.js
CHANGED
|
@@ -144,13 +144,13 @@ export const Board = ({ className, headingLevel = 3, label, laneLayout = "column
|
|
|
144
144
|
*/
|
|
145
145
|
className: toClassName("@container/board", className), children: [_jsxs("div", { className: "flex flex-col gap-3", children: [_jsx(SegmentedControl, { className: toClassName("max-w-full flex-wrap", laneLayout === "rows"
|
|
146
146
|
? "hidden"
|
|
147
|
-
: "cq-lg:hidden"), items: lanes.map((lane) => ({
|
|
147
|
+
: "cq-lg:hidden"), isFullWidth: true, items: lanes.map((lane) => ({
|
|
148
148
|
// Stacked rather than `Todo (6)`, because the count is
|
|
149
149
|
// the reason to look: a lane picker that reads
|
|
150
150
|
// "In Progress (5)" on one line is a long label with a
|
|
151
151
|
// number in it, and at 15rem three of them do not fit
|
|
152
152
|
// on any line at all.
|
|
153
|
-
label: (_jsxs("span", { className: "flex flex-col items-center leading-tight", children: [_jsx("span", { children: lane.label }), _jsx("span", { className: "font-normal text-content-muted text-xs", children: String(lane.itemCount ?? lane.items.length) })] })),
|
|
153
|
+
label: (_jsxs("span", { className: "flex flex-col items-center leading-tight", children: [_jsx("span", { className: "block whitespace-nowrap", children: lane.label }), _jsx("span", { className: "font-normal text-content-muted text-xs", children: String(lane.itemCount ?? lane.items.length) })] })),
|
|
154
154
|
value: lane.key,
|
|
155
155
|
})), label: `${label} lanes`, onChange: (value) => {
|
|
156
156
|
setVisibleLaneKey(value ?? "");
|
package/dist/Board/Board.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Board.js","sourceRoot":"","sources":["../../src/Board/Board.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAA0C,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAsC,CAAA;AAErE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAqB,CAAA;AACnD,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,cAAc,GACf,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAsEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EACpB,SAAS,EACT,YAAY,GAAG,CAAC,EAChB,KAAK,EACL,UAAU,GAAG,SAAS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O,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,CAAC;wCAClC,SAAS;qCACV,CAAC,CAAA;gCACJ,CAAC;gCACH,CAAC,CAAC,SAAS,EAEf,WAAW,EACT,MAAM;gCACJ,CAAC,CAAC,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE;oCACvB,SAAS,CAAC,YAAY,EAAE;wCACtB,GAAG,MAAM;wCACT,WAAW,EAAE,IAAI,CAAC,GAAG;qCACtB,CAAC,CAAA;gCACJ,CAAC;gCACH,CAAC,CAAC,SAAS,EAEf,mBAAmB,EAAE,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,IA3CtC,IAAI,CAAC,GAAG,CA4Cb,CACH,CAAC,GACE,IACF,EAQN,KAAC,cAAc,kBACD,GAAG,KAAK,WAAW,EAC/B,IAAI,EAAC,QAAQ,YAEZ,gBAAgB,GACF,IACT,CACX,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { IntentName } from "@charcuterie/tokens";
|
|
2
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
3
|
+
import type { SliderSize } from "../sliderStyles.ts";
|
|
4
|
+
import type { RangeSliderValue } from "./rangeSliderValue.ts";
|
|
5
|
+
/**
|
|
6
|
+
* A position along the range, drawn as a mark on the bar.
|
|
7
|
+
*
|
|
8
|
+
* Prop-driven and nothing more: a chapter list, a scene index, a set
|
|
9
|
+
* of preset prices. The component holds no model of what a tick
|
|
10
|
+
* means, and `label` is optional because a mark that needs no words
|
|
11
|
+
* is the common case.
|
|
12
|
+
*/
|
|
13
|
+
export type RangeSliderTick = {
|
|
14
|
+
label?: string;
|
|
15
|
+
value: number;
|
|
16
|
+
};
|
|
17
|
+
export type RangeSliderProps = Omit<ComponentPropsWithRef<"div">, "children" | "defaultValue" | "onChange"> & {
|
|
18
|
+
intent?: IntentName;
|
|
19
|
+
isDisabled?: boolean;
|
|
20
|
+
isLabelVisible?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Read-only in the `aria-readonly` sense: focusable, full contrast,
|
|
23
|
+
* announced as unchangeable — the same distinction `Slider` draws.
|
|
24
|
+
* A clip already sent to a renderer is this, not `isDisabled`: the
|
|
25
|
+
* span is still worth reading.
|
|
26
|
+
*/
|
|
27
|
+
isReadOnly?: boolean;
|
|
28
|
+
isValueShown?: boolean;
|
|
29
|
+
/** Required. Each thumb's own name is built from it. */
|
|
30
|
+
label: string;
|
|
31
|
+
/** PageUp / PageDown. Defaults to a tenth of the range, as `Slider`'s does. */
|
|
32
|
+
largeStep?: number;
|
|
33
|
+
max?: number;
|
|
34
|
+
min?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Fires on every movement — each arrow key, and each pointer sample
|
|
37
|
+
* while dragging. Use it to paint. See `onChangeEnd` for committing.
|
|
38
|
+
*/
|
|
39
|
+
onChange?: (value: RangeSliderValue) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Fires once, when the interaction ends: pointer release, or key up.
|
|
42
|
+
*
|
|
43
|
+
* The same split `Slider` settled, for the same reason. A clip
|
|
44
|
+
* preview that re-seeks a player from `onChange` issues one seek per
|
|
45
|
+
* pointer sample and arrives at the right frame **last**, behind a
|
|
46
|
+
* queue of stale ones.
|
|
47
|
+
*/
|
|
48
|
+
onChangeEnd?: (value: RangeSliderValue) => void;
|
|
49
|
+
size?: SliderSize;
|
|
50
|
+
step?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Marks along the bar. Positions in the same units as `value`, so a
|
|
53
|
+
* film's chapters are the offsets the app already has.
|
|
54
|
+
*
|
|
55
|
+
* A `label` is centred on its own mark and clamped inside the bar at
|
|
56
|
+
* both ends. Two marks closer together than a label box will overlap:
|
|
57
|
+
* the component draws what it is given, and a caller with dense marks
|
|
58
|
+
* passes the words only where there is room for them.
|
|
59
|
+
*/
|
|
60
|
+
ticks?: readonly RangeSliderTick[];
|
|
61
|
+
/**
|
|
62
|
+
* Seeds the range; it does not control it. A drag paints from the
|
|
63
|
+
* component's own value, so a caller that commits on `onChangeEnd`
|
|
64
|
+
* alone still sees the thumbs follow the pointer.
|
|
65
|
+
*/
|
|
66
|
+
value?: RangeSliderValue;
|
|
67
|
+
/**
|
|
68
|
+
* How each end reads aloud and, when `isValueShown`, on screen.
|
|
69
|
+
* This is what keeps timecodes out of the library: the component
|
|
70
|
+
* knows a number, the app knows it is 21:14.
|
|
71
|
+
*/
|
|
72
|
+
valueFormat?: (value: number) => string;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* A two-thumb range control: a span picked out along a bar, with an
|
|
76
|
+
* independently focusable handle at each end.
|
|
77
|
+
*
|
|
78
|
+
* It exists because QueuePilot lets a user play **only a section** of
|
|
79
|
+
* a video, and a clip's start and end are a shape `Slider` states it
|
|
80
|
+
* is not: *"a two-thumb range is a different widget with its own
|
|
81
|
+
* focus model"*
|
|
82
|
+
* ([decision](../../../../docs/decisions/2026-09-01-a-two-thumb-range-is-its-own-component-and-shares-the-bar.md)).
|
|
83
|
+
*
|
|
84
|
+
* ## Why this is a component and not `Slider isRange`
|
|
85
|
+
*
|
|
86
|
+
* `Combobox`'s `isMultiple` and `DatePicker`'s `isRange` are modes
|
|
87
|
+
* because neither changes the widget's role and both share nearly
|
|
88
|
+
* everything. Both halves of that test fail here.
|
|
89
|
+
*
|
|
90
|
+
* `Slider` puts `role="slider"`, the tab stop and the pointer target
|
|
91
|
+
* **on the track**, because one track reports one value. Two values
|
|
92
|
+
* cannot live on one accessible object, so here the role moves to the
|
|
93
|
+
* thumbs, the track becomes a `role="group"` carrying the label, and
|
|
94
|
+
* the tab stops go from one to two. A mode that rewrote its own role
|
|
95
|
+
* would break `getByRole("slider", { name })` in every consumer that
|
|
96
|
+
* had ever used the single-value one.
|
|
97
|
+
*
|
|
98
|
+
* What the two genuinely share is the arithmetic
|
|
99
|
+
* (`Slider/sliderValue.ts`, called rather than copied) and the bar
|
|
100
|
+
* (`../sliderStyles.ts`) — so a range slider snaps on the same grid
|
|
101
|
+
* and paints as the same control.
|
|
102
|
+
*
|
|
103
|
+
* ## The thumbs clamp, they do not swap
|
|
104
|
+
*
|
|
105
|
+
* A thumb dragged past its partner stops on it and the range collapses
|
|
106
|
+
* to zero width. The thumbs never trade identities mid-drag: the
|
|
107
|
+
* handle under the pointer is the one the user grabbed, and the
|
|
108
|
+
* focused handle is the one an arrow key moves. Each thumb reports the
|
|
109
|
+
* other as its own `aria-valuemin` / `aria-valuemax`, which is how a
|
|
110
|
+
* screen reader is told where this handle stops.
|
|
111
|
+
*
|
|
112
|
+
* A press on the bar moves the **nearer** thumb. When the two sit on
|
|
113
|
+
* the same value, the press's side decides — which is what lets a
|
|
114
|
+
* collapsed range be pulled open again in either direction.
|
|
115
|
+
*/
|
|
116
|
+
export declare const RangeSlider: ({ className, intent, isDisabled, isLabelVisible, isReadOnly, isValueShown, label, largeStep, max, min, onChange, onChangeEnd, size, step, ticks, value, valueFormat, ...divProps }: RangeSliderProps) => ReactNode;
|
|
117
|
+
//# sourceMappingURL=RangeSlider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangeSlider.d.ts","sourceRoot":"","sources":["../../src/RangeSlider/RangeSlider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EACV,qBAAqB,EAGrB,SAAS,EACV,MAAM,OAAO,CAAA;AAWd,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAWpD,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAQ9B;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,qBAAqB,CAAC,KAAK,CAAC,EAC5B,UAAU,GAAG,cAAc,GAAG,UAAU,CACzC,GAAG;IACF,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAA;IACb,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC5C;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC/C,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,SAAS,eAAe,EAAE,CAAA;IAClC;;;;OAIG;IACH,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACxB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CACxC,CAAA;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,WAAW,GAAI,oLAmBzB,gBAAgB,KAAG,SA8ZrB,CAAA"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useUniqueId } from "@charcuterie/logic";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { FOCUS_RING_CLASS, INTENT_SOLID_FILL_CLASS, } from "../intentStyles.js";
|
|
5
|
+
import { fromFraction, toPercent, } from "../Slider/sliderValue.js";
|
|
6
|
+
import { SLIDER_ROW_CLASS, SLIDER_THUMB_CLASS, SLIDER_THUMB_OFFSET, SLIDER_THUMB_SIZE_CLASS, SLIDER_TRACK_CLASS, SLIDER_TRACK_SIZE_CLASS, } from "../sliderStyles.js";
|
|
7
|
+
import { toClassName } from "../toClassName.js";
|
|
8
|
+
import { VisuallyHidden } from "../VisuallyHidden/VisuallyHidden.js";
|
|
9
|
+
import { getNearerThumb, getThumbBounds, moveThumb, snapRange, } from "./rangeSliderValue.js";
|
|
10
|
+
/** Half the tick-label box, which is what centres it on its mark. */
|
|
11
|
+
const TICK_LABEL_INLINE_SIZE = "4.5rem";
|
|
12
|
+
const TICK_LABEL_HALF = "2.25rem";
|
|
13
|
+
/**
|
|
14
|
+
* A two-thumb range control: a span picked out along a bar, with an
|
|
15
|
+
* independently focusable handle at each end.
|
|
16
|
+
*
|
|
17
|
+
* It exists because QueuePilot lets a user play **only a section** of
|
|
18
|
+
* a video, and a clip's start and end are a shape `Slider` states it
|
|
19
|
+
* is not: *"a two-thumb range is a different widget with its own
|
|
20
|
+
* focus model"*
|
|
21
|
+
* ([decision](../../../../docs/decisions/2026-09-01-a-two-thumb-range-is-its-own-component-and-shares-the-bar.md)).
|
|
22
|
+
*
|
|
23
|
+
* ## Why this is a component and not `Slider isRange`
|
|
24
|
+
*
|
|
25
|
+
* `Combobox`'s `isMultiple` and `DatePicker`'s `isRange` are modes
|
|
26
|
+
* because neither changes the widget's role and both share nearly
|
|
27
|
+
* everything. Both halves of that test fail here.
|
|
28
|
+
*
|
|
29
|
+
* `Slider` puts `role="slider"`, the tab stop and the pointer target
|
|
30
|
+
* **on the track**, because one track reports one value. Two values
|
|
31
|
+
* cannot live on one accessible object, so here the role moves to the
|
|
32
|
+
* thumbs, the track becomes a `role="group"` carrying the label, and
|
|
33
|
+
* the tab stops go from one to two. A mode that rewrote its own role
|
|
34
|
+
* would break `getByRole("slider", { name })` in every consumer that
|
|
35
|
+
* had ever used the single-value one.
|
|
36
|
+
*
|
|
37
|
+
* What the two genuinely share is the arithmetic
|
|
38
|
+
* (`Slider/sliderValue.ts`, called rather than copied) and the bar
|
|
39
|
+
* (`../sliderStyles.ts`) — so a range slider snaps on the same grid
|
|
40
|
+
* and paints as the same control.
|
|
41
|
+
*
|
|
42
|
+
* ## The thumbs clamp, they do not swap
|
|
43
|
+
*
|
|
44
|
+
* A thumb dragged past its partner stops on it and the range collapses
|
|
45
|
+
* to zero width. The thumbs never trade identities mid-drag: the
|
|
46
|
+
* handle under the pointer is the one the user grabbed, and the
|
|
47
|
+
* focused handle is the one an arrow key moves. Each thumb reports the
|
|
48
|
+
* other as its own `aria-valuemin` / `aria-valuemax`, which is how a
|
|
49
|
+
* screen reader is told where this handle stops.
|
|
50
|
+
*
|
|
51
|
+
* A press on the bar moves the **nearer** thumb. When the two sit on
|
|
52
|
+
* the same value, the press's side decides — which is what lets a
|
|
53
|
+
* collapsed range be pulled open again in either direction.
|
|
54
|
+
*/
|
|
55
|
+
export const RangeSlider = ({ className, intent = "accent", isDisabled = false, isLabelVisible = false, isReadOnly = false, isValueShown = false, label, largeStep, max = 100, min = 0, onChange, onChangeEnd, size = "md", step = 1, ticks, value = { end: max, start: min }, valueFormat, ...divProps }) => {
|
|
56
|
+
const labelId = useUniqueId();
|
|
57
|
+
const trackRef = useRef(null);
|
|
58
|
+
const startThumbRef = useRef(null);
|
|
59
|
+
const endThumbRef = useRef(null);
|
|
60
|
+
// Null means "not dragging". The thumb rides along with the value
|
|
61
|
+
// because a drag has to keep moving the handle it picked up, even
|
|
62
|
+
// once the pointer has travelled past the other one and the "nearer"
|
|
63
|
+
// answer has changed.
|
|
64
|
+
const [drag, setDrag] = useState(null);
|
|
65
|
+
const isInert = isDisabled || isReadOnly;
|
|
66
|
+
const bounds = { max, min, step };
|
|
67
|
+
const committed = snapRange(value, bounds);
|
|
68
|
+
const shown = drag?.range ?? committed;
|
|
69
|
+
const bigStep = largeStep == null
|
|
70
|
+
? (Math.max(min, max) - Math.min(min, max)) / 10
|
|
71
|
+
: largeStep;
|
|
72
|
+
const startPercent = toPercent(shown.start, min, max);
|
|
73
|
+
const endPercent = toPercent(shown.end, min, max);
|
|
74
|
+
const emit = (next, thumb, isEnd) => {
|
|
75
|
+
if (next.start !== shown.start ||
|
|
76
|
+
next.end !== shown.end) {
|
|
77
|
+
onChange?.(next);
|
|
78
|
+
}
|
|
79
|
+
if (isEnd) {
|
|
80
|
+
setDrag(null);
|
|
81
|
+
onChangeEnd?.(next);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
setDrag({ range: next, thumb });
|
|
85
|
+
};
|
|
86
|
+
/** The value the pointer at `clientX` is pointing at. */
|
|
87
|
+
const valueAt = (clientX) => {
|
|
88
|
+
const track = trackRef.current;
|
|
89
|
+
if (!track)
|
|
90
|
+
return shown.start;
|
|
91
|
+
const box = track.getBoundingClientRect();
|
|
92
|
+
if (box.width <= 0)
|
|
93
|
+
return shown.start;
|
|
94
|
+
// `left`/`width` are physical, from the layout box, and stay
|
|
95
|
+
// physical on purpose — `isRtl` is what turns them into a value.
|
|
96
|
+
// The logical-properties rule is about `className`, not geometry.
|
|
97
|
+
const fraction = (clientX - box.left) / box.width;
|
|
98
|
+
const isRtl = getComputedStyle(track).direction === "rtl";
|
|
99
|
+
return fromFraction(fraction, min, max, step, isRtl);
|
|
100
|
+
};
|
|
101
|
+
const onPointerDown = (event) => {
|
|
102
|
+
if (isInert || event.button !== 0)
|
|
103
|
+
return;
|
|
104
|
+
// The press is ours, and the default is what would undo it: a
|
|
105
|
+
// mousedown on a non-focusable element moves focus to the body,
|
|
106
|
+
// so the handle this handler just focused would lose it again a
|
|
107
|
+
// tick later. `Slider` never needed this because its pointer
|
|
108
|
+
// target IS its focusable element; here the bar is the target and
|
|
109
|
+
// the thumb is the tab stop.
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
const at = valueAt(event.clientX);
|
|
112
|
+
const thumb = getNearerThumb({ at, range: shown });
|
|
113
|
+
// Capture on the GROUP rather than on the thumb, so a drag that
|
|
114
|
+
// leaves the bar vertically keeps reporting — and so a fast drag
|
|
115
|
+
// that outruns the thumb it is moving does not hand the pointer to
|
|
116
|
+
// the element underneath.
|
|
117
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
118
|
+
// Focus follows the grab. A pointer user who then reaches for the
|
|
119
|
+
// arrow keys is moving the handle they were just dragging, which
|
|
120
|
+
// is the only answer that does not need looking at.
|
|
121
|
+
//
|
|
122
|
+
// The handle wears its focus ring for the length of the drag,
|
|
123
|
+
// which is a script `focus()` matching `:focus-visible`. On a
|
|
124
|
+
// one-thumb control that would be the ring-after-a-click the house
|
|
125
|
+
// style rejects; here it is the answer to "which of the two am I
|
|
126
|
+
// holding", and it is the same mark the keyboard path leaves.
|
|
127
|
+
const thumbElement = thumb === "start"
|
|
128
|
+
? startThumbRef.current
|
|
129
|
+
: endThumbRef.current;
|
|
130
|
+
thumbElement?.focus();
|
|
131
|
+
emit(moveThumb({ bounds, next: at, range: shown, thumb }), thumb, false);
|
|
132
|
+
};
|
|
133
|
+
const onPointerMove = (event) => {
|
|
134
|
+
if (isInert || drag == null)
|
|
135
|
+
return;
|
|
136
|
+
emit(moveThumb({
|
|
137
|
+
bounds,
|
|
138
|
+
next: valueAt(event.clientX),
|
|
139
|
+
range: shown,
|
|
140
|
+
thumb: drag.thumb,
|
|
141
|
+
}), drag.thumb, false);
|
|
142
|
+
};
|
|
143
|
+
const onPointerUp = (event) => {
|
|
144
|
+
if (isInert || drag == null)
|
|
145
|
+
return;
|
|
146
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
147
|
+
emit(moveThumb({
|
|
148
|
+
bounds,
|
|
149
|
+
next: valueAt(event.clientX),
|
|
150
|
+
range: shown,
|
|
151
|
+
thumb: drag.thumb,
|
|
152
|
+
}), drag.thumb, true);
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* `Slider`'s key handling, per thumb. Home and End are absolute and
|
|
156
|
+
* are clamped at the other thumb like any other movement, so End on
|
|
157
|
+
* the start handle means "as far right as this handle goes".
|
|
158
|
+
*/
|
|
159
|
+
const getKeyedValue = (event, current) => {
|
|
160
|
+
switch (event.key) {
|
|
161
|
+
case "ArrowDown":
|
|
162
|
+
case "ArrowLeft":
|
|
163
|
+
return current - step;
|
|
164
|
+
case "ArrowRight":
|
|
165
|
+
case "ArrowUp":
|
|
166
|
+
return current + step;
|
|
167
|
+
case "End":
|
|
168
|
+
return Math.max(min, max);
|
|
169
|
+
case "Home":
|
|
170
|
+
return Math.min(min, max);
|
|
171
|
+
case "PageDown":
|
|
172
|
+
return current - bigStep;
|
|
173
|
+
case "PageUp":
|
|
174
|
+
return current + bigStep;
|
|
175
|
+
default:
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
const onThumbKeyDown = (thumb) => (event) => {
|
|
180
|
+
if (isInert)
|
|
181
|
+
return;
|
|
182
|
+
const next = getKeyedValue(event, shown[thumb]);
|
|
183
|
+
if (next == null)
|
|
184
|
+
return;
|
|
185
|
+
event.preventDefault();
|
|
186
|
+
// Keys commit immediately, as `Slider`'s do: a key press is a
|
|
187
|
+
// discrete interaction with no release to wait for.
|
|
188
|
+
emit(moveThumb({ bounds, next, range: shown, thumb }), thumb, true);
|
|
189
|
+
};
|
|
190
|
+
const renderThumb = (thumb) => {
|
|
191
|
+
const thumbBounds = getThumbBounds({
|
|
192
|
+
bounds,
|
|
193
|
+
range: shown,
|
|
194
|
+
thumb,
|
|
195
|
+
});
|
|
196
|
+
const percent = thumb === "start" ? startPercent : endPercent;
|
|
197
|
+
return (_jsx("span", { "aria-disabled": isDisabled || undefined, "aria-label": `${label} ${thumb}`, "aria-orientation": "horizontal", "aria-readonly": isReadOnly || undefined, "aria-valuemax": thumbBounds.max, "aria-valuemin": thumbBounds.min, "aria-valuenow": shown[thumb], "aria-valuetext": valueFormat?.(shown[thumb]), className: toClassName(SLIDER_THUMB_CLASS, SLIDER_THUMB_SIZE_CLASS[size], INTENT_SOLID_FILL_CLASS[intent], FOCUS_RING_CLASS, isReadOnly ? "cursor-default" : ""), onKeyDown: onThumbKeyDown(thumb), ref: thumb === "start" ? startThumbRef : endThumbRef, role: "slider",
|
|
198
|
+
// Pulled back by half its own width so it sits ON the value
|
|
199
|
+
// rather than starting at it. `margin-inline-start`, not
|
|
200
|
+
// `translate: -50%`: `translate` is physical, so in RTL it
|
|
201
|
+
// would shift the thumb the wrong way and 0% would hang off
|
|
202
|
+
// the start edge.
|
|
203
|
+
style: {
|
|
204
|
+
insetInlineStart: `${percent}%`,
|
|
205
|
+
marginInlineStart: SLIDER_THUMB_OFFSET[size],
|
|
206
|
+
}, tabIndex: isDisabled ? -1 : 0 }, thumb));
|
|
207
|
+
};
|
|
208
|
+
const shownText = valueFormat == null
|
|
209
|
+
? `${shown.start} to ${shown.end}`
|
|
210
|
+
: `${valueFormat(shown.start)} to ${valueFormat(shown.end)}`;
|
|
211
|
+
return (_jsxs("div", { ...divProps, className: toClassName("flex flex-col gap-1",
|
|
212
|
+
// A definite floor, for `Slider`'s reason: the root has no
|
|
213
|
+
// intrinsic width of its own, so in a shrink-to-fit parent it
|
|
214
|
+
// would collapse to the width of a thumb with every gate
|
|
215
|
+
// still green.
|
|
216
|
+
"min-w-40", className), children: [isLabelVisible || isValueShown ? (_jsxs("div", { className: "flex items-baseline justify-between gap-2 text-sm", children: [isLabelVisible ? (_jsx("span", { className: "text-content-secondary", id: labelId, children: label })) : (_jsx(VisuallyHidden, { id: labelId, children: label })), isValueShown ? (_jsx("span", { className: "text-content-muted tabular-nums", children: shownText })) : null] })) : (_jsx(VisuallyHidden, { id: labelId, children: label })), _jsxs("div", { "aria-labelledby": labelId, className: toClassName(SLIDER_ROW_CLASS,
|
|
217
|
+
// NOT `ARIA_DISABLED_CLASS`, for the reason `Slider` gives:
|
|
218
|
+
// that constant paints a box-shaped control, and this
|
|
219
|
+
// control's body is a 2px bar inside a 40px row.
|
|
220
|
+
//
|
|
221
|
+
// `pointer-events-none` is load-bearing rather than
|
|
222
|
+
// cosmetic — without a real `:disabled` the hover rules
|
|
223
|
+
// still match.
|
|
224
|
+
isDisabled
|
|
225
|
+
? "pointer-events-none opacity-55"
|
|
226
|
+
: "", isReadOnly ? "cursor-default" : ""), onPointerCancel: onPointerUp, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, ref: trackRef, role: "group", children: [_jsx("span", { className: toClassName(SLIDER_TRACK_CLASS, SLIDER_TRACK_SIZE_CLASS[size]), children: _jsx("span", { className: toClassName("block h-full rounded-full", INTENT_SOLID_FILL_CLASS[intent]), style: {
|
|
227
|
+
inlineSize: `${endPercent - startPercent}%`,
|
|
228
|
+
marginInlineStart: `${startPercent}%`,
|
|
229
|
+
} }) }), ticks?.map((tick) => (_jsx("span", { "aria-hidden": "true", className: "absolute h-2 w-px bg-border-strong", style: {
|
|
230
|
+
insetInlineStart: `${toPercent(tick.value, min, max)}%`,
|
|
231
|
+
} }, tick.value))), renderThumb("start"), renderThumb("end")] }), ticks?.some((tick) => tick.label != null) ? (_jsx("div", { "aria-hidden": "true", className: "relative h-4 w-full text-content-muted text-xs", children: ticks.map((tick) => tick.label == null ? null : (_jsx("span", { className: "absolute text-center",
|
|
232
|
+
// Centred on its mark, and `clamp`ed so the first and
|
|
233
|
+
// last labels stay inside the bar instead of hanging
|
|
234
|
+
// off its ends. A fixed box is what makes the centring
|
|
235
|
+
// possible at all: the label's own width is not known
|
|
236
|
+
// here, and `translate: -50%` is physical.
|
|
237
|
+
style: {
|
|
238
|
+
inlineSize: TICK_LABEL_INLINE_SIZE,
|
|
239
|
+
insetInlineStart: `clamp(0rem, calc(${toPercent(tick.value, min, max)}% - ${TICK_LABEL_HALF}), calc(100% - ${TICK_LABEL_INLINE_SIZE}))`,
|
|
240
|
+
}, children: tick.label }, tick.value))) })) : null] }));
|
|
241
|
+
};
|
|
242
|
+
//# sourceMappingURL=RangeSlider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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C,CAAC,IAAI,IACJ,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The arithmetic behind `RangeSlider`: everything the second thumb
|
|
3
|
+
* adds to `Slider`'s, and nothing `Slider` already answers.
|
|
4
|
+
*
|
|
5
|
+
* The single-value functions are **called**, never re-derived —
|
|
6
|
+
* `snapToStep` and `clampToRange` come from `../Slider/sliderValue.ts`
|
|
7
|
+
* — so a range slider snaps on exactly the grid a plain slider snaps
|
|
8
|
+
* on. Anchoring on `min` rather than on zero, the re-clamp after a
|
|
9
|
+
* snap, and the float-step rounding are all already right there, and
|
|
10
|
+
* a second copy of them is a second set of edge cases to keep in
|
|
11
|
+
* agreement.
|
|
12
|
+
*
|
|
13
|
+
* Every function here is total. A caller may hand over a reversed
|
|
14
|
+
* range, a `NaN`, or a start past its end, and the answer is still a
|
|
15
|
+
* pair of numbers inside `[min, max]` with `start <= end`. A range
|
|
16
|
+
* that renders `inline-size: NaN%` paints nothing and the DOM says
|
|
17
|
+
* nothing about it.
|
|
18
|
+
*/
|
|
19
|
+
/** Which end of the range a movement is about. */
|
|
20
|
+
export type RangeSliderThumb = "end" | "start";
|
|
21
|
+
export type RangeSliderValue = {
|
|
22
|
+
end: number;
|
|
23
|
+
start: number;
|
|
24
|
+
};
|
|
25
|
+
export type RangeSliderBounds = {
|
|
26
|
+
max: number;
|
|
27
|
+
min: number;
|
|
28
|
+
step: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Both ends snapped to the step grid, clamped into the range, and put
|
|
32
|
+
* in order.
|
|
33
|
+
*
|
|
34
|
+
* The ordering is not a nicety. `value` **seeds** rather than
|
|
35
|
+
* controls, exactly as `Slider`'s does, so the pair arrives from an
|
|
36
|
+
* app's state and an app can hold `{ end: 20, start: 80 }` for a
|
|
37
|
+
* frame — a text field committing a typed start before the end
|
|
38
|
+
* catches up is the ordinary way to reach it. A backwards pair paints
|
|
39
|
+
* a fill of negative width, which is invisible rather than wrong-
|
|
40
|
+
* looking, so it is corrected here instead.
|
|
41
|
+
*/
|
|
42
|
+
export declare const snapRange: (range: RangeSliderValue, { max, min, step }: RangeSliderBounds) => RangeSliderValue;
|
|
43
|
+
/**
|
|
44
|
+
* The range with one thumb moved to `next`, clamped at the other one.
|
|
45
|
+
*
|
|
46
|
+
* **The thumbs clamp; they do not swap.** A thumb pushed past its
|
|
47
|
+
* partner stops on it, keeps its own identity, and the range collapses
|
|
48
|
+
* to zero width rather than turning inside out. Swapping is the other
|
|
49
|
+
* defensible answer and is the wrong one for the first consumer: the
|
|
50
|
+
* thumbs are a clip's start and its end, a QueuePilot user drags them
|
|
51
|
+
* against a `TimecodeInput` showing which is which, and a drag that
|
|
52
|
+
* silently renamed the handle under the pointer would move a number
|
|
53
|
+
* the user is reading somewhere else. Keyboard makes it plainer still
|
|
54
|
+
* — swapping means one ArrowRight moves the *other* thumb, and the
|
|
55
|
+
* focused element is no longer the value that changed.
|
|
56
|
+
*
|
|
57
|
+
* The snap happens on the **global** grid before the clamp, never on
|
|
58
|
+
* a grid anchored at the other thumb: the partner is already on the
|
|
59
|
+
* grid, so clamping to it lands on the grid too, while snapping
|
|
60
|
+
* against a moving anchor would put the two thumbs on different
|
|
61
|
+
* ladders.
|
|
62
|
+
*/
|
|
63
|
+
export declare const moveThumb: ({ bounds, next, range, thumb, }: {
|
|
64
|
+
bounds: RangeSliderBounds;
|
|
65
|
+
next: number;
|
|
66
|
+
range: RangeSliderValue;
|
|
67
|
+
thumb: RangeSliderThumb;
|
|
68
|
+
}) => RangeSliderValue;
|
|
69
|
+
/**
|
|
70
|
+
* The thumb a press at `at` should pick up.
|
|
71
|
+
*
|
|
72
|
+
* The nearer one, and the tie is the interesting half: two thumbs
|
|
73
|
+
* sitting on the same value are the state the clamping rule makes
|
|
74
|
+
* reachable, and a rule that always picked the same one would leave a
|
|
75
|
+
* collapsed range stuck against whichever end it collapsed on. So a
|
|
76
|
+
* tie is broken by **which side of them the press landed on** —
|
|
77
|
+
* below picks the start, on or above picks the end — which is what
|
|
78
|
+
* lets a collapsed pair be pulled open in either direction.
|
|
79
|
+
*/
|
|
80
|
+
export declare const getNearerThumb: ({ at, range, }: {
|
|
81
|
+
at: number;
|
|
82
|
+
range: RangeSliderValue;
|
|
83
|
+
}) => RangeSliderThumb;
|
|
84
|
+
/**
|
|
85
|
+
* What one thumb may report as its own `aria-valuemin` /
|
|
86
|
+
* `aria-valuemax`.
|
|
87
|
+
*
|
|
88
|
+
* The other thumb is the bound, which is how the clamping rule
|
|
89
|
+
* reaches assistive technology at all: a screen reader reading
|
|
90
|
+
* "12 of 0 to 30" on the start thumb is being told, in the only
|
|
91
|
+
* vocabulary a slider has, that 30 is where this handle stops. The
|
|
92
|
+
* APG's multi-thumb pattern asks for exactly this.
|
|
93
|
+
*/
|
|
94
|
+
export declare const getThumbBounds: ({ bounds, range, thumb, }: {
|
|
95
|
+
bounds: RangeSliderBounds;
|
|
96
|
+
range: RangeSliderValue;
|
|
97
|
+
thumb: RangeSliderThumb;
|
|
98
|
+
}) => {
|
|
99
|
+
max: number;
|
|
100
|
+
min: number;
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=rangeSliderValue.d.ts.map
|