@apliteni/apliteni-ui 0.130.0 → 0.132.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 +2 -1
- package/react/dist/index.d.ts +28 -1
- package/react/dist/index.js +628 -565
- package/src/components/account-nav.js +4 -7
- package/src/components/avatar.js +53 -0
- package/src/components/dropdown.js +529 -30
- package/src/components/shell.js +3 -2
- package/src/components/topbar.js +4 -3
- package/src/index.css +1 -0
- package/src/index.d.ts +40 -0
- package/src/index.js +1 -0
- package/src/inline.js +2 -0
- package/src/logic/avatar.js +28 -0
- package/src/logic/dropdown.js +22 -0
- package/src/styles/avatar.css +42 -0
- package/src/styles/dropdown.css +92 -22
- package/src/styles/layout.css +3 -6
- package/src/styles/topbar.css +6 -3
- package/src/tokens/tokens.css +23 -0
package/react/dist/index.js
CHANGED
|
@@ -94,7 +94,7 @@ var cx = (...a) => a.filter(Boolean).join(" ");
|
|
|
94
94
|
var Button = forwardRef3(function Button2({
|
|
95
95
|
variant = "secondary",
|
|
96
96
|
size = "md",
|
|
97
|
-
icon:
|
|
97
|
+
icon: icon8,
|
|
98
98
|
leading,
|
|
99
99
|
iconRight,
|
|
100
100
|
iconOnly,
|
|
@@ -158,7 +158,7 @@ var Button = forwardRef3(function Button2({
|
|
|
158
158
|
className
|
|
159
159
|
);
|
|
160
160
|
const labelled = rest["aria-label"] != null || rest["aria-labelledby"] != null;
|
|
161
|
-
const fallback = typeof children === "string" && children.trim() ? children.trim() :
|
|
161
|
+
const fallback = typeof children === "string" && children.trim() ? children.trim() : icon8;
|
|
162
162
|
const named = iconOnly && !labelled && fallback ? { "aria-label": fallback, title: rest.title ?? fallback } : {};
|
|
163
163
|
const Root = href === void 0 ? "button" : "a";
|
|
164
164
|
return /* @__PURE__ */ jsxs3(
|
|
@@ -203,7 +203,7 @@ var Button = forwardRef3(function Button2({
|
|
|
203
203
|
if (!blockKey(event)) onKeyUp?.(event);
|
|
204
204
|
},
|
|
205
205
|
children: [
|
|
206
|
-
leading != null ? /* @__PURE__ */ jsx4("span", { "aria-hidden": "true", style: { display: "inline-flex" }, children: leading }) :
|
|
206
|
+
leading != null ? /* @__PURE__ */ jsx4("span", { "aria-hidden": "true", style: { display: "inline-flex" }, children: leading }) : icon8 && /* @__PURE__ */ jsx4(Icon, { name: icon8 }),
|
|
207
207
|
!iconOnly && renderedChildren != null && /* @__PURE__ */ jsx4("span", { className: "ui-btn__label-slot", children: /* @__PURE__ */ jsx4("span", { className: "ui-btn__label", ref: labelRef, children: renderedChildren }) }),
|
|
208
208
|
iconRight && /* @__PURE__ */ jsx4(Icon, { name: iconRight }),
|
|
209
209
|
busy && /* @__PURE__ */ jsxs3("span", { className: "ui-btn__dots", "aria-hidden": "true", children: [
|
|
@@ -223,21 +223,46 @@ function Badge({ variant = "neutral", children }) {
|
|
|
223
223
|
return /* @__PURE__ */ jsx5("span", { className: cls, children });
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
// src/primitives/Avatar.tsx
|
|
227
|
+
import { useCallback, useState } from "react";
|
|
228
|
+
import { icon as icon2, avatarHue, avatarInitials } from "@apliteni/apliteni-ui";
|
|
229
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
230
|
+
function Avatar({ personKey, name, src, size = 24, empty = false }) {
|
|
231
|
+
const [failedSrc, setFailedSrc] = useState(null);
|
|
232
|
+
const [loadedSrc, setLoadedSrc] = useState(null);
|
|
233
|
+
const inspectPhoto = useCallback((img) => {
|
|
234
|
+
if (!img || !src || !img.complete) return;
|
|
235
|
+
if (img.naturalWidth > 0) setLoadedSrc(src);
|
|
236
|
+
else setFailedSrc(src);
|
|
237
|
+
}, [src]);
|
|
238
|
+
const base = ["ui-avatar", size === 32 && "ui-avatar--32"];
|
|
239
|
+
const cls = (...more) => [...base, ...more].filter(Boolean).join(" ");
|
|
240
|
+
if (empty) return /* @__PURE__ */ jsx6("span", { className: cls("ui-avatar--empty"), "aria-hidden": "true" });
|
|
241
|
+
const letters = avatarInitials(name);
|
|
242
|
+
if (!letters) {
|
|
243
|
+
return /* @__PURE__ */ jsx6("span", { className: cls("ui-avatar--anon"), "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon2("user") } });
|
|
244
|
+
}
|
|
245
|
+
return /* @__PURE__ */ jsxs4("span", { className: cls(`ui-avatar--h${avatarHue(personKey ?? name)}`), "data-initials": letters.length, "aria-hidden": "true", children: [
|
|
246
|
+
letters,
|
|
247
|
+
src && src !== failedSrc && /* @__PURE__ */ jsx6("img", { ref: inspectPhoto, src, alt: "", loading: "lazy", className: loadedSrc === src ? "is-loaded" : void 0, onLoad: () => setLoadedSrc(src), onError: () => setFailedSrc(src) })
|
|
248
|
+
] });
|
|
249
|
+
}
|
|
250
|
+
|
|
226
251
|
// src/primitives/Pill.tsx
|
|
227
252
|
import { forwardRef as forwardRef4 } from "react";
|
|
228
|
-
import { jsx as
|
|
253
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
229
254
|
var Pill = forwardRef4(function Pill2({
|
|
230
255
|
variant,
|
|
231
256
|
className,
|
|
232
257
|
...rest
|
|
233
258
|
}, ref) {
|
|
234
259
|
const classes = ["ui-pill", variant && `ui-pill--${variant}`, className].filter(Boolean).join(" ");
|
|
235
|
-
return /* @__PURE__ */
|
|
260
|
+
return /* @__PURE__ */ jsx7("span", { ...rest, ref, className: classes });
|
|
236
261
|
});
|
|
237
262
|
|
|
238
263
|
// src/primitives/StatusDot.tsx
|
|
239
264
|
import { forwardRef as forwardRef5 } from "react";
|
|
240
|
-
import { jsx as
|
|
265
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
241
266
|
var StatusDot = forwardRef5(function StatusDot2({
|
|
242
267
|
live = false,
|
|
243
268
|
className,
|
|
@@ -245,7 +270,7 @@ var StatusDot = forwardRef5(function StatusDot2({
|
|
|
245
270
|
}, ref) {
|
|
246
271
|
const labelled = Boolean(rest["aria-label"]?.trim() || rest["aria-labelledby"]?.trim());
|
|
247
272
|
const classes = ["ui-dot", live && "is-live", className].filter(Boolean).join(" ");
|
|
248
|
-
return /* @__PURE__ */
|
|
273
|
+
return /* @__PURE__ */ jsx8(
|
|
249
274
|
"span",
|
|
250
275
|
{
|
|
251
276
|
role: labelled ? "img" : void 0,
|
|
@@ -258,27 +283,27 @@ var StatusDot = forwardRef5(function StatusDot2({
|
|
|
258
283
|
});
|
|
259
284
|
|
|
260
285
|
// src/primitives/Card.tsx
|
|
261
|
-
import { jsx as
|
|
286
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
262
287
|
function Card({ title, sub, level = 2, className, children }) {
|
|
263
288
|
const n = Number(level);
|
|
264
289
|
const Heading = `h${[2, 3, 4, 5, 6].includes(n) ? n : 2}`;
|
|
265
290
|
const titled = title != null && title !== false && title !== "";
|
|
266
|
-
return /* @__PURE__ */
|
|
267
|
-
titled && /* @__PURE__ */
|
|
268
|
-
sub != null && /* @__PURE__ */
|
|
291
|
+
return /* @__PURE__ */ jsxs5("div", { className: ["ui-card", className].filter(Boolean).join(" "), children: [
|
|
292
|
+
titled && /* @__PURE__ */ jsx9(Heading, { className: "ui-card__title", children: title }),
|
|
293
|
+
sub != null && /* @__PURE__ */ jsx9("div", { className: "ui-card__sub", children: sub }),
|
|
269
294
|
children
|
|
270
295
|
] });
|
|
271
296
|
}
|
|
272
297
|
|
|
273
298
|
// src/primitives/Callout.tsx
|
|
274
299
|
import { calloutIcons, icon as kitIcon } from "@apliteni/apliteni-ui";
|
|
275
|
-
import { jsx as
|
|
276
|
-
function Callout({ variant, icon:
|
|
277
|
-
return /* @__PURE__ */
|
|
278
|
-
/* @__PURE__ */
|
|
279
|
-
/* @__PURE__ */
|
|
300
|
+
import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
301
|
+
function Callout({ variant, icon: icon8 = calloutIcons[variant ?? "neutral"], children, actions }) {
|
|
302
|
+
return /* @__PURE__ */ jsxs6("div", { className: `ui-callout${variant && variant !== "neutral" ? ` ui-callout--${variant}` : ""}`, role: variant === "danger" ? "alert" : void 0, children: [
|
|
303
|
+
/* @__PURE__ */ jsx10("span", { className: "ui-callout__icon", dangerouslySetInnerHTML: { __html: kitIcon(icon8) } }),
|
|
304
|
+
/* @__PURE__ */ jsxs6("div", { className: "ui-callout__body", children: [
|
|
280
305
|
children,
|
|
281
|
-
actions != null && /* @__PURE__ */
|
|
306
|
+
actions != null && /* @__PURE__ */ jsx10("div", { className: "ui-toolbar ui-callout__actions", children: actions })
|
|
282
307
|
] })
|
|
283
308
|
] });
|
|
284
309
|
}
|
|
@@ -326,8 +351,8 @@ function placeTip(host, mark, tip, bound, placement = "top") {
|
|
|
326
351
|
}
|
|
327
352
|
|
|
328
353
|
// src/Tooltip.tsx
|
|
329
|
-
import { useEffect, useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState } from "react";
|
|
330
|
-
import { Fragment, jsx as
|
|
354
|
+
import { useEffect, useId as useId2, useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
355
|
+
import { Fragment, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
331
356
|
var DOC_EVENTS = ["pointerdown", "pointercancel", "click", "keydown", "touchend"];
|
|
332
357
|
var CAPTURED = /* @__PURE__ */ new Set(["pointerdown", "pointercancel"]);
|
|
333
358
|
var wirings = /* @__PURE__ */ new WeakMap();
|
|
@@ -354,10 +379,10 @@ function wireDocument(doc, handlers) {
|
|
|
354
379
|
wirings.delete(doc);
|
|
355
380
|
};
|
|
356
381
|
}
|
|
357
|
-
var Text = ({ label = "", value = "", detail: detail2 = "" }) => /* @__PURE__ */
|
|
358
|
-
/* @__PURE__ */
|
|
359
|
-
/* @__PURE__ */
|
|
360
|
-
/* @__PURE__ */
|
|
382
|
+
var Text = ({ label = "", value = "", detail: detail2 = "" }) => /* @__PURE__ */ jsxs7(Fragment, { children: [
|
|
383
|
+
/* @__PURE__ */ jsx11("span", { className: "ui-tip__label", hidden: !label, children: label }),
|
|
384
|
+
/* @__PURE__ */ jsx11("span", { className: "ui-tip__value", hidden: !value, children: value }),
|
|
385
|
+
/* @__PURE__ */ jsx11("span", { className: "ui-tip__detail", hidden: !detail2, children: detail2 })
|
|
361
386
|
] });
|
|
362
387
|
function Tooltip({ text: text2, label = text2, value, detail: detail2, placement = "top", children }) {
|
|
363
388
|
const id = useId2();
|
|
@@ -369,7 +394,7 @@ function Tooltip({ text: text2, label = text2, value, detail: detail2, placement
|
|
|
369
394
|
const pointerKind = useRef2("");
|
|
370
395
|
const pendingClick = useRef2(null);
|
|
371
396
|
const dismissed = useRef2(null);
|
|
372
|
-
const [mark, setMark] =
|
|
397
|
+
const [mark, setMark] = useState2(null);
|
|
373
398
|
const active = useRef2(null);
|
|
374
399
|
active.current = mark;
|
|
375
400
|
const open = mark !== null;
|
|
@@ -435,7 +460,7 @@ function Tooltip({ text: text2, label = text2, value, detail: detail2, placement
|
|
|
435
460
|
view.removeEventListener("resize", reposition);
|
|
436
461
|
};
|
|
437
462
|
}, [open, placement]);
|
|
438
|
-
return /* @__PURE__ */
|
|
463
|
+
return /* @__PURE__ */ jsxs7(
|
|
439
464
|
"span",
|
|
440
465
|
{
|
|
441
466
|
ref: host,
|
|
@@ -507,15 +532,15 @@ function Tooltip({ text: text2, label = text2, value, detail: detail2, placement
|
|
|
507
532
|
}
|
|
508
533
|
},
|
|
509
534
|
children: [
|
|
510
|
-
/* @__PURE__ */
|
|
511
|
-
/* @__PURE__ */
|
|
535
|
+
/* @__PURE__ */ jsx11("span", { ref: trigger, className: "ui-focusable", tabIndex: 0, "aria-describedby": id, children }),
|
|
536
|
+
/* @__PURE__ */ jsx11("span", { ref: tip, id, "data-tip": "", role: "tooltip", className: `ui-tip${open ? " is-open" : ""}`, children: /* @__PURE__ */ jsx11(Text, { label, value, detail: detail2 }) })
|
|
512
537
|
]
|
|
513
538
|
}
|
|
514
539
|
);
|
|
515
540
|
}
|
|
516
541
|
|
|
517
542
|
// src/primitives/StatBand.tsx
|
|
518
|
-
import { Fragment as Fragment2, jsx as
|
|
543
|
+
import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
519
544
|
var GLYPH = { up: "arrowUp", down: "arrowDown", flat: "minus" };
|
|
520
545
|
var directionOf = (text2) => {
|
|
521
546
|
const t = text2.trim();
|
|
@@ -523,20 +548,20 @@ var directionOf = (text2) => {
|
|
|
523
548
|
};
|
|
524
549
|
var hasChange = (d) => !!d && d.value != null && d.value !== "";
|
|
525
550
|
function ContextRow({ caption, delta, basisId }) {
|
|
526
|
-
if (!hasChange(delta)) return caption ? /* @__PURE__ */
|
|
527
|
-
const lead = caption ? /* @__PURE__ */
|
|
528
|
-
/* @__PURE__ */
|
|
551
|
+
if (!hasChange(delta)) return caption ? /* @__PURE__ */ jsx12("dd", { className: "ui-stat__caption", children: caption }) : null;
|
|
552
|
+
const lead = caption ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
553
|
+
/* @__PURE__ */ jsx12("span", { className: "ui-stat__caption", children: caption }),
|
|
529
554
|
" "
|
|
530
555
|
] }) : null;
|
|
531
556
|
const dir = delta.direction && GLYPH[delta.direction] ? delta.direction : directionOf(delta.value);
|
|
532
557
|
const own = delta.basis || "";
|
|
533
|
-
return /* @__PURE__ */
|
|
558
|
+
return /* @__PURE__ */ jsxs8("dd", { className: "ui-stat__delta", "aria-describedby": !own && basisId ? basisId : void 0, children: [
|
|
534
559
|
lead,
|
|
535
|
-
/* @__PURE__ */
|
|
536
|
-
delta.tooltip ? /* @__PURE__ */
|
|
537
|
-
own ? /* @__PURE__ */
|
|
560
|
+
/* @__PURE__ */ jsx12(Icon, { name: GLYPH[dir] }),
|
|
561
|
+
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 }),
|
|
562
|
+
own ? /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
538
563
|
" ",
|
|
539
|
-
/* @__PURE__ */
|
|
564
|
+
/* @__PURE__ */ jsx12("span", { className: "ui-stat__basis", children: own })
|
|
540
565
|
] }) : null
|
|
541
566
|
] });
|
|
542
567
|
}
|
|
@@ -545,16 +570,16 @@ function StatBand({ stats, variant = "tiles", basis, basisId: sharedBasisId, lab
|
|
|
545
570
|
const v = ["band", "tiles", "open"].includes(variant) ? variant : "tiles";
|
|
546
571
|
const basisId = basis ? `${id || auto}-basis` : sharedBasisId;
|
|
547
572
|
const root = ["ui-stats", `ui-stats--${v}`, v === "band" && "ui-card"].filter(Boolean).join(" ");
|
|
548
|
-
return /* @__PURE__ */
|
|
549
|
-
basis ? /* @__PURE__ */
|
|
550
|
-
/* @__PURE__ */
|
|
573
|
+
return /* @__PURE__ */ jsxs8("div", { className: root, role: label ? "group" : void 0, "aria-label": label || void 0, children: [
|
|
574
|
+
basis ? /* @__PURE__ */ jsx12("p", { className: "ui-stats__basis", id: basisId, children: basis }) : null,
|
|
575
|
+
/* @__PURE__ */ jsx12("dl", { className: "ui-stats__list", children: stats.map((s, i) => {
|
|
551
576
|
const tone = hasChange(s.delta) && (s.delta.tone === "good" || s.delta.tone === "bad") ? s.delta.tone : "";
|
|
552
577
|
const cls = ["ui-stat", tone && `ui-stat--${tone}`, v === "tiles" && "ui-card ui-card--pad-sm"].filter(Boolean).join(" ");
|
|
553
|
-
return /* @__PURE__ */
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
s.trend ? /* @__PURE__ */
|
|
578
|
+
return /* @__PURE__ */ jsxs8("div", { className: cls, children: [
|
|
579
|
+
/* @__PURE__ */ jsx12("dt", { className: "ui-stat__label", children: s.label }),
|
|
580
|
+
/* @__PURE__ */ jsx12("dd", { className: "ui-stat__value", children: s.value }),
|
|
581
|
+
/* @__PURE__ */ jsx12(ContextRow, { caption: s.caption, delta: s.delta, basisId }),
|
|
582
|
+
s.trend ? /* @__PURE__ */ jsx12("dd", { className: "ui-stat__trend", children: s.trend }) : null
|
|
558
583
|
] }, `${s.label}-${i}`);
|
|
559
584
|
}) })
|
|
560
585
|
] });
|
|
@@ -574,7 +599,7 @@ import {
|
|
|
574
599
|
useEffect as useEffect2,
|
|
575
600
|
useLayoutEffect as useLayoutEffect3,
|
|
576
601
|
useRef as useRef3,
|
|
577
|
-
useState as
|
|
602
|
+
useState as useState3
|
|
578
603
|
} from "react";
|
|
579
604
|
import { transitionMs } from "@apliteni/apliteni-ui";
|
|
580
605
|
var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), details > summary:first-of-type';
|
|
@@ -694,8 +719,8 @@ function exit(entry) {
|
|
|
694
719
|
}
|
|
695
720
|
var EXIT_SLACK_MS = 50;
|
|
696
721
|
function usePresence(open, root, panel) {
|
|
697
|
-
const [present, setPresent] =
|
|
698
|
-
const [entered, setEntered] =
|
|
722
|
+
const [present, setPresent] = useState3(open);
|
|
723
|
+
const [entered, setEntered] = useState3(false);
|
|
699
724
|
if (open && !present) setPresent(true);
|
|
700
725
|
const shown = open && entered;
|
|
701
726
|
useIsoLayoutEffect(() => {
|
|
@@ -744,7 +769,7 @@ function usePresence(open, root, panel) {
|
|
|
744
769
|
}
|
|
745
770
|
function useDialog(active, { root, panel, body, initialFocus }, onClose) {
|
|
746
771
|
const parent = useContext(DialogScope);
|
|
747
|
-
const [scope] =
|
|
772
|
+
const [scope] = useState3(() => ({ parent }));
|
|
748
773
|
const close = useRef3(onClose);
|
|
749
774
|
useIsoLayoutEffect(() => {
|
|
750
775
|
close.current = onClose;
|
|
@@ -768,7 +793,7 @@ function useDialog(active, { root, panel, body, initialFocus }, onClose) {
|
|
|
768
793
|
}
|
|
769
794
|
|
|
770
795
|
// src/Modal.tsx
|
|
771
|
-
import { jsx as
|
|
796
|
+
import { jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
772
797
|
function Modal({ open, title, onClose, footer, children, initialFocusRef, role = "dialog" }) {
|
|
773
798
|
const id = useId4();
|
|
774
799
|
const titleId = `${id}-title`;
|
|
@@ -780,7 +805,7 @@ function Modal({ open, title, onClose, footer, children, initialFocusRef, role =
|
|
|
780
805
|
const scope = useDialog(shown, { root, panel, body, initialFocus: initialFocusRef }, onClose);
|
|
781
806
|
if (!mounted) return null;
|
|
782
807
|
return createPortal(
|
|
783
|
-
/* @__PURE__ */
|
|
808
|
+
/* @__PURE__ */ jsx13(DialogScope.Provider, { value: scope, children: /* @__PURE__ */ jsx13("div", { className: shown ? "rx-scrim is-open" : "rx-scrim", ref: root, onMouseDown: dismissOnScrim(onClose), children: /* @__PURE__ */ jsxs9(
|
|
784
809
|
"div",
|
|
785
810
|
{
|
|
786
811
|
className: "rx-modal",
|
|
@@ -791,12 +816,12 @@ function Modal({ open, title, onClose, footer, children, initialFocusRef, role =
|
|
|
791
816
|
tabIndex: -1,
|
|
792
817
|
ref: panel,
|
|
793
818
|
children: [
|
|
794
|
-
/* @__PURE__ */
|
|
795
|
-
/* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */
|
|
819
|
+
/* @__PURE__ */ jsxs9("div", { className: "rx-modal__head", children: [
|
|
820
|
+
/* @__PURE__ */ jsx13("h2", { className: "rx-modal__title", id: titleId, children: title }),
|
|
821
|
+
/* @__PURE__ */ jsx13(Button, { variant: "ghost", size: "sm", iconOnly: true, icon: "x", "aria-label": "Close", onClick: onClose })
|
|
797
822
|
] }),
|
|
798
|
-
/* @__PURE__ */
|
|
799
|
-
footer && /* @__PURE__ */
|
|
823
|
+
/* @__PURE__ */ jsx13("div", { className: "rx-modal__body", id: bodyId, ref: body, children }),
|
|
824
|
+
footer && /* @__PURE__ */ jsx13("div", { className: "rx-modal__foot", children: footer })
|
|
800
825
|
]
|
|
801
826
|
}
|
|
802
827
|
) }) }),
|
|
@@ -805,7 +830,7 @@ function Modal({ open, title, onClose, footer, children, initialFocusRef, role =
|
|
|
805
830
|
}
|
|
806
831
|
|
|
807
832
|
// src/Confirm.tsx
|
|
808
|
-
import { Fragment as Fragment3, jsx as
|
|
833
|
+
import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
809
834
|
function Confirm({
|
|
810
835
|
open,
|
|
811
836
|
title,
|
|
@@ -818,7 +843,7 @@ function Confirm({
|
|
|
818
843
|
onCancel
|
|
819
844
|
}) {
|
|
820
845
|
const safeAction = useRef5(null);
|
|
821
|
-
return /* @__PURE__ */
|
|
846
|
+
return /* @__PURE__ */ jsx14(
|
|
822
847
|
Modal,
|
|
823
848
|
{
|
|
824
849
|
open,
|
|
@@ -826,9 +851,9 @@ function Confirm({
|
|
|
826
851
|
onClose: onCancel,
|
|
827
852
|
role: "alertdialog",
|
|
828
853
|
initialFocusRef: safeAction,
|
|
829
|
-
footer: /* @__PURE__ */
|
|
830
|
-
/* @__PURE__ */
|
|
831
|
-
/* @__PURE__ */
|
|
854
|
+
footer: /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
855
|
+
/* @__PURE__ */ jsx14(Button, { ref: safeAction, variant: "ghost", onClick: onCancel, children: cancelLabel }),
|
|
856
|
+
/* @__PURE__ */ jsx14(Button, { variant: danger ? "danger" : "primary", busy, onClick: onConfirm, children: confirmLabel })
|
|
832
857
|
] }),
|
|
833
858
|
children: body
|
|
834
859
|
}
|
|
@@ -838,7 +863,7 @@ function Confirm({
|
|
|
838
863
|
// src/Drawer.tsx
|
|
839
864
|
import { useId as useId5, useRef as useRef6 } from "react";
|
|
840
865
|
import { createPortal as createPortal2 } from "react-dom";
|
|
841
|
-
import { jsx as
|
|
866
|
+
import { jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
842
867
|
function Drawer({
|
|
843
868
|
open,
|
|
844
869
|
title,
|
|
@@ -858,9 +883,9 @@ function Drawer({
|
|
|
858
883
|
if (!mounted) return null;
|
|
859
884
|
const cls = ["ui-drawer", `ui-drawer--${side}`, `ui-drawer--${size}`, shown && "is-open"].filter(Boolean).join(" ");
|
|
860
885
|
return createPortal2(
|
|
861
|
-
/* @__PURE__ */
|
|
862
|
-
/* @__PURE__ */
|
|
863
|
-
/* @__PURE__ */
|
|
886
|
+
/* @__PURE__ */ jsx15(DialogScope.Provider, { value: scope, children: /* @__PURE__ */ jsxs11("div", { className: cls, ref: root, children: [
|
|
887
|
+
/* @__PURE__ */ jsx15("div", { className: "ui-drawer__scrim", onMouseDown: dismissOnScrim(onClose) }),
|
|
888
|
+
/* @__PURE__ */ jsxs11(
|
|
864
889
|
"aside",
|
|
865
890
|
{
|
|
866
891
|
className: "ui-drawer__panel",
|
|
@@ -870,12 +895,12 @@ function Drawer({
|
|
|
870
895
|
tabIndex: -1,
|
|
871
896
|
ref: panel,
|
|
872
897
|
children: [
|
|
873
|
-
/* @__PURE__ */
|
|
874
|
-
/* @__PURE__ */
|
|
875
|
-
/* @__PURE__ */
|
|
898
|
+
/* @__PURE__ */ jsxs11("header", { className: "ui-drawer__header", children: [
|
|
899
|
+
/* @__PURE__ */ jsx15("h2", { className: "ui-drawer__title", id: titleId, children: title }),
|
|
900
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: "ui-drawer__close", "aria-label": closeLabel, onClick: onClose, children: /* @__PURE__ */ jsx15(Icon, { name: "x" }) })
|
|
876
901
|
] }),
|
|
877
|
-
/* @__PURE__ */
|
|
878
|
-
footer && /* @__PURE__ */
|
|
902
|
+
/* @__PURE__ */ jsx15("div", { className: "ui-drawer__body", ref: body, children }),
|
|
903
|
+
footer && /* @__PURE__ */ jsx15("footer", { className: "ui-drawer__footer", children: footer })
|
|
879
904
|
]
|
|
880
905
|
}
|
|
881
906
|
)
|
|
@@ -885,12 +910,12 @@ function Drawer({
|
|
|
885
910
|
}
|
|
886
911
|
|
|
887
912
|
// src/CommandPalette.tsx
|
|
888
|
-
import { useCallback, useEffect as useEffect3, useId as useId6, useMemo, useRef as useRef7, useState as
|
|
913
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useId as useId6, useMemo, useRef as useRef7, useState as useState4 } from "react";
|
|
889
914
|
import { createPortal as createPortal3 } from "react-dom";
|
|
890
|
-
import { rankGroups, icon as
|
|
891
|
-
import { jsx as
|
|
915
|
+
import { rankGroups, icon as icon3 } from "@apliteni/apliteni-ui";
|
|
916
|
+
import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
892
917
|
var cx2 = (...a) => a.filter(Boolean).join(" ");
|
|
893
|
-
var Glyph = ({ name, className }) => /* @__PURE__ */
|
|
918
|
+
var Glyph = ({ name, className }) => /* @__PURE__ */ jsx16("span", { className, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon3(name) } });
|
|
894
919
|
var keysOf = (shortcut) => shortcut == null ? [] : Array.isArray(shortcut) ? shortcut : [shortcut];
|
|
895
920
|
function CommandPalette({
|
|
896
921
|
open,
|
|
@@ -909,8 +934,8 @@ function CommandPalette({
|
|
|
909
934
|
const root = useRef7(null);
|
|
910
935
|
const panel = useRef7(null);
|
|
911
936
|
const search = useRef7(null);
|
|
912
|
-
const [query, setQuery] =
|
|
913
|
-
const [at, setAt] =
|
|
937
|
+
const [query, setQuery] = useState4("");
|
|
938
|
+
const [at, setAt] = useState4(0);
|
|
914
939
|
useEffect3(() => {
|
|
915
940
|
if (open) {
|
|
916
941
|
setQuery("");
|
|
@@ -927,7 +952,7 @@ function CommandPalette({
|
|
|
927
952
|
setAt(0);
|
|
928
953
|
}, [query]);
|
|
929
954
|
const scope = useDialog(open, { root, panel, body: search }, onClose);
|
|
930
|
-
const run =
|
|
955
|
+
const run = useCallback2((item, newTab) => {
|
|
931
956
|
if (isDisabled(item)) return;
|
|
932
957
|
onSelect?.(item, { newTab });
|
|
933
958
|
if (item.danger && item.onConfirm) {
|
|
@@ -955,9 +980,9 @@ function CommandPalette({
|
|
|
955
980
|
const listId = `${uid}-list`;
|
|
956
981
|
let n = 0;
|
|
957
982
|
return createPortal3(
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
/* @__PURE__ */
|
|
960
|
-
/* @__PURE__ */
|
|
983
|
+
/* @__PURE__ */ jsx16(DialogScope.Provider, { value: scope, children: /* @__PURE__ */ jsxs12("div", { className: cx2("ui-cmdk", density === "roomy" && "ui-cmdk--roomy", "is-open"), ref: root, children: [
|
|
984
|
+
/* @__PURE__ */ jsx16("div", { className: "ui-cmdk__scrim", onMouseDown: dismissOnScrim(onClose) }),
|
|
985
|
+
/* @__PURE__ */ jsxs12(
|
|
961
986
|
"div",
|
|
962
987
|
{
|
|
963
988
|
className: "ui-cmdk__panel",
|
|
@@ -968,9 +993,9 @@ function CommandPalette({
|
|
|
968
993
|
ref: panel,
|
|
969
994
|
onKeyDown,
|
|
970
995
|
children: [
|
|
971
|
-
/* @__PURE__ */
|
|
972
|
-
/* @__PURE__ */
|
|
973
|
-
/* @__PURE__ */
|
|
996
|
+
/* @__PURE__ */ jsxs12("div", { className: "ui-cmdk__search", ref: search, children: [
|
|
997
|
+
/* @__PURE__ */ jsx16(Glyph, { name: "search", className: "ui-cmdk__search-ic" }),
|
|
998
|
+
/* @__PURE__ */ jsx16(
|
|
974
999
|
"input",
|
|
975
1000
|
{
|
|
976
1001
|
className: "ui-cmdk__input",
|
|
@@ -992,19 +1017,19 @@ function CommandPalette({
|
|
|
992
1017
|
}
|
|
993
1018
|
)
|
|
994
1019
|
] }),
|
|
995
|
-
/* @__PURE__ */
|
|
1020
|
+
/* @__PURE__ */ jsx16("div", { className: "ui-cmdk__list", id: listId, role: "listbox", "aria-label": `${label} results`, children: shown.map((group, gi) => /* @__PURE__ */ jsxs12(
|
|
996
1021
|
"div",
|
|
997
1022
|
{
|
|
998
1023
|
className: "ui-cmdk__group",
|
|
999
1024
|
role: "group",
|
|
1000
1025
|
"aria-labelledby": group.label ? `${uid}-g${gi}` : void 0,
|
|
1001
1026
|
children: [
|
|
1002
|
-
group.label && /* @__PURE__ */
|
|
1027
|
+
group.label && /* @__PURE__ */ jsx16("div", { className: "ui-cmdk__group-head", id: `${uid}-g${gi}`, children: group.label }),
|
|
1003
1028
|
group.items.map((item) => {
|
|
1004
1029
|
const disabled = isDisabled(item);
|
|
1005
1030
|
const id = `${uid}-o${n++}`;
|
|
1006
1031
|
const on = item === active;
|
|
1007
|
-
return /* @__PURE__ */
|
|
1032
|
+
return /* @__PURE__ */ jsxs12(
|
|
1008
1033
|
"div",
|
|
1009
1034
|
{
|
|
1010
1035
|
id,
|
|
@@ -1024,13 +1049,13 @@ function CommandPalette({
|
|
|
1024
1049
|
},
|
|
1025
1050
|
onClick: (e) => run(item, e.metaKey || e.ctrlKey),
|
|
1026
1051
|
children: [
|
|
1027
|
-
item.icon && /* @__PURE__ */
|
|
1028
|
-
/* @__PURE__ */
|
|
1029
|
-
/* @__PURE__ */
|
|
1030
|
-
item.description && /* @__PURE__ */
|
|
1052
|
+
item.icon && /* @__PURE__ */ jsx16(Glyph, { name: item.icon, className: "ui-cmdk__ic" }),
|
|
1053
|
+
/* @__PURE__ */ jsxs12("span", { className: "ui-cmdk__main", children: [
|
|
1054
|
+
/* @__PURE__ */ jsx16("span", { className: "ui-cmdk__label", children: item.label }),
|
|
1055
|
+
item.description && /* @__PURE__ */ jsx16("span", { className: "ui-cmdk__desc", children: item.description })
|
|
1031
1056
|
] }),
|
|
1032
|
-
item.badge && /* @__PURE__ */
|
|
1033
|
-
keysOf(item.shortcut).length > 0 && /* @__PURE__ */
|
|
1057
|
+
item.badge && /* @__PURE__ */ jsx16("span", { className: "ui-cmdk__badge", children: item.badge }),
|
|
1058
|
+
keysOf(item.shortcut).length > 0 && /* @__PURE__ */ jsx16("span", { className: "ui-cmdk__keys", "aria-hidden": "true", children: keysOf(item.shortcut).map((k) => /* @__PURE__ */ jsx16("kbd", { className: "ui-cmdk__key", children: k }, k)) })
|
|
1034
1059
|
]
|
|
1035
1060
|
},
|
|
1036
1061
|
item.id
|
|
@@ -1040,20 +1065,20 @@ function CommandPalette({
|
|
|
1040
1065
|
},
|
|
1041
1066
|
group.label ?? `g${gi}`
|
|
1042
1067
|
)) }),
|
|
1043
|
-
/* @__PURE__ */
|
|
1044
|
-
/* @__PURE__ */
|
|
1045
|
-
hint && /* @__PURE__ */
|
|
1046
|
-
/* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
1068
|
+
/* @__PURE__ */ jsx16("p", { className: "ui-cmdk__empty", hidden: countOf(shown) > 0, children: empty }),
|
|
1069
|
+
/* @__PURE__ */ jsx16("p", { className: "ui-sr", role: "status", "aria-live": "polite", children: countOf(shown) === 0 ? "No results" : `${countOf(shown)} result${countOf(shown) === 1 ? "" : "s"}` }),
|
|
1070
|
+
hint && /* @__PURE__ */ jsxs12("div", { className: "ui-cmdk__foot", "aria-hidden": "true", children: [
|
|
1071
|
+
/* @__PURE__ */ jsxs12("span", { children: [
|
|
1072
|
+
/* @__PURE__ */ jsx16("kbd", { className: "ui-cmdk__key", children: "\u2191" }),
|
|
1073
|
+
/* @__PURE__ */ jsx16("kbd", { className: "ui-cmdk__key", children: "\u2193" }),
|
|
1049
1074
|
" move"
|
|
1050
1075
|
] }),
|
|
1051
|
-
/* @__PURE__ */
|
|
1052
|
-
/* @__PURE__ */
|
|
1076
|
+
/* @__PURE__ */ jsxs12("span", { children: [
|
|
1077
|
+
/* @__PURE__ */ jsx16("kbd", { className: "ui-cmdk__key", children: "\u21B5" }),
|
|
1053
1078
|
" run"
|
|
1054
1079
|
] }),
|
|
1055
|
-
/* @__PURE__ */
|
|
1056
|
-
/* @__PURE__ */
|
|
1080
|
+
/* @__PURE__ */ jsxs12("span", { children: [
|
|
1081
|
+
/* @__PURE__ */ jsx16("kbd", { className: "ui-cmdk__key", children: "esc" }),
|
|
1057
1082
|
" close"
|
|
1058
1083
|
] })
|
|
1059
1084
|
] })
|
|
@@ -1078,13 +1103,13 @@ function rowId(uid, groups, item) {
|
|
|
1078
1103
|
}
|
|
1079
1104
|
|
|
1080
1105
|
// src/DataTable.tsx
|
|
1081
|
-
import { useCallback as
|
|
1106
|
+
import { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo2, useRef as useRef9, useState as useState6 } from "react";
|
|
1082
1107
|
import { DEFAULT_PAGE_SIZE as DEFAULT_PAGE_SIZE2 } from "@apliteni/apliteni-ui";
|
|
1083
1108
|
|
|
1084
1109
|
// src/Pagination.tsx
|
|
1085
|
-
import { useEffect as useEffect4, useId as useId7, useRef as useRef8, useState as
|
|
1110
|
+
import { useEffect as useEffect4, useId as useId7, useRef as useRef8, useState as useState5 } from "react";
|
|
1086
1111
|
import { DEFAULT_PAGE_SIZE } from "@apliteni/apliteni-ui";
|
|
1087
|
-
import { jsx as
|
|
1112
|
+
import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1088
1113
|
var GHOST_SM = "ui-btn ui-btn--ghost ui-btn--sm";
|
|
1089
1114
|
var VARIANTS = ["steps", "numbered", "jump"];
|
|
1090
1115
|
var cx3 = (...a) => a.filter(Boolean).join(" ");
|
|
@@ -1127,8 +1152,8 @@ function Pagination({
|
|
|
1127
1152
|
onPageSizeChange
|
|
1128
1153
|
}) {
|
|
1129
1154
|
const auto = useId7();
|
|
1130
|
-
const [draft, setDraft] =
|
|
1131
|
-
const [drafting, setDrafting] =
|
|
1155
|
+
const [draft, setDraft] = useState5("");
|
|
1156
|
+
const [drafting, setDrafting] = useState5(false);
|
|
1132
1157
|
const nav = useRef8(null);
|
|
1133
1158
|
const pressed = useRef8(null);
|
|
1134
1159
|
const uid = id ?? auto;
|
|
@@ -1139,7 +1164,7 @@ function Pagination({
|
|
|
1139
1164
|
const rows = counted ? Math.max(0, asRows) : null;
|
|
1140
1165
|
const last = counted ? Math.max(1, Math.ceil(rows / size)) : null;
|
|
1141
1166
|
const at = counted ? Math.min(Math.max(1, int(page, 1)), last) : Math.min(Math.max(1, int(page, 1)), CAP - 1);
|
|
1142
|
-
const [draftFor, setDraftFor] =
|
|
1167
|
+
const [draftFor, setDraftFor] = useState5(at);
|
|
1143
1168
|
if (draftFor !== at) {
|
|
1144
1169
|
setDraftFor(at);
|
|
1145
1170
|
setDraft("");
|
|
@@ -1176,7 +1201,7 @@ function Pagination({
|
|
|
1176
1201
|
const step = (label_, target, disabled) => (
|
|
1177
1202
|
// A control at an end is disabled and stays where it is: removing it slides
|
|
1178
1203
|
// the next control under a pointer already travelling toward it.
|
|
1179
|
-
/* @__PURE__ */
|
|
1204
|
+
/* @__PURE__ */ jsx17(
|
|
1180
1205
|
"button",
|
|
1181
1206
|
{
|
|
1182
1207
|
type: "button",
|
|
@@ -1215,14 +1240,14 @@ function Pagination({
|
|
|
1215
1240
|
if (single) {
|
|
1216
1241
|
steps = null;
|
|
1217
1242
|
} else if (!counted) {
|
|
1218
|
-
steps = /* @__PURE__ */
|
|
1243
|
+
steps = /* @__PURE__ */ jsxs13("div", { className: "ui-pager__steps", children: [
|
|
1219
1244
|
step("Prev", Math.max(1, at - 1), atStart),
|
|
1220
1245
|
step("Next", at + 1, !hasMore)
|
|
1221
1246
|
] });
|
|
1222
1247
|
} else {
|
|
1223
1248
|
let middle = null;
|
|
1224
1249
|
if (kind === "numbered") {
|
|
1225
|
-
middle = slotsFor(at, last).map((n, i) => n == null ? /* @__PURE__ */
|
|
1250
|
+
middle = slotsFor(at, last).map((n, i) => n == null ? /* @__PURE__ */ jsx17("span", { className: "ui-pager__gap", "aria-hidden": "true", children: "\u2026" }, `gap${i}`) : /* @__PURE__ */ jsx17(
|
|
1226
1251
|
"button",
|
|
1227
1252
|
{
|
|
1228
1253
|
type: "button",
|
|
@@ -1237,9 +1262,9 @@ function Pagination({
|
|
|
1237
1262
|
n
|
|
1238
1263
|
));
|
|
1239
1264
|
} else if (kind === "jump") {
|
|
1240
|
-
middle = /* @__PURE__ */
|
|
1241
|
-
/* @__PURE__ */
|
|
1242
|
-
/* @__PURE__ */
|
|
1265
|
+
middle = /* @__PURE__ */ jsxs13("span", { className: "ui-pager__jump", children: [
|
|
1266
|
+
/* @__PURE__ */ jsx17("label", { htmlFor: `${uid}-jump`, children: "Page" }),
|
|
1267
|
+
/* @__PURE__ */ jsx17(
|
|
1243
1268
|
"input",
|
|
1244
1269
|
{
|
|
1245
1270
|
className: "ui-input ui-pager__jump-input",
|
|
@@ -1262,13 +1287,13 @@ function Pagination({
|
|
|
1262
1287
|
}
|
|
1263
1288
|
}
|
|
1264
1289
|
),
|
|
1265
|
-
/* @__PURE__ */
|
|
1290
|
+
/* @__PURE__ */ jsxs13("span", { className: "ui-pager__jump-of", children: [
|
|
1266
1291
|
"of ",
|
|
1267
1292
|
fmt(last)
|
|
1268
1293
|
] })
|
|
1269
1294
|
] });
|
|
1270
1295
|
}
|
|
1271
|
-
steps = /* @__PURE__ */
|
|
1296
|
+
steps = /* @__PURE__ */ jsxs13("div", { className: "ui-pager__steps", children: [
|
|
1272
1297
|
ends ? step("First", 1, atStart) : null,
|
|
1273
1298
|
step("Prev", Math.max(1, at - 1), atStart),
|
|
1274
1299
|
middle,
|
|
@@ -1276,7 +1301,7 @@ function Pagination({
|
|
|
1276
1301
|
ends ? step("Last", last, atEnd) : null
|
|
1277
1302
|
] });
|
|
1278
1303
|
}
|
|
1279
|
-
return /* @__PURE__ */
|
|
1304
|
+
return /* @__PURE__ */ jsxs13(
|
|
1280
1305
|
"nav",
|
|
1281
1306
|
{
|
|
1282
1307
|
ref: nav,
|
|
@@ -1284,10 +1309,10 @@ function Pagination({
|
|
|
1284
1309
|
"aria-label": label,
|
|
1285
1310
|
"aria-busy": loading ? true : void 0,
|
|
1286
1311
|
children: [
|
|
1287
|
-
/* @__PURE__ */
|
|
1288
|
-
sizes.length ? /* @__PURE__ */
|
|
1289
|
-
/* @__PURE__ */
|
|
1290
|
-
/* @__PURE__ */
|
|
1312
|
+
/* @__PURE__ */ jsx17("p", { className: "ui-pager__status", "aria-live": "polite", "aria-atomic": "true", children: status }),
|
|
1313
|
+
sizes.length ? /* @__PURE__ */ jsxs13("div", { className: "ui-pager__size", children: [
|
|
1314
|
+
/* @__PURE__ */ jsx17("label", { className: "ui-pager__size-label", htmlFor: `${uid}-size`, children: "Rows" }),
|
|
1315
|
+
/* @__PURE__ */ jsx17(
|
|
1291
1316
|
"select",
|
|
1292
1317
|
{
|
|
1293
1318
|
className: "ui-select ui-pager__size-select",
|
|
@@ -1295,7 +1320,7 @@ function Pagination({
|
|
|
1295
1320
|
disabled: loading,
|
|
1296
1321
|
value: size,
|
|
1297
1322
|
onChange: (e) => onPageSizeChange?.(Number(e.target.value)),
|
|
1298
|
-
children: sizes.map((s) => /* @__PURE__ */
|
|
1323
|
+
children: sizes.map((s) => /* @__PURE__ */ jsx17("option", { value: s, children: fmt(s) }, s))
|
|
1299
1324
|
}
|
|
1300
1325
|
)
|
|
1301
1326
|
] }) : null,
|
|
@@ -1306,7 +1331,7 @@ function Pagination({
|
|
|
1306
1331
|
}
|
|
1307
1332
|
|
|
1308
1333
|
// src/DataTable.tsx
|
|
1309
|
-
import { Fragment as Fragment4, jsx as
|
|
1334
|
+
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1310
1335
|
var NO_SORT = { key: void 0, dir: -1 };
|
|
1311
1336
|
function sortTableRows(rows, sort) {
|
|
1312
1337
|
if (sort.key === void 0) return [...rows];
|
|
@@ -1343,12 +1368,12 @@ function DataTable({
|
|
|
1343
1368
|
}) {
|
|
1344
1369
|
const scrollable = stickyHeader || pinnedIdentity;
|
|
1345
1370
|
const table = useRef9(null);
|
|
1346
|
-
const [pagerHost, setPagerHost] =
|
|
1347
|
-
const holdPagerBox =
|
|
1371
|
+
const [pagerHost, setPagerHost] = useState6(null);
|
|
1372
|
+
const holdPagerBox = useCallback3(
|
|
1348
1373
|
(box) => setPagerHost(box?.parentElement ?? null),
|
|
1349
1374
|
[]
|
|
1350
1375
|
);
|
|
1351
|
-
const [strip2, setStrip] =
|
|
1376
|
+
const [strip2, setStrip] = useState6();
|
|
1352
1377
|
useEffect5(() => {
|
|
1353
1378
|
const el = table.current;
|
|
1354
1379
|
const host = pagerHost;
|
|
@@ -1369,16 +1394,16 @@ function DataTable({
|
|
|
1369
1394
|
measure();
|
|
1370
1395
|
return () => observer.disconnect();
|
|
1371
1396
|
}, [pagerHost, columns, rows]);
|
|
1372
|
-
const [localSort, setLocalSort] =
|
|
1397
|
+
const [localSort, setLocalSort] = useState6(
|
|
1373
1398
|
{ key: columns.find((c) => c.sortable)?.key, dir: -1 }
|
|
1374
1399
|
);
|
|
1375
1400
|
const owned = controlledPage === void 0;
|
|
1376
1401
|
const sort = controlledSort ?? (owned ? localSort : NO_SORT);
|
|
1377
1402
|
const sortIsKnown = owned || controlledSort !== void 0;
|
|
1378
|
-
const [localPage, setLocalPage] =
|
|
1379
|
-
const [localSize, setLocalSize] =
|
|
1403
|
+
const [localPage, setLocalPage] = useState6(1);
|
|
1404
|
+
const [localSize, setLocalSize] = useState6(DEFAULT_PAGE_SIZE2);
|
|
1380
1405
|
const size = sizeOf(pageSize, owned ? localSize : rows.length || DEFAULT_PAGE_SIZE2);
|
|
1381
|
-
const [pagedSort, setPagedSort] =
|
|
1406
|
+
const [pagedSort, setPagedSort] = useState6(sort);
|
|
1382
1407
|
if (pagedSort.key !== sort.key || pagedSort.dir !== sort.dir) {
|
|
1383
1408
|
setPagedSort(sort);
|
|
1384
1409
|
setLocalPage(1);
|
|
@@ -1401,7 +1426,7 @@ function DataTable({
|
|
|
1401
1426
|
onSortChange?.(next);
|
|
1402
1427
|
toFirstPage();
|
|
1403
1428
|
};
|
|
1404
|
-
const caret = (k) => /* @__PURE__ */
|
|
1429
|
+
const caret = (k) => /* @__PURE__ */ jsx18(
|
|
1405
1430
|
"svg",
|
|
1406
1431
|
{
|
|
1407
1432
|
className: "rx-caret",
|
|
@@ -1413,31 +1438,31 @@ function DataTable({
|
|
|
1413
1438
|
strokeLinejoin: "round",
|
|
1414
1439
|
"aria-hidden": "true",
|
|
1415
1440
|
focusable: "false",
|
|
1416
|
-
children: sort.key === k ? /* @__PURE__ */
|
|
1417
|
-
/* @__PURE__ */
|
|
1418
|
-
/* @__PURE__ */
|
|
1441
|
+
children: sort.key === k ? /* @__PURE__ */ jsx18("path", { d: "m8 10 4 4 4-4" }) : /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
1442
|
+
/* @__PURE__ */ jsx18("path", { d: "m8 9 4-4 4 4" }),
|
|
1443
|
+
/* @__PURE__ */ jsx18("path", { d: "m8 15 4 4 4-4" })
|
|
1419
1444
|
] })
|
|
1420
1445
|
}
|
|
1421
1446
|
);
|
|
1422
1447
|
const pageAllOn = selectable && slice.length > 0 && slice.every((r) => selected.has(r.name));
|
|
1423
1448
|
const pageSomeOn = selectable && !pageAllOn && slice.some((r) => selected.has(r.name));
|
|
1424
|
-
return /* @__PURE__ */
|
|
1425
|
-
/* @__PURE__ */
|
|
1449
|
+
return /* @__PURE__ */ jsxs14(Fragment4, { children: [
|
|
1450
|
+
/* @__PURE__ */ jsx18(
|
|
1426
1451
|
"div",
|
|
1427
1452
|
{
|
|
1428
1453
|
className: scrollable ? "ui-table-scroll" : void 0,
|
|
1429
1454
|
role: scrollable ? "region" : void 0,
|
|
1430
1455
|
"aria-label": scrollable ? scrollLabel : void 0,
|
|
1431
1456
|
tabIndex: scrollable ? 0 : void 0,
|
|
1432
|
-
children: /* @__PURE__ */
|
|
1457
|
+
children: /* @__PURE__ */ jsxs14(
|
|
1433
1458
|
"table",
|
|
1434
1459
|
{
|
|
1435
1460
|
ref: table,
|
|
1436
1461
|
className: ["ui-table ui-table--hover", (density === "dense" || !density && dense) && "ui-table--dense", density === "compact" && "ui-table--compact", stickyHeader && "ui-table--sticky", pinnedIdentity && "ui-table--pinned"].filter(Boolean).join(" "),
|
|
1437
1462
|
"aria-busy": loading || void 0,
|
|
1438
1463
|
children: [
|
|
1439
|
-
/* @__PURE__ */
|
|
1440
|
-
selectable ? /* @__PURE__ */
|
|
1464
|
+
/* @__PURE__ */ jsx18("thead", { children: /* @__PURE__ */ jsxs14("tr", { children: [
|
|
1465
|
+
selectable ? /* @__PURE__ */ jsx18("th", { scope: "col", className: "ui-table__selection", children: /* @__PURE__ */ jsx18(
|
|
1441
1466
|
"input",
|
|
1442
1467
|
{
|
|
1443
1468
|
type: "checkbox",
|
|
@@ -1453,7 +1478,7 @@ function DataTable({
|
|
|
1453
1478
|
// The sort control is a real <button> inside the header cell. It used to be
|
|
1454
1479
|
// role="button" ON the <th>, which threw away the columnheader role and put
|
|
1455
1480
|
// aria-sort on a role that forbids it.
|
|
1456
|
-
/* @__PURE__ */
|
|
1481
|
+
/* @__PURE__ */ jsx18(
|
|
1457
1482
|
"th",
|
|
1458
1483
|
{
|
|
1459
1484
|
scope: "col",
|
|
@@ -1463,8 +1488,8 @@ function DataTable({
|
|
|
1463
1488
|
// The label is its own box so it can truncate: in a pinned
|
|
1464
1489
|
// identity column on a phone the header is capped, and a bare
|
|
1465
1490
|
// text node would push the caret out of the cell instead.
|
|
1466
|
-
/* @__PURE__ */
|
|
1467
|
-
/* @__PURE__ */
|
|
1491
|
+
/* @__PURE__ */ jsxs14("button", { type: "button", className: "rx-sort", onClick: () => onSort(c.key), children: [
|
|
1492
|
+
/* @__PURE__ */ jsx18("span", { className: "rx-sort__label", children: c.label }),
|
|
1468
1493
|
caret(c.key)
|
|
1469
1494
|
] })
|
|
1470
1495
|
) : c.label
|
|
@@ -1473,10 +1498,10 @@ function DataTable({
|
|
|
1473
1498
|
)
|
|
1474
1499
|
))
|
|
1475
1500
|
] }) }),
|
|
1476
|
-
/* @__PURE__ */
|
|
1477
|
-
!slice.length && /* @__PURE__ */
|
|
1478
|
-
slice.map((r) => /* @__PURE__ */
|
|
1479
|
-
selectable ? /* @__PURE__ */
|
|
1501
|
+
/* @__PURE__ */ jsxs14("tbody", { children: [
|
|
1502
|
+
!slice.length && /* @__PURE__ */ jsx18("tr", { children: /* @__PURE__ */ jsx18("td", { colSpan: columns.length + (selectable ? 1 : 0), children: loading ? "Loading rows\u2026" : empty }) }),
|
|
1503
|
+
slice.map((r) => /* @__PURE__ */ jsxs14("tr", { children: [
|
|
1504
|
+
selectable ? /* @__PURE__ */ jsx18("td", { className: "ui-table__selection", children: /* @__PURE__ */ jsx18(
|
|
1480
1505
|
"input",
|
|
1481
1506
|
{
|
|
1482
1507
|
type: "checkbox",
|
|
@@ -1485,7 +1510,7 @@ function DataTable({
|
|
|
1485
1510
|
onChange: () => onToggle(r.name)
|
|
1486
1511
|
}
|
|
1487
1512
|
) }) : null,
|
|
1488
|
-
columns.map((c, columnIndex) => /* @__PURE__ */
|
|
1513
|
+
columns.map((c, columnIndex) => /* @__PURE__ */ jsx18("td", { className: [c.num && "ui-table__num", pinnedIdentity && columnIndex === 0 && "ui-table__identity", c.linked && "ui-table__linked"].filter(Boolean).join(" "), children: c.render ? c.render(r) : String(r[c.key]) }, c.key))
|
|
1489
1514
|
] }, r.name))
|
|
1490
1515
|
] })
|
|
1491
1516
|
]
|
|
@@ -1498,13 +1523,13 @@ function DataTable({
|
|
|
1498
1523
|
// The two are siblings, and no selector sizes one to the other, so the width is
|
|
1499
1524
|
// measured: a cap rather than a width, so a pager wider than the table wraps
|
|
1500
1525
|
// inside it and a table wider than the room still leaves the strip in the room.
|
|
1501
|
-
/* @__PURE__ */
|
|
1526
|
+
/* @__PURE__ */ jsx18(
|
|
1502
1527
|
"div",
|
|
1503
1528
|
{
|
|
1504
1529
|
className: "rx-table-pager",
|
|
1505
1530
|
ref: holdPagerBox,
|
|
1506
1531
|
style: strip2 ? { maxWidth: strip2.width, marginInlineStart: strip2.inset || void 0 } : void 0,
|
|
1507
|
-
children: /* @__PURE__ */
|
|
1532
|
+
children: /* @__PURE__ */ jsx18(
|
|
1508
1533
|
Pagination,
|
|
1509
1534
|
{
|
|
1510
1535
|
page,
|
|
@@ -1532,7 +1557,7 @@ function DataTable({
|
|
|
1532
1557
|
import { PAGE_SIZES as KIT_PAGE_SIZES, DEFAULT_PAGE_SIZE as KIT_DEFAULT_PAGE_SIZE } from "@apliteni/apliteni-ui";
|
|
1533
1558
|
|
|
1534
1559
|
// src/Loading.tsx
|
|
1535
|
-
import { jsx as
|
|
1560
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1536
1561
|
var cx4 = (...a) => a.filter(Boolean).join(" ");
|
|
1537
1562
|
function Skeleton({ lines = 3, width, height, radius, className }) {
|
|
1538
1563
|
const widths = Array.isArray(lines) ? lines : null;
|
|
@@ -1542,19 +1567,19 @@ function Skeleton({ lines = 3, width, height, radius, className }) {
|
|
|
1542
1567
|
if (!w && !height && !radius) return void 0;
|
|
1543
1568
|
return { ...w && { width: w }, ...height && { height }, ...radius && { borderRadius: radius } };
|
|
1544
1569
|
};
|
|
1545
|
-
return /* @__PURE__ */
|
|
1570
|
+
return /* @__PURE__ */ jsx19("div", { className: cx4("ui-skel", className), "aria-hidden": "true", children: Array.from({ length: n }, (_, i) => /* @__PURE__ */ jsx19("span", { className: "ui-skel__bar m-skeleton", style: styleFor(i) }, i)) });
|
|
1546
1571
|
}
|
|
1547
1572
|
function SkeletonTable({ rows = 5, cols = 4, head = true }) {
|
|
1548
|
-
const cells = Array.from({ length: Math.max(1, cols) }, (_, i) => /* @__PURE__ */
|
|
1549
|
-
return /* @__PURE__ */
|
|
1573
|
+
const cells = Array.from({ length: Math.max(1, cols) }, (_, i) => /* @__PURE__ */ jsx19("span", { className: "ui-skel__bar m-skeleton" }, i));
|
|
1574
|
+
return /* @__PURE__ */ jsxs15(
|
|
1550
1575
|
"div",
|
|
1551
1576
|
{
|
|
1552
1577
|
className: "ui-skel ui-skel--table",
|
|
1553
1578
|
style: { "--skel-cols": Math.max(1, cols) },
|
|
1554
1579
|
"aria-hidden": "true",
|
|
1555
1580
|
children: [
|
|
1556
|
-
head && /* @__PURE__ */
|
|
1557
|
-
Array.from({ length: Math.max(1, rows) }, (_, i) => /* @__PURE__ */
|
|
1581
|
+
head && /* @__PURE__ */ jsx19("div", { className: "ui-skel__row ui-skel__row--head", children: cells }),
|
|
1582
|
+
Array.from({ length: Math.max(1, rows) }, (_, i) => /* @__PURE__ */ jsx19("div", { className: "ui-skel__row", children: cells }, i))
|
|
1558
1583
|
]
|
|
1559
1584
|
}
|
|
1560
1585
|
);
|
|
@@ -1567,7 +1592,7 @@ function BusyRegion({
|
|
|
1567
1592
|
className,
|
|
1568
1593
|
children
|
|
1569
1594
|
}) {
|
|
1570
|
-
return /* @__PURE__ */
|
|
1595
|
+
return /* @__PURE__ */ jsxs15(
|
|
1571
1596
|
"div",
|
|
1572
1597
|
{
|
|
1573
1598
|
className: cx4("ui-busy", className),
|
|
@@ -1575,8 +1600,8 @@ function BusyRegion({
|
|
|
1575
1600
|
"aria-live": "polite",
|
|
1576
1601
|
"aria-busy": busy,
|
|
1577
1602
|
children: [
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1603
|
+
/* @__PURE__ */ jsx19("span", { className: "ui-sr", children: busy ? label : message }),
|
|
1604
|
+
/* @__PURE__ */ jsx19("div", { className: "ui-busy__body", children: busy ? placeholder ?? /* @__PURE__ */ jsx19(Skeleton, { lines: 3 }) : children })
|
|
1580
1605
|
]
|
|
1581
1606
|
}
|
|
1582
1607
|
);
|
|
@@ -1585,31 +1610,31 @@ function Denied({
|
|
|
1585
1610
|
title = "You don\u2019t have access",
|
|
1586
1611
|
sub,
|
|
1587
1612
|
need,
|
|
1588
|
-
icon:
|
|
1613
|
+
icon: icon8 = "lock",
|
|
1589
1614
|
className,
|
|
1590
1615
|
children
|
|
1591
1616
|
}) {
|
|
1592
|
-
return /* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1595
|
-
sub && /* @__PURE__ */
|
|
1596
|
-
need && /* @__PURE__ */
|
|
1617
|
+
return /* @__PURE__ */ jsxs15("div", { className: cx4("ui-denied", className), children: [
|
|
1618
|
+
/* @__PURE__ */ jsx19("div", { className: "ui-denied__seal", children: /* @__PURE__ */ jsx19(Icon, { name: icon8 }) }),
|
|
1619
|
+
/* @__PURE__ */ jsx19("div", { className: "ui-denied__title", children: title }),
|
|
1620
|
+
sub && /* @__PURE__ */ jsx19("div", { className: "ui-denied__sub", children: sub }),
|
|
1621
|
+
need && /* @__PURE__ */ jsxs15("div", { className: "ui-denied__need", children: [
|
|
1597
1622
|
"Needs ",
|
|
1598
|
-
/* @__PURE__ */
|
|
1623
|
+
/* @__PURE__ */ jsx19("code", { className: "ui-code", children: need })
|
|
1599
1624
|
] }),
|
|
1600
|
-
children && /* @__PURE__ */
|
|
1625
|
+
children && /* @__PURE__ */ jsx19("div", { className: "ui-denied__actions", children })
|
|
1601
1626
|
] });
|
|
1602
1627
|
}
|
|
1603
1628
|
|
|
1604
1629
|
// src/DatePicker.tsx
|
|
1605
1630
|
import {
|
|
1606
|
-
useCallback as
|
|
1631
|
+
useCallback as useCallback4,
|
|
1607
1632
|
useEffect as useEffect6,
|
|
1608
1633
|
useMemo as useMemo3,
|
|
1609
1634
|
useRef as useRef10,
|
|
1610
|
-
useState as
|
|
1635
|
+
useState as useState7
|
|
1611
1636
|
} from "react";
|
|
1612
|
-
import { jsx as
|
|
1637
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1613
1638
|
var cx5 = (...a) => a.filter(Boolean).join(" ");
|
|
1614
1639
|
var pad = (n) => String(n).padStart(2, "0");
|
|
1615
1640
|
var DAY_MS = 864e5;
|
|
@@ -1618,7 +1643,7 @@ var MONTH_RE = /^(\d{4})-(\d{2})$/;
|
|
|
1618
1643
|
var DAY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
1619
1644
|
var PHONE_MAX = 560;
|
|
1620
1645
|
function usePhone() {
|
|
1621
|
-
const [phone, setPhone] =
|
|
1646
|
+
const [phone, setPhone] = useState7(false);
|
|
1622
1647
|
useEffect6(() => {
|
|
1623
1648
|
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX}px)`);
|
|
1624
1649
|
if (!query) return;
|
|
@@ -1717,11 +1742,11 @@ function DatePicker({
|
|
|
1717
1742
|
const root = useRef10(null);
|
|
1718
1743
|
const trigger = useRef10(null);
|
|
1719
1744
|
const grid = useRef10(null);
|
|
1720
|
-
const [selfOpen, setSelfOpen] =
|
|
1745
|
+
const [selfOpen, setSelfOpen] = useState7(defaultOpen);
|
|
1721
1746
|
const open = openProp ?? selfOpen;
|
|
1722
|
-
const [selfValue, setSelfValue] =
|
|
1747
|
+
const [selfValue, setSelfValue] = useState7(defaultValue);
|
|
1723
1748
|
const picked = value !== void 0 ? value : selfValue;
|
|
1724
|
-
const [selfRange, setSelfRange] =
|
|
1749
|
+
const [selfRange, setSelfRange] = useState7(defaultRange ?? { start: null, end: null });
|
|
1725
1750
|
const span = range !== void 0 ? range : selfRange;
|
|
1726
1751
|
const names = useMemo3(() => ({
|
|
1727
1752
|
month: new Intl.DateTimeFormat(locale, { month: "long", timeZone: "UTC" }),
|
|
@@ -1734,7 +1759,7 @@ function DatePicker({
|
|
|
1734
1759
|
weekdayShort: new Intl.DateTimeFormat(locale, { weekday: "short", timeZone: "UTC" })
|
|
1735
1760
|
}), [locale]);
|
|
1736
1761
|
const monthLabels = useMemo3(() => evenMonthLabels(names.monthShort), [names]);
|
|
1737
|
-
const at =
|
|
1762
|
+
const at = useCallback4((index) => new Date(
|
|
1738
1763
|
grain === "month" ? Date.UTC(Math.floor(index / 12), index % 12, 1) : index * DAY_MS
|
|
1739
1764
|
), [grain]);
|
|
1740
1765
|
const lo = toIndex(min, grain, "start");
|
|
@@ -1752,9 +1777,9 @@ function DatePicker({
|
|
|
1752
1777
|
return grain === "month" ? monthOf(now) : now;
|
|
1753
1778
|
}, [today, grain]);
|
|
1754
1779
|
const anchor = toIndex(picked, grain) ?? toIndex(picksRange ? span.start ?? span.end : null, grain) ?? todayIndex;
|
|
1755
|
-
const [cursor, setCursor] =
|
|
1780
|
+
const [cursor, setCursor] = useState7(() => clamp(anchor, lo, hi));
|
|
1756
1781
|
const land = useRef10(false);
|
|
1757
|
-
const setOpen =
|
|
1782
|
+
const setOpen = useCallback4((next) => {
|
|
1758
1783
|
if (openProp === void 0) setSelfOpen(next);
|
|
1759
1784
|
onOpenChange?.(next);
|
|
1760
1785
|
}, [openProp, onOpenChange]);
|
|
@@ -1791,7 +1816,7 @@ function DatePicker({
|
|
|
1791
1816
|
const columns = grain === "month" ? 3 : 7;
|
|
1792
1817
|
const page = grain === "month" ? Math.floor(cursor / 12) : monthOf(cursor);
|
|
1793
1818
|
const caption = grain === "month" ? String(page) : names.monthYear.format(at(firstDayOf(page)));
|
|
1794
|
-
const periodName =
|
|
1819
|
+
const periodName = useCallback4((index) => grain === "month" ? names.monthYear.format(at(index)) : `${names.weekday.format(at(index))} ${names.day.format(at(index))}`, [grain, names, at]);
|
|
1795
1820
|
const count = grain === "month" ? 12 : daysInMonth(page);
|
|
1796
1821
|
const first = grain === "month" ? page * 12 : firstDayOf(page);
|
|
1797
1822
|
const last = first + count - 1;
|
|
@@ -1927,10 +1952,10 @@ function DatePicker({
|
|
|
1927
1952
|
}
|
|
1928
1953
|
const noneBefore = lo != null && first <= lo;
|
|
1929
1954
|
const noneAfter = hi != null && last >= hi;
|
|
1930
|
-
const calendar = /* @__PURE__ */
|
|
1931
|
-
picksRange && presets?.length ? /* @__PURE__ */
|
|
1955
|
+
const calendar = /* @__PURE__ */ jsxs16("div", { className: cx5("ui-datepicker__body", asSheet && "is-sheet"), children: [
|
|
1956
|
+
picksRange && presets?.length ? /* @__PURE__ */ jsx20("div", { className: "ui-datepicker__presets", role: "group", "aria-label": "Period shortcuts", children: presets.map((preset) => {
|
|
1932
1957
|
const within = allowed(preset);
|
|
1933
|
-
return /* @__PURE__ */
|
|
1958
|
+
return /* @__PURE__ */ jsx20(
|
|
1934
1959
|
"button",
|
|
1935
1960
|
{
|
|
1936
1961
|
type: "button",
|
|
@@ -1942,9 +1967,9 @@ function DatePicker({
|
|
|
1942
1967
|
preset.label
|
|
1943
1968
|
);
|
|
1944
1969
|
}) }) : null,
|
|
1945
|
-
/* @__PURE__ */
|
|
1946
|
-
/* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1970
|
+
/* @__PURE__ */ jsxs16("div", { className: "ui-datepicker__calendar", children: [
|
|
1971
|
+
/* @__PURE__ */ jsxs16("div", { className: "ui-datepicker__head", children: [
|
|
1972
|
+
/* @__PURE__ */ jsx20(
|
|
1948
1973
|
"button",
|
|
1949
1974
|
{
|
|
1950
1975
|
type: "button",
|
|
@@ -1952,11 +1977,11 @@ function DatePicker({
|
|
|
1952
1977
|
"aria-label": stepBack,
|
|
1953
1978
|
disabled: noneBefore,
|
|
1954
1979
|
onClick: () => stepPage(-1),
|
|
1955
|
-
children: /* @__PURE__ */
|
|
1980
|
+
children: /* @__PURE__ */ jsx20(Icon, { name: "chevronLeft" })
|
|
1956
1981
|
}
|
|
1957
1982
|
),
|
|
1958
|
-
/* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
1983
|
+
/* @__PURE__ */ jsx20("span", { className: "ui-datepicker__caption", "aria-live": "polite", children: caption }),
|
|
1984
|
+
/* @__PURE__ */ jsx20(
|
|
1960
1985
|
"button",
|
|
1961
1986
|
{
|
|
1962
1987
|
type: "button",
|
|
@@ -1964,11 +1989,11 @@ function DatePicker({
|
|
|
1964
1989
|
"aria-label": stepOn,
|
|
1965
1990
|
disabled: noneAfter,
|
|
1966
1991
|
onClick: () => stepPage(1),
|
|
1967
|
-
children: /* @__PURE__ */
|
|
1992
|
+
children: /* @__PURE__ */ jsx20(Icon, { name: "chevronRight" })
|
|
1968
1993
|
}
|
|
1969
1994
|
)
|
|
1970
1995
|
] }),
|
|
1971
|
-
/* @__PURE__ */
|
|
1996
|
+
/* @__PURE__ */ jsxs16(
|
|
1972
1997
|
"div",
|
|
1973
1998
|
{
|
|
1974
1999
|
className: cx5("ui-datepicker__grid", grain === "day" && "is-days"),
|
|
@@ -1977,7 +2002,7 @@ function DatePicker({
|
|
|
1977
2002
|
ref: grid,
|
|
1978
2003
|
onKeyDown: onGridKeyDown,
|
|
1979
2004
|
children: [
|
|
1980
|
-
weekdays.length > 0 && /* @__PURE__ */
|
|
2005
|
+
weekdays.length > 0 && /* @__PURE__ */ jsx20("div", { className: "ui-datepicker__row", role: "row", children: weekdays.map((weekday) => /* @__PURE__ */ jsx20(
|
|
1981
2006
|
"span",
|
|
1982
2007
|
{
|
|
1983
2008
|
className: "ui-datepicker__weekday",
|
|
@@ -1987,13 +2012,13 @@ function DatePicker({
|
|
|
1987
2012
|
},
|
|
1988
2013
|
weekday.long
|
|
1989
2014
|
)) }),
|
|
1990
|
-
rows.map((cellsInRow, r) => /* @__PURE__ */
|
|
2015
|
+
rows.map((cellsInRow, r) => /* @__PURE__ */ jsx20("div", { className: "ui-datepicker__row", role: "row", children: cellsInRow.map((cell, c) => cell ? /* @__PURE__ */ jsx20(
|
|
1991
2016
|
"span",
|
|
1992
2017
|
{
|
|
1993
2018
|
className: "ui-datepicker__cell",
|
|
1994
2019
|
role: "gridcell",
|
|
1995
2020
|
"aria-selected": isPicked(cell.index),
|
|
1996
|
-
children: /* @__PURE__ */
|
|
2021
|
+
children: /* @__PURE__ */ jsx20(
|
|
1997
2022
|
"button",
|
|
1998
2023
|
{
|
|
1999
2024
|
type: "button",
|
|
@@ -2012,12 +2037,12 @@ function DatePicker({
|
|
|
2012
2037
|
"aria-label": state(cell),
|
|
2013
2038
|
onClick: () => pick(cell),
|
|
2014
2039
|
onFocus: () => setCursor(cell.index),
|
|
2015
|
-
children: /* @__PURE__ */
|
|
2040
|
+
children: /* @__PURE__ */ jsx20("span", { className: "ui-datepicker__num", children: cell.label })
|
|
2016
2041
|
}
|
|
2017
2042
|
)
|
|
2018
2043
|
},
|
|
2019
2044
|
cell.period
|
|
2020
|
-
) : /* @__PURE__ */
|
|
2045
|
+
) : /* @__PURE__ */ jsx20("span", { className: "ui-datepicker__cell is-empty", role: "gridcell" }, `e${r}-${c}`)) }, `r${r}`))
|
|
2021
2046
|
]
|
|
2022
2047
|
}
|
|
2023
2048
|
)
|
|
@@ -2027,8 +2052,8 @@ function DatePicker({
|
|
|
2027
2052
|
// `open` on the root whichever form the panel takes, so the trigger's
|
|
2028
2053
|
// chevron flips for the sheet as it does for the popover. The panel rules
|
|
2029
2054
|
// it also switches on have no panel to find while the sheet is up.
|
|
2030
|
-
/* @__PURE__ */
|
|
2031
|
-
/* @__PURE__ */
|
|
2055
|
+
/* @__PURE__ */ jsxs16("div", { className: cx5("ui-dropdown", "ui-datepicker", open && "open"), ref: root, children: [
|
|
2056
|
+
/* @__PURE__ */ jsxs16(
|
|
2032
2057
|
"button",
|
|
2033
2058
|
{
|
|
2034
2059
|
type: "button",
|
|
@@ -2044,8 +2069,8 @@ function DatePicker({
|
|
|
2044
2069
|
setOpen(!open);
|
|
2045
2070
|
},
|
|
2046
2071
|
children: [
|
|
2047
|
-
/* @__PURE__ */
|
|
2048
|
-
/* @__PURE__ */
|
|
2072
|
+
/* @__PURE__ */ jsx20("span", { className: "ui-dropdown__value", children: shown ?? empty }),
|
|
2073
|
+
/* @__PURE__ */ jsx20("span", { className: "ui-dropdown__chevron", "aria-hidden": "true" })
|
|
2049
2074
|
]
|
|
2050
2075
|
}
|
|
2051
2076
|
),
|
|
@@ -2056,8 +2081,8 @@ function DatePicker({
|
|
|
2056
2081
|
// without taking the sheet's affordances left a phone reader with no
|
|
2057
2082
|
// visible way out and a Tab that walked into the live page behind it.
|
|
2058
2083
|
// why: guidelines/drawer.md
|
|
2059
|
-
/* @__PURE__ */
|
|
2060
|
-
) : /* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ jsx20(Drawer, { open, side: "bottom", size: "md", title: name, onClose: () => setOpen(false), children: calendar })
|
|
2085
|
+
) : /* @__PURE__ */ jsx20(
|
|
2061
2086
|
"div",
|
|
2062
2087
|
{
|
|
2063
2088
|
className: cx5("ui-dropdown__panel", "ui-datepicker__panel", align === "end" && "is-end"),
|
|
@@ -2075,21 +2100,25 @@ function DatePicker({
|
|
|
2075
2100
|
// src/Dropdown.tsx
|
|
2076
2101
|
import {
|
|
2077
2102
|
Fragment as Fragment5,
|
|
2078
|
-
useCallback as
|
|
2103
|
+
useCallback as useCallback5,
|
|
2079
2104
|
useContext as useContext2,
|
|
2080
2105
|
useEffect as useEffect7,
|
|
2081
2106
|
useId as useId8,
|
|
2082
2107
|
useRef as useRef11,
|
|
2083
|
-
useState as
|
|
2108
|
+
useState as useState8
|
|
2084
2109
|
} from "react";
|
|
2085
2110
|
import {
|
|
2086
|
-
icon as
|
|
2111
|
+
icon as icon4,
|
|
2087
2112
|
dropdownMatch,
|
|
2088
2113
|
dropdownFiltering,
|
|
2089
2114
|
filterPanelFit,
|
|
2090
2115
|
transitionMs as transitionMs2,
|
|
2091
2116
|
dropdownViewportFit,
|
|
2092
2117
|
dropdownHeightFit,
|
|
2118
|
+
dropdownLift,
|
|
2119
|
+
dropdownReveal,
|
|
2120
|
+
dropdownRest,
|
|
2121
|
+
dropdownSnap,
|
|
2093
2122
|
filterPanelRow
|
|
2094
2123
|
} from "@apliteni/apliteni-ui";
|
|
2095
2124
|
|
|
@@ -2098,7 +2127,7 @@ import { createContext as createContext2 } from "react";
|
|
|
2098
2127
|
var FieldContext = createContext2(null);
|
|
2099
2128
|
|
|
2100
2129
|
// src/Dropdown.tsx
|
|
2101
|
-
import { Fragment as Fragment6, jsx as
|
|
2130
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2102
2131
|
var EXIT_SLACK_MS2 = 50;
|
|
2103
2132
|
var SETTLE_MS = 450;
|
|
2104
2133
|
var inPanel = (node) => {
|
|
@@ -2107,12 +2136,12 @@ var inPanel = (node) => {
|
|
|
2107
2136
|
};
|
|
2108
2137
|
var cx6 = (...a) => a.filter(Boolean).join(" ");
|
|
2109
2138
|
var isRow = (it) => Boolean(it) && it !== "---" && !it.separator;
|
|
2110
|
-
var Glyph2 = ({ name, className, hidden }) => /* @__PURE__ */
|
|
2139
|
+
var Glyph2 = ({ name, className, hidden }) => /* @__PURE__ */ jsx21(
|
|
2111
2140
|
"span",
|
|
2112
2141
|
{
|
|
2113
2142
|
className,
|
|
2114
2143
|
"aria-hidden": hidden ? "true" : void 0,
|
|
2115
|
-
dangerouslySetInnerHTML: { __html:
|
|
2144
|
+
dangerouslySetInnerHTML: { __html: icon4(name) }
|
|
2116
2145
|
}
|
|
2117
2146
|
);
|
|
2118
2147
|
function RowBadge({ badge }) {
|
|
@@ -2120,12 +2149,17 @@ function RowBadge({ badge }) {
|
|
|
2120
2149
|
const given = typeof badge === "string" ? "" : badge.tone || "";
|
|
2121
2150
|
let tone = given || (/^live$/i.test(String(text2)) ? "live" : "neutral");
|
|
2122
2151
|
if (!given && tone === "neutral" && /^(?:off|unset|disabled|archive|archived)$/i.test(text2)) tone = "state";
|
|
2123
|
-
return /* @__PURE__ */
|
|
2152
|
+
return /* @__PURE__ */ jsx21("span", { className: `ui-dropdown__badge is-${tone}`, children: text2 });
|
|
2124
2153
|
}
|
|
2125
2154
|
var keyOf = (it) => it.value != null ? `v:${it.value}` : `l:${it.label}`;
|
|
2126
2155
|
var itemsIn = (panel) => Array.from(panel?.querySelectorAll("[data-dd-item]") ?? []).filter((el) => el.getAttribute("aria-disabled") !== "true" && !el.hidden);
|
|
2127
2156
|
var openNow = /* @__PURE__ */ new Set();
|
|
2128
2157
|
var composing = (e) => e.isComposing || e.keyCode === 229;
|
|
2158
|
+
var countOf2 = (count, rows) => {
|
|
2159
|
+
if (count == null) return null;
|
|
2160
|
+
const n = count === true ? rows.filter((it) => !it.avatar?.empty).length : Number(count);
|
|
2161
|
+
return Number.isFinite(n) && n >= 0 ? n : null;
|
|
2162
|
+
};
|
|
2129
2163
|
var SEARCH_DEFAULTS = {
|
|
2130
2164
|
placeholder: "Search",
|
|
2131
2165
|
empty: "No match for \u201C{q}\u201D",
|
|
@@ -2159,22 +2193,23 @@ function Dropdown({
|
|
|
2159
2193
|
onSelect,
|
|
2160
2194
|
row
|
|
2161
2195
|
}) {
|
|
2162
|
-
const [selfOpen, setSelfOpen] =
|
|
2196
|
+
const [selfOpen, setSelfOpen] = useState8(defaultOpen);
|
|
2163
2197
|
const open = openProp ?? selfOpen;
|
|
2164
|
-
const [pick, setPick] =
|
|
2165
|
-
const [query, setQuery] =
|
|
2166
|
-
const [activeKey, setActiveKey] =
|
|
2198
|
+
const [pick, setPick] = useState8(null);
|
|
2199
|
+
const [query, setQuery] = useState8(() => search && search !== true ? search.query || "" : "");
|
|
2200
|
+
const [activeKey, setActiveKey] = useState8(null);
|
|
2167
2201
|
const root = useRef11(null);
|
|
2168
2202
|
const panel = useRef11(null);
|
|
2169
2203
|
const trigger = useRef11(null);
|
|
2170
2204
|
const field = useRef11(null);
|
|
2171
2205
|
const landOn = useRef11(null);
|
|
2206
|
+
const revealed = useRef11(false);
|
|
2172
2207
|
const at = useRef11("");
|
|
2173
2208
|
const auto = useId8().replace(/:/g, "");
|
|
2174
2209
|
const uid = id ?? auto;
|
|
2175
2210
|
const inField = useContext2(FieldContext);
|
|
2176
2211
|
const fieldName = inField && id === inField.id && !(ariaLabel && triggerContent != null) ? { id: `${uid}-trigger`, labelId: inField.labelId, labelledBy: `${inField.labelId} ${uid}-trigger` } : null;
|
|
2177
|
-
const setOpen =
|
|
2212
|
+
const setOpen = useCallback5((next) => {
|
|
2178
2213
|
if (openProp === void 0) setSelfOpen(next);
|
|
2179
2214
|
onOpenChange?.(next);
|
|
2180
2215
|
}, [openProp, onOpenChange]);
|
|
@@ -2260,9 +2295,17 @@ function Dropdown({
|
|
|
2260
2295
|
el.classList.remove("is-closing");
|
|
2261
2296
|
};
|
|
2262
2297
|
}, [open]);
|
|
2263
|
-
const sx = search ? { ...SEARCH_DEFAULTS, ...strip(search === true ? {} : search) } : null;
|
|
2264
2298
|
const entries = sections?.length ? sections.flatMap((s) => s.items || []) : items || [];
|
|
2265
2299
|
const rows = entries.filter(isRow);
|
|
2300
|
+
const given_ = search ? strip(search === true ? {} : search) : null;
|
|
2301
|
+
const n = given_ ? countOf2(given_.count, rows) : null;
|
|
2302
|
+
const counted = n == null ? void 0 : `Search ${n} ${given_?.noun || "people"}`;
|
|
2303
|
+
const sx = given_ ? {
|
|
2304
|
+
...SEARCH_DEFAULTS,
|
|
2305
|
+
...given_,
|
|
2306
|
+
placeholder: given_.placeholder || counted || SEARCH_DEFAULTS.placeholder,
|
|
2307
|
+
label: given_.label || counted
|
|
2308
|
+
} : null;
|
|
2266
2309
|
const isSelect = variant === "select" || variant == null && rows.some((it) => it.selected || it.value != null);
|
|
2267
2310
|
const listRole = isSelect ? "listbox" : "menu";
|
|
2268
2311
|
const asOption = isSelect || Boolean(sx);
|
|
@@ -2275,6 +2318,8 @@ function Dropdown({
|
|
|
2275
2318
|
}, [givenKey, pick]);
|
|
2276
2319
|
const picked = pickedKey != null ? rows.find((it) => keyOf(it) === pickedKey) : void 0;
|
|
2277
2320
|
const shown = value != null ? value : isSelect ? picked?.label ?? given?.label : null;
|
|
2321
|
+
const marked2 = isSelect && rows.some((it) => it.avatar);
|
|
2322
|
+
const chosen = marked2 ? value != null ? rows.find((it) => it.label === value) : picked ?? given : void 0;
|
|
2278
2323
|
const selectedOf = (it) => pickedKey != null ? it.disabled ? !!it.selected : keyOf(it) === pickedKey : !!it.selected;
|
|
2279
2324
|
const hiddenBy = (it) => Boolean(sx) && !dropdownMatch(it.label, query);
|
|
2280
2325
|
const filtering = Boolean(sx) && dropdownFiltering(query);
|
|
@@ -2312,24 +2357,39 @@ function Dropdown({
|
|
|
2312
2357
|
};
|
|
2313
2358
|
}, [open]);
|
|
2314
2359
|
useIsoLayoutEffect(() => {
|
|
2315
|
-
if (!open) return;
|
|
2316
2360
|
const el = panel.current;
|
|
2317
|
-
if (!el) return;
|
|
2361
|
+
if (!el || !root.current) return void 0;
|
|
2362
|
+
return dropdownRest(root.current, el, open);
|
|
2363
|
+
}, [open]);
|
|
2364
|
+
useIsoLayoutEffect(() => {
|
|
2365
|
+
const dd = root.current;
|
|
2366
|
+
const el = panel.current;
|
|
2367
|
+
if (!open || !el || !dd) return;
|
|
2318
2368
|
const size = () => {
|
|
2319
|
-
const avail = dropdownHeightFit(
|
|
2369
|
+
const avail = dropdownHeightFit(dd, el);
|
|
2320
2370
|
if (avail == null) return;
|
|
2321
2371
|
if (Number.isFinite(avail)) el.style.setProperty("--ui-dropdown-avail", `${avail}px`);
|
|
2322
2372
|
else el.style.removeProperty("--ui-dropdown-avail");
|
|
2323
|
-
|
|
2324
|
-
|
|
2373
|
+
el.classList.toggle("is-unbounded", !Number.isFinite(avail));
|
|
2374
|
+
dropdownSnap(dd, el);
|
|
2325
2375
|
};
|
|
2376
|
+
dropdownLift(dd, el);
|
|
2326
2377
|
size();
|
|
2378
|
+
revealed.current = dropdownReveal(dd, el) !== 0;
|
|
2379
|
+
const follow = () => {
|
|
2380
|
+
if (el.hasAttribute("data-dd-lifted")) dropdownLift(dd, el);
|
|
2381
|
+
};
|
|
2382
|
+
const resize = () => {
|
|
2383
|
+
dropdownLift(dd, el);
|
|
2384
|
+
size();
|
|
2385
|
+
dropdownReveal(dd, el);
|
|
2386
|
+
};
|
|
2327
2387
|
const view = el.ownerDocument?.defaultView ?? window;
|
|
2328
|
-
view.addEventListener("scroll",
|
|
2329
|
-
view.addEventListener("resize",
|
|
2388
|
+
view.addEventListener("scroll", follow, true);
|
|
2389
|
+
view.addEventListener("resize", resize);
|
|
2330
2390
|
return () => {
|
|
2331
|
-
view.removeEventListener("scroll",
|
|
2332
|
-
view.removeEventListener("resize",
|
|
2391
|
+
view.removeEventListener("scroll", follow, true);
|
|
2392
|
+
view.removeEventListener("resize", resize);
|
|
2333
2393
|
};
|
|
2334
2394
|
}, [open, direction]);
|
|
2335
2395
|
useIsoLayoutEffect(() => {
|
|
@@ -2350,7 +2410,7 @@ function Dropdown({
|
|
|
2350
2410
|
panel.current.style.minWidth = "";
|
|
2351
2411
|
if (panel.current.offsetWidth) panel.current.style.minWidth = `${panel.current.offsetWidth}px`;
|
|
2352
2412
|
}
|
|
2353
|
-
field.current?.focus();
|
|
2413
|
+
field.current?.focus(revealed.current ? { preventScroll: true } : void 0);
|
|
2354
2414
|
return;
|
|
2355
2415
|
}
|
|
2356
2416
|
if (want == null) return;
|
|
@@ -2358,7 +2418,7 @@ function Dropdown({
|
|
|
2358
2418
|
if (!els.length) return;
|
|
2359
2419
|
const sel = els.findIndex((el) => el.getAttribute("aria-selected") === "true");
|
|
2360
2420
|
const to = want === "selected" ? sel >= 0 ? sel : 0 : want;
|
|
2361
|
-
(els[to] || els[0]).focus();
|
|
2421
|
+
(els[to] || els[0]).focus(revealed.current ? { preventScroll: true } : void 0);
|
|
2362
2422
|
}, [open]);
|
|
2363
2423
|
useIsoLayoutEffect(() => {
|
|
2364
2424
|
if (!sx || !open || !active) return;
|
|
@@ -2375,6 +2435,7 @@ function Dropdown({
|
|
|
2375
2435
|
const el = panel.current;
|
|
2376
2436
|
if (!el || el.closest(".ui-filter-bar")) return;
|
|
2377
2437
|
const fit = () => {
|
|
2438
|
+
if (el.hasAttribute("data-dd-lifted")) return;
|
|
2378
2439
|
let got = dropdownViewportFit(el);
|
|
2379
2440
|
if (!got) return;
|
|
2380
2441
|
el.style.setProperty("--ui-dropdown-ceiling", got.max > 0 ? `${got.max}px` : "");
|
|
@@ -2482,6 +2543,7 @@ function Dropdown({
|
|
|
2482
2543
|
e.preventDefault();
|
|
2483
2544
|
const els = itemsIn(panel.current);
|
|
2484
2545
|
els[els.length - 1]?.focus();
|
|
2546
|
+
dropdownReveal(root.current, panel.current);
|
|
2485
2547
|
} else if ((e.key === "Enter" || e.key === " ") && open && e.target.matches?.("[data-dd-item]")) {
|
|
2486
2548
|
e.preventDefault();
|
|
2487
2549
|
e.target.click();
|
|
@@ -2506,7 +2568,7 @@ function Dropdown({
|
|
|
2506
2568
|
};
|
|
2507
2569
|
function renderRow(entry, key) {
|
|
2508
2570
|
if (!isRow(entry)) {
|
|
2509
|
-
return /* @__PURE__ */
|
|
2571
|
+
return /* @__PURE__ */ jsx21("div", { className: "ui-dropdown__sep", role: "separator", hidden: filtering || void 0 }, key);
|
|
2510
2572
|
}
|
|
2511
2573
|
const disabled2 = !!entry.disabled;
|
|
2512
2574
|
const selected = selectedOf(entry);
|
|
@@ -2528,23 +2590,23 @@ function Dropdown({
|
|
|
2528
2590
|
...asLink ? { href: entry.href, ...entry.target ? { target: entry.target } : null } : null,
|
|
2529
2591
|
...sx ? { id: rowIds.get(entry), hidden: hiddenBy(entry) || void 0 } : null,
|
|
2530
2592
|
onClick: (e) => choose(entry, e),
|
|
2531
|
-
children: /* @__PURE__ */
|
|
2532
|
-
entry.icon && /* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2534
|
-
/* @__PURE__ */
|
|
2535
|
-
entry.description && /* @__PURE__ */
|
|
2593
|
+
children: /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
2594
|
+
entry.avatar ? /* @__PURE__ */ jsx21(Avatar, { personKey: entry.avatar.key, name: entry.avatar.name, src: entry.avatar.src, empty: entry.avatar.empty }) : entry.icon && /* @__PURE__ */ jsx21(Glyph2, { name: entry.icon, className: "ui-dropdown__ic" }),
|
|
2595
|
+
/* @__PURE__ */ jsxs17("span", { className: "ui-dropdown__main", children: [
|
|
2596
|
+
/* @__PURE__ */ jsx21("span", { className: "ui-dropdown__label", children: entry.label }),
|
|
2597
|
+
entry.description && /* @__PURE__ */ jsx21("span", { className: "ui-dropdown__desc", children: entry.description })
|
|
2536
2598
|
] }),
|
|
2537
|
-
entry.badge ? /* @__PURE__ */
|
|
2538
|
-
asOption && /* @__PURE__ */
|
|
2599
|
+
entry.badge ? /* @__PURE__ */ jsx21(RowBadge, { badge: entry.badge }) : null,
|
|
2600
|
+
asOption && /* @__PURE__ */ jsx21(Glyph2, { name: "check", className: "ui-dropdown__tick", hidden: true })
|
|
2539
2601
|
] })
|
|
2540
2602
|
};
|
|
2541
|
-
if (row) return /* @__PURE__ */
|
|
2603
|
+
if (row) return /* @__PURE__ */ jsx21(Fragment5, { children: row(entry, props) }, key);
|
|
2542
2604
|
const Tag = asLink ? "a" : "div";
|
|
2543
|
-
return /* @__PURE__ */
|
|
2605
|
+
return /* @__PURE__ */ jsx21(Tag, { ...props }, key);
|
|
2544
2606
|
}
|
|
2545
2607
|
const body = sections?.length ? sections.map((section, si) => {
|
|
2546
2608
|
const gone = filtering && !(section.items || []).some((it) => isRow(it) && !hiddenBy(it));
|
|
2547
|
-
return /* @__PURE__ */
|
|
2609
|
+
return /* @__PURE__ */ jsxs17(
|
|
2548
2610
|
"div",
|
|
2549
2611
|
{
|
|
2550
2612
|
className: "ui-dropdown__section",
|
|
@@ -2552,7 +2614,7 @@ function Dropdown({
|
|
|
2552
2614
|
"aria-label": section.label || void 0,
|
|
2553
2615
|
hidden: gone || void 0,
|
|
2554
2616
|
children: [
|
|
2555
|
-
section.label && /* @__PURE__ */
|
|
2617
|
+
section.label && /* @__PURE__ */ jsx21("div", { className: "ui-dropdown__group", role: "presentation", children: section.label }),
|
|
2556
2618
|
(section.items || []).map((entry, i) => renderRow(entry, `s${si}-${i}`))
|
|
2557
2619
|
]
|
|
2558
2620
|
},
|
|
@@ -2560,12 +2622,12 @@ function Dropdown({
|
|
|
2560
2622
|
);
|
|
2561
2623
|
}) : (items || []).map((entry, i) => renderRow(entry, `i${i}`));
|
|
2562
2624
|
const cap = scroll && scroll !== true ? { "--ui-dropdown-cap": typeof scroll === "number" ? `${scroll}px` : scroll } : void 0;
|
|
2563
|
-
const none = sx && filtering && !visible.length ? /* @__PURE__ */
|
|
2564
|
-
/* @__PURE__ */
|
|
2565
|
-
/* @__PURE__ */
|
|
2625
|
+
const none = sx && filtering && !visible.length ? /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
2626
|
+
/* @__PURE__ */ jsx21("span", { className: "ui-dropdown__none-title", children: sx.empty.replace("{q}", () => query.trim()) }),
|
|
2627
|
+
/* @__PURE__ */ jsx21("span", { className: "ui-dropdown__none-hint", children: sx.hint })
|
|
2566
2628
|
] }) : null;
|
|
2567
|
-
return /* @__PURE__ */
|
|
2568
|
-
/* @__PURE__ */
|
|
2629
|
+
return /* @__PURE__ */ jsxs17("div", { className: cx6("ui-dropdown", open && "open"), id, ref: root, onKeyDown, children: [
|
|
2630
|
+
/* @__PURE__ */ jsxs17(
|
|
2569
2631
|
"button",
|
|
2570
2632
|
{
|
|
2571
2633
|
type: "button",
|
|
@@ -2585,15 +2647,16 @@ function Dropdown({
|
|
|
2585
2647
|
setOpen(!open);
|
|
2586
2648
|
},
|
|
2587
2649
|
children: [
|
|
2588
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */
|
|
2589
|
-
|
|
2590
|
-
/* @__PURE__ */
|
|
2650
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
2651
|
+
marked2 && (chosen?.avatar ? /* @__PURE__ */ jsx21(Avatar, { personKey: chosen.avatar.key, name: chosen.avatar.name, src: chosen.avatar.src, empty: chosen.avatar.empty }) : /* @__PURE__ */ jsx21(Avatar, { empty: true })),
|
|
2652
|
+
label && /* @__PURE__ */ jsx21("span", { className: "ui-dropdown__pre", children: label }),
|
|
2653
|
+
/* @__PURE__ */ jsx21("span", { className: cx6("ui-dropdown__value", marked2 && !chosen && "is-placeholder"), children: shown != null ? shown : placeholder })
|
|
2591
2654
|
] }),
|
|
2592
|
-
chevron && /* @__PURE__ */
|
|
2655
|
+
chevron && /* @__PURE__ */ jsx21("span", { className: "ui-dropdown__chevron", "aria-hidden": "true" })
|
|
2593
2656
|
]
|
|
2594
2657
|
}
|
|
2595
2658
|
),
|
|
2596
|
-
/* @__PURE__ */
|
|
2659
|
+
/* @__PURE__ */ jsxs17(
|
|
2597
2660
|
"div",
|
|
2598
2661
|
{
|
|
2599
2662
|
className: cx6(
|
|
@@ -2614,10 +2677,10 @@ function Dropdown({
|
|
|
2614
2677
|
onMouseMove,
|
|
2615
2678
|
children: [
|
|
2616
2679
|
header,
|
|
2617
|
-
sx ? /* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
/* @__PURE__ */
|
|
2620
|
-
/* @__PURE__ */
|
|
2680
|
+
sx ? /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
2681
|
+
/* @__PURE__ */ jsxs17("div", { className: "ui-dropdown__search", children: [
|
|
2682
|
+
/* @__PURE__ */ jsx21(Glyph2, { name: "search", className: "ui-dropdown__search-ic", hidden: true }),
|
|
2683
|
+
/* @__PURE__ */ jsx21(
|
|
2621
2684
|
"input",
|
|
2622
2685
|
{
|
|
2623
2686
|
className: "ui-dropdown__search-input",
|
|
@@ -2641,8 +2704,8 @@ function Dropdown({
|
|
|
2641
2704
|
}
|
|
2642
2705
|
)
|
|
2643
2706
|
] }),
|
|
2644
|
-
/* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2707
|
+
/* @__PURE__ */ jsx21("div", { className: "ui-dropdown__list", role: "listbox", id: listId, "aria-label": name, style: cap, children: body }),
|
|
2708
|
+
/* @__PURE__ */ jsx21(
|
|
2646
2709
|
"div",
|
|
2647
2710
|
{
|
|
2648
2711
|
className: "ui-dropdown__none",
|
|
@@ -2667,7 +2730,7 @@ function strip(o) {
|
|
|
2667
2730
|
}
|
|
2668
2731
|
|
|
2669
2732
|
// src/BackLink.tsx
|
|
2670
|
-
import { jsx as
|
|
2733
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2671
2734
|
var BARE = "Back";
|
|
2672
2735
|
var SCRIPTED = /^javascript:/i;
|
|
2673
2736
|
var LEADING = /^[\u0000-\u0020]+/;
|
|
@@ -2686,7 +2749,7 @@ function BackLink({
|
|
|
2686
2749
|
const name = text(label).replace(SAID, "");
|
|
2687
2750
|
const bare = !name || name.toLowerCase() === BARE.toLowerCase();
|
|
2688
2751
|
const Tag = as ?? "a";
|
|
2689
|
-
return /* @__PURE__ */
|
|
2752
|
+
return /* @__PURE__ */ jsxs18(
|
|
2690
2753
|
Tag,
|
|
2691
2754
|
{
|
|
2692
2755
|
className: ["ui-back", className].filter(Boolean).join(" "),
|
|
@@ -2694,8 +2757,8 @@ function BackLink({
|
|
|
2694
2757
|
"aria-label": bare ? void 0 : `${BARE} to ${name}`,
|
|
2695
2758
|
...rest,
|
|
2696
2759
|
children: [
|
|
2697
|
-
/* @__PURE__ */
|
|
2698
|
-
/* @__PURE__ */
|
|
2760
|
+
/* @__PURE__ */ jsx22(Icon, { name: "chevronLeft" }),
|
|
2761
|
+
/* @__PURE__ */ jsx22("span", { className: "ui-back__label", children: bare ? BARE : name })
|
|
2699
2762
|
]
|
|
2700
2763
|
}
|
|
2701
2764
|
);
|
|
@@ -2703,41 +2766,41 @@ function BackLink({
|
|
|
2703
2766
|
|
|
2704
2767
|
// src/TableValues.tsx
|
|
2705
2768
|
import { formatNumericValue, formatDeltaValue } from "@apliteni/apliteni-ui";
|
|
2706
|
-
import { jsx as
|
|
2769
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2707
2770
|
function NumericValue(props) {
|
|
2708
2771
|
const value = formatNumericValue(props);
|
|
2709
|
-
return /* @__PURE__ */
|
|
2772
|
+
return /* @__PURE__ */ jsx23("span", { children: /* @__PURE__ */ jsxs19("span", { className: "ui-value", "aria-label": value.missing, children: [
|
|
2710
2773
|
value.text,
|
|
2711
|
-
value.unit && /* @__PURE__ */
|
|
2774
|
+
value.unit && /* @__PURE__ */ jsx23("span", { className: "ui-value__unit", children: value.unit })
|
|
2712
2775
|
] }) });
|
|
2713
2776
|
}
|
|
2714
2777
|
function DeltaValue(props) {
|
|
2715
2778
|
const value = formatDeltaValue(props);
|
|
2716
|
-
return /* @__PURE__ */
|
|
2779
|
+
return /* @__PURE__ */ jsx23("span", { children: /* @__PURE__ */ jsx23("span", { className: value.className, "aria-describedby": value.basisId || void 0, children: value.text }) });
|
|
2717
2780
|
}
|
|
2718
2781
|
function RowIdentity({ symbol, name, logo, href }) {
|
|
2719
2782
|
const Tag = href ? "a" : "span";
|
|
2720
|
-
return /* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2722
|
-
/* @__PURE__ */
|
|
2723
|
-
logo && /* @__PURE__ */
|
|
2783
|
+
return /* @__PURE__ */ jsxs19(Tag, { className: "ui-identity", href, children: [
|
|
2784
|
+
/* @__PURE__ */ jsxs19("span", { className: "ui-identity__logo", "aria-hidden": "true", children: [
|
|
2785
|
+
/* @__PURE__ */ jsx23("span", { children: symbol.slice(0, 1) }),
|
|
2786
|
+
logo && /* @__PURE__ */ jsx23("img", { src: logo, alt: "", onLoad: (e) => {
|
|
2724
2787
|
e.currentTarget.hidden = false;
|
|
2725
2788
|
}, onError: (e) => {
|
|
2726
2789
|
e.currentTarget.hidden = true;
|
|
2727
2790
|
} })
|
|
2728
2791
|
] }),
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
/* @__PURE__ */
|
|
2792
|
+
/* @__PURE__ */ jsx23("span", { className: "ui-identity__symbol", children: symbol }),
|
|
2793
|
+
/* @__PURE__ */ jsx23("span", { className: "ui-identity__name", children: name })
|
|
2731
2794
|
] });
|
|
2732
2795
|
}
|
|
2733
2796
|
|
|
2734
2797
|
// src/Segmented.tsx
|
|
2735
2798
|
import { segmentedNextIndex } from "@apliteni/apliteni-ui";
|
|
2736
|
-
import { jsx as
|
|
2799
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2737
2800
|
function Segmented({ options, value, onChange, label, appearance = "pill", size, block = false, disabled = false }) {
|
|
2738
2801
|
const enabled = options.filter((o) => !o.disabled);
|
|
2739
2802
|
const tabValue = enabled.some((o) => o.value === value) ? value : enabled[0]?.value;
|
|
2740
|
-
return /* @__PURE__ */
|
|
2803
|
+
return /* @__PURE__ */ jsx24("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__ */ jsx24(
|
|
2741
2804
|
"button",
|
|
2742
2805
|
{
|
|
2743
2806
|
type: "button",
|
|
@@ -2763,17 +2826,17 @@ function Segmented({ options, value, onChange, label, appearance = "pill", size,
|
|
|
2763
2826
|
}
|
|
2764
2827
|
|
|
2765
2828
|
// src/FilterBar.tsx
|
|
2766
|
-
import { useRef as useRef12, useState as
|
|
2829
|
+
import { useRef as useRef12, useState as useState9 } from "react";
|
|
2767
2830
|
import { filterChipText, filterChipName, filterChipUnset, filterChipItems, focusNextStop } from "@apliteni/apliteni-ui";
|
|
2768
|
-
import { Fragment as Fragment7, jsx as
|
|
2831
|
+
import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2769
2832
|
var SEARCH_AT = 10;
|
|
2770
2833
|
var isRow2 = (entry) => entry !== "---" && !entry.separator;
|
|
2771
2834
|
function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clearVariant = "ghost", add, addLabel = "Filter", disabled = false, busy = false, onRemove, onClear, onChange, onAdd }) {
|
|
2772
2835
|
const bar = useRef12(null);
|
|
2773
2836
|
const focused = useRef12(null);
|
|
2774
2837
|
const landing = useRef12(null);
|
|
2775
|
-
const [opened, setOpened] =
|
|
2776
|
-
const [adding, setAdding] =
|
|
2838
|
+
const [opened, setOpened] = useState9({});
|
|
2839
|
+
const [adding, setAdding] = useState9(false);
|
|
2777
2840
|
const blocked = disabled || busy;
|
|
2778
2841
|
const offer = (add || []).filter((entry) => !filters.some((filter) => filter.id === entry.id));
|
|
2779
2842
|
const source = /* @__PURE__ */ new Map();
|
|
@@ -2808,7 +2871,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2808
2871
|
if (target) target.focus();
|
|
2809
2872
|
else focusNextStop(bar.current);
|
|
2810
2873
|
});
|
|
2811
|
-
return /* @__PURE__ */
|
|
2874
|
+
return /* @__PURE__ */ jsx25("div", { children: /* @__PURE__ */ jsxs20(
|
|
2812
2875
|
"fieldset",
|
|
2813
2876
|
{
|
|
2814
2877
|
ref: bar,
|
|
@@ -2821,8 +2884,8 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2821
2884
|
if (event.relatedTarget && !event.currentTarget.contains(event.relatedTarget)) focused.current = null;
|
|
2822
2885
|
},
|
|
2823
2886
|
children: [
|
|
2824
|
-
/* @__PURE__ */
|
|
2825
|
-
filters.map((filter, index) => /* @__PURE__ */
|
|
2887
|
+
/* @__PURE__ */ jsx25("legend", { className: "ui-filter-bar__legend", children: label }),
|
|
2888
|
+
filters.map((filter, index) => /* @__PURE__ */ jsxs20(
|
|
2826
2889
|
"fieldset",
|
|
2827
2890
|
{
|
|
2828
2891
|
className: "ui-filter-bar__chip",
|
|
@@ -2832,14 +2895,14 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2832
2895
|
focused.current = { id: filter.id, index };
|
|
2833
2896
|
},
|
|
2834
2897
|
children: [
|
|
2835
|
-
/* @__PURE__ */
|
|
2836
|
-
/* @__PURE__ */
|
|
2898
|
+
/* @__PURE__ */ jsx25("legend", { className: "ui-filter-bar__legend", children: filter.label }),
|
|
2899
|
+
/* @__PURE__ */ jsx25(
|
|
2837
2900
|
Dropdown,
|
|
2838
2901
|
{
|
|
2839
2902
|
items: filterChipItems(filter),
|
|
2840
2903
|
variant: "select",
|
|
2841
2904
|
ariaLabel: filterChipName(filter),
|
|
2842
|
-
triggerContent: /* @__PURE__ */
|
|
2905
|
+
triggerContent: /* @__PURE__ */ jsx25("span", { className: filterChipUnset(filter) ? "ui-dropdown__value is-placeholder" : "ui-dropdown__value", children: filterChipText(filter) }),
|
|
2843
2906
|
open: !blocked && !filter.disabled && (opened[filter.id] && opened[filter.id].against === filter.open ? opened[filter.id].open : !!filter.open),
|
|
2844
2907
|
onOpenChange: (open) => setOpened((previous) => ({ ...previous, [filter.id]: { open, against: filter.open } })),
|
|
2845
2908
|
onSelect: (value) => {
|
|
@@ -2847,7 +2910,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2847
2910
|
}
|
|
2848
2911
|
}
|
|
2849
2912
|
),
|
|
2850
|
-
/* @__PURE__ */
|
|
2913
|
+
/* @__PURE__ */ jsx25(
|
|
2851
2914
|
"button",
|
|
2852
2915
|
{
|
|
2853
2916
|
type: "button",
|
|
@@ -2864,16 +2927,16 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2864
2927
|
},
|
|
2865
2928
|
filter.id
|
|
2866
2929
|
)),
|
|
2867
|
-
offering && /* @__PURE__ */
|
|
2930
|
+
offering && /* @__PURE__ */ jsx25("div", { "data-filter-add": "", onFocus: () => {
|
|
2868
2931
|
focused.current = null;
|
|
2869
|
-
}, children: /* @__PURE__ */
|
|
2932
|
+
}, children: /* @__PURE__ */ jsx25(
|
|
2870
2933
|
Dropdown,
|
|
2871
2934
|
{
|
|
2872
2935
|
variant: "menu",
|
|
2873
2936
|
sections,
|
|
2874
2937
|
ariaLabel: addLabel,
|
|
2875
|
-
triggerContent: /* @__PURE__ */
|
|
2876
|
-
/* @__PURE__ */
|
|
2938
|
+
triggerContent: /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
2939
|
+
/* @__PURE__ */ jsx25(Icon, { name: "plus" }),
|
|
2877
2940
|
addLabel
|
|
2878
2941
|
] }),
|
|
2879
2942
|
search: options >= SEARCH_AT && { label: `Search ${label.toLowerCase()}` },
|
|
@@ -2887,9 +2950,9 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2887
2950
|
}
|
|
2888
2951
|
}
|
|
2889
2952
|
) }),
|
|
2890
|
-
filters.length > 0 && /* @__PURE__ */
|
|
2953
|
+
filters.length > 0 && /* @__PURE__ */ jsx25("span", { "data-filter-clear": "", onFocus: () => {
|
|
2891
2954
|
focused.current = { id: null, index: 0 };
|
|
2892
|
-
}, children: /* @__PURE__ */
|
|
2955
|
+
}, children: /* @__PURE__ */ jsx25(Button, { size: "sm", variant: clearVariant, onClick: () => {
|
|
2893
2956
|
if (!blocked) onClear();
|
|
2894
2957
|
}, children: clearLabel }) })
|
|
2895
2958
|
]
|
|
@@ -2898,34 +2961,34 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2898
2961
|
}
|
|
2899
2962
|
|
|
2900
2963
|
// src/KeyValueList.tsx
|
|
2901
|
-
import { jsx as
|
|
2964
|
+
import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2902
2965
|
function detail({ value, redacted }) {
|
|
2903
|
-
if (redacted) return /* @__PURE__ */
|
|
2904
|
-
/* @__PURE__ */
|
|
2966
|
+
if (redacted) return /* @__PURE__ */ jsxs21("span", { className: "ui-kv__hidden", children: [
|
|
2967
|
+
/* @__PURE__ */ jsx26(Icon, { name: "eyeOff" }),
|
|
2905
2968
|
"Hidden"
|
|
2906
2969
|
] });
|
|
2907
2970
|
if (value == null) return "\u2014";
|
|
2908
2971
|
return typeof value === "boolean" ? String(value) : value;
|
|
2909
2972
|
}
|
|
2910
2973
|
function KeyValueList({ rows, columns = 1, className, ...rest }) {
|
|
2911
|
-
return /* @__PURE__ */
|
|
2912
|
-
/* @__PURE__ */
|
|
2913
|
-
/* @__PURE__ */
|
|
2974
|
+
return /* @__PURE__ */ jsx26("dl", { ...rest, className: ["ui-kv", columns === 2 && "ui-kv--two-columns", className].filter(Boolean).join(" "), children: rows.map((row, index) => /* @__PURE__ */ jsxs21("div", { className: "ui-drawer__row", children: [
|
|
2975
|
+
/* @__PURE__ */ jsx26("dt", { children: row.label }),
|
|
2976
|
+
/* @__PURE__ */ jsx26("dd", { children: detail(row) })
|
|
2914
2977
|
] }, index)) });
|
|
2915
2978
|
}
|
|
2916
2979
|
function DrawerSection({ title, headingLevel = 3, className, children, ...rest }) {
|
|
2917
2980
|
const Heading = `h${headingLevel}`;
|
|
2918
|
-
return /* @__PURE__ */
|
|
2919
|
-
title != null && /* @__PURE__ */
|
|
2981
|
+
return /* @__PURE__ */ jsxs21("section", { ...rest, className: ["ui-drawer__section", className].filter(Boolean).join(" "), children: [
|
|
2982
|
+
title != null && /* @__PURE__ */ jsx26(Heading, { className: "ui-drawer__section-title", children: title }),
|
|
2920
2983
|
children
|
|
2921
2984
|
] });
|
|
2922
2985
|
}
|
|
2923
2986
|
|
|
2924
2987
|
// src/Snippet.tsx
|
|
2925
|
-
import { useEffect as useEffect8, useRef as useRef13, useState as
|
|
2926
|
-
import { Fragment as Fragment8, jsx as
|
|
2988
|
+
import { useEffect as useEffect8, useRef as useRef13, useState as useState10 } from "react";
|
|
2989
|
+
import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2927
2990
|
function Snippet({ label = "shell", code = "", children, copy = true, reveal = false, copyLabel = "Copy code" }) {
|
|
2928
|
-
const [status, setStatus] =
|
|
2991
|
+
const [status, setStatus] = useState10("idle");
|
|
2929
2992
|
const request = useRef13(0);
|
|
2930
2993
|
const timer = useRef13(void 0);
|
|
2931
2994
|
useEffect8(() => {
|
|
@@ -2948,11 +3011,11 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
2948
3011
|
if (current === request.current) setStatus("failed");
|
|
2949
3012
|
}
|
|
2950
3013
|
}
|
|
2951
|
-
return /* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
2953
|
-
/* @__PURE__ */
|
|
2954
|
-
copy && /* @__PURE__ */
|
|
2955
|
-
/* @__PURE__ */
|
|
3014
|
+
return /* @__PURE__ */ jsxs22("div", { className: reveal ? "ui-snippet ui-snippet--reveal" : "ui-snippet", children: [
|
|
3015
|
+
/* @__PURE__ */ jsxs22("div", { className: "ui-snippet__bar", children: [
|
|
3016
|
+
/* @__PURE__ */ jsx27("span", { children: label }),
|
|
3017
|
+
copy && /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
3018
|
+
/* @__PURE__ */ jsx27(
|
|
2956
3019
|
"button",
|
|
2957
3020
|
{
|
|
2958
3021
|
type: "button",
|
|
@@ -2960,20 +3023,20 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
2960
3023
|
"aria-label": copyLabel,
|
|
2961
3024
|
title: copyLabel,
|
|
2962
3025
|
onClick: handleCopy,
|
|
2963
|
-
children: /* @__PURE__ */
|
|
3026
|
+
children: /* @__PURE__ */ jsx27(Icon, { name: status === "idle" ? "copy" : "check" })
|
|
2964
3027
|
}
|
|
2965
3028
|
),
|
|
2966
|
-
/* @__PURE__ */
|
|
3029
|
+
/* @__PURE__ */ jsx27("span", { className: "ui-sr ui-snippet__status", role: "status", "aria-live": "polite", children: status === "copied" ? "Copied" : status === "failed" ? "Copy failed" : "" })
|
|
2967
3030
|
] })
|
|
2968
3031
|
] }),
|
|
2969
|
-
/* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ jsx27("pre", { children: children ?? code })
|
|
2970
3033
|
] });
|
|
2971
3034
|
}
|
|
2972
3035
|
|
|
2973
3036
|
// src/Tabs.tsx
|
|
2974
3037
|
import { useEffect as useEffect9, useId as useId9, useRef as useRef14 } from "react";
|
|
2975
3038
|
import { playEntrance } from "@apliteni/apliteni-ui/motion";
|
|
2976
|
-
import { Fragment as Fragment9, jsx as
|
|
3039
|
+
import { Fragment as Fragment9, jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2977
3040
|
function Tabs({ items, value, onChange, label }) {
|
|
2978
3041
|
const id = useId9();
|
|
2979
3042
|
const previous = useRef14(value);
|
|
@@ -2983,8 +3046,8 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
2983
3046
|
if (previous.current !== value) playEntrance(activePanel.current);
|
|
2984
3047
|
previous.current = value;
|
|
2985
3048
|
}, [value]);
|
|
2986
|
-
return /* @__PURE__ */
|
|
2987
|
-
/* @__PURE__ */
|
|
3049
|
+
return /* @__PURE__ */ jsxs23("div", { className: "ui-tabs", children: [
|
|
3050
|
+
/* @__PURE__ */ jsx28("div", { className: "ui-tabs__list", role: "tablist", "aria-label": label, children: items.map((item, i) => /* @__PURE__ */ jsxs23(
|
|
2988
3051
|
"button",
|
|
2989
3052
|
{
|
|
2990
3053
|
type: "button",
|
|
@@ -3022,7 +3085,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3022
3085
|
},
|
|
3023
3086
|
children: [
|
|
3024
3087
|
item.label,
|
|
3025
|
-
item.count != null && /* @__PURE__ */
|
|
3088
|
+
item.count != null && /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
3026
3089
|
" ",
|
|
3027
3090
|
item.count
|
|
3028
3091
|
] })
|
|
@@ -3030,7 +3093,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3030
3093
|
},
|
|
3031
3094
|
item.value
|
|
3032
3095
|
)) }),
|
|
3033
|
-
/* @__PURE__ */
|
|
3096
|
+
/* @__PURE__ */ jsx28("div", { className: "ui-tabs__panels", children: items.map((item, i) => /* @__PURE__ */ jsx28(
|
|
3034
3097
|
"div",
|
|
3035
3098
|
{
|
|
3036
3099
|
className: "ui-tabs__panel",
|
|
@@ -3050,7 +3113,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3050
3113
|
// src/Timeline.tsx
|
|
3051
3114
|
import { useEffect as useEffect10, useRef as useRef15 } from "react";
|
|
3052
3115
|
import { playEntrance as playEntrance2, prefersReducedMotion } from "@apliteni/apliteni-ui/motion";
|
|
3053
|
-
import { jsx as
|
|
3116
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3054
3117
|
var kindIcons = { person: "user", rule: "bolt", reversal: "refresh" };
|
|
3055
3118
|
function Timeline({ events, className, ...rest }) {
|
|
3056
3119
|
const previousIds = useRef15(new Set(events.map((event) => event.id)));
|
|
@@ -3067,7 +3130,7 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3067
3130
|
}
|
|
3068
3131
|
previousIds.current = new Set(events.map((event) => event.id));
|
|
3069
3132
|
}, [events]);
|
|
3070
|
-
return /* @__PURE__ */
|
|
3133
|
+
return /* @__PURE__ */ jsx29("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__ */ jsxs24(
|
|
3071
3134
|
"li",
|
|
3072
3135
|
{
|
|
3073
3136
|
className: "ui-timeline__event",
|
|
@@ -3076,20 +3139,20 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3076
3139
|
else rows.current.delete(event.id);
|
|
3077
3140
|
},
|
|
3078
3141
|
children: [
|
|
3079
|
-
/* @__PURE__ */
|
|
3142
|
+
/* @__PURE__ */ jsx29("span", { "aria-hidden": "true", className: [
|
|
3080
3143
|
"ui-timeline__marker",
|
|
3081
3144
|
event.kind && "ui-timeline__marker--kind",
|
|
3082
3145
|
event.kind === "reversal" && "ui-timeline__marker--reversal"
|
|
3083
|
-
].filter(Boolean).join(" "), children: event.kind && /* @__PURE__ */
|
|
3084
|
-
/* @__PURE__ */
|
|
3085
|
-
/* @__PURE__ */
|
|
3086
|
-
/* @__PURE__ */
|
|
3087
|
-
index === events.length - 1 && event.relativeTimestamp && /* @__PURE__ */
|
|
3146
|
+
].filter(Boolean).join(" "), children: event.kind && /* @__PURE__ */ jsx29(Icon, { name: kindIcons[event.kind] }) }),
|
|
3147
|
+
/* @__PURE__ */ jsxs24("div", { className: "ui-timeline__head", children: [
|
|
3148
|
+
/* @__PURE__ */ jsx29("span", { className: "ui-timeline__actor", children: event.actor }),
|
|
3149
|
+
/* @__PURE__ */ jsx29("time", { dateTime: event.dateTime, children: event.timestamp }),
|
|
3150
|
+
index === events.length - 1 && event.relativeTimestamp && /* @__PURE__ */ jsx29("span", { className: "ui-timeline__relative", children: event.relativeTimestamp })
|
|
3088
3151
|
] }),
|
|
3089
|
-
/* @__PURE__ */
|
|
3090
|
-
(event.meta != null || event.undo) && /* @__PURE__ */
|
|
3091
|
-
event.meta != null && /* @__PURE__ */
|
|
3092
|
-
event.undo && /* @__PURE__ */
|
|
3152
|
+
/* @__PURE__ */ jsx29("p", { className: "ui-timeline__description", children: event.description }),
|
|
3153
|
+
(event.meta != null || event.undo) && /* @__PURE__ */ jsxs24("div", { className: "ui-timeline__meta", children: [
|
|
3154
|
+
event.meta != null && /* @__PURE__ */ jsx29("span", { children: event.meta }),
|
|
3155
|
+
event.undo && /* @__PURE__ */ jsx29(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" })
|
|
3093
3156
|
] })
|
|
3094
3157
|
]
|
|
3095
3158
|
},
|
|
@@ -3098,29 +3161,29 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3098
3161
|
}
|
|
3099
3162
|
|
|
3100
3163
|
// src/Field.tsx
|
|
3101
|
-
import { forwardRef as forwardRef6, useEffect as useEffect11, useId as useId10, useRef as useRef16, useState as
|
|
3102
|
-
import { esc, icon as
|
|
3103
|
-
import { jsx as
|
|
3164
|
+
import { forwardRef as forwardRef6, useEffect as useEffect11, useId as useId10, useRef as useRef16, useState as useState11 } from "react";
|
|
3165
|
+
import { esc, icon as icon5 } from "@apliteni/apliteni-ui";
|
|
3166
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3104
3167
|
function messages(id, hint, error) {
|
|
3105
3168
|
return [error && `${id}-error`, hint && `${id}-hint`].filter(Boolean).join(" ") || void 0;
|
|
3106
3169
|
}
|
|
3107
3170
|
function Frame({ id, labelId, label, hint, error, required, children }) {
|
|
3108
|
-
return /* @__PURE__ */
|
|
3109
|
-
/* @__PURE__ */
|
|
3171
|
+
return /* @__PURE__ */ jsxs25("div", { className: "ui-field", children: [
|
|
3172
|
+
/* @__PURE__ */ jsxs25("label", { className: "ui-field__label", id: labelId, htmlFor: id, children: [
|
|
3110
3173
|
label,
|
|
3111
|
-
required && /* @__PURE__ */
|
|
3174
|
+
required && /* @__PURE__ */ jsx30("span", { className: "ui-field__req", "aria-hidden": "true", children: "*" })
|
|
3112
3175
|
] }),
|
|
3113
3176
|
children,
|
|
3114
|
-
error && /* @__PURE__ */
|
|
3177
|
+
error && /* @__PURE__ */ jsx30(
|
|
3115
3178
|
"div",
|
|
3116
3179
|
{
|
|
3117
3180
|
id: `${id}-error`,
|
|
3118
3181
|
className: "ui-field__error",
|
|
3119
3182
|
role: "alert",
|
|
3120
|
-
dangerouslySetInnerHTML: { __html:
|
|
3183
|
+
dangerouslySetInnerHTML: { __html: icon5("alert") + esc(error) }
|
|
3121
3184
|
}
|
|
3122
3185
|
),
|
|
3123
|
-
hint && /* @__PURE__ */
|
|
3186
|
+
hint && /* @__PURE__ */ jsx30("div", { id: `${id}-hint`, className: "ui-field__hint", children: hint })
|
|
3124
3187
|
] });
|
|
3125
3188
|
}
|
|
3126
3189
|
function wiring(id, hint, error) {
|
|
@@ -3130,13 +3193,13 @@ function Field({ id: suppliedId, label, hint, error, required, children }) {
|
|
|
3130
3193
|
const generatedId = useId10();
|
|
3131
3194
|
const id = suppliedId ?? generatedId;
|
|
3132
3195
|
const labelId = `${id}-label`;
|
|
3133
|
-
return /* @__PURE__ */
|
|
3196
|
+
return /* @__PURE__ */ jsx30(Frame, { ...{ id, labelId, label, hint, error, required }, children: /* @__PURE__ */ jsx30(FieldContext.Provider, { value: { id, labelId }, children: children({ ...wiring(id, hint, error), required }) }) });
|
|
3134
3197
|
}
|
|
3135
3198
|
var TextField = forwardRef6(function TextField2({ label, hint, error, required, type = "text", unit, icon: glyph, className = "", ...props }, ref) {
|
|
3136
3199
|
const id = useId10();
|
|
3137
3200
|
const hasUnit = type === "number" && !!unit;
|
|
3138
3201
|
const describedBy = [messages(id, hint, error), hasUnit ? `${id}-unit` : ""].filter(Boolean).join(" ") || void 0;
|
|
3139
|
-
const control = /* @__PURE__ */
|
|
3202
|
+
const control = /* @__PURE__ */ jsx30(
|
|
3140
3203
|
"input",
|
|
3141
3204
|
{
|
|
3142
3205
|
ref,
|
|
@@ -3149,19 +3212,19 @@ var TextField = forwardRef6(function TextField2({ label, hint, error, required,
|
|
|
3149
3212
|
className: `ui-input${error ? " is-invalid" : ""} ${className}`
|
|
3150
3213
|
}
|
|
3151
3214
|
);
|
|
3152
|
-
const unitSpan = hasUnit ? /* @__PURE__ */
|
|
3153
|
-
return /* @__PURE__ */
|
|
3154
|
-
/* @__PURE__ */
|
|
3215
|
+
const unitSpan = hasUnit ? /* @__PURE__ */ jsx30("span", { id: `${id}-unit`, className: "ui-field-number__unit", children: unit }) : null;
|
|
3216
|
+
return /* @__PURE__ */ jsx30(Frame, { ...{ id, label, hint, error, required }, children: glyph ? /* @__PURE__ */ jsxs25("div", { className: `ui-input-group${hasUnit ? " ui-field-number" : ""}`, children: [
|
|
3217
|
+
/* @__PURE__ */ jsx30("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon5(glyph) } }),
|
|
3155
3218
|
control,
|
|
3156
3219
|
unitSpan
|
|
3157
|
-
] }) : hasUnit ? /* @__PURE__ */
|
|
3220
|
+
] }) : hasUnit ? /* @__PURE__ */ jsxs25("div", { className: "ui-field-number", children: [
|
|
3158
3221
|
control,
|
|
3159
3222
|
unitSpan
|
|
3160
3223
|
] }) : control });
|
|
3161
3224
|
});
|
|
3162
3225
|
function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
3163
3226
|
const id = useId10();
|
|
3164
|
-
return /* @__PURE__ */
|
|
3227
|
+
return /* @__PURE__ */ jsx30(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx30(
|
|
3165
3228
|
"textarea",
|
|
3166
3229
|
{
|
|
3167
3230
|
rows: 4,
|
|
@@ -3174,7 +3237,7 @@ function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
|
3174
3237
|
}
|
|
3175
3238
|
function SelectField({ label, hint, error, required, className = "", children, ...props }) {
|
|
3176
3239
|
const id = useId10();
|
|
3177
|
-
return /* @__PURE__ */
|
|
3240
|
+
return /* @__PURE__ */ jsx30(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx30(
|
|
3178
3241
|
"select",
|
|
3179
3242
|
{
|
|
3180
3243
|
...props,
|
|
@@ -3188,8 +3251,8 @@ function SelectField({ label, hint, error, required, className = "", children, .
|
|
|
3188
3251
|
function FileField({ label, hint, error, required, disabled, onFileChange, className = "", ...props }) {
|
|
3189
3252
|
const id = useId10();
|
|
3190
3253
|
const input = useRef16(null);
|
|
3191
|
-
const [file, setFile] =
|
|
3192
|
-
const [dragging, setDragging] =
|
|
3254
|
+
const [file, setFile] = useState11(null);
|
|
3255
|
+
const [dragging, setDragging] = useState11(false);
|
|
3193
3256
|
useEffect11(() => {
|
|
3194
3257
|
const form = input.current?.form;
|
|
3195
3258
|
const reset = () => {
|
|
@@ -3203,7 +3266,7 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3203
3266
|
setFile(next);
|
|
3204
3267
|
onFileChange?.(next);
|
|
3205
3268
|
};
|
|
3206
|
-
return /* @__PURE__ */
|
|
3269
|
+
return /* @__PURE__ */ jsx30(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsxs25(
|
|
3207
3270
|
"div",
|
|
3208
3271
|
{
|
|
3209
3272
|
className: `ui-file${dragging && !disabled ? " is-dragging" : ""}${file ? " has-file" : ""}${error ? " is-invalid" : ""}${disabled ? " is-disabled" : ""}`,
|
|
@@ -3224,12 +3287,12 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3224
3287
|
update(transfer.files[0]);
|
|
3225
3288
|
},
|
|
3226
3289
|
children: [
|
|
3227
|
-
/* @__PURE__ */
|
|
3228
|
-
/* @__PURE__ */
|
|
3229
|
-
/* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3231
|
-
/* @__PURE__ */
|
|
3232
|
-
/* @__PURE__ */
|
|
3290
|
+
/* @__PURE__ */ jsx30("span", { className: "ui-file__glyph", children: /* @__PURE__ */ jsx30(Icon, { name: "upload" }) }),
|
|
3291
|
+
/* @__PURE__ */ jsx30("div", { "aria-live": "polite", children: file ? file.name : "Drop a file here" }),
|
|
3292
|
+
/* @__PURE__ */ jsx30("div", { children: "or choose one from your device" }),
|
|
3293
|
+
/* @__PURE__ */ jsxs25("span", { className: "ui-file__choose", children: [
|
|
3294
|
+
/* @__PURE__ */ jsx30("span", { className: "ui-btn ui-btn--secondary ui-btn--sm", "aria-hidden": "true", "aria-disabled": disabled || void 0, children: file ? "Replace file" : "Choose file" }),
|
|
3295
|
+
/* @__PURE__ */ jsx30(
|
|
3233
3296
|
"input",
|
|
3234
3297
|
{
|
|
3235
3298
|
...props,
|
|
@@ -3249,8 +3312,8 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3249
3312
|
}
|
|
3250
3313
|
|
|
3251
3314
|
// src/FileDrop.tsx
|
|
3252
|
-
import { useRef as useRef17, useState as
|
|
3253
|
-
import { Fragment as Fragment10, jsx as
|
|
3315
|
+
import { useRef as useRef17, useState as useState12 } from "react";
|
|
3316
|
+
import { Fragment as Fragment10, jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3254
3317
|
var MARKS = {
|
|
3255
3318
|
uploading: "clock",
|
|
3256
3319
|
done: "circleCheck",
|
|
@@ -3284,7 +3347,7 @@ function FileDrop({
|
|
|
3284
3347
|
className
|
|
3285
3348
|
}) {
|
|
3286
3349
|
const input = useRef17(null);
|
|
3287
|
-
const [over, setOver] =
|
|
3350
|
+
const [over, setOver] = useState12(false);
|
|
3288
3351
|
const status = file?.status ?? "uploading";
|
|
3289
3352
|
const word = status === "error" ? file?.error ?? WORDS.error : file?.state ?? WORDS[status];
|
|
3290
3353
|
const [stem, ext] = splitName(file?.name ?? "");
|
|
@@ -3295,7 +3358,7 @@ function FileDrop({
|
|
|
3295
3358
|
const take = (chosen) => {
|
|
3296
3359
|
if (chosen && !disabled) onFile?.(chosen);
|
|
3297
3360
|
};
|
|
3298
|
-
return /* @__PURE__ */
|
|
3361
|
+
return /* @__PURE__ */ jsxs26(
|
|
3299
3362
|
"div",
|
|
3300
3363
|
{
|
|
3301
3364
|
className: cx7("ui-drop", disabled && "is-disabled", className),
|
|
@@ -3315,16 +3378,16 @@ function FileDrop({
|
|
|
3315
3378
|
},
|
|
3316
3379
|
children: [
|
|
3317
3380
|
children,
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
file ? /* @__PURE__ */
|
|
3320
|
-
/* @__PURE__ */
|
|
3321
|
-
/* @__PURE__ */
|
|
3322
|
-
/* @__PURE__ */
|
|
3323
|
-
/* @__PURE__ */
|
|
3381
|
+
/* @__PURE__ */ jsxs26("div", { className: "ui-drop__row", children: [
|
|
3382
|
+
file ? /* @__PURE__ */ jsxs26("div", { className: cx7("ui-drop__file", status === "error" && "ui-drop__file--failed"), children: [
|
|
3383
|
+
/* @__PURE__ */ jsxs26("div", { className: "ui-drop__line", children: [
|
|
3384
|
+
/* @__PURE__ */ jsxs26("span", { className: "ui-drop__name", title: file.name, children: [
|
|
3385
|
+
/* @__PURE__ */ jsx31("span", { className: "ui-drop__stem", children: stem }),
|
|
3386
|
+
/* @__PURE__ */ jsx31("span", { className: "ui-drop__ext", children: ext })
|
|
3324
3387
|
] }),
|
|
3325
|
-
(onRemove || status === "error" && onRetry) && /* @__PURE__ */
|
|
3326
|
-
status === "error" && onRetry && /* @__PURE__ */
|
|
3327
|
-
onRemove && /* @__PURE__ */
|
|
3388
|
+
(onRemove || status === "error" && onRetry) && /* @__PURE__ */ jsxs26("span", { className: "ui-drop__actions", children: [
|
|
3389
|
+
status === "error" && onRetry && /* @__PURE__ */ jsx31(Button, { size: "sm", icon: "refresh", onClick: onRetry, disabled, children: retryLabel }),
|
|
3390
|
+
onRemove && /* @__PURE__ */ jsx31(
|
|
3328
3391
|
Button,
|
|
3329
3392
|
{
|
|
3330
3393
|
variant: "ghost",
|
|
@@ -3336,21 +3399,21 @@ function FileDrop({
|
|
|
3336
3399
|
)
|
|
3337
3400
|
] })
|
|
3338
3401
|
] }),
|
|
3339
|
-
(showSize || showWord) && /* @__PURE__ */
|
|
3402
|
+
(showSize || showWord) && /* @__PURE__ */ jsxs26(
|
|
3340
3403
|
"div",
|
|
3341
3404
|
{
|
|
3342
3405
|
className: cx7("ui-drop__facts", status === "error" && "ui-drop__error"),
|
|
3343
3406
|
role: status === "error" ? "alert" : void 0,
|
|
3344
3407
|
children: [
|
|
3345
|
-
showSize && /* @__PURE__ */
|
|
3346
|
-
showWord && /* @__PURE__ */
|
|
3347
|
-
/* @__PURE__ */
|
|
3348
|
-
/* @__PURE__ */
|
|
3408
|
+
showSize && /* @__PURE__ */ jsx31("span", { className: "ui-drop__size", children: file.size }),
|
|
3409
|
+
showWord && /* @__PURE__ */ jsxs26("span", { className: "ui-drop__state", children: [
|
|
3410
|
+
/* @__PURE__ */ jsx31(Icon, { name: MARKS[status] }),
|
|
3411
|
+
/* @__PURE__ */ jsx31("span", { className: "ui-drop__word", title: word, children: word })
|
|
3349
3412
|
] })
|
|
3350
3413
|
]
|
|
3351
3414
|
}
|
|
3352
3415
|
),
|
|
3353
|
-
hasBar && /* @__PURE__ */
|
|
3416
|
+
hasBar && /* @__PURE__ */ jsx31(
|
|
3354
3417
|
"span",
|
|
3355
3418
|
{
|
|
3356
3419
|
className: "ui-drop__bar",
|
|
@@ -3359,11 +3422,11 @@ function FileDrop({
|
|
|
3359
3422
|
"aria-valuenow": file.progress,
|
|
3360
3423
|
"aria-valuemin": 0,
|
|
3361
3424
|
"aria-valuemax": 100,
|
|
3362
|
-
children: /* @__PURE__ */
|
|
3425
|
+
children: /* @__PURE__ */ jsx31("span", { style: { width: `${file.progress}%` } })
|
|
3363
3426
|
}
|
|
3364
3427
|
)
|
|
3365
|
-
] }) : /* @__PURE__ */
|
|
3366
|
-
/* @__PURE__ */
|
|
3428
|
+
] }) : /* @__PURE__ */ jsxs26(Fragment10, { children: [
|
|
3429
|
+
/* @__PURE__ */ jsx31(
|
|
3367
3430
|
Button,
|
|
3368
3431
|
{
|
|
3369
3432
|
size: "sm",
|
|
@@ -3373,9 +3436,9 @@ function FileDrop({
|
|
|
3373
3436
|
children: label
|
|
3374
3437
|
}
|
|
3375
3438
|
),
|
|
3376
|
-
note && /* @__PURE__ */
|
|
3439
|
+
note && /* @__PURE__ */ jsx31("p", { className: "ui-drop__note", children: note })
|
|
3377
3440
|
] }),
|
|
3378
|
-
/* @__PURE__ */
|
|
3441
|
+
/* @__PURE__ */ jsx31(
|
|
3379
3442
|
"input",
|
|
3380
3443
|
{
|
|
3381
3444
|
ref: input,
|
|
@@ -3391,7 +3454,7 @@ function FileDrop({
|
|
|
3391
3454
|
}
|
|
3392
3455
|
)
|
|
3393
3456
|
] }),
|
|
3394
|
-
showTarget && /* @__PURE__ */
|
|
3457
|
+
showTarget && /* @__PURE__ */ jsx31("div", { className: "ui-drop__target", "aria-hidden": "true", children: dropLabel })
|
|
3395
3458
|
]
|
|
3396
3459
|
}
|
|
3397
3460
|
);
|
|
@@ -3399,12 +3462,12 @@ function FileDrop({
|
|
|
3399
3462
|
|
|
3400
3463
|
// src/SearchField.tsx
|
|
3401
3464
|
import { forwardRef as forwardRef7 } from "react";
|
|
3402
|
-
import { icon as
|
|
3403
|
-
import { jsx as
|
|
3465
|
+
import { icon as icon6 } from "@apliteni/apliteni-ui";
|
|
3466
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3404
3467
|
var SearchField = forwardRef7(function SearchField2({ ariaLabel, className, ...props }, ref) {
|
|
3405
|
-
return /* @__PURE__ */
|
|
3406
|
-
/* @__PURE__ */
|
|
3407
|
-
/* @__PURE__ */
|
|
3468
|
+
return /* @__PURE__ */ jsxs27("div", { className: "ui-input-group", children: [
|
|
3469
|
+
/* @__PURE__ */ jsx32("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon6("search") } }),
|
|
3470
|
+
/* @__PURE__ */ jsx32(
|
|
3408
3471
|
"input",
|
|
3409
3472
|
{
|
|
3410
3473
|
ref,
|
|
@@ -3418,9 +3481,9 @@ var SearchField = forwardRef7(function SearchField2({ ariaLabel, className, ...p
|
|
|
3418
3481
|
});
|
|
3419
3482
|
|
|
3420
3483
|
// src/Toast.tsx
|
|
3421
|
-
import { createContext as createContext3, useCallback as
|
|
3484
|
+
import { createContext as createContext3, useCallback as useCallback6, useContext as useContext3, useEffect as useEffect12, useLayoutEffect as useLayoutEffect4, useRef as useRef18, useState as useState13 } from "react";
|
|
3422
3485
|
import { createPortal as createPortal4 } from "react-dom";
|
|
3423
|
-
import { jsx as
|
|
3486
|
+
import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3424
3487
|
var Context = createContext3(null);
|
|
3425
3488
|
var glyphs = { success: "circleCheck", danger: "circleX", warn: "circleAlert", info: "info", neutral: "bolt" };
|
|
3426
3489
|
function useToast() {
|
|
@@ -3430,16 +3493,16 @@ function useToast() {
|
|
|
3430
3493
|
}
|
|
3431
3494
|
function Notice({ notice, remove }) {
|
|
3432
3495
|
const root = useRef18(null);
|
|
3433
|
-
const [leaving2, setLeaving] =
|
|
3496
|
+
const [leaving2, setLeaving] = useState13(false);
|
|
3434
3497
|
const dismissed = useRef18(false);
|
|
3435
|
-
const [hovered, setHovered] =
|
|
3436
|
-
const [focused, setFocused] =
|
|
3498
|
+
const [hovered, setHovered] = useState13(false);
|
|
3499
|
+
const [focused, setFocused] = useState13(false);
|
|
3437
3500
|
const paused = hovered || focused;
|
|
3438
3501
|
const tone = notice.tone ?? "success";
|
|
3439
3502
|
const timed = !notice.action && notice.timer !== false && notice.timer !== 0;
|
|
3440
3503
|
const duration = typeof notice.timer === "number" ? notice.timer * 1e3 : 5e3;
|
|
3441
3504
|
const remaining = useRef18(duration);
|
|
3442
|
-
const dismiss =
|
|
3505
|
+
const dismiss = useCallback6(() => {
|
|
3443
3506
|
if (dismissed.current) return;
|
|
3444
3507
|
dismissed.current = true;
|
|
3445
3508
|
if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches) remove();
|
|
@@ -3468,7 +3531,7 @@ function Notice({ notice, remove }) {
|
|
|
3468
3531
|
remaining.current = Math.max(0, remaining.current - (Date.now() - started));
|
|
3469
3532
|
};
|
|
3470
3533
|
}, [dismiss, leaving2, paused, timed]);
|
|
3471
|
-
return /* @__PURE__ */
|
|
3534
|
+
return /* @__PURE__ */ jsxs28(
|
|
3472
3535
|
"div",
|
|
3473
3536
|
{
|
|
3474
3537
|
ref: root,
|
|
@@ -3482,12 +3545,12 @@ function Notice({ notice, remove }) {
|
|
|
3482
3545
|
if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false);
|
|
3483
3546
|
},
|
|
3484
3547
|
children: [
|
|
3485
|
-
/* @__PURE__ */
|
|
3486
|
-
/* @__PURE__ */
|
|
3487
|
-
/* @__PURE__ */
|
|
3488
|
-
!notice.compact && notice.text && /* @__PURE__ */
|
|
3548
|
+
/* @__PURE__ */ jsx33("span", { className: "ui-toast__icon", children: /* @__PURE__ */ jsx33(Icon, { name: glyphs[tone] }) }),
|
|
3549
|
+
/* @__PURE__ */ jsxs28("div", { className: "ui-toast__body", children: [
|
|
3550
|
+
/* @__PURE__ */ jsx33("div", { className: "ui-toast__title", children: notice.title }),
|
|
3551
|
+
!notice.compact && notice.text && /* @__PURE__ */ jsx33("div", { className: "ui-toast__text", children: notice.text })
|
|
3489
3552
|
] }),
|
|
3490
|
-
notice.action && /* @__PURE__ */
|
|
3553
|
+
notice.action && /* @__PURE__ */ jsx33(
|
|
3491
3554
|
"button",
|
|
3492
3555
|
{
|
|
3493
3556
|
type: "button",
|
|
@@ -3502,8 +3565,8 @@ function Notice({ notice, remove }) {
|
|
|
3502
3565
|
children: notice.action.label
|
|
3503
3566
|
}
|
|
3504
3567
|
),
|
|
3505
|
-
notice.dismissible !== false && /* @__PURE__ */
|
|
3506
|
-
timed && /* @__PURE__ */
|
|
3568
|
+
notice.dismissible !== false && /* @__PURE__ */ jsx33("button", { type: "button", className: "ui-toast__close", "aria-label": "Dismiss", disabled: leaving2, onClick: dismiss, children: /* @__PURE__ */ jsx33(Icon, { name: "x" }) }),
|
|
3569
|
+
timed && /* @__PURE__ */ jsx33(
|
|
3507
3570
|
"span",
|
|
3508
3571
|
{
|
|
3509
3572
|
className: "ui-toast__timer is-running",
|
|
@@ -3536,40 +3599,40 @@ function usePublishedReach(stack2, count) {
|
|
|
3536
3599
|
}, [stack2, count]);
|
|
3537
3600
|
}
|
|
3538
3601
|
function Toast({ children }) {
|
|
3539
|
-
const [entries, setEntries] =
|
|
3602
|
+
const [entries, setEntries] = useState13([]);
|
|
3540
3603
|
const nextId = useRef18(0);
|
|
3541
3604
|
const stack2 = useRef18(null);
|
|
3542
|
-
const push =
|
|
3605
|
+
const push = useCallback6((notice) => {
|
|
3543
3606
|
const id = nextId.current++;
|
|
3544
3607
|
const remove = () => setEntries((current) => current.filter((entry) => entry.id !== id));
|
|
3545
3608
|
setEntries((current) => [...current, { id, notice, remove }]);
|
|
3546
3609
|
}, []);
|
|
3547
3610
|
usePublishedReach(stack2, entries.length);
|
|
3548
|
-
return /* @__PURE__ */
|
|
3611
|
+
return /* @__PURE__ */ jsxs28(Context.Provider, { value: push, children: [
|
|
3549
3612
|
children,
|
|
3550
3613
|
typeof document !== "undefined" && createPortal4(
|
|
3551
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ jsx33("div", { className: "ui-toast-stack rx-toast-stack", ref: stack2, children: entries.map((entry) => /* @__PURE__ */ jsx33(Notice, { notice: entry.notice, remove: entry.remove }, entry.id)) }),
|
|
3552
3615
|
document.body
|
|
3553
3616
|
)
|
|
3554
3617
|
] });
|
|
3555
3618
|
}
|
|
3556
3619
|
|
|
3557
3620
|
// src/AppShell.tsx
|
|
3558
|
-
import { useEffect as useEffect14, useId as useId12, useRef as useRef19, useState as
|
|
3621
|
+
import { useEffect as useEffect14, useId as useId12, useRef as useRef19, useState as useState15 } from "react";
|
|
3559
3622
|
import { paletteHotkey, prism, railCollapsed } from "@apliteni/apliteni-ui";
|
|
3560
3623
|
|
|
3561
3624
|
// src/SidebarNav.tsx
|
|
3562
|
-
import { forwardRef as forwardRef8, useEffect as useEffect13, useId as useId11, useState as
|
|
3625
|
+
import { forwardRef as forwardRef8, useEffect as useEffect13, useId as useId11, useState as useState14 } from "react";
|
|
3563
3626
|
import { ENTRANCE_FALLBACK_MS } from "@apliteni/apliteni-ui/motion";
|
|
3564
|
-
import { Fragment as Fragment11, jsx as
|
|
3627
|
+
import { Fragment as Fragment11, jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3565
3628
|
var badgeText = (badge) => typeof badge === "object" ? badge.text : badge;
|
|
3566
3629
|
function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
3567
3630
|
const uid = useId11();
|
|
3568
3631
|
const group = !sub && !!item.items?.length;
|
|
3569
3632
|
const childActive = group && item.items.some((child) => child.id === active);
|
|
3570
|
-
const [expanded, setExpanded] =
|
|
3633
|
+
const [expanded, setExpanded] = useState14();
|
|
3571
3634
|
const open = expanded ?? item.defaultOpen ?? childActive;
|
|
3572
|
-
const [entering, setEntering] =
|
|
3635
|
+
const [entering, setEntering] = useState14(false);
|
|
3573
3636
|
useEffect13(() => {
|
|
3574
3637
|
if (!entering) return;
|
|
3575
3638
|
const timer = setTimeout(() => setEntering(false), ENTRANCE_FALLBACK_MS);
|
|
@@ -3587,15 +3650,15 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
3587
3650
|
item.disabled && "is-disabled",
|
|
3588
3651
|
item.danger && "is-danger"
|
|
3589
3652
|
].filter(Boolean).join(" ");
|
|
3590
|
-
const children = /* @__PURE__ */
|
|
3591
|
-
(item.leading ?? item.icon) && /* @__PURE__ */
|
|
3592
|
-
/* @__PURE__ */
|
|
3593
|
-
count != null && count !== "" && /* @__PURE__ */
|
|
3594
|
-
group && /* @__PURE__ */
|
|
3653
|
+
const children = /* @__PURE__ */ jsxs29(Fragment11, { children: [
|
|
3654
|
+
(item.leading ?? item.icon) && /* @__PURE__ */ jsx34("span", { className: "ui-nav__ic", children: item.leading ?? /* @__PURE__ */ jsx34(Icon, { name: item.icon }) }),
|
|
3655
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-nav__label", children: item.label }),
|
|
3656
|
+
count != null && count !== "" && /* @__PURE__ */ jsx34("span", { className: `ui-nav__badge is-${typeof item.badge === "object" ? item.badge.tone ?? "neutral" : "neutral"}`, children: count }),
|
|
3657
|
+
group && /* @__PURE__ */ jsx34("span", { className: "ui-nav__caret", "aria-hidden": "true" })
|
|
3595
3658
|
] });
|
|
3596
3659
|
const common = { className, "aria-label": name, title: collapsed ? name : void 0, children };
|
|
3597
|
-
if (group) return /* @__PURE__ */
|
|
3598
|
-
/* @__PURE__ */
|
|
3660
|
+
if (group) return /* @__PURE__ */ jsxs29("li", { className: `ui-nav__group${open ? " is-open" : ""}`, children: [
|
|
3661
|
+
/* @__PURE__ */ jsx34(
|
|
3599
3662
|
"button",
|
|
3600
3663
|
{
|
|
3601
3664
|
...common,
|
|
@@ -3609,22 +3672,22 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
3609
3672
|
}
|
|
3610
3673
|
}
|
|
3611
3674
|
),
|
|
3612
|
-
/* @__PURE__ */
|
|
3675
|
+
/* @__PURE__ */ jsx34("ul", { id: uid, className: `ui-nav__sub${entering ? " is-entering" : ""}`, hidden: !open, onAnimationEnd: () => setEntering(false), children: item.items.map((child) => /* @__PURE__ */ jsx34(Row, { item: child, active, activeIs, collapsed, renderLink, sub: true }, child.id)) })
|
|
3613
3676
|
] });
|
|
3614
|
-
if (item.disabled) return /* @__PURE__ */
|
|
3677
|
+
if (item.disabled) return /* @__PURE__ */ jsx34("li", { children: /* @__PURE__ */ jsx34("span", { ...common, role: "link", "aria-disabled": "true" }) });
|
|
3615
3678
|
const props = {
|
|
3616
3679
|
...common,
|
|
3617
3680
|
href: item.href ?? `#${item.id}`,
|
|
3618
3681
|
target: item.target,
|
|
3619
3682
|
"aria-current": isActive ? activeIs === "section" ? "true" : "page" : void 0
|
|
3620
3683
|
};
|
|
3621
|
-
return /* @__PURE__ */
|
|
3684
|
+
return /* @__PURE__ */ jsx34("li", { children: renderLink ? renderLink(item, props) : /* @__PURE__ */ jsx34("a", { ...props }) });
|
|
3622
3685
|
}
|
|
3623
3686
|
function Section({ section, ...props }) {
|
|
3624
3687
|
const uid = useId11();
|
|
3625
|
-
return /* @__PURE__ */
|
|
3626
|
-
section.label && /* @__PURE__ */
|
|
3627
|
-
/* @__PURE__ */
|
|
3688
|
+
return /* @__PURE__ */ jsxs29("div", { className: "ui-nav__section", children: [
|
|
3689
|
+
section.label && /* @__PURE__ */ jsx34("div", { className: "ui-nav__cap", id: uid, "aria-hidden": props.collapsed || void 0, children: section.label }),
|
|
3690
|
+
/* @__PURE__ */ jsx34("ul", { className: "ui-nav__list", "aria-labelledby": section.label ? uid : void 0, children: section.items.map((item) => /* @__PURE__ */ jsx34(Row, { item, ...props }, item.id)) })
|
|
3628
3691
|
] });
|
|
3629
3692
|
}
|
|
3630
3693
|
var SidebarNav = forwardRef8(function SidebarNav2({
|
|
@@ -3639,8 +3702,8 @@ var SidebarNav = forwardRef8(function SidebarNav2({
|
|
|
3639
3702
|
"aria-label": label = "Sidebar",
|
|
3640
3703
|
...rest
|
|
3641
3704
|
}, ref) {
|
|
3642
|
-
return /* @__PURE__ */
|
|
3643
|
-
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */
|
|
3705
|
+
return /* @__PURE__ */ jsxs29("nav", { ...rest, ref, "aria-label": label, className: ["ui-nav", "ui-nav--side", collapsed && "is-collapsed", className].filter(Boolean).join(" "), children: [
|
|
3706
|
+
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */ jsx34(
|
|
3644
3707
|
Section,
|
|
3645
3708
|
{
|
|
3646
3709
|
section,
|
|
@@ -3651,14 +3714,14 @@ var SidebarNav = forwardRef8(function SidebarNav2({
|
|
|
3651
3714
|
},
|
|
3652
3715
|
index
|
|
3653
3716
|
)),
|
|
3654
|
-
footer && /* @__PURE__ */
|
|
3717
|
+
footer && /* @__PURE__ */ jsx34("div", { className: "ui-nav__foot", children: footer })
|
|
3655
3718
|
] });
|
|
3656
3719
|
});
|
|
3657
3720
|
|
|
3658
3721
|
// src/ThemeToggle.tsx
|
|
3659
3722
|
import { useSyncExternalStore } from "react";
|
|
3660
3723
|
import { themeIcon } from "@apliteni/apliteni-ui";
|
|
3661
|
-
import { jsx as
|
|
3724
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3662
3725
|
var STORAGE_KEY = "apliteni-strategy-theme";
|
|
3663
3726
|
var CHOICE_EVENT = "apliteni-theme-choice";
|
|
3664
3727
|
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')})()`;
|
|
@@ -3716,10 +3779,10 @@ function ThemeToggle({ labelled = false }) {
|
|
|
3716
3779
|
}
|
|
3717
3780
|
window.dispatchEvent(new Event(CHOICE_EVENT));
|
|
3718
3781
|
};
|
|
3719
|
-
const button = /* @__PURE__ */
|
|
3720
|
-
return labelled ? /* @__PURE__ */
|
|
3782
|
+
const button = /* @__PURE__ */ jsx35("button", { type: "button", className: "toggle", "aria-label": name, title: name, onClick: toggle, children: /* @__PURE__ */ jsx35("span", { className: "ic", "aria-hidden": "true", dangerouslySetInnerHTML: { __html: themeIcon(theme) } }) });
|
|
3783
|
+
return labelled ? /* @__PURE__ */ jsxs30("span", { className: "ui-theme-toggle", children: [
|
|
3721
3784
|
button,
|
|
3722
|
-
/* @__PURE__ */
|
|
3785
|
+
/* @__PURE__ */ jsxs30("span", { children: [
|
|
3723
3786
|
label,
|
|
3724
3787
|
" theme"
|
|
3725
3788
|
] })
|
|
@@ -3727,7 +3790,7 @@ function ThemeToggle({ labelled = false }) {
|
|
|
3727
3790
|
}
|
|
3728
3791
|
|
|
3729
3792
|
// src/AppShell.tsx
|
|
3730
|
-
import { Fragment as Fragment12, jsx as
|
|
3793
|
+
import { Fragment as Fragment12, jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3731
3794
|
var path = (value) => value.split(/[?#]/)[0].replace(/\/+$/, "") || "/";
|
|
3732
3795
|
function AppShell({
|
|
3733
3796
|
sections,
|
|
@@ -3751,9 +3814,9 @@ function AppShell({
|
|
|
3751
3814
|
renderLink
|
|
3752
3815
|
}) {
|
|
3753
3816
|
const uid = useId12();
|
|
3754
|
-
const [collapsed, setCollapsed] =
|
|
3755
|
-
const [search, setSearch] =
|
|
3756
|
-
const [menu, setMenu] =
|
|
3817
|
+
const [collapsed, setCollapsed] = useState15(defaultCollapsed);
|
|
3818
|
+
const [search, setSearch] = useState15(false);
|
|
3819
|
+
const [menu, setMenu] = useState15(false);
|
|
3757
3820
|
const menuButton = useRef19(null);
|
|
3758
3821
|
const current = path(pathname);
|
|
3759
3822
|
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];
|
|
@@ -3792,7 +3855,7 @@ function AppShell({
|
|
|
3792
3855
|
} catch {
|
|
3793
3856
|
}
|
|
3794
3857
|
};
|
|
3795
|
-
const sidebar = (label) => /* @__PURE__ */
|
|
3858
|
+
const sidebar = (label) => /* @__PURE__ */ jsx36(
|
|
3796
3859
|
SidebarNav,
|
|
3797
3860
|
{
|
|
3798
3861
|
"aria-label": label,
|
|
@@ -3804,34 +3867,33 @@ function AppShell({
|
|
|
3804
3867
|
const linkProps = { ...props, onClick: (event) => {
|
|
3805
3868
|
if (!event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) setMenu(false);
|
|
3806
3869
|
} };
|
|
3807
|
-
return renderLink ? renderLink(section, linkProps) : /* @__PURE__ */
|
|
3870
|
+
return renderLink ? renderLink(section, linkProps) : /* @__PURE__ */ jsx36("a", { ...linkProps });
|
|
3808
3871
|
}
|
|
3809
3872
|
}
|
|
3810
3873
|
);
|
|
3811
3874
|
const foldLabel = collapsed ? "Expand sidebar" : "Collapse sidebar";
|
|
3812
3875
|
const navigable = sections.length > 1 || Boolean(back);
|
|
3813
|
-
const
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
/* @__PURE__ */ jsx35("span", { children: word })
|
|
3876
|
+
const lockup = /* @__PURE__ */ jsxs31("a", { className: "ui-app__brand", href: brandHref, "aria-label": word, children: [
|
|
3877
|
+
brand ?? /* @__PURE__ */ jsx36("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(uid, 24) } }),
|
|
3878
|
+
/* @__PURE__ */ jsx36("span", { children: word })
|
|
3817
3879
|
] });
|
|
3818
|
-
return /* @__PURE__ */
|
|
3819
|
-
navigable && /* @__PURE__ */
|
|
3820
|
-
/* @__PURE__ */
|
|
3880
|
+
return /* @__PURE__ */ jsxs31("div", { className: `ui-app ui-app--topbar ui-react-app${collapsed ? " is-collapsed" : ""}`, children: [
|
|
3881
|
+
navigable && /* @__PURE__ */ jsxs31("div", { className: "ui-app__rail", role: "region", "aria-label": "Sidebar", children: [
|
|
3882
|
+
/* @__PURE__ */ jsx36("div", { className: "ui-app__head", children: lockup }),
|
|
3821
3883
|
sidebar("Sections"),
|
|
3822
|
-
/* @__PURE__ */
|
|
3823
|
-
/* @__PURE__ */
|
|
3824
|
-
/* @__PURE__ */
|
|
3825
|
-
/* @__PURE__ */
|
|
3826
|
-
/* @__PURE__ */
|
|
3884
|
+
/* @__PURE__ */ jsx36("div", { className: "ui-app__foot", children: /* @__PURE__ */ jsx36("div", { className: "ui-app__fold-row", children: /* @__PURE__ */ jsxs31("button", { type: "button", className: "ui-nav__item ui-app__fold", "aria-expanded": !collapsed, "aria-label": foldLabel, onClick: fold, children: [
|
|
3885
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-nav__ic", children: /* @__PURE__ */ jsxs31("svg", { className: "ui-icon", viewBox: "0 0 24 24", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
3886
|
+
/* @__PURE__ */ jsx36("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
3887
|
+
/* @__PURE__ */ jsx36("path", { className: "ui-app__fold-seam", d: "M9 3v18" }),
|
|
3888
|
+
/* @__PURE__ */ jsx36("path", { className: "ui-app__fold-arrow", d: "m16 15-3-3 3-3" })
|
|
3827
3889
|
] }) }),
|
|
3828
|
-
/* @__PURE__ */
|
|
3890
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-nav__label", children: foldLabel })
|
|
3829
3891
|
] }) }) })
|
|
3830
3892
|
] }),
|
|
3831
|
-
/* @__PURE__ */
|
|
3832
|
-
/* @__PURE__ */
|
|
3833
|
-
navigable && /* @__PURE__ */
|
|
3834
|
-
/* @__PURE__ */
|
|
3893
|
+
/* @__PURE__ */ jsxs31("div", { className: "ui-app__well", children: [
|
|
3894
|
+
/* @__PURE__ */ jsxs31("header", { className: "ui-app__bar", children: [
|
|
3895
|
+
navigable && /* @__PURE__ */ jsxs31(Fragment12, { children: [
|
|
3896
|
+
/* @__PURE__ */ jsx36(
|
|
3835
3897
|
Button,
|
|
3836
3898
|
{
|
|
3837
3899
|
ref: menuButton,
|
|
@@ -3845,19 +3907,19 @@ function AppShell({
|
|
|
3845
3907
|
onClick: () => setMenu(true)
|
|
3846
3908
|
}
|
|
3847
3909
|
),
|
|
3848
|
-
/* @__PURE__ */
|
|
3910
|
+
/* @__PURE__ */ jsx36("a", { className: "ui-app__brand ui-app__brand--band", href: brandHref, "aria-label": word, children: brand ?? /* @__PURE__ */ jsx36("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(`${uid}-band`, 24) } }) })
|
|
3849
3911
|
] }),
|
|
3850
3912
|
!navigable && lockup,
|
|
3851
|
-
/* @__PURE__ */
|
|
3852
|
-
/* @__PURE__ */
|
|
3853
|
-
/* @__PURE__ */
|
|
3854
|
-
/* @__PURE__ */
|
|
3855
|
-
/* @__PURE__ */
|
|
3913
|
+
/* @__PURE__ */ jsxs31("button", { type: "button", className: "ui-app__search", "aria-haspopup": "dialog", onClick: () => setSearch(true), children: [
|
|
3914
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-app__search-ic", children: /* @__PURE__ */ jsx36(Icon, { name: "search" }) }),
|
|
3915
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-app__search-txt", children: searchLabel }),
|
|
3916
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-app__search-short", "aria-hidden": "true", children: searchShortLabel }),
|
|
3917
|
+
/* @__PURE__ */ jsx36("kbd", { className: "ui-cmdk__key", children: paletteHotkey() })
|
|
3856
3918
|
] }),
|
|
3857
|
-
/* @__PURE__ */
|
|
3858
|
-
bandControl && /* @__PURE__ */
|
|
3859
|
-
/* @__PURE__ */
|
|
3860
|
-
/* @__PURE__ */
|
|
3919
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-app__bar-gap" }),
|
|
3920
|
+
bandControl && /* @__PURE__ */ jsx36("span", { className: "ui-react-app__band-control", children: bandControl }),
|
|
3921
|
+
/* @__PURE__ */ jsx36(ThemeToggle, {}),
|
|
3922
|
+
/* @__PURE__ */ jsx36("div", { className: "ui-app__user ui-app__user--bar", children: /* @__PURE__ */ jsx36(
|
|
3861
3923
|
Dropdown,
|
|
3862
3924
|
{
|
|
3863
3925
|
variant: "menu",
|
|
@@ -3866,57 +3928,57 @@ function AppShell({
|
|
|
3866
3928
|
ariaLabel: `Signed in as ${account.name}, ${account.email}`,
|
|
3867
3929
|
triggerClass: "ui-app__user-trigger",
|
|
3868
3930
|
panelClass: "ui-app__user-panel",
|
|
3869
|
-
triggerContent: /* @__PURE__ */
|
|
3870
|
-
header: /* @__PURE__ */
|
|
3871
|
-
/* @__PURE__ */
|
|
3872
|
-
/* @__PURE__ */
|
|
3931
|
+
triggerContent: /* @__PURE__ */ jsx36("span", { className: "ui-app__av", "aria-hidden": "true", children: /* @__PURE__ */ jsx36(Avatar, { personKey: account.email || account.name, name: account.name, size: 32 }) }),
|
|
3932
|
+
header: /* @__PURE__ */ jsxs31("div", { className: "ui-dropdown__head", children: [
|
|
3933
|
+
/* @__PURE__ */ jsx36("b", { children: account.name }),
|
|
3934
|
+
/* @__PURE__ */ jsx36("span", { children: account.email })
|
|
3873
3935
|
] }),
|
|
3874
3936
|
items: [{ label: "Sign out", icon: "logout", danger: true }],
|
|
3875
3937
|
onSelect: onSignOut
|
|
3876
3938
|
}
|
|
3877
3939
|
) })
|
|
3878
3940
|
] }),
|
|
3879
|
-
/* @__PURE__ */
|
|
3880
|
-
back && /* @__PURE__ */
|
|
3881
|
-
/* @__PURE__ */
|
|
3882
|
-
lede && /* @__PURE__ */
|
|
3883
|
-
actions && /* @__PURE__ */
|
|
3884
|
-
/* @__PURE__ */
|
|
3941
|
+
/* @__PURE__ */ jsxs31("main", { className: `ui-app__main${width === "wide" ? " ui-app__main--wide" : ""}`, children: [
|
|
3942
|
+
back && /* @__PURE__ */ jsx36(BackLink, { ...back }),
|
|
3943
|
+
/* @__PURE__ */ jsx36("h1", { children: title }),
|
|
3944
|
+
lede && /* @__PURE__ */ jsx36("p", { className: "ui-app__sub", children: lede }),
|
|
3945
|
+
actions && /* @__PURE__ */ jsx36("div", { className: "ui-react-app__actions", children: actions }),
|
|
3946
|
+
/* @__PURE__ */ jsx36("div", { className: "ui-app__body", children })
|
|
3885
3947
|
] })
|
|
3886
3948
|
] }),
|
|
3887
|
-
navigable && /* @__PURE__ */
|
|
3888
|
-
/* @__PURE__ */
|
|
3949
|
+
navigable && /* @__PURE__ */ jsx36(Drawer, { open: menu, onClose: () => setMenu(false), title: word, side: "left", size: "sm", children: /* @__PURE__ */ jsx36("div", { className: "ui-react-app__menu", children: sidebar("Menu sections") }) }),
|
|
3950
|
+
/* @__PURE__ */ jsx36(CommandPalette, { ...palette ?? { groups: [{ items: sections.map((section) => ({ id: section.href, ...section })) }] }, open: search, onClose: () => setSearch(false) })
|
|
3889
3951
|
] });
|
|
3890
3952
|
}
|
|
3891
3953
|
|
|
3892
3954
|
// src/EmptyState.tsx
|
|
3893
3955
|
import { icon as kitIcon2, illo } from "@apliteni/apliteni-ui";
|
|
3894
|
-
import { jsx as
|
|
3956
|
+
import { jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3895
3957
|
var cases = {
|
|
3896
3958
|
"first-run": { title: "Nothing needs you yet", sub: "New items will appear here when they need your attention.", icon: "check" },
|
|
3897
3959
|
"no-matches": { title: "No results in this view", sub: "Try another search or clear your filters.", icon: "search" },
|
|
3898
3960
|
"not-found": { title: "We can't find that page", sub: "Check the address or return to the home page.", icon: "folder" },
|
|
3899
3961
|
"not-yet-built": { title: "This ships later", sub: "This screen is not available yet. Check back later.", icon: "clock" }
|
|
3900
3962
|
};
|
|
3901
|
-
function EmptyState({ variant = "first-run", title, sub, icon:
|
|
3963
|
+
function EmptyState({ variant = "first-run", title, sub, icon: icon8, art, actions }) {
|
|
3902
3964
|
const preset = cases[variant];
|
|
3903
3965
|
const heading = title ?? preset.title;
|
|
3904
3966
|
const guidance = sub ?? preset.sub;
|
|
3905
|
-
const glyph =
|
|
3906
|
-
return /* @__PURE__ */
|
|
3907
|
-
art ? typeof art === "string" ? /* @__PURE__ */
|
|
3908
|
-
heading && /* @__PURE__ */
|
|
3909
|
-
guidance && /* @__PURE__ */
|
|
3910
|
-
actions && /* @__PURE__ */
|
|
3967
|
+
const glyph = icon8 ?? preset.icon;
|
|
3968
|
+
return /* @__PURE__ */ jsxs32("div", { className: "ui-empty", children: [
|
|
3969
|
+
art ? typeof art === "string" ? /* @__PURE__ */ jsx37("div", { className: "ui-empty__art", dangerouslySetInnerHTML: { __html: /<svg/.test(art) ? art : illo(art) } }) : /* @__PURE__ */ jsx37("div", { className: "ui-empty__art", "aria-hidden": "true", children: art }) : glyph ? /* @__PURE__ */ jsx37("div", { className: "ui-empty__icon", dangerouslySetInnerHTML: { __html: kitIcon2(glyph) } }) : null,
|
|
3970
|
+
heading && /* @__PURE__ */ jsx37("div", { className: "ui-empty__title", children: heading }),
|
|
3971
|
+
guidance && /* @__PURE__ */ jsx37("div", { className: "ui-empty__sub", children: guidance }),
|
|
3972
|
+
actions && /* @__PURE__ */ jsx37("div", { className: "ui-empty__actions", children: actions })
|
|
3911
3973
|
] });
|
|
3912
3974
|
}
|
|
3913
3975
|
|
|
3914
3976
|
// src/Success.tsx
|
|
3915
|
-
import { forwardRef as forwardRef9, useEffect as useEffect15, useRef as useRef20, useState as
|
|
3916
|
-
import { jsx as
|
|
3977
|
+
import { forwardRef as forwardRef9, useEffect as useEffect15, useRef as useRef20, useState as useState16 } from "react";
|
|
3978
|
+
import { jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3917
3979
|
var SuccessCheck = forwardRef9(function SuccessCheck2({ variant = "line", className, ...rest }, ref) {
|
|
3918
3980
|
const circled = variant === "circled";
|
|
3919
|
-
return /* @__PURE__ */
|
|
3981
|
+
return /* @__PURE__ */ jsxs33(
|
|
3920
3982
|
"svg",
|
|
3921
3983
|
{
|
|
3922
3984
|
...rest,
|
|
@@ -3928,18 +3990,18 @@ var SuccessCheck = forwardRef9(function SuccessCheck2({ variant = "line", classN
|
|
|
3928
3990
|
"aria-hidden": "true",
|
|
3929
3991
|
focusable: "false",
|
|
3930
3992
|
children: [
|
|
3931
|
-
circled && /* @__PURE__ */
|
|
3932
|
-
/* @__PURE__ */
|
|
3993
|
+
circled && /* @__PURE__ */ jsx38("path", { className: "ui-sx__circle", d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
3994
|
+
/* @__PURE__ */ jsx38("path", { className: "ui-sx__tick", d: circled ? "M22 4L12 14.01l-3-3" : "M20 6L9 17l-5-5" })
|
|
3933
3995
|
]
|
|
3934
3996
|
}
|
|
3935
3997
|
);
|
|
3936
3998
|
});
|
|
3937
3999
|
var SuccessPanel = forwardRef9(function SuccessPanel2({ title = "Done", sub, check = "line", className, ...rest }, ref) {
|
|
3938
4000
|
const circled = check === "circled";
|
|
3939
|
-
return /* @__PURE__ */
|
|
3940
|
-
/* @__PURE__ */
|
|
3941
|
-
/* @__PURE__ */
|
|
3942
|
-
sub && /* @__PURE__ */
|
|
4001
|
+
return /* @__PURE__ */ jsxs33("div", { ...rest, ref, className: ["ui-success", className].filter(Boolean).join(" "), children: [
|
|
4002
|
+
/* @__PURE__ */ jsx38("div", { className: ["ui-success__check", circled && "ui-success__check--circled"].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx38(SuccessCheck, { variant: circled ? "circled" : "line" }) }),
|
|
4003
|
+
/* @__PURE__ */ jsx38("div", { className: "ui-success__title", children: title }),
|
|
4004
|
+
sub && /* @__PURE__ */ jsx38("div", { className: "ui-success__sub", children: sub })
|
|
3943
4005
|
] });
|
|
3944
4006
|
});
|
|
3945
4007
|
var pieces = [
|
|
@@ -3959,7 +4021,7 @@ var pieces = [
|
|
|
3959
4021
|
[80, 0.36, -20, "c", 1.05]
|
|
3960
4022
|
];
|
|
3961
4023
|
function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
3962
|
-
const [remaining, setRemaining] =
|
|
4024
|
+
const [remaining, setRemaining] = useState16(seconds);
|
|
3963
4025
|
const callback = useRef20(onDone);
|
|
3964
4026
|
useEffect15(() => {
|
|
3965
4027
|
callback.current = onDone;
|
|
@@ -3976,12 +4038,12 @@ function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
|
3976
4038
|
}, 1e3);
|
|
3977
4039
|
return () => clearInterval(timer);
|
|
3978
4040
|
}, [seconds]);
|
|
3979
|
-
return /* @__PURE__ */
|
|
3980
|
-
/* @__PURE__ */
|
|
3981
|
-
/* @__PURE__ */
|
|
4041
|
+
return /* @__PURE__ */ jsxs33("div", { className: "ui-sx__count", "data-sx-count": "", style: { "--sx-secs": `${seconds}s` }, children: [
|
|
4042
|
+
/* @__PURE__ */ jsx38("span", { className: "ui-sx__count-ring", "aria-hidden": "true" }),
|
|
4043
|
+
/* @__PURE__ */ jsxs33("span", { className: "ui-sx__count-text", children: [
|
|
3982
4044
|
label,
|
|
3983
4045
|
" in ",
|
|
3984
|
-
/* @__PURE__ */
|
|
4046
|
+
/* @__PURE__ */ jsx38("b", { "data-sx-num": "", children: remaining }),
|
|
3985
4047
|
"s"
|
|
3986
4048
|
] })
|
|
3987
4049
|
] });
|
|
@@ -4008,7 +4070,7 @@ var Success = forwardRef9(function Success2({
|
|
|
4008
4070
|
const seconds = countdown?.seconds;
|
|
4009
4071
|
const duration = seconds != null && Number.isFinite(seconds) && seconds >= 1 ? Math.floor(seconds) : 5;
|
|
4010
4072
|
const mark = check === "circled" ? "circled" : "line";
|
|
4011
|
-
return /* @__PURE__ */
|
|
4073
|
+
return /* @__PURE__ */ jsxs33(
|
|
4012
4074
|
"div",
|
|
4013
4075
|
{
|
|
4014
4076
|
role: "status",
|
|
@@ -4017,16 +4079,16 @@ var Success = forwardRef9(function Success2({
|
|
|
4017
4079
|
ref,
|
|
4018
4080
|
className: ["ui-sx", `ui-sx--${layout}`, `ui-sx--check-${mark}`, confetti && "ui-sx--confetti", className].filter(Boolean).join(" "),
|
|
4019
4081
|
children: [
|
|
4020
|
-
confetti && /* @__PURE__ */
|
|
4021
|
-
([x, d, r, t, s], index) => /* @__PURE__ */
|
|
4082
|
+
confetti && /* @__PURE__ */ jsx38("div", { className: "ui-sx__confetti", "aria-hidden": "true", children: pieces.map(
|
|
4083
|
+
([x, d, r, t, s], index) => /* @__PURE__ */ jsx38("i", { className: `ui-sx__piece ui-sx__piece--${t}`, style: { left: `${x}%`, "--sx-d": `${d}s`, "--sx-r": `${r}deg`, "--sx-s": s } }, index)
|
|
4022
4084
|
) }),
|
|
4023
|
-
/* @__PURE__ */
|
|
4024
|
-
/* @__PURE__ */
|
|
4025
|
-
/* @__PURE__ */
|
|
4026
|
-
/* @__PURE__ */
|
|
4027
|
-
body && /* @__PURE__ */
|
|
4028
|
-
hasActions && /* @__PURE__ */
|
|
4029
|
-
countdown && /* @__PURE__ */
|
|
4085
|
+
/* @__PURE__ */ jsxs33("div", { className: "ui-sx__inner", children: [
|
|
4086
|
+
/* @__PURE__ */ jsx38("div", { className: "ui-sx__visual", children: /* @__PURE__ */ jsx38(SuccessCheck, { variant: mark }) }),
|
|
4087
|
+
/* @__PURE__ */ jsxs33("div", { className: "ui-sx__content", children: [
|
|
4088
|
+
/* @__PURE__ */ jsx38(Heading, { className: "ui-sx__title", children: title }),
|
|
4089
|
+
body && /* @__PURE__ */ jsx38("p", { className: "ui-sx__body", children: body }),
|
|
4090
|
+
hasActions && /* @__PURE__ */ jsx38("div", { className: "ui-sx__actions", children: actions }),
|
|
4091
|
+
countdown && /* @__PURE__ */ jsx38(Countdown, { seconds: duration, label: countdown.label, onDone: onCountdownEnd }, duration)
|
|
4030
4092
|
] })
|
|
4031
4093
|
] })
|
|
4032
4094
|
]
|
|
@@ -4036,16 +4098,16 @@ var Success = forwardRef9(function Success2({
|
|
|
4036
4098
|
|
|
4037
4099
|
// src/Chart.tsx
|
|
4038
4100
|
import {
|
|
4039
|
-
useCallback as
|
|
4101
|
+
useCallback as useCallback7,
|
|
4040
4102
|
useEffect as useEffect16,
|
|
4041
4103
|
useId as useId13,
|
|
4042
4104
|
useLayoutEffect as useLayoutEffect5,
|
|
4043
4105
|
useMemo as useMemo4,
|
|
4044
4106
|
useRef as useRef21,
|
|
4045
|
-
useState as
|
|
4107
|
+
useState as useState17
|
|
4046
4108
|
} from "react";
|
|
4047
4109
|
import { CHART_FLOOR, bridgeWalk, chartScale, pointTarget } from "@apliteni/apliteni-ui";
|
|
4048
|
-
import { Fragment as Fragment13, jsx as
|
|
4110
|
+
import { Fragment as Fragment13, jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4049
4111
|
var HEIGHT = { months: 216, bridge: 216, spark: 32 };
|
|
4050
4112
|
var PAD = 2;
|
|
4051
4113
|
var ZERO_INSET = 1.5;
|
|
@@ -4083,7 +4145,7 @@ function barPath(m) {
|
|
|
4083
4145
|
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";
|
|
4084
4146
|
}
|
|
4085
4147
|
function useTapFloor() {
|
|
4086
|
-
const [floor, setFloor] =
|
|
4148
|
+
const [floor, setFloor] = useState17(TARGET);
|
|
4087
4149
|
useEffect16(() => {
|
|
4088
4150
|
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX2}px) and (pointer: coarse)`);
|
|
4089
4151
|
if (!query) return;
|
|
@@ -4218,11 +4280,11 @@ function Chart(props) {
|
|
|
4218
4280
|
const opening = useRef21(false);
|
|
4219
4281
|
const pointerFocus = useRef21(false);
|
|
4220
4282
|
const floor = useTapFloor();
|
|
4221
|
-
const [width, setWidth] =
|
|
4222
|
-
const [openId, setOpenId] =
|
|
4223
|
-
const [rawCursor, setCursor] =
|
|
4224
|
-
const [said, setSaid] =
|
|
4225
|
-
const [ownPick, setOwnPick] =
|
|
4283
|
+
const [width, setWidth] = useState17(0);
|
|
4284
|
+
const [openId, setOpenId] = useState17(null);
|
|
4285
|
+
const [rawCursor, setCursor] = useState17(0);
|
|
4286
|
+
const [said, setSaid] = useState17("");
|
|
4287
|
+
const [ownPick, setOwnPick] = useState17(null);
|
|
4226
4288
|
const pick = selected === void 0 ? ownPick : selected;
|
|
4227
4289
|
const steps = props.variant === "bridge" ? props.steps : void 0;
|
|
4228
4290
|
const bridgeTones = props.variant === "bridge" ? props.tones : void 0;
|
|
@@ -4237,7 +4299,7 @@ function Chart(props) {
|
|
|
4237
4299
|
const boxHeight = Math.max(plotHeight, floor);
|
|
4238
4300
|
const boxTop = -(boxHeight - plotHeight) / 2;
|
|
4239
4301
|
const span = scale.max - scale.min || 1;
|
|
4240
|
-
const y =
|
|
4302
|
+
const y = useCallback7(
|
|
4241
4303
|
(value) => PAD + (scale.max - value) / span * (plotHeight - PAD * 2),
|
|
4242
4304
|
[scale.max, span, plotHeight]
|
|
4243
4305
|
);
|
|
@@ -4250,7 +4312,7 @@ function Chart(props) {
|
|
|
4250
4312
|
cap * lanes + LANE_GAP * (lanes - 1)
|
|
4251
4313
|
));
|
|
4252
4314
|
const barWidth = (groupWidth - LANE_GAP * (lanes - 1)) / lanes;
|
|
4253
|
-
const centre =
|
|
4315
|
+
const centre = useCallback7((column) => column * colWidth + colWidth / 2, [colWidth]);
|
|
4254
4316
|
const marks = useMemo4(() => {
|
|
4255
4317
|
const out = frame.bars.map((bar) => {
|
|
4256
4318
|
let top = Math.min(y(bar.from), y(bar.to));
|
|
@@ -4324,7 +4386,7 @@ function Chart(props) {
|
|
|
4324
4386
|
return [...out, ...dots];
|
|
4325
4387
|
}, [frame, lines, keys, columns, centre, barWidth, groupWidth, y, floor, colWidth, plotWidth, boxTop, boxHeight]);
|
|
4326
4388
|
const byId = useMemo4(() => new Map(marks.map((m) => [m.id, m])), [marks]);
|
|
4327
|
-
const lead =
|
|
4389
|
+
const lead = useCallback7((column) => marks.find((m) => m.column === column), [marks]);
|
|
4328
4390
|
const open = openId ? byId.get(openId) : void 0;
|
|
4329
4391
|
useEffect16(() => {
|
|
4330
4392
|
const el = plot.current;
|
|
@@ -4336,7 +4398,7 @@ function Chart(props) {
|
|
|
4336
4398
|
observer.observe(el);
|
|
4337
4399
|
return () => observer.disconnect();
|
|
4338
4400
|
}, []);
|
|
4339
|
-
const syncEdges =
|
|
4401
|
+
const syncEdges = useCallback7(() => {
|
|
4340
4402
|
const el = scroller.current;
|
|
4341
4403
|
if (!el) return;
|
|
4342
4404
|
const last = el.scrollWidth - el.clientWidth;
|
|
@@ -4377,7 +4439,7 @@ function Chart(props) {
|
|
|
4377
4439
|
setOpenId(id);
|
|
4378
4440
|
};
|
|
4379
4441
|
const markAt = (target) => target.closest?.("[data-mark]")?.getAttribute("data-mark") ?? null;
|
|
4380
|
-
const announce =
|
|
4442
|
+
const announce = useCallback7((column, picked = pick) => {
|
|
4381
4443
|
const where = columns[column];
|
|
4382
4444
|
if (!where) return;
|
|
4383
4445
|
const values = marks.filter((m) => m.column === column).map((m) => `${m.name} ${format(m.value)}`).join(". ") || "No value";
|
|
@@ -4421,7 +4483,7 @@ function Chart(props) {
|
|
|
4421
4483
|
const estimated = columns.filter((c) => c.estimated);
|
|
4422
4484
|
const estimatedTone = marks.find((m) => m.estimated && m.kind === "bar")?.tone ?? keys[0]?.tone ?? "neutral";
|
|
4423
4485
|
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) };
|
|
4424
|
-
return /* @__PURE__ */
|
|
4486
|
+
return /* @__PURE__ */ jsxs34(
|
|
4425
4487
|
"div",
|
|
4426
4488
|
{
|
|
4427
4489
|
className: cx8("ui-chart", `ui-chart--${variant}`, selectable && "ui-chart--pick", className),
|
|
@@ -4432,9 +4494,9 @@ function Chart(props) {
|
|
|
4432
4494
|
"--ui-chart-pad": `${PAD}px`
|
|
4433
4495
|
},
|
|
4434
4496
|
children: [
|
|
4435
|
-
!spark && keys.length > 0 && /* @__PURE__ */
|
|
4436
|
-
keys.map((key) => /* @__PURE__ */
|
|
4437
|
-
key.shape === "line" ? /* @__PURE__ */
|
|
4497
|
+
!spark && keys.length > 0 && /* @__PURE__ */ jsxs34("ul", { className: "ui-chart__legend", children: [
|
|
4498
|
+
keys.map((key) => /* @__PURE__ */ jsxs34("li", { className: cx8("ui-chart__key", `ui-chart__tone--${key.tone}`), children: [
|
|
4499
|
+
key.shape === "line" ? /* @__PURE__ */ jsx39("svg", { className: "ui-chart__key-mark", width: "18", height: "12", viewBox: "0 0 18 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx39("path", { className: "ui-chart__key-line", d: "M1 9 L6 5 L12 7 L17 3" }) }) : /* @__PURE__ */ jsx39("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx39(
|
|
4438
4500
|
"rect",
|
|
4439
4501
|
{
|
|
4440
4502
|
className: "ui-chart__key-swatch",
|
|
@@ -4447,12 +4509,12 @@ function Chart(props) {
|
|
|
4447
4509
|
) }),
|
|
4448
4510
|
key.name
|
|
4449
4511
|
] }, key.id)),
|
|
4450
|
-
estimated.length > 0 && /* @__PURE__ */
|
|
4451
|
-
/* @__PURE__ */
|
|
4512
|
+
estimated.length > 0 && /* @__PURE__ */ jsxs34("li", { className: cx8("ui-chart__key", `ui-chart__tone--${estimatedTone}`), children: [
|
|
4513
|
+
/* @__PURE__ */ jsx39("svg", { className: "ui-chart__key-mark", width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": "true", children: /* @__PURE__ */ jsx39("rect", { className: "ui-chart__key-estimated", x: "1.5", y: "1.5", width: "9", height: "9", rx: "1" }) }),
|
|
4452
4514
|
"Estimated"
|
|
4453
4515
|
] })
|
|
4454
4516
|
] }),
|
|
4455
|
-
/* @__PURE__ */
|
|
4517
|
+
/* @__PURE__ */ jsxs34(
|
|
4456
4518
|
"div",
|
|
4457
4519
|
{
|
|
4458
4520
|
ref: frameEl,
|
|
@@ -4476,8 +4538,8 @@ function Chart(props) {
|
|
|
4476
4538
|
setSaid("");
|
|
4477
4539
|
},
|
|
4478
4540
|
children: [
|
|
4479
|
-
!spark && scale.ticks.length > 0 && /* @__PURE__ */
|
|
4480
|
-
/* @__PURE__ */
|
|
4541
|
+
!spark && scale.ticks.length > 0 && /* @__PURE__ */ jsx39("div", { className: "ui-chart__axis", "aria-hidden": "true", children: [...scale.ticks].reverse().map((tick) => /* @__PURE__ */ jsx39("span", { className: "ui-chart__tick", children: formatAxis(tick) }, tick)) }),
|
|
4542
|
+
/* @__PURE__ */ jsx39("div", { ref: scroller, className: "ui-chart__scroll", tabIndex: -1, onScroll: () => {
|
|
4481
4543
|
syncEdges();
|
|
4482
4544
|
const anchor = [...svgEl.current?.querySelectorAll("[data-anchor]") ?? []].find((el) => el.getAttribute("data-anchor") === openId);
|
|
4483
4545
|
if (!anchor || !scroller.current || !frameEl.current || !tipEl.current) return;
|
|
@@ -4485,8 +4547,8 @@ function Chart(props) {
|
|
|
4485
4547
|
const view = scroller.current.getBoundingClientRect();
|
|
4486
4548
|
if (mark.right <= view.left || mark.left >= view.right) setOpenId(null);
|
|
4487
4549
|
else placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
|
|
4488
|
-
}, children: /* @__PURE__ */
|
|
4489
|
-
/* @__PURE__ */
|
|
4550
|
+
}, children: /* @__PURE__ */ jsxs34("div", { ref: plot, className: "ui-chart__plot", children: [
|
|
4551
|
+
/* @__PURE__ */ jsxs34(
|
|
4490
4552
|
"svg",
|
|
4491
4553
|
{
|
|
4492
4554
|
ref: svgEl,
|
|
@@ -4546,7 +4608,7 @@ function Chart(props) {
|
|
|
4546
4608
|
announce(mark.column, selectable ? mark.column : pick);
|
|
4547
4609
|
},
|
|
4548
4610
|
children: [
|
|
4549
|
-
!spark && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */
|
|
4611
|
+
!spark && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */ jsx39(
|
|
4550
4612
|
"rect",
|
|
4551
4613
|
{
|
|
4552
4614
|
className: "ui-chart__band",
|
|
@@ -4559,7 +4621,7 @@ function Chart(props) {
|
|
|
4559
4621
|
frame.links && frame.bars.slice(0, -1).map((bar, i) => {
|
|
4560
4622
|
const from = byId.get(bar.id);
|
|
4561
4623
|
const to = byId.get(frame.bars[i + 1].id);
|
|
4562
|
-
return from && to ? /* @__PURE__ */
|
|
4624
|
+
return from && to ? /* @__PURE__ */ jsx39(
|
|
4563
4625
|
"line",
|
|
4564
4626
|
{
|
|
4565
4627
|
className: "ui-chart__carry",
|
|
@@ -4571,7 +4633,7 @@ function Chart(props) {
|
|
|
4571
4633
|
`carry-${bar.id}`
|
|
4572
4634
|
) : null;
|
|
4573
4635
|
}),
|
|
4574
|
-
!spark && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */
|
|
4636
|
+
!spark && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */ jsx39(
|
|
4575
4637
|
"line",
|
|
4576
4638
|
{
|
|
4577
4639
|
className: "ui-chart__grid",
|
|
@@ -4582,7 +4644,7 @@ function Chart(props) {
|
|
|
4582
4644
|
},
|
|
4583
4645
|
`grid-${tick}`
|
|
4584
4646
|
)),
|
|
4585
|
-
!spark && scale.ticks.includes(0) && /* @__PURE__ */
|
|
4647
|
+
!spark && scale.ticks.includes(0) && /* @__PURE__ */ jsx39(
|
|
4586
4648
|
"line",
|
|
4587
4649
|
{
|
|
4588
4650
|
className: "ui-chart__zero",
|
|
@@ -4592,7 +4654,7 @@ function Chart(props) {
|
|
|
4592
4654
|
y2: px(y(0))
|
|
4593
4655
|
}
|
|
4594
4656
|
),
|
|
4595
|
-
marks.filter((m) => m.kind === "bar").map((mark) => /* @__PURE__ */
|
|
4657
|
+
marks.filter((m) => m.kind === "bar").map((mark) => /* @__PURE__ */ jsx39(
|
|
4596
4658
|
"path",
|
|
4597
4659
|
{
|
|
4598
4660
|
className: cx8(
|
|
@@ -4605,7 +4667,7 @@ function Chart(props) {
|
|
|
4605
4667
|
`bar-${mark.id}`
|
|
4606
4668
|
)),
|
|
4607
4669
|
["casing", "stroke"].map((layer) => lines.flatMap(
|
|
4608
|
-
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */
|
|
4670
|
+
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */ jsx39(
|
|
4609
4671
|
"line",
|
|
4610
4672
|
{
|
|
4611
4673
|
className: layer === "casing" ? "ui-chart__line-casing" : cx8(
|
|
@@ -4621,7 +4683,7 @@ function Chart(props) {
|
|
|
4621
4683
|
`${line.id}-${layer}-${i}`
|
|
4622
4684
|
) : null)
|
|
4623
4685
|
)),
|
|
4624
|
-
lines.flatMap((line) => line.values.map((value, i) => Number.isFinite(value) && !Number.isFinite(line.values[i - 1]) && !Number.isFinite(line.values[i + 1]) ? /* @__PURE__ */
|
|
4686
|
+
lines.flatMap((line) => line.values.map((value, i) => Number.isFinite(value) && !Number.isFinite(line.values[i - 1]) && !Number.isFinite(line.values[i + 1]) ? /* @__PURE__ */ jsx39(
|
|
4625
4687
|
"circle",
|
|
4626
4688
|
{
|
|
4627
4689
|
className: cx8("ui-chart__isolated", `ui-chart__tone--${line.tone}`),
|
|
@@ -4631,8 +4693,8 @@ function Chart(props) {
|
|
|
4631
4693
|
},
|
|
4632
4694
|
`isolated-${line.id}-${i}`
|
|
4633
4695
|
) : null)),
|
|
4634
|
-
marks.map((mark) => /* @__PURE__ */
|
|
4635
|
-
mark.kind === "bar" ? /* @__PURE__ */
|
|
4696
|
+
marks.map((mark) => /* @__PURE__ */ jsxs34("g", { "data-mark": mark.id, children: [
|
|
4697
|
+
mark.kind === "bar" ? /* @__PURE__ */ jsx39(
|
|
4636
4698
|
"rect",
|
|
4637
4699
|
{
|
|
4638
4700
|
className: "ui-chart__hit",
|
|
@@ -4641,7 +4703,7 @@ function Chart(props) {
|
|
|
4641
4703
|
y: px(hitBand(mark.band).y),
|
|
4642
4704
|
height: px(hitBand(mark.band).h)
|
|
4643
4705
|
}
|
|
4644
|
-
) : /* @__PURE__ */
|
|
4706
|
+
) : /* @__PURE__ */ jsx39(
|
|
4645
4707
|
"rect",
|
|
4646
4708
|
{
|
|
4647
4709
|
className: "ui-chart__hit",
|
|
@@ -4651,7 +4713,7 @@ function Chart(props) {
|
|
|
4651
4713
|
height: px(mark.hit?.h ?? TARGET)
|
|
4652
4714
|
}
|
|
4653
4715
|
),
|
|
4654
|
-
/* @__PURE__ */
|
|
4716
|
+
/* @__PURE__ */ jsx39(
|
|
4655
4717
|
"rect",
|
|
4656
4718
|
{
|
|
4657
4719
|
"data-anchor": mark.id,
|
|
@@ -4666,7 +4728,7 @@ function Chart(props) {
|
|
|
4666
4728
|
]
|
|
4667
4729
|
}
|
|
4668
4730
|
),
|
|
4669
|
-
!spark && /* @__PURE__ */
|
|
4731
|
+
!spark && /* @__PURE__ */ jsx39("div", { className: "ui-chart__periods", "aria-hidden": "true", children: columns.map((column, i) => /* @__PURE__ */ jsx39(
|
|
4670
4732
|
"span",
|
|
4671
4733
|
{
|
|
4672
4734
|
className: cx8("ui-chart__period", pick === i && "is-selected"),
|
|
@@ -4675,35 +4737,35 @@ function Chart(props) {
|
|
|
4675
4737
|
`${column.label}-${i}`
|
|
4676
4738
|
)) })
|
|
4677
4739
|
] }) }),
|
|
4678
|
-
/* @__PURE__ */
|
|
4679
|
-
/* @__PURE__ */
|
|
4680
|
-
/* @__PURE__ */
|
|
4681
|
-
(stateOf(columns[open.column]) || open.detail) && /* @__PURE__ */
|
|
4740
|
+
/* @__PURE__ */ jsx39("span", { ref: tipEl, className: cx8("ui-tip", openId && "is-open"), role: open ? "tooltip" : void 0, children: open && /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
4741
|
+
/* @__PURE__ */ jsx39("span", { className: "ui-tip__label", children: spark ? columns[open.column]?.label : `${open.name}, ${columns[open.column]?.label}` }),
|
|
4742
|
+
/* @__PURE__ */ jsx39("span", { className: "ui-tip__value", children: format(open.value) }),
|
|
4743
|
+
(stateOf(columns[open.column]) || open.detail) && /* @__PURE__ */ jsx39("span", { className: "ui-tip__detail", children: stateOf(columns[open.column]) || open.detail })
|
|
4682
4744
|
] }) })
|
|
4683
4745
|
]
|
|
4684
4746
|
}
|
|
4685
4747
|
),
|
|
4686
|
-
/* @__PURE__ */
|
|
4687
|
-
showTable && /* @__PURE__ */
|
|
4688
|
-
/* @__PURE__ */
|
|
4689
|
-
/* @__PURE__ */
|
|
4748
|
+
/* @__PURE__ */ jsx39("div", { className: "ui-sr", role: "status", children: said }),
|
|
4749
|
+
showTable && /* @__PURE__ */ jsxs34("details", { className: "ui-chart__data", children: [
|
|
4750
|
+
/* @__PURE__ */ jsx39("summary", { className: "ui-focusable", children: "Values as a table" }),
|
|
4751
|
+
/* @__PURE__ */ jsx39(
|
|
4690
4752
|
"div",
|
|
4691
4753
|
{
|
|
4692
4754
|
className: "ui-table-scroll",
|
|
4693
4755
|
role: "region",
|
|
4694
4756
|
tabIndex: 0,
|
|
4695
4757
|
"aria-label": `${title}, as a table. Scroll for more columns.`,
|
|
4696
|
-
children: /* @__PURE__ */
|
|
4697
|
-
/* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4699
|
-
/* @__PURE__ */
|
|
4758
|
+
children: /* @__PURE__ */ jsxs34("table", { className: "ui-table", "aria-label": title, children: [
|
|
4759
|
+
/* @__PURE__ */ jsx39("thead", { children: /* @__PURE__ */ jsx39("tr", { children: tableHead.map((head, i) => /* @__PURE__ */ jsx39("th", { scope: "col", className: cx8(i > 0 && "ui-table__num"), children: head }, head)) }) }),
|
|
4760
|
+
/* @__PURE__ */ jsx39("tbody", { children: tableRows.map((row, i) => /* @__PURE__ */ jsxs34("tr", { "aria-current": pick === i ? true : void 0, children: [
|
|
4761
|
+
/* @__PURE__ */ jsxs34("th", { scope: "row", children: [
|
|
4700
4762
|
row.column.label,
|
|
4701
|
-
row.column.estimated && /* @__PURE__ */
|
|
4763
|
+
row.column.estimated && /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
4702
4764
|
" ",
|
|
4703
|
-
/* @__PURE__ */
|
|
4765
|
+
/* @__PURE__ */ jsx39("span", { className: "ui-chart__state", children: stateOf(row.column) })
|
|
4704
4766
|
] })
|
|
4705
4767
|
] }),
|
|
4706
|
-
row.cells.map((cell, j) => /* @__PURE__ */
|
|
4768
|
+
row.cells.map((cell, j) => /* @__PURE__ */ jsx39("td", { className: "ui-table__num", children: cell }, tableHead[j + 1]))
|
|
4707
4769
|
] }, `${row.column.label}-${i}`)) })
|
|
4708
4770
|
] })
|
|
4709
4771
|
}
|
|
@@ -4717,7 +4779,7 @@ function Chart(props) {
|
|
|
4717
4779
|
// src/AccentPicker.tsx
|
|
4718
4780
|
import { forwardRef as forwardRef10 } from "react";
|
|
4719
4781
|
import { ACCENTS, accentSwatchStyle } from "@apliteni/apliteni-ui";
|
|
4720
|
-
import { jsx as
|
|
4782
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
4721
4783
|
var AccentPicker = forwardRef10(function AccentPicker2({
|
|
4722
4784
|
value,
|
|
4723
4785
|
onChange,
|
|
@@ -4726,7 +4788,7 @@ var AccentPicker = forwardRef10(function AccentPicker2({
|
|
|
4726
4788
|
"aria-label": label = "Accent",
|
|
4727
4789
|
...rest
|
|
4728
4790
|
}, ref) {
|
|
4729
|
-
return /* @__PURE__ */
|
|
4791
|
+
return /* @__PURE__ */ jsx40(
|
|
4730
4792
|
"div",
|
|
4731
4793
|
{
|
|
4732
4794
|
...rest,
|
|
@@ -4737,7 +4799,7 @@ var AccentPicker = forwardRef10(function AccentPicker2({
|
|
|
4737
4799
|
"aria-label": label,
|
|
4738
4800
|
children: options.map((accent) => {
|
|
4739
4801
|
const title = accent.charAt(0).toUpperCase() + accent.slice(1);
|
|
4740
|
-
return /* @__PURE__ */
|
|
4802
|
+
return /* @__PURE__ */ jsx40(
|
|
4741
4803
|
"button",
|
|
4742
4804
|
{
|
|
4743
4805
|
type: "button",
|
|
@@ -4758,7 +4820,7 @@ var AccentPicker = forwardRef10(function AccentPicker2({
|
|
|
4758
4820
|
// src/NavTabs.tsx
|
|
4759
4821
|
import { Fragment as Fragment14, forwardRef as forwardRef11, useEffect as useEffect17, useRef as useRef22, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
4760
4822
|
import { safeUrl, observeNavFit, revealCurrentNav, revealFocusedNav } from "@apliteni/apliteni-ui";
|
|
4761
|
-
import { Fragment as Fragment15, jsx as
|
|
4823
|
+
import { Fragment as Fragment15, jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4762
4824
|
var NavTabs = forwardRef11(function NavTabs2({
|
|
4763
4825
|
items,
|
|
4764
4826
|
active,
|
|
@@ -4776,7 +4838,7 @@ var NavTabs = forwardRef11(function NavTabs2({
|
|
|
4776
4838
|
useEffect17(() => {
|
|
4777
4839
|
if (navRef.current) revealCurrentNav(navRef.current);
|
|
4778
4840
|
}, [active, signature]);
|
|
4779
|
-
return /* @__PURE__ */
|
|
4841
|
+
return /* @__PURE__ */ jsx41(
|
|
4780
4842
|
"nav",
|
|
4781
4843
|
{
|
|
4782
4844
|
...rest,
|
|
@@ -4789,11 +4851,11 @@ var NavTabs = forwardRef11(function NavTabs2({
|
|
|
4789
4851
|
},
|
|
4790
4852
|
children: items.map((item) => {
|
|
4791
4853
|
const badge = item.badge != null && typeof item.badge === "object" ? item.badge : { text: item.badge, tone: void 0 };
|
|
4792
|
-
const inner = /* @__PURE__ */
|
|
4793
|
-
/* @__PURE__ */
|
|
4794
|
-
badge.text != null && badge.text !== "" && /* @__PURE__ */
|
|
4854
|
+
const inner = /* @__PURE__ */ jsxs35(Fragment15, { children: [
|
|
4855
|
+
/* @__PURE__ */ jsx41("span", { className: "ui-nav__tab-label", children: item.label }),
|
|
4856
|
+
badge.text != null && badge.text !== "" && /* @__PURE__ */ jsx41("span", { className: `ui-nav__badge is-${badge.tone || "neutral"}`, children: badge.text })
|
|
4795
4857
|
] });
|
|
4796
|
-
if (item.disabled) return /* @__PURE__ */
|
|
4858
|
+
if (item.disabled) return /* @__PURE__ */ jsx41("span", { className: "ui-nav__tab is-disabled", "aria-disabled": "true", children: inner }, item.id);
|
|
4797
4859
|
const current = item.id === active;
|
|
4798
4860
|
const linkProps = {
|
|
4799
4861
|
className: ["ui-nav__tab", current && "is-active"].filter(Boolean).join(" "),
|
|
@@ -4802,7 +4864,7 @@ var NavTabs = forwardRef11(function NavTabs2({
|
|
|
4802
4864
|
"aria-current": current ? "page" : void 0,
|
|
4803
4865
|
children: inner
|
|
4804
4866
|
};
|
|
4805
|
-
return /* @__PURE__ */
|
|
4867
|
+
return /* @__PURE__ */ jsx41(Fragment14, { children: renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx41("a", { ...linkProps }) }, item.id);
|
|
4806
4868
|
})
|
|
4807
4869
|
}
|
|
4808
4870
|
);
|
|
@@ -4810,8 +4872,8 @@ var NavTabs = forwardRef11(function NavTabs2({
|
|
|
4810
4872
|
|
|
4811
4873
|
// src/Breadcrumbs.tsx
|
|
4812
4874
|
import { forwardRef as forwardRef12 } from "react";
|
|
4813
|
-
import { icon as
|
|
4814
|
-
import { Fragment as Fragment16, jsx as
|
|
4875
|
+
import { icon as icon7, safeUrl as safeUrl2 } from "@apliteni/apliteni-ui";
|
|
4876
|
+
import { Fragment as Fragment16, jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4815
4877
|
var Breadcrumbs = forwardRef12(function Breadcrumbs2({
|
|
4816
4878
|
items,
|
|
4817
4879
|
renderLink,
|
|
@@ -4819,21 +4881,21 @@ var Breadcrumbs = forwardRef12(function Breadcrumbs2({
|
|
|
4819
4881
|
"aria-label": ariaLabel = "Breadcrumb",
|
|
4820
4882
|
...rest
|
|
4821
4883
|
}, ref) {
|
|
4822
|
-
return /* @__PURE__ */
|
|
4884
|
+
return /* @__PURE__ */ jsx42(
|
|
4823
4885
|
"nav",
|
|
4824
4886
|
{
|
|
4825
4887
|
...rest,
|
|
4826
4888
|
ref,
|
|
4827
4889
|
className: ["ui-nav", "ui-nav--crumbs", className].filter(Boolean).join(" "),
|
|
4828
4890
|
"aria-label": ariaLabel,
|
|
4829
|
-
children: /* @__PURE__ */
|
|
4891
|
+
children: /* @__PURE__ */ jsx42("ol", { className: "ui-nav__crumbs", children: items.map((item, index) => {
|
|
4830
4892
|
const current = index === items.length - 1;
|
|
4831
|
-
const inner = /* @__PURE__ */
|
|
4832
|
-
item.icon && /* @__PURE__ */
|
|
4833
|
-
/* @__PURE__ */
|
|
4893
|
+
const inner = /* @__PURE__ */ jsxs36(Fragment16, { children: [
|
|
4894
|
+
item.icon && /* @__PURE__ */ jsx42("span", { className: "ui-nav__ic", dangerouslySetInnerHTML: { __html: icon7(item.icon) } }),
|
|
4895
|
+
/* @__PURE__ */ jsx42("span", { className: "ui-nav__crumb-label", children: item.label })
|
|
4834
4896
|
] });
|
|
4835
4897
|
const linkProps = !current && item.href ? { className: "ui-nav__crumb", href: safeUrl2(item.href), target: item.target, children: inner } : null;
|
|
4836
|
-
return /* @__PURE__ */
|
|
4898
|
+
return /* @__PURE__ */ jsx42("li", { className: "ui-nav__crumb-item", children: linkProps ? renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx42("a", { ...linkProps }) : /* @__PURE__ */ jsx42(
|
|
4837
4899
|
"span",
|
|
4838
4900
|
{
|
|
4839
4901
|
className: ["ui-nav__crumb", current && "is-current"].filter(Boolean).join(" "),
|
|
@@ -4852,6 +4914,7 @@ var DEFAULT_PAGE_SIZE3 = KIT_DEFAULT_PAGE_SIZE;
|
|
|
4852
4914
|
export {
|
|
4853
4915
|
AccentPicker,
|
|
4854
4916
|
AppShell,
|
|
4917
|
+
Avatar,
|
|
4855
4918
|
BackLink,
|
|
4856
4919
|
Badge,
|
|
4857
4920
|
Breadcrumbs,
|