@apliteni/apliteni-ui 0.159.0 → 0.161.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/docs/components.md +33 -1
- package/guidelines/dense-tables.md +2 -2
- package/package.json +1 -1
- package/react/dist/index.d.ts +8 -1
- package/react/dist/index.js +284 -140
- package/src/styles/button.css +79 -5
- package/src/styles/table.css +41 -26
package/react/dist/index.js
CHANGED
|
@@ -58,8 +58,8 @@ var Switch = forwardRef2(function Switch2({
|
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
// src/primitives/Button.tsx
|
|
61
|
-
import { forwardRef as forwardRef3, useImperativeHandle, useLayoutEffect, useRef } from "react";
|
|
62
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
61
|
+
import { forwardRef as forwardRef3, useEffect, useId as useId2, useImperativeHandle, useLayoutEffect, useRef } from "react";
|
|
62
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
63
63
|
var announcers = /* @__PURE__ */ new WeakMap();
|
|
64
64
|
function acquireAnnouncer(doc) {
|
|
65
65
|
let entry = announcers.get(doc);
|
|
@@ -90,6 +90,11 @@ function acquireAnnouncer(doc) {
|
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
92
|
}
|
|
93
|
+
var HOLD_MS = 1e3;
|
|
94
|
+
var TAP_MS = 300;
|
|
95
|
+
var STEP_MS = 250;
|
|
96
|
+
var TWICE_MS = 3e3;
|
|
97
|
+
var HOLD_HELP = "Hold to confirm, or press twice.";
|
|
93
98
|
var cx = (...a) => a.filter(Boolean).join(" ");
|
|
94
99
|
var Button = forwardRef3(function Button2({
|
|
95
100
|
variant = "secondary",
|
|
@@ -102,6 +107,8 @@ var Button = forwardRef3(function Button2({
|
|
|
102
107
|
busy,
|
|
103
108
|
completionMessage,
|
|
104
109
|
children,
|
|
110
|
+
hold,
|
|
111
|
+
onConfirm,
|
|
105
112
|
type = "button",
|
|
106
113
|
href,
|
|
107
114
|
disabled,
|
|
@@ -142,6 +149,128 @@ var Button = forwardRef3(function Button2({
|
|
|
142
149
|
announcer.current = null;
|
|
143
150
|
previous.current = null;
|
|
144
151
|
}, []);
|
|
152
|
+
const holds = hold === true && href === void 0;
|
|
153
|
+
const holdHelpId = useId2();
|
|
154
|
+
const live = useRef({ busy, disabled, onConfirm });
|
|
155
|
+
live.current = { busy, disabled, onConfirm };
|
|
156
|
+
const cancelHold = useRef(() => {
|
|
157
|
+
});
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
const btn = buttonRef.current;
|
|
160
|
+
if (!holds || !btn) return;
|
|
161
|
+
let by = null, start = 0, frame = 0, armedUntil = 0;
|
|
162
|
+
let step, done;
|
|
163
|
+
const reduced = () => typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
164
|
+
const paint = (p) => btn.style.setProperty("--hold", String(p));
|
|
165
|
+
const hint = (on) => btn.toggleAttribute("data-hold-hint", on);
|
|
166
|
+
const fillEl = btn.querySelector(".ui-btn__hold-fill");
|
|
167
|
+
let drained;
|
|
168
|
+
const undrain = () => {
|
|
169
|
+
clearTimeout(drained);
|
|
170
|
+
btn.removeAttribute("data-hold-drain");
|
|
171
|
+
};
|
|
172
|
+
const stop = () => {
|
|
173
|
+
by = null;
|
|
174
|
+
cancelAnimationFrame(frame);
|
|
175
|
+
clearInterval(step);
|
|
176
|
+
clearTimeout(done);
|
|
177
|
+
};
|
|
178
|
+
const confirm = () => {
|
|
179
|
+
stop();
|
|
180
|
+
paint(0);
|
|
181
|
+
btn.removeAttribute("data-holding");
|
|
182
|
+
hint(false);
|
|
183
|
+
live.current.onConfirm?.();
|
|
184
|
+
};
|
|
185
|
+
const tick = () => {
|
|
186
|
+
paint(Math.min(1, (performance.now() - start) / HOLD_MS));
|
|
187
|
+
frame = requestAnimationFrame(tick);
|
|
188
|
+
};
|
|
189
|
+
const begin = (source) => {
|
|
190
|
+
if (by || live.current.busy || live.current.disabled) return;
|
|
191
|
+
by = source;
|
|
192
|
+
start = performance.now();
|
|
193
|
+
hint(false);
|
|
194
|
+
undrain();
|
|
195
|
+
btn.setAttribute("data-holding", "");
|
|
196
|
+
if (reduced()) {
|
|
197
|
+
let n = 0;
|
|
198
|
+
step = setInterval(() => paint(Math.min(4, ++n) / 4), STEP_MS);
|
|
199
|
+
} else frame = requestAnimationFrame(tick);
|
|
200
|
+
done = setTimeout(confirm, HOLD_MS);
|
|
201
|
+
};
|
|
202
|
+
const end = () => {
|
|
203
|
+
if (!by) return;
|
|
204
|
+
const short = performance.now() - start < TAP_MS;
|
|
205
|
+
stop();
|
|
206
|
+
btn.setAttribute("data-hold-drain", "");
|
|
207
|
+
drained = setTimeout(undrain, HOLD_MS);
|
|
208
|
+
btn.removeAttribute("data-holding");
|
|
209
|
+
paint(0);
|
|
210
|
+
if (short) hint(true);
|
|
211
|
+
};
|
|
212
|
+
cancelHold.current = () => {
|
|
213
|
+
armedUntil = 0;
|
|
214
|
+
hint(false);
|
|
215
|
+
if (!by) return;
|
|
216
|
+
stop();
|
|
217
|
+
btn.removeAttribute("data-holding");
|
|
218
|
+
paint(0);
|
|
219
|
+
};
|
|
220
|
+
const onPointerDown = (e) => {
|
|
221
|
+
if (e.button !== 0) return;
|
|
222
|
+
btn.setPointerCapture?.(e.pointerId);
|
|
223
|
+
begin("pointer");
|
|
224
|
+
};
|
|
225
|
+
const onKeyDown2 = (e) => {
|
|
226
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
227
|
+
e.preventDefault();
|
|
228
|
+
if (!e.repeat) begin("key");
|
|
229
|
+
};
|
|
230
|
+
const onKeyUp2 = (e) => {
|
|
231
|
+
if (e.key !== "Enter" && e.key !== " ") return;
|
|
232
|
+
e.preventDefault();
|
|
233
|
+
end();
|
|
234
|
+
};
|
|
235
|
+
const onClick2 = (e) => {
|
|
236
|
+
if (e.detail !== 0 || by || live.current.busy || live.current.disabled) return;
|
|
237
|
+
if (performance.now() < armedUntil) {
|
|
238
|
+
armedUntil = 0;
|
|
239
|
+
confirm();
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
armedUntil = performance.now() + TWICE_MS;
|
|
243
|
+
hint(true);
|
|
244
|
+
};
|
|
245
|
+
const onContextMenu = (e) => e.preventDefault();
|
|
246
|
+
const listeners = [
|
|
247
|
+
["pointerdown", onPointerDown],
|
|
248
|
+
["pointerup", end],
|
|
249
|
+
["pointercancel", end],
|
|
250
|
+
["lostpointercapture", end],
|
|
251
|
+
["keydown", onKeyDown2],
|
|
252
|
+
["keyup", onKeyUp2],
|
|
253
|
+
["blur", end],
|
|
254
|
+
["click", onClick2],
|
|
255
|
+
["contextmenu", onContextMenu]
|
|
256
|
+
];
|
|
257
|
+
for (const [type2, fn] of listeners) btn.addEventListener(type2, fn);
|
|
258
|
+
fillEl?.addEventListener("transitionend", undrain);
|
|
259
|
+
return () => {
|
|
260
|
+
stop();
|
|
261
|
+
undrain();
|
|
262
|
+
cancelHold.current = () => {
|
|
263
|
+
};
|
|
264
|
+
fillEl?.removeEventListener("transitionend", undrain);
|
|
265
|
+
for (const [type2, fn] of listeners) btn.removeEventListener(type2, fn);
|
|
266
|
+
btn.removeAttribute("data-holding");
|
|
267
|
+
btn.removeAttribute("data-hold-hint");
|
|
268
|
+
btn.style.removeProperty("--hold");
|
|
269
|
+
};
|
|
270
|
+
}, [holds]);
|
|
271
|
+
useEffect(() => {
|
|
272
|
+
if (busy || disabled) cancelHold.current();
|
|
273
|
+
}, [busy, disabled]);
|
|
145
274
|
const blockActivation = (event) => {
|
|
146
275
|
if (!busy && !disabled) return false;
|
|
147
276
|
event.preventDefault();
|
|
@@ -161,6 +290,8 @@ var Button = forwardRef3(function Button2({
|
|
|
161
290
|
const fallback = typeof children === "string" && children.trim() ? children.trim() : icon9;
|
|
162
291
|
const named = iconOnly && !labelled && fallback ? { "aria-label": fallback, title: rest.title ?? fallback } : {};
|
|
163
292
|
const Root = href === void 0 ? "button" : "a";
|
|
293
|
+
const describedBy = holds ? cx(rest["aria-describedby"], holdHelpId) : rest["aria-describedby"];
|
|
294
|
+
const lead = leading != null ? /* @__PURE__ */ jsx4("span", { "aria-hidden": "true", style: { display: "inline-flex" }, children: leading }) : icon9 && /* @__PURE__ */ jsx4(Icon, { name: icon9 });
|
|
164
295
|
return /* @__PURE__ */ jsxs3(
|
|
165
296
|
Root,
|
|
166
297
|
{
|
|
@@ -168,7 +299,7 @@ var Button = forwardRef3(function Button2({
|
|
|
168
299
|
ref: buttonRef,
|
|
169
300
|
"data-btn-wired": "",
|
|
170
301
|
"data-btn-ready": !busy && hasBeenBusy.current ? "" : void 0,
|
|
171
|
-
type: href === void 0 ? type : void 0,
|
|
302
|
+
type: href === void 0 ? holds ? "button" : type : void 0,
|
|
172
303
|
href: disabled || busy ? void 0 : href,
|
|
173
304
|
role: href !== void 0 ? "link" : rest.role,
|
|
174
305
|
tabIndex: href !== void 0 && disabled ? -1 : href !== void 0 ? tabIndex ?? 0 : tabIndex,
|
|
@@ -177,6 +308,8 @@ var Button = forwardRef3(function Button2({
|
|
|
177
308
|
disabled: href === void 0 ? disabled : void 0,
|
|
178
309
|
"aria-disabled": disabled || busy ? true : void 0,
|
|
179
310
|
"aria-busy": busy ? true : void 0,
|
|
311
|
+
"aria-describedby": describedBy,
|
|
312
|
+
"data-hold": holds ? "" : void 0,
|
|
180
313
|
...named,
|
|
181
314
|
onAuxClickCapture: (event) => {
|
|
182
315
|
if (!blockActivation(event)) onAuxClickCapture?.(event);
|
|
@@ -188,7 +321,9 @@ var Button = forwardRef3(function Button2({
|
|
|
188
321
|
if (!blockActivation(event)) onClickCapture?.(event);
|
|
189
322
|
},
|
|
190
323
|
onClick: (event) => {
|
|
191
|
-
if (
|
|
324
|
+
if (blockActivation(event)) return;
|
|
325
|
+
if (holds) event.preventDefault();
|
|
326
|
+
else onClick?.(event);
|
|
192
327
|
},
|
|
193
328
|
onKeyDownCapture: (event) => {
|
|
194
329
|
if (!blockKey(event)) onKeyDownCapture?.(event);
|
|
@@ -203,13 +338,22 @@ var Button = forwardRef3(function Button2({
|
|
|
203
338
|
if (!blockKey(event)) onKeyUp?.(event);
|
|
204
339
|
},
|
|
205
340
|
children: [
|
|
206
|
-
|
|
341
|
+
lead,
|
|
207
342
|
!iconOnly && renderedChildren != null && /* @__PURE__ */ jsx4("span", { className: "ui-btn__label-slot", children: /* @__PURE__ */ jsx4("span", { className: "ui-btn__label", ref: labelRef, children: renderedChildren }) }),
|
|
208
343
|
iconRight && /* @__PURE__ */ jsx4(Icon, { name: iconRight }),
|
|
209
344
|
busy && /* @__PURE__ */ jsxs3("span", { className: "ui-btn__dots", "aria-hidden": "true", children: [
|
|
210
345
|
/* @__PURE__ */ jsx4("i", {}),
|
|
211
346
|
/* @__PURE__ */ jsx4("i", {}),
|
|
212
347
|
/* @__PURE__ */ jsx4("i", {})
|
|
348
|
+
] }),
|
|
349
|
+
holds && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
350
|
+
/* @__PURE__ */ jsxs3("span", { className: "ui-btn__hold-fill", "aria-hidden": "true", children: [
|
|
351
|
+
lead,
|
|
352
|
+
!iconOnly && renderedChildren != null && /* @__PURE__ */ jsx4("span", { className: "ui-btn__label-slot", children: /* @__PURE__ */ jsx4("span", { className: "ui-btn__label", children: renderedChildren }) }),
|
|
353
|
+
iconRight && /* @__PURE__ */ jsx4(Icon, { name: iconRight })
|
|
354
|
+
] }),
|
|
355
|
+
/* @__PURE__ */ jsx4("span", { className: "ui-btn__hold-hint", "aria-hidden": "true", children: "Hold to confirm" }),
|
|
356
|
+
/* @__PURE__ */ jsx4("span", { id: holdHelpId, hidden: true, children: HOLD_HELP })
|
|
213
357
|
] })
|
|
214
358
|
]
|
|
215
359
|
}
|
|
@@ -284,7 +428,7 @@ var StatusDot = forwardRef5(function StatusDot2({
|
|
|
284
428
|
// src/primitives/Card.tsx
|
|
285
429
|
import { createContext, useCallback as useCallback2, useMemo, useState as useState2 } from "react";
|
|
286
430
|
import { icon as kitIcon, safeUrl } from "@apliteni/apliteni-ui";
|
|
287
|
-
import { Fragment, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
431
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
288
432
|
var CardTools = createContext(null);
|
|
289
433
|
function Card({ title, sub, level = 2, variant, pad: pad2, icon: icon9, href, tools, className, children }) {
|
|
290
434
|
const [claims, setClaims] = useState2([]);
|
|
@@ -304,7 +448,7 @@ function Card({ title, sub, level = 2, variant, pad: pad2, icon: icon9, href, to
|
|
|
304
448
|
icon9 && /* @__PURE__ */ jsx9("span", { className: "ui-card__icon", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: kitIcon(icon9) } }),
|
|
305
449
|
title
|
|
306
450
|
] });
|
|
307
|
-
const inner = /* @__PURE__ */ jsxs5(
|
|
451
|
+
const inner = /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
308
452
|
withTools && (tools != null || owner != null) ? /* @__PURE__ */ jsxs5("div", { className: "ui-card__head", children: [
|
|
309
453
|
heading,
|
|
310
454
|
/* @__PURE__ */ jsx9("div", { className: "ui-card__tools", ref: setSlot, children: tools })
|
|
@@ -329,7 +473,7 @@ function Callout({ variant, icon: icon9 = calloutIcons[variant ?? "neutral"], ch
|
|
|
329
473
|
}
|
|
330
474
|
|
|
331
475
|
// src/primitives/StatBand.tsx
|
|
332
|
-
import { useId as
|
|
476
|
+
import { useId as useId4 } from "react";
|
|
333
477
|
|
|
334
478
|
// src/tip.ts
|
|
335
479
|
var TIP_GAP = 8;
|
|
@@ -371,8 +515,8 @@ function placeTip(host, mark, tip, bound, placement = "top") {
|
|
|
371
515
|
}
|
|
372
516
|
|
|
373
517
|
// src/Tooltip.tsx
|
|
374
|
-
import { useEffect, useId as
|
|
375
|
-
import { Fragment as
|
|
518
|
+
import { useEffect as useEffect2, useId as useId3, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState3 } from "react";
|
|
519
|
+
import { Fragment as Fragment3, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
376
520
|
var DOC_EVENTS = ["pointerdown", "pointercancel", "click", "keydown", "touchend"];
|
|
377
521
|
var CAPTURED = /* @__PURE__ */ new Set(["pointerdown", "pointercancel"]);
|
|
378
522
|
var wirings = /* @__PURE__ */ new WeakMap();
|
|
@@ -399,13 +543,13 @@ function wireDocument(doc, handlers) {
|
|
|
399
543
|
wirings.delete(doc);
|
|
400
544
|
};
|
|
401
545
|
}
|
|
402
|
-
var Text2 = ({ label = "", value = "", detail: detail2 = "" }) => /* @__PURE__ */ jsxs7(
|
|
546
|
+
var Text2 = ({ label = "", value = "", detail: detail2 = "" }) => /* @__PURE__ */ jsxs7(Fragment3, { children: [
|
|
403
547
|
/* @__PURE__ */ jsx11("span", { className: "ui-tip__label", hidden: !label, children: label }),
|
|
404
548
|
/* @__PURE__ */ jsx11("span", { className: "ui-tip__value", hidden: !value, children: value }),
|
|
405
549
|
/* @__PURE__ */ jsx11("span", { className: "ui-tip__detail", hidden: !detail2, children: detail2 })
|
|
406
550
|
] });
|
|
407
551
|
function Tooltip({ text: text2, label = text2, value, detail: detail2, placement = "top", children }) {
|
|
408
|
-
const id =
|
|
552
|
+
const id = useId3();
|
|
409
553
|
const host = useRef2(null);
|
|
410
554
|
const trigger = useRef2(null);
|
|
411
555
|
const tip = useRef2(null);
|
|
@@ -468,8 +612,8 @@ function Tooltip({ text: text2, label = text2, value, detail: detail2, placement
|
|
|
468
612
|
shared.current.click = (event) => {
|
|
469
613
|
if ((pointerKind.current === "touch" || pointerKind.current === "pen") && !host.current?.contains(event.target)) close(true);
|
|
470
614
|
};
|
|
471
|
-
|
|
472
|
-
|
|
615
|
+
useEffect2(() => wireDocument(host.current.ownerDocument, shared.current), []);
|
|
616
|
+
useEffect2(() => {
|
|
473
617
|
if (!open) return;
|
|
474
618
|
const view = host.current.ownerDocument.defaultView;
|
|
475
619
|
const reposition = () => place();
|
|
@@ -560,7 +704,7 @@ function Tooltip({ text: text2, label = text2, value, detail: detail2, placement
|
|
|
560
704
|
}
|
|
561
705
|
|
|
562
706
|
// src/primitives/StatBand.tsx
|
|
563
|
-
import { Fragment as
|
|
707
|
+
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
564
708
|
var GLYPH = { up: "arrowUp", down: "arrowDown", flat: "minus" };
|
|
565
709
|
var directionOf = (text2) => {
|
|
566
710
|
const t = text2.trim();
|
|
@@ -569,7 +713,7 @@ var directionOf = (text2) => {
|
|
|
569
713
|
var hasChange = (d) => !!d && d.value != null && d.value !== "";
|
|
570
714
|
function ContextRow({ caption, delta, basisId }) {
|
|
571
715
|
if (!hasChange(delta)) return caption ? /* @__PURE__ */ jsx12("dd", { className: "ui-stat__caption", children: caption }) : null;
|
|
572
|
-
const lead = caption ? /* @__PURE__ */ jsxs8(
|
|
716
|
+
const lead = caption ? /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
573
717
|
/* @__PURE__ */ jsx12("span", { className: "ui-stat__caption", children: caption }),
|
|
574
718
|
" "
|
|
575
719
|
] }) : null;
|
|
@@ -579,14 +723,14 @@ function ContextRow({ caption, delta, basisId }) {
|
|
|
579
723
|
lead,
|
|
580
724
|
/* @__PURE__ */ jsx12(Icon, { name: GLYPH[dir] }),
|
|
581
725
|
delta.tooltip ? /* @__PURE__ */ jsx12(Tooltip, { text: delta.tooltip, children: /* @__PURE__ */ jsx12("span", { className: "ui-stat__change", children: delta.value }) }) : /* @__PURE__ */ jsx12("span", { className: "ui-stat__change", children: delta.value }),
|
|
582
|
-
own ? /* @__PURE__ */ jsxs8(
|
|
726
|
+
own ? /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
583
727
|
" ",
|
|
584
728
|
/* @__PURE__ */ jsx12("span", { className: "ui-stat__basis", children: own })
|
|
585
729
|
] }) : null
|
|
586
730
|
] });
|
|
587
731
|
}
|
|
588
732
|
function StatBand({ stats, variant = "tiles", basis, basisId: sharedBasisId, label, id }) {
|
|
589
|
-
const auto =
|
|
733
|
+
const auto = useId4();
|
|
590
734
|
const v = ["band", "tiles", "open"].includes(variant) ? variant : "tiles";
|
|
591
735
|
const basisId = basis ? `${id || auto}-basis` : sharedBasisId;
|
|
592
736
|
const root = ["ui-stats", `ui-stats--${v}`, v === "band" && "ui-card"].filter(Boolean).join(" ");
|
|
@@ -609,14 +753,14 @@ function StatBand({ stats, variant = "tiles", basis, basisId: sharedBasisId, lab
|
|
|
609
753
|
import { useRef as useRef5 } from "react";
|
|
610
754
|
|
|
611
755
|
// src/Modal.tsx
|
|
612
|
-
import { useId as
|
|
756
|
+
import { useId as useId5, useRef as useRef4 } from "react";
|
|
613
757
|
import { createPortal } from "react-dom";
|
|
614
758
|
|
|
615
759
|
// src/dialog.ts
|
|
616
760
|
import {
|
|
617
761
|
createContext as createContext2,
|
|
618
762
|
useContext,
|
|
619
|
-
useEffect as
|
|
763
|
+
useEffect as useEffect3,
|
|
620
764
|
useLayoutEffect as useLayoutEffect3,
|
|
621
765
|
useRef as useRef3,
|
|
622
766
|
useState as useState4
|
|
@@ -641,7 +785,7 @@ var dismissOnScrim = (onClose) => (e) => {
|
|
|
641
785
|
e.preventDefault();
|
|
642
786
|
onClose();
|
|
643
787
|
};
|
|
644
|
-
var useIsoLayoutEffect = typeof document === "undefined" ?
|
|
788
|
+
var useIsoLayoutEffect = typeof document === "undefined" ? useEffect3 : useLayoutEffect3;
|
|
645
789
|
var DialogScope = createContext2(null);
|
|
646
790
|
var stack = [];
|
|
647
791
|
var leaving = /* @__PURE__ */ new Set();
|
|
@@ -796,7 +940,7 @@ function useDialog(active, { root, panel, body, initialFocus, fallbackFocus }, o
|
|
|
796
940
|
useIsoLayoutEffect(() => {
|
|
797
941
|
close.current = onClose;
|
|
798
942
|
});
|
|
799
|
-
|
|
943
|
+
useEffect3(() => {
|
|
800
944
|
if (!active || !root.current || !panel.current) return;
|
|
801
945
|
const entry = {
|
|
802
946
|
scope,
|
|
@@ -818,7 +962,7 @@ function useDialog(active, { root, panel, body, initialFocus, fallbackFocus }, o
|
|
|
818
962
|
// src/Modal.tsx
|
|
819
963
|
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
820
964
|
function Modal({ open, title, onClose, footer, children, initialFocusRef, role = "dialog" }) {
|
|
821
|
-
const id =
|
|
965
|
+
const id = useId5();
|
|
822
966
|
const titleId = `${id}-title`;
|
|
823
967
|
const bodyId = `${id}-body`;
|
|
824
968
|
const root = useRef4(null);
|
|
@@ -853,7 +997,7 @@ function Modal({ open, title, onClose, footer, children, initialFocusRef, role =
|
|
|
853
997
|
}
|
|
854
998
|
|
|
855
999
|
// src/Confirm.tsx
|
|
856
|
-
import { Fragment as
|
|
1000
|
+
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
857
1001
|
function Confirm({
|
|
858
1002
|
open,
|
|
859
1003
|
title,
|
|
@@ -874,7 +1018,7 @@ function Confirm({
|
|
|
874
1018
|
onClose: onCancel,
|
|
875
1019
|
role: "alertdialog",
|
|
876
1020
|
initialFocusRef: safeAction,
|
|
877
|
-
footer: /* @__PURE__ */ jsxs10(
|
|
1021
|
+
footer: /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
878
1022
|
/* @__PURE__ */ jsx14(Button, { ref: safeAction, variant: "ghost", onClick: onCancel, children: cancelLabel }),
|
|
879
1023
|
/* @__PURE__ */ jsx14(Button, { variant: danger ? "danger" : "primary", busy, onClick: onConfirm, children: confirmLabel })
|
|
880
1024
|
] }),
|
|
@@ -884,10 +1028,10 @@ function Confirm({
|
|
|
884
1028
|
}
|
|
885
1029
|
|
|
886
1030
|
// src/Feedback.tsx
|
|
887
|
-
import { useEffect as
|
|
1031
|
+
import { useEffect as useEffect4, useRef as useRef6, useState as useState5 } from "react";
|
|
888
1032
|
import { createPortal as createPortal2 } from "react-dom";
|
|
889
1033
|
import { nearestSection } from "@apliteni/apliteni-ui";
|
|
890
|
-
import { Fragment as
|
|
1034
|
+
import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
891
1035
|
var defaultSection = (h) => {
|
|
892
1036
|
if (!h) return { label: "this page", title: "", anchor: "" };
|
|
893
1037
|
const t = (h.textContent || "").replace(/\s+/g, " ").trim();
|
|
@@ -921,7 +1065,7 @@ function Feedback({
|
|
|
921
1065
|
const doneClose = useRef6(null);
|
|
922
1066
|
const opts = useRef6({ minChars, section });
|
|
923
1067
|
opts.current = { minChars, section };
|
|
924
|
-
|
|
1068
|
+
useEffect4(() => {
|
|
925
1069
|
function onSelect() {
|
|
926
1070
|
if (openRef.current) return;
|
|
927
1071
|
const el = container.current;
|
|
@@ -1006,7 +1150,7 @@ function Feedback({
|
|
|
1006
1150
|
span.replaceWith(...Array.from(span.childNodes));
|
|
1007
1151
|
restoreRange();
|
|
1008
1152
|
}
|
|
1009
|
-
|
|
1153
|
+
useEffect4(() => () => {
|
|
1010
1154
|
opening.current++;
|
|
1011
1155
|
clearMark();
|
|
1012
1156
|
}, []);
|
|
@@ -1067,7 +1211,7 @@ function Feedback({
|
|
|
1067
1211
|
setState("ready");
|
|
1068
1212
|
}
|
|
1069
1213
|
}
|
|
1070
|
-
return createPortal2(/* @__PURE__ */ jsxs11(
|
|
1214
|
+
return createPortal2(/* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
1071
1215
|
/* @__PURE__ */ jsxs11(
|
|
1072
1216
|
"button",
|
|
1073
1217
|
{
|
|
@@ -1124,14 +1268,14 @@ function Feedback({
|
|
|
1124
1268
|
}
|
|
1125
1269
|
|
|
1126
1270
|
// src/AccountWindow.tsx
|
|
1127
|
-
import { useEffect as
|
|
1271
|
+
import { useEffect as useEffect8, useId as useId8, useRef as useRef9, useState as useState7 } from "react";
|
|
1128
1272
|
import { createPortal as createPortal3 } from "react-dom";
|
|
1129
1273
|
import { revealFocusedNav as revealFocusedNav2 } from "@apliteni/apliteni-ui";
|
|
1130
1274
|
|
|
1131
1275
|
// src/NavTabs.tsx
|
|
1132
|
-
import { Fragment as
|
|
1276
|
+
import { Fragment as Fragment7, forwardRef as forwardRef6, useEffect as useEffect5, useRef as useRef7, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
1133
1277
|
import { safeUrl as safeUrl2, observeNavFit, revealCurrentNav, revealFocusedNav } from "@apliteni/apliteni-ui";
|
|
1134
|
-
import { Fragment as
|
|
1278
|
+
import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1135
1279
|
var NavTabs = forwardRef6(function NavTabs2({
|
|
1136
1280
|
items,
|
|
1137
1281
|
active,
|
|
@@ -1145,8 +1289,8 @@ var NavTabs = forwardRef6(function NavTabs2({
|
|
|
1145
1289
|
const navRef = useRef7(null);
|
|
1146
1290
|
useImperativeHandle2(ref, () => navRef.current, []);
|
|
1147
1291
|
const signature = items.map((item) => item.id).join("\0");
|
|
1148
|
-
|
|
1149
|
-
|
|
1292
|
+
useEffect5(() => observeNavFit(navRef.current), []);
|
|
1293
|
+
useEffect5(() => {
|
|
1150
1294
|
if (navRef.current) revealCurrentNav(navRef.current);
|
|
1151
1295
|
}, [active, signature]);
|
|
1152
1296
|
return /* @__PURE__ */ jsx16(
|
|
@@ -1162,7 +1306,7 @@ var NavTabs = forwardRef6(function NavTabs2({
|
|
|
1162
1306
|
},
|
|
1163
1307
|
children: items.map((item) => {
|
|
1164
1308
|
const badge = item.badge != null && typeof item.badge === "object" ? item.badge : { text: item.badge, tone: void 0 };
|
|
1165
|
-
const inner = /* @__PURE__ */ jsxs12(
|
|
1309
|
+
const inner = /* @__PURE__ */ jsxs12(Fragment8, { children: [
|
|
1166
1310
|
/* @__PURE__ */ jsx16("span", { className: "ui-nav__tab-label", children: item.label }),
|
|
1167
1311
|
badge.text != null && badge.text !== "" && /* @__PURE__ */ jsx16("span", { className: `ui-nav__badge is-${badge.tone || "neutral"}`, children: badge.text })
|
|
1168
1312
|
] });
|
|
@@ -1175,25 +1319,25 @@ var NavTabs = forwardRef6(function NavTabs2({
|
|
|
1175
1319
|
"aria-current": current ? "page" : void 0,
|
|
1176
1320
|
children: inner
|
|
1177
1321
|
};
|
|
1178
|
-
return /* @__PURE__ */ jsx16(
|
|
1322
|
+
return /* @__PURE__ */ jsx16(Fragment7, { children: renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx16("a", { ...linkProps }) }, item.id);
|
|
1179
1323
|
})
|
|
1180
1324
|
}
|
|
1181
1325
|
);
|
|
1182
1326
|
});
|
|
1183
1327
|
|
|
1184
1328
|
// src/SidebarNav.tsx
|
|
1185
|
-
import { forwardRef as forwardRef7, useEffect as
|
|
1329
|
+
import { forwardRef as forwardRef7, useEffect as useEffect6, useId as useId6, useState as useState6 } from "react";
|
|
1186
1330
|
import { ENTRANCE_FALLBACK_MS } from "@apliteni/apliteni-ui/motion";
|
|
1187
|
-
import { Fragment as
|
|
1331
|
+
import { Fragment as Fragment9, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1188
1332
|
var badgeText = (badge) => typeof badge === "object" ? badge.text : badge;
|
|
1189
1333
|
function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
1190
|
-
const uid =
|
|
1334
|
+
const uid = useId6();
|
|
1191
1335
|
const group = !sub && !!item.items?.length;
|
|
1192
1336
|
const childActive = group && item.items.some((child) => child.id === active);
|
|
1193
1337
|
const [expanded, setExpanded] = useState6();
|
|
1194
1338
|
const open = expanded ?? item.defaultOpen ?? childActive;
|
|
1195
1339
|
const [entering, setEntering] = useState6(false);
|
|
1196
|
-
|
|
1340
|
+
useEffect6(() => {
|
|
1197
1341
|
if (!entering) return;
|
|
1198
1342
|
const timer = setTimeout(() => setEntering(false), ENTRANCE_FALLBACK_MS);
|
|
1199
1343
|
return () => clearTimeout(timer);
|
|
@@ -1210,7 +1354,7 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
1210
1354
|
item.disabled && "is-disabled",
|
|
1211
1355
|
item.danger && "is-danger"
|
|
1212
1356
|
].filter(Boolean).join(" ");
|
|
1213
|
-
const children = /* @__PURE__ */ jsxs13(
|
|
1357
|
+
const children = /* @__PURE__ */ jsxs13(Fragment9, { children: [
|
|
1214
1358
|
(item.leading ?? item.icon) && /* @__PURE__ */ jsx17("span", { className: "ui-nav__ic", children: item.leading ?? /* @__PURE__ */ jsx17(Icon, { name: item.icon }) }),
|
|
1215
1359
|
/* @__PURE__ */ jsx17("span", { className: "ui-nav__label", children: item.label }),
|
|
1216
1360
|
count != null && count !== "" && /* @__PURE__ */ jsx17("span", { className: `ui-nav__badge is-${typeof item.badge === "object" ? item.badge.tone ?? "neutral" : "neutral"}`, children: count }),
|
|
@@ -1244,7 +1388,7 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
1244
1388
|
return /* @__PURE__ */ jsx17("li", { children: renderLink ? renderLink(item, props) : /* @__PURE__ */ jsx17("a", { ...props }) });
|
|
1245
1389
|
}
|
|
1246
1390
|
function Section({ section, ...props }) {
|
|
1247
|
-
const uid =
|
|
1391
|
+
const uid = useId6();
|
|
1248
1392
|
return /* @__PURE__ */ jsxs13("div", { className: "ui-nav__section", children: [
|
|
1249
1393
|
section.label && /* @__PURE__ */ jsx17("div", { className: "ui-nav__cap", id: uid, "aria-hidden": props.collapsed || void 0, children: section.label }),
|
|
1250
1394
|
/* @__PURE__ */ jsx17("ul", { className: "ui-nav__list", "aria-labelledby": section.label ? uid : void 0, children: section.items.map((item) => /* @__PURE__ */ jsx17(Row, { item, ...props }, item.id)) })
|
|
@@ -1279,9 +1423,9 @@ var SidebarNav = forwardRef7(function SidebarNav2({
|
|
|
1279
1423
|
});
|
|
1280
1424
|
|
|
1281
1425
|
// src/Tabs.tsx
|
|
1282
|
-
import { useEffect as
|
|
1426
|
+
import { useEffect as useEffect7, useId as useId7, useRef as useRef8 } from "react";
|
|
1283
1427
|
import { playEntrance } from "@apliteni/apliteni-ui/motion";
|
|
1284
|
-
import { Fragment as
|
|
1428
|
+
import { Fragment as Fragment10, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1285
1429
|
function tabKeyIndex(key, i, count) {
|
|
1286
1430
|
switch (key) {
|
|
1287
1431
|
case "ArrowRight":
|
|
@@ -1297,11 +1441,11 @@ function tabKeyIndex(key, i, count) {
|
|
|
1297
1441
|
}
|
|
1298
1442
|
}
|
|
1299
1443
|
function Tabs({ items, value, onChange, label }) {
|
|
1300
|
-
const id =
|
|
1444
|
+
const id = useId7();
|
|
1301
1445
|
const previous = useRef8(value);
|
|
1302
1446
|
const activePanel = useRef8(null);
|
|
1303
1447
|
const buttons = useRef8([]);
|
|
1304
|
-
|
|
1448
|
+
useEffect7(() => {
|
|
1305
1449
|
if (previous.current !== value) playEntrance(activePanel.current);
|
|
1306
1450
|
previous.current = value;
|
|
1307
1451
|
}, [value]);
|
|
@@ -1329,7 +1473,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
1329
1473
|
},
|
|
1330
1474
|
children: [
|
|
1331
1475
|
item.label,
|
|
1332
|
-
item.count != null && /* @__PURE__ */ jsxs14(
|
|
1476
|
+
item.count != null && /* @__PURE__ */ jsxs14(Fragment10, { children: [
|
|
1333
1477
|
" ",
|
|
1334
1478
|
item.count
|
|
1335
1479
|
] })
|
|
@@ -1366,7 +1510,7 @@ function AccountWindow({
|
|
|
1366
1510
|
onSectionChange,
|
|
1367
1511
|
label = "Account"
|
|
1368
1512
|
}) {
|
|
1369
|
-
const titleId =
|
|
1513
|
+
const titleId = useId8();
|
|
1370
1514
|
const root = useRef9(null);
|
|
1371
1515
|
const panel = useRef9(null);
|
|
1372
1516
|
const body = useRef9(null);
|
|
@@ -1375,7 +1519,7 @@ function AccountWindow({
|
|
|
1375
1519
|
const { mounted, shown } = usePresence(open, root, panel);
|
|
1376
1520
|
const scope = useDialog(shown, { root, panel, body }, onClose);
|
|
1377
1521
|
const currentId = section ?? own;
|
|
1378
|
-
|
|
1522
|
+
useEffect8(() => {
|
|
1379
1523
|
const nav = tabs.current;
|
|
1380
1524
|
if (nav) revealFocusedNav2(nav, nav.querySelector('[aria-selected="true"]'));
|
|
1381
1525
|
}, [mounted, currentId]);
|
|
@@ -1490,7 +1634,7 @@ function AccountWindow({
|
|
|
1490
1634
|
}
|
|
1491
1635
|
|
|
1492
1636
|
// src/Drawer.tsx
|
|
1493
|
-
import { useId as
|
|
1637
|
+
import { useId as useId9, useRef as useRef10 } from "react";
|
|
1494
1638
|
import { createPortal as createPortal4 } from "react-dom";
|
|
1495
1639
|
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1496
1640
|
function Drawer({
|
|
@@ -1508,7 +1652,7 @@ function Drawer({
|
|
|
1508
1652
|
const root = useRef10(null);
|
|
1509
1653
|
const panel = useRef10(null);
|
|
1510
1654
|
const body = useRef10(null);
|
|
1511
|
-
const titleId =
|
|
1655
|
+
const titleId = useId9();
|
|
1512
1656
|
const { mounted, shown } = usePresence(open, root, panel);
|
|
1513
1657
|
const scope = useDialog(shown, { root, panel, body, initialFocus: initialFocusRef }, onClose);
|
|
1514
1658
|
if (!mounted) return null;
|
|
@@ -1542,7 +1686,7 @@ function Drawer({
|
|
|
1542
1686
|
}
|
|
1543
1687
|
|
|
1544
1688
|
// src/CommandPalette.tsx
|
|
1545
|
-
import { useCallback as useCallback3, useEffect as
|
|
1689
|
+
import { useCallback as useCallback3, useEffect as useEffect9, useId as useId10, useMemo as useMemo2, useRef as useRef11, useState as useState8 } from "react";
|
|
1546
1690
|
import { createPortal as createPortal5 } from "react-dom";
|
|
1547
1691
|
import { rankGroups, icon as icon3 } from "@apliteni/apliteni-ui";
|
|
1548
1692
|
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
@@ -1563,13 +1707,13 @@ function CommandPalette({
|
|
|
1563
1707
|
rank = true,
|
|
1564
1708
|
onQueryChange
|
|
1565
1709
|
}) {
|
|
1566
|
-
const uid =
|
|
1710
|
+
const uid = useId10().replace(/:/g, "");
|
|
1567
1711
|
const root = useRef11(null);
|
|
1568
1712
|
const panel = useRef11(null);
|
|
1569
1713
|
const search = useRef11(null);
|
|
1570
1714
|
const [query, setQuery] = useState8("");
|
|
1571
1715
|
const [at, setAt] = useState8(0);
|
|
1572
|
-
|
|
1716
|
+
useEffect9(() => {
|
|
1573
1717
|
if (open) {
|
|
1574
1718
|
setQuery("");
|
|
1575
1719
|
setAt(0);
|
|
@@ -1581,7 +1725,7 @@ function CommandPalette({
|
|
|
1581
1725
|
);
|
|
1582
1726
|
const rows = useMemo2(() => shown.flatMap((g) => g.items).filter((it) => !isDisabled(it)), [shown]);
|
|
1583
1727
|
const active = rows[Math.min(at, rows.length - 1)];
|
|
1584
|
-
|
|
1728
|
+
useEffect9(() => {
|
|
1585
1729
|
setAt(0);
|
|
1586
1730
|
}, [query]);
|
|
1587
1731
|
const scope = useDialog(open, { root, panel, body: search }, onClose);
|
|
@@ -1737,11 +1881,11 @@ function rowId(uid, groups, item) {
|
|
|
1737
1881
|
}
|
|
1738
1882
|
|
|
1739
1883
|
// src/DataTable.tsx
|
|
1740
|
-
import { Fragment as
|
|
1884
|
+
import { Fragment as Fragment11, useCallback as useCallback4, useEffect as useEffect11, useMemo as useMemo3, useRef as useRef13, useState as useState10 } from "react";
|
|
1741
1885
|
import { DEFAULT_PAGE_SIZE as DEFAULT_PAGE_SIZE2 } from "@apliteni/apliteni-ui";
|
|
1742
1886
|
|
|
1743
1887
|
// src/Pagination.tsx
|
|
1744
|
-
import { useEffect as
|
|
1888
|
+
import { useEffect as useEffect10, useId as useId11, useRef as useRef12, useState as useState9 } from "react";
|
|
1745
1889
|
import { DEFAULT_PAGE_SIZE } from "@apliteni/apliteni-ui";
|
|
1746
1890
|
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1747
1891
|
var GHOST_SM = "ui-btn ui-btn--ghost ui-btn--sm";
|
|
@@ -1785,7 +1929,7 @@ function Pagination({
|
|
|
1785
1929
|
onPageChange,
|
|
1786
1930
|
onPageSizeChange
|
|
1787
1931
|
}) {
|
|
1788
|
-
const auto =
|
|
1932
|
+
const auto = useId11();
|
|
1789
1933
|
const [draft, setDraft] = useState9("");
|
|
1790
1934
|
const [drafting, setDrafting] = useState9(false);
|
|
1791
1935
|
const nav = useRef12(null);
|
|
@@ -1806,7 +1950,7 @@ function Pagination({
|
|
|
1806
1950
|
}
|
|
1807
1951
|
const offered = (Array.isArray(pageSizes) ? pageSizes : []).slice(0, 12).map((s) => int(s, 0)).filter((s) => s > 0);
|
|
1808
1952
|
const sizes = offered.length ? [.../* @__PURE__ */ new Set([...offered, size])].sort((a, b) => a - b) : [];
|
|
1809
|
-
|
|
1953
|
+
useEffect10(() => {
|
|
1810
1954
|
const was = pressed.current;
|
|
1811
1955
|
if (!was || loading) return;
|
|
1812
1956
|
pressed.current = null;
|
|
@@ -1965,7 +2109,7 @@ function Pagination({
|
|
|
1965
2109
|
}
|
|
1966
2110
|
|
|
1967
2111
|
// src/DataTable.tsx
|
|
1968
|
-
import { Fragment as
|
|
2112
|
+
import { Fragment as Fragment12, jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1969
2113
|
var CELL_CLASS = { title: "ui-table__title", code: "ui-table__code", long: "ui-table__long", strong: "ui-table__num--strong", act: "ui-table__act" };
|
|
1970
2114
|
var NO_SORT = { key: void 0, dir: -1 };
|
|
1971
2115
|
function sortTableRows(rows, sort) {
|
|
@@ -2014,7 +2158,7 @@ function DataTable({
|
|
|
2014
2158
|
[]
|
|
2015
2159
|
);
|
|
2016
2160
|
const [strip2, setStrip] = useState10();
|
|
2017
|
-
|
|
2161
|
+
useEffect11(() => {
|
|
2018
2162
|
const el = table.current;
|
|
2019
2163
|
const host = pagerHost;
|
|
2020
2164
|
if (!el || !host || typeof ResizeObserver === "undefined") {
|
|
@@ -2078,16 +2222,16 @@ function DataTable({
|
|
|
2078
2222
|
strokeLinejoin: "round",
|
|
2079
2223
|
"aria-hidden": "true",
|
|
2080
2224
|
focusable: "false",
|
|
2081
|
-
children: sort.key === k ? /* @__PURE__ */ jsx23("path", { d: "m8 10 4 4 4-4" }) : /* @__PURE__ */ jsxs19(
|
|
2225
|
+
children: sort.key === k ? /* @__PURE__ */ jsx23("path", { d: "m8 10 4 4 4-4" }) : /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
2082
2226
|
/* @__PURE__ */ jsx23("path", { d: "m8 9 4-4 4 4" }),
|
|
2083
2227
|
/* @__PURE__ */ jsx23("path", { d: "m8 15 4 4 4-4" })
|
|
2084
2228
|
] })
|
|
2085
2229
|
}
|
|
2086
2230
|
);
|
|
2087
|
-
const Wrap = scrollable ? "div" :
|
|
2231
|
+
const Wrap = scrollable ? "div" : Fragment11;
|
|
2088
2232
|
const pageAllOn = selectable && slice.length > 0 && slice.every((r) => selected.has(r.name));
|
|
2089
2233
|
const pageSomeOn = selectable && !pageAllOn && slice.some((r) => selected.has(r.name));
|
|
2090
|
-
return /* @__PURE__ */ jsxs19(
|
|
2234
|
+
return /* @__PURE__ */ jsxs19(Fragment12, { children: [
|
|
2091
2235
|
/* @__PURE__ */ jsx23(Wrap, { ...scrollable ? { className: "ui-table-scroll", role: "region", "aria-label": scrollLabel, tabIndex: 0 } : {}, children: /* @__PURE__ */ jsxs19(
|
|
2092
2236
|
"table",
|
|
2093
2237
|
{
|
|
@@ -2281,7 +2425,7 @@ function Denied({
|
|
|
2281
2425
|
// src/DatePicker.tsx
|
|
2282
2426
|
import {
|
|
2283
2427
|
useCallback as useCallback5,
|
|
2284
|
-
useEffect as
|
|
2428
|
+
useEffect as useEffect12,
|
|
2285
2429
|
useMemo as useMemo4,
|
|
2286
2430
|
useRef as useRef14,
|
|
2287
2431
|
useState as useState11
|
|
@@ -2297,7 +2441,7 @@ var DAY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
|
2297
2441
|
var PHONE_MAX = 560;
|
|
2298
2442
|
function usePhone() {
|
|
2299
2443
|
const [phone, setPhone] = useState11(false);
|
|
2300
|
-
|
|
2444
|
+
useEffect12(() => {
|
|
2301
2445
|
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX}px)`);
|
|
2302
2446
|
if (!query) return;
|
|
2303
2447
|
const read = () => setPhone(query.matches);
|
|
@@ -2441,7 +2585,7 @@ function DatePicker({
|
|
|
2441
2585
|
useIsoLayoutEffect(() => {
|
|
2442
2586
|
close.current = setOpen;
|
|
2443
2587
|
});
|
|
2444
|
-
|
|
2588
|
+
useEffect12(() => {
|
|
2445
2589
|
if (open) setCursor(clamp(anchor, lo, hi));
|
|
2446
2590
|
}, [open]);
|
|
2447
2591
|
useIsoLayoutEffect(() => {
|
|
@@ -2465,7 +2609,7 @@ function DatePicker({
|
|
|
2465
2609
|
view.removeEventListener("resize", fit);
|
|
2466
2610
|
};
|
|
2467
2611
|
}, [open, asSheet]);
|
|
2468
|
-
|
|
2612
|
+
useEffect12(() => {
|
|
2469
2613
|
if (!open || asSheet) return;
|
|
2470
2614
|
const doc = root.current?.ownerDocument ?? document;
|
|
2471
2615
|
const onClick = (e) => {
|
|
@@ -2775,11 +2919,11 @@ function DatePicker({
|
|
|
2775
2919
|
|
|
2776
2920
|
// src/Dropdown.tsx
|
|
2777
2921
|
import {
|
|
2778
|
-
Fragment as
|
|
2922
|
+
Fragment as Fragment13,
|
|
2779
2923
|
useCallback as useCallback6,
|
|
2780
2924
|
useContext as useContext2,
|
|
2781
|
-
useEffect as
|
|
2782
|
-
useId as
|
|
2925
|
+
useEffect as useEffect13,
|
|
2926
|
+
useId as useId12,
|
|
2783
2927
|
useRef as useRef15,
|
|
2784
2928
|
useState as useState12
|
|
2785
2929
|
} from "react";
|
|
@@ -2803,7 +2947,7 @@ import { createContext as createContext3 } from "react";
|
|
|
2803
2947
|
var FieldContext = createContext3(null);
|
|
2804
2948
|
|
|
2805
2949
|
// src/Dropdown.tsx
|
|
2806
|
-
import { Fragment as
|
|
2950
|
+
import { Fragment as Fragment14, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2807
2951
|
var EXIT_SLACK_MS2 = 50;
|
|
2808
2952
|
var SETTLE_MS = 450;
|
|
2809
2953
|
var inPanel = (node) => {
|
|
@@ -2882,7 +3026,7 @@ function Dropdown({
|
|
|
2882
3026
|
const landOn = useRef15(null);
|
|
2883
3027
|
const revealed = useRef15(false);
|
|
2884
3028
|
const at = useRef15("");
|
|
2885
|
-
const auto =
|
|
3029
|
+
const auto = useId12().replace(/:/g, "");
|
|
2886
3030
|
const uid = id ?? auto;
|
|
2887
3031
|
const inField = useContext2(FieldContext);
|
|
2888
3032
|
const fieldName = inField && id === inField.id && !(ariaLabel && triggerContent != null) ? { id: `${uid}-trigger`, labelId: inField.labelId, labelledBy: `${inField.labelId} ${uid}-trigger` } : null;
|
|
@@ -2990,7 +3134,7 @@ function Dropdown({
|
|
|
2990
3134
|
const given = rows.find((it) => it.selected);
|
|
2991
3135
|
const givenKey = given ? keyOf(given) : null;
|
|
2992
3136
|
const pickedKey = selectedValue === void 0 && pick && pick.against === givenKey ? pick.key : null;
|
|
2993
|
-
|
|
3137
|
+
useEffect13(() => {
|
|
2994
3138
|
if (pick && pick.against !== givenKey) setPick(null);
|
|
2995
3139
|
}, [givenKey, pick]);
|
|
2996
3140
|
const picked = pickedKey != null ? rows.find((it) => keyOf(it) === pickedKey) : void 0;
|
|
@@ -3007,7 +3151,7 @@ function Dropdown({
|
|
|
3007
3151
|
const rowIds = /* @__PURE__ */ new Map();
|
|
3008
3152
|
rows.forEach((it, i) => rowIds.set(it, `${uid}-opt-${i}`));
|
|
3009
3153
|
const listId = `${uid}-list`;
|
|
3010
|
-
|
|
3154
|
+
useEffect13(() => {
|
|
3011
3155
|
if (!open) return;
|
|
3012
3156
|
const mine = () => close.current(false);
|
|
3013
3157
|
for (const other of [...openNow]) other();
|
|
@@ -3016,7 +3160,7 @@ function Dropdown({
|
|
|
3016
3160
|
openNow.delete(mine);
|
|
3017
3161
|
};
|
|
3018
3162
|
}, [open]);
|
|
3019
|
-
|
|
3163
|
+
useEffect13(() => {
|
|
3020
3164
|
if (!open) return;
|
|
3021
3165
|
const doc = root.current?.ownerDocument ?? document;
|
|
3022
3166
|
const onClick = (e) => {
|
|
@@ -3268,7 +3412,7 @@ function Dropdown({
|
|
|
3268
3412
|
...asLink ? { href: entry.href, ...entry.target ? { target: entry.target } : null } : null,
|
|
3269
3413
|
...sx ? { id: rowIds.get(entry), hidden: hiddenBy(entry) || void 0 } : null,
|
|
3270
3414
|
onClick: (e) => choose(entry, e),
|
|
3271
|
-
children: /* @__PURE__ */ jsxs22(
|
|
3415
|
+
children: /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
3272
3416
|
entry.avatar ? /* @__PURE__ */ jsx26(Avatar, { personKey: entry.avatar.key, name: entry.avatar.name, src: entry.avatar.src, empty: entry.avatar.empty }) : entry.icon && /* @__PURE__ */ jsx26(Glyph2, { name: entry.icon, className: "ui-dropdown__ic" }),
|
|
3273
3417
|
/* @__PURE__ */ jsxs22("span", { className: "ui-dropdown__main", children: [
|
|
3274
3418
|
/* @__PURE__ */ jsx26("span", { className: "ui-dropdown__label", children: entry.label }),
|
|
@@ -3278,7 +3422,7 @@ function Dropdown({
|
|
|
3278
3422
|
asOption && /* @__PURE__ */ jsx26(Glyph2, { name: "check", className: "ui-dropdown__tick", hidden: true })
|
|
3279
3423
|
] })
|
|
3280
3424
|
};
|
|
3281
|
-
if (row) return /* @__PURE__ */ jsx26(
|
|
3425
|
+
if (row) return /* @__PURE__ */ jsx26(Fragment13, { children: row(entry, props) }, key);
|
|
3282
3426
|
const Tag = asLink ? "a" : "div";
|
|
3283
3427
|
return /* @__PURE__ */ jsx26(Tag, { ...props }, key);
|
|
3284
3428
|
}
|
|
@@ -3300,7 +3444,7 @@ function Dropdown({
|
|
|
3300
3444
|
);
|
|
3301
3445
|
}) : (items || []).map((entry, i) => renderRow(entry, `i${i}`));
|
|
3302
3446
|
const cap = scroll && scroll !== true ? { "--ui-dropdown-cap": typeof scroll === "number" ? `${scroll}px` : scroll } : void 0;
|
|
3303
|
-
const none = sx && filtering && !visible.length ? /* @__PURE__ */ jsxs22(
|
|
3447
|
+
const none = sx && filtering && !visible.length ? /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
3304
3448
|
/* @__PURE__ */ jsx26("span", { className: "ui-dropdown__none-title", children: sx.empty.replace("{q}", () => query.trim()) }),
|
|
3305
3449
|
/* @__PURE__ */ jsx26("span", { className: "ui-dropdown__none-hint", children: sx.hint })
|
|
3306
3450
|
] }) : null;
|
|
@@ -3325,7 +3469,7 @@ function Dropdown({
|
|
|
3325
3469
|
setOpen(!open);
|
|
3326
3470
|
},
|
|
3327
3471
|
children: [
|
|
3328
|
-
triggerContent != null ? typeof triggerContent === "string" ? /* @__PURE__ */ jsx26("span", { className: "ui-dropdown__text", children: triggerContent }) : triggerContent : /* @__PURE__ */ jsxs22(
|
|
3472
|
+
triggerContent != null ? typeof triggerContent === "string" ? /* @__PURE__ */ jsx26("span", { className: "ui-dropdown__text", children: triggerContent }) : triggerContent : /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
3329
3473
|
marked2 && (chosen?.avatar ? /* @__PURE__ */ jsx26(Avatar, { personKey: chosen.avatar.key, name: chosen.avatar.name, src: chosen.avatar.src, empty: chosen.avatar.empty }) : /* @__PURE__ */ jsx26(Avatar, { empty: true })),
|
|
3330
3474
|
label && /* @__PURE__ */ jsx26("span", { className: "ui-dropdown__pre", children: label }),
|
|
3331
3475
|
/* @__PURE__ */ jsx26("span", { className: cx6("ui-dropdown__value", marked2 && !chosen && "is-placeholder"), children: shown != null ? shown : placeholder })
|
|
@@ -3355,7 +3499,7 @@ function Dropdown({
|
|
|
3355
3499
|
onMouseMove,
|
|
3356
3500
|
children: [
|
|
3357
3501
|
header,
|
|
3358
|
-
sx ? /* @__PURE__ */ jsxs22(
|
|
3502
|
+
sx ? /* @__PURE__ */ jsxs22(Fragment14, { children: [
|
|
3359
3503
|
/* @__PURE__ */ jsxs22("div", { className: "ui-dropdown__search", children: [
|
|
3360
3504
|
/* @__PURE__ */ jsx26(Glyph2, { name: "search", className: "ui-dropdown__search-ic", hidden: true }),
|
|
3361
3505
|
/* @__PURE__ */ jsx26(
|
|
@@ -3509,7 +3653,7 @@ function Segmented({ options, value, onChange, label, appearance = "pill", size,
|
|
|
3509
3653
|
// src/FilterBar.tsx
|
|
3510
3654
|
import { useRef as useRef16, useState as useState13 } from "react";
|
|
3511
3655
|
import { filterChipText, filterChipName, filterChipUnset, filterChipItems, focusNextStop } from "@apliteni/apliteni-ui";
|
|
3512
|
-
import { Fragment as
|
|
3656
|
+
import { Fragment as Fragment15, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3513
3657
|
var SEARCH_AT = 10;
|
|
3514
3658
|
var isRow2 = (entry) => entry !== "---" && !entry.separator;
|
|
3515
3659
|
function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clearVariant = "ghost", add, addLabel = "Filter", disabled = false, busy = false, onRemove, onClear, onChange, onAdd }) {
|
|
@@ -3623,7 +3767,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3623
3767
|
variant: "menu",
|
|
3624
3768
|
sections,
|
|
3625
3769
|
ariaLabel: addLabel,
|
|
3626
|
-
triggerContent: /* @__PURE__ */ jsxs26(
|
|
3770
|
+
triggerContent: /* @__PURE__ */ jsxs26(Fragment15, { children: [
|
|
3627
3771
|
/* @__PURE__ */ jsx30(Icon, { name: "plus" }),
|
|
3628
3772
|
addLabel
|
|
3629
3773
|
] }),
|
|
@@ -3673,13 +3817,13 @@ function DrawerSection({ title, headingLevel = 3, className, children, ...rest }
|
|
|
3673
3817
|
}
|
|
3674
3818
|
|
|
3675
3819
|
// src/Snippet.tsx
|
|
3676
|
-
import { useEffect as
|
|
3677
|
-
import { Fragment as
|
|
3820
|
+
import { useEffect as useEffect14, useRef as useRef17, useState as useState14 } from "react";
|
|
3821
|
+
import { Fragment as Fragment16, jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3678
3822
|
function Snippet({ label = "shell", code = "", children, copy = true, reveal = false, copyLabel = "Copy code" }) {
|
|
3679
3823
|
const [status, setStatus] = useState14("idle");
|
|
3680
3824
|
const request = useRef17(0);
|
|
3681
3825
|
const timer = useRef17(void 0);
|
|
3682
|
-
|
|
3826
|
+
useEffect14(() => {
|
|
3683
3827
|
setStatus("idle");
|
|
3684
3828
|
return () => {
|
|
3685
3829
|
request.current++;
|
|
@@ -3702,7 +3846,7 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
3702
3846
|
return /* @__PURE__ */ jsxs28("div", { className: reveal ? "ui-snippet ui-snippet--reveal" : "ui-snippet", children: [
|
|
3703
3847
|
/* @__PURE__ */ jsxs28("div", { className: "ui-snippet__bar", children: [
|
|
3704
3848
|
/* @__PURE__ */ jsx32("span", { children: label }),
|
|
3705
|
-
copy && /* @__PURE__ */ jsxs28(
|
|
3849
|
+
copy && /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
3706
3850
|
/* @__PURE__ */ jsx32(
|
|
3707
3851
|
"button",
|
|
3708
3852
|
{
|
|
@@ -3722,14 +3866,14 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
3722
3866
|
}
|
|
3723
3867
|
|
|
3724
3868
|
// src/Timeline.tsx
|
|
3725
|
-
import { useEffect as
|
|
3869
|
+
import { useEffect as useEffect15, useRef as useRef18 } from "react";
|
|
3726
3870
|
import { playEntrance as playEntrance2, prefersReducedMotion } from "@apliteni/apliteni-ui/motion";
|
|
3727
3871
|
import { jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3728
3872
|
var kindIcons = { person: "user", rule: "bolt", reversal: "refresh" };
|
|
3729
3873
|
function Timeline({ events, className, ...rest }) {
|
|
3730
3874
|
const previousIds = useRef18(new Set(events.map((event) => event.id)));
|
|
3731
3875
|
const rows = useRef18(/* @__PURE__ */ new Map());
|
|
3732
|
-
|
|
3876
|
+
useEffect15(() => {
|
|
3733
3877
|
if (previousIds.current.size > 0 && !prefersReducedMotion()) {
|
|
3734
3878
|
for (const event of events) {
|
|
3735
3879
|
if (previousIds.current.has(event.id)) continue;
|
|
@@ -3772,7 +3916,7 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3772
3916
|
}
|
|
3773
3917
|
|
|
3774
3918
|
// src/Field.tsx
|
|
3775
|
-
import { forwardRef as forwardRef8, useEffect as
|
|
3919
|
+
import { forwardRef as forwardRef8, useEffect as useEffect16, useId as useId13, useRef as useRef19, useState as useState15 } from "react";
|
|
3776
3920
|
import { esc, icon as icon5 } from "@apliteni/apliteni-ui";
|
|
3777
3921
|
import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3778
3922
|
function messages(id, hint, error) {
|
|
@@ -3801,13 +3945,13 @@ function wiring(id, hint, error) {
|
|
|
3801
3945
|
return { id, "aria-describedby": messages(id, hint, error), "aria-invalid": error ? true : void 0 };
|
|
3802
3946
|
}
|
|
3803
3947
|
function Field({ id: suppliedId, label, hint, error, required, children }) {
|
|
3804
|
-
const generatedId =
|
|
3948
|
+
const generatedId = useId13();
|
|
3805
3949
|
const id = suppliedId ?? generatedId;
|
|
3806
3950
|
const labelId = `${id}-label`;
|
|
3807
3951
|
return /* @__PURE__ */ jsx34(Frame, { ...{ id, labelId, label, hint, error, required }, children: /* @__PURE__ */ jsx34(FieldContext.Provider, { value: { id, labelId }, children: children({ ...wiring(id, hint, error), required }) }) });
|
|
3808
3952
|
}
|
|
3809
3953
|
var TextField = forwardRef8(function TextField2({ label, hint, error, required, type = "text", unit, icon: glyph2, className = "", ...props }, ref) {
|
|
3810
|
-
const id =
|
|
3954
|
+
const id = useId13();
|
|
3811
3955
|
const hasUnit = type === "number" && !!unit;
|
|
3812
3956
|
const describedBy = [messages(id, hint, error), hasUnit ? `${id}-unit` : ""].filter(Boolean).join(" ") || void 0;
|
|
3813
3957
|
const control = /* @__PURE__ */ jsx34(
|
|
@@ -3834,7 +3978,7 @@ var TextField = forwardRef8(function TextField2({ label, hint, error, required,
|
|
|
3834
3978
|
] }) : control });
|
|
3835
3979
|
});
|
|
3836
3980
|
function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
3837
|
-
const id =
|
|
3981
|
+
const id = useId13();
|
|
3838
3982
|
return /* @__PURE__ */ jsx34(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx34(
|
|
3839
3983
|
"textarea",
|
|
3840
3984
|
{
|
|
@@ -3847,7 +3991,7 @@ function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
|
3847
3991
|
) });
|
|
3848
3992
|
}
|
|
3849
3993
|
function SelectField({ label, hint, error, required, className = "", children, ...props }) {
|
|
3850
|
-
const id =
|
|
3994
|
+
const id = useId13();
|
|
3851
3995
|
return /* @__PURE__ */ jsx34(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx34(
|
|
3852
3996
|
"select",
|
|
3853
3997
|
{
|
|
@@ -3860,11 +4004,11 @@ function SelectField({ label, hint, error, required, className = "", children, .
|
|
|
3860
4004
|
) });
|
|
3861
4005
|
}
|
|
3862
4006
|
function FileField({ label, hint, error, required, disabled, onFileChange, className = "", ...props }) {
|
|
3863
|
-
const id =
|
|
4007
|
+
const id = useId13();
|
|
3864
4008
|
const input = useRef19(null);
|
|
3865
4009
|
const [file, setFile] = useState15(null);
|
|
3866
4010
|
const [dragging, setDragging] = useState15(false);
|
|
3867
|
-
|
|
4011
|
+
useEffect16(() => {
|
|
3868
4012
|
const form = input.current?.form;
|
|
3869
4013
|
const reset = () => {
|
|
3870
4014
|
setFile(null);
|
|
@@ -3948,7 +4092,7 @@ function EmptyState({ variant = "first-run", title, sub, icon: icon9, art, actio
|
|
|
3948
4092
|
}
|
|
3949
4093
|
|
|
3950
4094
|
// src/FileDrop.tsx
|
|
3951
|
-
import { Fragment as
|
|
4095
|
+
import { Fragment as Fragment17, jsx as jsx36, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3952
4096
|
var MARKS = {
|
|
3953
4097
|
uploading: "clock",
|
|
3954
4098
|
done: "circleCheck",
|
|
@@ -4116,7 +4260,7 @@ function FileDrop({
|
|
|
4116
4260
|
children: /* @__PURE__ */ jsx36("span", { style: { width: `${file.progress}%` } })
|
|
4117
4261
|
}
|
|
4118
4262
|
)
|
|
4119
|
-
] }) : /* @__PURE__ */ jsxs32(
|
|
4263
|
+
] }) : /* @__PURE__ */ jsxs32(Fragment17, { children: [
|
|
4120
4264
|
/* @__PURE__ */ jsx36(
|
|
4121
4265
|
Button,
|
|
4122
4266
|
{
|
|
@@ -4156,7 +4300,7 @@ var SearchField = forwardRef9(function SearchField2({ ariaLabel, className, ...p
|
|
|
4156
4300
|
});
|
|
4157
4301
|
|
|
4158
4302
|
// src/Toast.tsx
|
|
4159
|
-
import { createContext as createContext4, useCallback as useCallback7, useContext as useContext3, useEffect as
|
|
4303
|
+
import { createContext as createContext4, useCallback as useCallback7, useContext as useContext3, useEffect as useEffect17, useLayoutEffect as useLayoutEffect4, useRef as useRef21, useState as useState17 } from "react";
|
|
4160
4304
|
import { createPortal as createPortal6 } from "react-dom";
|
|
4161
4305
|
|
|
4162
4306
|
// src/lib/toast-stack.ts
|
|
@@ -4293,7 +4437,7 @@ function Notice({ notice, remove }) {
|
|
|
4293
4437
|
if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches) remove();
|
|
4294
4438
|
else setLeaving(true);
|
|
4295
4439
|
}, [remove]);
|
|
4296
|
-
|
|
4440
|
+
useEffect17(() => {
|
|
4297
4441
|
if (leaving2) {
|
|
4298
4442
|
const element = root.current;
|
|
4299
4443
|
const finish = (event) => {
|
|
@@ -4307,7 +4451,7 @@ function Notice({ notice, remove }) {
|
|
|
4307
4451
|
};
|
|
4308
4452
|
}
|
|
4309
4453
|
}, [leaving2, remove]);
|
|
4310
|
-
|
|
4454
|
+
useEffect17(() => {
|
|
4311
4455
|
if (leaving2 || !timed || paused) return;
|
|
4312
4456
|
const started = Date.now();
|
|
4313
4457
|
const timer = setTimeout(dismiss, remaining.current);
|
|
@@ -4436,7 +4580,7 @@ function Toast({ children, collapse = false }) {
|
|
|
4436
4580
|
}
|
|
4437
4581
|
|
|
4438
4582
|
// src/AppShell.tsx
|
|
4439
|
-
import { useEffect as
|
|
4583
|
+
import { useEffect as useEffect19, useId as useId14, useMemo as useMemo5, useRef as useRef23, useState as useState19 } from "react";
|
|
4440
4584
|
import { prism } from "@apliteni/apliteni-ui";
|
|
4441
4585
|
|
|
4442
4586
|
// src/lib/palette-hotkey.ts
|
|
@@ -4466,7 +4610,7 @@ function storeRailCollapsed(collapsed) {
|
|
|
4466
4610
|
}
|
|
4467
4611
|
|
|
4468
4612
|
// src/AccountMenu.tsx
|
|
4469
|
-
import { useEffect as
|
|
4613
|
+
import { useEffect as useEffect18, useRef as useRef22, useState as useState18 } from "react";
|
|
4470
4614
|
import { createPortal as createPortal7 } from "react-dom";
|
|
4471
4615
|
import { icon as icon7, themeIcon as themeIcon2, transitionMs as transitionMs3 } from "@apliteni/apliteni-ui";
|
|
4472
4616
|
|
|
@@ -4547,7 +4691,7 @@ function ThemeToggle({ labelled = false }) {
|
|
|
4547
4691
|
}
|
|
4548
4692
|
|
|
4549
4693
|
// src/AccountMenu.tsx
|
|
4550
|
-
import { Fragment as
|
|
4694
|
+
import { Fragment as Fragment18, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4551
4695
|
var THEMES = [["auto", "Auto"], ["light", "Light"], ["dark", "Dark"]];
|
|
4552
4696
|
var glyph = (svg, className) => /* @__PURE__ */ jsx40("span", { className, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: svg } });
|
|
4553
4697
|
function AccountMenu({ account, items, onSelect, withTheme, inPlace, away }) {
|
|
@@ -4588,7 +4732,7 @@ function AccountMenu({ account, items, onSelect, withTheme, inPlace, away }) {
|
|
|
4588
4732
|
clearTimeout(landed);
|
|
4589
4733
|
};
|
|
4590
4734
|
}, [sub, inPlace]);
|
|
4591
|
-
|
|
4735
|
+
useEffect18(() => {
|
|
4592
4736
|
if (!open || !away) return;
|
|
4593
4737
|
const gone = () => {
|
|
4594
4738
|
if (block.current?.getClientRects().length) return;
|
|
@@ -4601,7 +4745,7 @@ function AccountMenu({ account, items, onSelect, withTheme, inPlace, away }) {
|
|
|
4601
4745
|
window.addEventListener("resize", gone);
|
|
4602
4746
|
return () => window.removeEventListener("resize", gone);
|
|
4603
4747
|
}, [open, away]);
|
|
4604
|
-
|
|
4748
|
+
useEffect18(() => {
|
|
4605
4749
|
if (sub) list.current?.querySelector('[role="menuitemradio"]')?.focus();
|
|
4606
4750
|
else if (refocus.current) {
|
|
4607
4751
|
refocus.current = false;
|
|
@@ -4673,7 +4817,7 @@ function AccountMenu({ account, items, onSelect, withTheme, inPlace, away }) {
|
|
|
4673
4817
|
setOpen(next);
|
|
4674
4818
|
if (!next) setSub(false);
|
|
4675
4819
|
},
|
|
4676
|
-
triggerContent: /* @__PURE__ */ jsxs36(
|
|
4820
|
+
triggerContent: /* @__PURE__ */ jsxs36(Fragment18, { children: [
|
|
4677
4821
|
/* @__PURE__ */ jsx40("span", { className: "ui-app__av", "aria-hidden": "true", children: /* @__PURE__ */ jsx40(Avatar, { personKey: account.email || account.name, name: account.name, size: 32 }) }),
|
|
4678
4822
|
/* @__PURE__ */ jsxs36("span", { className: "ui-app__who", children: [
|
|
4679
4823
|
/* @__PURE__ */ jsx40("b", { children: account.name }),
|
|
@@ -4681,7 +4825,7 @@ function AccountMenu({ account, items, onSelect, withTheme, inPlace, away }) {
|
|
|
4681
4825
|
] })
|
|
4682
4826
|
] }),
|
|
4683
4827
|
items: [...items, ...withTheme ? [{ label: "Theme", value: "theme" }, "---"] : [], { label: "Sign out", value: "sign-out", icon: "logout", danger: true }],
|
|
4684
|
-
row: (item, props) => item.value === "theme" ? /* @__PURE__ */ jsxs36(
|
|
4828
|
+
row: (item, props) => item.value === "theme" ? /* @__PURE__ */ jsxs36(Fragment18, { children: [
|
|
4685
4829
|
/* @__PURE__ */ jsxs36(
|
|
4686
4830
|
"div",
|
|
4687
4831
|
{
|
|
@@ -4720,7 +4864,7 @@ function AccountMenu({ account, items, onSelect, withTheme, inPlace, away }) {
|
|
|
4720
4864
|
}
|
|
4721
4865
|
|
|
4722
4866
|
// src/AppShell.tsx
|
|
4723
|
-
import { Fragment as
|
|
4867
|
+
import { Fragment as Fragment19, jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4724
4868
|
var path = (value) => value.split(/[?#]/)[0].replace(/\/+$/, "") || "/";
|
|
4725
4869
|
function AppShell({
|
|
4726
4870
|
sections,
|
|
@@ -4747,7 +4891,7 @@ function AppShell({
|
|
|
4747
4891
|
onNavigate,
|
|
4748
4892
|
renderLink
|
|
4749
4893
|
}) {
|
|
4750
|
-
const uid =
|
|
4894
|
+
const uid = useId14();
|
|
4751
4895
|
const [collapsed, setCollapsed] = useState19(defaultCollapsed);
|
|
4752
4896
|
const [search, setSearch] = useState19(false);
|
|
4753
4897
|
const [menu, setMenu] = useState19(false);
|
|
@@ -4758,14 +4902,14 @@ function AppShell({
|
|
|
4758
4902
|
} }), []);
|
|
4759
4903
|
const current = path(pathname);
|
|
4760
4904
|
const active = sections.filter((section) => current === path(section.href) || path(section.href) !== "/" && current.startsWith(`${path(section.href)}/`)).sort((a, b) => path(b.href).length - path(a.href).length)[0];
|
|
4761
|
-
|
|
4905
|
+
useEffect19(() => {
|
|
4762
4906
|
setCollapsed(railCollapsed() ?? defaultCollapsed);
|
|
4763
4907
|
}, [defaultCollapsed]);
|
|
4764
|
-
|
|
4908
|
+
useEffect19(() => {
|
|
4765
4909
|
setMenu(false);
|
|
4766
4910
|
setSearch(false);
|
|
4767
4911
|
}, [pathname]);
|
|
4768
|
-
|
|
4912
|
+
useEffect19(() => {
|
|
4769
4913
|
if (!menu) return;
|
|
4770
4914
|
const grown = () => {
|
|
4771
4915
|
const button = menuButton.current;
|
|
@@ -4774,7 +4918,7 @@ function AppShell({
|
|
|
4774
4918
|
window.addEventListener("resize", grown);
|
|
4775
4919
|
return () => window.removeEventListener("resize", grown);
|
|
4776
4920
|
}, [menu]);
|
|
4777
|
-
|
|
4921
|
+
useEffect19(() => {
|
|
4778
4922
|
if (layout === "rail") return;
|
|
4779
4923
|
const hotkey = (event) => {
|
|
4780
4924
|
if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey || event.key.toLowerCase() !== "k") return;
|
|
@@ -4914,7 +5058,7 @@ function AppShell({
|
|
|
4914
5058
|
] }),
|
|
4915
5059
|
/* @__PURE__ */ jsxs37("div", { className: "ui-app__well", children: [
|
|
4916
5060
|
/* @__PURE__ */ jsxs37("header", { className: "ui-app__bar", children: [
|
|
4917
|
-
navigable ? /* @__PURE__ */ jsxs37(
|
|
5061
|
+
navigable ? /* @__PURE__ */ jsxs37(Fragment19, { children: [
|
|
4918
5062
|
/* @__PURE__ */ jsx41("a", { className: "ui-app__brand ui-app__brand--band", href: brandHref, "aria-label": word, children: brand ?? /* @__PURE__ */ jsx41("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(`${uid}-band`, 24) } }) }),
|
|
4919
5063
|
/* @__PURE__ */ jsx41("span", { className: "ui-react-app__title", "aria-hidden": "true", children: title })
|
|
4920
5064
|
] }) : lockup,
|
|
@@ -4937,7 +5081,7 @@ function AppShell({
|
|
|
4937
5081
|
"aria-expanded": menu,
|
|
4938
5082
|
onClick: () => setMenu(true)
|
|
4939
5083
|
}
|
|
4940
|
-
) : /* @__PURE__ */ jsxs37(
|
|
5084
|
+
) : /* @__PURE__ */ jsxs37(Fragment19, { children: [
|
|
4941
5085
|
bandControl && /* @__PURE__ */ jsx41("span", { className: "ui-react-app__band-control", children: bandControl }),
|
|
4942
5086
|
headControl && /* @__PURE__ */ jsx41("span", { className: "ui-react-app__band-control", children: headControl }),
|
|
4943
5087
|
/* @__PURE__ */ jsx41(ThemeToggle, {}),
|
|
@@ -4995,7 +5139,7 @@ var AuthShell = forwardRef10(function AuthShell2({ brand, children, className, .
|
|
|
4995
5139
|
});
|
|
4996
5140
|
|
|
4997
5141
|
// src/Footer.tsx
|
|
4998
|
-
import { useId as
|
|
5142
|
+
import { useId as useId15 } from "react";
|
|
4999
5143
|
import { prism as prism2, safeUrl as safeUrl3 } from "@apliteni/apliteni-ui";
|
|
5000
5144
|
import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
5001
5145
|
var SOCIAL_GLYPHS = {
|
|
@@ -5027,7 +5171,7 @@ function Footer({
|
|
|
5027
5171
|
className,
|
|
5028
5172
|
...rest
|
|
5029
5173
|
}) {
|
|
5030
|
-
const uid =
|
|
5174
|
+
const uid = useId15();
|
|
5031
5175
|
const cls = ["ui-footer", `ui-footer--${variant}`, className].filter(Boolean).join(" ");
|
|
5032
5176
|
const bar = /* @__PURE__ */ jsx43(Legal, { legal, legalLinks, switcher });
|
|
5033
5177
|
if (variant !== "full") {
|
|
@@ -5065,7 +5209,7 @@ function Footer({
|
|
|
5065
5209
|
}
|
|
5066
5210
|
|
|
5067
5211
|
// src/Success.tsx
|
|
5068
|
-
import { forwardRef as forwardRef11, useEffect as
|
|
5212
|
+
import { forwardRef as forwardRef11, useEffect as useEffect20, useRef as useRef24, useState as useState20 } from "react";
|
|
5069
5213
|
import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
5070
5214
|
var SuccessCheck = forwardRef11(function SuccessCheck2({ variant = "line", className, ...rest }, ref) {
|
|
5071
5215
|
const circled = variant === "circled";
|
|
@@ -5114,10 +5258,10 @@ var pieces = [
|
|
|
5114
5258
|
function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
5115
5259
|
const [remaining, setRemaining] = useState20(seconds);
|
|
5116
5260
|
const callback = useRef24(onDone);
|
|
5117
|
-
|
|
5261
|
+
useEffect20(() => {
|
|
5118
5262
|
callback.current = onDone;
|
|
5119
5263
|
}, [onDone]);
|
|
5120
|
-
|
|
5264
|
+
useEffect20(() => {
|
|
5121
5265
|
let count = seconds;
|
|
5122
5266
|
const timer = setInterval(() => {
|
|
5123
5267
|
count -= 1;
|
|
@@ -5191,8 +5335,8 @@ var Success = forwardRef11(function Success2({
|
|
|
5191
5335
|
import {
|
|
5192
5336
|
useCallback as useCallback8,
|
|
5193
5337
|
useContext as useContext4,
|
|
5194
|
-
useEffect as
|
|
5195
|
-
useId as
|
|
5338
|
+
useEffect as useEffect21,
|
|
5339
|
+
useId as useId16,
|
|
5196
5340
|
useLayoutEffect as useLayoutEffect5,
|
|
5197
5341
|
useMemo as useMemo6,
|
|
5198
5342
|
useRef as useRef25,
|
|
@@ -5202,7 +5346,7 @@ import { createPortal as createPortal8 } from "react-dom";
|
|
|
5202
5346
|
import { CHART_FLOOR, bridgeWalk, chartScale, pointTarget } from "@apliteni/apliteni-ui";
|
|
5203
5347
|
|
|
5204
5348
|
// src/chart-looks.tsx
|
|
5205
|
-
import { Fragment as
|
|
5349
|
+
import { Fragment as Fragment20, jsx as jsx45, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
5206
5350
|
var LOOK_DEFAULT = {
|
|
5207
5351
|
line: "thin",
|
|
5208
5352
|
area: "stacked",
|
|
@@ -5527,7 +5671,7 @@ function linesDrawing(g, open) {
|
|
|
5527
5671
|
)
|
|
5528
5672
|
] }, `end-${layer.id}`);
|
|
5529
5673
|
});
|
|
5530
|
-
return /* @__PURE__ */ jsxs41(
|
|
5674
|
+
return /* @__PURE__ */ jsxs41(Fragment20, { children: [
|
|
5531
5675
|
ramps.some(Boolean) && /* @__PURE__ */ jsx45("defs", { children: ramps.map((ramp) => ramp && /* @__PURE__ */ jsxs41(
|
|
5532
5676
|
"linearGradient",
|
|
5533
5677
|
{
|
|
@@ -5586,7 +5730,7 @@ function rowsDrawing(g, pick) {
|
|
|
5586
5730
|
const { look, labels, format, formatAxis, scale } = g;
|
|
5587
5731
|
const rows = rowsOf(g);
|
|
5588
5732
|
const bottom = rows.row * labels.length;
|
|
5589
|
-
return /* @__PURE__ */ jsxs41(
|
|
5733
|
+
return /* @__PURE__ */ jsxs41(Fragment20, { children: [
|
|
5590
5734
|
pick !== null && pick >= 0 && pick < labels.length && /* @__PURE__ */ jsx45("rect", { className: "ui-chart__band", x: "0", width: px(rows.w), y: px(pick * rows.row), height: px(rows.row) }),
|
|
5591
5735
|
scale.ticks.map((tick) => /* @__PURE__ */ jsxs41("g", { children: [
|
|
5592
5736
|
/* @__PURE__ */ jsx45(
|
|
@@ -5657,7 +5801,7 @@ function ringDrawing(g) {
|
|
|
5657
5801
|
const { look, format } = g;
|
|
5658
5802
|
const ring = ringOf(g);
|
|
5659
5803
|
const total = look.totals[0];
|
|
5660
|
-
return /* @__PURE__ */ jsxs41(
|
|
5804
|
+
return /* @__PURE__ */ jsxs41(Fragment20, { children: [
|
|
5661
5805
|
look.layers.filter((s) => s.to[0] > s.from[0]).map((slice) => /* @__PURE__ */ jsx45(
|
|
5662
5806
|
"path",
|
|
5663
5807
|
{
|
|
@@ -5701,7 +5845,7 @@ function Shares({ look, format, swatch }) {
|
|
|
5701
5845
|
}
|
|
5702
5846
|
|
|
5703
5847
|
// src/Chart.tsx
|
|
5704
|
-
import { Fragment as
|
|
5848
|
+
import { Fragment as Fragment21, jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
5705
5849
|
var HEIGHT = { months: 216, bridge: 216, spark: 32, line: 216, area: 216, stacked: 216, donut: 216 };
|
|
5706
5850
|
var PAD = 2;
|
|
5707
5851
|
var ZERO_INSET = 1.5;
|
|
@@ -5744,7 +5888,7 @@ function barPath(m) {
|
|
|
5744
5888
|
}
|
|
5745
5889
|
function useTapFloor() {
|
|
5746
5890
|
const [floor, setFloor] = useState21(TARGET);
|
|
5747
|
-
|
|
5891
|
+
useEffect21(() => {
|
|
5748
5892
|
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX2}px) and (pointer: coarse)`);
|
|
5749
5893
|
if (!query) return;
|
|
5750
5894
|
const read = () => setFloor(query.matches ? TAP_FLOOR : TARGET);
|
|
@@ -5981,7 +6125,7 @@ function Chart(props) {
|
|
|
5981
6125
|
const showTable = table ?? !spark;
|
|
5982
6126
|
const [view, setView] = useState21("chart");
|
|
5983
6127
|
const asTable = showTable && view === "table";
|
|
5984
|
-
const uid =
|
|
6128
|
+
const uid = useId16().replace(/[^\w-]/g, "");
|
|
5985
6129
|
const frameEl = useRef25(null);
|
|
5986
6130
|
const card = useContext4(CardTools);
|
|
5987
6131
|
const claim = card?.claim;
|
|
@@ -6135,7 +6279,7 @@ function Chart(props) {
|
|
|
6135
6279
|
const fades = useMemo6(() => new Map(marks.filter((m) => m.kind === "bar").map((m) => fadeOf(uid, m, variant === "bridge")).filter((f) => f !== null).map((f) => [f.id, f])), [marks, uid, variant]);
|
|
6136
6280
|
const lead = useCallback8((column) => marks.find((m) => m.column === column), [marks]);
|
|
6137
6281
|
const open = openId ? byId.get(openId) : void 0;
|
|
6138
|
-
|
|
6282
|
+
useEffect21(() => {
|
|
6139
6283
|
const el = plot.current;
|
|
6140
6284
|
const box2 = scroller.current;
|
|
6141
6285
|
if (!el || !box2) return;
|
|
@@ -6160,7 +6304,7 @@ function Chart(props) {
|
|
|
6160
6304
|
const anchor = [...svgEl.current.querySelectorAll("[data-anchor]")].find((el) => el.getAttribute("data-anchor") === openId);
|
|
6161
6305
|
if (anchor) placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
|
|
6162
6306
|
}, [openId, plotWidth, plotHeight]);
|
|
6163
|
-
|
|
6307
|
+
useEffect21(() => {
|
|
6164
6308
|
if (!openId) return;
|
|
6165
6309
|
const doc = frameEl.current?.ownerDocument;
|
|
6166
6310
|
const view2 = doc?.defaultView;
|
|
@@ -6540,9 +6684,9 @@ function Chart(props) {
|
|
|
6540
6684
|
] })
|
|
6541
6685
|
}
|
|
6542
6686
|
),
|
|
6543
|
-
/* @__PURE__ */ jsx46("span", { ref: tipEl, className: cx9("ui-tip", openId && "is-open"), role: open ? "tooltip" : void 0, children: open && /* @__PURE__ */ jsxs42(
|
|
6687
|
+
/* @__PURE__ */ jsx46("span", { ref: tipEl, className: cx9("ui-tip", openId && "is-open"), role: open ? "tooltip" : void 0, children: open && /* @__PURE__ */ jsxs42(Fragment21, { children: [
|
|
6544
6688
|
/* @__PURE__ */ jsx46("span", { className: "ui-tip__label", children: spark || look ? columns[open.column]?.label : `${open.name}, ${columns[open.column]?.label}` }),
|
|
6545
|
-
open.rows ? /* @__PURE__ */ jsxs42(
|
|
6689
|
+
open.rows ? /* @__PURE__ */ jsxs42(Fragment21, { children: [
|
|
6546
6690
|
open.rows.map((row) => /* @__PURE__ */ jsxs42("span", { className: "ui-tip__value ui-chart__row", children: [
|
|
6547
6691
|
/* @__PURE__ */ jsxs42("span", { className: cx9("ui-chart__key", `ui-chart__tone--${row.tone}`), children: [
|
|
6548
6692
|
/* @__PURE__ */ jsx46(KeyMark, { shape: row.shape }),
|
|
@@ -6574,7 +6718,7 @@ function Chart(props) {
|
|
|
6574
6718
|
/* @__PURE__ */ jsx46("tbody", { children: tableRows.map((row, i) => /* @__PURE__ */ jsxs42("tr", { "aria-current": pick === i ? true : void 0, children: [
|
|
6575
6719
|
/* @__PURE__ */ jsxs42("th", { scope: "row", children: [
|
|
6576
6720
|
row.column.label,
|
|
6577
|
-
row.column.estimated && /* @__PURE__ */ jsxs42(
|
|
6721
|
+
row.column.estimated && /* @__PURE__ */ jsxs42(Fragment21, { children: [
|
|
6578
6722
|
" ",
|
|
6579
6723
|
/* @__PURE__ */ jsx46("span", { className: "ui-chart__state", children: stateOf(row.column) })
|
|
6580
6724
|
] })
|
|
@@ -6631,9 +6775,9 @@ var AccentPicker = forwardRef12(function AccentPicker2({
|
|
|
6631
6775
|
});
|
|
6632
6776
|
|
|
6633
6777
|
// src/TopBar.tsx
|
|
6634
|
-
import { Fragment as
|
|
6778
|
+
import { Fragment as Fragment22 } from "react";
|
|
6635
6779
|
import { prism as prism3, safeUrl as safeUrl4, icon as icon8, ACCOUNT_NAV } from "@apliteni/apliteni-ui";
|
|
6636
|
-
import { Fragment as
|
|
6780
|
+
import { Fragment as Fragment23, jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
6637
6781
|
function TopBar({
|
|
6638
6782
|
brand,
|
|
6639
6783
|
word = "Strategy",
|
|
@@ -6667,7 +6811,7 @@ function ViewSwitch({ items, active, label = "View", renderLink }) {
|
|
|
6667
6811
|
"aria-current": current ? "page" : void 0,
|
|
6668
6812
|
children: item.label
|
|
6669
6813
|
};
|
|
6670
|
-
return /* @__PURE__ */ jsx48(
|
|
6814
|
+
return /* @__PURE__ */ jsx48(Fragment22, { children: renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx48("a", { ...linkProps }) }, item.id);
|
|
6671
6815
|
}) });
|
|
6672
6816
|
}
|
|
6673
6817
|
var BADGE = { live: "Live", archive: "Archive" };
|
|
@@ -6684,7 +6828,7 @@ function VersionSwitcher({ versions, value, onChange, label = "Version", default
|
|
|
6684
6828
|
chevron: false,
|
|
6685
6829
|
defaultOpen,
|
|
6686
6830
|
ariaLabel: `${label} \u2014 ${current?.label ?? ""}`,
|
|
6687
|
-
triggerContent: /* @__PURE__ */ jsxs43(
|
|
6831
|
+
triggerContent: /* @__PURE__ */ jsxs43(Fragment23, { children: [
|
|
6688
6832
|
/* @__PURE__ */ jsx48("span", { className: "cur", children: current?.label }),
|
|
6689
6833
|
/* @__PURE__ */ jsx48("span", { className: "car", "aria-hidden": "true" })
|
|
6690
6834
|
] }),
|