@apliteni/apliteni-ui 0.149.0 → 0.154.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/TRADEMARK.md +22 -0
- package/docs/components.md +1384 -0
- package/docs/foundations.md +494 -0
- package/guidelines/account-and-settings.md +2 -2
- package/guidelines/dashboards-and-reports.md +14 -0
- package/guidelines/dense-tables.md +16 -2
- package/guidelines/density-and-accents.md +1 -1
- package/guidelines/going-back.md +5 -5
- package/guidelines/the-page.md +2 -0
- package/package.json +5 -2
- package/react/README.md +5 -14
- package/react/dist/index.css +8 -0
- package/react/dist/index.d.ts +19 -23
- package/react/dist/index.js +720 -493
- package/src/assets/icons.js +10 -0
- package/src/logic/dropdown-placement.js +17 -1
- package/src/styles/back.css +2 -2
- package/src/styles/card.css +55 -0
- package/src/styles/chart.css +6 -0
- package/src/styles/dropdown.css +14 -0
- package/src/styles/layout.css +7 -3
- package/src/styles/nav.css +3 -38
- package/src/styles/tap-zone.css +8 -0
- package/src/tokens/tokens.css +12 -0
package/react/dist/index.js
CHANGED
|
@@ -282,22 +282,37 @@ var StatusDot = forwardRef5(function StatusDot2({
|
|
|
282
282
|
});
|
|
283
283
|
|
|
284
284
|
// src/primitives/Card.tsx
|
|
285
|
+
import { createContext, useCallback as useCallback2, useMemo, useState as useState2 } from "react";
|
|
285
286
|
import { icon as kitIcon, safeUrl } from "@apliteni/apliteni-ui";
|
|
286
287
|
import { Fragment, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
287
|
-
|
|
288
|
+
var CardTools = createContext(null);
|
|
289
|
+
function Card({ title, sub, level = 2, variant, pad: pad2, icon: icon9, href, tools, className, children }) {
|
|
290
|
+
const [claims, setClaims] = useState2([]);
|
|
291
|
+
const [slot, setSlot] = useState2(null);
|
|
292
|
+
const claim = useCallback2((id) => {
|
|
293
|
+
setClaims((held) => held.includes(id) ? held : [...held, id]);
|
|
294
|
+
return () => setClaims((held) => held.filter((h) => h !== id));
|
|
295
|
+
}, []);
|
|
296
|
+
const owner = claims[0] ?? null;
|
|
297
|
+
const offer = useMemo(() => ({ slot, owner, claim }), [slot, owner, claim]);
|
|
288
298
|
const n = Number(level);
|
|
289
299
|
const Heading = href != null ? "div" : `h${[2, 3, 4, 5, 6].includes(n) ? n : 2}`;
|
|
290
300
|
const titled = title != null && title !== false && title !== "";
|
|
291
301
|
const classes = ["ui-card", variant && `ui-card--${variant}`, pad2 && `ui-card--pad-${pad2}`, href != null && "ui-card--interactive", className].filter(Boolean).join(" ");
|
|
302
|
+
const withTools = titled && href == null;
|
|
303
|
+
const heading = titled && /* @__PURE__ */ jsxs5(Heading, { className: "ui-card__title", children: [
|
|
304
|
+
icon9 && /* @__PURE__ */ jsx9("span", { className: "ui-card__icon", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: kitIcon(icon9) } }),
|
|
305
|
+
title
|
|
306
|
+
] });
|
|
292
307
|
const inner = /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
] }),
|
|
308
|
+
withTools && (tools != null || owner != null) ? /* @__PURE__ */ jsxs5("div", { className: "ui-card__head", children: [
|
|
309
|
+
heading,
|
|
310
|
+
/* @__PURE__ */ jsx9("div", { className: "ui-card__tools", ref: setSlot, children: tools })
|
|
311
|
+
] }) : heading,
|
|
297
312
|
sub != null && /* @__PURE__ */ jsx9("div", { className: "ui-card__sub", children: sub }),
|
|
298
313
|
children
|
|
299
314
|
] });
|
|
300
|
-
return href != null ? /* @__PURE__ */ jsx9("a", { className: classes, href: safeUrl(href), children: inner }) : /* @__PURE__ */ jsx9("div", { className: classes, children: inner });
|
|
315
|
+
return href != null ? /* @__PURE__ */ jsx9("a", { className: classes, href: safeUrl(href), children: inner }) : /* @__PURE__ */ jsx9("div", { className: classes, children: withTools ? /* @__PURE__ */ jsx9(CardTools.Provider, { value: offer, children: inner }) : inner });
|
|
301
316
|
}
|
|
302
317
|
|
|
303
318
|
// src/primitives/Callout.tsx
|
|
@@ -356,7 +371,7 @@ function placeTip(host, mark, tip, bound, placement = "top") {
|
|
|
356
371
|
}
|
|
357
372
|
|
|
358
373
|
// src/Tooltip.tsx
|
|
359
|
-
import { useEffect, useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as
|
|
374
|
+
import { useEffect, useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState3 } from "react";
|
|
360
375
|
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
361
376
|
var DOC_EVENTS = ["pointerdown", "pointercancel", "click", "keydown", "touchend"];
|
|
362
377
|
var CAPTURED = /* @__PURE__ */ new Set(["pointerdown", "pointercancel"]);
|
|
@@ -399,7 +414,7 @@ function Tooltip({ text: text2, label = text2, value, detail: detail2, placement
|
|
|
399
414
|
const pointerKind = useRef2("");
|
|
400
415
|
const pendingClick = useRef2(null);
|
|
401
416
|
const dismissed = useRef2(null);
|
|
402
|
-
const [mark, setMark] =
|
|
417
|
+
const [mark, setMark] = useState3(null);
|
|
403
418
|
const active = useRef2(null);
|
|
404
419
|
active.current = mark;
|
|
405
420
|
const open = mark !== null;
|
|
@@ -599,12 +614,12 @@ import { createPortal } from "react-dom";
|
|
|
599
614
|
|
|
600
615
|
// src/dialog.ts
|
|
601
616
|
import {
|
|
602
|
-
createContext,
|
|
617
|
+
createContext as createContext2,
|
|
603
618
|
useContext,
|
|
604
619
|
useEffect as useEffect2,
|
|
605
620
|
useLayoutEffect as useLayoutEffect3,
|
|
606
621
|
useRef as useRef3,
|
|
607
|
-
useState as
|
|
622
|
+
useState as useState4
|
|
608
623
|
} from "react";
|
|
609
624
|
import { transitionMs } from "@apliteni/apliteni-ui";
|
|
610
625
|
var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), details > summary:first-of-type';
|
|
@@ -627,7 +642,7 @@ var dismissOnScrim = (onClose) => (e) => {
|
|
|
627
642
|
onClose();
|
|
628
643
|
};
|
|
629
644
|
var useIsoLayoutEffect = typeof document === "undefined" ? useEffect2 : useLayoutEffect3;
|
|
630
|
-
var DialogScope =
|
|
645
|
+
var DialogScope = createContext2(null);
|
|
631
646
|
var stack = [];
|
|
632
647
|
var leaving = /* @__PURE__ */ new Set();
|
|
633
648
|
var marked = [];
|
|
@@ -726,8 +741,8 @@ function exit(entry) {
|
|
|
726
741
|
}
|
|
727
742
|
var EXIT_SLACK_MS = 50;
|
|
728
743
|
function usePresence(open, root, panel) {
|
|
729
|
-
const [present, setPresent] =
|
|
730
|
-
const [entered, setEntered] =
|
|
744
|
+
const [present, setPresent] = useState4(open);
|
|
745
|
+
const [entered, setEntered] = useState4(false);
|
|
731
746
|
if (open && !present) setPresent(true);
|
|
732
747
|
const shown = open && entered;
|
|
733
748
|
useIsoLayoutEffect(() => {
|
|
@@ -776,7 +791,7 @@ function usePresence(open, root, panel) {
|
|
|
776
791
|
}
|
|
777
792
|
function useDialog(active, { root, panel, body, initialFocus, fallbackFocus }, onClose) {
|
|
778
793
|
const parent = useContext(DialogScope);
|
|
779
|
-
const [scope] =
|
|
794
|
+
const [scope] = useState4(() => ({ parent }));
|
|
780
795
|
const close = useRef3(onClose);
|
|
781
796
|
useIsoLayoutEffect(() => {
|
|
782
797
|
close.current = onClose;
|
|
@@ -869,7 +884,7 @@ function Confirm({
|
|
|
869
884
|
}
|
|
870
885
|
|
|
871
886
|
// src/Feedback.tsx
|
|
872
|
-
import { useEffect as useEffect3, useRef as useRef6, useState as
|
|
887
|
+
import { useEffect as useEffect3, useRef as useRef6, useState as useState5 } from "react";
|
|
873
888
|
import { createPortal as createPortal2 } from "react-dom";
|
|
874
889
|
import { nearestSection } from "@apliteni/apliteni-ui";
|
|
875
890
|
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
@@ -888,14 +903,14 @@ function Feedback({
|
|
|
888
903
|
placeholder = "What's off, missing, or worth adding here?",
|
|
889
904
|
sentMessage = "Thanks, your note is sent."
|
|
890
905
|
}) {
|
|
891
|
-
const [pill, setPill] =
|
|
892
|
-
const [open, setOpen] =
|
|
906
|
+
const [pill, setPill] = useState5(null);
|
|
907
|
+
const [open, setOpen] = useState5(false);
|
|
893
908
|
const openRef = useRef6(false);
|
|
894
|
-
const [note, setNote] =
|
|
895
|
-
const [state, setState] =
|
|
896
|
-
const [error, setError] =
|
|
909
|
+
const [note, setNote] = useState5("");
|
|
910
|
+
const [state, setState] = useState5("ready");
|
|
911
|
+
const [error, setError] = useState5("");
|
|
897
912
|
const pending = useRef6(null);
|
|
898
|
-
const [view, setView] =
|
|
913
|
+
const [view, setView] = useState5({ chip: "this page", quote: "" });
|
|
899
914
|
const mark = useRef6(null);
|
|
900
915
|
const opening = useRef6(0);
|
|
901
916
|
const pillRef = useRef6(null);
|
|
@@ -1109,7 +1124,7 @@ function Feedback({
|
|
|
1109
1124
|
}
|
|
1110
1125
|
|
|
1111
1126
|
// src/AccountWindow.tsx
|
|
1112
|
-
import { useEffect as useEffect7, useId as useId7, useRef as useRef9, useState as
|
|
1127
|
+
import { useEffect as useEffect7, useId as useId7, useRef as useRef9, useState as useState7 } from "react";
|
|
1113
1128
|
import { createPortal as createPortal3 } from "react-dom";
|
|
1114
1129
|
import { revealFocusedNav as revealFocusedNav2 } from "@apliteni/apliteni-ui";
|
|
1115
1130
|
|
|
@@ -1167,7 +1182,7 @@ var NavTabs = forwardRef6(function NavTabs2({
|
|
|
1167
1182
|
});
|
|
1168
1183
|
|
|
1169
1184
|
// src/SidebarNav.tsx
|
|
1170
|
-
import { forwardRef as forwardRef7, useEffect as useEffect5, useId as useId5, useState as
|
|
1185
|
+
import { forwardRef as forwardRef7, useEffect as useEffect5, useId as useId5, useState as useState6 } from "react";
|
|
1171
1186
|
import { ENTRANCE_FALLBACK_MS } from "@apliteni/apliteni-ui/motion";
|
|
1172
1187
|
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1173
1188
|
var badgeText = (badge) => typeof badge === "object" ? badge.text : badge;
|
|
@@ -1175,9 +1190,9 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
1175
1190
|
const uid = useId5();
|
|
1176
1191
|
const group = !sub && !!item.items?.length;
|
|
1177
1192
|
const childActive = group && item.items.some((child) => child.id === active);
|
|
1178
|
-
const [expanded, setExpanded] =
|
|
1193
|
+
const [expanded, setExpanded] = useState6();
|
|
1179
1194
|
const open = expanded ?? item.defaultOpen ?? childActive;
|
|
1180
|
-
const [entering, setEntering] =
|
|
1195
|
+
const [entering, setEntering] = useState6(false);
|
|
1181
1196
|
useEffect5(() => {
|
|
1182
1197
|
if (!entering) return;
|
|
1183
1198
|
const timer = setTimeout(() => setEntering(false), ENTRANCE_FALLBACK_MS);
|
|
@@ -1356,7 +1371,7 @@ function AccountWindow({
|
|
|
1356
1371
|
const panel = useRef9(null);
|
|
1357
1372
|
const body = useRef9(null);
|
|
1358
1373
|
const tabs = useRef9(null);
|
|
1359
|
-
const [own, setOwn] =
|
|
1374
|
+
const [own, setOwn] = useState7(defaultSection2 ?? sections[0]?.id);
|
|
1360
1375
|
const { mounted, shown } = usePresence(open, root, panel);
|
|
1361
1376
|
const scope = useDialog(shown, { root, panel, body }, onClose);
|
|
1362
1377
|
const currentId = section ?? own;
|
|
@@ -1502,7 +1517,7 @@ function Drawer({
|
|
|
1502
1517
|
/* @__PURE__ */ jsx20(DialogScope.Provider, { value: scope, children: /* @__PURE__ */ jsxs16("div", { className: cls, ref: root, children: [
|
|
1503
1518
|
/* @__PURE__ */ jsx20("div", { className: "ui-drawer__scrim", onMouseDown: dismissOnScrim(onClose) }),
|
|
1504
1519
|
/* @__PURE__ */ jsxs16(
|
|
1505
|
-
"
|
|
1520
|
+
"div",
|
|
1506
1521
|
{
|
|
1507
1522
|
className: "ui-drawer__panel",
|
|
1508
1523
|
role: "dialog",
|
|
@@ -1527,7 +1542,7 @@ function Drawer({
|
|
|
1527
1542
|
}
|
|
1528
1543
|
|
|
1529
1544
|
// src/CommandPalette.tsx
|
|
1530
|
-
import { useCallback as
|
|
1545
|
+
import { useCallback as useCallback3, useEffect as useEffect8, useId as useId9, useMemo as useMemo2, useRef as useRef11, useState as useState8 } from "react";
|
|
1531
1546
|
import { createPortal as createPortal5 } from "react-dom";
|
|
1532
1547
|
import { rankGroups, icon as icon3 } from "@apliteni/apliteni-ui";
|
|
1533
1548
|
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
@@ -1551,25 +1566,25 @@ function CommandPalette({
|
|
|
1551
1566
|
const root = useRef11(null);
|
|
1552
1567
|
const panel = useRef11(null);
|
|
1553
1568
|
const search = useRef11(null);
|
|
1554
|
-
const [query, setQuery] =
|
|
1555
|
-
const [at, setAt] =
|
|
1569
|
+
const [query, setQuery] = useState8("");
|
|
1570
|
+
const [at, setAt] = useState8(0);
|
|
1556
1571
|
useEffect8(() => {
|
|
1557
1572
|
if (open) {
|
|
1558
1573
|
setQuery("");
|
|
1559
1574
|
setAt(0);
|
|
1560
1575
|
}
|
|
1561
1576
|
}, [open]);
|
|
1562
|
-
const shown =
|
|
1577
|
+
const shown = useMemo2(
|
|
1563
1578
|
() => (rank ? rankGroups(groups, query) : groups).filter((g) => g.items.length),
|
|
1564
1579
|
[groups, query, rank]
|
|
1565
1580
|
);
|
|
1566
|
-
const rows =
|
|
1581
|
+
const rows = useMemo2(() => shown.flatMap((g) => g.items).filter((it) => !isDisabled(it)), [shown]);
|
|
1567
1582
|
const active = rows[Math.min(at, rows.length - 1)];
|
|
1568
1583
|
useEffect8(() => {
|
|
1569
1584
|
setAt(0);
|
|
1570
1585
|
}, [query]);
|
|
1571
1586
|
const scope = useDialog(open, { root, panel, body: search }, onClose);
|
|
1572
|
-
const run =
|
|
1587
|
+
const run = useCallback3((item, newTab) => {
|
|
1573
1588
|
if (isDisabled(item)) return;
|
|
1574
1589
|
onSelect?.(item, { newTab });
|
|
1575
1590
|
if (item.danger && item.onConfirm) {
|
|
@@ -1720,11 +1735,11 @@ function rowId(uid, groups, item) {
|
|
|
1720
1735
|
}
|
|
1721
1736
|
|
|
1722
1737
|
// src/DataTable.tsx
|
|
1723
|
-
import { Fragment as Fragment10, useCallback as
|
|
1738
|
+
import { Fragment as Fragment10, useCallback as useCallback4, useEffect as useEffect10, useMemo as useMemo3, useRef as useRef13, useState as useState10 } from "react";
|
|
1724
1739
|
import { DEFAULT_PAGE_SIZE as DEFAULT_PAGE_SIZE2 } from "@apliteni/apliteni-ui";
|
|
1725
1740
|
|
|
1726
1741
|
// src/Pagination.tsx
|
|
1727
|
-
import { useEffect as useEffect9, useId as useId10, useRef as useRef12, useState as
|
|
1742
|
+
import { useEffect as useEffect9, useId as useId10, useRef as useRef12, useState as useState9 } from "react";
|
|
1728
1743
|
import { DEFAULT_PAGE_SIZE } from "@apliteni/apliteni-ui";
|
|
1729
1744
|
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1730
1745
|
var GHOST_SM = "ui-btn ui-btn--ghost ui-btn--sm";
|
|
@@ -1769,8 +1784,8 @@ function Pagination({
|
|
|
1769
1784
|
onPageSizeChange
|
|
1770
1785
|
}) {
|
|
1771
1786
|
const auto = useId10();
|
|
1772
|
-
const [draft, setDraft] =
|
|
1773
|
-
const [drafting, setDrafting] =
|
|
1787
|
+
const [draft, setDraft] = useState9("");
|
|
1788
|
+
const [drafting, setDrafting] = useState9(false);
|
|
1774
1789
|
const nav = useRef12(null);
|
|
1775
1790
|
const pressed = useRef12(null);
|
|
1776
1791
|
const uid = id ?? auto;
|
|
@@ -1781,7 +1796,7 @@ function Pagination({
|
|
|
1781
1796
|
const rows = counted ? Math.max(0, asRows) : null;
|
|
1782
1797
|
const last = counted ? Math.max(1, Math.ceil(rows / size)) : null;
|
|
1783
1798
|
const at = counted ? Math.min(Math.max(1, int(page, 1)), last) : Math.min(Math.max(1, int(page, 1)), CAP - 1);
|
|
1784
|
-
const [draftFor, setDraftFor] =
|
|
1799
|
+
const [draftFor, setDraftFor] = useState9(at);
|
|
1785
1800
|
if (draftFor !== at) {
|
|
1786
1801
|
setDraftFor(at);
|
|
1787
1802
|
setDraft("");
|
|
@@ -1991,12 +2006,12 @@ function DataTable({
|
|
|
1991
2006
|
}) {
|
|
1992
2007
|
const scrollable = stickyHeader || pinnedIdentity;
|
|
1993
2008
|
const table = useRef13(null);
|
|
1994
|
-
const [pagerHost, setPagerHost] =
|
|
1995
|
-
const holdPagerBox =
|
|
2009
|
+
const [pagerHost, setPagerHost] = useState10(null);
|
|
2010
|
+
const holdPagerBox = useCallback4(
|
|
1996
2011
|
(box) => setPagerHost(box?.parentElement ?? null),
|
|
1997
2012
|
[]
|
|
1998
2013
|
);
|
|
1999
|
-
const [strip2, setStrip] =
|
|
2014
|
+
const [strip2, setStrip] = useState10();
|
|
2000
2015
|
useEffect10(() => {
|
|
2001
2016
|
const el = table.current;
|
|
2002
2017
|
const host = pagerHost;
|
|
@@ -2017,21 +2032,21 @@ function DataTable({
|
|
|
2017
2032
|
measure();
|
|
2018
2033
|
return () => observer.disconnect();
|
|
2019
2034
|
}, [pagerHost, columns, rows]);
|
|
2020
|
-
const [localSort, setLocalSort] =
|
|
2035
|
+
const [localSort, setLocalSort] = useState10(
|
|
2021
2036
|
{ key: columns.find((c) => c.sortable)?.key, dir: -1 }
|
|
2022
2037
|
);
|
|
2023
2038
|
const owned = controlledPage === void 0;
|
|
2024
2039
|
const sort = controlledSort ?? (owned ? localSort : NO_SORT);
|
|
2025
2040
|
const sortIsKnown = owned || controlledSort !== void 0;
|
|
2026
|
-
const [localPage, setLocalPage] =
|
|
2027
|
-
const [localSize, setLocalSize] =
|
|
2041
|
+
const [localPage, setLocalPage] = useState10(1);
|
|
2042
|
+
const [localSize, setLocalSize] = useState10(DEFAULT_PAGE_SIZE2);
|
|
2028
2043
|
const size = sizeOf(pageSize, owned ? localSize : rows.length || DEFAULT_PAGE_SIZE2);
|
|
2029
|
-
const [pagedSort, setPagedSort] =
|
|
2044
|
+
const [pagedSort, setPagedSort] = useState10(sort);
|
|
2030
2045
|
if (pagedSort.key !== sort.key || pagedSort.dir !== sort.dir) {
|
|
2031
2046
|
setPagedSort(sort);
|
|
2032
2047
|
setLocalPage(1);
|
|
2033
2048
|
}
|
|
2034
|
-
const ordered =
|
|
2049
|
+
const ordered = useMemo3(
|
|
2035
2050
|
() => owned ? sortTableRows(rows, sort) : rows,
|
|
2036
2051
|
[owned, rows, sort.key, sort.dir]
|
|
2037
2052
|
);
|
|
@@ -2263,11 +2278,11 @@ function Denied({
|
|
|
2263
2278
|
|
|
2264
2279
|
// src/DatePicker.tsx
|
|
2265
2280
|
import {
|
|
2266
|
-
useCallback as
|
|
2281
|
+
useCallback as useCallback5,
|
|
2267
2282
|
useEffect as useEffect11,
|
|
2268
|
-
useMemo as
|
|
2283
|
+
useMemo as useMemo4,
|
|
2269
2284
|
useRef as useRef14,
|
|
2270
|
-
useState as
|
|
2285
|
+
useState as useState11
|
|
2271
2286
|
} from "react";
|
|
2272
2287
|
import { dropdownViewportFit } from "@apliteni/apliteni-ui";
|
|
2273
2288
|
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
@@ -2279,7 +2294,7 @@ var MONTH_RE = /^(\d{4})-(\d{2})$/;
|
|
|
2279
2294
|
var DAY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
2280
2295
|
var PHONE_MAX = 560;
|
|
2281
2296
|
function usePhone() {
|
|
2282
|
-
const [phone, setPhone] =
|
|
2297
|
+
const [phone, setPhone] = useState11(false);
|
|
2283
2298
|
useEffect11(() => {
|
|
2284
2299
|
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX}px)`);
|
|
2285
2300
|
if (!query) return;
|
|
@@ -2379,13 +2394,13 @@ function DatePicker({
|
|
|
2379
2394
|
const trigger = useRef14(null);
|
|
2380
2395
|
const grid = useRef14(null);
|
|
2381
2396
|
const panel = useRef14(null);
|
|
2382
|
-
const [selfOpen, setSelfOpen] =
|
|
2397
|
+
const [selfOpen, setSelfOpen] = useState11(defaultOpen);
|
|
2383
2398
|
const open = openProp ?? selfOpen;
|
|
2384
|
-
const [selfValue, setSelfValue] =
|
|
2399
|
+
const [selfValue, setSelfValue] = useState11(defaultValue);
|
|
2385
2400
|
const picked = value !== void 0 ? value : selfValue;
|
|
2386
|
-
const [selfRange, setSelfRange] =
|
|
2401
|
+
const [selfRange, setSelfRange] = useState11(defaultRange ?? { start: null, end: null });
|
|
2387
2402
|
const span = range !== void 0 ? range : selfRange;
|
|
2388
|
-
const names =
|
|
2403
|
+
const names = useMemo4(() => ({
|
|
2389
2404
|
month: new Intl.DateTimeFormat(locale, { month: "long", timeZone: "UTC" }),
|
|
2390
2405
|
monthShort: new Intl.DateTimeFormat(locale, { month: "short", timeZone: "UTC" }),
|
|
2391
2406
|
monthYear: new Intl.DateTimeFormat(locale, { month: "long", year: "numeric", timeZone: "UTC" }),
|
|
@@ -2395,28 +2410,28 @@ function DatePicker({
|
|
|
2395
2410
|
weekday: new Intl.DateTimeFormat(locale, { weekday: "long", timeZone: "UTC" }),
|
|
2396
2411
|
weekdayShort: new Intl.DateTimeFormat(locale, { weekday: "short", timeZone: "UTC" })
|
|
2397
2412
|
}), [locale]);
|
|
2398
|
-
const monthLabels =
|
|
2399
|
-
const at =
|
|
2413
|
+
const monthLabels = useMemo4(() => evenMonthLabels(names.monthShort), [names]);
|
|
2414
|
+
const at = useCallback5((index) => new Date(
|
|
2400
2415
|
grain === "month" ? Date.UTC(Math.floor(index / 12), index % 12, 1) : index * DAY_MS
|
|
2401
2416
|
), [grain]);
|
|
2402
2417
|
const lo = toIndex(min, grain, "start");
|
|
2403
2418
|
const hi = toIndex(max, grain, "end");
|
|
2404
|
-
const blocked =
|
|
2419
|
+
const blocked = useMemo4(() => (disabledPeriods ?? []).flatMap((period) => {
|
|
2405
2420
|
const from = toIndex(period, grain, "start");
|
|
2406
2421
|
const to = toIndex(period, grain, "end");
|
|
2407
2422
|
return from == null || to == null ? [] : [[from, to]];
|
|
2408
2423
|
}), [disabledPeriods, grain]);
|
|
2409
2424
|
const outOfBounds = (index) => lo != null && index < lo || hi != null && index > hi;
|
|
2410
2425
|
const isBlocked = (index) => outOfBounds(index) || blocked.some(([from, to]) => index >= from && index <= to);
|
|
2411
|
-
const todayIndex =
|
|
2426
|
+
const todayIndex = useMemo4(() => {
|
|
2412
2427
|
const given = toIndex(today, "day");
|
|
2413
2428
|
const now = given ?? Math.floor(Date.now() / DAY_MS);
|
|
2414
2429
|
return grain === "month" ? monthOf(now) : now;
|
|
2415
2430
|
}, [today, grain]);
|
|
2416
2431
|
const anchor = toIndex(picked, grain) ?? toIndex(picksRange ? span.start ?? span.end : null, grain) ?? todayIndex;
|
|
2417
|
-
const [cursor, setCursor] =
|
|
2432
|
+
const [cursor, setCursor] = useState11(() => clamp(anchor, lo, hi));
|
|
2418
2433
|
const land = useRef14(false);
|
|
2419
|
-
const setOpen =
|
|
2434
|
+
const setOpen = useCallback5((next) => {
|
|
2420
2435
|
if (openProp === void 0) setSelfOpen(next);
|
|
2421
2436
|
onOpenChange?.(next);
|
|
2422
2437
|
}, [openProp, onOpenChange]);
|
|
@@ -2474,11 +2489,11 @@ function DatePicker({
|
|
|
2474
2489
|
const columns = grain === "month" ? 3 : 7;
|
|
2475
2490
|
const page = grain === "month" ? Math.floor(cursor / 12) : monthOf(cursor);
|
|
2476
2491
|
const caption = grain === "month" ? String(page) : names.monthYear.format(at(firstDayOf(page)));
|
|
2477
|
-
const periodName =
|
|
2492
|
+
const periodName = useCallback5((index) => grain === "month" ? names.monthYear.format(at(index)) : `${names.weekday.format(at(index))} ${names.day.format(at(index))}`, [grain, names, at]);
|
|
2478
2493
|
const count = grain === "month" ? 12 : daysInMonth(page);
|
|
2479
2494
|
const first = grain === "month" ? page * 12 : firstDayOf(page);
|
|
2480
2495
|
const last = first + count - 1;
|
|
2481
|
-
const cells =
|
|
2496
|
+
const cells = useMemo4(() => Array.from({ length: count }, (_, i) => {
|
|
2482
2497
|
const index = first + i;
|
|
2483
2498
|
const period = fromIndex(index, grain);
|
|
2484
2499
|
return {
|
|
@@ -2572,7 +2587,7 @@ function DatePicker({
|
|
|
2572
2587
|
dismiss();
|
|
2573
2588
|
}
|
|
2574
2589
|
}
|
|
2575
|
-
const shown =
|
|
2590
|
+
const shown = useMemo4(() => {
|
|
2576
2591
|
if (picksRange) {
|
|
2577
2592
|
const text2 = (period) => {
|
|
2578
2593
|
const index2 = toIndex(period, grain);
|
|
@@ -2759,12 +2774,12 @@ function DatePicker({
|
|
|
2759
2774
|
// src/Dropdown.tsx
|
|
2760
2775
|
import {
|
|
2761
2776
|
Fragment as Fragment12,
|
|
2762
|
-
useCallback as
|
|
2777
|
+
useCallback as useCallback6,
|
|
2763
2778
|
useContext as useContext2,
|
|
2764
2779
|
useEffect as useEffect12,
|
|
2765
2780
|
useId as useId11,
|
|
2766
2781
|
useRef as useRef15,
|
|
2767
|
-
useState as
|
|
2782
|
+
useState as useState12
|
|
2768
2783
|
} from "react";
|
|
2769
2784
|
import {
|
|
2770
2785
|
icon as icon4,
|
|
@@ -2782,8 +2797,8 @@ import {
|
|
|
2782
2797
|
} from "@apliteni/apliteni-ui";
|
|
2783
2798
|
|
|
2784
2799
|
// src/fieldContext.ts
|
|
2785
|
-
import { createContext as
|
|
2786
|
-
var FieldContext =
|
|
2800
|
+
import { createContext as createContext3 } from "react";
|
|
2801
|
+
var FieldContext = createContext3(null);
|
|
2787
2802
|
|
|
2788
2803
|
// src/Dropdown.tsx
|
|
2789
2804
|
import { Fragment as Fragment13, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
@@ -2853,11 +2868,11 @@ function Dropdown({
|
|
|
2853
2868
|
onSelect,
|
|
2854
2869
|
row
|
|
2855
2870
|
}) {
|
|
2856
|
-
const [selfOpen, setSelfOpen] =
|
|
2871
|
+
const [selfOpen, setSelfOpen] = useState12(defaultOpen);
|
|
2857
2872
|
const open = openProp ?? selfOpen;
|
|
2858
|
-
const [pick, setPick] =
|
|
2859
|
-
const [query, setQuery] =
|
|
2860
|
-
const [activeKey, setActiveKey] =
|
|
2873
|
+
const [pick, setPick] = useState12(null);
|
|
2874
|
+
const [query, setQuery] = useState12(() => search && search !== true ? search.query || "" : "");
|
|
2875
|
+
const [activeKey, setActiveKey] = useState12(null);
|
|
2861
2876
|
const root = useRef15(null);
|
|
2862
2877
|
const panel = useRef15(null);
|
|
2863
2878
|
const trigger = useRef15(null);
|
|
@@ -2869,7 +2884,7 @@ function Dropdown({
|
|
|
2869
2884
|
const uid = id ?? auto;
|
|
2870
2885
|
const inField = useContext2(FieldContext);
|
|
2871
2886
|
const fieldName = inField && id === inField.id && !(ariaLabel && triggerContent != null) ? { id: `${uid}-trigger`, labelId: inField.labelId, labelledBy: `${inField.labelId} ${uid}-trigger` } : null;
|
|
2872
|
-
const setOpen =
|
|
2887
|
+
const setOpen = useCallback6((next) => {
|
|
2873
2888
|
if (openProp === void 0) setSelfOpen(next);
|
|
2874
2889
|
onOpenChange?.(next);
|
|
2875
2890
|
}, [openProp, onOpenChange]);
|
|
@@ -3490,7 +3505,7 @@ function Segmented({ options, value, onChange, label, appearance = "pill", size,
|
|
|
3490
3505
|
}
|
|
3491
3506
|
|
|
3492
3507
|
// src/FilterBar.tsx
|
|
3493
|
-
import { useRef as useRef16, useState as
|
|
3508
|
+
import { useRef as useRef16, useState as useState13 } from "react";
|
|
3494
3509
|
import { filterChipText, filterChipName, filterChipUnset, filterChipItems, focusNextStop } from "@apliteni/apliteni-ui";
|
|
3495
3510
|
import { Fragment as Fragment14, jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3496
3511
|
var SEARCH_AT = 10;
|
|
@@ -3499,8 +3514,8 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
3499
3514
|
const bar = useRef16(null);
|
|
3500
3515
|
const focused = useRef16(null);
|
|
3501
3516
|
const landing = useRef16(null);
|
|
3502
|
-
const [opened, setOpened] =
|
|
3503
|
-
const [adding, setAdding] =
|
|
3517
|
+
const [opened, setOpened] = useState13({});
|
|
3518
|
+
const [adding, setAdding] = useState13(false);
|
|
3504
3519
|
const blocked = disabled || busy;
|
|
3505
3520
|
const offer = (add || []).filter((entry) => !filters.some((filter) => filter.id === entry.id));
|
|
3506
3521
|
const source = /* @__PURE__ */ new Map();
|
|
@@ -3656,10 +3671,10 @@ function DrawerSection({ title, headingLevel = 3, className, children, ...rest }
|
|
|
3656
3671
|
}
|
|
3657
3672
|
|
|
3658
3673
|
// src/Snippet.tsx
|
|
3659
|
-
import { useEffect as useEffect13, useRef as useRef17, useState as
|
|
3674
|
+
import { useEffect as useEffect13, useRef as useRef17, useState as useState14 } from "react";
|
|
3660
3675
|
import { Fragment as Fragment15, jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3661
3676
|
function Snippet({ label = "shell", code = "", children, copy = true, reveal = false, copyLabel = "Copy code" }) {
|
|
3662
|
-
const [status, setStatus] =
|
|
3677
|
+
const [status, setStatus] = useState14("idle");
|
|
3663
3678
|
const request = useRef17(0);
|
|
3664
3679
|
const timer = useRef17(void 0);
|
|
3665
3680
|
useEffect13(() => {
|
|
@@ -3755,7 +3770,7 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3755
3770
|
}
|
|
3756
3771
|
|
|
3757
3772
|
// src/Field.tsx
|
|
3758
|
-
import { forwardRef as forwardRef8, useEffect as useEffect15, useId as useId12, useRef as useRef19, useState as
|
|
3773
|
+
import { forwardRef as forwardRef8, useEffect as useEffect15, useId as useId12, useRef as useRef19, useState as useState15 } from "react";
|
|
3759
3774
|
import { esc, icon as icon5 } from "@apliteni/apliteni-ui";
|
|
3760
3775
|
import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3761
3776
|
function messages(id, hint, error) {
|
|
@@ -3789,7 +3804,7 @@ function Field({ id: suppliedId, label, hint, error, required, children }) {
|
|
|
3789
3804
|
const labelId = `${id}-label`;
|
|
3790
3805
|
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 }) }) });
|
|
3791
3806
|
}
|
|
3792
|
-
var TextField = forwardRef8(function TextField2({ label, hint, error, required, type = "text", unit, icon:
|
|
3807
|
+
var TextField = forwardRef8(function TextField2({ label, hint, error, required, type = "text", unit, icon: glyph2, className = "", ...props }, ref) {
|
|
3793
3808
|
const id = useId12();
|
|
3794
3809
|
const hasUnit = type === "number" && !!unit;
|
|
3795
3810
|
const describedBy = [messages(id, hint, error), hasUnit ? `${id}-unit` : ""].filter(Boolean).join(" ") || void 0;
|
|
@@ -3807,8 +3822,8 @@ var TextField = forwardRef8(function TextField2({ label, hint, error, required,
|
|
|
3807
3822
|
}
|
|
3808
3823
|
);
|
|
3809
3824
|
const unitSpan = hasUnit ? /* @__PURE__ */ jsx34("span", { id: `${id}-unit`, className: "ui-field-number__unit", children: unit }) : null;
|
|
3810
|
-
return /* @__PURE__ */ jsx34(Frame, { ...{ id, label, hint, error, required }, children:
|
|
3811
|
-
/* @__PURE__ */ jsx34("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon5(
|
|
3825
|
+
return /* @__PURE__ */ jsx34(Frame, { ...{ id, label, hint, error, required }, children: glyph2 ? /* @__PURE__ */ jsxs30("div", { className: `ui-input-group${hasUnit ? " ui-field-number" : ""}`, children: [
|
|
3826
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon5(glyph2) } }),
|
|
3812
3827
|
control,
|
|
3813
3828
|
unitSpan
|
|
3814
3829
|
] }) : hasUnit ? /* @__PURE__ */ jsxs30("div", { className: "ui-field-number", children: [
|
|
@@ -3845,8 +3860,8 @@ function SelectField({ label, hint, error, required, className = "", children, .
|
|
|
3845
3860
|
function FileField({ label, hint, error, required, disabled, onFileChange, className = "", ...props }) {
|
|
3846
3861
|
const id = useId12();
|
|
3847
3862
|
const input = useRef19(null);
|
|
3848
|
-
const [file, setFile] =
|
|
3849
|
-
const [dragging, setDragging] =
|
|
3863
|
+
const [file, setFile] = useState15(null);
|
|
3864
|
+
const [dragging, setDragging] = useState15(false);
|
|
3850
3865
|
useEffect15(() => {
|
|
3851
3866
|
const form = input.current?.form;
|
|
3852
3867
|
const reset = () => {
|
|
@@ -3906,7 +3921,7 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3906
3921
|
}
|
|
3907
3922
|
|
|
3908
3923
|
// src/FileDrop.tsx
|
|
3909
|
-
import { useRef as useRef20, useState as
|
|
3924
|
+
import { useRef as useRef20, useState as useState16 } from "react";
|
|
3910
3925
|
|
|
3911
3926
|
// src/EmptyState.tsx
|
|
3912
3927
|
import { icon as kitIcon3, illo } from "@apliteni/apliteni-ui";
|
|
@@ -3921,9 +3936,9 @@ function EmptyState({ variant = "first-run", title, sub, icon: icon9, art, actio
|
|
|
3921
3936
|
const preset = cases[variant];
|
|
3922
3937
|
const heading = title ?? preset.title;
|
|
3923
3938
|
const guidance = sub ?? preset.sub;
|
|
3924
|
-
const
|
|
3939
|
+
const glyph2 = icon9 ?? preset.icon;
|
|
3925
3940
|
return /* @__PURE__ */ jsxs31("div", { className: "ui-empty", children: [
|
|
3926
|
-
art ? typeof art === "string" ? /* @__PURE__ */ jsx35("div", { className: "ui-empty__art", dangerouslySetInnerHTML: { __html: /<svg/.test(art) ? art : illo(art) } }) : /* @__PURE__ */ jsx35("div", { className: "ui-empty__art", "aria-hidden": "true", children: art }) :
|
|
3941
|
+
art ? typeof art === "string" ? /* @__PURE__ */ jsx35("div", { className: "ui-empty__art", dangerouslySetInnerHTML: { __html: /<svg/.test(art) ? art : illo(art) } }) : /* @__PURE__ */ jsx35("div", { className: "ui-empty__art", "aria-hidden": "true", children: art }) : glyph2 ? /* @__PURE__ */ jsx35("div", { className: "ui-empty__icon", dangerouslySetInnerHTML: { __html: kitIcon3(glyph2) } }) : null,
|
|
3927
3942
|
heading && /* @__PURE__ */ jsx35("div", { className: "ui-empty__title", children: heading }),
|
|
3928
3943
|
guidance && /* @__PURE__ */ jsx35("div", { className: "ui-empty__sub", children: guidance }),
|
|
3929
3944
|
actions && /* @__PURE__ */ jsx35("div", { className: "ui-empty__actions", children: actions })
|
|
@@ -3968,7 +3983,7 @@ function FileDrop({
|
|
|
3968
3983
|
className
|
|
3969
3984
|
}) {
|
|
3970
3985
|
const input = useRef20(null);
|
|
3971
|
-
const [over, setOver] =
|
|
3986
|
+
const [over, setOver] = useState16(false);
|
|
3972
3987
|
const status = file?.status ?? "uploading";
|
|
3973
3988
|
const word = status === "error" ? file?.error ?? WORDS.error : file?.state ?? WORDS[status];
|
|
3974
3989
|
const [stem, ext] = splitName(file?.name ?? "");
|
|
@@ -4139,7 +4154,7 @@ var SearchField = forwardRef9(function SearchField2({ ariaLabel, className, ...p
|
|
|
4139
4154
|
});
|
|
4140
4155
|
|
|
4141
4156
|
// src/Toast.tsx
|
|
4142
|
-
import { createContext as
|
|
4157
|
+
import { createContext as createContext4, useCallback as useCallback7, useContext as useContext3, useEffect as useEffect16, useLayoutEffect as useLayoutEffect4, useRef as useRef21, useState as useState17 } from "react";
|
|
4143
4158
|
import { createPortal as createPortal6 } from "react-dom";
|
|
4144
4159
|
|
|
4145
4160
|
// src/lib/toast-stack.ts
|
|
@@ -4250,8 +4265,8 @@ function watchToastPile(stack2) {
|
|
|
4250
4265
|
|
|
4251
4266
|
// src/Toast.tsx
|
|
4252
4267
|
import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4253
|
-
var Context =
|
|
4254
|
-
var PileHoldContext =
|
|
4268
|
+
var Context = createContext4(null);
|
|
4269
|
+
var PileHoldContext = createContext4(false);
|
|
4255
4270
|
var glyphs = { success: "circleCheck", danger: "circleX", warn: "circleAlert", info: "info", neutral: "bolt" };
|
|
4256
4271
|
function useToast() {
|
|
4257
4272
|
const push = useContext3(Context);
|
|
@@ -4260,17 +4275,17 @@ function useToast() {
|
|
|
4260
4275
|
}
|
|
4261
4276
|
function Notice({ notice, remove }) {
|
|
4262
4277
|
const root = useRef21(null);
|
|
4263
|
-
const [leaving2, setLeaving] =
|
|
4278
|
+
const [leaving2, setLeaving] = useState17(false);
|
|
4264
4279
|
const dismissed = useRef21(false);
|
|
4265
|
-
const [hovered, setHovered] =
|
|
4266
|
-
const [focused, setFocused] =
|
|
4280
|
+
const [hovered, setHovered] = useState17(false);
|
|
4281
|
+
const [focused, setFocused] = useState17(false);
|
|
4267
4282
|
const pileHeld = useContext3(PileHoldContext);
|
|
4268
4283
|
const paused = hovered || focused || pileHeld;
|
|
4269
4284
|
const tone2 = notice.tone ?? "success";
|
|
4270
4285
|
const timed = !notice.action && notice.timer !== false && notice.timer !== 0;
|
|
4271
4286
|
const duration = typeof notice.timer === "number" ? notice.timer * 1e3 : 5e3;
|
|
4272
4287
|
const remaining = useRef21(duration);
|
|
4273
|
-
const dismiss =
|
|
4288
|
+
const dismiss = useCallback7(() => {
|
|
4274
4289
|
if (dismissed.current) return;
|
|
4275
4290
|
dismissed.current = true;
|
|
4276
4291
|
if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches) remove();
|
|
@@ -4378,12 +4393,12 @@ function usePile(stack2, piled, count) {
|
|
|
4378
4393
|
}, [stack2, piled, count]);
|
|
4379
4394
|
}
|
|
4380
4395
|
function Toast({ children, collapse = false }) {
|
|
4381
|
-
const [entries, setEntries] =
|
|
4382
|
-
const [pileHovered, setPileHovered] =
|
|
4383
|
-
const [pileFocused, setPileFocused] =
|
|
4396
|
+
const [entries, setEntries] = useState17([]);
|
|
4397
|
+
const [pileHovered, setPileHovered] = useState17(false);
|
|
4398
|
+
const [pileFocused, setPileFocused] = useState17(false);
|
|
4384
4399
|
const nextId = useRef21(0);
|
|
4385
4400
|
const stack2 = useRef21(null);
|
|
4386
|
-
const push =
|
|
4401
|
+
const push = useCallback7((notice) => {
|
|
4387
4402
|
const id = nextId.current++;
|
|
4388
4403
|
const remove = () => setEntries((current) => current.filter((entry) => entry.id !== id));
|
|
4389
4404
|
setEntries((current) => [...current, { id, notice, remove }]);
|
|
@@ -4419,8 +4434,8 @@ function Toast({ children, collapse = false }) {
|
|
|
4419
4434
|
}
|
|
4420
4435
|
|
|
4421
4436
|
// src/AppShell.tsx
|
|
4422
|
-
import { useEffect as
|
|
4423
|
-
import { prism
|
|
4437
|
+
import { useEffect as useEffect18, useId as useId13, useMemo as useMemo5, useRef as useRef23, useState as useState19 } from "react";
|
|
4438
|
+
import { prism } from "@apliteni/apliteni-ui";
|
|
4424
4439
|
|
|
4425
4440
|
// src/lib/palette-hotkey.ts
|
|
4426
4441
|
function paletteHotkey(platform = typeof navigator === "undefined" ? "" : navigator.platform) {
|
|
@@ -4448,48 +4463,15 @@ function storeRailCollapsed(collapsed) {
|
|
|
4448
4463
|
}
|
|
4449
4464
|
}
|
|
4450
4465
|
|
|
4451
|
-
// src/
|
|
4452
|
-
import {
|
|
4453
|
-
import {
|
|
4454
|
-
import {
|
|
4455
|
-
var Breadcrumbs = forwardRef10(function Breadcrumbs2({
|
|
4456
|
-
items,
|
|
4457
|
-
renderLink,
|
|
4458
|
-
className,
|
|
4459
|
-
"aria-label": ariaLabel = "Breadcrumb",
|
|
4460
|
-
...rest
|
|
4461
|
-
}, ref) {
|
|
4462
|
-
return /* @__PURE__ */ jsx39(
|
|
4463
|
-
"nav",
|
|
4464
|
-
{
|
|
4465
|
-
...rest,
|
|
4466
|
-
ref,
|
|
4467
|
-
className: ["ui-nav", "ui-nav--crumbs", className].filter(Boolean).join(" "),
|
|
4468
|
-
"aria-label": ariaLabel,
|
|
4469
|
-
children: /* @__PURE__ */ jsx39("ol", { className: "ui-nav__crumbs", children: items.map((item, index) => {
|
|
4470
|
-
const current = index === items.length - 1;
|
|
4471
|
-
const inner = /* @__PURE__ */ jsxs35(Fragment17, { children: [
|
|
4472
|
-
item.icon && /* @__PURE__ */ jsx39("span", { className: "ui-nav__ic", dangerouslySetInnerHTML: { __html: icon7(item.icon) } }),
|
|
4473
|
-
/* @__PURE__ */ jsx39("span", { className: "ui-nav__crumb-label", children: item.label })
|
|
4474
|
-
] });
|
|
4475
|
-
const linkProps = !current && item.href ? { className: "ui-nav__crumb", href: safeUrl3(item.href), target: item.target, children: inner } : null;
|
|
4476
|
-
return /* @__PURE__ */ jsx39("li", { className: "ui-nav__crumb-item", children: linkProps ? renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx39("a", { ...linkProps }) : /* @__PURE__ */ jsx39(
|
|
4477
|
-
"span",
|
|
4478
|
-
{
|
|
4479
|
-
className: ["ui-nav__crumb", current && "is-current"].filter(Boolean).join(" "),
|
|
4480
|
-
"aria-current": current ? "page" : void 0,
|
|
4481
|
-
children: inner
|
|
4482
|
-
}
|
|
4483
|
-
) }, index);
|
|
4484
|
-
}) })
|
|
4485
|
-
}
|
|
4486
|
-
);
|
|
4487
|
-
});
|
|
4466
|
+
// src/AccountMenu.tsx
|
|
4467
|
+
import { useEffect as useEffect17, useRef as useRef22, useState as useState18 } from "react";
|
|
4468
|
+
import { createPortal as createPortal7 } from "react-dom";
|
|
4469
|
+
import { icon as icon7, themeIcon as themeIcon2, transitionMs as transitionMs3 } from "@apliteni/apliteni-ui";
|
|
4488
4470
|
|
|
4489
4471
|
// src/ThemeToggle.tsx
|
|
4490
4472
|
import { useSyncExternalStore } from "react";
|
|
4491
4473
|
import { themeIcon } from "@apliteni/apliteni-ui";
|
|
4492
|
-
import { jsx as
|
|
4474
|
+
import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4493
4475
|
var STORAGE_KEY = "apliteni-strategy-theme";
|
|
4494
4476
|
var CHOICE_EVENT = "apliteni-theme-choice";
|
|
4495
4477
|
var THEME_INIT_SCRIPT = `(()=>{let t;try{t=localStorage.getItem('apliteni-strategy-theme')}catch{}document.documentElement.setAttribute('data-theme',t==='dark'||t==='light'?t:window.matchMedia?.('(prefers-color-scheme: light)').matches?'light':'dark')})()`;
|
|
@@ -4538,29 +4520,203 @@ function useThemeChoice() {
|
|
|
4538
4520
|
const next = theme === "dark" ? "light" : theme === "light" ? "auto" : "dark";
|
|
4539
4521
|
const label = theme === "auto" ? "Auto" : theme === "light" ? "Light" : "Dark";
|
|
4540
4522
|
const name = `Theme: ${label}. Switch to ${next}.`;
|
|
4541
|
-
const
|
|
4542
|
-
document.documentElement.setAttribute("data-theme-choice",
|
|
4543
|
-
document.documentElement.setAttribute("data-theme",
|
|
4523
|
+
const set = (choice) => {
|
|
4524
|
+
document.documentElement.setAttribute("data-theme-choice", choice);
|
|
4525
|
+
document.documentElement.setAttribute("data-theme", choice === "auto" ? window.matchMedia?.("(prefers-color-scheme: light)").matches ? "light" : "dark" : choice);
|
|
4544
4526
|
try {
|
|
4545
|
-
localStorage.setItem(STORAGE_KEY,
|
|
4527
|
+
localStorage.setItem(STORAGE_KEY, choice);
|
|
4546
4528
|
} catch {
|
|
4547
4529
|
}
|
|
4548
4530
|
window.dispatchEvent(new Event(CHOICE_EVENT));
|
|
4549
4531
|
};
|
|
4550
|
-
|
|
4532
|
+
const toggle = () => set(next);
|
|
4533
|
+
return { theme, next, label, name, toggle, set };
|
|
4551
4534
|
}
|
|
4552
4535
|
function ThemeToggle({ labelled = false }) {
|
|
4553
4536
|
const { theme, label, name, toggle } = useThemeChoice();
|
|
4554
|
-
const button = /* @__PURE__ */
|
|
4555
|
-
return labelled ? /* @__PURE__ */
|
|
4537
|
+
const button = /* @__PURE__ */ jsx39("button", { type: "button", className: "toggle", "aria-label": name, title: name, onClick: toggle, children: /* @__PURE__ */ jsx39("span", { className: "ic", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: themeIcon(theme) } }) });
|
|
4538
|
+
return labelled ? /* @__PURE__ */ jsxs35("span", { className: "ui-theme-toggle", children: [
|
|
4556
4539
|
button,
|
|
4557
|
-
/* @__PURE__ */
|
|
4540
|
+
/* @__PURE__ */ jsxs35("span", { children: [
|
|
4558
4541
|
label,
|
|
4559
4542
|
" theme"
|
|
4560
4543
|
] })
|
|
4561
4544
|
] }) : button;
|
|
4562
4545
|
}
|
|
4563
4546
|
|
|
4547
|
+
// src/AccountMenu.tsx
|
|
4548
|
+
import { Fragment as Fragment17, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4549
|
+
var THEMES = [["auto", "Auto"], ["light", "Light"], ["dark", "Dark"]];
|
|
4550
|
+
var glyph = (svg, className) => /* @__PURE__ */ jsx40("span", { className, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: svg } });
|
|
4551
|
+
function AccountMenu({ account, items, onSelect, withTheme, inPlace, away }) {
|
|
4552
|
+
const theme = useThemeChoice();
|
|
4553
|
+
const [open, setOpen] = useState18(false);
|
|
4554
|
+
const [sub, setSub] = useState18(false);
|
|
4555
|
+
const block = useRef22(null);
|
|
4556
|
+
const themeRow = useRef22(null);
|
|
4557
|
+
const list = useRef22(null);
|
|
4558
|
+
const flyout = useRef22(null);
|
|
4559
|
+
const refocus = useRef22(false);
|
|
4560
|
+
const close = () => {
|
|
4561
|
+
refocus.current = true;
|
|
4562
|
+
setSub(false);
|
|
4563
|
+
};
|
|
4564
|
+
useIsoLayoutEffect(() => {
|
|
4565
|
+
if (!sub || inPlace) return;
|
|
4566
|
+
const place = () => {
|
|
4567
|
+
const row = themeRow.current;
|
|
4568
|
+
const fly = flyout.current;
|
|
4569
|
+
const panel2 = row?.closest(".ui-dropdown__panel");
|
|
4570
|
+
if (!row || !fly || !panel2) return;
|
|
4571
|
+
const right = panel2.getBoundingClientRect().right;
|
|
4572
|
+
const style = getComputedStyle(fly);
|
|
4573
|
+
const pad2 = parseFloat(style.paddingTop) + parseFloat(style.borderTopWidth);
|
|
4574
|
+
const top = Math.min(row.getBoundingClientRect().top - pad2, window.innerHeight - fly.offsetHeight - parseFloat(style.paddingTop));
|
|
4575
|
+
fly.style.left = `${right + parseFloat(style.paddingLeft)}px`;
|
|
4576
|
+
fly.style.top = `${Math.max(0, top)}px`;
|
|
4577
|
+
};
|
|
4578
|
+
const panel = themeRow.current?.closest(".ui-dropdown__panel");
|
|
4579
|
+
place();
|
|
4580
|
+
window.addEventListener("resize", place);
|
|
4581
|
+
panel?.addEventListener("transitionend", place);
|
|
4582
|
+
const landed = panel ? setTimeout(place, transitionMs3(panel)) : void 0;
|
|
4583
|
+
return () => {
|
|
4584
|
+
window.removeEventListener("resize", place);
|
|
4585
|
+
panel?.removeEventListener("transitionend", place);
|
|
4586
|
+
clearTimeout(landed);
|
|
4587
|
+
};
|
|
4588
|
+
}, [sub, inPlace]);
|
|
4589
|
+
useEffect17(() => {
|
|
4590
|
+
if (!open || !away) return;
|
|
4591
|
+
const gone = () => {
|
|
4592
|
+
if (block.current?.getClientRects().length) return;
|
|
4593
|
+
const el = document.activeElement;
|
|
4594
|
+
const held = !el || el === document.body || block.current?.contains(el) || flyout.current?.contains(el);
|
|
4595
|
+
setSub(false);
|
|
4596
|
+
setOpen(false);
|
|
4597
|
+
if (held) away.current?.focus();
|
|
4598
|
+
};
|
|
4599
|
+
window.addEventListener("resize", gone);
|
|
4600
|
+
return () => window.removeEventListener("resize", gone);
|
|
4601
|
+
}, [open, away]);
|
|
4602
|
+
useEffect17(() => {
|
|
4603
|
+
if (sub) list.current?.querySelector('[role="menuitemradio"]')?.focus();
|
|
4604
|
+
else if (refocus.current) {
|
|
4605
|
+
refocus.current = false;
|
|
4606
|
+
themeRow.current?.focus();
|
|
4607
|
+
}
|
|
4608
|
+
}, [sub]);
|
|
4609
|
+
const subKeys = (e) => {
|
|
4610
|
+
const rows = [...e.currentTarget.querySelectorAll(".ui-dropdown__item")];
|
|
4611
|
+
const i = rows.indexOf(document.activeElement);
|
|
4612
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") rows[(i + (e.key === "ArrowDown" ? 1 : rows.length - 1)) % rows.length]?.focus();
|
|
4613
|
+
else if (e.key === "Home" || e.key === "End") rows[e.key === "Home" ? 0 : rows.length - 1]?.focus();
|
|
4614
|
+
else if (e.key === "Enter" || e.key === " ") rows[i]?.click();
|
|
4615
|
+
else if (e.key === "ArrowLeft" || e.key === "Escape") close();
|
|
4616
|
+
else {
|
|
4617
|
+
if (e.key === "Tab" && !inPlace) themeRow.current?.focus();
|
|
4618
|
+
return;
|
|
4619
|
+
}
|
|
4620
|
+
e.preventDefault();
|
|
4621
|
+
e.stopPropagation();
|
|
4622
|
+
};
|
|
4623
|
+
const choices = /* @__PURE__ */ jsxs36(
|
|
4624
|
+
"div",
|
|
4625
|
+
{
|
|
4626
|
+
ref: list,
|
|
4627
|
+
role: "menu",
|
|
4628
|
+
"aria-label": "Theme",
|
|
4629
|
+
className: "ui-dropdown__sub",
|
|
4630
|
+
onKeyDown: subKeys,
|
|
4631
|
+
onClick: (e) => e.stopPropagation(),
|
|
4632
|
+
children: [
|
|
4633
|
+
inPlace && /* @__PURE__ */ jsxs36("div", { role: "menuitem", tabIndex: -1, className: "ui-dropdown__item", "aria-label": "Back from Theme", onClick: close, children: [
|
|
4634
|
+
glyph(icon7("chevronLeft"), "ui-dropdown__ic"),
|
|
4635
|
+
/* @__PURE__ */ jsx40("span", { className: "ui-dropdown__main", children: /* @__PURE__ */ jsx40("span", { className: "ui-dropdown__label", children: "Theme" }) })
|
|
4636
|
+
] }),
|
|
4637
|
+
THEMES.map(([value, label]) => /* @__PURE__ */ jsxs36(
|
|
4638
|
+
"div",
|
|
4639
|
+
{
|
|
4640
|
+
role: "menuitemradio",
|
|
4641
|
+
"aria-checked": theme.theme === value,
|
|
4642
|
+
tabIndex: -1,
|
|
4643
|
+
className: `ui-dropdown__item${theme.theme === value ? " is-selected" : ""}`,
|
|
4644
|
+
onClick: () => {
|
|
4645
|
+
theme.set(value);
|
|
4646
|
+
close();
|
|
4647
|
+
},
|
|
4648
|
+
children: [
|
|
4649
|
+
glyph(themeIcon2(value), "ui-dropdown__ic"),
|
|
4650
|
+
/* @__PURE__ */ jsx40("span", { className: "ui-dropdown__main", children: /* @__PURE__ */ jsx40("span", { className: "ui-dropdown__label", children: label }) }),
|
|
4651
|
+
glyph(icon7("check"), "ui-dropdown__tick")
|
|
4652
|
+
]
|
|
4653
|
+
},
|
|
4654
|
+
value
|
|
4655
|
+
))
|
|
4656
|
+
]
|
|
4657
|
+
}
|
|
4658
|
+
);
|
|
4659
|
+
return /* @__PURE__ */ jsx40("div", { ref: block, className: "ui-app__user", children: /* @__PURE__ */ jsx40(
|
|
4660
|
+
Dropdown,
|
|
4661
|
+
{
|
|
4662
|
+
variant: "menu",
|
|
4663
|
+
direction: "up",
|
|
4664
|
+
align: "start",
|
|
4665
|
+
chevron: true,
|
|
4666
|
+
open,
|
|
4667
|
+
ariaLabel: `Signed in as ${account.name}, ${account.email}`,
|
|
4668
|
+
triggerClass: "ui-app__user-trigger",
|
|
4669
|
+
panelClass: `ui-app__user-panel${sub && inPlace ? " is-sub" : ""}`,
|
|
4670
|
+
onOpenChange: (next) => {
|
|
4671
|
+
setOpen(next);
|
|
4672
|
+
if (!next) setSub(false);
|
|
4673
|
+
},
|
|
4674
|
+
triggerContent: /* @__PURE__ */ jsxs36(Fragment17, { children: [
|
|
4675
|
+
/* @__PURE__ */ jsx40("span", { className: "ui-app__av", "aria-hidden": "true", children: /* @__PURE__ */ jsx40(Avatar, { personKey: account.email || account.name, name: account.name, size: 32 }) }),
|
|
4676
|
+
/* @__PURE__ */ jsxs36("span", { className: "ui-app__who", children: [
|
|
4677
|
+
/* @__PURE__ */ jsx40("b", { children: account.name }),
|
|
4678
|
+
/* @__PURE__ */ jsx40("span", { children: account.email })
|
|
4679
|
+
] })
|
|
4680
|
+
] }),
|
|
4681
|
+
items: [...items, ...withTheme ? [{ label: "Theme", value: "theme" }, "---"] : [], { label: "Sign out", value: "sign-out", icon: "logout", danger: true }],
|
|
4682
|
+
row: (item, props) => item.value === "theme" ? /* @__PURE__ */ jsxs36(Fragment17, { children: [
|
|
4683
|
+
/* @__PURE__ */ jsxs36(
|
|
4684
|
+
"div",
|
|
4685
|
+
{
|
|
4686
|
+
...props,
|
|
4687
|
+
ref: themeRow,
|
|
4688
|
+
"aria-haspopup": "menu",
|
|
4689
|
+
"aria-expanded": sub,
|
|
4690
|
+
onClick: () => setSub((open2) => !open2),
|
|
4691
|
+
onKeyDown: (e) => {
|
|
4692
|
+
if (e.key === "ArrowRight") {
|
|
4693
|
+
e.preventDefault();
|
|
4694
|
+
e.stopPropagation();
|
|
4695
|
+
setSub(true);
|
|
4696
|
+
}
|
|
4697
|
+
},
|
|
4698
|
+
children: [
|
|
4699
|
+
glyph(themeIcon2(theme.theme), "ui-dropdown__ic"),
|
|
4700
|
+
/* @__PURE__ */ jsx40("span", { className: "ui-dropdown__main", children: /* @__PURE__ */ jsx40("span", { className: "ui-dropdown__label", children: "Theme" }) }),
|
|
4701
|
+
/* @__PURE__ */ jsx40("span", { className: "ui-dropdown__aside", children: theme.label }),
|
|
4702
|
+
glyph(icon7("chevronRight"), "ui-dropdown__more")
|
|
4703
|
+
]
|
|
4704
|
+
}
|
|
4705
|
+
),
|
|
4706
|
+
sub && (inPlace ? choices : createPortal7(/* @__PURE__ */ jsx40(
|
|
4707
|
+
"div",
|
|
4708
|
+
{
|
|
4709
|
+
ref: flyout,
|
|
4710
|
+
className: "ui-dropdown__panel ui-dropdown__panel--portal ui-dropdown__panel--sub is-open",
|
|
4711
|
+
children: choices
|
|
4712
|
+
}
|
|
4713
|
+
), document.body))
|
|
4714
|
+
] }) : props.href ? /* @__PURE__ */ jsx40("a", { ...props }) : /* @__PURE__ */ jsx40("div", { ...props }),
|
|
4715
|
+
onSelect
|
|
4716
|
+
}
|
|
4717
|
+
) });
|
|
4718
|
+
}
|
|
4719
|
+
|
|
4564
4720
|
// src/AppShell.tsx
|
|
4565
4721
|
import { Fragment as Fragment18, jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4566
4722
|
var path = (value) => value.split(/[?#]/)[0].replace(/\/+$/, "") || "/";
|
|
@@ -4575,12 +4731,13 @@ function AppShell({
|
|
|
4575
4731
|
brandHref = "/",
|
|
4576
4732
|
width = "centered",
|
|
4577
4733
|
back,
|
|
4578
|
-
crumbs,
|
|
4579
4734
|
lede,
|
|
4580
4735
|
actions,
|
|
4736
|
+
tools,
|
|
4581
4737
|
bandControl,
|
|
4582
4738
|
headControl,
|
|
4583
4739
|
account,
|
|
4740
|
+
accountItems = [],
|
|
4584
4741
|
onSignOut,
|
|
4585
4742
|
searchLabel = "Search or run a command\u2026",
|
|
4586
4743
|
defaultCollapsed = false,
|
|
@@ -4588,25 +4745,24 @@ function AppShell({
|
|
|
4588
4745
|
renderLink
|
|
4589
4746
|
}) {
|
|
4590
4747
|
const uid = useId13();
|
|
4591
|
-
const
|
|
4592
|
-
const [
|
|
4593
|
-
const [
|
|
4594
|
-
const
|
|
4595
|
-
const
|
|
4596
|
-
const
|
|
4597
|
-
const firstRow = useMemo4(() => ({ get current() {
|
|
4748
|
+
const [collapsed, setCollapsed] = useState19(defaultCollapsed);
|
|
4749
|
+
const [search, setSearch] = useState19(false);
|
|
4750
|
+
const [menu, setMenu] = useState19(false);
|
|
4751
|
+
const menuButton = useRef23(null);
|
|
4752
|
+
const menuBody = useRef23(null);
|
|
4753
|
+
const firstRow = useMemo5(() => ({ get current() {
|
|
4598
4754
|
return menuBody.current?.querySelector(".ui-nav__item") ?? null;
|
|
4599
4755
|
} }), []);
|
|
4600
4756
|
const current = path(pathname);
|
|
4601
4757
|
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];
|
|
4602
|
-
|
|
4758
|
+
useEffect18(() => {
|
|
4603
4759
|
setCollapsed(railCollapsed() ?? defaultCollapsed);
|
|
4604
4760
|
}, [defaultCollapsed]);
|
|
4605
|
-
|
|
4761
|
+
useEffect18(() => {
|
|
4606
4762
|
setMenu(false);
|
|
4607
4763
|
setSearch(false);
|
|
4608
4764
|
}, [pathname]);
|
|
4609
|
-
|
|
4765
|
+
useEffect18(() => {
|
|
4610
4766
|
if (!menu) return;
|
|
4611
4767
|
const grown = () => {
|
|
4612
4768
|
const button = menuButton.current;
|
|
@@ -4615,7 +4771,7 @@ function AppShell({
|
|
|
4615
4771
|
window.addEventListener("resize", grown);
|
|
4616
4772
|
return () => window.removeEventListener("resize", grown);
|
|
4617
4773
|
}, [menu]);
|
|
4618
|
-
|
|
4774
|
+
useEffect18(() => {
|
|
4619
4775
|
if (layout === "rail") return;
|
|
4620
4776
|
const hotkey = (event) => {
|
|
4621
4777
|
if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey || event.key.toLowerCase() !== "k") return;
|
|
@@ -4654,41 +4810,22 @@ function AppShell({
|
|
|
4654
4810
|
brand ?? /* @__PURE__ */ jsx41("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(uid, 24) } }),
|
|
4655
4811
|
/* @__PURE__ */ jsx41("span", { children: word })
|
|
4656
4812
|
] });
|
|
4657
|
-
const
|
|
4658
|
-
|
|
4813
|
+
const ownItems = accountItems.map(({ label, icon: icon9, href }, i) => ({ label, icon: icon9, href, value: `item-${i}` }));
|
|
4814
|
+
const pick = (value) => {
|
|
4815
|
+
if (value === "sign-out") onSignOut();
|
|
4816
|
+
else accountItems[Number(String(value).slice(5))]?.onSelect?.();
|
|
4817
|
+
};
|
|
4818
|
+
const accountBlock = (withTheme = false, inPlace = false) => /* @__PURE__ */ jsx41(
|
|
4819
|
+
AccountMenu,
|
|
4659
4820
|
{
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
panelClass: "ui-app__user-panel",
|
|
4667
|
-
triggerContent: /* @__PURE__ */ jsxs37(Fragment18, { children: [
|
|
4668
|
-
/* @__PURE__ */ jsx41("span", { className: "ui-app__av", "aria-hidden": "true", children: /* @__PURE__ */ jsx41(Avatar, { personKey: account.email || account.name, name: account.name, size: 32 }) }),
|
|
4669
|
-
/* @__PURE__ */ jsxs37("span", { className: "ui-app__who", children: [
|
|
4670
|
-
/* @__PURE__ */ jsx41("b", { children: account.name }),
|
|
4671
|
-
/* @__PURE__ */ jsx41("span", { children: account.email })
|
|
4672
|
-
] })
|
|
4673
|
-
] }),
|
|
4674
|
-
items: [...withTheme ? [{ label: `${theme.label} theme`, value: "theme" }] : [], { label: "Sign out", value: "sign-out", icon: "logout", danger: true }],
|
|
4675
|
-
row: (item, props) => item.value === "theme" ? /* @__PURE__ */ jsxs37(
|
|
4676
|
-
"div",
|
|
4677
|
-
{
|
|
4678
|
-
...props,
|
|
4679
|
-
"aria-label": `${item.label}. Switch to ${theme.next}.`,
|
|
4680
|
-
onClick: theme.toggle,
|
|
4681
|
-
children: [
|
|
4682
|
-
/* @__PURE__ */ jsx41("span", { className: "ui-dropdown__ic", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: themeIcon2(theme.theme) } }),
|
|
4683
|
-
/* @__PURE__ */ jsx41("span", { className: "ui-dropdown__main", children: /* @__PURE__ */ jsx41("span", { className: "ui-dropdown__label", children: item.label }) })
|
|
4684
|
-
]
|
|
4685
|
-
}
|
|
4686
|
-
) : /* @__PURE__ */ jsx41("div", { ...props }),
|
|
4687
|
-
onSelect: (value) => {
|
|
4688
|
-
if (value === "sign-out") onSignOut();
|
|
4689
|
-
}
|
|
4821
|
+
account,
|
|
4822
|
+
items: ownItems,
|
|
4823
|
+
onSelect: pick,
|
|
4824
|
+
withTheme,
|
|
4825
|
+
inPlace,
|
|
4826
|
+
away: menuButton
|
|
4690
4827
|
}
|
|
4691
|
-
)
|
|
4828
|
+
);
|
|
4692
4829
|
const headSlot = layout === "topbar" && headControl && /* @__PURE__ */ jsx41("div", { className: "ui-react-app__head-control", children: headControl });
|
|
4693
4830
|
const foldControl = /* @__PURE__ */ jsxs37("div", { className: "ui-app__fold-row", children: [
|
|
4694
4831
|
headSlot,
|
|
@@ -4712,8 +4849,11 @@ function AppShell({
|
|
|
4712
4849
|
)
|
|
4713
4850
|
] });
|
|
4714
4851
|
const page = /* @__PURE__ */ jsxs37("main", { className: `ui-app__main${width === "wide" ? " ui-app__main--wide" : ""}`, children: [
|
|
4715
|
-
back
|
|
4716
|
-
/* @__PURE__ */
|
|
4852
|
+
back && /* @__PURE__ */ jsx41(BackLink, { ...back }),
|
|
4853
|
+
tools ? /* @__PURE__ */ jsxs37("div", { className: "ui-app__title-row", children: [
|
|
4854
|
+
/* @__PURE__ */ jsx41("h1", { children: title }),
|
|
4855
|
+
/* @__PURE__ */ jsx41("div", { className: "ui-app__tools", children: tools })
|
|
4856
|
+
] }) : /* @__PURE__ */ jsx41("h1", { children: title }),
|
|
4717
4857
|
lede && /* @__PURE__ */ jsx41("p", { className: "ui-app__sub", children: lede }),
|
|
4718
4858
|
actions && /* @__PURE__ */ jsx41("div", { className: "ui-react-app__actions", children: actions }),
|
|
4719
4859
|
/* @__PURE__ */ jsx41("div", { className: "ui-app__body", children })
|
|
@@ -4812,8 +4952,8 @@ function AppShell({
|
|
|
4812
4952
|
/* @__PURE__ */ jsx41("b", { children: account.name }),
|
|
4813
4953
|
/* @__PURE__ */ jsx41("span", { children: account.email })
|
|
4814
4954
|
] }),
|
|
4815
|
-
items: [{ label: "Sign out", icon: "logout", danger: true }],
|
|
4816
|
-
onSelect:
|
|
4955
|
+
items: [...ownItems, { label: "Sign out", value: "sign-out", icon: "logout", danger: true }],
|
|
4956
|
+
onSelect: pick
|
|
4817
4957
|
}
|
|
4818
4958
|
) })
|
|
4819
4959
|
] })
|
|
@@ -4830,7 +4970,7 @@ function AppShell({
|
|
|
4830
4970
|
size: "sm",
|
|
4831
4971
|
initialFocusRef: firstRow,
|
|
4832
4972
|
headerActions: headSlot,
|
|
4833
|
-
footer: /* @__PURE__ */ jsx41("div", { className: "ui-app__drawer", children: accountBlock(true) }),
|
|
4973
|
+
footer: /* @__PURE__ */ jsx41("div", { className: "ui-app__drawer", children: accountBlock(true, true) }),
|
|
4834
4974
|
children: /* @__PURE__ */ jsxs37("div", { className: "ui-react-app__menu", ref: menuBody, children: [
|
|
4835
4975
|
bandControl && /* @__PURE__ */ jsx41("div", { className: "ui-react-app__control", children: bandControl }),
|
|
4836
4976
|
sidebar("Menu sections")
|
|
@@ -4842,9 +4982,9 @@ function AppShell({
|
|
|
4842
4982
|
}
|
|
4843
4983
|
|
|
4844
4984
|
// src/AuthShell.tsx
|
|
4845
|
-
import { forwardRef as
|
|
4985
|
+
import { forwardRef as forwardRef10 } from "react";
|
|
4846
4986
|
import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4847
|
-
var AuthShell =
|
|
4987
|
+
var AuthShell = forwardRef10(function AuthShell2({ brand, children, className, ...rest }, ref) {
|
|
4848
4988
|
return /* @__PURE__ */ jsx42("div", { ...rest, ref, className: ["ui-auth", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs38("div", { className: "ui-auth__card", children: [
|
|
4849
4989
|
/* @__PURE__ */ jsx42("div", { className: "ui-auth__brand", children: brand }),
|
|
4850
4990
|
children
|
|
@@ -4853,7 +4993,7 @@ var AuthShell = forwardRef11(function AuthShell2({ brand, children, className, .
|
|
|
4853
4993
|
|
|
4854
4994
|
// src/Footer.tsx
|
|
4855
4995
|
import { useId as useId14 } from "react";
|
|
4856
|
-
import { prism as prism2, safeUrl as
|
|
4996
|
+
import { prism as prism2, safeUrl as safeUrl3 } from "@apliteni/apliteni-ui";
|
|
4857
4997
|
import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
4858
4998
|
var SOCIAL_GLYPHS = {
|
|
4859
4999
|
github: '<path d="M12 2a10 10 0 0 0-3.16 19.49c.5.09.68-.22.68-.48v-1.7c-2.78.6-3.37-1.34-3.37-1.34-.45-1.16-1.11-1.47-1.11-1.47-.9-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.9 1.53 2.34 1.09 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.94 0-1.09.39-1.98 1.03-2.68-.1-.25-.45-1.27.1-2.64 0 0 .84-.27 2.75 1.02a9.5 9.5 0 0 1 5 0c1.91-1.29 2.75-1.02 2.75-1.02.55 1.37.2 2.39.1 2.64.64.7 1.03 1.59 1.03 2.68 0 3.84-2.34 4.68-4.57 4.93.36.31.68.92.68 1.85v2.74c0 .27.18.58.69.48A10 10 0 0 0 12 2z"/>',
|
|
@@ -4865,7 +5005,7 @@ var escapeText = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/
|
|
|
4865
5005
|
function Legal({ legal, legalLinks, switcher }) {
|
|
4866
5006
|
return /* @__PURE__ */ jsxs39("div", { className: "ui-footer__bar", children: [
|
|
4867
5007
|
/* @__PURE__ */ jsx43("span", { className: "ui-footer__legal", children: legal }),
|
|
4868
|
-
legalLinks && legalLinks.length > 0 && /* @__PURE__ */ jsx43("nav", { className: "ui-footer__legal-links", "aria-label": "Legal", children: legalLinks.map(({ label, href: to }) => /* @__PURE__ */ jsx43("a", { href:
|
|
5008
|
+
legalLinks && legalLinks.length > 0 && /* @__PURE__ */ jsx43("nav", { className: "ui-footer__legal-links", "aria-label": "Legal", children: legalLinks.map(({ label, href: to }) => /* @__PURE__ */ jsx43("a", { href: safeUrl3(to ?? "#"), children: label }, label)) }),
|
|
4869
5009
|
switcher ? /* @__PURE__ */ jsx43("div", { className: "ui-footer__switcher", children: switcher }) : null
|
|
4870
5010
|
] });
|
|
4871
5011
|
}
|
|
@@ -4895,7 +5035,7 @@ function Footer({
|
|
|
4895
5035
|
"a",
|
|
4896
5036
|
{
|
|
4897
5037
|
className: "brand",
|
|
4898
|
-
href:
|
|
5038
|
+
href: safeUrl3(brandHref),
|
|
4899
5039
|
"aria-label": `Apliteni ${word}`,
|
|
4900
5040
|
dangerouslySetInnerHTML: { __html: `${mark}<span>${escapeText(word)}</span>` }
|
|
4901
5041
|
}
|
|
@@ -4909,12 +5049,12 @@ function Footer({
|
|
|
4909
5049
|
const markup = SOCIAL_GLYPHS[icon9];
|
|
4910
5050
|
const fill = icon9 === "mail" ? "none" : "currentColor";
|
|
4911
5051
|
const viewBox = icon9 === "linkedin" ? "0 0 448 512" : "0 0 24 24";
|
|
4912
|
-
return /* @__PURE__ */ jsx43("a", { className: "ui-footer__social", href:
|
|
5052
|
+
return /* @__PURE__ */ jsx43("a", { className: "ui-footer__social", href: safeUrl3(to ?? "#"), "aria-label": label, children: /* @__PURE__ */ jsx43("svg", { viewBox, fill, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: markup } }) }, label);
|
|
4913
5053
|
}) })
|
|
4914
5054
|
] }),
|
|
4915
5055
|
(links || columns.length > 0) && /* @__PURE__ */ jsx43("nav", { className: "ui-footer__nav", "aria-label": "Footer", children: links ?? columns.map(({ title, links: columnLinks }, i) => /* @__PURE__ */ jsxs39("div", { className: "ui-footer__col", children: [
|
|
4916
5056
|
title && /* @__PURE__ */ jsx43("h2", { className: "ui-footer__col-title", children: title }),
|
|
4917
|
-
/* @__PURE__ */ jsx43("ul", { className: "ui-footer__links", children: columnLinks.map(({ label, href: to, target }) => /* @__PURE__ */ jsx43("li", { children: /* @__PURE__ */ jsx43("a", { href:
|
|
5057
|
+
/* @__PURE__ */ jsx43("ul", { className: "ui-footer__links", children: columnLinks.map(({ label, href: to, target }) => /* @__PURE__ */ jsx43("li", { children: /* @__PURE__ */ jsx43("a", { href: safeUrl3(to ?? "#"), target, rel: target ? "noreferrer" : void 0, children: label }) }, label)) })
|
|
4918
5058
|
] }, title ?? i)) })
|
|
4919
5059
|
] }),
|
|
4920
5060
|
bar
|
|
@@ -4922,9 +5062,9 @@ function Footer({
|
|
|
4922
5062
|
}
|
|
4923
5063
|
|
|
4924
5064
|
// src/Success.tsx
|
|
4925
|
-
import { forwardRef as
|
|
5065
|
+
import { forwardRef as forwardRef11, useEffect as useEffect19, useRef as useRef24, useState as useState20 } from "react";
|
|
4926
5066
|
import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
4927
|
-
var SuccessCheck =
|
|
5067
|
+
var SuccessCheck = forwardRef11(function SuccessCheck2({ variant = "line", className, ...rest }, ref) {
|
|
4928
5068
|
const circled = variant === "circled";
|
|
4929
5069
|
return /* @__PURE__ */ jsxs40(
|
|
4930
5070
|
"svg",
|
|
@@ -4944,7 +5084,7 @@ var SuccessCheck = forwardRef12(function SuccessCheck2({ variant = "line", class
|
|
|
4944
5084
|
}
|
|
4945
5085
|
);
|
|
4946
5086
|
});
|
|
4947
|
-
var SuccessPanel =
|
|
5087
|
+
var SuccessPanel = forwardRef11(function SuccessPanel2({ title = "Done", sub, check = "line", className, ...rest }, ref) {
|
|
4948
5088
|
const circled = check === "circled";
|
|
4949
5089
|
return /* @__PURE__ */ jsxs40("div", { ...rest, ref, className: ["ui-success", className].filter(Boolean).join(" "), children: [
|
|
4950
5090
|
/* @__PURE__ */ jsx44("div", { className: ["ui-success__check", circled && "ui-success__check--circled"].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx44(SuccessCheck, { variant: circled ? "circled" : "line" }) }),
|
|
@@ -4969,12 +5109,12 @@ var pieces = [
|
|
|
4969
5109
|
[80, 0.36, -20, "c", 1.05]
|
|
4970
5110
|
];
|
|
4971
5111
|
function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
4972
|
-
const [remaining, setRemaining] =
|
|
4973
|
-
const callback =
|
|
4974
|
-
|
|
5112
|
+
const [remaining, setRemaining] = useState20(seconds);
|
|
5113
|
+
const callback = useRef24(onDone);
|
|
5114
|
+
useEffect19(() => {
|
|
4975
5115
|
callback.current = onDone;
|
|
4976
5116
|
}, [onDone]);
|
|
4977
|
-
|
|
5117
|
+
useEffect19(() => {
|
|
4978
5118
|
let count = seconds;
|
|
4979
5119
|
const timer = setInterval(() => {
|
|
4980
5120
|
count -= 1;
|
|
@@ -4996,7 +5136,7 @@ function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
|
4996
5136
|
] })
|
|
4997
5137
|
] });
|
|
4998
5138
|
}
|
|
4999
|
-
var Success =
|
|
5139
|
+
var Success = forwardRef11(function Success2({
|
|
5000
5140
|
layout = "hero",
|
|
5001
5141
|
level,
|
|
5002
5142
|
check = "line",
|
|
@@ -5046,14 +5186,16 @@ var Success = forwardRef12(function Success2({
|
|
|
5046
5186
|
|
|
5047
5187
|
// src/Chart.tsx
|
|
5048
5188
|
import {
|
|
5049
|
-
useCallback as
|
|
5050
|
-
|
|
5189
|
+
useCallback as useCallback8,
|
|
5190
|
+
useContext as useContext4,
|
|
5191
|
+
useEffect as useEffect20,
|
|
5051
5192
|
useId as useId15,
|
|
5052
5193
|
useLayoutEffect as useLayoutEffect5,
|
|
5053
|
-
useMemo as
|
|
5054
|
-
useRef as
|
|
5055
|
-
useState as
|
|
5194
|
+
useMemo as useMemo6,
|
|
5195
|
+
useRef as useRef25,
|
|
5196
|
+
useState as useState21
|
|
5056
5197
|
} from "react";
|
|
5198
|
+
import { createPortal as createPortal8 } from "react-dom";
|
|
5057
5199
|
import { CHART_FLOOR, bridgeWalk, chartScale, pointTarget } from "@apliteni/apliteni-ui";
|
|
5058
5200
|
|
|
5059
5201
|
// src/chart-looks.tsx
|
|
@@ -5101,7 +5243,22 @@ function rightRounded(x, y, w, h, r) {
|
|
|
5101
5243
|
return `M${px(x)} ${px(y)}H${px(x + w - k)}A${px(k)} ${px(k)} 0 0 1 ${px(x + w)} ${px(y + k)}V${px(y + h - k)}A${px(k)} ${px(k)} 0 0 1 ${px(x + w - k)} ${px(y + h)}H${px(x)}Z`;
|
|
5102
5244
|
}
|
|
5103
5245
|
var square = (x, y, w, h) => `M${px(x)} ${px(y)}h${px(w)}v${px(h)}h${px(-w)}Z`;
|
|
5104
|
-
var
|
|
5246
|
+
var overlaps = (look) => look === "flat" || look === "curves";
|
|
5247
|
+
var keyShape = (look) => look.variant === "line" || look.variant === "area" && overlaps(look.look) ? "line" : "fill";
|
|
5248
|
+
function monotone(xs, ys) {
|
|
5249
|
+
const s = xs.slice(1).map((x, k) => (ys[k + 1] - ys[k]) / (x - xs[k]));
|
|
5250
|
+
if (s.length < 2) return ys.map(() => s[0] ?? 0);
|
|
5251
|
+
const t = ys.map((_, i) => {
|
|
5252
|
+
if (i === 0 || i === ys.length - 1) return 0;
|
|
5253
|
+
const [s0, s1] = [s[i - 1], s[i]];
|
|
5254
|
+
const [h0, h1] = [xs[i] - xs[i - 1], xs[i + 1] - xs[i]];
|
|
5255
|
+
const p = (s0 * h1 + s1 * h0) / (h0 + h1);
|
|
5256
|
+
return (Math.sign(s0) + Math.sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), Math.abs(p) / 2);
|
|
5257
|
+
});
|
|
5258
|
+
t[0] = (3 * s[0] - t[1]) / 2;
|
|
5259
|
+
t[t.length - 1] = (3 * s[s.length - 1] - t[t.length - 2]) / 2;
|
|
5260
|
+
return t;
|
|
5261
|
+
}
|
|
5105
5262
|
function columnRows(g, i) {
|
|
5106
5263
|
const { look, format } = g;
|
|
5107
5264
|
const shape = keyShape(look);
|
|
@@ -5192,7 +5349,7 @@ function lookMarks(g) {
|
|
|
5192
5349
|
};
|
|
5193
5350
|
});
|
|
5194
5351
|
}
|
|
5195
|
-
const lift = look.variant === "line" && look.look === "points" ? 6 : look.variant === "stacked" ? 2 : 4;
|
|
5352
|
+
const lift = look.variant === "line" && look.look === "points" || look.look === "curves" ? 6 : look.variant === "stacked" ? 2 : 4;
|
|
5196
5353
|
return g.labels.map((label, i) => {
|
|
5197
5354
|
const tops = look.layers.map((l) => l.to[i]).filter(Number.isFinite);
|
|
5198
5355
|
const top = tops.length ? Math.max(...tops) : g.scale.min;
|
|
@@ -5228,16 +5385,52 @@ function linesDrawing(g, open) {
|
|
|
5228
5385
|
const area = look.variant === "area";
|
|
5229
5386
|
const finite = (layer, i) => Number.isFinite(look.stacked ? layer.to[i] : layer.values[i]);
|
|
5230
5387
|
const at = (layer, i) => look.stacked ? layer.to[i] : layer.values[i];
|
|
5388
|
+
const curves = area && look.look === "curves";
|
|
5231
5389
|
const ramps = area && !look.share ? look.layers.map((layer) => {
|
|
5232
5390
|
const tops = layer.values.map((_, i) => at(layer, i)).filter(Number.isFinite);
|
|
5233
|
-
const lo = Math.min(...tops);
|
|
5391
|
+
const lo = curves ? 0 : Math.min(...tops);
|
|
5234
5392
|
const hi = Math.max(...tops);
|
|
5235
5393
|
return tops.length && y(lo) - y(hi) >= 1 ? { id: `${g.uid}-ramp-${layer.id}`, layer, lo, hi } : null;
|
|
5236
5394
|
}) : [];
|
|
5395
|
+
const runs = (layer) => [...Array(n).keys()].reduce((out, i) => {
|
|
5396
|
+
if (!finite(layer, i)) return out;
|
|
5397
|
+
if (finite(layer, i - 1)) out[out.length - 1].push(i);
|
|
5398
|
+
else out.push([i]);
|
|
5399
|
+
return out;
|
|
5400
|
+
}, []);
|
|
5401
|
+
const tangents = curves ? look.layers.map((layer) => {
|
|
5402
|
+
const t = new Array(n).fill(0);
|
|
5403
|
+
for (const run of runs(layer)) {
|
|
5404
|
+
monotone(run.map(centre), run.map((i) => y(at(layer, i)))).forEach((v, k) => {
|
|
5405
|
+
t[run[k]] = v;
|
|
5406
|
+
});
|
|
5407
|
+
}
|
|
5408
|
+
return t;
|
|
5409
|
+
}) : [];
|
|
5410
|
+
const bend = (k, i) => {
|
|
5411
|
+
const layer = look.layers[k];
|
|
5412
|
+
const h = (centre(i + 1) - centre(i)) / 3;
|
|
5413
|
+
return `C${px(centre(i) + h)} ${px(y(at(layer, i)) + h * tangents[k][i])} ${px(centre(i + 1) - h)} ${px(y(at(layer, i + 1)) - h * tangents[k][i + 1])} ${px(centre(i + 1))} ${px(y(at(layer, i + 1)))}`;
|
|
5414
|
+
};
|
|
5237
5415
|
const fills = area && look.layers.map((layer, k) => {
|
|
5238
5416
|
const up = layer.to.map((v, i) => `${i ? "L" : "M"}${px(centre(i))} ${px(y(Number.isFinite(v) ? v : layer.from[i]))}`);
|
|
5239
5417
|
const down = layer.from.map((v, i) => `L${px(centre(i))} ${px(y(v))}`).reverse();
|
|
5240
5418
|
const ramp = ramps[k];
|
|
5419
|
+
if (curves) {
|
|
5420
|
+
const d = runs(layer).filter((run) => run.length > 1).map((run) => {
|
|
5421
|
+
const [a, b] = [run[0], run[run.length - 1]];
|
|
5422
|
+
return `M${px(centre(a))} ${px(y(layer.from[a]))}L${px(centre(a))} ${px(y(at(layer, a)))}${run.slice(0, -1).map((i) => bend(k, i)).join("")}L${px(centre(b))} ${px(y(layer.from[b]))}Z`;
|
|
5423
|
+
}).join("");
|
|
5424
|
+
return d && /* @__PURE__ */ jsx45(
|
|
5425
|
+
"path",
|
|
5426
|
+
{
|
|
5427
|
+
className: cx8("ui-chart__area", tone(layer.tone)),
|
|
5428
|
+
style: ramp ? { "--ui-chart-paint": `url(#${ramp.id})` } : void 0,
|
|
5429
|
+
d
|
|
5430
|
+
},
|
|
5431
|
+
`fill-${layer.id}`
|
|
5432
|
+
);
|
|
5433
|
+
}
|
|
5241
5434
|
return /* @__PURE__ */ jsx45(
|
|
5242
5435
|
"path",
|
|
5243
5436
|
{
|
|
@@ -5248,7 +5441,18 @@ function linesDrawing(g, open) {
|
|
|
5248
5441
|
`fill-${layer.id}`
|
|
5249
5442
|
);
|
|
5250
5443
|
});
|
|
5251
|
-
const edges =
|
|
5444
|
+
const edges = curves ? look.layers.flatMap((layer, k) => layer.to.slice(1).map((_, i) => finite(layer, i) && finite(layer, i + 1) ? /* @__PURE__ */ jsx45(
|
|
5445
|
+
"path",
|
|
5446
|
+
{
|
|
5447
|
+
className: cx8(
|
|
5448
|
+
"ui-chart__line",
|
|
5449
|
+
tone(layer.tone),
|
|
5450
|
+
(labels[i]?.estimated || labels[i + 1]?.estimated) && "is-estimated"
|
|
5451
|
+
),
|
|
5452
|
+
d: `M${px(centre(i))} ${px(y(at(layer, i)))}${bend(k, i)}`
|
|
5453
|
+
},
|
|
5454
|
+
`edge-${layer.id}-${i}`
|
|
5455
|
+
) : null)) : !look.share && look.layers.flatMap((layer) => layer.to.slice(1).map((_, k) => finite(layer, k) && finite(layer, k + 1) ? /* @__PURE__ */ jsx45(
|
|
5252
5456
|
"line",
|
|
5253
5457
|
{
|
|
5254
5458
|
className: cx8(
|
|
@@ -5263,7 +5467,7 @@ function linesDrawing(g, open) {
|
|
|
5263
5467
|
},
|
|
5264
5468
|
`edge-${layer.id}-${k}`
|
|
5265
5469
|
) : null));
|
|
5266
|
-
const points = look.variant === "line" && look.look === "points";
|
|
5470
|
+
const points = look.variant === "line" && look.look === "points" || curves;
|
|
5267
5471
|
const dots = look.layers.flatMap((layer) => layer.to.map((_, i) => {
|
|
5268
5472
|
if (!finite(layer, i)) return null;
|
|
5269
5473
|
const lonely = !finite(layer, i - 1) && !finite(layer, i + 1);
|
|
@@ -5332,8 +5536,8 @@ function linesDrawing(g, open) {
|
|
|
5332
5536
|
y1: px(y(ramp.lo)),
|
|
5333
5537
|
y2: px(y(ramp.hi)),
|
|
5334
5538
|
children: [
|
|
5335
|
-
/* @__PURE__ */ jsx45("stop", { className: "ui-chart__fade-base", offset: "0" }),
|
|
5336
|
-
/* @__PURE__ */ jsx45("stop", { className: "ui-chart__fade-end", offset: "1" })
|
|
5539
|
+
/* @__PURE__ */ jsx45("stop", { className: curves ? "ui-chart__wash-floor" : "ui-chart__fade-base", offset: "0" }),
|
|
5540
|
+
/* @__PURE__ */ jsx45("stop", { className: curves ? "ui-chart__wash-top" : "ui-chart__fade-end", offset: "1" })
|
|
5337
5541
|
]
|
|
5338
5542
|
},
|
|
5339
5543
|
ramp.id
|
|
@@ -5536,8 +5740,8 @@ function barPath(m) {
|
|
|
5536
5740
|
return `M${px2(x)} ${px2(roundBottom ? bottom - r : bottom)}V${px2(roundTop ? top + r : top)}` + (roundTop ? `${arc2(r, -r, 1)}h${px2(w - r * 2)}${arc2(r, r, 1)}` : `h${px2(w)}`) + `V${px2(roundBottom ? bottom - r : bottom)}` + (roundBottom ? `${arc2(-r, r, 1)}h${px2(-(w - r * 2))}${arc2(-r, -r, 1)}` : `h${px2(-w)}`) + "z";
|
|
5537
5741
|
}
|
|
5538
5742
|
function useTapFloor() {
|
|
5539
|
-
const [floor, setFloor] =
|
|
5540
|
-
|
|
5743
|
+
const [floor, setFloor] = useState21(TARGET);
|
|
5744
|
+
useEffect20(() => {
|
|
5541
5745
|
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX2}px) and (pointer: coarse)`);
|
|
5542
5746
|
if (!query) return;
|
|
5543
5747
|
const read = () => setFloor(query.matches ? TAP_FLOOR : TARGET);
|
|
@@ -5650,7 +5854,7 @@ function noNegative(variant, values) {
|
|
|
5650
5854
|
function lookFrame(variant, look, periods, series, format) {
|
|
5651
5855
|
if (variant !== "line") noNegative(variant, series.flatMap((s) => s.values.map((value2) => ({ name: s.name, value: value2 }))));
|
|
5652
5856
|
const columns = periods.map((p) => columnOf(p, p.label.split(" ")[0]));
|
|
5653
|
-
const stacked = variant === "stacked" ||
|
|
5857
|
+
const stacked = variant === "stacked" || variant === "area" && !overlaps(look);
|
|
5654
5858
|
const share = look === "share";
|
|
5655
5859
|
const n = columns.length;
|
|
5656
5860
|
const value = (s, i) => Number.isFinite(s.values[i]) ? s.values[i] : Number.NaN;
|
|
@@ -5772,25 +5976,30 @@ function Chart(props) {
|
|
|
5772
5976
|
const spark = variant === "spark";
|
|
5773
5977
|
const plotHeight = height ?? HEIGHT[variant];
|
|
5774
5978
|
const showTable = table ?? !spark;
|
|
5775
|
-
const [view, setView] =
|
|
5979
|
+
const [view, setView] = useState21("chart");
|
|
5776
5980
|
const asTable = showTable && view === "table";
|
|
5777
5981
|
const uid = useId15().replace(/[^\w-]/g, "");
|
|
5778
|
-
const frameEl =
|
|
5779
|
-
const
|
|
5780
|
-
const
|
|
5781
|
-
|
|
5782
|
-
const
|
|
5783
|
-
const
|
|
5784
|
-
const
|
|
5785
|
-
const
|
|
5786
|
-
const
|
|
5787
|
-
const
|
|
5982
|
+
const frameEl = useRef25(null);
|
|
5983
|
+
const card = useContext4(CardTools);
|
|
5984
|
+
const claim = card?.claim;
|
|
5985
|
+
useLayoutEffect5(() => showTable && claim ? claim(uid) : void 0, [showTable, claim, uid]);
|
|
5986
|
+
const toCard = showTable && card?.owner === uid ? card.slot : null;
|
|
5987
|
+
const scroller = useRef25(null);
|
|
5988
|
+
const plot = useRef25(null);
|
|
5989
|
+
const tipEl = useRef25(null);
|
|
5990
|
+
const svgEl = useRef25(null);
|
|
5991
|
+
const ignoreMouseUntil = useRef25(0);
|
|
5992
|
+
const touchMoved = useRef25(false);
|
|
5993
|
+
const dismissed = useRef25(null);
|
|
5994
|
+
const opening = useRef25(false);
|
|
5995
|
+
const pointerFocus = useRef25(false);
|
|
5788
5996
|
const floor = useTapFloor();
|
|
5789
|
-
const [width, setWidth] =
|
|
5790
|
-
const [
|
|
5791
|
-
const [
|
|
5792
|
-
const [
|
|
5793
|
-
const [
|
|
5997
|
+
const [width, setWidth] = useState21(0);
|
|
5998
|
+
const [overflows, setOverflows] = useState21(false);
|
|
5999
|
+
const [openId, setOpenId] = useState21(null);
|
|
6000
|
+
const [rawCursor, setCursor] = useState21(0);
|
|
6001
|
+
const [said, setSaid] = useState21("");
|
|
6002
|
+
const [ownPick, setOwnPick] = useState21(null);
|
|
5794
6003
|
const pick = selected === void 0 ? ownPick : selected;
|
|
5795
6004
|
const steps = props.variant === "bridge" ? props.steps : void 0;
|
|
5796
6005
|
const bridgeTones = props.variant === "bridge" ? props.tones : void 0;
|
|
@@ -5799,7 +6008,7 @@ function Chart(props) {
|
|
|
5799
6008
|
const slices = props.variant === "donut" ? props.slices : void 0;
|
|
5800
6009
|
const totalLabel = props.variant === "donut" ? props.totalLabel ?? "Total" : "Total";
|
|
5801
6010
|
const lookName = props.variant === "line" || props.variant === "area" || props.variant === "stacked" || props.variant === "donut" ? props.look ?? LOOK_DEFAULT[props.variant] : void 0;
|
|
5802
|
-
const frame =
|
|
6011
|
+
const frame = useMemo6(() => {
|
|
5803
6012
|
if (steps) return bridgeFrame(steps, bridgeTones, format);
|
|
5804
6013
|
if (slices) return donutFrame(lookName, slices, totalLabel, format);
|
|
5805
6014
|
if (lookName) return lookFrame(variant, lookName, periods ?? [], series ?? [], format);
|
|
@@ -5814,7 +6023,7 @@ function Chart(props) {
|
|
|
5814
6023
|
const boxHeight = Math.max(plotHeight, floor);
|
|
5815
6024
|
const boxTop = -(boxHeight - plotHeight) / 2;
|
|
5816
6025
|
const span = scale.max - scale.min || 1;
|
|
5817
|
-
const y =
|
|
6026
|
+
const y = useCallback8(
|
|
5818
6027
|
(value) => PAD + (scale.max - value) / span * (plotHeight - PAD * 2),
|
|
5819
6028
|
[scale.max, span, plotHeight]
|
|
5820
6029
|
);
|
|
@@ -5827,9 +6036,9 @@ function Chart(props) {
|
|
|
5827
6036
|
cap * lanes + LANE_GAP * (lanes - 1)
|
|
5828
6037
|
));
|
|
5829
6038
|
const barWidth = (groupWidth - LANE_GAP * (lanes - 1)) / lanes;
|
|
5830
|
-
const centre =
|
|
6039
|
+
const centre = useCallback8((column) => column * colWidth + colWidth / 2, [colWidth]);
|
|
5831
6040
|
const axisFormat = look?.share ? pct : formatAxis;
|
|
5832
|
-
const geometry =
|
|
6041
|
+
const geometry = useMemo6(() => look ? {
|
|
5833
6042
|
look,
|
|
5834
6043
|
uid,
|
|
5835
6044
|
labels: columns,
|
|
@@ -5846,7 +6055,7 @@ function Chart(props) {
|
|
|
5846
6055
|
formatAxis: axisFormat
|
|
5847
6056
|
} : null, [look, uid, columns, plotWidth, plotHeight, colWidth, floor, y, centre, scale, format, axisFormat]);
|
|
5848
6057
|
const box = geometry ? lookBox(geometry) : null;
|
|
5849
|
-
const marks =
|
|
6058
|
+
const marks = useMemo6(() => {
|
|
5850
6059
|
if (geometry) return lookMarks(geometry);
|
|
5851
6060
|
const out = frame.bars.map((bar) => {
|
|
5852
6061
|
let top = Math.min(y(bar.from), y(bar.to));
|
|
@@ -5919,18 +6128,23 @@ function Chart(props) {
|
|
|
5919
6128
|
}
|
|
5920
6129
|
return [...out, ...dots];
|
|
5921
6130
|
}, [geometry, frame, lines, keys, columns, centre, barWidth, groupWidth, y, floor, colWidth, plotWidth, boxTop, boxHeight]);
|
|
5922
|
-
const byId =
|
|
5923
|
-
const fades =
|
|
5924
|
-
const lead =
|
|
6131
|
+
const byId = useMemo6(() => new Map(marks.map((m) => [m.id, m])), [marks]);
|
|
6132
|
+
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]);
|
|
6133
|
+
const lead = useCallback8((column) => marks.find((m) => m.column === column), [marks]);
|
|
5925
6134
|
const open = openId ? byId.get(openId) : void 0;
|
|
5926
|
-
|
|
6135
|
+
useEffect20(() => {
|
|
5927
6136
|
const el = plot.current;
|
|
5928
|
-
|
|
5929
|
-
|
|
6137
|
+
const box2 = scroller.current;
|
|
6138
|
+
if (!el || !box2) return;
|
|
6139
|
+
const read = () => {
|
|
6140
|
+
setWidth(el.clientWidth);
|
|
6141
|
+
setOverflows(box2.scrollWidth > box2.clientWidth);
|
|
6142
|
+
};
|
|
5930
6143
|
read();
|
|
5931
6144
|
if (typeof ResizeObserver === "undefined") return;
|
|
5932
6145
|
const observer = new ResizeObserver(read);
|
|
5933
6146
|
observer.observe(el);
|
|
6147
|
+
observer.observe(box2);
|
|
5934
6148
|
return () => observer.disconnect();
|
|
5935
6149
|
}, []);
|
|
5936
6150
|
const opensAtEnd = variant === "line" && lookName === "labels";
|
|
@@ -5943,7 +6157,7 @@ function Chart(props) {
|
|
|
5943
6157
|
const anchor = [...svgEl.current.querySelectorAll("[data-anchor]")].find((el) => el.getAttribute("data-anchor") === openId);
|
|
5944
6158
|
if (anchor) placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
|
|
5945
6159
|
}, [openId, plotWidth, plotHeight]);
|
|
5946
|
-
|
|
6160
|
+
useEffect20(() => {
|
|
5947
6161
|
if (!openId) return;
|
|
5948
6162
|
const doc = frameEl.current?.ownerDocument;
|
|
5949
6163
|
const view2 = doc?.defaultView;
|
|
@@ -5971,7 +6185,7 @@ function Chart(props) {
|
|
|
5971
6185
|
setOpenId(id);
|
|
5972
6186
|
};
|
|
5973
6187
|
const markAt = (target) => target.closest?.("[data-mark]")?.getAttribute("data-mark") ?? null;
|
|
5974
|
-
const announce =
|
|
6188
|
+
const announce = useCallback8((column, picked = pick) => {
|
|
5975
6189
|
const where = columns[column];
|
|
5976
6190
|
if (!where) return;
|
|
5977
6191
|
const values = marks.filter((m) => m.column === column).map((m) => {
|
|
@@ -5998,6 +6212,7 @@ function Chart(props) {
|
|
|
5998
6212
|
onSelect?.(column);
|
|
5999
6213
|
};
|
|
6000
6214
|
const onKeyDown = (event) => {
|
|
6215
|
+
if (event.target !== event.currentTarget) return;
|
|
6001
6216
|
const steps2 = {
|
|
6002
6217
|
ArrowLeft: cursor - 1,
|
|
6003
6218
|
ArrowRight: cursor + 1,
|
|
@@ -6029,6 +6244,19 @@ function Chart(props) {
|
|
|
6029
6244
|
"Estimated"
|
|
6030
6245
|
] })
|
|
6031
6246
|
] });
|
|
6247
|
+
const viewSwitch = showTable && /* @__PURE__ */ jsx46(
|
|
6248
|
+
Segmented,
|
|
6249
|
+
{
|
|
6250
|
+
size: "sm",
|
|
6251
|
+
label: `${title}, view`,
|
|
6252
|
+
value: view,
|
|
6253
|
+
onChange: (next) => setView(next),
|
|
6254
|
+
options: [
|
|
6255
|
+
{ value: "chart", label: "Chart", icon: "chart", iconOnly: true },
|
|
6256
|
+
{ value: "table", label: "Table", icon: "table", iconOnly: true }
|
|
6257
|
+
]
|
|
6258
|
+
}
|
|
6259
|
+
);
|
|
6032
6260
|
const noun = look?.layout === "ring" ? "slices" : look?.layout === "rows" ? "rows" : "columns";
|
|
6033
6261
|
return /* @__PURE__ */ jsxs42(
|
|
6034
6262
|
"div",
|
|
@@ -6047,21 +6275,10 @@ function Chart(props) {
|
|
|
6047
6275
|
"--ui-chart-pad": `${PAD}px`
|
|
6048
6276
|
},
|
|
6049
6277
|
children: [
|
|
6050
|
-
|
|
6278
|
+
toCard && createPortal8(viewSwitch, toCard),
|
|
6279
|
+
(showTable && !toCard || legendFirst && legend) && /* @__PURE__ */ jsxs42("div", { className: "ui-chart__head", children: [
|
|
6051
6280
|
legendFirst && legend,
|
|
6052
|
-
|
|
6053
|
-
Segmented,
|
|
6054
|
-
{
|
|
6055
|
-
size: "sm",
|
|
6056
|
-
label: `${title}, view`,
|
|
6057
|
-
value: view,
|
|
6058
|
-
onChange: (next) => setView(next),
|
|
6059
|
-
options: [
|
|
6060
|
-
{ value: "chart", label: "Chart", icon: "chart", iconOnly: true },
|
|
6061
|
-
{ value: "table", label: "Table", icon: "table", iconOnly: true }
|
|
6062
|
-
]
|
|
6063
|
-
}
|
|
6064
|
-
)
|
|
6281
|
+
!toCard && viewSwitch
|
|
6065
6282
|
] }),
|
|
6066
6283
|
/* @__PURE__ */ jsxs42(
|
|
6067
6284
|
"div",
|
|
@@ -6089,226 +6306,237 @@ function Chart(props) {
|
|
|
6089
6306
|
},
|
|
6090
6307
|
children: [
|
|
6091
6308
|
!spark && columnsLayout && scale.ticks.length > 0 && /* @__PURE__ */ jsx46("div", { className: "ui-chart__axis", "aria-hidden": "true", children: [...scale.ticks].reverse().map((tick) => /* @__PURE__ */ jsx46("span", { className: "ui-chart__tick", children: axisFormat(tick) }, tick)) }),
|
|
6092
|
-
/* @__PURE__ */ jsx46(
|
|
6093
|
-
|
|
6094
|
-
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6111
|
-
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
|
|
6122
|
-
|
|
6123
|
-
},
|
|
6124
|
-
onTouchMove: () => {
|
|
6125
|
-
touchMoved.current = true;
|
|
6126
|
-
},
|
|
6127
|
-
onTouchCancel: () => {
|
|
6128
|
-
touchMoved.current = true;
|
|
6129
|
-
},
|
|
6130
|
-
onTouchEnd: (event) => {
|
|
6131
|
-
ignoreMouseUntil.current = Date.now() + 800;
|
|
6132
|
-
if (touchMoved.current) return;
|
|
6133
|
-
const id = markAt(event.target);
|
|
6134
|
-
if (id && id === openId) {
|
|
6135
|
-
opening.current = false;
|
|
6136
|
-
setOpenId(null);
|
|
6137
|
-
} else {
|
|
6138
|
-
opening.current = Boolean(id) && dismissed.current !== id;
|
|
6139
|
-
show(id);
|
|
6140
|
-
}
|
|
6141
|
-
},
|
|
6142
|
-
onPointerDown: () => {
|
|
6143
|
-
pointerFocus.current = true;
|
|
6144
|
-
},
|
|
6145
|
-
onClick: (event) => {
|
|
6146
|
-
frameEl.current?.focus();
|
|
6147
|
-
pointerFocus.current = false;
|
|
6148
|
-
const opened = opening.current;
|
|
6149
|
-
opening.current = false;
|
|
6150
|
-
const mark = byId.get(markAt(event.target) ?? "");
|
|
6151
|
-
if (!mark) return;
|
|
6152
|
-
setCursor(mark.column);
|
|
6153
|
-
if (opened) {
|
|
6154
|
-
announce(mark.column);
|
|
6155
|
-
return;
|
|
6156
|
-
}
|
|
6157
|
-
choose(mark.column);
|
|
6158
|
-
announce(mark.column, selectable ? mark.column : pick);
|
|
6159
|
-
},
|
|
6160
|
-
children: [
|
|
6161
|
-
!spark && columnsLayout && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */ jsx46(
|
|
6162
|
-
"rect",
|
|
6163
|
-
{
|
|
6164
|
-
className: "ui-chart__band",
|
|
6165
|
-
x: px2(pick * colWidth),
|
|
6166
|
-
width: px2(colWidth),
|
|
6167
|
-
y: "0",
|
|
6168
|
-
height: px2(plotHeight)
|
|
6169
|
-
}
|
|
6170
|
-
),
|
|
6171
|
-
frame.links && frame.bars.slice(0, -1).map((bar, i) => {
|
|
6172
|
-
const from = byId.get(bar.id);
|
|
6173
|
-
const to = byId.get(frame.bars[i + 1].id);
|
|
6174
|
-
return from && to ? /* @__PURE__ */ jsx46(
|
|
6175
|
-
"line",
|
|
6176
|
-
{
|
|
6177
|
-
className: "ui-chart__carry",
|
|
6178
|
-
x1: px2(from.x + from.w),
|
|
6179
|
-
x2: px2(to.x),
|
|
6180
|
-
y1: px2(y(bar.to)),
|
|
6181
|
-
y2: px2(y(bar.to))
|
|
6182
|
-
},
|
|
6183
|
-
`carry-${bar.id}`
|
|
6184
|
-
) : null;
|
|
6185
|
-
}),
|
|
6186
|
-
!spark && columnsLayout && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */ jsx46(
|
|
6187
|
-
"line",
|
|
6188
|
-
{
|
|
6189
|
-
className: "ui-chart__grid",
|
|
6190
|
-
x1: "0",
|
|
6191
|
-
x2: px2(plotWidth),
|
|
6192
|
-
y1: px2(y(tick)),
|
|
6193
|
-
y2: px2(y(tick))
|
|
6309
|
+
/* @__PURE__ */ jsx46(
|
|
6310
|
+
"div",
|
|
6311
|
+
{
|
|
6312
|
+
ref: scroller,
|
|
6313
|
+
className: cx9("ui-chart__scroll", overflows && "ui-focusable"),
|
|
6314
|
+
tabIndex: overflows ? 0 : -1,
|
|
6315
|
+
role: overflows ? "region" : void 0,
|
|
6316
|
+
"aria-label": overflows ? `${title}. Scroll for more ${noun}.` : void 0,
|
|
6317
|
+
onScroll: () => {
|
|
6318
|
+
const anchor = [...svgEl.current?.querySelectorAll("[data-anchor]") ?? []].find((el) => el.getAttribute("data-anchor") === openId);
|
|
6319
|
+
if (!anchor || !scroller.current || !frameEl.current || !tipEl.current) return;
|
|
6320
|
+
const mark = anchor.getBoundingClientRect();
|
|
6321
|
+
const view2 = scroller.current.getBoundingClientRect();
|
|
6322
|
+
if (mark.right <= view2.left || mark.left >= view2.right) setOpenId(null);
|
|
6323
|
+
else placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
|
|
6324
|
+
},
|
|
6325
|
+
children: /* @__PURE__ */ jsxs42("div", { ref: plot, className: "ui-chart__plot", children: [
|
|
6326
|
+
/* @__PURE__ */ jsxs42(
|
|
6327
|
+
"svg",
|
|
6328
|
+
{
|
|
6329
|
+
ref: svgEl,
|
|
6330
|
+
className: "ui-chart__svg",
|
|
6331
|
+
width: px2(plotWidth),
|
|
6332
|
+
height: px2(boxHeight),
|
|
6333
|
+
viewBox: `0 ${px2(boxTop)} ${px2(plotWidth)} ${px2(boxHeight)}`,
|
|
6334
|
+
...box && { width: px2(box.w), height: px2(box.h), viewBox: `0 0 ${px2(box.w)} ${px2(box.h)}` },
|
|
6335
|
+
role: "img",
|
|
6336
|
+
"aria-label": spark && marks.length > 0 ? `${title}. ${format(marks[0].value)} to ${format(marks[marks.length - 1].value)}.` : title,
|
|
6337
|
+
onMouseMove: (event) => {
|
|
6338
|
+
if (Date.now() < ignoreMouseUntil.current) return;
|
|
6339
|
+
show(markAt(event.target));
|
|
6194
6340
|
},
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
{
|
|
6200
|
-
className: "ui-chart__zero",
|
|
6201
|
-
x1: "0",
|
|
6202
|
-
x2: px2(plotWidth),
|
|
6203
|
-
y1: px2(y(0)),
|
|
6204
|
-
y2: px2(y(0))
|
|
6205
|
-
}
|
|
6206
|
-
),
|
|
6207
|
-
fades.size > 0 && /* @__PURE__ */ jsx46("defs", { children: [...fades.values()].map((fade) => /* @__PURE__ */ jsxs42(
|
|
6208
|
-
"linearGradient",
|
|
6209
|
-
{
|
|
6210
|
-
id: fade.id,
|
|
6211
|
-
className: `ui-chart__tone--${fade.tone}`,
|
|
6212
|
-
x1: "0",
|
|
6213
|
-
x2: "0",
|
|
6214
|
-
y1: fade.up ? "1" : "0",
|
|
6215
|
-
y2: fade.up ? "0" : "1",
|
|
6216
|
-
children: [
|
|
6217
|
-
/* @__PURE__ */ jsx46("stop", { className: "ui-chart__fade-base", offset: "0" }),
|
|
6218
|
-
/* @__PURE__ */ jsx46("stop", { className: "ui-chart__fade-end", offset: "1" })
|
|
6219
|
-
]
|
|
6341
|
+
onMouseLeave: () => {
|
|
6342
|
+
if (Date.now() < ignoreMouseUntil.current) return;
|
|
6343
|
+
dismissed.current = null;
|
|
6344
|
+
setOpenId(null);
|
|
6220
6345
|
},
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
const fade = fadeOf(uid, mark, variant === "bridge");
|
|
6225
|
-
return /* @__PURE__ */ jsx46(
|
|
6226
|
-
"path",
|
|
6227
|
-
{
|
|
6228
|
-
className: cx9(
|
|
6229
|
-
"ui-chart__bar",
|
|
6230
|
-
`ui-chart__tone--${mark.tone}`,
|
|
6231
|
-
mark.estimated && "is-estimated"
|
|
6232
|
-
),
|
|
6233
|
-
style: fade ? { "--ui-chart-paint": `url(#${fade.id})` } : void 0,
|
|
6234
|
-
d: barPath(mark)
|
|
6235
|
-
},
|
|
6236
|
-
`bar-${mark.id}`
|
|
6237
|
-
);
|
|
6238
|
-
}),
|
|
6239
|
-
["casing", "stroke"].map((layer) => lines.flatMap(
|
|
6240
|
-
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */ jsx46(
|
|
6241
|
-
"line",
|
|
6242
|
-
{
|
|
6243
|
-
className: layer === "casing" ? "ui-chart__line-casing" : cx9(
|
|
6244
|
-
"ui-chart__line",
|
|
6245
|
-
`ui-chart__tone--${line.tone}`,
|
|
6246
|
-
(columns[i]?.estimated || columns[i + 1]?.estimated) && "is-estimated"
|
|
6247
|
-
),
|
|
6248
|
-
x1: px2(centre(i)),
|
|
6249
|
-
y1: px2(y(line.values[i])),
|
|
6250
|
-
x2: px2(centre(i + 1)),
|
|
6251
|
-
y2: px2(y(value))
|
|
6252
|
-
},
|
|
6253
|
-
`${line.id}-${layer}-${i}`
|
|
6254
|
-
) : null)
|
|
6255
|
-
)),
|
|
6256
|
-
lines.flatMap((line) => line.values.map((value, i) => Number.isFinite(value) && !Number.isFinite(line.values[i - 1]) && !Number.isFinite(line.values[i + 1]) ? /* @__PURE__ */ jsx46(
|
|
6257
|
-
"circle",
|
|
6258
|
-
{
|
|
6259
|
-
className: cx9("ui-chart__isolated", `ui-chart__tone--${line.tone}`),
|
|
6260
|
-
cx: px2(centre(i)),
|
|
6261
|
-
cy: px2(y(value)),
|
|
6262
|
-
r: "2"
|
|
6346
|
+
onTouchStart: () => {
|
|
6347
|
+
ignoreMouseUntil.current = Date.now() + 800;
|
|
6348
|
+
touchMoved.current = false;
|
|
6263
6349
|
},
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
className: "ui-chart__hit",
|
|
6281
|
-
x: px2(mark.hit?.x ?? mark.x),
|
|
6282
|
-
y: px2(mark.hit?.y ?? mark.y),
|
|
6283
|
-
width: px2(mark.hit?.w ?? TARGET),
|
|
6284
|
-
height: px2(mark.hit?.h ?? TARGET)
|
|
6350
|
+
onTouchMove: () => {
|
|
6351
|
+
touchMoved.current = true;
|
|
6352
|
+
},
|
|
6353
|
+
onTouchCancel: () => {
|
|
6354
|
+
touchMoved.current = true;
|
|
6355
|
+
},
|
|
6356
|
+
onTouchEnd: (event) => {
|
|
6357
|
+
ignoreMouseUntil.current = Date.now() + 800;
|
|
6358
|
+
if (touchMoved.current) return;
|
|
6359
|
+
const id = markAt(event.target);
|
|
6360
|
+
if (id && id === openId) {
|
|
6361
|
+
opening.current = false;
|
|
6362
|
+
setOpenId(null);
|
|
6363
|
+
} else {
|
|
6364
|
+
opening.current = Boolean(id) && dismissed.current !== id;
|
|
6365
|
+
show(id);
|
|
6285
6366
|
}
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6367
|
+
},
|
|
6368
|
+
onPointerDown: () => {
|
|
6369
|
+
pointerFocus.current = true;
|
|
6370
|
+
},
|
|
6371
|
+
onClick: (event) => {
|
|
6372
|
+
frameEl.current?.focus();
|
|
6373
|
+
pointerFocus.current = false;
|
|
6374
|
+
const opened = opening.current;
|
|
6375
|
+
opening.current = false;
|
|
6376
|
+
const mark = byId.get(markAt(event.target) ?? "");
|
|
6377
|
+
if (!mark) return;
|
|
6378
|
+
setCursor(mark.column);
|
|
6379
|
+
if (opened) {
|
|
6380
|
+
announce(mark.column);
|
|
6381
|
+
return;
|
|
6296
6382
|
}
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6383
|
+
choose(mark.column);
|
|
6384
|
+
announce(mark.column, selectable ? mark.column : pick);
|
|
6385
|
+
},
|
|
6386
|
+
children: [
|
|
6387
|
+
!spark && columnsLayout && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */ jsx46(
|
|
6388
|
+
"rect",
|
|
6389
|
+
{
|
|
6390
|
+
className: "ui-chart__band",
|
|
6391
|
+
x: px2(pick * colWidth),
|
|
6392
|
+
width: px2(colWidth),
|
|
6393
|
+
y: "0",
|
|
6394
|
+
height: px2(plotHeight)
|
|
6395
|
+
}
|
|
6396
|
+
),
|
|
6397
|
+
frame.links && frame.bars.slice(0, -1).map((bar, i) => {
|
|
6398
|
+
const from = byId.get(bar.id);
|
|
6399
|
+
const to = byId.get(frame.bars[i + 1].id);
|
|
6400
|
+
return from && to ? /* @__PURE__ */ jsx46(
|
|
6401
|
+
"line",
|
|
6402
|
+
{
|
|
6403
|
+
className: "ui-chart__carry",
|
|
6404
|
+
x1: px2(from.x + from.w),
|
|
6405
|
+
x2: px2(to.x),
|
|
6406
|
+
y1: px2(y(bar.to)),
|
|
6407
|
+
y2: px2(y(bar.to))
|
|
6408
|
+
},
|
|
6409
|
+
`carry-${bar.id}`
|
|
6410
|
+
) : null;
|
|
6411
|
+
}),
|
|
6412
|
+
!spark && columnsLayout && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */ jsx46(
|
|
6413
|
+
"line",
|
|
6414
|
+
{
|
|
6415
|
+
className: "ui-chart__grid",
|
|
6416
|
+
x1: "0",
|
|
6417
|
+
x2: px2(plotWidth),
|
|
6418
|
+
y1: px2(y(tick)),
|
|
6419
|
+
y2: px2(y(tick))
|
|
6420
|
+
},
|
|
6421
|
+
`grid-${tick}`
|
|
6422
|
+
)),
|
|
6423
|
+
!spark && columnsLayout && scale.ticks.includes(0) && /* @__PURE__ */ jsx46(
|
|
6424
|
+
"line",
|
|
6425
|
+
{
|
|
6426
|
+
className: "ui-chart__zero",
|
|
6427
|
+
x1: "0",
|
|
6428
|
+
x2: px2(plotWidth),
|
|
6429
|
+
y1: px2(y(0)),
|
|
6430
|
+
y2: px2(y(0))
|
|
6431
|
+
}
|
|
6432
|
+
),
|
|
6433
|
+
fades.size > 0 && /* @__PURE__ */ jsx46("defs", { children: [...fades.values()].map((fade) => /* @__PURE__ */ jsxs42(
|
|
6434
|
+
"linearGradient",
|
|
6435
|
+
{
|
|
6436
|
+
id: fade.id,
|
|
6437
|
+
className: `ui-chart__tone--${fade.tone}`,
|
|
6438
|
+
x1: "0",
|
|
6439
|
+
x2: "0",
|
|
6440
|
+
y1: fade.up ? "1" : "0",
|
|
6441
|
+
y2: fade.up ? "0" : "1",
|
|
6442
|
+
children: [
|
|
6443
|
+
/* @__PURE__ */ jsx46("stop", { className: "ui-chart__fade-base", offset: "0" }),
|
|
6444
|
+
/* @__PURE__ */ jsx46("stop", { className: "ui-chart__fade-end", offset: "1" })
|
|
6445
|
+
]
|
|
6446
|
+
},
|
|
6447
|
+
fade.id
|
|
6448
|
+
)) }),
|
|
6449
|
+
marks.filter((m) => m.kind === "bar").map((mark) => {
|
|
6450
|
+
const fade = fadeOf(uid, mark, variant === "bridge");
|
|
6451
|
+
return /* @__PURE__ */ jsx46(
|
|
6452
|
+
"path",
|
|
6453
|
+
{
|
|
6454
|
+
className: cx9(
|
|
6455
|
+
"ui-chart__bar",
|
|
6456
|
+
`ui-chart__tone--${mark.tone}`,
|
|
6457
|
+
mark.estimated && "is-estimated"
|
|
6458
|
+
),
|
|
6459
|
+
style: fade ? { "--ui-chart-paint": `url(#${fade.id})` } : void 0,
|
|
6460
|
+
d: barPath(mark)
|
|
6461
|
+
},
|
|
6462
|
+
`bar-${mark.id}`
|
|
6463
|
+
);
|
|
6464
|
+
}),
|
|
6465
|
+
["casing", "stroke"].map((layer) => lines.flatMap(
|
|
6466
|
+
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */ jsx46(
|
|
6467
|
+
"line",
|
|
6468
|
+
{
|
|
6469
|
+
className: layer === "casing" ? "ui-chart__line-casing" : cx9(
|
|
6470
|
+
"ui-chart__line",
|
|
6471
|
+
`ui-chart__tone--${line.tone}`,
|
|
6472
|
+
(columns[i]?.estimated || columns[i + 1]?.estimated) && "is-estimated"
|
|
6473
|
+
),
|
|
6474
|
+
x1: px2(centre(i)),
|
|
6475
|
+
y1: px2(y(line.values[i])),
|
|
6476
|
+
x2: px2(centre(i + 1)),
|
|
6477
|
+
y2: px2(y(value))
|
|
6478
|
+
},
|
|
6479
|
+
`${line.id}-${layer}-${i}`
|
|
6480
|
+
) : null)
|
|
6481
|
+
)),
|
|
6482
|
+
lines.flatMap((line) => line.values.map((value, i) => Number.isFinite(value) && !Number.isFinite(line.values[i - 1]) && !Number.isFinite(line.values[i + 1]) ? /* @__PURE__ */ jsx46(
|
|
6483
|
+
"circle",
|
|
6484
|
+
{
|
|
6485
|
+
className: cx9("ui-chart__isolated", `ui-chart__tone--${line.tone}`),
|
|
6486
|
+
cx: px2(centre(i)),
|
|
6487
|
+
cy: px2(y(value)),
|
|
6488
|
+
r: "2"
|
|
6489
|
+
},
|
|
6490
|
+
`isolated-${line.id}-${i}`
|
|
6491
|
+
) : null)),
|
|
6492
|
+
geometry && lookDrawing(geometry, open?.column ?? null, pick),
|
|
6493
|
+
marks.map((mark) => /* @__PURE__ */ jsxs42("g", { "data-mark": mark.id, children: [
|
|
6494
|
+
mark.hitPath ? /* @__PURE__ */ jsx46("path", { className: "ui-chart__hit", d: mark.hitPath }) : mark.kind === "bar" ? /* @__PURE__ */ jsx46(
|
|
6495
|
+
"rect",
|
|
6496
|
+
{
|
|
6497
|
+
className: "ui-chart__hit",
|
|
6498
|
+
x: px2(mark.column * colWidth + mark.lane * colWidth / mark.lanes),
|
|
6499
|
+
width: px2(colWidth / mark.lanes),
|
|
6500
|
+
y: px2(hitBand(mark.band).y),
|
|
6501
|
+
height: px2(hitBand(mark.band).h)
|
|
6502
|
+
}
|
|
6503
|
+
) : /* @__PURE__ */ jsx46(
|
|
6504
|
+
"rect",
|
|
6505
|
+
{
|
|
6506
|
+
className: "ui-chart__hit",
|
|
6507
|
+
x: px2(mark.hit?.x ?? mark.x),
|
|
6508
|
+
y: px2(mark.hit?.y ?? mark.y),
|
|
6509
|
+
width: px2(mark.hit?.w ?? TARGET),
|
|
6510
|
+
height: px2(mark.hit?.h ?? TARGET)
|
|
6511
|
+
}
|
|
6512
|
+
),
|
|
6513
|
+
/* @__PURE__ */ jsx46(
|
|
6514
|
+
"rect",
|
|
6515
|
+
{
|
|
6516
|
+
"data-anchor": mark.id,
|
|
6517
|
+
className: "ui-chart__anchor",
|
|
6518
|
+
x: px2(mark.x),
|
|
6519
|
+
y: px2(mark.y),
|
|
6520
|
+
width: px2(mark.w),
|
|
6521
|
+
height: "0"
|
|
6522
|
+
}
|
|
6523
|
+
)
|
|
6524
|
+
] }, `hit-${mark.id}`))
|
|
6525
|
+
]
|
|
6526
|
+
}
|
|
6527
|
+
),
|
|
6528
|
+
look?.variant === "donut" && look.look === "table" && /* @__PURE__ */ jsx46(Shares, { look, format, swatch: /* @__PURE__ */ jsx46(KeyMark, { shape: "fill" }) }),
|
|
6529
|
+
!spark && columnsLayout && /* @__PURE__ */ jsx46("div", { className: "ui-chart__periods", "aria-hidden": "true", children: columns.map((column, i) => /* @__PURE__ */ jsx46(
|
|
6530
|
+
"span",
|
|
6531
|
+
{
|
|
6532
|
+
className: cx9("ui-chart__period", pick === i && "is-selected"),
|
|
6533
|
+
children: column.short
|
|
6534
|
+
},
|
|
6535
|
+
`${column.label}-${i}`
|
|
6536
|
+
)) })
|
|
6537
|
+
] })
|
|
6538
|
+
}
|
|
6539
|
+
),
|
|
6312
6540
|
/* @__PURE__ */ jsx46("span", { ref: tipEl, className: cx9("ui-tip", openId && "is-open"), role: open ? "tooltip" : void 0, children: open && /* @__PURE__ */ jsxs42(Fragment20, { children: [
|
|
6313
6541
|
/* @__PURE__ */ jsx46("span", { className: "ui-tip__label", children: spark || look ? columns[open.column]?.label : `${open.name}, ${columns[open.column]?.label}` }),
|
|
6314
6542
|
open.rows ? /* @__PURE__ */ jsxs42(Fragment20, { children: [
|
|
@@ -6359,10 +6587,10 @@ function Chart(props) {
|
|
|
6359
6587
|
}
|
|
6360
6588
|
|
|
6361
6589
|
// src/AccentPicker.tsx
|
|
6362
|
-
import { forwardRef as
|
|
6590
|
+
import { forwardRef as forwardRef12 } from "react";
|
|
6363
6591
|
import { ACCENTS, accentSwatchStyle } from "@apliteni/apliteni-ui";
|
|
6364
6592
|
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
6365
|
-
var AccentPicker =
|
|
6593
|
+
var AccentPicker = forwardRef12(function AccentPicker2({
|
|
6366
6594
|
value,
|
|
6367
6595
|
onChange,
|
|
6368
6596
|
options = ACCENTS,
|
|
@@ -6401,7 +6629,7 @@ var AccentPicker = forwardRef13(function AccentPicker2({
|
|
|
6401
6629
|
|
|
6402
6630
|
// src/TopBar.tsx
|
|
6403
6631
|
import { Fragment as Fragment21 } from "react";
|
|
6404
|
-
import { prism as prism3, safeUrl as
|
|
6632
|
+
import { prism as prism3, safeUrl as safeUrl4, icon as icon8, ACCOUNT_NAV } from "@apliteni/apliteni-ui";
|
|
6405
6633
|
import { Fragment as Fragment22, jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
6406
6634
|
function TopBar({
|
|
6407
6635
|
brand,
|
|
@@ -6415,7 +6643,7 @@ function TopBar({
|
|
|
6415
6643
|
...rest
|
|
6416
6644
|
}) {
|
|
6417
6645
|
return /* @__PURE__ */ jsx48("header", { ...rest, className: ["topbar", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs43("div", { className: "topbar__in", children: [
|
|
6418
|
-
brand ?? /* @__PURE__ */ jsxs43("a", { className: "brand", href:
|
|
6646
|
+
brand ?? /* @__PURE__ */ jsxs43("a", { className: "brand", href: safeUrl4(brandHref), "aria-label": `Apliteni ${word}`, children: [
|
|
6419
6647
|
/* @__PURE__ */ jsx48("span", { "aria-hidden": "true", dangerouslySetInnerHTML: { __html: prism3("tb-mark", 22) } }),
|
|
6420
6648
|
/* @__PURE__ */ jsx48("span", { children: word })
|
|
6421
6649
|
] }),
|
|
@@ -6431,7 +6659,7 @@ function ViewSwitch({ items, active, label = "View", renderLink }) {
|
|
|
6431
6659
|
const current = item.id === active;
|
|
6432
6660
|
const linkProps = {
|
|
6433
6661
|
className: current ? "cur" : void 0,
|
|
6434
|
-
href:
|
|
6662
|
+
href: safeUrl4(item.href || `#${item.id}`),
|
|
6435
6663
|
target: item.target,
|
|
6436
6664
|
"aria-current": current ? "page" : void 0,
|
|
6437
6665
|
children: item.label
|
|
@@ -6484,7 +6712,7 @@ var ACCOUNT_ITEMS = ACCOUNT_NAV.map((item) => ({
|
|
|
6484
6712
|
value: item.id,
|
|
6485
6713
|
href: `#${item.id}`
|
|
6486
6714
|
}));
|
|
6487
|
-
function
|
|
6715
|
+
function AccountMenu2({
|
|
6488
6716
|
name,
|
|
6489
6717
|
email,
|
|
6490
6718
|
items = ACCOUNT_ITEMS,
|
|
@@ -6518,7 +6746,7 @@ function AccountMenu({
|
|
|
6518
6746
|
"a",
|
|
6519
6747
|
{
|
|
6520
6748
|
...props,
|
|
6521
|
-
href: item.disabled ? void 0 : item.href ?
|
|
6749
|
+
href: item.disabled ? void 0 : item.href ? safeUrl4(item.href) : item.value === "sign-out" && onSignOut ? void 0 : safeUrl4(item.value === "sign-out" ? "#logout" : `#${item.value}`),
|
|
6522
6750
|
className: [props.className.replace(/\bui-dropdown__item\b/, "").trim(), !item.disabled && item.value === current && "cur", item.value === "sign-out" && "aout"].filter(Boolean).join(" "),
|
|
6523
6751
|
children: [
|
|
6524
6752
|
item.icon && /* @__PURE__ */ jsx48("span", { "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon8(item.icon) } }),
|
|
@@ -6539,14 +6767,13 @@ var PAGE_SIZES = KIT_PAGE_SIZES;
|
|
|
6539
6767
|
var DEFAULT_PAGE_SIZE3 = KIT_DEFAULT_PAGE_SIZE;
|
|
6540
6768
|
export {
|
|
6541
6769
|
AccentPicker,
|
|
6542
|
-
AccountMenu,
|
|
6770
|
+
AccountMenu2 as AccountMenu,
|
|
6543
6771
|
AccountWindow,
|
|
6544
6772
|
AppShell,
|
|
6545
6773
|
AuthShell,
|
|
6546
6774
|
Avatar,
|
|
6547
6775
|
BackLink,
|
|
6548
6776
|
Badge,
|
|
6549
|
-
Breadcrumbs,
|
|
6550
6777
|
BusyRegion,
|
|
6551
6778
|
Button,
|
|
6552
6779
|
Callout,
|