@apliteni/apliteni-ui 0.133.0 → 0.137.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/package.json +1 -1
- package/react/README.md +59 -1
- package/react/dist/index.d.ts +95 -4
- package/react/dist/index.js +990 -645
- package/src/components/feedback.js +6 -3
- package/src/components/footer.js +5 -3
- package/src/styles/button.css +1 -1
- package/src/styles/card.css +22 -5
- package/src/styles/feedback.css +4 -3
- package/src/styles/footer.css +4 -3
- package/src/styles/layout.css +4 -4
- package/src/styles/table.css +28 -24
- package/src/tokens/tokens.css +8 -7
package/react/dist/index.js
CHANGED
|
@@ -282,24 +282,30 @@ var StatusDot = forwardRef5(function StatusDot2({
|
|
|
282
282
|
});
|
|
283
283
|
|
|
284
284
|
// src/primitives/Card.tsx
|
|
285
|
-
import {
|
|
286
|
-
|
|
285
|
+
import { icon as kitIcon, safeUrl } from "@apliteni/apliteni-ui";
|
|
286
|
+
import { Fragment, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
287
|
+
function Card({ title, sub, level = 2, variant, pad: pad2, icon: icon8, href, className, children }) {
|
|
287
288
|
const n = Number(level);
|
|
288
|
-
const Heading = `h${[2, 3, 4, 5, 6].includes(n) ? n : 2}`;
|
|
289
|
+
const Heading = href != null ? "div" : `h${[2, 3, 4, 5, 6].includes(n) ? n : 2}`;
|
|
289
290
|
const titled = title != null && title !== false && title !== "";
|
|
290
|
-
|
|
291
|
-
|
|
291
|
+
const classes = ["ui-card", variant && `ui-card--${variant}`, pad2 && `ui-card--pad-${pad2}`, href != null && "ui-card--interactive", className].filter(Boolean).join(" ");
|
|
292
|
+
const inner = /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
293
|
+
titled && /* @__PURE__ */ jsxs5(Heading, { className: "ui-card__title", children: [
|
|
294
|
+
icon8 && /* @__PURE__ */ jsx9("span", { className: "ui-card__icon", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: kitIcon(icon8) } }),
|
|
295
|
+
title
|
|
296
|
+
] }),
|
|
292
297
|
sub != null && /* @__PURE__ */ jsx9("div", { className: "ui-card__sub", children: sub }),
|
|
293
298
|
children
|
|
294
299
|
] });
|
|
300
|
+
return href != null ? /* @__PURE__ */ jsx9("a", { className: classes, href: safeUrl(href), children: inner }) : /* @__PURE__ */ jsx9("div", { className: classes, children: inner });
|
|
295
301
|
}
|
|
296
302
|
|
|
297
303
|
// src/primitives/Callout.tsx
|
|
298
|
-
import { calloutIcons, icon as
|
|
304
|
+
import { calloutIcons, icon as kitIcon2 } from "@apliteni/apliteni-ui";
|
|
299
305
|
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
300
306
|
function Callout({ variant, icon: icon8 = calloutIcons[variant ?? "neutral"], children, actions }) {
|
|
301
307
|
return /* @__PURE__ */ jsxs6("div", { className: `ui-callout${variant && variant !== "neutral" ? ` ui-callout--${variant}` : ""}`, role: variant === "danger" ? "alert" : void 0, children: [
|
|
302
|
-
/* @__PURE__ */ jsx10("span", { className: "ui-callout__icon", dangerouslySetInnerHTML: { __html:
|
|
308
|
+
/* @__PURE__ */ jsx10("span", { className: "ui-callout__icon", dangerouslySetInnerHTML: { __html: kitIcon2(icon8) } }),
|
|
303
309
|
/* @__PURE__ */ jsxs6("div", { className: "ui-callout__body", children: [
|
|
304
310
|
children,
|
|
305
311
|
actions != null && /* @__PURE__ */ jsx10("div", { className: "ui-toolbar ui-callout__actions", children: actions })
|
|
@@ -351,7 +357,7 @@ function placeTip(host, mark, tip, bound, placement = "top") {
|
|
|
351
357
|
|
|
352
358
|
// src/Tooltip.tsx
|
|
353
359
|
import { useEffect, useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
354
|
-
import { Fragment, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
360
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
355
361
|
var DOC_EVENTS = ["pointerdown", "pointercancel", "click", "keydown", "touchend"];
|
|
356
362
|
var CAPTURED = /* @__PURE__ */ new Set(["pointerdown", "pointercancel"]);
|
|
357
363
|
var wirings = /* @__PURE__ */ new WeakMap();
|
|
@@ -378,7 +384,7 @@ function wireDocument(doc, handlers) {
|
|
|
378
384
|
wirings.delete(doc);
|
|
379
385
|
};
|
|
380
386
|
}
|
|
381
|
-
var
|
|
387
|
+
var Text2 = ({ label = "", value = "", detail: detail2 = "" }) => /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
382
388
|
/* @__PURE__ */ jsx11("span", { className: "ui-tip__label", hidden: !label, children: label }),
|
|
383
389
|
/* @__PURE__ */ jsx11("span", { className: "ui-tip__value", hidden: !value, children: value }),
|
|
384
390
|
/* @__PURE__ */ jsx11("span", { className: "ui-tip__detail", hidden: !detail2, children: detail2 })
|
|
@@ -532,14 +538,14 @@ function Tooltip({ text: text2, label = text2, value, detail: detail2, placement
|
|
|
532
538
|
},
|
|
533
539
|
children: [
|
|
534
540
|
/* @__PURE__ */ jsx11("span", { ref: trigger, className: "ui-focusable", tabIndex: 0, "aria-describedby": id, children }),
|
|
535
|
-
/* @__PURE__ */ jsx11("span", { ref: tip, id, "data-tip": "", role: "tooltip", className: `ui-tip${open ? " is-open" : ""}`, children: /* @__PURE__ */ jsx11(
|
|
541
|
+
/* @__PURE__ */ jsx11("span", { ref: tip, id, "data-tip": "", role: "tooltip", className: `ui-tip${open ? " is-open" : ""}`, children: /* @__PURE__ */ jsx11(Text2, { label, value, detail: detail2 }) })
|
|
536
542
|
]
|
|
537
543
|
}
|
|
538
544
|
);
|
|
539
545
|
}
|
|
540
546
|
|
|
541
547
|
// src/primitives/StatBand.tsx
|
|
542
|
-
import { Fragment as
|
|
548
|
+
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
543
549
|
var GLYPH = { up: "arrowUp", down: "arrowDown", flat: "minus" };
|
|
544
550
|
var directionOf = (text2) => {
|
|
545
551
|
const t = text2.trim();
|
|
@@ -548,7 +554,7 @@ var directionOf = (text2) => {
|
|
|
548
554
|
var hasChange = (d) => !!d && d.value != null && d.value !== "";
|
|
549
555
|
function ContextRow({ caption, delta, basisId }) {
|
|
550
556
|
if (!hasChange(delta)) return caption ? /* @__PURE__ */ jsx12("dd", { className: "ui-stat__caption", children: caption }) : null;
|
|
551
|
-
const lead = caption ? /* @__PURE__ */ jsxs8(
|
|
557
|
+
const lead = caption ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
552
558
|
/* @__PURE__ */ jsx12("span", { className: "ui-stat__caption", children: caption }),
|
|
553
559
|
" "
|
|
554
560
|
] }) : null;
|
|
@@ -558,7 +564,7 @@ function ContextRow({ caption, delta, basisId }) {
|
|
|
558
564
|
lead,
|
|
559
565
|
/* @__PURE__ */ jsx12(Icon, { name: GLYPH[dir] }),
|
|
560
566
|
delta.tooltip ? /* @__PURE__ */ jsx12(Tooltip, { text: delta.tooltip, children: /* @__PURE__ */ jsx12("span", { className: "ui-stat__change", children: delta.value }) }) : /* @__PURE__ */ jsx12("span", { className: "ui-stat__change", children: delta.value }),
|
|
561
|
-
own ? /* @__PURE__ */ jsxs8(
|
|
567
|
+
own ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
562
568
|
" ",
|
|
563
569
|
/* @__PURE__ */ jsx12("span", { className: "ui-stat__basis", children: own })
|
|
564
570
|
] }) : null
|
|
@@ -677,10 +683,12 @@ function sync() {
|
|
|
677
683
|
else document.removeEventListener("keydown", onKey);
|
|
678
684
|
}
|
|
679
685
|
}
|
|
680
|
-
function returnFocus(opener) {
|
|
686
|
+
function returnFocus(opener, fallback) {
|
|
681
687
|
const live = opener && !opener.isConnected && opener.id ? document.getElementById(opener.id) : opener;
|
|
682
|
-
|
|
683
|
-
|
|
688
|
+
const visible = live?.isConnected && (!fallback || live instanceof HTMLElement && !live.closest('[hidden], [aria-hidden="true"], [inert]') && !live.matches(':disabled, [aria-disabled="true"]') && (typeof live.checkVisibility !== "function" || live.checkVisibility({ visibilityProperty: true })));
|
|
689
|
+
const target = visible ? live : fallback?.isConnected ? fallback : null;
|
|
690
|
+
if (target) target.focus?.();
|
|
691
|
+
if (document.activeElement !== target) document.activeElement?.blur?.();
|
|
684
692
|
}
|
|
685
693
|
function enter(entry) {
|
|
686
694
|
const at = stack.findIndex((e) => {
|
|
@@ -710,7 +718,7 @@ function exit(entry) {
|
|
|
710
718
|
if (above) return;
|
|
711
719
|
const next = stack[stack.length - 1];
|
|
712
720
|
if (!next) {
|
|
713
|
-
returnFocus(entry.opener);
|
|
721
|
+
returnFocus(entry.opener, entry.fallback);
|
|
714
722
|
return;
|
|
715
723
|
}
|
|
716
724
|
const back = [entry.opener, next.resume].find((el) => el?.isConnected && next.panel.contains(el));
|
|
@@ -766,7 +774,7 @@ function usePresence(open, root, panel) {
|
|
|
766
774
|
}, [open, present]);
|
|
767
775
|
return { mounted: present, shown };
|
|
768
776
|
}
|
|
769
|
-
function useDialog(active, { root, panel, body, initialFocus }, onClose) {
|
|
777
|
+
function useDialog(active, { root, panel, body, initialFocus, fallbackFocus }, onClose) {
|
|
770
778
|
const parent = useContext(DialogScope);
|
|
771
779
|
const [scope] = useState3(() => ({ parent }));
|
|
772
780
|
const close = useRef3(onClose);
|
|
@@ -783,6 +791,7 @@ function useDialog(active, { root, panel, body, initialFocus }, onClose) {
|
|
|
783
791
|
initialFocus: initialFocus?.current ?? null,
|
|
784
792
|
close: () => close.current(),
|
|
785
793
|
opener: document.activeElement,
|
|
794
|
+
fallback: fallbackFocus?.current ?? null,
|
|
786
795
|
resume: null
|
|
787
796
|
};
|
|
788
797
|
enter(entry);
|
|
@@ -829,7 +838,7 @@ function Modal({ open, title, onClose, footer, children, initialFocusRef, role =
|
|
|
829
838
|
}
|
|
830
839
|
|
|
831
840
|
// src/Confirm.tsx
|
|
832
|
-
import { Fragment as
|
|
841
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
833
842
|
function Confirm({
|
|
834
843
|
open,
|
|
835
844
|
title,
|
|
@@ -850,7 +859,7 @@ function Confirm({
|
|
|
850
859
|
onClose: onCancel,
|
|
851
860
|
role: "alertdialog",
|
|
852
861
|
initialFocusRef: safeAction,
|
|
853
|
-
footer: /* @__PURE__ */ jsxs10(
|
|
862
|
+
footer: /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
854
863
|
/* @__PURE__ */ jsx14(Button, { ref: safeAction, variant: "ghost", onClick: onCancel, children: cancelLabel }),
|
|
855
864
|
/* @__PURE__ */ jsx14(Button, { variant: danger ? "danger" : "primary", busy, onClick: onConfirm, children: confirmLabel })
|
|
856
865
|
] }),
|
|
@@ -859,10 +868,250 @@ function Confirm({
|
|
|
859
868
|
);
|
|
860
869
|
}
|
|
861
870
|
|
|
862
|
-
// src/
|
|
863
|
-
import {
|
|
871
|
+
// src/Feedback.tsx
|
|
872
|
+
import { useEffect as useEffect3, useRef as useRef6, useState as useState4 } from "react";
|
|
864
873
|
import { createPortal as createPortal2 } from "react-dom";
|
|
865
|
-
import {
|
|
874
|
+
import { nearestSection } from "@apliteni/apliteni-ui";
|
|
875
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
876
|
+
var defaultSection = (h) => {
|
|
877
|
+
if (!h) return { label: "this page", title: "", anchor: "" };
|
|
878
|
+
const t = (h.textContent || "").replace(/\s+/g, " ").trim();
|
|
879
|
+
return { label: t, title: t, anchor: h.id || "" };
|
|
880
|
+
};
|
|
881
|
+
var RETURN_CONTROL = 'a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), summary, [role="button"], [role="link"], [role="checkbox"], [role="switch"], [role="tab"], [contenteditable="true"]';
|
|
882
|
+
function Feedback({
|
|
883
|
+
container,
|
|
884
|
+
onSend,
|
|
885
|
+
minChars = 3,
|
|
886
|
+
section = defaultSection,
|
|
887
|
+
label = "Give feedback",
|
|
888
|
+
placeholder = "What's off, missing, or worth adding here?",
|
|
889
|
+
sentMessage = "Thanks, your note is sent."
|
|
890
|
+
}) {
|
|
891
|
+
const [pill, setPill] = useState4(null);
|
|
892
|
+
const [open, setOpen] = useState4(false);
|
|
893
|
+
const openRef = useRef6(false);
|
|
894
|
+
const [note, setNote] = useState4("");
|
|
895
|
+
const [state, setState] = useState4("ready");
|
|
896
|
+
const [error, setError] = useState4("");
|
|
897
|
+
const pending = useRef6(null);
|
|
898
|
+
const [view, setView] = useState4({ chip: "this page", quote: "" });
|
|
899
|
+
const mark = useRef6(null);
|
|
900
|
+
const opening = useRef6(0);
|
|
901
|
+
const pillRef = useRef6(null);
|
|
902
|
+
const root = useRef6(null);
|
|
903
|
+
const panel = useRef6(null);
|
|
904
|
+
const body = useRef6(null);
|
|
905
|
+
const noteRef = useRef6(null);
|
|
906
|
+
const doneClose = useRef6(null);
|
|
907
|
+
const opts = useRef6({ minChars, section });
|
|
908
|
+
opts.current = { minChars, section };
|
|
909
|
+
useEffect3(() => {
|
|
910
|
+
function onSelect() {
|
|
911
|
+
if (openRef.current) return;
|
|
912
|
+
const el = container.current;
|
|
913
|
+
const sel = window.getSelection();
|
|
914
|
+
if (!el || !sel || sel.isCollapsed || !sel.rangeCount) {
|
|
915
|
+
setPill(null);
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
const range = sel.getRangeAt(0);
|
|
919
|
+
if (!el.contains(range.commonAncestorContainer)) {
|
|
920
|
+
setPill(null);
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
const text2 = sel.toString().trim();
|
|
924
|
+
if (text2.length < opts.current.minChars) {
|
|
925
|
+
setPill(null);
|
|
926
|
+
return;
|
|
927
|
+
}
|
|
928
|
+
const rect = range.getBoundingClientRect();
|
|
929
|
+
if (!rect.width && !rect.height) return;
|
|
930
|
+
const s = opts.current.section(nearestSection(range.startContainer, el)) || {};
|
|
931
|
+
pending.current = { text: text2, anchor: s.anchor || "", label: s.label || "", title: s.title || "", range: range.cloneRange() };
|
|
932
|
+
setPill({ left: window.scrollX + rect.left + rect.width / 2, top: window.scrollY + rect.top });
|
|
933
|
+
}
|
|
934
|
+
const later = () => {
|
|
935
|
+
setTimeout(onSelect, 0);
|
|
936
|
+
};
|
|
937
|
+
const onKeyUp = (e) => {
|
|
938
|
+
if (e.shiftKey || e.key === "Shift") later();
|
|
939
|
+
};
|
|
940
|
+
const hide = () => {
|
|
941
|
+
if (!openRef.current) setPill(null);
|
|
942
|
+
};
|
|
943
|
+
const onMouseUp = (e) => {
|
|
944
|
+
const target = e.target;
|
|
945
|
+
if (target instanceof Node && (root.current?.contains(target) || pillRef.current?.contains(target))) return;
|
|
946
|
+
later();
|
|
947
|
+
};
|
|
948
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
949
|
+
document.addEventListener("keyup", onKeyUp);
|
|
950
|
+
window.addEventListener("scroll", hide, { passive: true });
|
|
951
|
+
return () => {
|
|
952
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
953
|
+
document.removeEventListener("keyup", onKeyUp);
|
|
954
|
+
window.removeEventListener("scroll", hide);
|
|
955
|
+
};
|
|
956
|
+
}, [container]);
|
|
957
|
+
function clearMark() {
|
|
958
|
+
const m = mark.current;
|
|
959
|
+
mark.current = null;
|
|
960
|
+
const span = m?.span;
|
|
961
|
+
if (!m || !span?.parentNode) return;
|
|
962
|
+
const restoreRange = () => {
|
|
963
|
+
if (!m.start?.isConnected || !m.end?.isConnected) return;
|
|
964
|
+
const range = document.createRange();
|
|
965
|
+
range.setStart(m.start, m.startOffset);
|
|
966
|
+
range.setEnd(m.end, m.endOffset);
|
|
967
|
+
m.selection.range = range;
|
|
968
|
+
};
|
|
969
|
+
const kids = Array.from(span.childNodes);
|
|
970
|
+
const first = kids[0];
|
|
971
|
+
const last = kids[kids.length - 1];
|
|
972
|
+
if (m.start && m.start === m.end) {
|
|
973
|
+
const tail = span.nextSibling;
|
|
974
|
+
if (kids.length === 1 && first instanceof Text && span.previousSibling === m.start && tail instanceof Text) {
|
|
975
|
+
m.start.data += first.data + tail.data;
|
|
976
|
+
tail.remove();
|
|
977
|
+
span.remove();
|
|
978
|
+
restoreRange();
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
} else {
|
|
982
|
+
if (m.start && first instanceof Text && span.previousSibling === m.start) {
|
|
983
|
+
m.start.data += first.data;
|
|
984
|
+
first.remove();
|
|
985
|
+
}
|
|
986
|
+
if (m.end && last instanceof Text && last !== first && span.nextSibling === m.end) {
|
|
987
|
+
m.end.data = last.data + m.end.data;
|
|
988
|
+
last.remove();
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
span.replaceWith(...Array.from(span.childNodes));
|
|
992
|
+
restoreRange();
|
|
993
|
+
}
|
|
994
|
+
useEffect3(() => () => {
|
|
995
|
+
opening.current++;
|
|
996
|
+
clearMark();
|
|
997
|
+
}, []);
|
|
998
|
+
const { mounted, shown } = usePresence(open, root, panel);
|
|
999
|
+
function close() {
|
|
1000
|
+
opening.current++;
|
|
1001
|
+
openRef.current = false;
|
|
1002
|
+
setOpen(false);
|
|
1003
|
+
clearMark();
|
|
1004
|
+
}
|
|
1005
|
+
useDialog(shown, { root, panel, body, initialFocus: noteRef, fallbackFocus: pillRef }, close);
|
|
1006
|
+
function start() {
|
|
1007
|
+
const p = pending.current;
|
|
1008
|
+
if (!p) return;
|
|
1009
|
+
opening.current++;
|
|
1010
|
+
openRef.current = true;
|
|
1011
|
+
const before = document.activeElement;
|
|
1012
|
+
if (!(before instanceof HTMLElement) || before.tabIndex < 0 || !before.matches(RETURN_CONTROL) || before.getAttribute("aria-disabled") === "true" || typeof before.checkVisibility === "function" && !before.checkVisibility({ visibilityProperty: true })) {
|
|
1013
|
+
pillRef.current?.focus({ preventScroll: true });
|
|
1014
|
+
}
|
|
1015
|
+
setView({ chip: p.label || "this page", quote: p.text.length > 200 ? `${p.text.slice(0, 200)}\u2026` : p.text });
|
|
1016
|
+
setNote("");
|
|
1017
|
+
setError("");
|
|
1018
|
+
setState("ready");
|
|
1019
|
+
try {
|
|
1020
|
+
const span = document.createElement("span");
|
|
1021
|
+
span.className = "ui-fbmark";
|
|
1022
|
+
const start2 = p.range.startContainer instanceof Text ? p.range.startContainer : null;
|
|
1023
|
+
const end = p.range.endContainer instanceof Text ? p.range.endContainer : null;
|
|
1024
|
+
const startOffset = p.range.startOffset;
|
|
1025
|
+
const endOffset = p.range.endOffset;
|
|
1026
|
+
p.range.surroundContents(span);
|
|
1027
|
+
mark.current = { span, start: start2, end, startOffset, endOffset, selection: p };
|
|
1028
|
+
} catch {
|
|
1029
|
+
mark.current = null;
|
|
1030
|
+
}
|
|
1031
|
+
window.getSelection()?.removeAllRanges();
|
|
1032
|
+
setOpen(true);
|
|
1033
|
+
}
|
|
1034
|
+
async function send() {
|
|
1035
|
+
const p = pending.current;
|
|
1036
|
+
if (state !== "ready" || !p || !note.trim()) return;
|
|
1037
|
+
const sentOpening = opening.current;
|
|
1038
|
+
setError("");
|
|
1039
|
+
setState("sending");
|
|
1040
|
+
try {
|
|
1041
|
+
const res = await onSend({ note: note.trim(), excerpt: p.text, anchor: p.anchor, sectionLabel: p.label, sectionTitle: p.title });
|
|
1042
|
+
if (opening.current !== sentOpening) return;
|
|
1043
|
+
if (!res || !res.ok) throw new Error(res?.error);
|
|
1044
|
+
clearMark();
|
|
1045
|
+
setState("sent");
|
|
1046
|
+
setTimeout(() => {
|
|
1047
|
+
if (opening.current === sentOpening) doneClose.current?.focus();
|
|
1048
|
+
}, 0);
|
|
1049
|
+
} catch (e) {
|
|
1050
|
+
if (opening.current !== sentOpening) return;
|
|
1051
|
+
setError(e instanceof Error && e.message || "Could not send just now \u2014 try again in a moment.");
|
|
1052
|
+
setState("ready");
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
return createPortal2(/* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
1056
|
+
/* @__PURE__ */ jsxs11(
|
|
1057
|
+
"button",
|
|
1058
|
+
{
|
|
1059
|
+
ref: pillRef,
|
|
1060
|
+
type: "button",
|
|
1061
|
+
className: pill ? "ui-fbpill show" : "ui-fbpill",
|
|
1062
|
+
tabIndex: pill ? 0 : -1,
|
|
1063
|
+
"aria-hidden": pill ? void 0 : true,
|
|
1064
|
+
style: pill ?? void 0,
|
|
1065
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
1066
|
+
onClick: start,
|
|
1067
|
+
children: [
|
|
1068
|
+
/* @__PURE__ */ jsx15("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx15("path", { d: "M21 15a2 2 0 0 1-2 2H8l-4 4V5a2 2 0 0 1 2-2h13a2 2 0 0 1 2 2z" }) }),
|
|
1069
|
+
label
|
|
1070
|
+
]
|
|
1071
|
+
}
|
|
1072
|
+
),
|
|
1073
|
+
mounted && /* @__PURE__ */ jsxs11("div", { ref: root, children: [
|
|
1074
|
+
/* @__PURE__ */ jsx15("div", { className: shown ? "ui-fbscrim show" : "ui-fbscrim", onClick: close }),
|
|
1075
|
+
/* @__PURE__ */ jsx15("div", { ref: panel, className: shown ? "ui-fbcomposer show" : "ui-fbcomposer", role: "dialog", "aria-modal": "true", "aria-label": "Leave feedback", tabIndex: -1, children: state === "sent" ? /* @__PURE__ */ jsxs11("div", { className: "ui-fbc__done", ref: body, children: [
|
|
1076
|
+
/* @__PURE__ */ jsx15("p", { role: "status", children: sentMessage }),
|
|
1077
|
+
/* @__PURE__ */ jsx15("div", { className: "row", children: /* @__PURE__ */ jsx15(Button, { ref: doneClose, variant: "ghost", onClick: close, children: "Close" }) })
|
|
1078
|
+
] }) : /* @__PURE__ */ jsxs11("div", { ref: body, children: [
|
|
1079
|
+
/* @__PURE__ */ jsxs11("div", { className: "ui-fbc__head", children: [
|
|
1080
|
+
/* @__PURE__ */ jsxs11("span", { className: "ui-fbc__chip", children: [
|
|
1081
|
+
/* @__PURE__ */ jsx15("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ jsx15("path", { d: "M4 5h16M4 12h10M4 19h7" }) }),
|
|
1082
|
+
/* @__PURE__ */ jsx15("span", { children: view.chip })
|
|
1083
|
+
] }),
|
|
1084
|
+
/* @__PURE__ */ jsx15(Button, { variant: "ghost", size: "sm", iconOnly: true, icon: "x", "aria-label": "Close", style: { marginLeft: "auto" }, onClick: close })
|
|
1085
|
+
] }),
|
|
1086
|
+
/* @__PURE__ */ jsxs11("div", { className: "ui-fbc__quote", children: [
|
|
1087
|
+
/* @__PURE__ */ jsx15("span", { className: "ui-fbc__qm", children: "\u201C" }),
|
|
1088
|
+
/* @__PURE__ */ jsx15("q", { children: view.quote })
|
|
1089
|
+
] }),
|
|
1090
|
+
/* @__PURE__ */ jsx15("div", { className: "ui-fbc__body", children: /* @__PURE__ */ jsx15(
|
|
1091
|
+
"textarea",
|
|
1092
|
+
{
|
|
1093
|
+
ref: noteRef,
|
|
1094
|
+
maxLength: 6e3,
|
|
1095
|
+
value: note,
|
|
1096
|
+
placeholder,
|
|
1097
|
+
"aria-label": "Your note",
|
|
1098
|
+
onChange: (e) => setNote(e.target.value)
|
|
1099
|
+
}
|
|
1100
|
+
) }),
|
|
1101
|
+
error && /* @__PURE__ */ jsx15("div", { className: "ui-fbc__err show is-entering", role: "alert", children: error }),
|
|
1102
|
+
/* @__PURE__ */ jsxs11("div", { className: "ui-fbc__foot", children: [
|
|
1103
|
+
/* @__PURE__ */ jsx15(Button, { variant: "ghost", onClick: close, children: "Cancel" }),
|
|
1104
|
+
/* @__PURE__ */ jsx15(Button, { variant: "primary", busy: state === "sending", disabled: !note.trim(), onClick: send, children: "Send feedback" })
|
|
1105
|
+
] })
|
|
1106
|
+
] }) })
|
|
1107
|
+
] })
|
|
1108
|
+
] }), document.body);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
// src/Drawer.tsx
|
|
1112
|
+
import { useId as useId5, useRef as useRef7 } from "react";
|
|
1113
|
+
import { createPortal as createPortal3 } from "react-dom";
|
|
1114
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
866
1115
|
function Drawer({
|
|
867
1116
|
open,
|
|
868
1117
|
title,
|
|
@@ -873,18 +1122,18 @@ function Drawer({
|
|
|
873
1122
|
children,
|
|
874
1123
|
closeLabel = "Close"
|
|
875
1124
|
}) {
|
|
876
|
-
const root =
|
|
877
|
-
const panel =
|
|
878
|
-
const body =
|
|
1125
|
+
const root = useRef7(null);
|
|
1126
|
+
const panel = useRef7(null);
|
|
1127
|
+
const body = useRef7(null);
|
|
879
1128
|
const titleId = useId5();
|
|
880
1129
|
const { mounted, shown } = usePresence(open, root, panel);
|
|
881
1130
|
const scope = useDialog(shown, { root, panel, body }, onClose);
|
|
882
1131
|
if (!mounted) return null;
|
|
883
1132
|
const cls = ["ui-drawer", `ui-drawer--${side}`, `ui-drawer--${size}`, shown && "is-open"].filter(Boolean).join(" ");
|
|
884
|
-
return
|
|
885
|
-
/* @__PURE__ */
|
|
886
|
-
/* @__PURE__ */
|
|
887
|
-
/* @__PURE__ */
|
|
1133
|
+
return createPortal3(
|
|
1134
|
+
/* @__PURE__ */ jsx16(DialogScope.Provider, { value: scope, children: /* @__PURE__ */ jsxs12("div", { className: cls, ref: root, children: [
|
|
1135
|
+
/* @__PURE__ */ jsx16("div", { className: "ui-drawer__scrim", onMouseDown: dismissOnScrim(onClose) }),
|
|
1136
|
+
/* @__PURE__ */ jsxs12(
|
|
888
1137
|
"aside",
|
|
889
1138
|
{
|
|
890
1139
|
className: "ui-drawer__panel",
|
|
@@ -894,12 +1143,12 @@ function Drawer({
|
|
|
894
1143
|
tabIndex: -1,
|
|
895
1144
|
ref: panel,
|
|
896
1145
|
children: [
|
|
897
|
-
/* @__PURE__ */
|
|
898
|
-
/* @__PURE__ */
|
|
899
|
-
/* @__PURE__ */
|
|
1146
|
+
/* @__PURE__ */ jsxs12("header", { className: "ui-drawer__header", children: [
|
|
1147
|
+
/* @__PURE__ */ jsx16("h2", { className: "ui-drawer__title", id: titleId, children: title }),
|
|
1148
|
+
/* @__PURE__ */ jsx16("button", { type: "button", className: "ui-drawer__close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx16(Icon, { name: "x" }) })
|
|
900
1149
|
] }),
|
|
901
|
-
/* @__PURE__ */
|
|
902
|
-
footer && /* @__PURE__ */
|
|
1150
|
+
/* @__PURE__ */ jsx16("div", { className: "ui-drawer__body", ref: body, children }),
|
|
1151
|
+
footer && /* @__PURE__ */ jsx16("footer", { className: "ui-drawer__footer", children: footer })
|
|
903
1152
|
]
|
|
904
1153
|
}
|
|
905
1154
|
)
|
|
@@ -909,12 +1158,12 @@ function Drawer({
|
|
|
909
1158
|
}
|
|
910
1159
|
|
|
911
1160
|
// src/CommandPalette.tsx
|
|
912
|
-
import { useCallback as useCallback2, useEffect as
|
|
913
|
-
import { createPortal as
|
|
1161
|
+
import { useCallback as useCallback2, useEffect as useEffect4, useId as useId6, useMemo, useRef as useRef8, useState as useState5 } from "react";
|
|
1162
|
+
import { createPortal as createPortal4 } from "react-dom";
|
|
914
1163
|
import { rankGroups, icon as icon3 } from "@apliteni/apliteni-ui";
|
|
915
|
-
import { jsx as
|
|
1164
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
916
1165
|
var cx2 = (...a) => a.filter(Boolean).join(" ");
|
|
917
|
-
var Glyph = ({ name, className }) => /* @__PURE__ */
|
|
1166
|
+
var Glyph = ({ name, className }) => /* @__PURE__ */ jsx17("span", { className, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon3(name) } });
|
|
918
1167
|
var keysOf = (shortcut) => shortcut == null ? [] : Array.isArray(shortcut) ? shortcut : [shortcut];
|
|
919
1168
|
function CommandPalette({
|
|
920
1169
|
open,
|
|
@@ -930,12 +1179,12 @@ function CommandPalette({
|
|
|
930
1179
|
onQueryChange
|
|
931
1180
|
}) {
|
|
932
1181
|
const uid = useId6().replace(/:/g, "");
|
|
933
|
-
const root =
|
|
934
|
-
const panel =
|
|
935
|
-
const search =
|
|
936
|
-
const [query, setQuery] =
|
|
937
|
-
const [at, setAt] =
|
|
938
|
-
|
|
1182
|
+
const root = useRef8(null);
|
|
1183
|
+
const panel = useRef8(null);
|
|
1184
|
+
const search = useRef8(null);
|
|
1185
|
+
const [query, setQuery] = useState5("");
|
|
1186
|
+
const [at, setAt] = useState5(0);
|
|
1187
|
+
useEffect4(() => {
|
|
939
1188
|
if (open) {
|
|
940
1189
|
setQuery("");
|
|
941
1190
|
setAt(0);
|
|
@@ -947,7 +1196,7 @@ function CommandPalette({
|
|
|
947
1196
|
);
|
|
948
1197
|
const rows = useMemo(() => shown.flatMap((g) => g.items).filter((it) => !isDisabled(it)), [shown]);
|
|
949
1198
|
const active = rows[Math.min(at, rows.length - 1)];
|
|
950
|
-
|
|
1199
|
+
useEffect4(() => {
|
|
951
1200
|
setAt(0);
|
|
952
1201
|
}, [query]);
|
|
953
1202
|
const scope = useDialog(open, { root, panel, body: search }, onClose);
|
|
@@ -978,10 +1227,10 @@ function CommandPalette({
|
|
|
978
1227
|
if (!open) return null;
|
|
979
1228
|
const listId = `${uid}-list`;
|
|
980
1229
|
let n = 0;
|
|
981
|
-
return
|
|
982
|
-
/* @__PURE__ */
|
|
983
|
-
/* @__PURE__ */
|
|
984
|
-
/* @__PURE__ */
|
|
1230
|
+
return createPortal4(
|
|
1231
|
+
/* @__PURE__ */ jsx17(DialogScope.Provider, { value: scope, children: /* @__PURE__ */ jsxs13("div", { className: cx2("ui-cmdk", density === "roomy" && "ui-cmdk--roomy", "is-open"), ref: root, children: [
|
|
1232
|
+
/* @__PURE__ */ jsx17("div", { className: "ui-cmdk__scrim", onMouseDown: dismissOnScrim(onClose) }),
|
|
1233
|
+
/* @__PURE__ */ jsxs13(
|
|
985
1234
|
"div",
|
|
986
1235
|
{
|
|
987
1236
|
className: "ui-cmdk__panel",
|
|
@@ -992,9 +1241,9 @@ function CommandPalette({
|
|
|
992
1241
|
ref: panel,
|
|
993
1242
|
onKeyDown,
|
|
994
1243
|
children: [
|
|
995
|
-
/* @__PURE__ */
|
|
996
|
-
/* @__PURE__ */
|
|
997
|
-
/* @__PURE__ */
|
|
1244
|
+
/* @__PURE__ */ jsxs13("div", { className: "ui-cmdk__search", ref: search, children: [
|
|
1245
|
+
/* @__PURE__ */ jsx17(Glyph, { name: "search", className: "ui-cmdk__search-ic" }),
|
|
1246
|
+
/* @__PURE__ */ jsx17(
|
|
998
1247
|
"input",
|
|
999
1248
|
{
|
|
1000
1249
|
className: "ui-cmdk__input",
|
|
@@ -1016,19 +1265,19 @@ function CommandPalette({
|
|
|
1016
1265
|
}
|
|
1017
1266
|
)
|
|
1018
1267
|
] }),
|
|
1019
|
-
/* @__PURE__ */
|
|
1268
|
+
/* @__PURE__ */ jsx17("div", { className: "ui-cmdk__list", id: listId, role: "listbox", "aria-label": `${label} results`, children: shown.map((group, gi) => /* @__PURE__ */ jsxs13(
|
|
1020
1269
|
"div",
|
|
1021
1270
|
{
|
|
1022
1271
|
className: "ui-cmdk__group",
|
|
1023
1272
|
role: "group",
|
|
1024
1273
|
"aria-labelledby": group.label ? `${uid}-g${gi}` : void 0,
|
|
1025
1274
|
children: [
|
|
1026
|
-
group.label && /* @__PURE__ */
|
|
1275
|
+
group.label && /* @__PURE__ */ jsx17("div", { className: "ui-cmdk__group-head", id: `${uid}-g${gi}`, children: group.label }),
|
|
1027
1276
|
group.items.map((item) => {
|
|
1028
1277
|
const disabled = isDisabled(item);
|
|
1029
1278
|
const id = `${uid}-o${n++}`;
|
|
1030
1279
|
const on = item === active;
|
|
1031
|
-
return /* @__PURE__ */
|
|
1280
|
+
return /* @__PURE__ */ jsxs13(
|
|
1032
1281
|
"div",
|
|
1033
1282
|
{
|
|
1034
1283
|
id,
|
|
@@ -1048,13 +1297,13 @@ function CommandPalette({
|
|
|
1048
1297
|
},
|
|
1049
1298
|
onClick: (e) => run(item, e.metaKey || e.ctrlKey),
|
|
1050
1299
|
children: [
|
|
1051
|
-
item.icon && /* @__PURE__ */
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
/* @__PURE__ */
|
|
1054
|
-
item.description && /* @__PURE__ */
|
|
1300
|
+
item.icon && /* @__PURE__ */ jsx17(Glyph, { name: item.icon, className: "ui-cmdk__ic" }),
|
|
1301
|
+
/* @__PURE__ */ jsxs13("span", { className: "ui-cmdk__main", children: [
|
|
1302
|
+
/* @__PURE__ */ jsx17("span", { className: "ui-cmdk__label", children: item.label }),
|
|
1303
|
+
item.description && /* @__PURE__ */ jsx17("span", { className: "ui-cmdk__desc", children: item.description })
|
|
1055
1304
|
] }),
|
|
1056
|
-
item.badge && /* @__PURE__ */
|
|
1057
|
-
keysOf(item.shortcut).length > 0 && /* @__PURE__ */
|
|
1305
|
+
item.badge && /* @__PURE__ */ jsx17("span", { className: "ui-cmdk__badge", children: item.badge }),
|
|
1306
|
+
keysOf(item.shortcut).length > 0 && /* @__PURE__ */ jsx17("span", { className: "ui-cmdk__keys", "aria-hidden": "true", children: keysOf(item.shortcut).map((k) => /* @__PURE__ */ jsx17("kbd", { className: "ui-cmdk__key", children: k }, k)) })
|
|
1058
1307
|
]
|
|
1059
1308
|
},
|
|
1060
1309
|
item.id
|
|
@@ -1064,20 +1313,20 @@ function CommandPalette({
|
|
|
1064
1313
|
},
|
|
1065
1314
|
group.label ?? `g${gi}`
|
|
1066
1315
|
)) }),
|
|
1067
|
-
/* @__PURE__ */
|
|
1068
|
-
/* @__PURE__ */
|
|
1069
|
-
hint && /* @__PURE__ */
|
|
1070
|
-
/* @__PURE__ */
|
|
1071
|
-
/* @__PURE__ */
|
|
1072
|
-
/* @__PURE__ */
|
|
1316
|
+
/* @__PURE__ */ jsx17("p", { className: "ui-cmdk__empty", hidden: countOf(shown) > 0, children: empty }),
|
|
1317
|
+
/* @__PURE__ */ jsx17("p", { className: "ui-sr", role: "status", "aria-live": "polite", children: countOf(shown) === 0 ? "No results" : `${countOf(shown)} result${countOf(shown) === 1 ? "" : "s"}` }),
|
|
1318
|
+
hint && /* @__PURE__ */ jsxs13("div", { className: "ui-cmdk__foot", "aria-hidden": "true", children: [
|
|
1319
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
1320
|
+
/* @__PURE__ */ jsx17("kbd", { className: "ui-cmdk__key", children: "\u2191" }),
|
|
1321
|
+
/* @__PURE__ */ jsx17("kbd", { className: "ui-cmdk__key", children: "\u2193" }),
|
|
1073
1322
|
" move"
|
|
1074
1323
|
] }),
|
|
1075
|
-
/* @__PURE__ */
|
|
1076
|
-
/* @__PURE__ */
|
|
1324
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
1325
|
+
/* @__PURE__ */ jsx17("kbd", { className: "ui-cmdk__key", children: "\u21B5" }),
|
|
1077
1326
|
" run"
|
|
1078
1327
|
] }),
|
|
1079
|
-
/* @__PURE__ */
|
|
1080
|
-
/* @__PURE__ */
|
|
1328
|
+
/* @__PURE__ */ jsxs13("span", { children: [
|
|
1329
|
+
/* @__PURE__ */ jsx17("kbd", { className: "ui-cmdk__key", children: "esc" }),
|
|
1081
1330
|
" close"
|
|
1082
1331
|
] })
|
|
1083
1332
|
] })
|
|
@@ -1102,13 +1351,13 @@ function rowId(uid, groups, item) {
|
|
|
1102
1351
|
}
|
|
1103
1352
|
|
|
1104
1353
|
// src/DataTable.tsx
|
|
1105
|
-
import { useCallback as useCallback3, useEffect as
|
|
1354
|
+
import { Fragment as Fragment6, useCallback as useCallback3, useEffect as useEffect6, useMemo as useMemo2, useRef as useRef10, useState as useState7 } from "react";
|
|
1106
1355
|
import { DEFAULT_PAGE_SIZE as DEFAULT_PAGE_SIZE2 } from "@apliteni/apliteni-ui";
|
|
1107
1356
|
|
|
1108
1357
|
// src/Pagination.tsx
|
|
1109
|
-
import { useEffect as
|
|
1358
|
+
import { useEffect as useEffect5, useId as useId7, useRef as useRef9, useState as useState6 } from "react";
|
|
1110
1359
|
import { DEFAULT_PAGE_SIZE } from "@apliteni/apliteni-ui";
|
|
1111
|
-
import { jsx as
|
|
1360
|
+
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1112
1361
|
var GHOST_SM = "ui-btn ui-btn--ghost ui-btn--sm";
|
|
1113
1362
|
var VARIANTS = ["steps", "numbered", "jump"];
|
|
1114
1363
|
var cx3 = (...a) => a.filter(Boolean).join(" ");
|
|
@@ -1151,10 +1400,10 @@ function Pagination({
|
|
|
1151
1400
|
onPageSizeChange
|
|
1152
1401
|
}) {
|
|
1153
1402
|
const auto = useId7();
|
|
1154
|
-
const [draft, setDraft] =
|
|
1155
|
-
const [drafting, setDrafting] =
|
|
1156
|
-
const nav =
|
|
1157
|
-
const pressed =
|
|
1403
|
+
const [draft, setDraft] = useState6("");
|
|
1404
|
+
const [drafting, setDrafting] = useState6(false);
|
|
1405
|
+
const nav = useRef9(null);
|
|
1406
|
+
const pressed = useRef9(null);
|
|
1158
1407
|
const uid = id ?? auto;
|
|
1159
1408
|
const kind = VARIANTS.includes(variant) ? variant : "steps";
|
|
1160
1409
|
const size = sizeOf(pageSize, DEFAULT_PAGE_SIZE);
|
|
@@ -1163,7 +1412,7 @@ function Pagination({
|
|
|
1163
1412
|
const rows = counted ? Math.max(0, asRows) : null;
|
|
1164
1413
|
const last = counted ? Math.max(1, Math.ceil(rows / size)) : null;
|
|
1165
1414
|
const at = counted ? Math.min(Math.max(1, int(page, 1)), last) : Math.min(Math.max(1, int(page, 1)), CAP - 1);
|
|
1166
|
-
const [draftFor, setDraftFor] =
|
|
1415
|
+
const [draftFor, setDraftFor] = useState6(at);
|
|
1167
1416
|
if (draftFor !== at) {
|
|
1168
1417
|
setDraftFor(at);
|
|
1169
1418
|
setDraft("");
|
|
@@ -1171,7 +1420,7 @@ function Pagination({
|
|
|
1171
1420
|
}
|
|
1172
1421
|
const offered = (Array.isArray(pageSizes) ? pageSizes : []).slice(0, 12).map((s) => int(s, 0)).filter((s) => s > 0);
|
|
1173
1422
|
const sizes = offered.length ? [.../* @__PURE__ */ new Set([...offered, size])].sort((a, b) => a - b) : [];
|
|
1174
|
-
|
|
1423
|
+
useEffect5(() => {
|
|
1175
1424
|
const was = pressed.current;
|
|
1176
1425
|
if (!was || loading) return;
|
|
1177
1426
|
pressed.current = null;
|
|
@@ -1200,7 +1449,7 @@ function Pagination({
|
|
|
1200
1449
|
const step = (label_, target, disabled) => (
|
|
1201
1450
|
// A control at an end is disabled and stays where it is: removing it slides
|
|
1202
1451
|
// the next control under a pointer already travelling toward it.
|
|
1203
|
-
/* @__PURE__ */
|
|
1452
|
+
/* @__PURE__ */ jsx18(
|
|
1204
1453
|
"button",
|
|
1205
1454
|
{
|
|
1206
1455
|
type: "button",
|
|
@@ -1239,14 +1488,14 @@ function Pagination({
|
|
|
1239
1488
|
if (single) {
|
|
1240
1489
|
steps = null;
|
|
1241
1490
|
} else if (!counted) {
|
|
1242
|
-
steps = /* @__PURE__ */
|
|
1491
|
+
steps = /* @__PURE__ */ jsxs14("div", { className: "ui-pager__steps", children: [
|
|
1243
1492
|
step("Prev", Math.max(1, at - 1), atStart),
|
|
1244
1493
|
step("Next", at + 1, !hasMore)
|
|
1245
1494
|
] });
|
|
1246
1495
|
} else {
|
|
1247
1496
|
let middle = null;
|
|
1248
1497
|
if (kind === "numbered") {
|
|
1249
|
-
middle = slotsFor(at, last).map((n, i) => n == null ? /* @__PURE__ */
|
|
1498
|
+
middle = slotsFor(at, last).map((n, i) => n == null ? /* @__PURE__ */ jsx18("span", { className: "ui-pager__gap", "aria-hidden": "true", children: "\u2026" }, `gap${i}`) : /* @__PURE__ */ jsx18(
|
|
1250
1499
|
"button",
|
|
1251
1500
|
{
|
|
1252
1501
|
type: "button",
|
|
@@ -1261,9 +1510,9 @@ function Pagination({
|
|
|
1261
1510
|
n
|
|
1262
1511
|
));
|
|
1263
1512
|
} else if (kind === "jump") {
|
|
1264
|
-
middle = /* @__PURE__ */
|
|
1265
|
-
/* @__PURE__ */
|
|
1266
|
-
/* @__PURE__ */
|
|
1513
|
+
middle = /* @__PURE__ */ jsxs14("span", { className: "ui-pager__jump", children: [
|
|
1514
|
+
/* @__PURE__ */ jsx18("label", { htmlFor: `${uid}-jump`, children: "Page" }),
|
|
1515
|
+
/* @__PURE__ */ jsx18(
|
|
1267
1516
|
"input",
|
|
1268
1517
|
{
|
|
1269
1518
|
className: "ui-input ui-pager__jump-input",
|
|
@@ -1286,13 +1535,13 @@ function Pagination({
|
|
|
1286
1535
|
}
|
|
1287
1536
|
}
|
|
1288
1537
|
),
|
|
1289
|
-
/* @__PURE__ */
|
|
1538
|
+
/* @__PURE__ */ jsxs14("span", { className: "ui-pager__jump-of", children: [
|
|
1290
1539
|
"of ",
|
|
1291
1540
|
fmt(last)
|
|
1292
1541
|
] })
|
|
1293
1542
|
] });
|
|
1294
1543
|
}
|
|
1295
|
-
steps = /* @__PURE__ */
|
|
1544
|
+
steps = /* @__PURE__ */ jsxs14("div", { className: "ui-pager__steps", children: [
|
|
1296
1545
|
ends ? step("First", 1, atStart) : null,
|
|
1297
1546
|
step("Prev", Math.max(1, at - 1), atStart),
|
|
1298
1547
|
middle,
|
|
@@ -1300,7 +1549,7 @@ function Pagination({
|
|
|
1300
1549
|
ends ? step("Last", last, atEnd) : null
|
|
1301
1550
|
] });
|
|
1302
1551
|
}
|
|
1303
|
-
return /* @__PURE__ */
|
|
1552
|
+
return /* @__PURE__ */ jsxs14(
|
|
1304
1553
|
"nav",
|
|
1305
1554
|
{
|
|
1306
1555
|
ref: nav,
|
|
@@ -1308,10 +1557,10 @@ function Pagination({
|
|
|
1308
1557
|
"aria-label": label,
|
|
1309
1558
|
"aria-busy": loading ? true : void 0,
|
|
1310
1559
|
children: [
|
|
1311
|
-
/* @__PURE__ */
|
|
1312
|
-
sizes.length ? /* @__PURE__ */
|
|
1313
|
-
/* @__PURE__ */
|
|
1314
|
-
/* @__PURE__ */
|
|
1560
|
+
/* @__PURE__ */ jsx18("p", { className: "ui-pager__status", "aria-live": "polite", "aria-atomic": "true", children: status }),
|
|
1561
|
+
sizes.length ? /* @__PURE__ */ jsxs14("div", { className: "ui-pager__size", children: [
|
|
1562
|
+
/* @__PURE__ */ jsx18("label", { className: "ui-pager__size-label", htmlFor: `${uid}-size`, children: "Rows" }),
|
|
1563
|
+
/* @__PURE__ */ jsx18(
|
|
1315
1564
|
"select",
|
|
1316
1565
|
{
|
|
1317
1566
|
className: "ui-select ui-pager__size-select",
|
|
@@ -1319,7 +1568,7 @@ function Pagination({
|
|
|
1319
1568
|
disabled: loading,
|
|
1320
1569
|
value: size,
|
|
1321
1570
|
onChange: (e) => onPageSizeChange?.(Number(e.target.value)),
|
|
1322
|
-
children: sizes.map((s) => /* @__PURE__ */
|
|
1571
|
+
children: sizes.map((s) => /* @__PURE__ */ jsx18("option", { value: s, children: fmt(s) }, s))
|
|
1323
1572
|
}
|
|
1324
1573
|
)
|
|
1325
1574
|
] }) : null,
|
|
@@ -1330,7 +1579,8 @@ function Pagination({
|
|
|
1330
1579
|
}
|
|
1331
1580
|
|
|
1332
1581
|
// src/DataTable.tsx
|
|
1333
|
-
import { Fragment as
|
|
1582
|
+
import { Fragment as Fragment7, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1583
|
+
var CELL_CLASS = { title: "ui-table__title", code: "ui-table__code", long: "ui-table__long", strong: "ui-table__num--strong", act: "ui-table__act" };
|
|
1334
1584
|
var NO_SORT = { key: void 0, dir: -1 };
|
|
1335
1585
|
function sortTableRows(rows, sort) {
|
|
1336
1586
|
if (sort.key === void 0) return [...rows];
|
|
@@ -1340,6 +1590,12 @@ function sortTableRows(rows, sort) {
|
|
|
1340
1590
|
function DataTable({
|
|
1341
1591
|
columns,
|
|
1342
1592
|
rows,
|
|
1593
|
+
zebra = false,
|
|
1594
|
+
hover = true,
|
|
1595
|
+
stack: stack2 = false,
|
|
1596
|
+
rowState,
|
|
1597
|
+
footer,
|
|
1598
|
+
caption,
|
|
1343
1599
|
dense = false,
|
|
1344
1600
|
density,
|
|
1345
1601
|
stickyHeader = false,
|
|
@@ -1366,14 +1622,14 @@ function DataTable({
|
|
|
1366
1622
|
hasMore = false
|
|
1367
1623
|
}) {
|
|
1368
1624
|
const scrollable = stickyHeader || pinnedIdentity;
|
|
1369
|
-
const table =
|
|
1370
|
-
const [pagerHost, setPagerHost] =
|
|
1625
|
+
const table = useRef10(null);
|
|
1626
|
+
const [pagerHost, setPagerHost] = useState7(null);
|
|
1371
1627
|
const holdPagerBox = useCallback3(
|
|
1372
1628
|
(box) => setPagerHost(box?.parentElement ?? null),
|
|
1373
1629
|
[]
|
|
1374
1630
|
);
|
|
1375
|
-
const [strip2, setStrip] =
|
|
1376
|
-
|
|
1631
|
+
const [strip2, setStrip] = useState7();
|
|
1632
|
+
useEffect6(() => {
|
|
1377
1633
|
const el = table.current;
|
|
1378
1634
|
const host = pagerHost;
|
|
1379
1635
|
if (!el || !host || typeof ResizeObserver === "undefined") {
|
|
@@ -1393,16 +1649,16 @@ function DataTable({
|
|
|
1393
1649
|
measure();
|
|
1394
1650
|
return () => observer.disconnect();
|
|
1395
1651
|
}, [pagerHost, columns, rows]);
|
|
1396
|
-
const [localSort, setLocalSort] =
|
|
1652
|
+
const [localSort, setLocalSort] = useState7(
|
|
1397
1653
|
{ key: columns.find((c) => c.sortable)?.key, dir: -1 }
|
|
1398
1654
|
);
|
|
1399
1655
|
const owned = controlledPage === void 0;
|
|
1400
1656
|
const sort = controlledSort ?? (owned ? localSort : NO_SORT);
|
|
1401
1657
|
const sortIsKnown = owned || controlledSort !== void 0;
|
|
1402
|
-
const [localPage, setLocalPage] =
|
|
1403
|
-
const [localSize, setLocalSize] =
|
|
1658
|
+
const [localPage, setLocalPage] = useState7(1);
|
|
1659
|
+
const [localSize, setLocalSize] = useState7(DEFAULT_PAGE_SIZE2);
|
|
1404
1660
|
const size = sizeOf(pageSize, owned ? localSize : rows.length || DEFAULT_PAGE_SIZE2);
|
|
1405
|
-
const [pagedSort, setPagedSort] =
|
|
1661
|
+
const [pagedSort, setPagedSort] = useState7(sort);
|
|
1406
1662
|
if (pagedSort.key !== sort.key || pagedSort.dir !== sort.dir) {
|
|
1407
1663
|
setPagedSort(sort);
|
|
1408
1664
|
setLocalPage(1);
|
|
@@ -1425,7 +1681,7 @@ function DataTable({
|
|
|
1425
1681
|
onSortChange?.(next);
|
|
1426
1682
|
toFirstPage();
|
|
1427
1683
|
};
|
|
1428
|
-
const caret = (k) => /* @__PURE__ */
|
|
1684
|
+
const caret = (k) => /* @__PURE__ */ jsx19(
|
|
1429
1685
|
"svg",
|
|
1430
1686
|
{
|
|
1431
1687
|
className: "rx-caret",
|
|
@@ -1437,70 +1693,72 @@ function DataTable({
|
|
|
1437
1693
|
strokeLinejoin: "round",
|
|
1438
1694
|
"aria-hidden": "true",
|
|
1439
1695
|
focusable: "false",
|
|
1440
|
-
children: sort.key === k ? /* @__PURE__ */
|
|
1441
|
-
/* @__PURE__ */
|
|
1442
|
-
/* @__PURE__ */
|
|
1696
|
+
children: sort.key === k ? /* @__PURE__ */ jsx19("path", { d: "m8 10 4 4 4-4" }) : /* @__PURE__ */ jsxs15(Fragment7, { children: [
|
|
1697
|
+
/* @__PURE__ */ jsx19("path", { d: "m8 9 4-4 4 4" }),
|
|
1698
|
+
/* @__PURE__ */ jsx19("path", { d: "m8 15 4 4 4-4" })
|
|
1443
1699
|
] })
|
|
1444
1700
|
}
|
|
1445
1701
|
);
|
|
1702
|
+
const Wrap = scrollable ? "div" : Fragment6;
|
|
1446
1703
|
const pageAllOn = selectable && slice.length > 0 && slice.every((r) => selected.has(r.name));
|
|
1447
1704
|
const pageSomeOn = selectable && !pageAllOn && slice.some((r) => selected.has(r.name));
|
|
1448
|
-
return /* @__PURE__ */
|
|
1449
|
-
/* @__PURE__ */
|
|
1450
|
-
"
|
|
1705
|
+
return /* @__PURE__ */ jsxs15(Fragment7, { children: [
|
|
1706
|
+
/* @__PURE__ */ jsx19(Wrap, { ...scrollable ? { className: "ui-table-scroll", role: "region", "aria-label": scrollLabel, tabIndex: 0 } : {}, children: /* @__PURE__ */ jsxs15(
|
|
1707
|
+
"table",
|
|
1451
1708
|
{
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
"aria-
|
|
1455
|
-
|
|
1456
|
-
children:
|
|
1457
|
-
"
|
|
1458
|
-
{
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1709
|
+
ref: table,
|
|
1710
|
+
className: ["ui-table", hover && "ui-table--hover", zebra && "ui-table--zebra", stack2 && "ui-table--stack", (density === "dense" || !density && dense) && "ui-table--dense", density === "compact" && "ui-table--compact", stickyHeader && "ui-table--sticky", pinnedIdentity && "ui-table--pinned"].filter(Boolean).join(" "),
|
|
1711
|
+
"aria-busy": loading || void 0,
|
|
1712
|
+
role: stack2 ? "table" : void 0,
|
|
1713
|
+
children: [
|
|
1714
|
+
caption ? /* @__PURE__ */ jsx19("caption", { className: "ui-sr", children: caption }) : null,
|
|
1715
|
+
/* @__PURE__ */ jsx19("thead", { role: stack2 ? "rowgroup" : void 0, children: /* @__PURE__ */ jsxs15("tr", { role: stack2 ? "row" : void 0, children: [
|
|
1716
|
+
selectable ? /* @__PURE__ */ jsx19("th", { scope: "col", role: stack2 ? "columnheader" : void 0, className: "ui-table__selection", children: /* @__PURE__ */ jsx19(
|
|
1717
|
+
"input",
|
|
1718
|
+
{
|
|
1719
|
+
type: "checkbox",
|
|
1720
|
+
checked: pageAllOn,
|
|
1721
|
+
"aria-label": "Select all rows on this page",
|
|
1722
|
+
ref: (input) => {
|
|
1723
|
+
if (input) input.indeterminate = pageSomeOn;
|
|
1724
|
+
},
|
|
1725
|
+
onChange: () => onTogglePage(slice.map((r) => r.name))
|
|
1726
|
+
}
|
|
1727
|
+
) }) : null,
|
|
1728
|
+
columns.map((c, columnIndex) => (
|
|
1729
|
+
// The sort control is a real <button> inside the header cell. It used to be
|
|
1730
|
+
// role="button" ON the <th>, which threw away the columnheader role and put
|
|
1731
|
+
// aria-sort on a role that forbids it.
|
|
1732
|
+
/* @__PURE__ */ jsx19(
|
|
1733
|
+
"th",
|
|
1734
|
+
{
|
|
1735
|
+
scope: "col",
|
|
1736
|
+
role: stack2 ? "columnheader" : void 0,
|
|
1737
|
+
className: [pinnedIdentity && columnIndex === 0 && "ui-table__identity", c.num && "ui-table__num", c.sortable && "rx-sortable"].filter(Boolean).join(" "),
|
|
1738
|
+
"aria-sort": sort.key === c.key ? sort.dir === 1 ? "ascending" : "descending" : c.sortable && sortIsKnown ? "none" : void 0,
|
|
1739
|
+
children: c.sortable ? (
|
|
1740
|
+
// The label is its own box so it can truncate: in a pinned
|
|
1741
|
+
// identity column on a phone the header is capped, and a bare
|
|
1742
|
+
// text node would push the caret out of the cell instead.
|
|
1743
|
+
/* @__PURE__ */ jsxs15("button", { type: "button", className: "rx-sort", onClick: () => onSort(c.key), children: [
|
|
1744
|
+
/* @__PURE__ */ jsx19("span", { className: "rx-sort__label", children: c.label }),
|
|
1745
|
+
caret(c.key)
|
|
1746
|
+
] })
|
|
1747
|
+
) : c.label
|
|
1748
|
+
},
|
|
1749
|
+
c.key
|
|
1750
|
+
)
|
|
1751
|
+
))
|
|
1752
|
+
] }) }),
|
|
1753
|
+
/* @__PURE__ */ jsxs15("tbody", { role: stack2 ? "rowgroup" : void 0, children: [
|
|
1754
|
+
!slice.length && /* @__PURE__ */ jsx19("tr", { role: stack2 ? "row" : void 0, children: /* @__PURE__ */ jsx19("td", { role: stack2 ? "cell" : void 0, colSpan: columns.length + (selectable ? 1 : 0), children: loading ? "Loading rows\u2026" : empty }) }),
|
|
1755
|
+
slice.map((r) => /* @__PURE__ */ jsxs15(
|
|
1756
|
+
"tr",
|
|
1757
|
+
{
|
|
1758
|
+
role: stack2 ? "row" : void 0,
|
|
1759
|
+
className: rowState?.(r) ? `is-${rowState(r)}` : void 0,
|
|
1760
|
+
children: [
|
|
1761
|
+
selectable ? /* @__PURE__ */ jsx19("td", { role: stack2 ? "cell" : void 0, className: "ui-table__selection", children: /* @__PURE__ */ jsx19(
|
|
1504
1762
|
"input",
|
|
1505
1763
|
{
|
|
1506
1764
|
type: "checkbox",
|
|
@@ -1509,26 +1767,41 @@ function DataTable({
|
|
|
1509
1767
|
onChange: () => onToggle(r.name)
|
|
1510
1768
|
}
|
|
1511
1769
|
) }) : null,
|
|
1512
|
-
columns.map((c, columnIndex) =>
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1770
|
+
columns.map((c, columnIndex) => {
|
|
1771
|
+
const Cell = c.rowHeader ? "th" : "td";
|
|
1772
|
+
return /* @__PURE__ */ jsx19(
|
|
1773
|
+
Cell,
|
|
1774
|
+
{
|
|
1775
|
+
scope: c.rowHeader ? "row" : void 0,
|
|
1776
|
+
role: stack2 ? c.rowHeader ? "rowheader" : "cell" : void 0,
|
|
1777
|
+
"data-label": stack2 && c.num && typeof c.label === "string" ? c.label : void 0,
|
|
1778
|
+
className: [c.num && "ui-table__num", c.cell && CELL_CLASS[c.cell], pinnedIdentity && columnIndex === 0 && "ui-table__identity", c.linked && "ui-table__linked"].filter(Boolean).join(" ") || void 0,
|
|
1779
|
+
children: c.render ? c.render(r) : String(r[c.key])
|
|
1780
|
+
},
|
|
1781
|
+
c.key
|
|
1782
|
+
);
|
|
1783
|
+
})
|
|
1784
|
+
]
|
|
1785
|
+
},
|
|
1786
|
+
r.name
|
|
1787
|
+
))
|
|
1788
|
+
] }),
|
|
1789
|
+
footer ? /* @__PURE__ */ jsx19("tfoot", { role: stack2 ? "rowgroup" : void 0, children: footer }) : null
|
|
1790
|
+
]
|
|
1518
1791
|
}
|
|
1519
|
-
),
|
|
1792
|
+
) }),
|
|
1520
1793
|
pager ? (
|
|
1521
1794
|
// The strip that pages a table may not be wider than the rows it pages (#504).
|
|
1522
1795
|
// The two are siblings, and no selector sizes one to the other, so the width is
|
|
1523
1796
|
// measured: a cap rather than a width, so a pager wider than the table wraps
|
|
1524
1797
|
// inside it and a table wider than the room still leaves the strip in the room.
|
|
1525
|
-
/* @__PURE__ */
|
|
1798
|
+
/* @__PURE__ */ jsx19(
|
|
1526
1799
|
"div",
|
|
1527
1800
|
{
|
|
1528
1801
|
className: "rx-table-pager",
|
|
1529
1802
|
ref: holdPagerBox,
|
|
1530
1803
|
style: strip2 ? { maxWidth: strip2.width, marginInlineStart: strip2.inset || void 0 } : void 0,
|
|
1531
|
-
children: /* @__PURE__ */
|
|
1804
|
+
children: /* @__PURE__ */ jsx19(
|
|
1532
1805
|
Pagination,
|
|
1533
1806
|
{
|
|
1534
1807
|
page,
|
|
@@ -1556,7 +1829,7 @@ function DataTable({
|
|
|
1556
1829
|
import { PAGE_SIZES as KIT_PAGE_SIZES, DEFAULT_PAGE_SIZE as KIT_DEFAULT_PAGE_SIZE } from "@apliteni/apliteni-ui";
|
|
1557
1830
|
|
|
1558
1831
|
// src/Loading.tsx
|
|
1559
|
-
import { jsx as
|
|
1832
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1560
1833
|
var cx4 = (...a) => a.filter(Boolean).join(" ");
|
|
1561
1834
|
function Skeleton({ lines = 3, width, height, radius, className }) {
|
|
1562
1835
|
const widths = Array.isArray(lines) ? lines : null;
|
|
@@ -1566,19 +1839,19 @@ function Skeleton({ lines = 3, width, height, radius, className }) {
|
|
|
1566
1839
|
if (!w && !height && !radius) return void 0;
|
|
1567
1840
|
return { ...w && { width: w }, ...height && { height }, ...radius && { borderRadius: radius } };
|
|
1568
1841
|
};
|
|
1569
|
-
return /* @__PURE__ */
|
|
1842
|
+
return /* @__PURE__ */ jsx20("div", { className: cx4("ui-skel", className), "aria-hidden": "true", children: Array.from({ length: n }, (_, i) => /* @__PURE__ */ jsx20("span", { className: "ui-skel__bar m-skeleton", style: styleFor(i) }, i)) });
|
|
1570
1843
|
}
|
|
1571
1844
|
function SkeletonTable({ rows = 5, cols = 4, head = true }) {
|
|
1572
|
-
const cells = Array.from({ length: Math.max(1, cols) }, (_, i) => /* @__PURE__ */
|
|
1573
|
-
return /* @__PURE__ */
|
|
1845
|
+
const cells = Array.from({ length: Math.max(1, cols) }, (_, i) => /* @__PURE__ */ jsx20("span", { className: "ui-skel__bar m-skeleton" }, i));
|
|
1846
|
+
return /* @__PURE__ */ jsxs16(
|
|
1574
1847
|
"div",
|
|
1575
1848
|
{
|
|
1576
1849
|
className: "ui-skel ui-skel--table",
|
|
1577
1850
|
style: { "--skel-cols": Math.max(1, cols) },
|
|
1578
1851
|
"aria-hidden": "true",
|
|
1579
1852
|
children: [
|
|
1580
|
-
head && /* @__PURE__ */
|
|
1581
|
-
Array.from({ length: Math.max(1, rows) }, (_, i) => /* @__PURE__ */
|
|
1853
|
+
head && /* @__PURE__ */ jsx20("div", { className: "ui-skel__row ui-skel__row--head", children: cells }),
|
|
1854
|
+
Array.from({ length: Math.max(1, rows) }, (_, i) => /* @__PURE__ */ jsx20("div", { className: "ui-skel__row", children: cells }, i))
|
|
1582
1855
|
]
|
|
1583
1856
|
}
|
|
1584
1857
|
);
|
|
@@ -1591,7 +1864,7 @@ function BusyRegion({
|
|
|
1591
1864
|
className,
|
|
1592
1865
|
children
|
|
1593
1866
|
}) {
|
|
1594
|
-
return /* @__PURE__ */
|
|
1867
|
+
return /* @__PURE__ */ jsxs16(
|
|
1595
1868
|
"div",
|
|
1596
1869
|
{
|
|
1597
1870
|
className: cx4("ui-busy", className),
|
|
@@ -1599,8 +1872,8 @@ function BusyRegion({
|
|
|
1599
1872
|
"aria-live": "polite",
|
|
1600
1873
|
"aria-busy": busy,
|
|
1601
1874
|
children: [
|
|
1602
|
-
/* @__PURE__ */
|
|
1603
|
-
/* @__PURE__ */
|
|
1875
|
+
/* @__PURE__ */ jsx20("span", { className: "ui-sr", children: busy ? label : message }),
|
|
1876
|
+
/* @__PURE__ */ jsx20("div", { className: "ui-busy__body", children: busy ? placeholder ?? /* @__PURE__ */ jsx20(Skeleton, { lines: 3 }) : children })
|
|
1604
1877
|
]
|
|
1605
1878
|
}
|
|
1606
1879
|
);
|
|
@@ -1613,27 +1886,27 @@ function Denied({
|
|
|
1613
1886
|
className,
|
|
1614
1887
|
children
|
|
1615
1888
|
}) {
|
|
1616
|
-
return /* @__PURE__ */
|
|
1617
|
-
/* @__PURE__ */
|
|
1618
|
-
/* @__PURE__ */
|
|
1619
|
-
sub && /* @__PURE__ */
|
|
1620
|
-
need && /* @__PURE__ */
|
|
1889
|
+
return /* @__PURE__ */ jsxs16("div", { className: cx4("ui-denied", className), children: [
|
|
1890
|
+
/* @__PURE__ */ jsx20("div", { className: "ui-denied__seal", children: /* @__PURE__ */ jsx20(Icon, { name: icon8 }) }),
|
|
1891
|
+
/* @__PURE__ */ jsx20("div", { className: "ui-denied__title", children: title }),
|
|
1892
|
+
sub && /* @__PURE__ */ jsx20("div", { className: "ui-denied__sub", children: sub }),
|
|
1893
|
+
need && /* @__PURE__ */ jsxs16("div", { className: "ui-denied__need", children: [
|
|
1621
1894
|
"Needs ",
|
|
1622
|
-
/* @__PURE__ */
|
|
1895
|
+
/* @__PURE__ */ jsx20("code", { className: "ui-code", children: need })
|
|
1623
1896
|
] }),
|
|
1624
|
-
children && /* @__PURE__ */
|
|
1897
|
+
children && /* @__PURE__ */ jsx20("div", { className: "ui-denied__actions", children })
|
|
1625
1898
|
] });
|
|
1626
1899
|
}
|
|
1627
1900
|
|
|
1628
1901
|
// src/DatePicker.tsx
|
|
1629
1902
|
import {
|
|
1630
1903
|
useCallback as useCallback4,
|
|
1631
|
-
useEffect as
|
|
1904
|
+
useEffect as useEffect7,
|
|
1632
1905
|
useMemo as useMemo3,
|
|
1633
|
-
useRef as
|
|
1634
|
-
useState as
|
|
1906
|
+
useRef as useRef11,
|
|
1907
|
+
useState as useState8
|
|
1635
1908
|
} from "react";
|
|
1636
|
-
import { jsx as
|
|
1909
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1637
1910
|
var cx5 = (...a) => a.filter(Boolean).join(" ");
|
|
1638
1911
|
var pad = (n) => String(n).padStart(2, "0");
|
|
1639
1912
|
var DAY_MS = 864e5;
|
|
@@ -1642,8 +1915,8 @@ var MONTH_RE = /^(\d{4})-(\d{2})$/;
|
|
|
1642
1915
|
var DAY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
1643
1916
|
var PHONE_MAX = 560;
|
|
1644
1917
|
function usePhone() {
|
|
1645
|
-
const [phone, setPhone] =
|
|
1646
|
-
|
|
1918
|
+
const [phone, setPhone] = useState8(false);
|
|
1919
|
+
useEffect7(() => {
|
|
1647
1920
|
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX}px)`);
|
|
1648
1921
|
if (!query) return;
|
|
1649
1922
|
const read = () => setPhone(query.matches);
|
|
@@ -1738,14 +2011,14 @@ function DatePicker({
|
|
|
1738
2011
|
const picksRange = mode === "range" || mode === "day-range";
|
|
1739
2012
|
const phone = usePhone();
|
|
1740
2013
|
const asSheet = sheet ?? phone;
|
|
1741
|
-
const root =
|
|
1742
|
-
const trigger =
|
|
1743
|
-
const grid =
|
|
1744
|
-
const [selfOpen, setSelfOpen] =
|
|
2014
|
+
const root = useRef11(null);
|
|
2015
|
+
const trigger = useRef11(null);
|
|
2016
|
+
const grid = useRef11(null);
|
|
2017
|
+
const [selfOpen, setSelfOpen] = useState8(defaultOpen);
|
|
1745
2018
|
const open = openProp ?? selfOpen;
|
|
1746
|
-
const [selfValue, setSelfValue] =
|
|
2019
|
+
const [selfValue, setSelfValue] = useState8(defaultValue);
|
|
1747
2020
|
const picked = value !== void 0 ? value : selfValue;
|
|
1748
|
-
const [selfRange, setSelfRange] =
|
|
2021
|
+
const [selfRange, setSelfRange] = useState8(defaultRange ?? { start: null, end: null });
|
|
1749
2022
|
const span = range !== void 0 ? range : selfRange;
|
|
1750
2023
|
const names = useMemo3(() => ({
|
|
1751
2024
|
month: new Intl.DateTimeFormat(locale, { month: "long", timeZone: "UTC" }),
|
|
@@ -1776,20 +2049,20 @@ function DatePicker({
|
|
|
1776
2049
|
return grain === "month" ? monthOf(now) : now;
|
|
1777
2050
|
}, [today, grain]);
|
|
1778
2051
|
const anchor = toIndex(picked, grain) ?? toIndex(picksRange ? span.start ?? span.end : null, grain) ?? todayIndex;
|
|
1779
|
-
const [cursor, setCursor] =
|
|
1780
|
-
const land =
|
|
2052
|
+
const [cursor, setCursor] = useState8(() => clamp(anchor, lo, hi));
|
|
2053
|
+
const land = useRef11(false);
|
|
1781
2054
|
const setOpen = useCallback4((next) => {
|
|
1782
2055
|
if (openProp === void 0) setSelfOpen(next);
|
|
1783
2056
|
onOpenChange?.(next);
|
|
1784
2057
|
}, [openProp, onOpenChange]);
|
|
1785
|
-
const close =
|
|
2058
|
+
const close = useRef11(setOpen);
|
|
1786
2059
|
useIsoLayoutEffect(() => {
|
|
1787
2060
|
close.current = setOpen;
|
|
1788
2061
|
});
|
|
1789
|
-
|
|
2062
|
+
useEffect7(() => {
|
|
1790
2063
|
if (open) setCursor(clamp(anchor, lo, hi));
|
|
1791
2064
|
}, [open]);
|
|
1792
|
-
|
|
2065
|
+
useEffect7(() => {
|
|
1793
2066
|
if (!open || asSheet) return;
|
|
1794
2067
|
const doc = root.current?.ownerDocument ?? document;
|
|
1795
2068
|
const onClick = (e) => {
|
|
@@ -1951,10 +2224,10 @@ function DatePicker({
|
|
|
1951
2224
|
}
|
|
1952
2225
|
const noneBefore = lo != null && first <= lo;
|
|
1953
2226
|
const noneAfter = hi != null && last >= hi;
|
|
1954
|
-
const calendar = /* @__PURE__ */
|
|
1955
|
-
picksRange && presets?.length ? /* @__PURE__ */
|
|
2227
|
+
const calendar = /* @__PURE__ */ jsxs17("div", { className: cx5("ui-datepicker__body", asSheet && "is-sheet"), children: [
|
|
2228
|
+
picksRange && presets?.length ? /* @__PURE__ */ jsx21("div", { className: "ui-datepicker__presets", role: "group", "aria-label": "Period shortcuts", children: presets.map((preset) => {
|
|
1956
2229
|
const within = allowed(preset);
|
|
1957
|
-
return /* @__PURE__ */
|
|
2230
|
+
return /* @__PURE__ */ jsx21(
|
|
1958
2231
|
"button",
|
|
1959
2232
|
{
|
|
1960
2233
|
type: "button",
|
|
@@ -1966,9 +2239,9 @@ function DatePicker({
|
|
|
1966
2239
|
preset.label
|
|
1967
2240
|
);
|
|
1968
2241
|
}) }) : null,
|
|
1969
|
-
/* @__PURE__ */
|
|
1970
|
-
/* @__PURE__ */
|
|
1971
|
-
/* @__PURE__ */
|
|
2242
|
+
/* @__PURE__ */ jsxs17("div", { className: "ui-datepicker__calendar", children: [
|
|
2243
|
+
/* @__PURE__ */ jsxs17("div", { className: "ui-datepicker__head", children: [
|
|
2244
|
+
/* @__PURE__ */ jsx21(
|
|
1972
2245
|
"button",
|
|
1973
2246
|
{
|
|
1974
2247
|
type: "button",
|
|
@@ -1976,11 +2249,11 @@ function DatePicker({
|
|
|
1976
2249
|
"aria-label": stepBack,
|
|
1977
2250
|
disabled: noneBefore,
|
|
1978
2251
|
onClick: () => stepPage(-1),
|
|
1979
|
-
children: /* @__PURE__ */
|
|
2252
|
+
children: /* @__PURE__ */ jsx21(Icon, { name: "chevronLeft" })
|
|
1980
2253
|
}
|
|
1981
2254
|
),
|
|
1982
|
-
/* @__PURE__ */
|
|
1983
|
-
/* @__PURE__ */
|
|
2255
|
+
/* @__PURE__ */ jsx21("span", { className: "ui-datepicker__caption", "aria-live": "polite", children: caption }),
|
|
2256
|
+
/* @__PURE__ */ jsx21(
|
|
1984
2257
|
"button",
|
|
1985
2258
|
{
|
|
1986
2259
|
type: "button",
|
|
@@ -1988,11 +2261,11 @@ function DatePicker({
|
|
|
1988
2261
|
"aria-label": stepOn,
|
|
1989
2262
|
disabled: noneAfter,
|
|
1990
2263
|
onClick: () => stepPage(1),
|
|
1991
|
-
children: /* @__PURE__ */
|
|
2264
|
+
children: /* @__PURE__ */ jsx21(Icon, { name: "chevronRight" })
|
|
1992
2265
|
}
|
|
1993
2266
|
)
|
|
1994
2267
|
] }),
|
|
1995
|
-
/* @__PURE__ */
|
|
2268
|
+
/* @__PURE__ */ jsxs17(
|
|
1996
2269
|
"div",
|
|
1997
2270
|
{
|
|
1998
2271
|
className: cx5("ui-datepicker__grid", grain === "day" && "is-days"),
|
|
@@ -2001,7 +2274,7 @@ function DatePicker({
|
|
|
2001
2274
|
ref: grid,
|
|
2002
2275
|
onKeyDown: onGridKeyDown,
|
|
2003
2276
|
children: [
|
|
2004
|
-
weekdays.length > 0 && /* @__PURE__ */
|
|
2277
|
+
weekdays.length > 0 && /* @__PURE__ */ jsx21("div", { className: "ui-datepicker__row", role: "row", children: weekdays.map((weekday) => /* @__PURE__ */ jsx21(
|
|
2005
2278
|
"span",
|
|
2006
2279
|
{
|
|
2007
2280
|
className: "ui-datepicker__weekday",
|
|
@@ -2011,13 +2284,13 @@ function DatePicker({
|
|
|
2011
2284
|
},
|
|
2012
2285
|
weekday.long
|
|
2013
2286
|
)) }),
|
|
2014
|
-
rows.map((cellsInRow, r) => /* @__PURE__ */
|
|
2287
|
+
rows.map((cellsInRow, r) => /* @__PURE__ */ jsx21("div", { className: "ui-datepicker__row", role: "row", children: cellsInRow.map((cell, c) => cell ? /* @__PURE__ */ jsx21(
|
|
2015
2288
|
"span",
|
|
2016
2289
|
{
|
|
2017
2290
|
className: "ui-datepicker__cell",
|
|
2018
2291
|
role: "gridcell",
|
|
2019
2292
|
"aria-selected": isPicked(cell.index),
|
|
2020
|
-
children: /* @__PURE__ */
|
|
2293
|
+
children: /* @__PURE__ */ jsx21(
|
|
2021
2294
|
"button",
|
|
2022
2295
|
{
|
|
2023
2296
|
type: "button",
|
|
@@ -2036,12 +2309,12 @@ function DatePicker({
|
|
|
2036
2309
|
"aria-label": state(cell),
|
|
2037
2310
|
onClick: () => pick(cell),
|
|
2038
2311
|
onFocus: () => setCursor(cell.index),
|
|
2039
|
-
children: /* @__PURE__ */
|
|
2312
|
+
children: /* @__PURE__ */ jsx21("span", { className: "ui-datepicker__num", children: cell.label })
|
|
2040
2313
|
}
|
|
2041
2314
|
)
|
|
2042
2315
|
},
|
|
2043
2316
|
cell.period
|
|
2044
|
-
) : /* @__PURE__ */
|
|
2317
|
+
) : /* @__PURE__ */ jsx21("span", { className: "ui-datepicker__cell is-empty", role: "gridcell" }, `e${r}-${c}`)) }, `r${r}`))
|
|
2045
2318
|
]
|
|
2046
2319
|
}
|
|
2047
2320
|
)
|
|
@@ -2051,8 +2324,8 @@ function DatePicker({
|
|
|
2051
2324
|
// `open` on the root whichever form the panel takes, so the trigger's
|
|
2052
2325
|
// chevron flips for the sheet as it does for the popover. The panel rules
|
|
2053
2326
|
// it also switches on have no panel to find while the sheet is up.
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
/* @__PURE__ */
|
|
2327
|
+
/* @__PURE__ */ jsxs17("div", { className: cx5("ui-dropdown", "ui-datepicker", open && "open"), ref: root, children: [
|
|
2328
|
+
/* @__PURE__ */ jsxs17(
|
|
2056
2329
|
"button",
|
|
2057
2330
|
{
|
|
2058
2331
|
type: "button",
|
|
@@ -2068,8 +2341,8 @@ function DatePicker({
|
|
|
2068
2341
|
setOpen(!open);
|
|
2069
2342
|
},
|
|
2070
2343
|
children: [
|
|
2071
|
-
/* @__PURE__ */
|
|
2072
|
-
/* @__PURE__ */
|
|
2344
|
+
/* @__PURE__ */ jsx21("span", { className: "ui-dropdown__value", children: shown ?? empty }),
|
|
2345
|
+
/* @__PURE__ */ jsx21("span", { className: "ui-dropdown__chevron", "aria-hidden": "true" })
|
|
2073
2346
|
]
|
|
2074
2347
|
}
|
|
2075
2348
|
),
|
|
@@ -2080,8 +2353,8 @@ function DatePicker({
|
|
|
2080
2353
|
// without taking the sheet's affordances left a phone reader with no
|
|
2081
2354
|
// visible way out and a Tab that walked into the live page behind it.
|
|
2082
2355
|
// why: guidelines/drawer.md
|
|
2083
|
-
/* @__PURE__ */
|
|
2084
|
-
) : /* @__PURE__ */
|
|
2356
|
+
/* @__PURE__ */ jsx21(Drawer, { open, side: "bottom", size: "md", title: name, onClose: () => setOpen(false), children: calendar })
|
|
2357
|
+
) : /* @__PURE__ */ jsx21(
|
|
2085
2358
|
"div",
|
|
2086
2359
|
{
|
|
2087
2360
|
className: cx5("ui-dropdown__panel", "ui-datepicker__panel", align === "end" && "is-end"),
|
|
@@ -2098,13 +2371,13 @@ function DatePicker({
|
|
|
2098
2371
|
|
|
2099
2372
|
// src/Dropdown.tsx
|
|
2100
2373
|
import {
|
|
2101
|
-
Fragment as
|
|
2374
|
+
Fragment as Fragment8,
|
|
2102
2375
|
useCallback as useCallback5,
|
|
2103
2376
|
useContext as useContext2,
|
|
2104
|
-
useEffect as
|
|
2377
|
+
useEffect as useEffect8,
|
|
2105
2378
|
useId as useId8,
|
|
2106
|
-
useRef as
|
|
2107
|
-
useState as
|
|
2379
|
+
useRef as useRef12,
|
|
2380
|
+
useState as useState9
|
|
2108
2381
|
} from "react";
|
|
2109
2382
|
import {
|
|
2110
2383
|
icon as icon4,
|
|
@@ -2126,7 +2399,7 @@ import { createContext as createContext2 } from "react";
|
|
|
2126
2399
|
var FieldContext = createContext2(null);
|
|
2127
2400
|
|
|
2128
2401
|
// src/Dropdown.tsx
|
|
2129
|
-
import { Fragment as
|
|
2402
|
+
import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2130
2403
|
var EXIT_SLACK_MS2 = 50;
|
|
2131
2404
|
var SETTLE_MS = 450;
|
|
2132
2405
|
var inPanel = (node) => {
|
|
@@ -2135,7 +2408,7 @@ var inPanel = (node) => {
|
|
|
2135
2408
|
};
|
|
2136
2409
|
var cx6 = (...a) => a.filter(Boolean).join(" ");
|
|
2137
2410
|
var isRow = (it) => Boolean(it) && it !== "---" && !it.separator;
|
|
2138
|
-
var Glyph2 = ({ name, className, hidden }) => /* @__PURE__ */
|
|
2411
|
+
var Glyph2 = ({ name, className, hidden }) => /* @__PURE__ */ jsx22(
|
|
2139
2412
|
"span",
|
|
2140
2413
|
{
|
|
2141
2414
|
className,
|
|
@@ -2148,7 +2421,7 @@ function RowBadge({ badge }) {
|
|
|
2148
2421
|
const given = typeof badge === "string" ? "" : badge.tone || "";
|
|
2149
2422
|
let tone = given || (/^live$/i.test(String(text2)) ? "live" : "neutral");
|
|
2150
2423
|
if (!given && tone === "neutral" && /^(?:off|unset|disabled|archive|archived)$/i.test(text2)) tone = "state";
|
|
2151
|
-
return /* @__PURE__ */
|
|
2424
|
+
return /* @__PURE__ */ jsx22("span", { className: `ui-dropdown__badge is-${tone}`, children: text2 });
|
|
2152
2425
|
}
|
|
2153
2426
|
var keyOf = (it) => it.value != null ? `v:${it.value}` : `l:${it.label}`;
|
|
2154
2427
|
var itemsIn = (panel) => Array.from(panel?.querySelectorAll("[data-dd-item]") ?? []).filter((el) => el.getAttribute("aria-disabled") !== "true" && !el.hidden);
|
|
@@ -2192,18 +2465,18 @@ function Dropdown({
|
|
|
2192
2465
|
onSelect,
|
|
2193
2466
|
row
|
|
2194
2467
|
}) {
|
|
2195
|
-
const [selfOpen, setSelfOpen] =
|
|
2468
|
+
const [selfOpen, setSelfOpen] = useState9(defaultOpen);
|
|
2196
2469
|
const open = openProp ?? selfOpen;
|
|
2197
|
-
const [pick, setPick] =
|
|
2198
|
-
const [query, setQuery] =
|
|
2199
|
-
const [activeKey, setActiveKey] =
|
|
2200
|
-
const root =
|
|
2201
|
-
const panel =
|
|
2202
|
-
const trigger =
|
|
2203
|
-
const field =
|
|
2204
|
-
const landOn =
|
|
2205
|
-
const revealed =
|
|
2206
|
-
const at =
|
|
2470
|
+
const [pick, setPick] = useState9(null);
|
|
2471
|
+
const [query, setQuery] = useState9(() => search && search !== true ? search.query || "" : "");
|
|
2472
|
+
const [activeKey, setActiveKey] = useState9(null);
|
|
2473
|
+
const root = useRef12(null);
|
|
2474
|
+
const panel = useRef12(null);
|
|
2475
|
+
const trigger = useRef12(null);
|
|
2476
|
+
const field = useRef12(null);
|
|
2477
|
+
const landOn = useRef12(null);
|
|
2478
|
+
const revealed = useRef12(false);
|
|
2479
|
+
const at = useRef12("");
|
|
2207
2480
|
const auto = useId8().replace(/:/g, "");
|
|
2208
2481
|
const uid = id ?? auto;
|
|
2209
2482
|
const inField = useContext2(FieldContext);
|
|
@@ -2212,7 +2485,7 @@ function Dropdown({
|
|
|
2212
2485
|
if (openProp === void 0) setSelfOpen(next);
|
|
2213
2486
|
onOpenChange?.(next);
|
|
2214
2487
|
}, [openProp, onOpenChange]);
|
|
2215
|
-
const close =
|
|
2488
|
+
const close = useRef12(setOpen);
|
|
2216
2489
|
useIsoLayoutEffect(() => {
|
|
2217
2490
|
close.current = setOpen;
|
|
2218
2491
|
});
|
|
@@ -2265,7 +2538,7 @@ function Dropdown({
|
|
|
2265
2538
|
stop.forEach((off) => off());
|
|
2266
2539
|
};
|
|
2267
2540
|
}, [open]);
|
|
2268
|
-
const opened =
|
|
2541
|
+
const opened = useRef12(false);
|
|
2269
2542
|
useIsoLayoutEffect(() => {
|
|
2270
2543
|
const el = panel.current;
|
|
2271
2544
|
if (open) {
|
|
@@ -2312,7 +2585,7 @@ function Dropdown({
|
|
|
2312
2585
|
const given = rows.find((it) => it.selected);
|
|
2313
2586
|
const givenKey = given ? keyOf(given) : null;
|
|
2314
2587
|
const pickedKey = pick && pick.against === givenKey ? pick.key : null;
|
|
2315
|
-
|
|
2588
|
+
useEffect8(() => {
|
|
2316
2589
|
if (pick && pick.against !== givenKey) setPick(null);
|
|
2317
2590
|
}, [givenKey, pick]);
|
|
2318
2591
|
const picked = pickedKey != null ? rows.find((it) => keyOf(it) === pickedKey) : void 0;
|
|
@@ -2328,7 +2601,7 @@ function Dropdown({
|
|
|
2328
2601
|
const rowIds = /* @__PURE__ */ new Map();
|
|
2329
2602
|
rows.forEach((it, i) => rowIds.set(it, `${uid}-opt-${i}`));
|
|
2330
2603
|
const listId = `${uid}-list`;
|
|
2331
|
-
|
|
2604
|
+
useEffect8(() => {
|
|
2332
2605
|
if (!open) return;
|
|
2333
2606
|
const mine = () => close.current(false);
|
|
2334
2607
|
for (const other of [...openNow]) other();
|
|
@@ -2337,7 +2610,7 @@ function Dropdown({
|
|
|
2337
2610
|
openNow.delete(mine);
|
|
2338
2611
|
};
|
|
2339
2612
|
}, [open]);
|
|
2340
|
-
|
|
2613
|
+
useEffect8(() => {
|
|
2341
2614
|
if (!open) return;
|
|
2342
2615
|
const doc = root.current?.ownerDocument ?? document;
|
|
2343
2616
|
const onClick = (e) => {
|
|
@@ -2567,7 +2840,7 @@ function Dropdown({
|
|
|
2567
2840
|
};
|
|
2568
2841
|
function renderRow(entry, key) {
|
|
2569
2842
|
if (!isRow(entry)) {
|
|
2570
|
-
return /* @__PURE__ */
|
|
2843
|
+
return /* @__PURE__ */ jsx22("div", { className: "ui-dropdown__sep", role: "separator", hidden: filtering || void 0 }, key);
|
|
2571
2844
|
}
|
|
2572
2845
|
const disabled2 = !!entry.disabled;
|
|
2573
2846
|
const selected = selectedOf(entry);
|
|
@@ -2589,23 +2862,23 @@ function Dropdown({
|
|
|
2589
2862
|
...asLink ? { href: entry.href, ...entry.target ? { target: entry.target } : null } : null,
|
|
2590
2863
|
...sx ? { id: rowIds.get(entry), hidden: hiddenBy(entry) || void 0 } : null,
|
|
2591
2864
|
onClick: (e) => choose(entry, e),
|
|
2592
|
-
children: /* @__PURE__ */
|
|
2593
|
-
entry.avatar ? /* @__PURE__ */
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2596
|
-
entry.description && /* @__PURE__ */
|
|
2865
|
+
children: /* @__PURE__ */ jsxs18(Fragment9, { children: [
|
|
2866
|
+
entry.avatar ? /* @__PURE__ */ jsx22(Avatar, { personKey: entry.avatar.key, name: entry.avatar.name, src: entry.avatar.src, empty: entry.avatar.empty }) : entry.icon && /* @__PURE__ */ jsx22(Glyph2, { name: entry.icon, className: "ui-dropdown__ic" }),
|
|
2867
|
+
/* @__PURE__ */ jsxs18("span", { className: "ui-dropdown__main", children: [
|
|
2868
|
+
/* @__PURE__ */ jsx22("span", { className: "ui-dropdown__label", children: entry.label }),
|
|
2869
|
+
entry.description && /* @__PURE__ */ jsx22("span", { className: "ui-dropdown__desc", children: entry.description })
|
|
2597
2870
|
] }),
|
|
2598
|
-
entry.badge ? /* @__PURE__ */
|
|
2599
|
-
asOption && /* @__PURE__ */
|
|
2871
|
+
entry.badge ? /* @__PURE__ */ jsx22(RowBadge, { badge: entry.badge }) : null,
|
|
2872
|
+
asOption && /* @__PURE__ */ jsx22(Glyph2, { name: "check", className: "ui-dropdown__tick", hidden: true })
|
|
2600
2873
|
] })
|
|
2601
2874
|
};
|
|
2602
|
-
if (row) return /* @__PURE__ */
|
|
2875
|
+
if (row) return /* @__PURE__ */ jsx22(Fragment8, { children: row(entry, props) }, key);
|
|
2603
2876
|
const Tag = asLink ? "a" : "div";
|
|
2604
|
-
return /* @__PURE__ */
|
|
2877
|
+
return /* @__PURE__ */ jsx22(Tag, { ...props }, key);
|
|
2605
2878
|
}
|
|
2606
2879
|
const body = sections?.length ? sections.map((section, si) => {
|
|
2607
2880
|
const gone = filtering && !(section.items || []).some((it) => isRow(it) && !hiddenBy(it));
|
|
2608
|
-
return /* @__PURE__ */
|
|
2881
|
+
return /* @__PURE__ */ jsxs18(
|
|
2609
2882
|
"div",
|
|
2610
2883
|
{
|
|
2611
2884
|
className: "ui-dropdown__section",
|
|
@@ -2613,7 +2886,7 @@ function Dropdown({
|
|
|
2613
2886
|
"aria-label": section.label || void 0,
|
|
2614
2887
|
hidden: gone || void 0,
|
|
2615
2888
|
children: [
|
|
2616
|
-
section.label && /* @__PURE__ */
|
|
2889
|
+
section.label && /* @__PURE__ */ jsx22("div", { className: "ui-dropdown__group", role: "presentation", children: section.label }),
|
|
2617
2890
|
(section.items || []).map((entry, i) => renderRow(entry, `s${si}-${i}`))
|
|
2618
2891
|
]
|
|
2619
2892
|
},
|
|
@@ -2621,12 +2894,12 @@ function Dropdown({
|
|
|
2621
2894
|
);
|
|
2622
2895
|
}) : (items || []).map((entry, i) => renderRow(entry, `i${i}`));
|
|
2623
2896
|
const cap = scroll && scroll !== true ? { "--ui-dropdown-cap": typeof scroll === "number" ? `${scroll}px` : scroll } : void 0;
|
|
2624
|
-
const none = sx && filtering && !visible.length ? /* @__PURE__ */
|
|
2625
|
-
/* @__PURE__ */
|
|
2626
|
-
/* @__PURE__ */
|
|
2897
|
+
const none = sx && filtering && !visible.length ? /* @__PURE__ */ jsxs18(Fragment9, { children: [
|
|
2898
|
+
/* @__PURE__ */ jsx22("span", { className: "ui-dropdown__none-title", children: sx.empty.replace("{q}", () => query.trim()) }),
|
|
2899
|
+
/* @__PURE__ */ jsx22("span", { className: "ui-dropdown__none-hint", children: sx.hint })
|
|
2627
2900
|
] }) : null;
|
|
2628
|
-
return /* @__PURE__ */
|
|
2629
|
-
/* @__PURE__ */
|
|
2901
|
+
return /* @__PURE__ */ jsxs18("div", { className: cx6("ui-dropdown", open && "open"), id, ref: root, onKeyDown, children: [
|
|
2902
|
+
/* @__PURE__ */ jsxs18(
|
|
2630
2903
|
"button",
|
|
2631
2904
|
{
|
|
2632
2905
|
type: "button",
|
|
@@ -2646,16 +2919,16 @@ function Dropdown({
|
|
|
2646
2919
|
setOpen(!open);
|
|
2647
2920
|
},
|
|
2648
2921
|
children: [
|
|
2649
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */
|
|
2650
|
-
marked2 && (chosen?.avatar ? /* @__PURE__ */
|
|
2651
|
-
label && /* @__PURE__ */
|
|
2652
|
-
/* @__PURE__ */
|
|
2922
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ jsxs18(Fragment9, { children: [
|
|
2923
|
+
marked2 && (chosen?.avatar ? /* @__PURE__ */ jsx22(Avatar, { personKey: chosen.avatar.key, name: chosen.avatar.name, src: chosen.avatar.src, empty: chosen.avatar.empty }) : /* @__PURE__ */ jsx22(Avatar, { empty: true })),
|
|
2924
|
+
label && /* @__PURE__ */ jsx22("span", { className: "ui-dropdown__pre", children: label }),
|
|
2925
|
+
/* @__PURE__ */ jsx22("span", { className: cx6("ui-dropdown__value", marked2 && !chosen && "is-placeholder"), children: shown != null ? shown : placeholder })
|
|
2653
2926
|
] }),
|
|
2654
|
-
chevron && /* @__PURE__ */
|
|
2927
|
+
chevron && /* @__PURE__ */ jsx22("span", { className: "ui-dropdown__chevron", "aria-hidden": "true" })
|
|
2655
2928
|
]
|
|
2656
2929
|
}
|
|
2657
2930
|
),
|
|
2658
|
-
/* @__PURE__ */
|
|
2931
|
+
/* @__PURE__ */ jsxs18(
|
|
2659
2932
|
"div",
|
|
2660
2933
|
{
|
|
2661
2934
|
className: cx6(
|
|
@@ -2676,10 +2949,10 @@ function Dropdown({
|
|
|
2676
2949
|
onMouseMove,
|
|
2677
2950
|
children: [
|
|
2678
2951
|
header,
|
|
2679
|
-
sx ? /* @__PURE__ */
|
|
2680
|
-
/* @__PURE__ */
|
|
2681
|
-
/* @__PURE__ */
|
|
2682
|
-
/* @__PURE__ */
|
|
2952
|
+
sx ? /* @__PURE__ */ jsxs18(Fragment9, { children: [
|
|
2953
|
+
/* @__PURE__ */ jsxs18("div", { className: "ui-dropdown__search", children: [
|
|
2954
|
+
/* @__PURE__ */ jsx22(Glyph2, { name: "search", className: "ui-dropdown__search-ic", hidden: true }),
|
|
2955
|
+
/* @__PURE__ */ jsx22(
|
|
2683
2956
|
"input",
|
|
2684
2957
|
{
|
|
2685
2958
|
className: "ui-dropdown__search-input",
|
|
@@ -2703,8 +2976,8 @@ function Dropdown({
|
|
|
2703
2976
|
}
|
|
2704
2977
|
)
|
|
2705
2978
|
] }),
|
|
2706
|
-
/* @__PURE__ */
|
|
2707
|
-
/* @__PURE__ */
|
|
2979
|
+
/* @__PURE__ */ jsx22("div", { className: "ui-dropdown__list", role: "listbox", id: listId, "aria-label": name, style: cap, children: body }),
|
|
2980
|
+
/* @__PURE__ */ jsx22(
|
|
2708
2981
|
"div",
|
|
2709
2982
|
{
|
|
2710
2983
|
className: "ui-dropdown__none",
|
|
@@ -2729,7 +3002,7 @@ function strip(o) {
|
|
|
2729
3002
|
}
|
|
2730
3003
|
|
|
2731
3004
|
// src/BackLink.tsx
|
|
2732
|
-
import { jsx as
|
|
3005
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2733
3006
|
var BARE = "Back";
|
|
2734
3007
|
var SCRIPTED = /^javascript:/i;
|
|
2735
3008
|
var LEADING = /^[\u0000-\u0020]+/;
|
|
@@ -2748,7 +3021,7 @@ function BackLink({
|
|
|
2748
3021
|
const name = text(label).replace(SAID, "");
|
|
2749
3022
|
const bare = !name || name.toLowerCase() === BARE.toLowerCase();
|
|
2750
3023
|
const Tag = as ?? "a";
|
|
2751
|
-
return /* @__PURE__ */
|
|
3024
|
+
return /* @__PURE__ */ jsxs19(
|
|
2752
3025
|
Tag,
|
|
2753
3026
|
{
|
|
2754
3027
|
className: ["ui-back", className].filter(Boolean).join(" "),
|
|
@@ -2756,8 +3029,8 @@ function BackLink({
|
|
|
2756
3029
|
"aria-label": bare ? void 0 : `${BARE} to ${name}`,
|
|
2757
3030
|
...rest,
|
|
2758
3031
|
children: [
|
|
2759
|
-
/* @__PURE__ */
|
|
2760
|
-
/* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ jsx23(Icon, { name: "chevronLeft" }),
|
|
3033
|
+
/* @__PURE__ */ jsx23("span", { className: "ui-back__label", children: bare ? BARE : name })
|
|
2761
3034
|
]
|
|
2762
3035
|
}
|
|
2763
3036
|
);
|
|
@@ -2765,41 +3038,41 @@ function BackLink({
|
|
|
2765
3038
|
|
|
2766
3039
|
// src/TableValues.tsx
|
|
2767
3040
|
import { formatNumericValue, formatDeltaValue } from "@apliteni/apliteni-ui";
|
|
2768
|
-
import { jsx as
|
|
3041
|
+
import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2769
3042
|
function NumericValue(props) {
|
|
2770
3043
|
const value = formatNumericValue(props);
|
|
2771
|
-
return /* @__PURE__ */
|
|
3044
|
+
return /* @__PURE__ */ jsx24("span", { children: /* @__PURE__ */ jsxs20("span", { className: "ui-value", "aria-label": value.missing, children: [
|
|
2772
3045
|
value.text,
|
|
2773
|
-
value.unit && /* @__PURE__ */
|
|
3046
|
+
value.unit && /* @__PURE__ */ jsx24("span", { className: "ui-value__unit", children: value.unit })
|
|
2774
3047
|
] }) });
|
|
2775
3048
|
}
|
|
2776
3049
|
function DeltaValue(props) {
|
|
2777
3050
|
const value = formatDeltaValue(props);
|
|
2778
|
-
return /* @__PURE__ */
|
|
3051
|
+
return /* @__PURE__ */ jsx24("span", { children: /* @__PURE__ */ jsx24("span", { className: value.className, "aria-describedby": value.basisId || void 0, children: value.text }) });
|
|
2779
3052
|
}
|
|
2780
3053
|
function RowIdentity({ symbol, name, logo, href }) {
|
|
2781
3054
|
const Tag = href ? "a" : "span";
|
|
2782
|
-
return /* @__PURE__ */
|
|
2783
|
-
/* @__PURE__ */
|
|
2784
|
-
/* @__PURE__ */
|
|
2785
|
-
logo && /* @__PURE__ */
|
|
3055
|
+
return /* @__PURE__ */ jsxs20(Tag, { className: "ui-identity", href, children: [
|
|
3056
|
+
/* @__PURE__ */ jsxs20("span", { className: "ui-identity__logo", "aria-hidden": "true", children: [
|
|
3057
|
+
/* @__PURE__ */ jsx24("span", { children: symbol.slice(0, 1) }),
|
|
3058
|
+
logo && /* @__PURE__ */ jsx24("img", { src: logo, alt: "", onLoad: (e) => {
|
|
2786
3059
|
e.currentTarget.hidden = false;
|
|
2787
3060
|
}, onError: (e) => {
|
|
2788
3061
|
e.currentTarget.hidden = true;
|
|
2789
3062
|
} })
|
|
2790
3063
|
] }),
|
|
2791
|
-
/* @__PURE__ */
|
|
2792
|
-
/* @__PURE__ */
|
|
3064
|
+
/* @__PURE__ */ jsx24("span", { className: "ui-identity__symbol", children: symbol }),
|
|
3065
|
+
/* @__PURE__ */ jsx24("span", { className: "ui-identity__name", children: name })
|
|
2793
3066
|
] });
|
|
2794
3067
|
}
|
|
2795
3068
|
|
|
2796
3069
|
// src/Segmented.tsx
|
|
2797
3070
|
import { segmentedNextIndex } from "@apliteni/apliteni-ui";
|
|
2798
|
-
import { jsx as
|
|
3071
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
2799
3072
|
function Segmented({ options, value, onChange, label, appearance = "pill", size, block = false, disabled = false }) {
|
|
2800
3073
|
const enabled = options.filter((o) => !o.disabled);
|
|
2801
3074
|
const tabValue = enabled.some((o) => o.value === value) ? value : enabled[0]?.value;
|
|
2802
|
-
return /* @__PURE__ */
|
|
3075
|
+
return /* @__PURE__ */ jsx25("div", { className: `ui-seg${size === "sm" ? " ui-seg--sm" : ""}${block ? " ui-seg--block" : ""}${appearance === "underline" ? " ui-seg--underline" : ""}`, role: "toolbar", "aria-label": label, children: options.map((option) => /* @__PURE__ */ jsx25(
|
|
2803
3076
|
"button",
|
|
2804
3077
|
{
|
|
2805
3078
|
type: "button",
|
|
@@ -2825,17 +3098,17 @@ function Segmented({ options, value, onChange, label, appearance = "pill", size,
|
|
|
2825
3098
|
}
|
|
2826
3099
|
|
|
2827
3100
|
// src/FilterBar.tsx
|
|
2828
|
-
import { useRef as
|
|
3101
|
+
import { useRef as useRef13, useState as useState10 } from "react";
|
|
2829
3102
|
import { filterChipText, filterChipName, filterChipUnset, filterChipItems, focusNextStop } from "@apliteni/apliteni-ui";
|
|
2830
|
-
import { Fragment as
|
|
3103
|
+
import { Fragment as Fragment10, jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2831
3104
|
var SEARCH_AT = 10;
|
|
2832
3105
|
var isRow2 = (entry) => entry !== "---" && !entry.separator;
|
|
2833
3106
|
function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clearVariant = "ghost", add, addLabel = "Filter", disabled = false, busy = false, onRemove, onClear, onChange, onAdd }) {
|
|
2834
|
-
const bar =
|
|
2835
|
-
const focused =
|
|
2836
|
-
const landing =
|
|
2837
|
-
const [opened, setOpened] =
|
|
2838
|
-
const [adding, setAdding] =
|
|
3107
|
+
const bar = useRef13(null);
|
|
3108
|
+
const focused = useRef13(null);
|
|
3109
|
+
const landing = useRef13(null);
|
|
3110
|
+
const [opened, setOpened] = useState10({});
|
|
3111
|
+
const [adding, setAdding] = useState10(false);
|
|
2839
3112
|
const blocked = disabled || busy;
|
|
2840
3113
|
const offer = (add || []).filter((entry) => !filters.some((filter) => filter.id === entry.id));
|
|
2841
3114
|
const source = /* @__PURE__ */ new Map();
|
|
@@ -2870,7 +3143,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2870
3143
|
if (target) target.focus();
|
|
2871
3144
|
else focusNextStop(bar.current);
|
|
2872
3145
|
});
|
|
2873
|
-
return /* @__PURE__ */
|
|
3146
|
+
return /* @__PURE__ */ jsx26("div", { children: /* @__PURE__ */ jsxs21(
|
|
2874
3147
|
"fieldset",
|
|
2875
3148
|
{
|
|
2876
3149
|
ref: bar,
|
|
@@ -2883,8 +3156,8 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2883
3156
|
if (event.relatedTarget && !event.currentTarget.contains(event.relatedTarget)) focused.current = null;
|
|
2884
3157
|
},
|
|
2885
3158
|
children: [
|
|
2886
|
-
/* @__PURE__ */
|
|
2887
|
-
filters.map((filter, index) => /* @__PURE__ */
|
|
3159
|
+
/* @__PURE__ */ jsx26("legend", { className: "ui-filter-bar__legend", children: label }),
|
|
3160
|
+
filters.map((filter, index) => /* @__PURE__ */ jsxs21(
|
|
2888
3161
|
"fieldset",
|
|
2889
3162
|
{
|
|
2890
3163
|
className: "ui-filter-bar__chip",
|
|
@@ -2894,14 +3167,14 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2894
3167
|
focused.current = { id: filter.id, index };
|
|
2895
3168
|
},
|
|
2896
3169
|
children: [
|
|
2897
|
-
/* @__PURE__ */
|
|
2898
|
-
/* @__PURE__ */
|
|
3170
|
+
/* @__PURE__ */ jsx26("legend", { className: "ui-filter-bar__legend", children: filter.label }),
|
|
3171
|
+
/* @__PURE__ */ jsx26(
|
|
2899
3172
|
Dropdown,
|
|
2900
3173
|
{
|
|
2901
3174
|
items: filterChipItems(filter),
|
|
2902
3175
|
variant: "select",
|
|
2903
3176
|
ariaLabel: filterChipName(filter),
|
|
2904
|
-
triggerContent: /* @__PURE__ */
|
|
3177
|
+
triggerContent: /* @__PURE__ */ jsx26("span", { className: filterChipUnset(filter) ? "ui-dropdown__value is-placeholder" : "ui-dropdown__value", children: filterChipText(filter) }),
|
|
2905
3178
|
open: !blocked && !filter.disabled && (opened[filter.id] && opened[filter.id].against === filter.open ? opened[filter.id].open : !!filter.open),
|
|
2906
3179
|
onOpenChange: (open) => setOpened((previous) => ({ ...previous, [filter.id]: { open, against: filter.open } })),
|
|
2907
3180
|
onSelect: (value) => {
|
|
@@ -2909,7 +3182,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2909
3182
|
}
|
|
2910
3183
|
}
|
|
2911
3184
|
),
|
|
2912
|
-
/* @__PURE__ */
|
|
3185
|
+
/* @__PURE__ */ jsx26(
|
|
2913
3186
|
"button",
|
|
2914
3187
|
{
|
|
2915
3188
|
type: "button",
|
|
@@ -2926,16 +3199,16 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2926
3199
|
},
|
|
2927
3200
|
filter.id
|
|
2928
3201
|
)),
|
|
2929
|
-
offering && /* @__PURE__ */
|
|
3202
|
+
offering && /* @__PURE__ */ jsx26("div", { "data-filter-add": "", onFocus: () => {
|
|
2930
3203
|
focused.current = null;
|
|
2931
|
-
}, children: /* @__PURE__ */
|
|
3204
|
+
}, children: /* @__PURE__ */ jsx26(
|
|
2932
3205
|
Dropdown,
|
|
2933
3206
|
{
|
|
2934
3207
|
variant: "menu",
|
|
2935
3208
|
sections,
|
|
2936
3209
|
ariaLabel: addLabel,
|
|
2937
|
-
triggerContent: /* @__PURE__ */
|
|
2938
|
-
/* @__PURE__ */
|
|
3210
|
+
triggerContent: /* @__PURE__ */ jsxs21(Fragment10, { children: [
|
|
3211
|
+
/* @__PURE__ */ jsx26(Icon, { name: "plus" }),
|
|
2939
3212
|
addLabel
|
|
2940
3213
|
] }),
|
|
2941
3214
|
search: options >= SEARCH_AT && { label: `Search ${label.toLowerCase()}` },
|
|
@@ -2949,9 +3222,9 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2949
3222
|
}
|
|
2950
3223
|
}
|
|
2951
3224
|
) }),
|
|
2952
|
-
filters.length > 0 && /* @__PURE__ */
|
|
3225
|
+
filters.length > 0 && /* @__PURE__ */ jsx26("span", { "data-filter-clear": "", onFocus: () => {
|
|
2953
3226
|
focused.current = { id: null, index: 0 };
|
|
2954
|
-
}, children: /* @__PURE__ */
|
|
3227
|
+
}, children: /* @__PURE__ */ jsx26(Button, { size: "sm", variant: clearVariant, onClick: () => {
|
|
2955
3228
|
if (!blocked) onClear();
|
|
2956
3229
|
}, children: clearLabel }) })
|
|
2957
3230
|
]
|
|
@@ -2960,37 +3233,37 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2960
3233
|
}
|
|
2961
3234
|
|
|
2962
3235
|
// src/KeyValueList.tsx
|
|
2963
|
-
import { jsx as
|
|
3236
|
+
import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2964
3237
|
function detail({ value, redacted }) {
|
|
2965
|
-
if (redacted) return /* @__PURE__ */
|
|
2966
|
-
/* @__PURE__ */
|
|
3238
|
+
if (redacted) return /* @__PURE__ */ jsxs22("span", { className: "ui-kv__hidden", children: [
|
|
3239
|
+
/* @__PURE__ */ jsx27(Icon, { name: "eyeOff" }),
|
|
2967
3240
|
"Hidden"
|
|
2968
3241
|
] });
|
|
2969
3242
|
if (value == null) return "\u2014";
|
|
2970
3243
|
return typeof value === "boolean" ? String(value) : value;
|
|
2971
3244
|
}
|
|
2972
3245
|
function KeyValueList({ rows, columns = 1, className, ...rest }) {
|
|
2973
|
-
return /* @__PURE__ */
|
|
2974
|
-
/* @__PURE__ */
|
|
2975
|
-
/* @__PURE__ */
|
|
3246
|
+
return /* @__PURE__ */ jsx27("dl", { ...rest, className: ["ui-kv", columns === 2 && "ui-kv--two-columns", className].filter(Boolean).join(" "), children: rows.map((row, index) => /* @__PURE__ */ jsxs22("div", { className: "ui-drawer__row", children: [
|
|
3247
|
+
/* @__PURE__ */ jsx27("dt", { children: row.label }),
|
|
3248
|
+
/* @__PURE__ */ jsx27("dd", { children: detail(row) })
|
|
2976
3249
|
] }, index)) });
|
|
2977
3250
|
}
|
|
2978
3251
|
function DrawerSection({ title, headingLevel = 3, className, children, ...rest }) {
|
|
2979
3252
|
const Heading = `h${headingLevel}`;
|
|
2980
|
-
return /* @__PURE__ */
|
|
2981
|
-
title != null && /* @__PURE__ */
|
|
3253
|
+
return /* @__PURE__ */ jsxs22("section", { ...rest, className: ["ui-drawer__section", className].filter(Boolean).join(" "), children: [
|
|
3254
|
+
title != null && /* @__PURE__ */ jsx27(Heading, { className: "ui-drawer__section-title", children: title }),
|
|
2982
3255
|
children
|
|
2983
3256
|
] });
|
|
2984
3257
|
}
|
|
2985
3258
|
|
|
2986
3259
|
// src/Snippet.tsx
|
|
2987
|
-
import { useEffect as
|
|
2988
|
-
import { Fragment as
|
|
3260
|
+
import { useEffect as useEffect9, useRef as useRef14, useState as useState11 } from "react";
|
|
3261
|
+
import { Fragment as Fragment11, jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2989
3262
|
function Snippet({ label = "shell", code = "", children, copy = true, reveal = false, copyLabel = "Copy code" }) {
|
|
2990
|
-
const [status, setStatus] =
|
|
2991
|
-
const request =
|
|
2992
|
-
const timer =
|
|
2993
|
-
|
|
3263
|
+
const [status, setStatus] = useState11("idle");
|
|
3264
|
+
const request = useRef14(0);
|
|
3265
|
+
const timer = useRef14(void 0);
|
|
3266
|
+
useEffect9(() => {
|
|
2994
3267
|
setStatus("idle");
|
|
2995
3268
|
return () => {
|
|
2996
3269
|
request.current++;
|
|
@@ -3010,11 +3283,11 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
3010
3283
|
if (current === request.current) setStatus("failed");
|
|
3011
3284
|
}
|
|
3012
3285
|
}
|
|
3013
|
-
return /* @__PURE__ */
|
|
3014
|
-
/* @__PURE__ */
|
|
3015
|
-
/* @__PURE__ */
|
|
3016
|
-
copy && /* @__PURE__ */
|
|
3017
|
-
/* @__PURE__ */
|
|
3286
|
+
return /* @__PURE__ */ jsxs23("div", { className: reveal ? "ui-snippet ui-snippet--reveal" : "ui-snippet", children: [
|
|
3287
|
+
/* @__PURE__ */ jsxs23("div", { className: "ui-snippet__bar", children: [
|
|
3288
|
+
/* @__PURE__ */ jsx28("span", { children: label }),
|
|
3289
|
+
copy && /* @__PURE__ */ jsxs23(Fragment11, { children: [
|
|
3290
|
+
/* @__PURE__ */ jsx28(
|
|
3018
3291
|
"button",
|
|
3019
3292
|
{
|
|
3020
3293
|
type: "button",
|
|
@@ -3022,31 +3295,31 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
3022
3295
|
"aria-label": copyLabel,
|
|
3023
3296
|
title: copyLabel,
|
|
3024
3297
|
onClick: handleCopy,
|
|
3025
|
-
children: /* @__PURE__ */
|
|
3298
|
+
children: /* @__PURE__ */ jsx28(Icon, { name: status === "idle" ? "copy" : "check" })
|
|
3026
3299
|
}
|
|
3027
3300
|
),
|
|
3028
|
-
/* @__PURE__ */
|
|
3301
|
+
/* @__PURE__ */ jsx28("span", { className: "ui-sr ui-snippet__status", role: "status", "aria-live": "polite", children: status === "copied" ? "Copied" : status === "failed" ? "Copy failed" : "" })
|
|
3029
3302
|
] })
|
|
3030
3303
|
] }),
|
|
3031
|
-
/* @__PURE__ */
|
|
3304
|
+
/* @__PURE__ */ jsx28("pre", { children: children ?? code })
|
|
3032
3305
|
] });
|
|
3033
3306
|
}
|
|
3034
3307
|
|
|
3035
3308
|
// src/Tabs.tsx
|
|
3036
|
-
import { useEffect as
|
|
3309
|
+
import { useEffect as useEffect10, useId as useId9, useRef as useRef15 } from "react";
|
|
3037
3310
|
import { playEntrance } from "@apliteni/apliteni-ui/motion";
|
|
3038
|
-
import { Fragment as
|
|
3311
|
+
import { Fragment as Fragment12, jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3039
3312
|
function Tabs({ items, value, onChange, label }) {
|
|
3040
3313
|
const id = useId9();
|
|
3041
|
-
const previous =
|
|
3042
|
-
const activePanel =
|
|
3043
|
-
const buttons =
|
|
3044
|
-
|
|
3314
|
+
const previous = useRef15(value);
|
|
3315
|
+
const activePanel = useRef15(null);
|
|
3316
|
+
const buttons = useRef15([]);
|
|
3317
|
+
useEffect10(() => {
|
|
3045
3318
|
if (previous.current !== value) playEntrance(activePanel.current);
|
|
3046
3319
|
previous.current = value;
|
|
3047
3320
|
}, [value]);
|
|
3048
|
-
return /* @__PURE__ */
|
|
3049
|
-
/* @__PURE__ */
|
|
3321
|
+
return /* @__PURE__ */ jsxs24("div", { className: "ui-tabs", children: [
|
|
3322
|
+
/* @__PURE__ */ jsx29("div", { className: "ui-tabs__list", role: "tablist", "aria-label": label, children: items.map((item, i) => /* @__PURE__ */ jsxs24(
|
|
3050
3323
|
"button",
|
|
3051
3324
|
{
|
|
3052
3325
|
type: "button",
|
|
@@ -3084,7 +3357,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3084
3357
|
},
|
|
3085
3358
|
children: [
|
|
3086
3359
|
item.label,
|
|
3087
|
-
item.count != null && /* @__PURE__ */
|
|
3360
|
+
item.count != null && /* @__PURE__ */ jsxs24(Fragment12, { children: [
|
|
3088
3361
|
" ",
|
|
3089
3362
|
item.count
|
|
3090
3363
|
] })
|
|
@@ -3092,7 +3365,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3092
3365
|
},
|
|
3093
3366
|
item.value
|
|
3094
3367
|
)) }),
|
|
3095
|
-
/* @__PURE__ */
|
|
3368
|
+
/* @__PURE__ */ jsx29("div", { className: "ui-tabs__panels", children: items.map((item, i) => /* @__PURE__ */ jsx29(
|
|
3096
3369
|
"div",
|
|
3097
3370
|
{
|
|
3098
3371
|
className: "ui-tabs__panel",
|
|
@@ -3110,14 +3383,14 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3110
3383
|
}
|
|
3111
3384
|
|
|
3112
3385
|
// src/Timeline.tsx
|
|
3113
|
-
import { useEffect as
|
|
3386
|
+
import { useEffect as useEffect11, useRef as useRef16 } from "react";
|
|
3114
3387
|
import { playEntrance as playEntrance2, prefersReducedMotion } from "@apliteni/apliteni-ui/motion";
|
|
3115
|
-
import { jsx as
|
|
3388
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3116
3389
|
var kindIcons = { person: "user", rule: "bolt", reversal: "refresh" };
|
|
3117
3390
|
function Timeline({ events, className, ...rest }) {
|
|
3118
|
-
const previousIds =
|
|
3119
|
-
const rows =
|
|
3120
|
-
|
|
3391
|
+
const previousIds = useRef16(new Set(events.map((event) => event.id)));
|
|
3392
|
+
const rows = useRef16(/* @__PURE__ */ new Map());
|
|
3393
|
+
useEffect11(() => {
|
|
3121
3394
|
if (previousIds.current.size > 0 && !prefersReducedMotion()) {
|
|
3122
3395
|
for (const event of events) {
|
|
3123
3396
|
if (previousIds.current.has(event.id)) continue;
|
|
@@ -3129,7 +3402,7 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3129
3402
|
}
|
|
3130
3403
|
previousIds.current = new Set(events.map((event) => event.id));
|
|
3131
3404
|
}, [events]);
|
|
3132
|
-
return /* @__PURE__ */
|
|
3405
|
+
return /* @__PURE__ */ jsx30("ol", { ...rest, role: "list", className: ["ui-timeline", events.some((event) => event.kind) && "ui-timeline--kinds", className].filter(Boolean).join(" "), children: events.map((event, index) => /* @__PURE__ */ jsxs25(
|
|
3133
3406
|
"li",
|
|
3134
3407
|
{
|
|
3135
3408
|
className: "ui-timeline__event",
|
|
@@ -3138,20 +3411,20 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3138
3411
|
else rows.current.delete(event.id);
|
|
3139
3412
|
},
|
|
3140
3413
|
children: [
|
|
3141
|
-
/* @__PURE__ */
|
|
3414
|
+
/* @__PURE__ */ jsx30("span", { "aria-hidden": "true", className: [
|
|
3142
3415
|
"ui-timeline__marker",
|
|
3143
3416
|
event.kind && "ui-timeline__marker--kind",
|
|
3144
3417
|
event.kind === "reversal" && "ui-timeline__marker--reversal"
|
|
3145
|
-
].filter(Boolean).join(" "), children: event.kind && /* @__PURE__ */
|
|
3146
|
-
/* @__PURE__ */
|
|
3147
|
-
/* @__PURE__ */
|
|
3148
|
-
/* @__PURE__ */
|
|
3149
|
-
index === events.length - 1 && event.relativeTimestamp && /* @__PURE__ */
|
|
3418
|
+
].filter(Boolean).join(" "), children: event.kind && /* @__PURE__ */ jsx30(Icon, { name: kindIcons[event.kind] }) }),
|
|
3419
|
+
/* @__PURE__ */ jsxs25("div", { className: "ui-timeline__head", children: [
|
|
3420
|
+
/* @__PURE__ */ jsx30("span", { className: "ui-timeline__actor", children: event.actor }),
|
|
3421
|
+
/* @__PURE__ */ jsx30("time", { dateTime: event.dateTime, children: event.timestamp }),
|
|
3422
|
+
index === events.length - 1 && event.relativeTimestamp && /* @__PURE__ */ jsx30("span", { className: "ui-timeline__relative", children: event.relativeTimestamp })
|
|
3150
3423
|
] }),
|
|
3151
|
-
/* @__PURE__ */
|
|
3152
|
-
(event.meta != null || event.undo) && /* @__PURE__ */
|
|
3153
|
-
event.meta != null && /* @__PURE__ */
|
|
3154
|
-
event.undo && /* @__PURE__ */
|
|
3424
|
+
/* @__PURE__ */ jsx30("p", { className: "ui-timeline__description", children: event.description }),
|
|
3425
|
+
(event.meta != null || event.undo) && /* @__PURE__ */ jsxs25("div", { className: "ui-timeline__meta", children: [
|
|
3426
|
+
event.meta != null && /* @__PURE__ */ jsx30("span", { children: event.meta }),
|
|
3427
|
+
event.undo && /* @__PURE__ */ jsx30(Button, { variant: "ghost", size: "xs", className: "ui-btn ui-btn--ghost ui-btn--xs ui-timeline__undo", "aria-label": event.undo.label, onClick: event.undo.onUndo, children: "Undo" })
|
|
3155
3428
|
] })
|
|
3156
3429
|
]
|
|
3157
3430
|
},
|
|
@@ -3160,20 +3433,20 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3160
3433
|
}
|
|
3161
3434
|
|
|
3162
3435
|
// src/Field.tsx
|
|
3163
|
-
import { forwardRef as forwardRef6, useEffect as
|
|
3436
|
+
import { forwardRef as forwardRef6, useEffect as useEffect12, useId as useId10, useRef as useRef17, useState as useState12 } from "react";
|
|
3164
3437
|
import { esc, icon as icon5 } from "@apliteni/apliteni-ui";
|
|
3165
|
-
import { jsx as
|
|
3438
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3166
3439
|
function messages(id, hint, error) {
|
|
3167
3440
|
return [error && `${id}-error`, hint && `${id}-hint`].filter(Boolean).join(" ") || void 0;
|
|
3168
3441
|
}
|
|
3169
3442
|
function Frame({ id, labelId, label, hint, error, required, children }) {
|
|
3170
|
-
return /* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
3443
|
+
return /* @__PURE__ */ jsxs26("div", { className: "ui-field", children: [
|
|
3444
|
+
/* @__PURE__ */ jsxs26("label", { className: "ui-field__label", id: labelId, htmlFor: id, children: [
|
|
3172
3445
|
label,
|
|
3173
|
-
required && /* @__PURE__ */
|
|
3446
|
+
required && /* @__PURE__ */ jsx31("span", { className: "ui-field__req", "aria-hidden": "true", children: "*" })
|
|
3174
3447
|
] }),
|
|
3175
3448
|
children,
|
|
3176
|
-
error && /* @__PURE__ */
|
|
3449
|
+
error && /* @__PURE__ */ jsx31(
|
|
3177
3450
|
"div",
|
|
3178
3451
|
{
|
|
3179
3452
|
id: `${id}-error`,
|
|
@@ -3182,7 +3455,7 @@ function Frame({ id, labelId, label, hint, error, required, children }) {
|
|
|
3182
3455
|
dangerouslySetInnerHTML: { __html: icon5("alert") + esc(error) }
|
|
3183
3456
|
}
|
|
3184
3457
|
),
|
|
3185
|
-
hint && /* @__PURE__ */
|
|
3458
|
+
hint && /* @__PURE__ */ jsx31("div", { id: `${id}-hint`, className: "ui-field__hint", children: hint })
|
|
3186
3459
|
] });
|
|
3187
3460
|
}
|
|
3188
3461
|
function wiring(id, hint, error) {
|
|
@@ -3192,13 +3465,13 @@ function Field({ id: suppliedId, label, hint, error, required, children }) {
|
|
|
3192
3465
|
const generatedId = useId10();
|
|
3193
3466
|
const id = suppliedId ?? generatedId;
|
|
3194
3467
|
const labelId = `${id}-label`;
|
|
3195
|
-
return /* @__PURE__ */
|
|
3468
|
+
return /* @__PURE__ */ jsx31(Frame, { ...{ id, labelId, label, hint, error, required }, children: /* @__PURE__ */ jsx31(FieldContext.Provider, { value: { id, labelId }, children: children({ ...wiring(id, hint, error), required }) }) });
|
|
3196
3469
|
}
|
|
3197
3470
|
var TextField = forwardRef6(function TextField2({ label, hint, error, required, type = "text", unit, icon: glyph, className = "", ...props }, ref) {
|
|
3198
3471
|
const id = useId10();
|
|
3199
3472
|
const hasUnit = type === "number" && !!unit;
|
|
3200
3473
|
const describedBy = [messages(id, hint, error), hasUnit ? `${id}-unit` : ""].filter(Boolean).join(" ") || void 0;
|
|
3201
|
-
const control = /* @__PURE__ */
|
|
3474
|
+
const control = /* @__PURE__ */ jsx31(
|
|
3202
3475
|
"input",
|
|
3203
3476
|
{
|
|
3204
3477
|
ref,
|
|
@@ -3211,19 +3484,19 @@ var TextField = forwardRef6(function TextField2({ label, hint, error, required,
|
|
|
3211
3484
|
className: `ui-input${error ? " is-invalid" : ""} ${className}`
|
|
3212
3485
|
}
|
|
3213
3486
|
);
|
|
3214
|
-
const unitSpan = hasUnit ? /* @__PURE__ */
|
|
3215
|
-
return /* @__PURE__ */
|
|
3216
|
-
/* @__PURE__ */
|
|
3487
|
+
const unitSpan = hasUnit ? /* @__PURE__ */ jsx31("span", { id: `${id}-unit`, className: "ui-field-number__unit", children: unit }) : null;
|
|
3488
|
+
return /* @__PURE__ */ jsx31(Frame, { ...{ id, label, hint, error, required }, children: glyph ? /* @__PURE__ */ jsxs26("div", { className: `ui-input-group${hasUnit ? " ui-field-number" : ""}`, children: [
|
|
3489
|
+
/* @__PURE__ */ jsx31("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon5(glyph) } }),
|
|
3217
3490
|
control,
|
|
3218
3491
|
unitSpan
|
|
3219
|
-
] }) : hasUnit ? /* @__PURE__ */
|
|
3492
|
+
] }) : hasUnit ? /* @__PURE__ */ jsxs26("div", { className: "ui-field-number", children: [
|
|
3220
3493
|
control,
|
|
3221
3494
|
unitSpan
|
|
3222
3495
|
] }) : control });
|
|
3223
3496
|
});
|
|
3224
3497
|
function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
3225
3498
|
const id = useId10();
|
|
3226
|
-
return /* @__PURE__ */
|
|
3499
|
+
return /* @__PURE__ */ jsx31(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx31(
|
|
3227
3500
|
"textarea",
|
|
3228
3501
|
{
|
|
3229
3502
|
rows: 4,
|
|
@@ -3236,7 +3509,7 @@ function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
|
3236
3509
|
}
|
|
3237
3510
|
function SelectField({ label, hint, error, required, className = "", children, ...props }) {
|
|
3238
3511
|
const id = useId10();
|
|
3239
|
-
return /* @__PURE__ */
|
|
3512
|
+
return /* @__PURE__ */ jsx31(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx31(
|
|
3240
3513
|
"select",
|
|
3241
3514
|
{
|
|
3242
3515
|
...props,
|
|
@@ -3249,10 +3522,10 @@ function SelectField({ label, hint, error, required, className = "", children, .
|
|
|
3249
3522
|
}
|
|
3250
3523
|
function FileField({ label, hint, error, required, disabled, onFileChange, className = "", ...props }) {
|
|
3251
3524
|
const id = useId10();
|
|
3252
|
-
const input =
|
|
3253
|
-
const [file, setFile] =
|
|
3254
|
-
const [dragging, setDragging] =
|
|
3255
|
-
|
|
3525
|
+
const input = useRef17(null);
|
|
3526
|
+
const [file, setFile] = useState12(null);
|
|
3527
|
+
const [dragging, setDragging] = useState12(false);
|
|
3528
|
+
useEffect12(() => {
|
|
3256
3529
|
const form = input.current?.form;
|
|
3257
3530
|
const reset = () => {
|
|
3258
3531
|
setFile(null);
|
|
@@ -3265,7 +3538,7 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3265
3538
|
setFile(next);
|
|
3266
3539
|
onFileChange?.(next);
|
|
3267
3540
|
};
|
|
3268
|
-
return /* @__PURE__ */
|
|
3541
|
+
return /* @__PURE__ */ jsx31(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsxs26(
|
|
3269
3542
|
"div",
|
|
3270
3543
|
{
|
|
3271
3544
|
className: `ui-file${dragging && !disabled ? " is-dragging" : ""}${file ? " has-file" : ""}${error ? " is-invalid" : ""}${disabled ? " is-disabled" : ""}`,
|
|
@@ -3286,12 +3559,12 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3286
3559
|
update(transfer.files[0]);
|
|
3287
3560
|
},
|
|
3288
3561
|
children: [
|
|
3289
|
-
/* @__PURE__ */
|
|
3290
|
-
/* @__PURE__ */
|
|
3291
|
-
/* @__PURE__ */
|
|
3292
|
-
/* @__PURE__ */
|
|
3293
|
-
/* @__PURE__ */
|
|
3294
|
-
/* @__PURE__ */
|
|
3562
|
+
/* @__PURE__ */ jsx31("span", { className: "ui-file__glyph", children: /* @__PURE__ */ jsx31(Icon, { name: "upload" }) }),
|
|
3563
|
+
/* @__PURE__ */ jsx31("div", { "aria-live": "polite", children: file ? file.name : "Drop a file here" }),
|
|
3564
|
+
/* @__PURE__ */ jsx31("div", { children: "or choose one from your device" }),
|
|
3565
|
+
/* @__PURE__ */ jsxs26("span", { className: "ui-file__choose", children: [
|
|
3566
|
+
/* @__PURE__ */ jsx31("span", { className: "ui-btn ui-btn--secondary ui-btn--sm", "aria-hidden": "true", "aria-disabled": disabled || void 0, children: file ? "Replace file" : "Choose file" }),
|
|
3567
|
+
/* @__PURE__ */ jsx31(
|
|
3295
3568
|
"input",
|
|
3296
3569
|
{
|
|
3297
3570
|
...props,
|
|
@@ -3311,11 +3584,11 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3311
3584
|
}
|
|
3312
3585
|
|
|
3313
3586
|
// src/FileDrop.tsx
|
|
3314
|
-
import { useRef as
|
|
3587
|
+
import { useRef as useRef18, useState as useState13 } from "react";
|
|
3315
3588
|
|
|
3316
3589
|
// src/EmptyState.tsx
|
|
3317
|
-
import { icon as
|
|
3318
|
-
import { jsx as
|
|
3590
|
+
import { icon as kitIcon3, illo } from "@apliteni/apliteni-ui";
|
|
3591
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3319
3592
|
var cases = {
|
|
3320
3593
|
"first-run": { title: "Nothing needs you yet", sub: "New items will appear here when they need your attention.", icon: "check" },
|
|
3321
3594
|
"no-matches": { title: "No results in this view", sub: "Try another search or clear your filters.", icon: "search" },
|
|
@@ -3327,16 +3600,16 @@ function EmptyState({ variant = "first-run", title, sub, icon: icon8, art, actio
|
|
|
3327
3600
|
const heading = title ?? preset.title;
|
|
3328
3601
|
const guidance = sub ?? preset.sub;
|
|
3329
3602
|
const glyph = icon8 ?? preset.icon;
|
|
3330
|
-
return /* @__PURE__ */
|
|
3331
|
-
art ? typeof art === "string" ? /* @__PURE__ */
|
|
3332
|
-
heading && /* @__PURE__ */
|
|
3333
|
-
guidance && /* @__PURE__ */
|
|
3334
|
-
actions && /* @__PURE__ */
|
|
3603
|
+
return /* @__PURE__ */ jsxs27("div", { className: "ui-empty", children: [
|
|
3604
|
+
art ? typeof art === "string" ? /* @__PURE__ */ jsx32("div", { className: "ui-empty__art", dangerouslySetInnerHTML: { __html: /<svg/.test(art) ? art : illo(art) } }) : /* @__PURE__ */ jsx32("div", { className: "ui-empty__art", "aria-hidden": "true", children: art }) : glyph ? /* @__PURE__ */ jsx32("div", { className: "ui-empty__icon", dangerouslySetInnerHTML: { __html: kitIcon3(glyph) } }) : null,
|
|
3605
|
+
heading && /* @__PURE__ */ jsx32("div", { className: "ui-empty__title", children: heading }),
|
|
3606
|
+
guidance && /* @__PURE__ */ jsx32("div", { className: "ui-empty__sub", children: guidance }),
|
|
3607
|
+
actions && /* @__PURE__ */ jsx32("div", { className: "ui-empty__actions", children: actions })
|
|
3335
3608
|
] });
|
|
3336
3609
|
}
|
|
3337
3610
|
|
|
3338
3611
|
// src/FileDrop.tsx
|
|
3339
|
-
import { Fragment as
|
|
3612
|
+
import { Fragment as Fragment13, jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3340
3613
|
var MARKS = {
|
|
3341
3614
|
uploading: "clock",
|
|
3342
3615
|
done: "circleCheck",
|
|
@@ -3372,8 +3645,8 @@ function FileDrop({
|
|
|
3372
3645
|
children,
|
|
3373
3646
|
className
|
|
3374
3647
|
}) {
|
|
3375
|
-
const input =
|
|
3376
|
-
const [over, setOver] =
|
|
3648
|
+
const input = useRef18(null);
|
|
3649
|
+
const [over, setOver] = useState13(false);
|
|
3377
3650
|
const status = file?.status ?? "uploading";
|
|
3378
3651
|
const word = status === "error" ? file?.error ?? WORDS.error : file?.state ?? WORDS[status];
|
|
3379
3652
|
const [stem, ext] = splitName(file?.name ?? "");
|
|
@@ -3389,7 +3662,7 @@ function FileDrop({
|
|
|
3389
3662
|
const pick = () => {
|
|
3390
3663
|
if (!disabled) input.current?.click();
|
|
3391
3664
|
};
|
|
3392
|
-
const picker = /* @__PURE__ */
|
|
3665
|
+
const picker = /* @__PURE__ */ jsx33(
|
|
3393
3666
|
"input",
|
|
3394
3667
|
{
|
|
3395
3668
|
ref: input,
|
|
@@ -3422,20 +3695,20 @@ function FileDrop({
|
|
|
3422
3695
|
take(Array.from(event.dataTransfer.files));
|
|
3423
3696
|
}
|
|
3424
3697
|
};
|
|
3425
|
-
if (title !== void 0) return /* @__PURE__ */
|
|
3698
|
+
if (title !== void 0) return /* @__PURE__ */ jsxs28(
|
|
3426
3699
|
"div",
|
|
3427
3700
|
{
|
|
3428
3701
|
className: cx7("ui-drop", "ui-drop--area", showTarget && "is-dragging", disabled && "is-disabled", className),
|
|
3429
3702
|
onClick: pick,
|
|
3430
3703
|
...drag,
|
|
3431
3704
|
children: [
|
|
3432
|
-
/* @__PURE__ */
|
|
3705
|
+
/* @__PURE__ */ jsx33(
|
|
3433
3706
|
EmptyState,
|
|
3434
3707
|
{
|
|
3435
3708
|
icon: "upload",
|
|
3436
3709
|
title,
|
|
3437
3710
|
sub: note ?? "",
|
|
3438
|
-
actions: /* @__PURE__ */
|
|
3711
|
+
actions: /* @__PURE__ */ jsx33(
|
|
3439
3712
|
Button,
|
|
3440
3713
|
{
|
|
3441
3714
|
variant: "primary",
|
|
@@ -3455,18 +3728,18 @@ function FileDrop({
|
|
|
3455
3728
|
]
|
|
3456
3729
|
}
|
|
3457
3730
|
);
|
|
3458
|
-
return /* @__PURE__ */
|
|
3731
|
+
return /* @__PURE__ */ jsxs28("div", { className: cx7("ui-drop", disabled && "is-disabled", className), ...drag, children: [
|
|
3459
3732
|
children,
|
|
3460
|
-
/* @__PURE__ */
|
|
3461
|
-
file ? /* @__PURE__ */
|
|
3462
|
-
/* @__PURE__ */
|
|
3463
|
-
/* @__PURE__ */
|
|
3464
|
-
/* @__PURE__ */
|
|
3465
|
-
/* @__PURE__ */
|
|
3733
|
+
/* @__PURE__ */ jsxs28("div", { className: "ui-drop__row", children: [
|
|
3734
|
+
file ? /* @__PURE__ */ jsxs28("div", { className: cx7("ui-drop__file", status === "error" && "ui-drop__file--failed"), children: [
|
|
3735
|
+
/* @__PURE__ */ jsxs28("div", { className: "ui-drop__line", children: [
|
|
3736
|
+
/* @__PURE__ */ jsxs28("span", { className: "ui-drop__name", title: file.name, children: [
|
|
3737
|
+
/* @__PURE__ */ jsx33("span", { className: "ui-drop__stem", children: stem }),
|
|
3738
|
+
/* @__PURE__ */ jsx33("span", { className: "ui-drop__ext", children: ext })
|
|
3466
3739
|
] }),
|
|
3467
|
-
(onRemove || status === "error" && onRetry) && /* @__PURE__ */
|
|
3468
|
-
status === "error" && onRetry && /* @__PURE__ */
|
|
3469
|
-
onRemove && /* @__PURE__ */
|
|
3740
|
+
(onRemove || status === "error" && onRetry) && /* @__PURE__ */ jsxs28("span", { className: "ui-drop__actions", children: [
|
|
3741
|
+
status === "error" && onRetry && /* @__PURE__ */ jsx33(Button, { size: "sm", icon: "refresh", onClick: onRetry, disabled, children: retryLabel }),
|
|
3742
|
+
onRemove && /* @__PURE__ */ jsx33(
|
|
3470
3743
|
Button,
|
|
3471
3744
|
{
|
|
3472
3745
|
variant: "ghost",
|
|
@@ -3478,21 +3751,21 @@ function FileDrop({
|
|
|
3478
3751
|
)
|
|
3479
3752
|
] })
|
|
3480
3753
|
] }),
|
|
3481
|
-
(showSize || showWord) && /* @__PURE__ */
|
|
3754
|
+
(showSize || showWord) && /* @__PURE__ */ jsxs28(
|
|
3482
3755
|
"div",
|
|
3483
3756
|
{
|
|
3484
3757
|
className: cx7("ui-drop__facts", status === "error" && "ui-drop__error"),
|
|
3485
3758
|
role: status === "error" ? "alert" : void 0,
|
|
3486
3759
|
children: [
|
|
3487
|
-
showSize && /* @__PURE__ */
|
|
3488
|
-
showWord && /* @__PURE__ */
|
|
3489
|
-
/* @__PURE__ */
|
|
3490
|
-
/* @__PURE__ */
|
|
3760
|
+
showSize && /* @__PURE__ */ jsx33("span", { className: "ui-drop__size", children: file.size }),
|
|
3761
|
+
showWord && /* @__PURE__ */ jsxs28("span", { className: "ui-drop__state", children: [
|
|
3762
|
+
/* @__PURE__ */ jsx33(Icon, { name: MARKS[status] }),
|
|
3763
|
+
/* @__PURE__ */ jsx33("span", { className: "ui-drop__word", title: word, children: word })
|
|
3491
3764
|
] })
|
|
3492
3765
|
]
|
|
3493
3766
|
}
|
|
3494
3767
|
),
|
|
3495
|
-
hasBar && /* @__PURE__ */
|
|
3768
|
+
hasBar && /* @__PURE__ */ jsx33(
|
|
3496
3769
|
"span",
|
|
3497
3770
|
{
|
|
3498
3771
|
className: "ui-drop__bar",
|
|
@@ -3501,11 +3774,11 @@ function FileDrop({
|
|
|
3501
3774
|
"aria-valuenow": file.progress,
|
|
3502
3775
|
"aria-valuemin": 0,
|
|
3503
3776
|
"aria-valuemax": 100,
|
|
3504
|
-
children: /* @__PURE__ */
|
|
3777
|
+
children: /* @__PURE__ */ jsx33("span", { style: { width: `${file.progress}%` } })
|
|
3505
3778
|
}
|
|
3506
3779
|
)
|
|
3507
|
-
] }) : /* @__PURE__ */
|
|
3508
|
-
/* @__PURE__ */
|
|
3780
|
+
] }) : /* @__PURE__ */ jsxs28(Fragment13, { children: [
|
|
3781
|
+
/* @__PURE__ */ jsx33(
|
|
3509
3782
|
Button,
|
|
3510
3783
|
{
|
|
3511
3784
|
size: "sm",
|
|
@@ -3515,22 +3788,22 @@ function FileDrop({
|
|
|
3515
3788
|
children: label
|
|
3516
3789
|
}
|
|
3517
3790
|
),
|
|
3518
|
-
note && /* @__PURE__ */
|
|
3791
|
+
note && /* @__PURE__ */ jsx33("p", { className: "ui-drop__note", children: note })
|
|
3519
3792
|
] }),
|
|
3520
3793
|
picker
|
|
3521
3794
|
] }),
|
|
3522
|
-
showTarget && /* @__PURE__ */
|
|
3795
|
+
showTarget && /* @__PURE__ */ jsx33("div", { className: "ui-drop__target", "aria-hidden": "true", children: dropLabel })
|
|
3523
3796
|
] });
|
|
3524
3797
|
}
|
|
3525
3798
|
|
|
3526
3799
|
// src/SearchField.tsx
|
|
3527
3800
|
import { forwardRef as forwardRef7 } from "react";
|
|
3528
3801
|
import { icon as icon6 } from "@apliteni/apliteni-ui";
|
|
3529
|
-
import { jsx as
|
|
3802
|
+
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3530
3803
|
var SearchField = forwardRef7(function SearchField2({ ariaLabel, className, ...props }, ref) {
|
|
3531
|
-
return /* @__PURE__ */
|
|
3532
|
-
/* @__PURE__ */
|
|
3533
|
-
/* @__PURE__ */
|
|
3804
|
+
return /* @__PURE__ */ jsxs29("div", { className: "ui-input-group", children: [
|
|
3805
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon6("search") } }),
|
|
3806
|
+
/* @__PURE__ */ jsx34(
|
|
3534
3807
|
"input",
|
|
3535
3808
|
{
|
|
3536
3809
|
ref,
|
|
@@ -3544,9 +3817,9 @@ var SearchField = forwardRef7(function SearchField2({ ariaLabel, className, ...p
|
|
|
3544
3817
|
});
|
|
3545
3818
|
|
|
3546
3819
|
// src/Toast.tsx
|
|
3547
|
-
import { createContext as createContext3, useCallback as useCallback6, useContext as useContext3, useEffect as
|
|
3548
|
-
import { createPortal as
|
|
3549
|
-
import { jsx as
|
|
3820
|
+
import { createContext as createContext3, useCallback as useCallback6, useContext as useContext3, useEffect as useEffect13, useLayoutEffect as useLayoutEffect4, useRef as useRef19, useState as useState14 } from "react";
|
|
3821
|
+
import { createPortal as createPortal5 } from "react-dom";
|
|
3822
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3550
3823
|
var Context = createContext3(null);
|
|
3551
3824
|
var glyphs = { success: "circleCheck", danger: "circleX", warn: "circleAlert", info: "info", neutral: "bolt" };
|
|
3552
3825
|
function useToast() {
|
|
@@ -3555,23 +3828,23 @@ function useToast() {
|
|
|
3555
3828
|
return push;
|
|
3556
3829
|
}
|
|
3557
3830
|
function Notice({ notice, remove }) {
|
|
3558
|
-
const root =
|
|
3559
|
-
const [leaving2, setLeaving] =
|
|
3560
|
-
const dismissed =
|
|
3561
|
-
const [hovered, setHovered] =
|
|
3562
|
-
const [focused, setFocused] =
|
|
3831
|
+
const root = useRef19(null);
|
|
3832
|
+
const [leaving2, setLeaving] = useState14(false);
|
|
3833
|
+
const dismissed = useRef19(false);
|
|
3834
|
+
const [hovered, setHovered] = useState14(false);
|
|
3835
|
+
const [focused, setFocused] = useState14(false);
|
|
3563
3836
|
const paused = hovered || focused;
|
|
3564
3837
|
const tone = notice.tone ?? "success";
|
|
3565
3838
|
const timed = !notice.action && notice.timer !== false && notice.timer !== 0;
|
|
3566
3839
|
const duration = typeof notice.timer === "number" ? notice.timer * 1e3 : 5e3;
|
|
3567
|
-
const remaining =
|
|
3840
|
+
const remaining = useRef19(duration);
|
|
3568
3841
|
const dismiss = useCallback6(() => {
|
|
3569
3842
|
if (dismissed.current) return;
|
|
3570
3843
|
dismissed.current = true;
|
|
3571
3844
|
if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches) remove();
|
|
3572
3845
|
else setLeaving(true);
|
|
3573
3846
|
}, [remove]);
|
|
3574
|
-
|
|
3847
|
+
useEffect13(() => {
|
|
3575
3848
|
if (leaving2) {
|
|
3576
3849
|
const element = root.current;
|
|
3577
3850
|
const finish = (event) => {
|
|
@@ -3585,7 +3858,7 @@ function Notice({ notice, remove }) {
|
|
|
3585
3858
|
};
|
|
3586
3859
|
}
|
|
3587
3860
|
}, [leaving2, remove]);
|
|
3588
|
-
|
|
3861
|
+
useEffect13(() => {
|
|
3589
3862
|
if (leaving2 || !timed || paused) return;
|
|
3590
3863
|
const started = Date.now();
|
|
3591
3864
|
const timer = setTimeout(dismiss, remaining.current);
|
|
@@ -3594,7 +3867,7 @@ function Notice({ notice, remove }) {
|
|
|
3594
3867
|
remaining.current = Math.max(0, remaining.current - (Date.now() - started));
|
|
3595
3868
|
};
|
|
3596
3869
|
}, [dismiss, leaving2, paused, timed]);
|
|
3597
|
-
return /* @__PURE__ */
|
|
3870
|
+
return /* @__PURE__ */ jsxs30(
|
|
3598
3871
|
"div",
|
|
3599
3872
|
{
|
|
3600
3873
|
ref: root,
|
|
@@ -3608,12 +3881,12 @@ function Notice({ notice, remove }) {
|
|
|
3608
3881
|
if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false);
|
|
3609
3882
|
},
|
|
3610
3883
|
children: [
|
|
3611
|
-
/* @__PURE__ */
|
|
3612
|
-
/* @__PURE__ */
|
|
3613
|
-
/* @__PURE__ */
|
|
3614
|
-
!notice.compact && notice.text && /* @__PURE__ */
|
|
3884
|
+
/* @__PURE__ */ jsx35("span", { className: "ui-toast__icon", children: /* @__PURE__ */ jsx35(Icon, { name: glyphs[tone] }) }),
|
|
3885
|
+
/* @__PURE__ */ jsxs30("div", { className: "ui-toast__body", children: [
|
|
3886
|
+
/* @__PURE__ */ jsx35("div", { className: "ui-toast__title", children: notice.title }),
|
|
3887
|
+
!notice.compact && notice.text && /* @__PURE__ */ jsx35("div", { className: "ui-toast__text", children: notice.text })
|
|
3615
3888
|
] }),
|
|
3616
|
-
notice.action && /* @__PURE__ */
|
|
3889
|
+
notice.action && /* @__PURE__ */ jsx35(
|
|
3617
3890
|
"button",
|
|
3618
3891
|
{
|
|
3619
3892
|
type: "button",
|
|
@@ -3628,8 +3901,8 @@ function Notice({ notice, remove }) {
|
|
|
3628
3901
|
children: notice.action.label
|
|
3629
3902
|
}
|
|
3630
3903
|
),
|
|
3631
|
-
notice.dismissible !== false && /* @__PURE__ */
|
|
3632
|
-
timed && /* @__PURE__ */
|
|
3904
|
+
notice.dismissible !== false && /* @__PURE__ */ jsx35("button", { type: "button", className: "ui-toast__close", "aria-label": "Dismiss", disabled: leaving2, onClick: dismiss, children: /* @__PURE__ */ jsx35(Icon, { name: "x" }) }),
|
|
3905
|
+
timed && /* @__PURE__ */ jsx35(
|
|
3633
3906
|
"span",
|
|
3634
3907
|
{
|
|
3635
3908
|
className: "ui-toast__timer is-running",
|
|
@@ -3662,41 +3935,41 @@ function usePublishedReach(stack2, count) {
|
|
|
3662
3935
|
}, [stack2, count]);
|
|
3663
3936
|
}
|
|
3664
3937
|
function Toast({ children }) {
|
|
3665
|
-
const [entries, setEntries] =
|
|
3666
|
-
const nextId =
|
|
3667
|
-
const stack2 =
|
|
3938
|
+
const [entries, setEntries] = useState14([]);
|
|
3939
|
+
const nextId = useRef19(0);
|
|
3940
|
+
const stack2 = useRef19(null);
|
|
3668
3941
|
const push = useCallback6((notice) => {
|
|
3669
3942
|
const id = nextId.current++;
|
|
3670
3943
|
const remove = () => setEntries((current) => current.filter((entry) => entry.id !== id));
|
|
3671
3944
|
setEntries((current) => [...current, { id, notice, remove }]);
|
|
3672
3945
|
}, []);
|
|
3673
3946
|
usePublishedReach(stack2, entries.length);
|
|
3674
|
-
return /* @__PURE__ */
|
|
3947
|
+
return /* @__PURE__ */ jsxs30(Context.Provider, { value: push, children: [
|
|
3675
3948
|
children,
|
|
3676
|
-
typeof document !== "undefined" &&
|
|
3677
|
-
/* @__PURE__ */
|
|
3949
|
+
typeof document !== "undefined" && createPortal5(
|
|
3950
|
+
/* @__PURE__ */ jsx35("div", { className: "ui-toast-stack rx-toast-stack", ref: stack2, children: entries.map((entry) => /* @__PURE__ */ jsx35(Notice, { notice: entry.notice, remove: entry.remove }, entry.id)) }),
|
|
3678
3951
|
document.body
|
|
3679
3952
|
)
|
|
3680
3953
|
] });
|
|
3681
3954
|
}
|
|
3682
3955
|
|
|
3683
3956
|
// src/AppShell.tsx
|
|
3684
|
-
import { useEffect as
|
|
3957
|
+
import { useEffect as useEffect15, useId as useId12, useRef as useRef20, useState as useState16 } from "react";
|
|
3685
3958
|
import { paletteHotkey, prism, railCollapsed } from "@apliteni/apliteni-ui";
|
|
3686
3959
|
|
|
3687
3960
|
// src/SidebarNav.tsx
|
|
3688
|
-
import { forwardRef as forwardRef8, useEffect as
|
|
3961
|
+
import { forwardRef as forwardRef8, useEffect as useEffect14, useId as useId11, useState as useState15 } from "react";
|
|
3689
3962
|
import { ENTRANCE_FALLBACK_MS } from "@apliteni/apliteni-ui/motion";
|
|
3690
|
-
import { Fragment as
|
|
3963
|
+
import { Fragment as Fragment14, jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3691
3964
|
var badgeText = (badge) => typeof badge === "object" ? badge.text : badge;
|
|
3692
3965
|
function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
3693
3966
|
const uid = useId11();
|
|
3694
3967
|
const group = !sub && !!item.items?.length;
|
|
3695
3968
|
const childActive = group && item.items.some((child) => child.id === active);
|
|
3696
|
-
const [expanded, setExpanded] =
|
|
3969
|
+
const [expanded, setExpanded] = useState15();
|
|
3697
3970
|
const open = expanded ?? item.defaultOpen ?? childActive;
|
|
3698
|
-
const [entering, setEntering] =
|
|
3699
|
-
|
|
3971
|
+
const [entering, setEntering] = useState15(false);
|
|
3972
|
+
useEffect14(() => {
|
|
3700
3973
|
if (!entering) return;
|
|
3701
3974
|
const timer = setTimeout(() => setEntering(false), ENTRANCE_FALLBACK_MS);
|
|
3702
3975
|
return () => clearTimeout(timer);
|
|
@@ -3713,15 +3986,15 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
3713
3986
|
item.disabled && "is-disabled",
|
|
3714
3987
|
item.danger && "is-danger"
|
|
3715
3988
|
].filter(Boolean).join(" ");
|
|
3716
|
-
const children = /* @__PURE__ */
|
|
3717
|
-
(item.leading ?? item.icon) && /* @__PURE__ */
|
|
3718
|
-
/* @__PURE__ */
|
|
3719
|
-
count != null && count !== "" && /* @__PURE__ */
|
|
3720
|
-
group && /* @__PURE__ */
|
|
3989
|
+
const children = /* @__PURE__ */ jsxs31(Fragment14, { children: [
|
|
3990
|
+
(item.leading ?? item.icon) && /* @__PURE__ */ jsx36("span", { className: "ui-nav__ic", children: item.leading ?? /* @__PURE__ */ jsx36(Icon, { name: item.icon }) }),
|
|
3991
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-nav__label", children: item.label }),
|
|
3992
|
+
count != null && count !== "" && /* @__PURE__ */ jsx36("span", { className: `ui-nav__badge is-${typeof item.badge === "object" ? item.badge.tone ?? "neutral" : "neutral"}`, children: count }),
|
|
3993
|
+
group && /* @__PURE__ */ jsx36("span", { className: "ui-nav__caret", "aria-hidden": "true" })
|
|
3721
3994
|
] });
|
|
3722
3995
|
const common = { className, "aria-label": name, title: collapsed ? name : void 0, children };
|
|
3723
|
-
if (group) return /* @__PURE__ */
|
|
3724
|
-
/* @__PURE__ */
|
|
3996
|
+
if (group) return /* @__PURE__ */ jsxs31("li", { className: `ui-nav__group${open ? " is-open" : ""}`, children: [
|
|
3997
|
+
/* @__PURE__ */ jsx36(
|
|
3725
3998
|
"button",
|
|
3726
3999
|
{
|
|
3727
4000
|
...common,
|
|
@@ -3735,22 +4008,22 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
3735
4008
|
}
|
|
3736
4009
|
}
|
|
3737
4010
|
),
|
|
3738
|
-
/* @__PURE__ */
|
|
4011
|
+
/* @__PURE__ */ jsx36("ul", { id: uid, className: `ui-nav__sub${entering ? " is-entering" : ""}`, hidden: !open, onAnimationEnd: () => setEntering(false), children: item.items.map((child) => /* @__PURE__ */ jsx36(Row, { item: child, active, activeIs, collapsed, renderLink, sub: true }, child.id)) })
|
|
3739
4012
|
] });
|
|
3740
|
-
if (item.disabled) return /* @__PURE__ */
|
|
4013
|
+
if (item.disabled) return /* @__PURE__ */ jsx36("li", { children: /* @__PURE__ */ jsx36("span", { ...common, role: "link", "aria-disabled": "true" }) });
|
|
3741
4014
|
const props = {
|
|
3742
4015
|
...common,
|
|
3743
4016
|
href: item.href ?? `#${item.id}`,
|
|
3744
4017
|
target: item.target,
|
|
3745
4018
|
"aria-current": isActive ? activeIs === "section" ? "true" : "page" : void 0
|
|
3746
4019
|
};
|
|
3747
|
-
return /* @__PURE__ */
|
|
4020
|
+
return /* @__PURE__ */ jsx36("li", { children: renderLink ? renderLink(item, props) : /* @__PURE__ */ jsx36("a", { ...props }) });
|
|
3748
4021
|
}
|
|
3749
4022
|
function Section({ section, ...props }) {
|
|
3750
4023
|
const uid = useId11();
|
|
3751
|
-
return /* @__PURE__ */
|
|
3752
|
-
section.label && /* @__PURE__ */
|
|
3753
|
-
/* @__PURE__ */
|
|
4024
|
+
return /* @__PURE__ */ jsxs31("div", { className: "ui-nav__section", children: [
|
|
4025
|
+
section.label && /* @__PURE__ */ jsx36("div", { className: "ui-nav__cap", id: uid, "aria-hidden": props.collapsed || void 0, children: section.label }),
|
|
4026
|
+
/* @__PURE__ */ jsx36("ul", { className: "ui-nav__list", "aria-labelledby": section.label ? uid : void 0, children: section.items.map((item) => /* @__PURE__ */ jsx36(Row, { item, ...props }, item.id)) })
|
|
3754
4027
|
] });
|
|
3755
4028
|
}
|
|
3756
4029
|
var SidebarNav = forwardRef8(function SidebarNav2({
|
|
@@ -3765,8 +4038,8 @@ var SidebarNav = forwardRef8(function SidebarNav2({
|
|
|
3765
4038
|
"aria-label": label = "Sidebar",
|
|
3766
4039
|
...rest
|
|
3767
4040
|
}, ref) {
|
|
3768
|
-
return /* @__PURE__ */
|
|
3769
|
-
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */
|
|
4041
|
+
return /* @__PURE__ */ jsxs31("nav", { ...rest, ref, "aria-label": label, className: ["ui-nav", "ui-nav--side", collapsed && "is-collapsed", className].filter(Boolean).join(" "), children: [
|
|
4042
|
+
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */ jsx36(
|
|
3770
4043
|
Section,
|
|
3771
4044
|
{
|
|
3772
4045
|
section,
|
|
@@ -3777,14 +4050,14 @@ var SidebarNav = forwardRef8(function SidebarNav2({
|
|
|
3777
4050
|
},
|
|
3778
4051
|
index
|
|
3779
4052
|
)),
|
|
3780
|
-
footer && /* @__PURE__ */
|
|
4053
|
+
footer && /* @__PURE__ */ jsx36("div", { className: "ui-nav__foot", children: footer })
|
|
3781
4054
|
] });
|
|
3782
4055
|
});
|
|
3783
4056
|
|
|
3784
4057
|
// src/ThemeToggle.tsx
|
|
3785
4058
|
import { useSyncExternalStore } from "react";
|
|
3786
4059
|
import { themeIcon } from "@apliteni/apliteni-ui";
|
|
3787
|
-
import { jsx as
|
|
4060
|
+
import { jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3788
4061
|
var STORAGE_KEY = "apliteni-strategy-theme";
|
|
3789
4062
|
var CHOICE_EVENT = "apliteni-theme-choice";
|
|
3790
4063
|
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')})()`;
|
|
@@ -3842,10 +4115,10 @@ function ThemeToggle({ labelled = false }) {
|
|
|
3842
4115
|
}
|
|
3843
4116
|
window.dispatchEvent(new Event(CHOICE_EVENT));
|
|
3844
4117
|
};
|
|
3845
|
-
const button = /* @__PURE__ */
|
|
3846
|
-
return labelled ? /* @__PURE__ */
|
|
4118
|
+
const button = /* @__PURE__ */ jsx37("button", { type: "button", className: "toggle", "aria-label": name, title: name, onClick: toggle, children: /* @__PURE__ */ jsx37("span", { className: "ic", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: themeIcon(theme) } }) });
|
|
4119
|
+
return labelled ? /* @__PURE__ */ jsxs32("span", { className: "ui-theme-toggle", children: [
|
|
3847
4120
|
button,
|
|
3848
|
-
/* @__PURE__ */
|
|
4121
|
+
/* @__PURE__ */ jsxs32("span", { children: [
|
|
3849
4122
|
label,
|
|
3850
4123
|
" theme"
|
|
3851
4124
|
] })
|
|
@@ -3853,7 +4126,7 @@ function ThemeToggle({ labelled = false }) {
|
|
|
3853
4126
|
}
|
|
3854
4127
|
|
|
3855
4128
|
// src/AppShell.tsx
|
|
3856
|
-
import { Fragment as
|
|
4129
|
+
import { Fragment as Fragment15, jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3857
4130
|
var path = (value) => value.split(/[?#]/)[0].replace(/\/+$/, "") || "/";
|
|
3858
4131
|
function AppShell({
|
|
3859
4132
|
sections,
|
|
@@ -3877,20 +4150,20 @@ function AppShell({
|
|
|
3877
4150
|
renderLink
|
|
3878
4151
|
}) {
|
|
3879
4152
|
const uid = useId12();
|
|
3880
|
-
const [collapsed, setCollapsed] =
|
|
3881
|
-
const [search, setSearch] =
|
|
3882
|
-
const [menu, setMenu] =
|
|
3883
|
-
const menuButton =
|
|
4153
|
+
const [collapsed, setCollapsed] = useState16(defaultCollapsed);
|
|
4154
|
+
const [search, setSearch] = useState16(false);
|
|
4155
|
+
const [menu, setMenu] = useState16(false);
|
|
4156
|
+
const menuButton = useRef20(null);
|
|
3884
4157
|
const current = path(pathname);
|
|
3885
4158
|
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];
|
|
3886
|
-
|
|
4159
|
+
useEffect15(() => {
|
|
3887
4160
|
setCollapsed(railCollapsed() ?? defaultCollapsed);
|
|
3888
4161
|
}, [defaultCollapsed]);
|
|
3889
|
-
|
|
4162
|
+
useEffect15(() => {
|
|
3890
4163
|
setMenu(false);
|
|
3891
4164
|
setSearch(false);
|
|
3892
4165
|
}, [pathname]);
|
|
3893
|
-
|
|
4166
|
+
useEffect15(() => {
|
|
3894
4167
|
if (!menu) return;
|
|
3895
4168
|
const grown = () => {
|
|
3896
4169
|
const button = menuButton.current;
|
|
@@ -3899,7 +4172,7 @@ function AppShell({
|
|
|
3899
4172
|
window.addEventListener("resize", grown);
|
|
3900
4173
|
return () => window.removeEventListener("resize", grown);
|
|
3901
4174
|
}, [menu]);
|
|
3902
|
-
|
|
4175
|
+
useEffect15(() => {
|
|
3903
4176
|
const hotkey = (event) => {
|
|
3904
4177
|
if (!(event.metaKey || event.ctrlKey) || event.altKey || event.shiftKey || event.key.toLowerCase() !== "k") return;
|
|
3905
4178
|
const target = event.target;
|
|
@@ -3918,7 +4191,7 @@ function AppShell({
|
|
|
3918
4191
|
} catch {
|
|
3919
4192
|
}
|
|
3920
4193
|
};
|
|
3921
|
-
const sidebar = (label) => /* @__PURE__ */
|
|
4194
|
+
const sidebar = (label) => /* @__PURE__ */ jsx38(
|
|
3922
4195
|
SidebarNav,
|
|
3923
4196
|
{
|
|
3924
4197
|
"aria-label": label,
|
|
@@ -3930,33 +4203,33 @@ function AppShell({
|
|
|
3930
4203
|
const linkProps = { ...props, onClick: (event) => {
|
|
3931
4204
|
if (!event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) setMenu(false);
|
|
3932
4205
|
} };
|
|
3933
|
-
return renderLink ? renderLink(section, linkProps) : /* @__PURE__ */
|
|
4206
|
+
return renderLink ? renderLink(section, linkProps) : /* @__PURE__ */ jsx38("a", { ...linkProps });
|
|
3934
4207
|
}
|
|
3935
4208
|
}
|
|
3936
4209
|
);
|
|
3937
4210
|
const foldLabel = collapsed ? "Expand sidebar" : "Collapse sidebar";
|
|
3938
4211
|
const navigable = sections.length > 1 || Boolean(back);
|
|
3939
|
-
const lockup = /* @__PURE__ */
|
|
3940
|
-
brand ?? /* @__PURE__ */
|
|
3941
|
-
/* @__PURE__ */
|
|
4212
|
+
const lockup = /* @__PURE__ */ jsxs33("a", { className: "ui-app__brand", href: brandHref, "aria-label": word, children: [
|
|
4213
|
+
brand ?? /* @__PURE__ */ jsx38("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(uid, 24) } }),
|
|
4214
|
+
/* @__PURE__ */ jsx38("span", { children: word })
|
|
3942
4215
|
] });
|
|
3943
|
-
return /* @__PURE__ */
|
|
3944
|
-
navigable && /* @__PURE__ */
|
|
3945
|
-
/* @__PURE__ */
|
|
4216
|
+
return /* @__PURE__ */ jsxs33("div", { className: `ui-app ui-app--topbar ui-react-app${collapsed ? " is-collapsed" : ""}`, children: [
|
|
4217
|
+
navigable && /* @__PURE__ */ jsxs33("div", { className: "ui-app__rail", role: "region", "aria-label": "Sidebar", children: [
|
|
4218
|
+
/* @__PURE__ */ jsx38("div", { className: "ui-app__head", children: lockup }),
|
|
3946
4219
|
sidebar("Sections"),
|
|
3947
|
-
/* @__PURE__ */
|
|
3948
|
-
/* @__PURE__ */
|
|
3949
|
-
/* @__PURE__ */
|
|
3950
|
-
/* @__PURE__ */
|
|
3951
|
-
/* @__PURE__ */
|
|
4220
|
+
/* @__PURE__ */ jsx38("div", { className: "ui-app__foot", children: /* @__PURE__ */ jsx38("div", { className: "ui-app__fold-row", children: /* @__PURE__ */ jsxs33("button", { type: "button", className: "ui-nav__item ui-app__fold", "aria-expanded": !collapsed, "aria-label": foldLabel, onClick: fold, children: [
|
|
4221
|
+
/* @__PURE__ */ jsx38("span", { className: "ui-nav__ic", children: /* @__PURE__ */ jsxs33("svg", { className: "ui-icon", viewBox: "0 0 24 24", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
4222
|
+
/* @__PURE__ */ jsx38("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
4223
|
+
/* @__PURE__ */ jsx38("path", { className: "ui-app__fold-seam", d: "M9 3v18" }),
|
|
4224
|
+
/* @__PURE__ */ jsx38("path", { className: "ui-app__fold-arrow", d: "m16 15-3-3 3-3" })
|
|
3952
4225
|
] }) }),
|
|
3953
|
-
/* @__PURE__ */
|
|
4226
|
+
/* @__PURE__ */ jsx38("span", { className: "ui-nav__label", children: foldLabel })
|
|
3954
4227
|
] }) }) })
|
|
3955
4228
|
] }),
|
|
3956
|
-
/* @__PURE__ */
|
|
3957
|
-
/* @__PURE__ */
|
|
3958
|
-
navigable && /* @__PURE__ */
|
|
3959
|
-
/* @__PURE__ */
|
|
4229
|
+
/* @__PURE__ */ jsxs33("div", { className: "ui-app__well", children: [
|
|
4230
|
+
/* @__PURE__ */ jsxs33("header", { className: "ui-app__bar", children: [
|
|
4231
|
+
navigable && /* @__PURE__ */ jsxs33(Fragment15, { children: [
|
|
4232
|
+
/* @__PURE__ */ jsx38(
|
|
3960
4233
|
Button,
|
|
3961
4234
|
{
|
|
3962
4235
|
ref: menuButton,
|
|
@@ -3970,19 +4243,19 @@ function AppShell({
|
|
|
3970
4243
|
onClick: () => setMenu(true)
|
|
3971
4244
|
}
|
|
3972
4245
|
),
|
|
3973
|
-
/* @__PURE__ */
|
|
4246
|
+
/* @__PURE__ */ jsx38("a", { className: "ui-app__brand ui-app__brand--band", href: brandHref, "aria-label": word, children: brand ?? /* @__PURE__ */ jsx38("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(`${uid}-band`, 24) } }) })
|
|
3974
4247
|
] }),
|
|
3975
4248
|
!navigable && lockup,
|
|
3976
|
-
/* @__PURE__ */
|
|
3977
|
-
/* @__PURE__ */
|
|
3978
|
-
/* @__PURE__ */
|
|
3979
|
-
/* @__PURE__ */
|
|
3980
|
-
/* @__PURE__ */
|
|
4249
|
+
/* @__PURE__ */ jsxs33("button", { type: "button", className: "ui-app__search", "aria-haspopup": "dialog", onClick: () => setSearch(true), children: [
|
|
4250
|
+
/* @__PURE__ */ jsx38("span", { className: "ui-app__search-ic", children: /* @__PURE__ */ jsx38(Icon, { name: "search" }) }),
|
|
4251
|
+
/* @__PURE__ */ jsx38("span", { className: "ui-app__search-txt", children: searchLabel }),
|
|
4252
|
+
/* @__PURE__ */ jsx38("span", { className: "ui-app__search-short", "aria-hidden": "true", children: searchShortLabel }),
|
|
4253
|
+
/* @__PURE__ */ jsx38("kbd", { className: "ui-cmdk__key", children: paletteHotkey() })
|
|
3981
4254
|
] }),
|
|
3982
|
-
/* @__PURE__ */
|
|
3983
|
-
bandControl && /* @__PURE__ */
|
|
3984
|
-
/* @__PURE__ */
|
|
3985
|
-
/* @__PURE__ */
|
|
4255
|
+
/* @__PURE__ */ jsx38("span", { className: "ui-app__bar-gap" }),
|
|
4256
|
+
bandControl && /* @__PURE__ */ jsx38("span", { className: "ui-react-app__band-control", children: bandControl }),
|
|
4257
|
+
/* @__PURE__ */ jsx38(ThemeToggle, {}),
|
|
4258
|
+
/* @__PURE__ */ jsx38("div", { className: "ui-app__user ui-app__user--bar", children: /* @__PURE__ */ jsx38(
|
|
3986
4259
|
Dropdown,
|
|
3987
4260
|
{
|
|
3988
4261
|
variant: "menu",
|
|
@@ -3991,35 +4264,105 @@ function AppShell({
|
|
|
3991
4264
|
ariaLabel: `Signed in as ${account.name}, ${account.email}`,
|
|
3992
4265
|
triggerClass: "ui-app__user-trigger",
|
|
3993
4266
|
panelClass: "ui-app__user-panel",
|
|
3994
|
-
triggerContent: /* @__PURE__ */
|
|
3995
|
-
header: /* @__PURE__ */
|
|
3996
|
-
/* @__PURE__ */
|
|
3997
|
-
/* @__PURE__ */
|
|
4267
|
+
triggerContent: /* @__PURE__ */ jsx38("span", { className: "ui-app__av", "aria-hidden": "true", children: /* @__PURE__ */ jsx38(Avatar, { personKey: account.email || account.name, name: account.name, size: 32 }) }),
|
|
4268
|
+
header: /* @__PURE__ */ jsxs33("div", { className: "ui-dropdown__head", children: [
|
|
4269
|
+
/* @__PURE__ */ jsx38("b", { children: account.name }),
|
|
4270
|
+
/* @__PURE__ */ jsx38("span", { children: account.email })
|
|
3998
4271
|
] }),
|
|
3999
4272
|
items: [{ label: "Sign out", icon: "logout", danger: true }],
|
|
4000
4273
|
onSelect: onSignOut
|
|
4001
4274
|
}
|
|
4002
4275
|
) })
|
|
4003
4276
|
] }),
|
|
4004
|
-
/* @__PURE__ */
|
|
4005
|
-
back && /* @__PURE__ */
|
|
4006
|
-
/* @__PURE__ */
|
|
4007
|
-
lede && /* @__PURE__ */
|
|
4008
|
-
actions && /* @__PURE__ */
|
|
4009
|
-
/* @__PURE__ */
|
|
4277
|
+
/* @__PURE__ */ jsxs33("main", { className: `ui-app__main${width === "wide" ? " ui-app__main--wide" : ""}`, children: [
|
|
4278
|
+
back && /* @__PURE__ */ jsx38(BackLink, { ...back }),
|
|
4279
|
+
/* @__PURE__ */ jsx38("h1", { children: title }),
|
|
4280
|
+
lede && /* @__PURE__ */ jsx38("p", { className: "ui-app__sub", children: lede }),
|
|
4281
|
+
actions && /* @__PURE__ */ jsx38("div", { className: "ui-react-app__actions", children: actions }),
|
|
4282
|
+
/* @__PURE__ */ jsx38("div", { className: "ui-app__body", children })
|
|
4010
4283
|
] })
|
|
4011
4284
|
] }),
|
|
4012
|
-
navigable && /* @__PURE__ */
|
|
4013
|
-
/* @__PURE__ */
|
|
4285
|
+
navigable && /* @__PURE__ */ jsx38(Drawer, { open: menu, onClose: () => setMenu(false), title: word, side: "left", size: "sm", children: /* @__PURE__ */ jsx38("div", { className: "ui-react-app__menu", children: sidebar("Menu sections") }) }),
|
|
4286
|
+
/* @__PURE__ */ jsx38(CommandPalette, { ...palette ?? { groups: [{ items: sections.map((section) => ({ id: section.href, ...section })) }] }, open: search, onClose: () => setSearch(false) })
|
|
4014
4287
|
] });
|
|
4015
4288
|
}
|
|
4016
4289
|
|
|
4290
|
+
// src/Footer.tsx
|
|
4291
|
+
import { useId as useId13 } from "react";
|
|
4292
|
+
import { prism as prism2, safeUrl as safeUrl2 } from "@apliteni/apliteni-ui";
|
|
4293
|
+
import { jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4294
|
+
var SOCIAL_GLYPHS = {
|
|
4295
|
+
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"/>',
|
|
4296
|
+
x: '<path d="M4 3h4.5l4 5.5L17.5 3H21l-6.5 8.5L21 21h-4.5l-4.3-5.9L7 21H3.5l6.8-8.9z"/>',
|
|
4297
|
+
linkedin: '<path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"/>',
|
|
4298
|
+
mail: '<rect x="3" y="5" width="18" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="1.7"/><path d="m3 7 9 6 9-6" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
4299
|
+
};
|
|
4300
|
+
var escapeText = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
4301
|
+
function Legal({ legal, legalLinks, switcher }) {
|
|
4302
|
+
return /* @__PURE__ */ jsxs34("div", { className: "ui-footer__bar", children: [
|
|
4303
|
+
/* @__PURE__ */ jsx39("span", { className: "ui-footer__legal", children: legal }),
|
|
4304
|
+
legalLinks && legalLinks.length > 0 && /* @__PURE__ */ jsx39("nav", { className: "ui-footer__legal-links", "aria-label": "Legal", children: legalLinks.map(({ label, href: to }) => /* @__PURE__ */ jsx39("a", { href: safeUrl2(to ?? "#"), children: label }, label)) }),
|
|
4305
|
+
switcher ? /* @__PURE__ */ jsx39("div", { className: "ui-footer__switcher", children: switcher }) : null
|
|
4306
|
+
] });
|
|
4307
|
+
}
|
|
4308
|
+
function Footer({
|
|
4309
|
+
variant = "full",
|
|
4310
|
+
word = "Strategy",
|
|
4311
|
+
brandHref = "/",
|
|
4312
|
+
brand,
|
|
4313
|
+
tagline,
|
|
4314
|
+
columns = [],
|
|
4315
|
+
links,
|
|
4316
|
+
social = [],
|
|
4317
|
+
legal = `\xA9 ${(/* @__PURE__ */ new Date()).getFullYear()} Apliteni`,
|
|
4318
|
+
legalLinks = [],
|
|
4319
|
+
switcher,
|
|
4320
|
+
className,
|
|
4321
|
+
...rest
|
|
4322
|
+
}) {
|
|
4323
|
+
const uid = useId13();
|
|
4324
|
+
const cls = ["ui-footer", `ui-footer--${variant}`, className].filter(Boolean).join(" ");
|
|
4325
|
+
const bar = /* @__PURE__ */ jsx39(Legal, { legal, legalLinks, switcher });
|
|
4326
|
+
if (variant !== "full") {
|
|
4327
|
+
return /* @__PURE__ */ jsx39("footer", { ...rest, className: cls, role: "contentinfo", children: /* @__PURE__ */ jsx39("div", { className: "ui-footer__in", children: bar }) });
|
|
4328
|
+
}
|
|
4329
|
+
const mark = prism2(uid.replace(/:/g, ""), 22);
|
|
4330
|
+
const lockup = brand ?? /* @__PURE__ */ jsx39(
|
|
4331
|
+
"a",
|
|
4332
|
+
{
|
|
4333
|
+
className: "brand",
|
|
4334
|
+
href: safeUrl2(brandHref),
|
|
4335
|
+
"aria-label": `Apliteni ${word}`,
|
|
4336
|
+
dangerouslySetInnerHTML: { __html: `${mark}<span>${escapeText(word)}</span>` }
|
|
4337
|
+
}
|
|
4338
|
+
);
|
|
4339
|
+
return /* @__PURE__ */ jsx39("footer", { ...rest, className: cls, role: "contentinfo", children: /* @__PURE__ */ jsxs34("div", { className: "ui-footer__in", children: [
|
|
4340
|
+
/* @__PURE__ */ jsxs34("div", { className: "ui-footer__top", children: [
|
|
4341
|
+
brand !== false && /* @__PURE__ */ jsxs34("div", { className: "ui-footer__brand", children: [
|
|
4342
|
+
lockup,
|
|
4343
|
+
tagline && /* @__PURE__ */ jsx39("p", { className: "ui-footer__tagline", children: tagline }),
|
|
4344
|
+
social.length > 0 && /* @__PURE__ */ jsx39("div", { className: "ui-footer__socials", children: social.map(({ label, href: to, icon: icon8 = "github" }) => {
|
|
4345
|
+
const markup = SOCIAL_GLYPHS[icon8];
|
|
4346
|
+
const fill = icon8 === "mail" ? "none" : "currentColor";
|
|
4347
|
+
const viewBox = icon8 === "linkedin" ? "0 0 448 512" : "0 0 24 24";
|
|
4348
|
+
return /* @__PURE__ */ jsx39("a", { className: "ui-footer__social", href: safeUrl2(to ?? "#"), "aria-label": label, children: /* @__PURE__ */ jsx39("svg", { viewBox, fill, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: markup } }) }, label);
|
|
4349
|
+
}) })
|
|
4350
|
+
] }),
|
|
4351
|
+
(links || columns.length > 0) && /* @__PURE__ */ jsx39("nav", { className: "ui-footer__nav", "aria-label": "Footer", children: links ?? columns.map(({ title, links: columnLinks }, i) => /* @__PURE__ */ jsxs34("div", { className: "ui-footer__col", children: [
|
|
4352
|
+
title && /* @__PURE__ */ jsx39("h2", { className: "ui-footer__col-title", children: title }),
|
|
4353
|
+
/* @__PURE__ */ jsx39("ul", { className: "ui-footer__links", children: columnLinks.map(({ label, href: to, target }) => /* @__PURE__ */ jsx39("li", { children: /* @__PURE__ */ jsx39("a", { href: safeUrl2(to ?? "#"), target, rel: target ? "noreferrer" : void 0, children: label }) }, label)) })
|
|
4354
|
+
] }, title ?? i)) })
|
|
4355
|
+
] }),
|
|
4356
|
+
bar
|
|
4357
|
+
] }) });
|
|
4358
|
+
}
|
|
4359
|
+
|
|
4017
4360
|
// src/Success.tsx
|
|
4018
|
-
import { forwardRef as forwardRef9, useEffect as
|
|
4019
|
-
import { jsx as
|
|
4361
|
+
import { forwardRef as forwardRef9, useEffect as useEffect16, useRef as useRef21, useState as useState17 } from "react";
|
|
4362
|
+
import { jsx as jsx40, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4020
4363
|
var SuccessCheck = forwardRef9(function SuccessCheck2({ variant = "line", className, ...rest }, ref) {
|
|
4021
4364
|
const circled = variant === "circled";
|
|
4022
|
-
return /* @__PURE__ */
|
|
4365
|
+
return /* @__PURE__ */ jsxs35(
|
|
4023
4366
|
"svg",
|
|
4024
4367
|
{
|
|
4025
4368
|
...rest,
|
|
@@ -4031,18 +4374,18 @@ var SuccessCheck = forwardRef9(function SuccessCheck2({ variant = "line", classN
|
|
|
4031
4374
|
"aria-hidden": "true",
|
|
4032
4375
|
focusable: "false",
|
|
4033
4376
|
children: [
|
|
4034
|
-
circled && /* @__PURE__ */
|
|
4035
|
-
/* @__PURE__ */
|
|
4377
|
+
circled && /* @__PURE__ */ jsx40("path", { className: "ui-sx__circle", d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
4378
|
+
/* @__PURE__ */ jsx40("path", { className: "ui-sx__tick", d: circled ? "M22 4L12 14.01l-3-3" : "M20 6L9 17l-5-5" })
|
|
4036
4379
|
]
|
|
4037
4380
|
}
|
|
4038
4381
|
);
|
|
4039
4382
|
});
|
|
4040
4383
|
var SuccessPanel = forwardRef9(function SuccessPanel2({ title = "Done", sub, check = "line", className, ...rest }, ref) {
|
|
4041
4384
|
const circled = check === "circled";
|
|
4042
|
-
return /* @__PURE__ */
|
|
4043
|
-
/* @__PURE__ */
|
|
4044
|
-
/* @__PURE__ */
|
|
4045
|
-
sub && /* @__PURE__ */
|
|
4385
|
+
return /* @__PURE__ */ jsxs35("div", { ...rest, ref, className: ["ui-success", className].filter(Boolean).join(" "), children: [
|
|
4386
|
+
/* @__PURE__ */ jsx40("div", { className: ["ui-success__check", circled && "ui-success__check--circled"].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx40(SuccessCheck, { variant: circled ? "circled" : "line" }) }),
|
|
4387
|
+
/* @__PURE__ */ jsx40("div", { className: "ui-success__title", children: title }),
|
|
4388
|
+
sub && /* @__PURE__ */ jsx40("div", { className: "ui-success__sub", children: sub })
|
|
4046
4389
|
] });
|
|
4047
4390
|
});
|
|
4048
4391
|
var pieces = [
|
|
@@ -4062,12 +4405,12 @@ var pieces = [
|
|
|
4062
4405
|
[80, 0.36, -20, "c", 1.05]
|
|
4063
4406
|
];
|
|
4064
4407
|
function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
4065
|
-
const [remaining, setRemaining] =
|
|
4066
|
-
const callback =
|
|
4067
|
-
|
|
4408
|
+
const [remaining, setRemaining] = useState17(seconds);
|
|
4409
|
+
const callback = useRef21(onDone);
|
|
4410
|
+
useEffect16(() => {
|
|
4068
4411
|
callback.current = onDone;
|
|
4069
4412
|
}, [onDone]);
|
|
4070
|
-
|
|
4413
|
+
useEffect16(() => {
|
|
4071
4414
|
let count = seconds;
|
|
4072
4415
|
const timer = setInterval(() => {
|
|
4073
4416
|
count -= 1;
|
|
@@ -4079,12 +4422,12 @@ function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
|
4079
4422
|
}, 1e3);
|
|
4080
4423
|
return () => clearInterval(timer);
|
|
4081
4424
|
}, [seconds]);
|
|
4082
|
-
return /* @__PURE__ */
|
|
4083
|
-
/* @__PURE__ */
|
|
4084
|
-
/* @__PURE__ */
|
|
4425
|
+
return /* @__PURE__ */ jsxs35("div", { className: "ui-sx__count", "data-sx-count": "", style: { "--sx-secs": `${seconds}s` }, children: [
|
|
4426
|
+
/* @__PURE__ */ jsx40("span", { className: "ui-sx__count-ring", "aria-hidden": "true" }),
|
|
4427
|
+
/* @__PURE__ */ jsxs35("span", { className: "ui-sx__count-text", children: [
|
|
4085
4428
|
label,
|
|
4086
4429
|
" in ",
|
|
4087
|
-
/* @__PURE__ */
|
|
4430
|
+
/* @__PURE__ */ jsx40("b", { "data-sx-num": "", children: remaining }),
|
|
4088
4431
|
"s"
|
|
4089
4432
|
] })
|
|
4090
4433
|
] });
|
|
@@ -4111,7 +4454,7 @@ var Success = forwardRef9(function Success2({
|
|
|
4111
4454
|
const seconds = countdown?.seconds;
|
|
4112
4455
|
const duration = seconds != null && Number.isFinite(seconds) && seconds >= 1 ? Math.floor(seconds) : 5;
|
|
4113
4456
|
const mark = check === "circled" ? "circled" : "line";
|
|
4114
|
-
return /* @__PURE__ */
|
|
4457
|
+
return /* @__PURE__ */ jsxs35(
|
|
4115
4458
|
"div",
|
|
4116
4459
|
{
|
|
4117
4460
|
role: "status",
|
|
@@ -4120,16 +4463,16 @@ var Success = forwardRef9(function Success2({
|
|
|
4120
4463
|
ref,
|
|
4121
4464
|
className: ["ui-sx", `ui-sx--${layout}`, `ui-sx--check-${mark}`, confetti && "ui-sx--confetti", className].filter(Boolean).join(" "),
|
|
4122
4465
|
children: [
|
|
4123
|
-
confetti && /* @__PURE__ */
|
|
4124
|
-
([x, d, r, t, s], index) => /* @__PURE__ */
|
|
4466
|
+
confetti && /* @__PURE__ */ jsx40("div", { className: "ui-sx__confetti", "aria-hidden": "true", children: pieces.map(
|
|
4467
|
+
([x, d, r, t, s], index) => /* @__PURE__ */ jsx40("i", { className: `ui-sx__piece ui-sx__piece--${t}`, style: { left: `${x}%`, "--sx-d": `${d}s`, "--sx-r": `${r}deg`, "--sx-s": s } }, index)
|
|
4125
4468
|
) }),
|
|
4126
|
-
/* @__PURE__ */
|
|
4127
|
-
/* @__PURE__ */
|
|
4128
|
-
/* @__PURE__ */
|
|
4129
|
-
/* @__PURE__ */
|
|
4130
|
-
body && /* @__PURE__ */
|
|
4131
|
-
hasActions && /* @__PURE__ */
|
|
4132
|
-
countdown && /* @__PURE__ */
|
|
4469
|
+
/* @__PURE__ */ jsxs35("div", { className: "ui-sx__inner", children: [
|
|
4470
|
+
/* @__PURE__ */ jsx40("div", { className: "ui-sx__visual", children: /* @__PURE__ */ jsx40(SuccessCheck, { variant: mark }) }),
|
|
4471
|
+
/* @__PURE__ */ jsxs35("div", { className: "ui-sx__content", children: [
|
|
4472
|
+
/* @__PURE__ */ jsx40(Heading, { className: "ui-sx__title", children: title }),
|
|
4473
|
+
body && /* @__PURE__ */ jsx40("p", { className: "ui-sx__body", children: body }),
|
|
4474
|
+
hasActions && /* @__PURE__ */ jsx40("div", { className: "ui-sx__actions", children: actions }),
|
|
4475
|
+
countdown && /* @__PURE__ */ jsx40(Countdown, { seconds: duration, label: countdown.label, onDone: onCountdownEnd }, duration)
|
|
4133
4476
|
] })
|
|
4134
4477
|
] })
|
|
4135
4478
|
]
|
|
@@ -4140,15 +4483,15 @@ var Success = forwardRef9(function Success2({
|
|
|
4140
4483
|
// src/Chart.tsx
|
|
4141
4484
|
import {
|
|
4142
4485
|
useCallback as useCallback7,
|
|
4143
|
-
useEffect as
|
|
4144
|
-
useId as
|
|
4486
|
+
useEffect as useEffect17,
|
|
4487
|
+
useId as useId14,
|
|
4145
4488
|
useLayoutEffect as useLayoutEffect5,
|
|
4146
4489
|
useMemo as useMemo4,
|
|
4147
|
-
useRef as
|
|
4148
|
-
useState as
|
|
4490
|
+
useRef as useRef22,
|
|
4491
|
+
useState as useState18
|
|
4149
4492
|
} from "react";
|
|
4150
4493
|
import { CHART_FLOOR, bridgeWalk, chartScale, pointTarget } from "@apliteni/apliteni-ui";
|
|
4151
|
-
import { Fragment as
|
|
4494
|
+
import { Fragment as Fragment16, jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4152
4495
|
var HEIGHT = { months: 216, bridge: 216, spark: 32 };
|
|
4153
4496
|
var PAD = 2;
|
|
4154
4497
|
var ZERO_INSET = 1.5;
|
|
@@ -4186,8 +4529,8 @@ function barPath(m) {
|
|
|
4186
4529
|
return `M${px(x)} ${px(roundBottom ? bottom - r : bottom)}V${px(roundTop ? top + r : top)}` + (roundTop ? `${arc(r, -r, 1)}h${px(w - r * 2)}${arc(r, r, 1)}` : `h${px(w)}`) + `V${px(roundBottom ? bottom - r : bottom)}` + (roundBottom ? `${arc(-r, r, 1)}h${px(-(w - r * 2))}${arc(-r, -r, 1)}` : `h${px(-w)}`) + "z";
|
|
4187
4530
|
}
|
|
4188
4531
|
function useTapFloor() {
|
|
4189
|
-
const [floor, setFloor] =
|
|
4190
|
-
|
|
4532
|
+
const [floor, setFloor] = useState18(TARGET);
|
|
4533
|
+
useEffect17(() => {
|
|
4191
4534
|
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX2}px) and (pointer: coarse)`);
|
|
4192
4535
|
if (!query) return;
|
|
4193
4536
|
const read = () => setFloor(query.matches ? TAP_FLOOR : TARGET);
|
|
@@ -4309,23 +4652,23 @@ function Chart(props) {
|
|
|
4309
4652
|
const spark = variant === "spark";
|
|
4310
4653
|
const plotHeight = height ?? HEIGHT[variant];
|
|
4311
4654
|
const showTable = table ?? !spark;
|
|
4312
|
-
const uid =
|
|
4313
|
-
const frameEl =
|
|
4314
|
-
const scroller =
|
|
4315
|
-
const plot =
|
|
4316
|
-
const tipEl =
|
|
4317
|
-
const svgEl =
|
|
4318
|
-
const ignoreMouseUntil =
|
|
4319
|
-
const touchMoved =
|
|
4320
|
-
const dismissed =
|
|
4321
|
-
const opening =
|
|
4322
|
-
const pointerFocus =
|
|
4655
|
+
const uid = useId14().replace(/[^\w-]/g, "");
|
|
4656
|
+
const frameEl = useRef22(null);
|
|
4657
|
+
const scroller = useRef22(null);
|
|
4658
|
+
const plot = useRef22(null);
|
|
4659
|
+
const tipEl = useRef22(null);
|
|
4660
|
+
const svgEl = useRef22(null);
|
|
4661
|
+
const ignoreMouseUntil = useRef22(0);
|
|
4662
|
+
const touchMoved = useRef22(false);
|
|
4663
|
+
const dismissed = useRef22(null);
|
|
4664
|
+
const opening = useRef22(false);
|
|
4665
|
+
const pointerFocus = useRef22(false);
|
|
4323
4666
|
const floor = useTapFloor();
|
|
4324
|
-
const [width, setWidth] =
|
|
4325
|
-
const [openId, setOpenId] =
|
|
4326
|
-
const [rawCursor, setCursor] =
|
|
4327
|
-
const [said, setSaid] =
|
|
4328
|
-
const [ownPick, setOwnPick] =
|
|
4667
|
+
const [width, setWidth] = useState18(0);
|
|
4668
|
+
const [openId, setOpenId] = useState18(null);
|
|
4669
|
+
const [rawCursor, setCursor] = useState18(0);
|
|
4670
|
+
const [said, setSaid] = useState18("");
|
|
4671
|
+
const [ownPick, setOwnPick] = useState18(null);
|
|
4329
4672
|
const pick = selected === void 0 ? ownPick : selected;
|
|
4330
4673
|
const steps = props.variant === "bridge" ? props.steps : void 0;
|
|
4331
4674
|
const bridgeTones = props.variant === "bridge" ? props.tones : void 0;
|
|
@@ -4429,7 +4772,7 @@ function Chart(props) {
|
|
|
4429
4772
|
const byId = useMemo4(() => new Map(marks.map((m) => [m.id, m])), [marks]);
|
|
4430
4773
|
const lead = useCallback7((column) => marks.find((m) => m.column === column), [marks]);
|
|
4431
4774
|
const open = openId ? byId.get(openId) : void 0;
|
|
4432
|
-
|
|
4775
|
+
useEffect17(() => {
|
|
4433
4776
|
const el = plot.current;
|
|
4434
4777
|
if (!el) return;
|
|
4435
4778
|
const read = () => setWidth(el.clientWidth);
|
|
@@ -4446,13 +4789,13 @@ function Chart(props) {
|
|
|
4446
4789
|
el.classList.toggle("is-more-before", el.scrollLeft > 1);
|
|
4447
4790
|
el.classList.toggle("is-more-after", el.scrollLeft < last - 1);
|
|
4448
4791
|
}, []);
|
|
4449
|
-
|
|
4792
|
+
useEffect17(syncEdges, [syncEdges, plotWidth, count]);
|
|
4450
4793
|
useLayoutEffect5(() => {
|
|
4451
4794
|
if (!openId || !frameEl.current || !tipEl.current || !svgEl.current) return;
|
|
4452
4795
|
const anchor = [...svgEl.current.querySelectorAll("[data-anchor]")].find((el) => el.getAttribute("data-anchor") === openId);
|
|
4453
4796
|
if (anchor) placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
|
|
4454
4797
|
}, [openId, plotWidth, plotHeight]);
|
|
4455
|
-
|
|
4798
|
+
useEffect17(() => {
|
|
4456
4799
|
if (!openId) return;
|
|
4457
4800
|
const doc = frameEl.current?.ownerDocument;
|
|
4458
4801
|
const view = doc?.defaultView;
|
|
@@ -4524,7 +4867,7 @@ function Chart(props) {
|
|
|
4524
4867
|
const estimated = columns.filter((c) => c.estimated);
|
|
4525
4868
|
const estimatedTone = marks.find((m) => m.estimated && m.kind === "bar")?.tone ?? keys[0]?.tone ?? "neutral";
|
|
4526
4869
|
const hitBand = (band) => band === "up" ? { y: PAD, h: Math.max(zero - PAD, TARGET) } : band === "down" ? { y: zero, h: Math.max(plotHeight - PAD - zero, TARGET) } : { y: PAD, h: Math.max(plotHeight - PAD * 2, TARGET) };
|
|
4527
|
-
return /* @__PURE__ */
|
|
4870
|
+
return /* @__PURE__ */ jsxs36(
|
|
4528
4871
|
"div",
|
|
4529
4872
|
{
|
|
4530
4873
|
className: cx8("ui-chart", `ui-chart--${variant}`, selectable && "ui-chart--pick", className),
|
|
@@ -4535,9 +4878,9 @@ function Chart(props) {
|
|
|
4535
4878
|
"--ui-chart-pad": `${PAD}px`
|
|
4536
4879
|
},
|
|
4537
4880
|
children: [
|
|
4538
|
-
!spark && keys.length > 0 && /* @__PURE__ */
|
|
4539
|
-
keys.map((key) => /* @__PURE__ */
|
|
4540
|
-
key.shape === "line" ? /* @__PURE__ */
|
|
4881
|
+
!spark && keys.length > 0 && /* @__PURE__ */ jsxs36("ul", { className: "ui-chart__legend", children: [
|
|
4882
|
+
keys.map((key) => /* @__PURE__ */ jsxs36("li", { className: cx8("ui-chart__key", `ui-chart__tone--${key.tone}`), children: [
|
|
4883
|
+
key.shape === "line" ? /* @__PURE__ */ jsx41("svg", { className: "ui-chart__key-mark", width: "18", height: "12", viewBox: "0 0 18 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx41("path", { className: "ui-chart__key-line", d: "M1 9 L6 5 L12 7 L17 3" }) }) : /* @__PURE__ */ jsx41("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx41(
|
|
4541
4884
|
"rect",
|
|
4542
4885
|
{
|
|
4543
4886
|
className: "ui-chart__key-swatch",
|
|
@@ -4550,12 +4893,12 @@ function Chart(props) {
|
|
|
4550
4893
|
) }),
|
|
4551
4894
|
key.name
|
|
4552
4895
|
] }, key.id)),
|
|
4553
|
-
estimated.length > 0 && /* @__PURE__ */
|
|
4554
|
-
/* @__PURE__ */
|
|
4896
|
+
estimated.length > 0 && /* @__PURE__ */ jsxs36("li", { className: cx8("ui-chart__key", `ui-chart__tone--${estimatedTone}`), children: [
|
|
4897
|
+
/* @__PURE__ */ jsx41("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx41("rect", { className: "ui-chart__key-estimated", x: "1.5", y: "1.5", width: "9", height: "9", rx: "1" }) }),
|
|
4555
4898
|
"Estimated"
|
|
4556
4899
|
] })
|
|
4557
4900
|
] }),
|
|
4558
|
-
/* @__PURE__ */
|
|
4901
|
+
/* @__PURE__ */ jsxs36(
|
|
4559
4902
|
"div",
|
|
4560
4903
|
{
|
|
4561
4904
|
ref: frameEl,
|
|
@@ -4579,8 +4922,8 @@ function Chart(props) {
|
|
|
4579
4922
|
setSaid("");
|
|
4580
4923
|
},
|
|
4581
4924
|
children: [
|
|
4582
|
-
!spark && scale.ticks.length > 0 && /* @__PURE__ */
|
|
4583
|
-
/* @__PURE__ */
|
|
4925
|
+
!spark && scale.ticks.length > 0 && /* @__PURE__ */ jsx41("div", { className: "ui-chart__axis", "aria-hidden": "true", children: [...scale.ticks].reverse().map((tick) => /* @__PURE__ */ jsx41("span", { className: "ui-chart__tick", children: formatAxis(tick) }, tick)) }),
|
|
4926
|
+
/* @__PURE__ */ jsx41("div", { ref: scroller, className: "ui-chart__scroll", tabIndex: -1, onScroll: () => {
|
|
4584
4927
|
syncEdges();
|
|
4585
4928
|
const anchor = [...svgEl.current?.querySelectorAll("[data-anchor]") ?? []].find((el) => el.getAttribute("data-anchor") === openId);
|
|
4586
4929
|
if (!anchor || !scroller.current || !frameEl.current || !tipEl.current) return;
|
|
@@ -4588,8 +4931,8 @@ function Chart(props) {
|
|
|
4588
4931
|
const view = scroller.current.getBoundingClientRect();
|
|
4589
4932
|
if (mark.right <= view.left || mark.left >= view.right) setOpenId(null);
|
|
4590
4933
|
else placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
|
|
4591
|
-
}, children: /* @__PURE__ */
|
|
4592
|
-
/* @__PURE__ */
|
|
4934
|
+
}, children: /* @__PURE__ */ jsxs36("div", { ref: plot, className: "ui-chart__plot", children: [
|
|
4935
|
+
/* @__PURE__ */ jsxs36(
|
|
4593
4936
|
"svg",
|
|
4594
4937
|
{
|
|
4595
4938
|
ref: svgEl,
|
|
@@ -4649,7 +4992,7 @@ function Chart(props) {
|
|
|
4649
4992
|
announce(mark.column, selectable ? mark.column : pick);
|
|
4650
4993
|
},
|
|
4651
4994
|
children: [
|
|
4652
|
-
!spark && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */
|
|
4995
|
+
!spark && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */ jsx41(
|
|
4653
4996
|
"rect",
|
|
4654
4997
|
{
|
|
4655
4998
|
className: "ui-chart__band",
|
|
@@ -4662,7 +5005,7 @@ function Chart(props) {
|
|
|
4662
5005
|
frame.links && frame.bars.slice(0, -1).map((bar, i) => {
|
|
4663
5006
|
const from = byId.get(bar.id);
|
|
4664
5007
|
const to = byId.get(frame.bars[i + 1].id);
|
|
4665
|
-
return from && to ? /* @__PURE__ */
|
|
5008
|
+
return from && to ? /* @__PURE__ */ jsx41(
|
|
4666
5009
|
"line",
|
|
4667
5010
|
{
|
|
4668
5011
|
className: "ui-chart__carry",
|
|
@@ -4674,7 +5017,7 @@ function Chart(props) {
|
|
|
4674
5017
|
`carry-${bar.id}`
|
|
4675
5018
|
) : null;
|
|
4676
5019
|
}),
|
|
4677
|
-
!spark && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */
|
|
5020
|
+
!spark && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */ jsx41(
|
|
4678
5021
|
"line",
|
|
4679
5022
|
{
|
|
4680
5023
|
className: "ui-chart__grid",
|
|
@@ -4685,7 +5028,7 @@ function Chart(props) {
|
|
|
4685
5028
|
},
|
|
4686
5029
|
`grid-${tick}`
|
|
4687
5030
|
)),
|
|
4688
|
-
!spark && scale.ticks.includes(0) && /* @__PURE__ */
|
|
5031
|
+
!spark && scale.ticks.includes(0) && /* @__PURE__ */ jsx41(
|
|
4689
5032
|
"line",
|
|
4690
5033
|
{
|
|
4691
5034
|
className: "ui-chart__zero",
|
|
@@ -4695,7 +5038,7 @@ function Chart(props) {
|
|
|
4695
5038
|
y2: px(y(0))
|
|
4696
5039
|
}
|
|
4697
5040
|
),
|
|
4698
|
-
marks.filter((m) => m.kind === "bar").map((mark) => /* @__PURE__ */
|
|
5041
|
+
marks.filter((m) => m.kind === "bar").map((mark) => /* @__PURE__ */ jsx41(
|
|
4699
5042
|
"path",
|
|
4700
5043
|
{
|
|
4701
5044
|
className: cx8(
|
|
@@ -4708,7 +5051,7 @@ function Chart(props) {
|
|
|
4708
5051
|
`bar-${mark.id}`
|
|
4709
5052
|
)),
|
|
4710
5053
|
["casing", "stroke"].map((layer) => lines.flatMap(
|
|
4711
|
-
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */
|
|
5054
|
+
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */ jsx41(
|
|
4712
5055
|
"line",
|
|
4713
5056
|
{
|
|
4714
5057
|
className: layer === "casing" ? "ui-chart__line-casing" : cx8(
|
|
@@ -4724,7 +5067,7 @@ function Chart(props) {
|
|
|
4724
5067
|
`${line.id}-${layer}-${i}`
|
|
4725
5068
|
) : null)
|
|
4726
5069
|
)),
|
|
4727
|
-
lines.flatMap((line) => line.values.map((value, i) => Number.isFinite(value) && !Number.isFinite(line.values[i - 1]) && !Number.isFinite(line.values[i + 1]) ? /* @__PURE__ */
|
|
5070
|
+
lines.flatMap((line) => line.values.map((value, i) => Number.isFinite(value) && !Number.isFinite(line.values[i - 1]) && !Number.isFinite(line.values[i + 1]) ? /* @__PURE__ */ jsx41(
|
|
4728
5071
|
"circle",
|
|
4729
5072
|
{
|
|
4730
5073
|
className: cx8("ui-chart__isolated", `ui-chart__tone--${line.tone}`),
|
|
@@ -4734,8 +5077,8 @@ function Chart(props) {
|
|
|
4734
5077
|
},
|
|
4735
5078
|
`isolated-${line.id}-${i}`
|
|
4736
5079
|
) : null)),
|
|
4737
|
-
marks.map((mark) => /* @__PURE__ */
|
|
4738
|
-
mark.kind === "bar" ? /* @__PURE__ */
|
|
5080
|
+
marks.map((mark) => /* @__PURE__ */ jsxs36("g", { "data-mark": mark.id, children: [
|
|
5081
|
+
mark.kind === "bar" ? /* @__PURE__ */ jsx41(
|
|
4739
5082
|
"rect",
|
|
4740
5083
|
{
|
|
4741
5084
|
className: "ui-chart__hit",
|
|
@@ -4744,7 +5087,7 @@ function Chart(props) {
|
|
|
4744
5087
|
y: px(hitBand(mark.band).y),
|
|
4745
5088
|
height: px(hitBand(mark.band).h)
|
|
4746
5089
|
}
|
|
4747
|
-
) : /* @__PURE__ */
|
|
5090
|
+
) : /* @__PURE__ */ jsx41(
|
|
4748
5091
|
"rect",
|
|
4749
5092
|
{
|
|
4750
5093
|
className: "ui-chart__hit",
|
|
@@ -4754,7 +5097,7 @@ function Chart(props) {
|
|
|
4754
5097
|
height: px(mark.hit?.h ?? TARGET)
|
|
4755
5098
|
}
|
|
4756
5099
|
),
|
|
4757
|
-
/* @__PURE__ */
|
|
5100
|
+
/* @__PURE__ */ jsx41(
|
|
4758
5101
|
"rect",
|
|
4759
5102
|
{
|
|
4760
5103
|
"data-anchor": mark.id,
|
|
@@ -4769,7 +5112,7 @@ function Chart(props) {
|
|
|
4769
5112
|
]
|
|
4770
5113
|
}
|
|
4771
5114
|
),
|
|
4772
|
-
!spark && /* @__PURE__ */
|
|
5115
|
+
!spark && /* @__PURE__ */ jsx41("div", { className: "ui-chart__periods", "aria-hidden": "true", children: columns.map((column, i) => /* @__PURE__ */ jsx41(
|
|
4773
5116
|
"span",
|
|
4774
5117
|
{
|
|
4775
5118
|
className: cx8("ui-chart__period", pick === i && "is-selected"),
|
|
@@ -4778,35 +5121,35 @@ function Chart(props) {
|
|
|
4778
5121
|
`${column.label}-${i}`
|
|
4779
5122
|
)) })
|
|
4780
5123
|
] }) }),
|
|
4781
|
-
/* @__PURE__ */
|
|
4782
|
-
/* @__PURE__ */
|
|
4783
|
-
/* @__PURE__ */
|
|
4784
|
-
(stateOf(columns[open.column]) || open.detail) && /* @__PURE__ */
|
|
5124
|
+
/* @__PURE__ */ jsx41("span", { ref: tipEl, className: cx8("ui-tip", openId && "is-open"), role: open ? "tooltip" : void 0, children: open && /* @__PURE__ */ jsxs36(Fragment16, { children: [
|
|
5125
|
+
/* @__PURE__ */ jsx41("span", { className: "ui-tip__label", children: spark ? columns[open.column]?.label : `${open.name}, ${columns[open.column]?.label}` }),
|
|
5126
|
+
/* @__PURE__ */ jsx41("span", { className: "ui-tip__value", children: format(open.value) }),
|
|
5127
|
+
(stateOf(columns[open.column]) || open.detail) && /* @__PURE__ */ jsx41("span", { className: "ui-tip__detail", children: stateOf(columns[open.column]) || open.detail })
|
|
4785
5128
|
] }) })
|
|
4786
5129
|
]
|
|
4787
5130
|
}
|
|
4788
5131
|
),
|
|
4789
|
-
/* @__PURE__ */
|
|
4790
|
-
showTable && /* @__PURE__ */
|
|
4791
|
-
/* @__PURE__ */
|
|
4792
|
-
/* @__PURE__ */
|
|
5132
|
+
/* @__PURE__ */ jsx41("div", { className: "ui-sr", role: "status", children: said }),
|
|
5133
|
+
showTable && /* @__PURE__ */ jsxs36("details", { className: "ui-chart__data", children: [
|
|
5134
|
+
/* @__PURE__ */ jsx41("summary", { className: "ui-focusable", children: "Values as a table" }),
|
|
5135
|
+
/* @__PURE__ */ jsx41(
|
|
4793
5136
|
"div",
|
|
4794
5137
|
{
|
|
4795
5138
|
className: "ui-table-scroll",
|
|
4796
5139
|
role: "region",
|
|
4797
5140
|
tabIndex: 0,
|
|
4798
5141
|
"aria-label": `${title}, as a table. Scroll for more columns.`,
|
|
4799
|
-
children: /* @__PURE__ */
|
|
4800
|
-
/* @__PURE__ */
|
|
4801
|
-
/* @__PURE__ */
|
|
4802
|
-
/* @__PURE__ */
|
|
5142
|
+
children: /* @__PURE__ */ jsxs36("table", { className: "ui-table", "aria-label": title, children: [
|
|
5143
|
+
/* @__PURE__ */ jsx41("thead", { children: /* @__PURE__ */ jsx41("tr", { children: tableHead.map((head, i) => /* @__PURE__ */ jsx41("th", { scope: "col", className: cx8(i > 0 && "ui-table__num"), children: head }, head)) }) }),
|
|
5144
|
+
/* @__PURE__ */ jsx41("tbody", { children: tableRows.map((row, i) => /* @__PURE__ */ jsxs36("tr", { "aria-current": pick === i ? true : void 0, children: [
|
|
5145
|
+
/* @__PURE__ */ jsxs36("th", { scope: "row", children: [
|
|
4803
5146
|
row.column.label,
|
|
4804
|
-
row.column.estimated && /* @__PURE__ */
|
|
5147
|
+
row.column.estimated && /* @__PURE__ */ jsxs36(Fragment16, { children: [
|
|
4805
5148
|
" ",
|
|
4806
|
-
/* @__PURE__ */
|
|
5149
|
+
/* @__PURE__ */ jsx41("span", { className: "ui-chart__state", children: stateOf(row.column) })
|
|
4807
5150
|
] })
|
|
4808
5151
|
] }),
|
|
4809
|
-
row.cells.map((cell, j) => /* @__PURE__ */
|
|
5152
|
+
row.cells.map((cell, j) => /* @__PURE__ */ jsx41("td", { className: "ui-table__num", children: cell }, tableHead[j + 1]))
|
|
4810
5153
|
] }, `${row.column.label}-${i}`)) })
|
|
4811
5154
|
] })
|
|
4812
5155
|
}
|
|
@@ -4820,7 +5163,7 @@ function Chart(props) {
|
|
|
4820
5163
|
// src/AccentPicker.tsx
|
|
4821
5164
|
import { forwardRef as forwardRef10 } from "react";
|
|
4822
5165
|
import { ACCENTS, accentSwatchStyle } from "@apliteni/apliteni-ui";
|
|
4823
|
-
import { jsx as
|
|
5166
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
4824
5167
|
var AccentPicker = forwardRef10(function AccentPicker2({
|
|
4825
5168
|
value,
|
|
4826
5169
|
onChange,
|
|
@@ -4829,7 +5172,7 @@ var AccentPicker = forwardRef10(function AccentPicker2({
|
|
|
4829
5172
|
"aria-label": label = "Accent",
|
|
4830
5173
|
...rest
|
|
4831
5174
|
}, ref) {
|
|
4832
|
-
return /* @__PURE__ */
|
|
5175
|
+
return /* @__PURE__ */ jsx42(
|
|
4833
5176
|
"div",
|
|
4834
5177
|
{
|
|
4835
5178
|
...rest,
|
|
@@ -4840,7 +5183,7 @@ var AccentPicker = forwardRef10(function AccentPicker2({
|
|
|
4840
5183
|
"aria-label": label,
|
|
4841
5184
|
children: options.map((accent) => {
|
|
4842
5185
|
const title = accent.charAt(0).toUpperCase() + accent.slice(1);
|
|
4843
|
-
return /* @__PURE__ */
|
|
5186
|
+
return /* @__PURE__ */ jsx42(
|
|
4844
5187
|
"button",
|
|
4845
5188
|
{
|
|
4846
5189
|
type: "button",
|
|
@@ -4859,9 +5202,9 @@ var AccentPicker = forwardRef10(function AccentPicker2({
|
|
|
4859
5202
|
});
|
|
4860
5203
|
|
|
4861
5204
|
// src/NavTabs.tsx
|
|
4862
|
-
import { Fragment as
|
|
4863
|
-
import { safeUrl, observeNavFit, revealCurrentNav, revealFocusedNav } from "@apliteni/apliteni-ui";
|
|
4864
|
-
import { Fragment as
|
|
5205
|
+
import { Fragment as Fragment17, forwardRef as forwardRef11, useEffect as useEffect18, useRef as useRef23, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
5206
|
+
import { safeUrl as safeUrl3, observeNavFit, revealCurrentNav, revealFocusedNav } from "@apliteni/apliteni-ui";
|
|
5207
|
+
import { Fragment as Fragment18, jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4865
5208
|
var NavTabs = forwardRef11(function NavTabs2({
|
|
4866
5209
|
items,
|
|
4867
5210
|
active,
|
|
@@ -4872,14 +5215,14 @@ var NavTabs = forwardRef11(function NavTabs2({
|
|
|
4872
5215
|
"aria-label": ariaLabel = "Tabs",
|
|
4873
5216
|
...rest
|
|
4874
5217
|
}, ref) {
|
|
4875
|
-
const navRef =
|
|
5218
|
+
const navRef = useRef23(null);
|
|
4876
5219
|
useImperativeHandle2(ref, () => navRef.current, []);
|
|
4877
5220
|
const signature = items.map((item) => item.id).join("\0");
|
|
4878
|
-
|
|
4879
|
-
|
|
5221
|
+
useEffect18(() => observeNavFit(navRef.current), []);
|
|
5222
|
+
useEffect18(() => {
|
|
4880
5223
|
if (navRef.current) revealCurrentNav(navRef.current);
|
|
4881
5224
|
}, [active, signature]);
|
|
4882
|
-
return /* @__PURE__ */
|
|
5225
|
+
return /* @__PURE__ */ jsx43(
|
|
4883
5226
|
"nav",
|
|
4884
5227
|
{
|
|
4885
5228
|
...rest,
|
|
@@ -4892,20 +5235,20 @@ var NavTabs = forwardRef11(function NavTabs2({
|
|
|
4892
5235
|
},
|
|
4893
5236
|
children: items.map((item) => {
|
|
4894
5237
|
const badge = item.badge != null && typeof item.badge === "object" ? item.badge : { text: item.badge, tone: void 0 };
|
|
4895
|
-
const inner = /* @__PURE__ */
|
|
4896
|
-
/* @__PURE__ */
|
|
4897
|
-
badge.text != null && badge.text !== "" && /* @__PURE__ */
|
|
5238
|
+
const inner = /* @__PURE__ */ jsxs37(Fragment18, { children: [
|
|
5239
|
+
/* @__PURE__ */ jsx43("span", { className: "ui-nav__tab-label", children: item.label }),
|
|
5240
|
+
badge.text != null && badge.text !== "" && /* @__PURE__ */ jsx43("span", { className: `ui-nav__badge is-${badge.tone || "neutral"}`, children: badge.text })
|
|
4898
5241
|
] });
|
|
4899
|
-
if (item.disabled) return /* @__PURE__ */
|
|
5242
|
+
if (item.disabled) return /* @__PURE__ */ jsx43("span", { className: "ui-nav__tab is-disabled", "aria-disabled": "true", children: inner }, item.id);
|
|
4900
5243
|
const current = item.id === active;
|
|
4901
5244
|
const linkProps = {
|
|
4902
5245
|
className: ["ui-nav__tab", current && "is-active"].filter(Boolean).join(" "),
|
|
4903
|
-
href:
|
|
5246
|
+
href: safeUrl3(item.href || `#${item.id}`),
|
|
4904
5247
|
target: item.target,
|
|
4905
5248
|
"aria-current": current ? "page" : void 0,
|
|
4906
5249
|
children: inner
|
|
4907
5250
|
};
|
|
4908
|
-
return /* @__PURE__ */
|
|
5251
|
+
return /* @__PURE__ */ jsx43(Fragment17, { children: renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx43("a", { ...linkProps }) }, item.id);
|
|
4909
5252
|
})
|
|
4910
5253
|
}
|
|
4911
5254
|
);
|
|
@@ -4913,8 +5256,8 @@ var NavTabs = forwardRef11(function NavTabs2({
|
|
|
4913
5256
|
|
|
4914
5257
|
// src/Breadcrumbs.tsx
|
|
4915
5258
|
import { forwardRef as forwardRef12 } from "react";
|
|
4916
|
-
import { icon as icon7, safeUrl as
|
|
4917
|
-
import { Fragment as
|
|
5259
|
+
import { icon as icon7, safeUrl as safeUrl4 } from "@apliteni/apliteni-ui";
|
|
5260
|
+
import { Fragment as Fragment19, jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4918
5261
|
var Breadcrumbs = forwardRef12(function Breadcrumbs2({
|
|
4919
5262
|
items,
|
|
4920
5263
|
renderLink,
|
|
@@ -4922,21 +5265,21 @@ var Breadcrumbs = forwardRef12(function Breadcrumbs2({
|
|
|
4922
5265
|
"aria-label": ariaLabel = "Breadcrumb",
|
|
4923
5266
|
...rest
|
|
4924
5267
|
}, ref) {
|
|
4925
|
-
return /* @__PURE__ */
|
|
5268
|
+
return /* @__PURE__ */ jsx44(
|
|
4926
5269
|
"nav",
|
|
4927
5270
|
{
|
|
4928
5271
|
...rest,
|
|
4929
5272
|
ref,
|
|
4930
5273
|
className: ["ui-nav", "ui-nav--crumbs", className].filter(Boolean).join(" "),
|
|
4931
5274
|
"aria-label": ariaLabel,
|
|
4932
|
-
children: /* @__PURE__ */
|
|
5275
|
+
children: /* @__PURE__ */ jsx44("ol", { className: "ui-nav__crumbs", children: items.map((item, index) => {
|
|
4933
5276
|
const current = index === items.length - 1;
|
|
4934
|
-
const inner = /* @__PURE__ */
|
|
4935
|
-
item.icon && /* @__PURE__ */
|
|
4936
|
-
/* @__PURE__ */
|
|
5277
|
+
const inner = /* @__PURE__ */ jsxs38(Fragment19, { children: [
|
|
5278
|
+
item.icon && /* @__PURE__ */ jsx44("span", { className: "ui-nav__ic", dangerouslySetInnerHTML: { __html: icon7(item.icon) } }),
|
|
5279
|
+
/* @__PURE__ */ jsx44("span", { className: "ui-nav__crumb-label", children: item.label })
|
|
4937
5280
|
] });
|
|
4938
|
-
const linkProps = !current && item.href ? { className: "ui-nav__crumb", href:
|
|
4939
|
-
return /* @__PURE__ */
|
|
5281
|
+
const linkProps = !current && item.href ? { className: "ui-nav__crumb", href: safeUrl4(item.href), target: item.target, children: inner } : null;
|
|
5282
|
+
return /* @__PURE__ */ jsx44("li", { className: "ui-nav__crumb-item", children: linkProps ? renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx44("a", { ...linkProps }) : /* @__PURE__ */ jsx44(
|
|
4940
5283
|
"span",
|
|
4941
5284
|
{
|
|
4942
5285
|
className: ["ui-nav__crumb", current && "is-current"].filter(Boolean).join(" "),
|
|
@@ -4977,10 +5320,12 @@ export {
|
|
|
4977
5320
|
DrawerSection,
|
|
4978
5321
|
Dropdown,
|
|
4979
5322
|
EmptyState,
|
|
5323
|
+
Feedback,
|
|
4980
5324
|
Field,
|
|
4981
5325
|
FileDrop,
|
|
4982
5326
|
FileField,
|
|
4983
5327
|
FilterBar,
|
|
5328
|
+
Footer,
|
|
4984
5329
|
Icon,
|
|
4985
5330
|
KeyValueList,
|
|
4986
5331
|
Modal,
|