strata-react 1.0.39 → 1.0.41
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 +29 -5
- package/UPGRADING.md +11 -0
- package/bin/strata-stock-classes.js +5 -0
- package/dist/components/button.d.ts +3 -0
- package/dist/components/checkbox.d.ts +3 -2
- package/dist/components/compare-parts.d.ts +25 -0
- package/dist/components/compare-video.d.ts +4 -2
- package/dist/components/compare.d.ts +4 -2
- package/dist/components/secret-field.d.ts +34 -0
- package/dist/components/selection.d.ts +45 -1
- package/dist/components/toast.d.ts +3 -2
- package/dist/components/transcript-view.d.ts +18 -2
- package/dist/components/tree.d.ts +16 -6
- package/dist/components/value-controls.d.ts +20 -4
- package/dist/{query-CJ1pSPiC.js → errors-BunUBqpA.js} +5 -176
- package/dist/errors-BunUBqpA.js.map +1 -0
- package/dist/{field-7Z4N5r5g.js → field-DeKNvGox.js} +74 -5
- package/dist/field-DeKNvGox.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +847 -332
- package/dist/index.js.map +1 -1
- package/dist/lib/choice.d.ts +29 -0
- package/dist/lib/transcript.d.ts +16 -0
- package/dist/map.js +2 -2
- package/dist/migrate/cli.d.ts +2 -0
- package/dist/migrate/stock-classes.d.ts +11 -0
- package/dist/migrate-cli.js +128 -0
- package/dist/migrate-cli.js.map +1 -0
- package/dist/panorama.js +2 -2
- package/dist/query-B934ufsW.js +209 -0
- package/dist/query-B934ufsW.js.map +1 -0
- package/dist/strata.css +6 -0
- package/dist/strata.migrate.css +224 -0
- package/dist/testing.js +2 -2
- package/dist/{theme-CFNi6WUO.js → theme-DVaIxyNn.js} +6 -75
- package/dist/theme-DVaIxyNn.js.map +1 -0
- package/dist/value-controls-FO4zQiHP.js +735 -0
- package/dist/value-controls-FO4zQiHP.js.map +1 -0
- package/package.json +7 -2
- package/dist/field-7Z4N5r5g.js.map +0 -1
- package/dist/query-CJ1pSPiC.js.map +0 -1
- package/dist/theme-CFNi6WUO.js.map +0 -1
- package/dist/value-controls-D6O9TsM6.js +0 -356
- package/dist/value-controls-D6O9TsM6.js.map +0 -1
|
@@ -1,356 +0,0 @@
|
|
|
1
|
-
import { c as cn, o as useFieldControl, s as controlHeight } from "./field-7Z4N5r5g.js";
|
|
2
|
-
import { i as format } from "./format-B32-PVi2.js";
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { I18nProvider, Input, NumberField, Slider, SliderOutput, SliderThumb, SliderTrack } from "react-aria-components";
|
|
5
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
// src/lib/in-view.ts
|
|
7
|
-
/**
|
|
8
|
-
* Whether an element is within `rootMargin` of its scroll region (the nearest
|
|
9
|
-
* `[data-strata-scroll]` ancestor, else the viewport). Returns a callback ref, so it follows the
|
|
10
|
-
* element as it mounts and unmounts.
|
|
11
|
-
*/
|
|
12
|
-
function useInView({ active = true, rootMargin = "0px", once = false, unsupported = false } = {}) {
|
|
13
|
-
const [inView, setInView] = React.useState(false);
|
|
14
|
-
const [el, setEl] = React.useState(null);
|
|
15
|
-
const seen = once && inView;
|
|
16
|
-
React.useEffect(() => {
|
|
17
|
-
if (seen) return;
|
|
18
|
-
if (!active || !el) {
|
|
19
|
-
setInView(false);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
if (typeof IntersectionObserver === "undefined") {
|
|
23
|
-
setInView(unsupported);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
const root = el.parentElement?.closest("[data-strata-scroll]") ?? null;
|
|
27
|
-
const observer = new IntersectionObserver((entries) => setInView(entries[entries.length - 1].isIntersecting), {
|
|
28
|
-
root,
|
|
29
|
-
rootMargin
|
|
30
|
-
});
|
|
31
|
-
observer.observe(el);
|
|
32
|
-
return () => observer.disconnect();
|
|
33
|
-
}, [
|
|
34
|
-
active,
|
|
35
|
-
el,
|
|
36
|
-
rootMargin,
|
|
37
|
-
seen,
|
|
38
|
-
unsupported
|
|
39
|
-
]);
|
|
40
|
-
return {
|
|
41
|
-
ref: setEl,
|
|
42
|
-
inView
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
// src/lib/number-input.ts
|
|
46
|
-
/** Reads `#rgb`, `#rrggbb` (with or without the #) as lower-case `#rrggbb`, or null. */
|
|
47
|
-
function parseHex(text) {
|
|
48
|
-
const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(text.trim());
|
|
49
|
-
if (!m) return null;
|
|
50
|
-
const h = m[1].toLowerCase();
|
|
51
|
-
return "#" + (h.length === 3 ? [...h].map((c) => c + c).join("") : h);
|
|
52
|
-
}
|
|
53
|
-
function luminance(hex) {
|
|
54
|
-
const v = [
|
|
55
|
-
1,
|
|
56
|
-
3,
|
|
57
|
-
5
|
|
58
|
-
].map((i) => parseInt(hex.slice(i, i + 2), 16) / 255).map((c) => c <= .03928 ? c / 12.92 : ((c + .055) / 1.055) ** 2.4);
|
|
59
|
-
return .2126 * v[0] + .7152 * v[1] + .0722 * v[2];
|
|
60
|
-
}
|
|
61
|
-
/** WCAG contrast ratio between two `#rrggbb` colours, 1 to 21. */
|
|
62
|
-
function contrastRatio(a, b) {
|
|
63
|
-
const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
|
64
|
-
return (hi + .05) / (lo + .05);
|
|
65
|
-
}
|
|
66
|
-
// src/components/value-controls.tsx
|
|
67
|
-
var box = "flex w-full min-w-0 items-center rounded-control border border-input bg-background px-3 type-body text-foreground transition-state disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-70 has-[input:disabled]:cursor-not-allowed has-[input:disabled]:bg-muted has-[input:disabled]:opacity-70 aria-invalid:border-danger has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-offset-2 has-[input:focus-visible]:outline-ring";
|
|
68
|
-
/** A number with its unit joined by a non-breaking space; `%` and `°` stay attached. */
|
|
69
|
-
function withUnit(text, unit) {
|
|
70
|
-
if (!unit) return text;
|
|
71
|
-
return unit === "%" || unit === "°" ? text + unit : text + "\xA0" + unit;
|
|
72
|
-
}
|
|
73
|
-
var intlUnits = {
|
|
74
|
-
"%": "percent",
|
|
75
|
-
"°": "degree",
|
|
76
|
-
ms: "millisecond",
|
|
77
|
-
s: "second",
|
|
78
|
-
kB: "kilobyte",
|
|
79
|
-
MB: "megabyte",
|
|
80
|
-
GB: "gigabyte",
|
|
81
|
-
kbps: "kilobit-per-second",
|
|
82
|
-
Mbps: "megabit-per-second"
|
|
83
|
-
};
|
|
84
|
-
function decimalsOf(n) {
|
|
85
|
-
const s = String(n);
|
|
86
|
-
if (s.includes("e-")) return Number(s.split("e-")[1]) + (s.split("e-")[0].split(".")[1]?.length ?? 0);
|
|
87
|
-
return s.split(".")[1]?.length ?? 0;
|
|
88
|
-
}
|
|
89
|
-
function useNumberText(locale, places) {
|
|
90
|
-
return React.useMemo(() => {
|
|
91
|
-
const f = new Intl.NumberFormat(locale, {
|
|
92
|
-
maximumFractionDigits: places,
|
|
93
|
-
minimumFractionDigits: 0
|
|
94
|
-
});
|
|
95
|
-
return (n) => f.format(n);
|
|
96
|
-
}, [locale, places]);
|
|
97
|
-
}
|
|
98
|
-
function formatOptionsFor(places, unit) {
|
|
99
|
-
const base = {
|
|
100
|
-
maximumFractionDigits: places,
|
|
101
|
-
minimumFractionDigits: 0
|
|
102
|
-
};
|
|
103
|
-
const known = unit ? intlUnits[unit] : void 0;
|
|
104
|
-
return known ? {
|
|
105
|
-
...base,
|
|
106
|
-
style: "unit",
|
|
107
|
-
unit: known,
|
|
108
|
-
unitDisplay: "narrow"
|
|
109
|
-
} : base;
|
|
110
|
-
}
|
|
111
|
-
function describeRange(min, max, show, unit) {
|
|
112
|
-
const a = min === void 0 ? "" : withUnit(show(min), unit);
|
|
113
|
-
const b = max === void 0 ? "" : withUnit(show(max), unit);
|
|
114
|
-
if (min !== void 0 && max !== void 0) return `Enter a value from ${a} to ${b}.`;
|
|
115
|
-
if (min !== void 0) return `Enter ${a} or more.`;
|
|
116
|
-
if (max !== void 0) return `Enter ${b} or less.`;
|
|
117
|
-
return "Enter a number.";
|
|
118
|
-
}
|
|
119
|
-
/** A number with a unit on React Aria's number field: typed input is validated, not clamped, so an out-of-range value is explained in the surrounding `Field` and never passed on; empty stays `null`. */
|
|
120
|
-
function NumberField$1({ value, onChange, min, max, step = 1, places, unit, locale = format.locale, required = false, disabled, id: idProp, name, size = "default", className, "aria-label": ariaLabel }) {
|
|
121
|
-
const { field, report } = useFieldControl();
|
|
122
|
-
const digits = places ?? Math.max(decimalsOf(step), min === void 0 ? 0 : decimalsOf(min));
|
|
123
|
-
const show = useNumberText(locale, digits);
|
|
124
|
-
const [own, setOwn] = React.useState(false);
|
|
125
|
-
const unitId = React.useId();
|
|
126
|
-
const [local, setLocal] = React.useState(value ?? NaN);
|
|
127
|
-
const [seen, setSeen] = React.useState(value);
|
|
128
|
-
if (seen !== value) {
|
|
129
|
-
setSeen(value);
|
|
130
|
-
setLocal(value ?? NaN);
|
|
131
|
-
}
|
|
132
|
-
const fail = (message) => {
|
|
133
|
-
setOwn(true);
|
|
134
|
-
report(message);
|
|
135
|
-
};
|
|
136
|
-
const ok = () => {
|
|
137
|
-
setOwn(false);
|
|
138
|
-
report(void 0);
|
|
139
|
-
};
|
|
140
|
-
const handle = (n) => {
|
|
141
|
-
setLocal(n);
|
|
142
|
-
if (Number.isNaN(n)) {
|
|
143
|
-
if (required) return fail("Enter a value.");
|
|
144
|
-
ok();
|
|
145
|
-
if (value !== null) onChange(null);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
if (min !== void 0 && n < min || max !== void 0 && n > max) return fail(describeRange(min, max, show, unit));
|
|
149
|
-
ok();
|
|
150
|
-
if (n !== value) onChange(n);
|
|
151
|
-
};
|
|
152
|
-
const invalid = field?.invalid || own;
|
|
153
|
-
return /* @__PURE__ */ jsx(I18nProvider, {
|
|
154
|
-
locale,
|
|
155
|
-
children: /* @__PURE__ */ jsxs(NumberField, {
|
|
156
|
-
value: local,
|
|
157
|
-
onChange: handle,
|
|
158
|
-
minValue: min,
|
|
159
|
-
maxValue: max,
|
|
160
|
-
step,
|
|
161
|
-
formatOptions: {
|
|
162
|
-
maximumFractionDigits: digits,
|
|
163
|
-
minimumFractionDigits: 0
|
|
164
|
-
},
|
|
165
|
-
commitBehavior: "validate",
|
|
166
|
-
isDisabled: disabled,
|
|
167
|
-
isInvalid: invalid || void 0,
|
|
168
|
-
name,
|
|
169
|
-
"aria-label": ariaLabel ?? field?.label,
|
|
170
|
-
className: cn(box, controlHeight[size], className),
|
|
171
|
-
children: [/* @__PURE__ */ jsx(Input, {
|
|
172
|
-
id: idProp ?? field?.id,
|
|
173
|
-
placeholder: format.missing,
|
|
174
|
-
"aria-describedby": [field?.describedBy, unit ? unitId : void 0].filter(Boolean).join(" ") || void 0,
|
|
175
|
-
className: "min-w-0 flex-1 bg-transparent tabular-nums outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed"
|
|
176
|
-
}), unit && /* @__PURE__ */ jsxs("span", {
|
|
177
|
-
id: unitId,
|
|
178
|
-
className: "ml-2 shrink-0 type-body-sm text-muted-foreground",
|
|
179
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
180
|
-
"aria-hidden": true,
|
|
181
|
-
children: unit
|
|
182
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
183
|
-
className: "sr-only",
|
|
184
|
-
children: intlUnits[unit] ? intlUnits[unit].replace(/-/g, " ") : unit
|
|
185
|
-
})]
|
|
186
|
-
})]
|
|
187
|
-
})
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
/** A slider on React Aria with its current value always printed beside the track (and spoken with the unit when `Intl` knows it); `editable` adds a number field to type an exact value. */
|
|
191
|
-
function Slider$1({ value, onChange, min, max, step = 1, unit, locale = format.locale, editable = false, hideValue = false, places, disabled, className, "aria-label": ariaLabel }) {
|
|
192
|
-
const { field } = useFieldControl();
|
|
193
|
-
const digits = places ?? Math.max(decimalsOf(step), decimalsOf(min));
|
|
194
|
-
const show = useNumberText(locale, digits);
|
|
195
|
-
const name = ariaLabel ?? field?.label ?? "Value";
|
|
196
|
-
const text = withUnit(show(value), unit);
|
|
197
|
-
return /* @__PURE__ */ jsx(I18nProvider, {
|
|
198
|
-
locale,
|
|
199
|
-
children: /* @__PURE__ */ jsxs(Slider, {
|
|
200
|
-
value,
|
|
201
|
-
onChange: (v) => onChange(v),
|
|
202
|
-
minValue: min,
|
|
203
|
-
maxValue: max,
|
|
204
|
-
step,
|
|
205
|
-
formatOptions: formatOptionsFor(digits, unit),
|
|
206
|
-
isDisabled: disabled,
|
|
207
|
-
"aria-label": name,
|
|
208
|
-
"aria-describedby": field?.describedBy,
|
|
209
|
-
className: cn("flex min-w-0 items-center gap-3", className),
|
|
210
|
-
children: [/* @__PURE__ */ jsx(SliderTrack, {
|
|
211
|
-
className: "relative flex h-(--control-h) min-w-0 flex-1 cursor-pointer items-center disabled:cursor-not-allowed disabled:opacity-50",
|
|
212
|
-
children: ({ state }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
213
|
-
/* @__PURE__ */ jsx("span", {
|
|
214
|
-
"aria-hidden": true,
|
|
215
|
-
className: "absolute inset-x-0 h-1.5 rounded-pill bg-muted"
|
|
216
|
-
}),
|
|
217
|
-
/* @__PURE__ */ jsx("span", {
|
|
218
|
-
"aria-hidden": true,
|
|
219
|
-
className: "absolute left-0 h-1.5 rounded-pill bg-primary",
|
|
220
|
-
style: { width: `${state.getThumbPercent(0) * 100}%` }
|
|
221
|
-
}),
|
|
222
|
-
/* @__PURE__ */ jsx(SliderThumb, { className: "top-1/2 size-5 rounded-pill border-2 border-primary bg-background focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring" })
|
|
223
|
-
] })
|
|
224
|
-
}), editable ? /* @__PURE__ */ jsx(NumberField$1, {
|
|
225
|
-
className: "w-28 shrink-0",
|
|
226
|
-
"aria-label": `${name}, exact value`,
|
|
227
|
-
value,
|
|
228
|
-
onChange: (v) => v !== null && onChange(v),
|
|
229
|
-
min,
|
|
230
|
-
max,
|
|
231
|
-
step,
|
|
232
|
-
unit,
|
|
233
|
-
locale,
|
|
234
|
-
places: digits,
|
|
235
|
-
required: true,
|
|
236
|
-
disabled
|
|
237
|
-
}) : !hideValue && /* @__PURE__ */ jsx(SliderOutput, {
|
|
238
|
-
"aria-hidden": true,
|
|
239
|
-
className: "w-16 shrink-0 text-right type-body-sm tabular-nums text-foreground",
|
|
240
|
-
children: text
|
|
241
|
-
})]
|
|
242
|
-
})
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
/** Choose a colour with the platform picker, see and type its hex value, pick from the app's suggestions, and get a note when it would be hard to see on `against`. A half-typed value is never passed on. */
|
|
246
|
-
function ColorField({ value, onChange, suggestions, against, againstLabel = "the background", minContrast = 3, disabled, id: idProp, className, "aria-label": ariaLabel }) {
|
|
247
|
-
const { field, report } = useFieldControl();
|
|
248
|
-
const label = ariaLabel ?? field?.label;
|
|
249
|
-
const pickerName = label ? `${label}, picker` : "Colour picker";
|
|
250
|
-
const [draft, setDraft] = React.useState(null);
|
|
251
|
-
const [own, setOwn] = React.useState(false);
|
|
252
|
-
const text = draft ?? value ?? "";
|
|
253
|
-
const ratio = value && against ? contrastRatio(value, against) : null;
|
|
254
|
-
const commitText = (t) => {
|
|
255
|
-
if (t.trim() === "") {
|
|
256
|
-
setOwn(false);
|
|
257
|
-
report(void 0);
|
|
258
|
-
if (value !== null) onChange(null);
|
|
259
|
-
return true;
|
|
260
|
-
}
|
|
261
|
-
const hex = parseHex(t);
|
|
262
|
-
if (!hex) {
|
|
263
|
-
setOwn(true);
|
|
264
|
-
report("Enter a colour like #1a7f64.");
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
267
|
-
setOwn(false);
|
|
268
|
-
report(void 0);
|
|
269
|
-
if (hex !== value) onChange(hex);
|
|
270
|
-
return true;
|
|
271
|
-
};
|
|
272
|
-
const pick = (hex) => {
|
|
273
|
-
setDraft(null);
|
|
274
|
-
setOwn(false);
|
|
275
|
-
report(void 0);
|
|
276
|
-
if (hex !== value) onChange(hex);
|
|
277
|
-
};
|
|
278
|
-
const invalid = field?.invalid || own;
|
|
279
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
280
|
-
className: cn("grid min-w-0 gap-2", className),
|
|
281
|
-
children: [
|
|
282
|
-
/* @__PURE__ */ jsxs("div", {
|
|
283
|
-
className: cn(box, controlHeight.default, "gap-2 px-2"),
|
|
284
|
-
"aria-invalid": invalid || void 0,
|
|
285
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
286
|
-
className: "relative size-6 shrink-0 overflow-hidden rounded-control border border-input",
|
|
287
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
288
|
-
"aria-hidden": true,
|
|
289
|
-
className: cn("absolute inset-0", value === null && "bg-muted"),
|
|
290
|
-
style: value ? { background: value } : void 0
|
|
291
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
292
|
-
type: "color",
|
|
293
|
-
"aria-label": pickerName,
|
|
294
|
-
value: value ?? "#000000",
|
|
295
|
-
disabled,
|
|
296
|
-
onChange: (e) => pick(e.target.value),
|
|
297
|
-
className: "absolute inset-0 size-full cursor-pointer opacity-0 disabled:cursor-not-allowed"
|
|
298
|
-
})]
|
|
299
|
-
}), /* @__PURE__ */ jsx("input", {
|
|
300
|
-
id: idProp ?? field?.id,
|
|
301
|
-
type: "text",
|
|
302
|
-
autoComplete: "off",
|
|
303
|
-
spellCheck: false,
|
|
304
|
-
disabled,
|
|
305
|
-
"aria-label": ariaLabel,
|
|
306
|
-
"aria-describedby": field?.describedBy,
|
|
307
|
-
"aria-invalid": invalid || void 0,
|
|
308
|
-
placeholder: format.missing,
|
|
309
|
-
value: text,
|
|
310
|
-
onChange: (e) => setDraft(e.target.value),
|
|
311
|
-
onBlur: () => {
|
|
312
|
-
if (draft !== null && commitText(draft)) setDraft(null);
|
|
313
|
-
},
|
|
314
|
-
onKeyDown: (e) => {
|
|
315
|
-
if (e.key === "Enter" && draft !== null && commitText(draft)) setDraft(null);
|
|
316
|
-
if (e.key === "Escape" && draft !== null) {
|
|
317
|
-
setDraft(null);
|
|
318
|
-
setOwn(false);
|
|
319
|
-
report(void 0);
|
|
320
|
-
}
|
|
321
|
-
},
|
|
322
|
-
className: "min-w-0 flex-1 bg-transparent tabular-nums outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed"
|
|
323
|
-
})]
|
|
324
|
-
}),
|
|
325
|
-
suggestions && suggestions.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
326
|
-
role: "group",
|
|
327
|
-
"aria-label": "Suggested colours",
|
|
328
|
-
className: "flex flex-wrap gap-1.5",
|
|
329
|
-
children: suggestions.map((hex) => /* @__PURE__ */ jsx("button", {
|
|
330
|
-
type: "button",
|
|
331
|
-
disabled,
|
|
332
|
-
"aria-label": hex,
|
|
333
|
-
"aria-pressed": value === hex,
|
|
334
|
-
onClick: () => pick(hex),
|
|
335
|
-
className: "size-6 cursor-pointer rounded-control border border-input transition-state aria-pressed:outline-2 aria-pressed:outline-offset-2 aria-pressed:outline-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
336
|
-
style: { background: hex }
|
|
337
|
-
}, hex))
|
|
338
|
-
}),
|
|
339
|
-
ratio !== null && ratio < minContrast && /* @__PURE__ */ jsxs("p", {
|
|
340
|
-
className: "type-body-sm text-warning",
|
|
341
|
-
children: [
|
|
342
|
-
"Hard to see on ",
|
|
343
|
-
againstLabel,
|
|
344
|
-
": contrast ",
|
|
345
|
-
format.decimal(ratio),
|
|
346
|
-
":1, aim for ",
|
|
347
|
-
format.decimal(minContrast),
|
|
348
|
-
":1 or more."
|
|
349
|
-
]
|
|
350
|
-
})
|
|
351
|
-
]
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
export { useInView as i, NumberField$1 as n, Slider$1 as r, ColorField as t };
|
|
355
|
-
|
|
356
|
-
//# sourceMappingURL=value-controls-D6O9TsM6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"value-controls-D6O9TsM6.js","names":["NumberField","AriaNumberField","AriaInput","Slider","AriaSlider","_Fragment"],"sources":["../src/lib/in-view.ts","../src/lib/number-input.ts","../src/components/value-controls.tsx"],"sourcesContent":["import * as React from \"react\";\n\n// One IntersectionObserver hook for everything that waits until it is near the screen: the\n// sentinel at the end of an InfiniteList and an image in a Thumbnail. Both watch from the nearest\n// `[data-strata-scroll]` region (a VirtualList's) or else the viewport, with a root\n// margin so the work starts before the element is reached. They differ in two ways, which are\n// options rather than two hooks:\n//\n// - `once`: an image, once asked for, stays asked for; scrolling it away again must not unload it.\n// A sentinel reports in and out of view every time.\n// - `unsupported`: where there is no IntersectionObserver (an old browser, a test without the\n// fake), an image loads at once, because a photo that never loads is worse than one loaded\n// early. A sentinel reports out of view, because InfiniteList's Show more button is the path\n// that always works.\n\n/** Options for {@link useInView}. */\nexport type InViewOptions = {\n /** Watch only while this is true. Default true. */\n active?: boolean;\n /** How far outside the scroll region still counts as in view (IntersectionObserver `rootMargin`). */\n rootMargin?: string;\n /** Stay in view after the first time, and stop watching. */\n once?: boolean;\n /** What to report where `IntersectionObserver` does not exist. Default false. */\n unsupported?: boolean;\n};\n\n/**\n * Whether an element is within `rootMargin` of its scroll region (the nearest\n * `[data-strata-scroll]` ancestor, else the viewport). Returns a callback ref, so it follows the\n * element as it mounts and unmounts.\n */\nexport function useInView({ active = true, rootMargin = \"0px\", once = false, unsupported = false }: InViewOptions = {}) {\n const [inView, setInView] = React.useState(false);\n const [el, setEl] = React.useState<Element | null>(null);\n const seen = once && inView;\n React.useEffect(() => {\n if (seen) return;\n if (!active || !el) {\n setInView(false);\n return;\n }\n if (typeof IntersectionObserver === \"undefined\") {\n setInView(unsupported);\n return;\n }\n const root = el.parentElement?.closest<HTMLElement>(\"[data-strata-scroll]\") ?? null;\n const observer = new IntersectionObserver((entries) => setInView(entries[entries.length - 1].isIntersecting), { root, rootMargin });\n observer.observe(el);\n return () => observer.disconnect();\n }, [active, el, rootMargin, seen, unsupported]);\n return { ref: setEl, inView };\n}\n","// Colour rules for `ColorField` (issue #73): reading a typed hex, and the WCAG contrast ratio\n// against what the colour is drawn on, which a user-chosen colour (content, not theme) is checked\n// with. Number parsing and stepping are React Aria's.\n\n/** Reads `#rgb`, `#rrggbb` (with or without the #) as lower-case `#rrggbb`, or null. */\nexport function parseHex(text: string): string | null {\n const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(text.trim());\n if (!m) return null;\n const h = m[1].toLowerCase();\n return \"#\" + (h.length === 3 ? [...h].map((c) => c + c).join(\"\") : h);\n}\n\nfunction luminance(hex: string): number {\n const v = [1, 3, 5].map((i) => parseInt(hex.slice(i, i + 2), 16) / 255).map((c) => (c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4));\n return 0.2126 * v[0] + 0.7152 * v[1] + 0.0722 * v[2];\n}\n\n/** WCAG contrast ratio between two `#rrggbb` colours, 1 to 21. */\nexport function contrastRatio(a: string, b: string): number {\n const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);\n return (hi + 0.05) / (lo + 0.05);\n}\n","import * as React from \"react\";\nimport {\n I18nProvider,\n Input as AriaInput,\n NumberField as AriaNumberField,\n Slider as AriaSlider,\n SliderOutput,\n SliderThumb,\n SliderTrack,\n} from \"react-aria-components\";\nimport { useFieldControl } from \"./field\";\nimport { NBSP, format } from \"../lib/format\";\nimport { contrastRatio, parseHex } from \"../lib/number-input\";\nimport { cn } from \"../lib/utils\";\nimport { controlHeight, type ControlSize } from \"../lib/control\";\n\n// Controls for setting a number or a colour precisely (strata-react issue #73, from moving\n// strata-vid onto Strata: opacity, rotation, volume, bitrate, a line colour). The native ones fail\n// in the same few ways, and each rule below answers one:\n//\n// - `parseFloat(e.target.value)` turns an empty field into NaN. Here a value that is not known is\n// `null`, stays `null`, and prints `format.missing`; a typed value outside the limits is NOT\n// clamped and NOT passed on: React Aria's field runs with `commitBehavior=\"validate\"` (it keeps\n// what was typed instead of snapping 600 to 500), and the control tells the surrounding `Field`\n// what is wrong (\"Enter a value from 0% to 500%.\"), the same place a server's 422 appears. The\n// callback only ever receives a number inside the limits, or null.\n// - The unit lives inside the control, muted. A slider's spoken value carries it (\"40%\", \"90°\")\n// when `Intl` knows the unit (percent, degree, millisecond, megabit-per-second and the like):\n// React Aria builds `aria-valuetext` from an `Intl.NumberFormat`, so \"px\" or \"steps\" are in the\n// printed value and the label but cannot be in the spoken one.\n// - Digits are the locale's: what is printed and what is read back go through `Intl` (React Aria's\n// `NumberParser`), so 12,5 works in a de-DE app, and the message is in the same digits.\n// - Behaviour is React Aria's: arrows step, PageUp/PageDown take ten steps, Home/End jump to the\n// limits, a field commits on Enter and blur. Nothing animates when a value changes: these are\n// dragged and stepped dozens of times a minute (character.md, the frequency budget).\n// - A colour a person picks for their own content (a route's line) is content, not theme, so it is\n// the one place a raw colour value is right; `against` checks it against what it is drawn on.\n// The colour field's text box is ours: React Aria's colour field puts the old colour back when\n// the text is not a colour, where this one says so under the control; the swatch opens the\n// platform picker.\n\nconst box =\n \"flex w-full min-w-0 items-center rounded-control border border-input bg-background px-3 type-body text-foreground transition-state disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-70 has-[input:disabled]:cursor-not-allowed has-[input:disabled]:bg-muted has-[input:disabled]:opacity-70 aria-invalid:border-danger has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-offset-2 has-[input:focus-visible]:outline-ring\";\n\n/** A number with its unit joined by a non-breaking space; `%` and `°` stay attached. */\nfunction withUnit(text: string, unit?: string) {\n if (!unit) return text;\n return unit === \"%\" || unit === \"°\" ? text + unit : text + NBSP + unit;\n}\n\n// Units `Intl` can speak, by the symbol an app prints. Anything else is printed but not spoken.\nconst intlUnits: Record<string, string> = {\n \"%\": \"percent\",\n \"°\": \"degree\",\n ms: \"millisecond\",\n s: \"second\",\n kB: \"kilobyte\",\n MB: \"megabyte\",\n GB: \"gigabyte\",\n kbps: \"kilobit-per-second\",\n Mbps: \"megabit-per-second\",\n};\n\nfunction decimalsOf(n: number): number {\n const s = String(n);\n if (s.includes(\"e-\")) return Number(s.split(\"e-\")[1]) + (s.split(\"e-\")[0].split(\".\")[1]?.length ?? 0);\n return s.split(\".\")[1]?.length ?? 0;\n}\n\nfunction useNumberText(locale: string, places: number) {\n return React.useMemo(() => {\n const f = new Intl.NumberFormat(locale, { maximumFractionDigits: places, minimumFractionDigits: 0 });\n return (n: number) => f.format(n);\n }, [locale, places]);\n}\n\nfunction formatOptionsFor(places: number, unit?: string): Intl.NumberFormatOptions {\n const base: Intl.NumberFormatOptions = { maximumFractionDigits: places, minimumFractionDigits: 0 };\n const known = unit ? intlUnits[unit] : undefined;\n return known ? { ...base, style: \"unit\", unit: known, unitDisplay: \"narrow\" } : base;\n}\n\n/** Props shared by the number field and the slider. */\nexport type RangeProps = {\n min?: number;\n max?: number;\n /** The size of one arrow-key step. Default 1. */\n step?: number;\n /** The unit shown with the value: \"%\", \"°\", \"Mbps\", \"px\". Spoken too when `Intl` has it (%, °, ms, s, kB, MB, GB, kbps, Mbps). */\n unit?: string;\n /** The locale for digits and the decimal mark. Default the app's `format` locale. */\n locale?: string;\n};\n\n/** Props for `NumberField`. */\nexport type NumberFieldProps = RangeProps & {\n /** The current value; `null` when it is not known (shown as an en dash, not 0). */\n value: number | null;\n /** Receives a number inside the limits, or `null` when the field is cleared. Never NaN, never out of range. */\n onChange: (value: number | null) => void;\n /** Decimal places to show and keep. Default the places in `step` (and `min`). */\n places?: number;\n /** An empty field is an error (\"Enter a value.\") rather than `null`. */\n required?: boolean;\n disabled?: boolean;\n /** Names the control when it is used without a `Field`. */\n \"aria-label\"?: string;\n id?: string;\n name?: string;\n /** `sm` is --control-h-sm, the height of a small `Toggle` or `IconButton` beside it. Default --control-h. */\n size?: ControlSize;\n className?: string;\n};\n\nfunction describeRange(min: number | undefined, max: number | undefined, show: (n: number) => string, unit?: string) {\n const a = min === undefined ? \"\" : withUnit(show(min), unit);\n const b = max === undefined ? \"\" : withUnit(show(max), unit);\n if (min !== undefined && max !== undefined) return `Enter a value from ${a} to ${b}.`;\n if (min !== undefined) return `Enter ${a} or more.`;\n if (max !== undefined) return `Enter ${b} or less.`;\n return \"Enter a number.\";\n}\n\n/** A number with a unit on React Aria's number field: typed input is validated, not clamped, so an out-of-range value is explained in the surrounding `Field` and never passed on; empty stays `null`. */\nexport function NumberField({\n value,\n onChange,\n min,\n max,\n step = 1,\n places,\n unit,\n locale = format.locale,\n required = false,\n disabled,\n id: idProp,\n name,\n size = \"default\",\n className,\n \"aria-label\": ariaLabel,\n}: NumberFieldProps) {\n const { field, report } = useFieldControl();\n const digits = places ?? Math.max(decimalsOf(step), min === undefined ? 0 : decimalsOf(min));\n const show = useNumberText(locale, digits);\n const [own, setOwn] = React.useState(false); // invalid, when there is no Field to say so\n const unitId = React.useId();\n // What the field shows. It follows `value`, but also holds an entry we refused, so the person sees\n // (and can correct) what they typed instead of the field snapping back to the old value.\n const [local, setLocal] = React.useState<number>(value ?? Number.NaN);\n const [seen, setSeen] = React.useState(value);\n if (seen !== value) {\n setSeen(value);\n setLocal(value ?? Number.NaN);\n }\n\n const fail = (message: string) => {\n setOwn(true);\n report(message);\n };\n const ok = () => {\n setOwn(false);\n report(undefined);\n };\n\n const handle = (n: number) => {\n setLocal(n);\n if (Number.isNaN(n)) {\n if (required) return fail(\"Enter a value.\");\n ok();\n if (value !== null) onChange(null);\n return;\n }\n if ((min !== undefined && n < min) || (max !== undefined && n > max)) return fail(describeRange(min, max, show, unit));\n ok();\n if (n !== value) onChange(n);\n };\n\n const invalid = field?.invalid || own;\n return (\n <I18nProvider locale={locale}>\n <AriaNumberField\n value={local}\n onChange={handle}\n minValue={min}\n maxValue={max}\n step={step}\n formatOptions={{ maximumFractionDigits: digits, minimumFractionDigits: 0 }}\n commitBehavior=\"validate\"\n isDisabled={disabled}\n isInvalid={invalid || undefined}\n name={name}\n aria-label={ariaLabel ?? field?.label}\n className={cn(box, controlHeight[size], className)}\n >\n <AriaInput\n id={idProp ?? field?.id}\n placeholder={format.missing}\n aria-describedby={[field?.describedBy, unit ? unitId : undefined].filter(Boolean).join(\" \") || undefined}\n className=\"min-w-0 flex-1 bg-transparent tabular-nums outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed\"\n />\n {unit && (\n <span id={unitId} className=\"ml-2 shrink-0 type-body-sm text-muted-foreground\">\n <span aria-hidden>{unit}</span>\n <span className=\"sr-only\">{intlUnits[unit] ? intlUnits[unit].replace(/-/g, \" \") : unit}</span>\n </span>\n )}\n </AriaNumberField>\n </I18nProvider>\n );\n}\n\n/** Props for `Slider`. */\nexport type SliderProps = RangeProps & {\n value: number;\n onChange: (value: number) => void;\n /** Both limits are required: a slider with no ends is not a slider. */\n min: number;\n max: number;\n /** Replace the printed value with a `NumberField` beside the track, so an exact value can be typed. */\n editable?: boolean;\n /** Hide the printed value (when something else beside it already shows it). */\n hideValue?: boolean;\n /** Decimal places in the printed and spoken value. Default the places in `step`. */\n places?: number;\n disabled?: boolean;\n /** Names the slider when it is used without a `Field`. */\n \"aria-label\"?: string;\n className?: string;\n};\n\n/** A slider on React Aria with its current value always printed beside the track (and spoken with the unit when `Intl` knows it); `editable` adds a number field to type an exact value. */\nexport function Slider({\n value,\n onChange,\n min,\n max,\n step = 1,\n unit,\n locale = format.locale,\n editable = false,\n hideValue = false,\n places,\n disabled,\n className,\n \"aria-label\": ariaLabel,\n}: SliderProps) {\n const { field } = useFieldControl();\n const digits = places ?? Math.max(decimalsOf(step), decimalsOf(min));\n const show = useNumberText(locale, digits);\n const name = ariaLabel ?? field?.label ?? \"Value\";\n const text = withUnit(show(value), unit);\n return (\n <I18nProvider locale={locale}>\n <AriaSlider\n value={value}\n onChange={(v) => onChange(v as number)}\n minValue={min}\n maxValue={max}\n step={step}\n formatOptions={formatOptionsFor(digits, unit)}\n isDisabled={disabled}\n aria-label={name}\n aria-describedby={field?.describedBy}\n className={cn(\"flex min-w-0 items-center gap-3\", className)}\n >\n <SliderTrack className=\"relative flex h-(--control-h) min-w-0 flex-1 cursor-pointer items-center disabled:cursor-not-allowed disabled:opacity-50\">\n {({ state }) => (\n <>\n <span aria-hidden className=\"absolute inset-x-0 h-1.5 rounded-pill bg-muted\" />\n <span aria-hidden className=\"absolute left-0 h-1.5 rounded-pill bg-primary\" style={{ width: `${state.getThumbPercent(0) * 100}%` }} />\n <SliderThumb className=\"top-1/2 size-5 rounded-pill border-2 border-primary bg-background focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring\" />\n </>\n )}\n </SliderTrack>\n {editable ? (\n <NumberField className=\"w-28 shrink-0\" aria-label={`${name}, exact value`} value={value} onChange={(v) => v !== null && onChange(v)} min={min} max={max} step={step} unit={unit} locale={locale} places={digits} required disabled={disabled} />\n ) : (\n !hideValue && (\n <SliderOutput aria-hidden className=\"w-16 shrink-0 text-right type-body-sm tabular-nums text-foreground\">\n {text}\n </SliderOutput>\n )\n )}\n </AriaSlider>\n </I18nProvider>\n );\n}\n\n/** Props for `ColorField`. */\nexport type ColorFieldProps = {\n /** `#rrggbb`, or `null` when no colour is set. */\n value: string | null;\n /** Receives a valid `#rrggbb` (lower case) or `null` when cleared; never a half-typed value. */\n onChange: (value: string | null) => void;\n /** A short list the app suggests, as `#rrggbb`. Pressing one chooses it. */\n suggestions?: readonly string[];\n /** The colour this will be drawn on, `#rrggbb`: a note appears when the contrast would be low. */\n against?: string;\n /** What it is drawn on, in words: \"the map\". Completes the note. */\n againstLabel?: string;\n /** The lowest contrast ratio accepted before the note shows. Default 3, the WCAG minimum for graphics. */\n minContrast?: number;\n disabled?: boolean;\n \"aria-label\"?: string;\n id?: string;\n className?: string;\n};\n\n/** Choose a colour with the platform picker, see and type its hex value, pick from the app's suggestions, and get a note when it would be hard to see on `against`. A half-typed value is never passed on. */\nexport function ColorField({ value, onChange, suggestions, against, againstLabel = \"the background\", minContrast = 3, disabled, id: idProp, className, \"aria-label\": ariaLabel }: ColorFieldProps) {\n const { field, report } = useFieldControl();\n // Named for the `aria-label` or, failing that, the surrounding Field's label, so two colour fields in one panel never share a name (issue #116).\n const label = ariaLabel ?? field?.label;\n const pickerName = label ? `${label}, picker` : \"Colour picker\";\n const [draft, setDraft] = React.useState<string | null>(null);\n const [own, setOwn] = React.useState(false);\n const text = draft ?? value ?? \"\";\n const ratio = value && against ? contrastRatio(value, against) : null;\n\n const commitText = (t: string): boolean => {\n if (t.trim() === \"\") {\n setOwn(false);\n report(undefined);\n if (value !== null) onChange(null);\n return true;\n }\n const hex = parseHex(t);\n if (!hex) {\n setOwn(true);\n report(\"Enter a colour like #1a7f64.\");\n return false;\n }\n setOwn(false);\n report(undefined);\n if (hex !== value) onChange(hex);\n return true;\n };\n\n const pick = (hex: string) => {\n setDraft(null);\n setOwn(false);\n report(undefined);\n if (hex !== value) onChange(hex);\n };\n\n const invalid = field?.invalid || own;\n return (\n <div className={cn(\"grid min-w-0 gap-2\", className)}>\n <div className={cn(box, controlHeight.default, \"gap-2 px-2\")} aria-invalid={invalid || undefined}>\n <span className=\"relative size-6 shrink-0 overflow-hidden rounded-control border border-input\">\n {/* The swatch is the chosen colour itself: user content, not a theme role. */}\n <span aria-hidden className={cn(\"absolute inset-0\", value === null && \"bg-muted\")} style={value ? { background: value } : undefined} />\n <input\n type=\"color\"\n aria-label={pickerName}\n value={value ?? \"#000000\"}\n disabled={disabled}\n onChange={(e) => pick(e.target.value)}\n className=\"absolute inset-0 size-full cursor-pointer opacity-0 disabled:cursor-not-allowed\"\n />\n </span>\n <input\n id={idProp ?? field?.id}\n type=\"text\"\n autoComplete=\"off\"\n spellCheck={false}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={field?.describedBy}\n aria-invalid={invalid || undefined}\n placeholder={format.missing}\n value={text}\n onChange={(e) => setDraft(e.target.value)}\n onBlur={() => {\n if (draft !== null && commitText(draft)) setDraft(null);\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && draft !== null && commitText(draft)) setDraft(null);\n if (e.key === \"Escape\" && draft !== null) {\n setDraft(null);\n setOwn(false);\n report(undefined);\n }\n }}\n className=\"min-w-0 flex-1 bg-transparent tabular-nums outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed\"\n />\n </div>\n {suggestions && suggestions.length > 0 && (\n <div role=\"group\" aria-label=\"Suggested colours\" className=\"flex flex-wrap gap-1.5\">\n {suggestions.map((hex) => (\n <button\n key={hex}\n type=\"button\"\n disabled={disabled}\n aria-label={hex}\n aria-pressed={value === hex}\n onClick={() => pick(hex)}\n className=\"size-6 cursor-pointer rounded-control border border-input transition-state aria-pressed:outline-2 aria-pressed:outline-offset-2 aria-pressed:outline-foreground disabled:cursor-not-allowed disabled:opacity-50\"\n style={{ background: hex }}\n />\n ))}\n </div>\n )}\n {ratio !== null && ratio < minContrast && (\n <p className=\"type-body-sm text-warning\">\n Hard to see on {againstLabel}: contrast {format.decimal(ratio)}:1, aim for {format.decimal(minContrast)}:1 or more.\n </p>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAgCA,SAAgB,UAAU,EAAE,SAAS,MAAM,aAAa,OAAO,OAAO,OAAO,cAAc,UAAyB,CAAC,GAAG;CACtH,MAAM,CAAC,QAAQ,aAAa,MAAM,SAAS,KAAK;CAChD,MAAM,CAAC,IAAI,SAAS,MAAM,SAAyB,IAAI;CACvD,MAAM,OAAO,QAAQ;CACrB,MAAM,gBAAgB;EACpB,IAAI,MAAM;EACV,IAAI,CAAC,UAAU,CAAC,IAAI;GAClB,UAAU,KAAK;GACf;EACF;EACA,IAAI,OAAO,yBAAyB,aAAa;GAC/C,UAAU,WAAW;GACrB;EACF;EACA,MAAM,OAAO,GAAG,eAAe,QAAqB,sBAAsB,KAAK;EAC/E,MAAM,WAAW,IAAI,sBAAsB,YAAY,UAAU,QAAQ,QAAQ,SAAS,EAAE,CAAC,cAAc,GAAG;GAAE;GAAM;EAAW,CAAC;EAClI,SAAS,QAAQ,EAAE;EACnB,aAAa,SAAS,WAAW;CACnC,GAAG;EAAC;EA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