@knpkv/rly 0.12.1 → 0.13.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.
@@ -0,0 +1,1001 @@
1
+ import { r as e, t } from "./ThemeProvider-BFeldMeE.js";
2
+ import { i as n } from "./PortalProvider-CN_81Fy3.js";
3
+ import { i as r, n as i, o as a, r as o, t as s } from "./component-DKy8kjZl.js";
4
+ import { h as c, i as l, p as u } from "./Dialog-B9Ub_gMT.js";
5
+ import { RadioGroup as d, Tabs as f } from "radix-ui";
6
+ import { createElement as p, useCallback as m, useEffect as h, useId as g, useLayoutEffect as _, useMemo as v, useRef as y, useState as b } from "react";
7
+ import { Fragment as ee, jsx as x, jsxs as S } from "react/jsx-runtime";
8
+ var C = {
9
+ root: "rly_ChartLegend-module__root",
10
+ item: "rly_ChartLegend-module__item",
11
+ swatch: "rly_ChartLegend-module__swatch"
12
+ }, w = (e) => i(C, e), T = [
13
+ 1,
14
+ 2,
15
+ 3,
16
+ 4,
17
+ 5,
18
+ 6,
19
+ 7,
20
+ 8,
21
+ "other"
22
+ ], te = (e) => `var(--rly-color-series-${e})`, ne = (e) => {
23
+ let t = /* @__PURE__ */ new Set();
24
+ for (let n of e) {
25
+ let e = r(n.id, "ChartLegend item id");
26
+ if (t.has(e)) throw Error(`ChartLegend item ids must be unique: ${e}`);
27
+ t.add(e);
28
+ }
29
+ }, re = ({ className: e, items: t, label: n, ...i }) => (ne(t), t.length === 0 ? null : /* @__PURE__ */ x("ul", {
30
+ ...i,
31
+ "aria-label": r(n, "ChartLegend label"),
32
+ className: s(w("root"), e),
33
+ role: "list",
34
+ children: t.map((e) => /* @__PURE__ */ S("li", {
35
+ className: w("item"),
36
+ children: [/* @__PURE__ */ x("span", {
37
+ "aria-hidden": "true",
38
+ className: w("swatch"),
39
+ "data-series": String(e.series),
40
+ style: { background: te(e.series) }
41
+ }), r(e.label, "ChartLegend item label")]
42
+ }, e.id))
43
+ })), E = {
44
+ root: "rly_Divider-module__root",
45
+ horizontal: "rly_Divider-module__horizontal",
46
+ vertical: "rly_Divider-module__vertical",
47
+ subtle: "rly_Divider-module__subtle",
48
+ strong: "rly_Divider-module__strong"
49
+ }, D = (e) => i(E, e), O = o({
50
+ orientation: {
51
+ horizontal: {
52
+ className: D("horizontal"),
53
+ purpose: "Separate stacked content",
54
+ tokens: ["space-0"]
55
+ },
56
+ vertical: {
57
+ className: D("vertical"),
58
+ purpose: "Separate adjacent content",
59
+ tokens: ["space-0"]
60
+ }
61
+ },
62
+ strength: {
63
+ subtle: {
64
+ className: D("subtle"),
65
+ purpose: "Quiet structural boundary",
66
+ tokens: ["color-border-1"]
67
+ },
68
+ strong: {
69
+ className: D("strong"),
70
+ purpose: "Explicit structural boundary",
71
+ tokens: ["color-border-2"]
72
+ }
73
+ }
74
+ }), k = o({
75
+ orientation: "horizontal",
76
+ strength: "subtle"
77
+ }), ie = ({ className: e, decorative: t = !0, label: n, orientation: i = "horizontal", strength: a = "subtle", ...o }) => {
78
+ if (!t && n === void 0) throw Error("Semantic Divider label must contain visible text");
79
+ let c = t || n === void 0 ? void 0 : r(n, "Semantic Divider label");
80
+ return /* @__PURE__ */ x("div", {
81
+ ...o,
82
+ "aria-hidden": t ? "true" : void 0,
83
+ "aria-label": c,
84
+ "aria-orientation": t ? void 0 : i,
85
+ className: s(D("root"), O.orientation[i].className, O.strength[a].className, e),
86
+ role: t ? "presentation" : "separator"
87
+ });
88
+ }, ae = {
89
+ root: "rly_LimitTrack-module__root",
90
+ defaultSize: "rly_LimitTrack-module__defaultSize",
91
+ slim: "rly_LimitTrack-module__slim",
92
+ fill: "rly_LimitTrack-module__fill",
93
+ projection: "rly_LimitTrack-module__projection",
94
+ near: "rly_LimitTrack-module__near"
95
+ }, A = (e) => i(ae, e), j = o({ size: {
96
+ default: {
97
+ className: A("defaultSize"),
98
+ purpose: "A limit beside its numbers",
99
+ tokens: ["space-12", "radius-tag"]
100
+ },
101
+ slim: {
102
+ className: A("slim"),
103
+ purpose: "A limit inside a dense row",
104
+ tokens: ["space-6", "radius-tag"]
105
+ }
106
+ } }), oe = o({ size: "default" }), M = (e) => e !== null && Number.isFinite(e) ? e : null, N = (e, t) => {
107
+ if (!Number.isFinite(e)) throw Error(`${t} must be a finite number`);
108
+ return e;
109
+ }, se = (e, t) => {
110
+ let n = N(t, "limitTrackTone near"), r = M(e);
111
+ return r === null ? "unknown" : r >= 100 ? "full" : r >= n ? "near" : "ok";
112
+ }, P = (e) => Math.min(100, Math.max(0, e)), F = ({ className: e, decorative: t = !0, label: n, near: i = 80, projected: a, size: o = oe.size, stale: c = !1, value: l, valueText: u, ...d }) => {
113
+ let f = M(l), p = N(i, "LimitTrack near"), m = !t, h = m ? r(n ?? "", "LimitTrack label") : void 0, g = m ? r(u ?? "", "LimitTrack valueText") : void 0, _ = m && f !== null, v = f !== null && a !== void 0 && Number.isFinite(a) && a > f ? {
114
+ start: P(f),
115
+ length: P(a) - P(f)
116
+ } : null;
117
+ return /* @__PURE__ */ S("span", {
118
+ ...d,
119
+ "aria-hidden": m ? void 0 : "true",
120
+ "aria-label": m && !_ ? `${h}: ${g}` : h,
121
+ "aria-valuemax": _ ? 100 : void 0,
122
+ "aria-valuemin": _ ? 0 : void 0,
123
+ "aria-valuenow": _ && f !== null ? P(f) : void 0,
124
+ "aria-valuetext": _ ? g : void 0,
125
+ className: s(A("root"), j.size[o].className, e),
126
+ "data-stale": c ? "true" : void 0,
127
+ "data-tone": se(f, p),
128
+ role: m ? _ ? "meter" : "img" : void 0,
129
+ children: [
130
+ f === null ? null : /* @__PURE__ */ x("span", {
131
+ className: A("fill"),
132
+ "data-part": "fill",
133
+ style: { inlineSize: `${P(f)}%` }
134
+ }),
135
+ v === null ? null : /* @__PURE__ */ x("span", {
136
+ className: A("projection"),
137
+ "data-part": "projection",
138
+ style: {
139
+ inlineSize: `${v.length}%`,
140
+ insetInlineStart: `${v.start}%`
141
+ }
142
+ }),
143
+ /* @__PURE__ */ x("span", {
144
+ className: A("near"),
145
+ "data-part": "near",
146
+ style: { insetInlineStart: `min(${P(p)}%, 100% - 1px)` }
147
+ })
148
+ ]
149
+ });
150
+ }, I = {
151
+ root: "rly_Notice-module__root",
152
+ neutral: "rly_Notice-module__neutral",
153
+ positive: "rly_Notice-module__positive",
154
+ critical: "rly_Notice-module__critical",
155
+ caution: "rly_Notice-module__caution",
156
+ progress: "rly_Notice-module__progress",
157
+ icon: "rly_Notice-module__icon",
158
+ lead: "rly_Notice-module__lead",
159
+ message: "rly_Notice-module__message",
160
+ action: "rly_Notice-module__action"
161
+ }, L = (e) => i(I, e), ce = o({ tone: {
162
+ neutral: {
163
+ className: L("neutral"),
164
+ purpose: "Neutral context",
165
+ tokens: ["color-text-2", "color-border-1"]
166
+ },
167
+ positive: {
168
+ className: L("positive"),
169
+ purpose: "Completed outcome",
170
+ tokens: ["color-success-ink"]
171
+ },
172
+ critical: {
173
+ className: L("critical"),
174
+ purpose: "Failure that needs attention",
175
+ tokens: ["color-blocked-ink"]
176
+ },
177
+ caution: {
178
+ className: L("caution"),
179
+ purpose: "Limitation or warning",
180
+ tokens: ["color-held-ink"]
181
+ },
182
+ progress: {
183
+ className: L("progress"),
184
+ purpose: "Work in progress",
185
+ tokens: ["color-deploying-ink"]
186
+ }
187
+ } }), le = o({ tone: "neutral" }), ue = {
188
+ neutral: void 0,
189
+ positive: "check",
190
+ critical: "alert",
191
+ caution: "clock",
192
+ progress: "loader"
193
+ }, de = ({ action: e, announce: t = "off", children: r, className: i, icon: a, tone: o = "neutral", ...c }) => {
194
+ let l = a ?? ue[o], u = t === "assertive" ? "alert" : t === "polite" ? "status" : c.role;
195
+ return /* @__PURE__ */ S("div", {
196
+ ...c,
197
+ "aria-live": t === "off" ? void 0 : t,
198
+ className: s(L("root"), ce.tone[o].className, i),
199
+ role: u,
200
+ children: [/* @__PURE__ */ S("div", {
201
+ className: L("lead"),
202
+ children: [l === void 0 ? null : /* @__PURE__ */ x("span", {
203
+ "aria-hidden": "true",
204
+ className: L("icon"),
205
+ children: /* @__PURE__ */ x(n, {
206
+ decorative: !0,
207
+ name: l,
208
+ size: "small"
209
+ })
210
+ }), /* @__PURE__ */ x("div", {
211
+ className: L("message"),
212
+ children: r
213
+ })]
214
+ }), e === void 0 ? null : /* @__PURE__ */ x("div", {
215
+ className: L("action"),
216
+ children: e
217
+ })]
218
+ });
219
+ }, fe = [
220
+ 1,
221
+ 2,
222
+ 3,
223
+ 6,
224
+ 12,
225
+ 24
226
+ ], R = 24, z = (e, t) => {
227
+ let n = [];
228
+ for (let r = 0; r < e; r += t) n.push(r);
229
+ return e % t > 0 && n.length > 1 && n.pop(), n;
230
+ }, pe = (e) => {
231
+ for (let [t, n] of e.entries()) {
232
+ let r = e[t - 1];
233
+ if (n.end < n.start || r !== void 0 && n.start < r.end) throw Error(`StackedBars columns must be in time order without overlaps; column ${t} is not`);
234
+ }
235
+ }, me = (e) => {
236
+ let t = /* @__PURE__ */ new Map();
237
+ for (let n of e) for (let e of n.segments) t.has(e.id) || t.set(e.id, t.size);
238
+ return t;
239
+ }, he = (e, t, n) => {
240
+ let r = e[0]?.start ?? 0, i = Math.max(1, (e[e.length - 1]?.end ?? r) - r), a = z(e.length, t), o = Infinity;
241
+ for (let [t, s] of a.entries()) {
242
+ let c = (a[t + 1] ?? e.length) - 1;
243
+ o = Math.min(o, ((e[c]?.end ?? r) - (e[s]?.start ?? r)) / i * n);
244
+ }
245
+ return o;
246
+ }, ge = (e, t, n = 6) => {
247
+ if (t.length === 0) return 1;
248
+ let r = fe.find((r) => he(t, r, e) >= n);
249
+ if (r !== void 0) return r;
250
+ for (let r = 2; r * R < t.length; r += 1) if (he(t, r * R, e) >= n) return r * R;
251
+ return t.length;
252
+ }, _e = (e, t, n) => {
253
+ let r = Math.max(1, t.reduce((e, t) => e + Math.max(0, t.end - t.start), 0)) / Math.max(1, t.length);
254
+ return e.map((e) => r * n / Math.max(1, e.end - e.start));
255
+ }, ve = (e, t) => {
256
+ let n = [], r = me(e), i = z(e.length, t);
257
+ for (let [t, a] of i.entries()) {
258
+ let o = e.slice(a, i[t + 1] ?? e.length), s = /* @__PURE__ */ new Map();
259
+ for (let e of o.flatMap((e) => e.segments)) {
260
+ if (!Number.isFinite(e.value) || e.value <= 0) continue;
261
+ let t = s.get(e.id);
262
+ s.set(e.id, t === void 0 ? e : {
263
+ ...t,
264
+ value: t.value + e.value
265
+ });
266
+ }
267
+ let c = [...s.values()].sort((e, t) => (r.get(e.id) ?? 0) - (r.get(t.id) ?? 0)).reduce((e, t) => [...e, {
268
+ ...t,
269
+ offset: e.reduce((e, { value: t }) => e + t, 0)
270
+ }], []);
271
+ n.push({
272
+ end: o[o.length - 1]?.end ?? 0,
273
+ first: a,
274
+ last: a + o.length - 1,
275
+ segments: c,
276
+ start: o[0]?.start ?? 0,
277
+ total: c.reduce((e, { value: t }) => e + t, 0)
278
+ });
279
+ }
280
+ return n;
281
+ }, ye = (e, t, n, r) => {
282
+ let i = t[n];
283
+ return i === void 0 ? e : !r || e === null ? {
284
+ from: i.first,
285
+ to: i.last
286
+ } : {
287
+ from: Math.min(e.from, i.first),
288
+ to: Math.max(e.to, i.last)
289
+ };
290
+ }, be = (e, t, n) => {
291
+ let r = (e) => Math.max(0, Math.min(n, e));
292
+ switch (e) {
293
+ case "ArrowLeft": return r(t - 1);
294
+ case "ArrowRight": return r(t + 1);
295
+ case "Home": return 0;
296
+ case "End": return n;
297
+ default: return null;
298
+ }
299
+ }, xe = (e, t, n) => e.length === 0 ? [] : e.length === 1 ? t >= 2 * n ? [{
300
+ anchor: "start",
301
+ index: 0
302
+ }, { anchor: "end" }] : [{
303
+ anchor: "start",
304
+ index: 0
305
+ }] : [...e.reduce((r, i, a) => {
306
+ let o = r.at(-1);
307
+ return i - (o === void 0 ? -Infinity : e[o.index] ?? 0) >= n && i + n <= t - n ? [...r, {
308
+ anchor: "start",
309
+ index: a
310
+ }] : r;
311
+ }, []), { anchor: "end" }], Se = {
312
+ root: "rly_StackedBars-module__root",
313
+ band: "rly_StackedBars-module__band",
314
+ bandLabel: "rly_StackedBars-module__bandLabel",
315
+ scale: "rly_StackedBars-module__scale",
316
+ tick: "rly_StackedBars-module__tick",
317
+ bandPlot: "rly_StackedBars-module__bandPlot",
318
+ level: "rly_StackedBars-module__level",
319
+ unknown: "rly_StackedBars-module__unknown",
320
+ near: "rly_StackedBars-module__near",
321
+ plot: "rly_StackedBars-module__plot",
322
+ bars: "rly_StackedBars-module__bars",
323
+ segment: "rly_StackedBars-module__segment",
324
+ hit: "rly_StackedBars-module__hit",
325
+ selection: "rly_StackedBars-module__selection",
326
+ selectionHalo: "rly_StackedBars-module__selectionHalo",
327
+ selectionEdge: "rly_StackedBars-module__selectionEdge",
328
+ window: "rly_StackedBars-module__window",
329
+ windowEdge: "rly_StackedBars-module__windowEdge",
330
+ keys: "rly_StackedBars-module__keys",
331
+ windowKey: "rly_StackedBars-module__windowKey",
332
+ windowSwatch: "rly_StackedBars-module__windowSwatch",
333
+ nearSwatch: "rly_StackedBars-module__nearSwatch",
334
+ unknownSwatch: "rly_StackedBars-module__unknownSwatch",
335
+ focusRing: "rly_StackedBars-module__focusRing",
336
+ axis: "rly_StackedBars-module__axis",
337
+ barsClip: "rly_StackedBars-module__barsClip",
338
+ hidden: "rly_StackedBars-module__hidden"
339
+ }, B = (e) => i(Se, e), Ce = 72, we = 8, Te = 500, Ee = 24, De = (e, t) => {
340
+ if (a(e)) {
341
+ let n = e(t);
342
+ return a(n) ? n : () => e(null);
343
+ }
344
+ return e == null ? () => void 0 : (e.current = t, () => {
345
+ e.current = null;
346
+ });
347
+ }, Oe = (e, t) => {
348
+ let [n, r] = b(e);
349
+ return [n, m((e) => {
350
+ if (e === null) return;
351
+ let n = De(t, e), i = new ResizeObserver(([e]) => {
352
+ e !== void 0 && r(e.contentRect.width);
353
+ });
354
+ return i.observe(e), () => {
355
+ i.disconnect(), n();
356
+ };
357
+ }, [t])];
358
+ }, ke = (e) => Number.isFinite(e) ? Math.min(100, Math.max(0, e)) : null, V = (e) => {
359
+ if (!Number.isFinite(e)) throw Error("StackedBars near level must be a finite percentage");
360
+ return Math.min(100, Math.max(0, e));
361
+ }, Ae = (e, t, n) => Math.max(0, Math.min(1, (e - t) / Math.max(1, n - t))), je = ({ band: e, from: t, to: n, window: i }) => {
362
+ let a = (e) => Ae(e, t, n) * 1e3, o = e.near === void 0 ? void 0 : V(e.near.level);
363
+ return /* @__PURE__ */ S("div", {
364
+ className: B("band"),
365
+ "data-band": e.id,
366
+ children: [/* @__PURE__ */ x("span", {
367
+ className: B("bandLabel"),
368
+ children: r(e.label, "StackedBars band label")
369
+ }), /* @__PURE__ */ S("svg", {
370
+ "aria-hidden": "true",
371
+ className: B("bandPlot"),
372
+ preserveAspectRatio: "none",
373
+ viewBox: "0 0 1000 100",
374
+ children: [
375
+ i === void 0 ? null : /* @__PURE__ */ x("rect", {
376
+ className: B("window"),
377
+ "data-part": "window",
378
+ height: 100,
379
+ width: Math.max(0, a(i.to) - a(i.from)),
380
+ x: a(i.from)
381
+ }),
382
+ e.segments.map((e, t) => {
383
+ let n = a(e.from), r = a(e.to) - n;
384
+ if (r <= 0) return null;
385
+ let i = e.level === null ? null : ke(e.level);
386
+ if (i === null) return /* @__PURE__ */ x("rect", {
387
+ className: B("unknown"),
388
+ height: 100,
389
+ width: r,
390
+ x: n
391
+ }, `${t}:${e.from}`);
392
+ let s = i;
393
+ return /* @__PURE__ */ x("rect", {
394
+ className: B("level"),
395
+ "data-tone": s >= 100 ? "full" : o !== void 0 && s >= o ? "near" : "ok",
396
+ height: s,
397
+ width: r,
398
+ x: n,
399
+ y: 100 - s
400
+ }, `${t}:${e.from}`);
401
+ }),
402
+ o === void 0 ? null : /* @__PURE__ */ x("line", {
403
+ className: B("near"),
404
+ x1: 0,
405
+ x2: 1e3,
406
+ y1: 100 - o,
407
+ y2: 100 - o
408
+ }),
409
+ i === void 0 ? null : /* @__PURE__ */ x("rect", {
410
+ className: B("windowEdge"),
411
+ "data-part": "window-edge",
412
+ height: 100,
413
+ width: Math.max(0, a(i.to) - a(i.from)),
414
+ x: a(i.from)
415
+ })
416
+ ]
417
+ })]
418
+ });
419
+ }, H = ({ bands: e = [], className: t, columns: n, describeSelection: i, formatScale: a, formatTick: o, height: c = 180, instructions: l, label: u, noReadingLabel: d, onSelectionChange: f, ref: p, selection: m, window: C, ...w }) => {
420
+ pe(n);
421
+ let [T, ne] = Oe(720, p), re = g(), E = ge(T, n, Ee), D = v(() => ve(n, E), [n, E]), O = _e(D, n, E), k = Math.max(0, ...D.map(({ total: e }, t) => e * (O[t] ?? 1))), ie = [...new Set(e.flatMap((e) => e.near === void 0 ? [] : [r(e.near.label, "StackedBars near label")]))], ae = e.some((e) => e.segments.some((e) => e.level === null || ke(e.level) === null)) ? r(d ?? "", "StackedBars noReadingLabel (a band has a stretch with no reading)") : void 0, A = n[0]?.start ?? 0, j = n[n.length - 1]?.end ?? A, [oe, M] = b(Ce), N = y(null), se = xe(D.map((e) => Ae(e.start, A, j) * T), T, oe), [P, F] = b(null), [I, L] = b(null), ce = y("mouse"), le = y(m), [ue, de] = b(0), fe = (e) => {
422
+ le.current = e, de((e) => e + 1), f(e);
423
+ }, R = m?.from, z = m?.to;
424
+ h(() => {
425
+ let e = le.current;
426
+ (e === null ? R !== void 0 : e.from !== R || e.to !== z) && (F(null), L(null)), le.current = R === void 0 || z === void 0 ? null : {
427
+ from: R,
428
+ to: z
429
+ };
430
+ }, [R, z]);
431
+ let [me, he] = b(""), Se = y("");
432
+ Se.current = i(m);
433
+ let De = (e) => Math.min(D.length - 1, Math.floor(e / E)), V = P === null ? null : De(P);
434
+ h(() => {
435
+ if (ue === 0) return;
436
+ he("");
437
+ let e = setTimeout(() => he(Se.current), Te);
438
+ return () => clearTimeout(e);
439
+ }, [ue]), _(() => {
440
+ M(Ce);
441
+ }, [
442
+ E,
443
+ A,
444
+ j
445
+ ]);
446
+ let [H, Me] = b(void 0);
447
+ _(() => {
448
+ let e = [...N.current?.querySelectorAll("[data-anchor]") ?? []], t = Math.max(0, ...e.map((e) => e.scrollWidth));
449
+ t + we > oe && M(t + we);
450
+ let n = Math.max(0, ...e.map((e) => e.offsetHeight));
451
+ n > 0 && n !== H && Me(n);
452
+ });
453
+ let U = (e) => {
454
+ if (e.key === "Escape") {
455
+ if (m === null) return;
456
+ e.preventDefault(), F(null), L(null), fe(null);
457
+ return;
458
+ }
459
+ if (D.length === 0) return;
460
+ let t = V ?? (m === null ? D.length - 1 : De(m.to)), n = be(e.key, t, D.length - 1);
461
+ n !== null && (e.preventDefault(), F(D[n]?.first ?? null), L(null), fe(ye(m, D, n, e.shiftKey)));
462
+ }, W = n[0]?.start ?? 0, Ne = n[n.length - 1]?.end ?? W, G = (e) => Ae(e, W, Ne) * 1e3, K = (e, t) => ({
463
+ width: Math.max(0, G(t) - G(e)),
464
+ x: G(e)
465
+ }), q = C === void 0 ? null : K(C.from, C.to), J = m === null ? void 0 : n[Math.max(0, m.from)], Pe = m === null ? void 0 : n[Math.min(n.length - 1, m.to)], Y = J === void 0 || Pe === void 0 ? null : K(J.start, Pe.end), Fe = V === null ? void 0 : D[V], Ie = Math.max(Ee, c), X = 1e3 / Math.max(1, T), Z = 100 / Ie, Q = Fe === void 0 ? null : K(Fe.start, Fe.end);
466
+ return /* @__PURE__ */ S("div", {
467
+ ...w,
468
+ className: s(B("root"), t),
469
+ ref: ne,
470
+ children: [
471
+ e.map((e) => /* @__PURE__ */ x(je, {
472
+ band: e,
473
+ from: W,
474
+ to: Ne,
475
+ window: C
476
+ }, e.id)),
477
+ /* @__PURE__ */ x("span", {
478
+ className: B("scale"),
479
+ children: a(k, E)
480
+ }),
481
+ /* @__PURE__ */ x("div", {
482
+ "aria-describedby": re,
483
+ "aria-label": r(u, "StackedBars label"),
484
+ "aria-roledescription": "chart",
485
+ className: B("plot"),
486
+ onBlur: () => F(null),
487
+ onKeyDown: U,
488
+ role: "group",
489
+ style: { blockSize: `${Ie}px` },
490
+ tabIndex: 0,
491
+ children: /* @__PURE__ */ S("svg", {
492
+ "aria-hidden": "true",
493
+ className: B("bars"),
494
+ preserveAspectRatio: "none",
495
+ viewBox: "0 0 1000 100",
496
+ children: [
497
+ q === null || q.width <= 0 ? null : /* @__PURE__ */ x("rect", {
498
+ className: B("window"),
499
+ "data-part": "window",
500
+ height: 100,
501
+ width: q.width,
502
+ x: q.x
503
+ }),
504
+ Y === null || Y.width <= 0 ? null : /* @__PURE__ */ x("rect", {
505
+ className: B("selection"),
506
+ "data-part": "selection",
507
+ height: 100,
508
+ width: Y.width,
509
+ x: Y.x
510
+ }),
511
+ /* @__PURE__ */ x("g", {
512
+ className: B("barsClip"),
513
+ children: D.map((e, t) => {
514
+ let n = K(e.start, e.end), r = m !== null && e.last >= m.from && e.first <= m.to;
515
+ return /* @__PURE__ */ S("g", {
516
+ "data-bin": t,
517
+ "data-focused": V === t ? "true" : void 0,
518
+ "data-selected": r ? "true" : void 0,
519
+ onClick: (n) => {
520
+ let r = ce.current === "touch", i = n.shiftKey || r && m !== null && I !== null && I >= m.from && I <= m.to && (I < e.first || I > e.last);
521
+ fe(ye(m, D, t, i)), F(e.first), L(r && !i ? e.first : null);
522
+ },
523
+ onPointerDown: (e) => {
524
+ ce.current = e.pointerType;
525
+ },
526
+ children: [/* @__PURE__ */ x("rect", {
527
+ className: B("hit"),
528
+ height: 100,
529
+ width: n.width,
530
+ x: n.x
531
+ }), e.segments.map((e) => {
532
+ let r = O[t] ?? 1, i = k === 0 ? 0 : (e.offset + e.value) * r / k * 88, a = k === 0 ? 0 : e.value * r / k * 88;
533
+ return /* @__PURE__ */ x("rect", {
534
+ className: B("segment"),
535
+ "data-series": String(e.series),
536
+ fill: te(e.series),
537
+ height: a,
538
+ width: n.width,
539
+ x: n.x,
540
+ y: 100 - i
541
+ }, e.id);
542
+ })]
543
+ }, e.first);
544
+ })
545
+ }),
546
+ Y === null || Y.width <= 0 ? null : /* @__PURE__ */ S(ee, { children: [/* @__PURE__ */ x("rect", {
547
+ className: B("selectionHalo"),
548
+ "data-part": "selection-halo",
549
+ height: 100,
550
+ width: Y.width,
551
+ x: Y.x
552
+ }), /* @__PURE__ */ x("rect", {
553
+ className: B("selectionEdge"),
554
+ "data-part": "selection-edge",
555
+ height: 100,
556
+ width: Y.width,
557
+ x: Y.x
558
+ })] }),
559
+ q === null || q.width <= 0 ? null : /* @__PURE__ */ x("rect", {
560
+ className: B("windowEdge"),
561
+ "data-part": "window-edge",
562
+ height: 100,
563
+ width: q.width,
564
+ x: q.x
565
+ }),
566
+ Q === null ? null : /* @__PURE__ */ x("rect", {
567
+ className: B("focusRing"),
568
+ "data-part": "focus-ring",
569
+ height: Math.max(0, 100 - 2 * Z),
570
+ width: Math.max(0, Q.width - 2 * X),
571
+ x: Q.x + X,
572
+ y: Z
573
+ })
574
+ ]
575
+ })
576
+ }),
577
+ /* @__PURE__ */ x("div", {
578
+ "aria-hidden": "true",
579
+ className: B("axis"),
580
+ ref: N,
581
+ style: H === void 0 ? void 0 : { blockSize: `${H}px` },
582
+ children: se.map((e) => {
583
+ let t = e.anchor === "end" ? j : D[e.index]?.start;
584
+ return t === void 0 ? null : /* @__PURE__ */ x("span", {
585
+ className: B("tick"),
586
+ "data-anchor": e.anchor,
587
+ style: e.anchor === "end" ? { right: 0 } : { left: `${G(t) / 10}%` },
588
+ children: o(t, E)
589
+ }, e.anchor === "end" ? "end" : e.index);
590
+ })
591
+ }),
592
+ C === void 0 && ie.length === 0 && ae === void 0 ? null : /* @__PURE__ */ S("ul", {
593
+ className: B("keys"),
594
+ role: "list",
595
+ children: [
596
+ C === void 0 ? null : /* @__PURE__ */ S("li", {
597
+ className: B("windowKey"),
598
+ children: [/* @__PURE__ */ x("span", {
599
+ "aria-hidden": "true",
600
+ className: B("windowSwatch")
601
+ }), r(C.label, "StackedBars window label")]
602
+ }),
603
+ ie.map((e) => /* @__PURE__ */ S("li", {
604
+ className: B("windowKey"),
605
+ children: [/* @__PURE__ */ x("span", {
606
+ "aria-hidden": "true",
607
+ className: B("nearSwatch")
608
+ }), e]
609
+ }, e)),
610
+ ae === void 0 ? null : /* @__PURE__ */ S("li", {
611
+ className: B("windowKey"),
612
+ children: [/* @__PURE__ */ x("span", {
613
+ "aria-hidden": "true",
614
+ className: B("unknownSwatch")
615
+ }), ae]
616
+ })
617
+ ]
618
+ }),
619
+ /* @__PURE__ */ x("p", {
620
+ className: B("hidden"),
621
+ id: re,
622
+ children: r(l, "StackedBars instructions")
623
+ }),
624
+ /* @__PURE__ */ x("p", {
625
+ "aria-live": "polite",
626
+ className: B("hidden"),
627
+ children: me
628
+ })
629
+ ]
630
+ });
631
+ }, Me = {
632
+ root: "rly_Surface-module__root",
633
+ tonePrimary: "rly_Surface-module__tonePrimary",
634
+ toneSecondary: "rly_Surface-module__toneSecondary",
635
+ toneTertiary: "rly_Surface-module__toneTertiary",
636
+ shapeCard: "rly_Surface-module__shapeCard",
637
+ shapeGrouped: "rly_Surface-module__shapeGrouped",
638
+ paddingNone: "rly_Surface-module__paddingNone",
639
+ paddingCompact: "rly_Surface-module__paddingCompact",
640
+ paddingDefault: "rly_Surface-module__paddingDefault",
641
+ paddingSpacious: "rly_Surface-module__paddingSpacious"
642
+ }, U = (e) => i(Me, e), W = o({
643
+ tone: {
644
+ primary: {
645
+ className: U("tonePrimary"),
646
+ purpose: "Primary bordered surface",
647
+ tokens: ["color-surface-1", "color-border-1"]
648
+ },
649
+ secondary: {
650
+ className: U("toneSecondary"),
651
+ purpose: "Quiet secondary surface",
652
+ tokens: ["color-surface-2"]
653
+ },
654
+ tertiary: {
655
+ className: U("toneTertiary"),
656
+ purpose: "Inset tertiary surface",
657
+ tokens: ["color-surface-3"]
658
+ }
659
+ },
660
+ form: {
661
+ card: {
662
+ className: U("shapeCard"),
663
+ purpose: "Standard card geometry",
664
+ tokens: ["radius-control"]
665
+ },
666
+ grouped: {
667
+ className: U("shapeGrouped"),
668
+ purpose: "Grouped content geometry",
669
+ tokens: ["radius-group"]
670
+ }
671
+ },
672
+ padding: {
673
+ none: {
674
+ className: U("paddingNone"),
675
+ purpose: "Caller-owned internal layout",
676
+ tokens: ["space-0"]
677
+ },
678
+ compact: {
679
+ className: U("paddingCompact"),
680
+ purpose: "Dense supporting content",
681
+ tokens: ["space-16"]
682
+ },
683
+ default: {
684
+ className: U("paddingDefault"),
685
+ purpose: "Standard content",
686
+ tokens: ["space-24"]
687
+ },
688
+ spacious: {
689
+ className: U("paddingSpacious"),
690
+ purpose: "Prominent grouped content",
691
+ tokens: ["space-32"]
692
+ }
693
+ }
694
+ }), Ne = o({
695
+ tone: "primary",
696
+ form: "card",
697
+ padding: "default"
698
+ }), G = ({ as: e, children: t, className: n, form: r = "card", padding: i = "default", ref: a, tone: o = "primary", ...c }) => p(e ?? "div", {
699
+ ...c,
700
+ className: s(U("root"), W.tone[o].className, W.form[r].className, W.padding[i].className, n),
701
+ ref: a
702
+ }, t), K = {
703
+ root: "rly_Tabs-module__root",
704
+ list: "rly_Tabs-module__list",
705
+ trigger: "rly_Tabs-module__trigger",
706
+ defaultSize: "rly_Tabs-module__defaultSize",
707
+ large: "rly_Tabs-module__large",
708
+ panel: "rly_Tabs-module__panel"
709
+ }, q = (e) => i(K, e), J = o({ size: {
710
+ default: {
711
+ className: q("defaultSize"),
712
+ purpose: "Standard section navigation",
713
+ tokens: [
714
+ "type-label",
715
+ "space-40",
716
+ "space-4"
717
+ ]
718
+ },
719
+ large: {
720
+ className: q("large"),
721
+ purpose: "Prominent page-level navigation",
722
+ tokens: ["type-body", "space-48"]
723
+ }
724
+ } }), Pe = o({ size: "default" }), Y = (e) => {
725
+ if (e.length === 0) throw Error("Tabs items must contain at least one enabled tab");
726
+ let t = /* @__PURE__ */ new Set(), n;
727
+ for (let i of e) {
728
+ let e = r(i.value, "Tab value");
729
+ if (r(i.label, `Tab label for ${e}`), t.has(e)) throw Error(`Tabs item values must be unique: ${e}`);
730
+ t.add(e), !i.disabled && n === void 0 && (n = i);
731
+ }
732
+ if (n === void 0) throw Error("Tabs items must contain at least one enabled tab");
733
+ return n;
734
+ }, Fe = ({ "aria-label": e, className: t, defaultValue: n, direction: i, items: a, onValueChange: o, ref: c, size: l = "default", value: u, ...d }) => {
735
+ let m = r(e, "Tabs aria-label"), h = Y(a), g = u ?? n ?? h.value, _ = a.find((e) => e.value === g);
736
+ if (_ === void 0 || _.disabled) throw Error(`Tabs selected value must identify an enabled tab: ${g}`);
737
+ let v = u === void 0 ? o === void 0 ? { defaultValue: g } : {
738
+ defaultValue: g,
739
+ onValueChange: o
740
+ } : {
741
+ onValueChange: o,
742
+ value: u
743
+ }, y = i === void 0 ? {} : { dir: i };
744
+ return /* @__PURE__ */ S(f.Root, {
745
+ ...d,
746
+ ...v,
747
+ ...y,
748
+ activationMode: "automatic",
749
+ className: s(q("root"), J.size[l].className, t),
750
+ orientation: "horizontal",
751
+ ref: c,
752
+ children: [/* @__PURE__ */ x(f.List, {
753
+ "aria-label": m,
754
+ className: q("list"),
755
+ loop: !0,
756
+ children: a.map((e) => /* @__PURE__ */ x(f.Trigger, {
757
+ className: q("trigger"),
758
+ "data-tab-value": e.value,
759
+ disabled: e.disabled,
760
+ value: e.value,
761
+ children: e.label
762
+ }, e.value))
763
+ }), a.map((e) => /* @__PURE__ */ p(f.Content, {
764
+ className: q("panel"),
765
+ ...e.forceMount === void 0 ? {} : { forceMount: e.forceMount },
766
+ key: e.value,
767
+ value: e.value
768
+ }, e.content))]
769
+ });
770
+ }, Ie = {
771
+ root: "rly_Text-module__root",
772
+ verdict: "rly_Text-module__verdict",
773
+ pageTitle: "rly_Text-module__pageTitle",
774
+ sectionTitle: "rly_Text-module__sectionTitle",
775
+ cardTitle: "rly_Text-module__cardTitle",
776
+ bodyLarge: "rly_Text-module__bodyLarge",
777
+ body: "rly_Text-module__body",
778
+ label: "rly_Text-module__label",
779
+ meta: "rly_Text-module__meta",
780
+ code: "rly_Text-module__code",
781
+ tonePrimary: "rly_Text-module__tonePrimary",
782
+ toneSecondary: "rly_Text-module__toneSecondary",
783
+ toneTertiary: "rly_Text-module__toneTertiary",
784
+ toneInherit: "rly_Text-module__toneInherit"
785
+ }, X = (e) => i(Ie, e), Z = o({
786
+ variant: {
787
+ verdict: {
788
+ className: X("verdict"),
789
+ purpose: "One restrained verdict thesis",
790
+ tokens: ["type-verdict"]
791
+ },
792
+ "page-title": {
793
+ className: X("pageTitle"),
794
+ purpose: "Primary page title",
795
+ tokens: ["type-page-title"]
796
+ },
797
+ "section-title": {
798
+ className: X("sectionTitle"),
799
+ purpose: "Section heading",
800
+ tokens: ["type-section-title"]
801
+ },
802
+ "card-title": {
803
+ className: X("cardTitle"),
804
+ purpose: "Card or panel heading",
805
+ tokens: ["type-card-title"]
806
+ },
807
+ "body-large": {
808
+ className: X("bodyLarge"),
809
+ purpose: "Leading explanatory copy",
810
+ tokens: ["type-body-large"]
811
+ },
812
+ body: {
813
+ className: X("body"),
814
+ purpose: "Default interface copy",
815
+ tokens: ["type-body"]
816
+ },
817
+ label: {
818
+ className: X("label"),
819
+ purpose: "Control and metadata labels",
820
+ tokens: ["type-label"]
821
+ },
822
+ meta: {
823
+ className: X("meta"),
824
+ purpose: "Supporting metadata",
825
+ tokens: ["type-meta"]
826
+ },
827
+ code: {
828
+ className: X("code"),
829
+ purpose: "Code and tabular data",
830
+ tokens: ["type-code"]
831
+ }
832
+ },
833
+ tone: {
834
+ primary: {
835
+ className: X("tonePrimary"),
836
+ purpose: "Primary readable text",
837
+ tokens: ["color-text-1"]
838
+ },
839
+ secondary: {
840
+ className: X("toneSecondary"),
841
+ purpose: "Supporting text",
842
+ tokens: ["color-text-2"]
843
+ },
844
+ tertiary: {
845
+ className: X("toneTertiary"),
846
+ purpose: "Restricted tertiary text",
847
+ tokens: ["color-text-3"]
848
+ },
849
+ inherit: {
850
+ className: X("toneInherit"),
851
+ purpose: "Inherit semantic context",
852
+ tokens: []
853
+ }
854
+ }
855
+ }), Q = o({
856
+ variant: "body",
857
+ tone: "primary"
858
+ }), Le = (e) => e === "code" ? "code" : e === "verdict" ? "p" : e === "label" || e === "meta" ? "span" : "p", Re = ({ as: e, children: t, className: n, ref: r, tone: i = Q.tone, variant: a = Q.variant, ...o }) => p(e ?? Le(a), {
859
+ ...o,
860
+ className: s(X("root"), Z.variant[a].className, Z.tone[i].className, n),
861
+ ref: r
862
+ }, t), ze = { intrinsic: "rly_ThemeSelect-module__intrinsic" }, Be = {
863
+ system: "System",
864
+ light: "Light",
865
+ dark: "Dark"
866
+ }, Ve = t.map((e) => ({
867
+ label: Be[e],
868
+ value: e
869
+ })), He = ({ className: t, label: n = "Appearance", labelVisibility: r = "visible", onValueChange: a, size: o = u.size, value: d }) => {
870
+ let f = (t) => {
871
+ let n = e(t);
872
+ n !== void 0 && a(n);
873
+ };
874
+ return r === "hidden" ? /* @__PURE__ */ x(c, {
875
+ "aria-label": n,
876
+ className: s(i(ze, "intrinsic"), t),
877
+ onValueChange: f,
878
+ options: Ve,
879
+ size: o,
880
+ value: d
881
+ }) : /* @__PURE__ */ x(l, {
882
+ ...t === void 0 ? {} : { className: t },
883
+ label: n,
884
+ size: o,
885
+ children: (e) => /* @__PURE__ */ x(c, {
886
+ ...e,
887
+ onValueChange: f,
888
+ options: Ve,
889
+ size: o,
890
+ value: d
891
+ })
892
+ });
893
+ }, Ue = {
894
+ root: "rly_ToggleGroup-module__root",
895
+ item: "rly_ToggleGroup-module__item",
896
+ dense: "rly_ToggleGroup-module__dense",
897
+ compact: "rly_ToggleGroup-module__compact",
898
+ defaultSize: "rly_ToggleGroup-module__defaultSize"
899
+ }, $ = (e) => i(Ue, e), We = o({ size: {
900
+ dense: {
901
+ className: $("dense"),
902
+ purpose: "Tool-density choice beside dense controls; the default",
903
+ tokens: [
904
+ "control-height-dense",
905
+ "type-meta",
906
+ "radius-tag"
907
+ ]
908
+ },
909
+ compact: {
910
+ className: $("compact"),
911
+ purpose: "Filter rows beside compact controls",
912
+ tokens: [
913
+ "control-height-compact",
914
+ "type-meta",
915
+ "radius-tag"
916
+ ]
917
+ },
918
+ default: {
919
+ className: $("defaultSize"),
920
+ purpose: "Standard view and filter choices",
921
+ tokens: [
922
+ "control-height-default",
923
+ "type-label",
924
+ "radius-tag"
925
+ ]
926
+ }
927
+ } }), Ge = o({ size: "dense" }), Ke = (e) => e === "ArrowLeft" || e === "ArrowUp" ? -1 : e === "ArrowRight" || e === "ArrowDown" ? 1 : null, qe = (e, t) => {
928
+ let n = /* @__PURE__ */ new Set();
929
+ for (let t of e) {
930
+ let e = r(t.value, "ToggleGroup item value");
931
+ if (r(t.label, `ToggleGroup item label for ${e}`), n.has(e)) throw Error(`ToggleGroup item values must be unique: ${e}`);
932
+ n.add(e);
933
+ }
934
+ if (!n.has(t)) throw Error(`ToggleGroup value must identify an option: ${t}`);
935
+ }, Je = ({ "aria-label": e, className: t, items: n, onValueChange: i, ref: a, size: o = Ge.size, value: c, ...l }) => {
936
+ let u = r(e, "ToggleGroup aria-label");
937
+ qe(n, c);
938
+ let f = y(/* @__PURE__ */ new Map()), p = (e, t) => {
939
+ let r = Ke(e.key);
940
+ if (r === null) return;
941
+ e.preventDefault();
942
+ let a = n[(t + r + n.length) % n.length];
943
+ a !== void 0 && (a.value !== c && i(a.value), f.current.get(a.value)?.focus());
944
+ };
945
+ return /* @__PURE__ */ x(d.Root, {
946
+ ...l,
947
+ "aria-label": u,
948
+ className: s($("root"), We.size[o].className, t),
949
+ loop: !0,
950
+ onValueChange: i,
951
+ orientation: "horizontal",
952
+ ref: a,
953
+ value: c,
954
+ children: n.map((e, t) => /* @__PURE__ */ x(d.Item, {
955
+ className: $("item"),
956
+ onKeyDown: (e) => p(e, t),
957
+ ref: (t) => {
958
+ t === null ? f.current.delete(e.value) : f.current.set(e.value, t);
959
+ },
960
+ value: e.value,
961
+ children: e.label
962
+ }, e.value))
963
+ });
964
+ }, Ye = {
965
+ root: "rly_TrackKey-module__root",
966
+ item: "rly_TrackKey-module__item",
967
+ near: "rly_TrackKey-module__near",
968
+ projected: "rly_TrackKey-module__projected",
969
+ stale: "rly_TrackKey-module__stale",
970
+ unknown: "rly_TrackKey-module__unknown"
971
+ }, Xe = (e) => i(Ye, e), Ze = [
972
+ "near",
973
+ "projected",
974
+ "stale",
975
+ "unknown"
976
+ ], Qe = ({ className: e, items: t, label: n, ...i }) => {
977
+ if (t.length === 0) throw Error("TrackKey needs at least one mark to explain");
978
+ let a = /* @__PURE__ */ new Set();
979
+ for (let e of t) {
980
+ if (a.has(e.mark)) throw Error(`TrackKey marks must be unique: ${e.mark}`);
981
+ a.add(e.mark);
982
+ }
983
+ return /* @__PURE__ */ x("ul", {
984
+ ...i,
985
+ "aria-label": r(n, "TrackKey label"),
986
+ className: s(Xe("root"), e),
987
+ role: "list",
988
+ children: t.map((e) => /* @__PURE__ */ S("li", {
989
+ className: Xe("item"),
990
+ children: [/* @__PURE__ */ x("span", {
991
+ "aria-hidden": "true",
992
+ className: Xe(e.mark),
993
+ "data-mark": e.mark
994
+ }), r(e.label, "TrackKey item label")]
995
+ }, e.mark))
996
+ });
997
+ };
998
+ //#endregion
999
+ export { se as C, re as D, O as E, T as O, j as S, k as T, de as _, Je as a, F as b, Z as c, J as d, Fe as f, H as g, G as h, We as i, te as k, Re as l, W as m, Qe as n, He as o, Ne as p, Ge as r, Q as s, Ze as t, Pe as u, le as v, ie as w, oe as x, ce as y };
1000
+
1001
+ //# sourceMappingURL=primitives-Bd6WhE78.js.map