@apliteni/apliteni-ui 0.129.0 → 0.131.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/README.md +7 -0
- package/react/dist/index.d.ts +31 -1
- package/react/dist/index.js +602 -559
- package/src/components/account-nav.js +4 -7
- package/src/components/avatar.js +53 -0
- package/src/components/dropdown.js +36 -10
- package/src/components/shell.js +3 -2
- package/src/components/toasts.js +38 -14
- package/src/components/topbar.js +4 -3
- package/src/index.css +1 -0
- package/src/index.d.ts +8 -0
- package/src/index.js +1 -0
- package/src/inline.js +2 -0
- package/src/logic/avatar.js +28 -0
- package/src/styles/avatar.css +42 -0
- package/src/styles/callout.css +13 -3
- package/src/styles/dropdown.css +18 -0
- package/src/styles/layout.css +3 -6
- package/src/styles/topbar.css +5 -2
- 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,15 +2100,15 @@ 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,
|
|
@@ -2098,7 +2123,7 @@ import { createContext as createContext2 } from "react";
|
|
|
2098
2123
|
var FieldContext = createContext2(null);
|
|
2099
2124
|
|
|
2100
2125
|
// src/Dropdown.tsx
|
|
2101
|
-
import { Fragment as Fragment6, jsx as
|
|
2126
|
+
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2102
2127
|
var EXIT_SLACK_MS2 = 50;
|
|
2103
2128
|
var SETTLE_MS = 450;
|
|
2104
2129
|
var inPanel = (node) => {
|
|
@@ -2107,12 +2132,12 @@ var inPanel = (node) => {
|
|
|
2107
2132
|
};
|
|
2108
2133
|
var cx6 = (...a) => a.filter(Boolean).join(" ");
|
|
2109
2134
|
var isRow = (it) => Boolean(it) && it !== "---" && !it.separator;
|
|
2110
|
-
var Glyph2 = ({ name, className, hidden }) => /* @__PURE__ */
|
|
2135
|
+
var Glyph2 = ({ name, className, hidden }) => /* @__PURE__ */ jsx21(
|
|
2111
2136
|
"span",
|
|
2112
2137
|
{
|
|
2113
2138
|
className,
|
|
2114
2139
|
"aria-hidden": hidden ? "true" : void 0,
|
|
2115
|
-
dangerouslySetInnerHTML: { __html:
|
|
2140
|
+
dangerouslySetInnerHTML: { __html: icon4(name) }
|
|
2116
2141
|
}
|
|
2117
2142
|
);
|
|
2118
2143
|
function RowBadge({ badge }) {
|
|
@@ -2120,12 +2145,17 @@ function RowBadge({ badge }) {
|
|
|
2120
2145
|
const given = typeof badge === "string" ? "" : badge.tone || "";
|
|
2121
2146
|
let tone = given || (/^live$/i.test(String(text2)) ? "live" : "neutral");
|
|
2122
2147
|
if (!given && tone === "neutral" && /^(?:off|unset|disabled|archive|archived)$/i.test(text2)) tone = "state";
|
|
2123
|
-
return /* @__PURE__ */
|
|
2148
|
+
return /* @__PURE__ */ jsx21("span", { className: `ui-dropdown__badge is-${tone}`, children: text2 });
|
|
2124
2149
|
}
|
|
2125
2150
|
var keyOf = (it) => it.value != null ? `v:${it.value}` : `l:${it.label}`;
|
|
2126
2151
|
var itemsIn = (panel) => Array.from(panel?.querySelectorAll("[data-dd-item]") ?? []).filter((el) => el.getAttribute("aria-disabled") !== "true" && !el.hidden);
|
|
2127
2152
|
var openNow = /* @__PURE__ */ new Set();
|
|
2128
2153
|
var composing = (e) => e.isComposing || e.keyCode === 229;
|
|
2154
|
+
var countOf2 = (count, rows) => {
|
|
2155
|
+
if (count == null) return null;
|
|
2156
|
+
const n = count === true ? rows.filter((it) => !it.avatar?.empty).length : Number(count);
|
|
2157
|
+
return Number.isFinite(n) && n >= 0 ? n : null;
|
|
2158
|
+
};
|
|
2129
2159
|
var SEARCH_DEFAULTS = {
|
|
2130
2160
|
placeholder: "Search",
|
|
2131
2161
|
empty: "No match for \u201C{q}\u201D",
|
|
@@ -2159,11 +2189,11 @@ function Dropdown({
|
|
|
2159
2189
|
onSelect,
|
|
2160
2190
|
row
|
|
2161
2191
|
}) {
|
|
2162
|
-
const [selfOpen, setSelfOpen] =
|
|
2192
|
+
const [selfOpen, setSelfOpen] = useState8(defaultOpen);
|
|
2163
2193
|
const open = openProp ?? selfOpen;
|
|
2164
|
-
const [pick, setPick] =
|
|
2165
|
-
const [query, setQuery] =
|
|
2166
|
-
const [activeKey, setActiveKey] =
|
|
2194
|
+
const [pick, setPick] = useState8(null);
|
|
2195
|
+
const [query, setQuery] = useState8(() => search && search !== true ? search.query || "" : "");
|
|
2196
|
+
const [activeKey, setActiveKey] = useState8(null);
|
|
2167
2197
|
const root = useRef11(null);
|
|
2168
2198
|
const panel = useRef11(null);
|
|
2169
2199
|
const trigger = useRef11(null);
|
|
@@ -2174,7 +2204,7 @@ function Dropdown({
|
|
|
2174
2204
|
const uid = id ?? auto;
|
|
2175
2205
|
const inField = useContext2(FieldContext);
|
|
2176
2206
|
const fieldName = inField && id === inField.id && !(ariaLabel && triggerContent != null) ? { id: `${uid}-trigger`, labelId: inField.labelId, labelledBy: `${inField.labelId} ${uid}-trigger` } : null;
|
|
2177
|
-
const setOpen =
|
|
2207
|
+
const setOpen = useCallback5((next) => {
|
|
2178
2208
|
if (openProp === void 0) setSelfOpen(next);
|
|
2179
2209
|
onOpenChange?.(next);
|
|
2180
2210
|
}, [openProp, onOpenChange]);
|
|
@@ -2260,9 +2290,17 @@ function Dropdown({
|
|
|
2260
2290
|
el.classList.remove("is-closing");
|
|
2261
2291
|
};
|
|
2262
2292
|
}, [open]);
|
|
2263
|
-
const sx = search ? { ...SEARCH_DEFAULTS, ...strip(search === true ? {} : search) } : null;
|
|
2264
2293
|
const entries = sections?.length ? sections.flatMap((s) => s.items || []) : items || [];
|
|
2265
2294
|
const rows = entries.filter(isRow);
|
|
2295
|
+
const given_ = search ? strip(search === true ? {} : search) : null;
|
|
2296
|
+
const n = given_ ? countOf2(given_.count, rows) : null;
|
|
2297
|
+
const counted = n == null ? void 0 : `Search ${n} ${given_?.noun || "people"}`;
|
|
2298
|
+
const sx = given_ ? {
|
|
2299
|
+
...SEARCH_DEFAULTS,
|
|
2300
|
+
...given_,
|
|
2301
|
+
placeholder: given_.placeholder || counted || SEARCH_DEFAULTS.placeholder,
|
|
2302
|
+
label: given_.label || counted
|
|
2303
|
+
} : null;
|
|
2266
2304
|
const isSelect = variant === "select" || variant == null && rows.some((it) => it.selected || it.value != null);
|
|
2267
2305
|
const listRole = isSelect ? "listbox" : "menu";
|
|
2268
2306
|
const asOption = isSelect || Boolean(sx);
|
|
@@ -2275,6 +2313,8 @@ function Dropdown({
|
|
|
2275
2313
|
}, [givenKey, pick]);
|
|
2276
2314
|
const picked = pickedKey != null ? rows.find((it) => keyOf(it) === pickedKey) : void 0;
|
|
2277
2315
|
const shown = value != null ? value : isSelect ? picked?.label ?? given?.label : null;
|
|
2316
|
+
const marked2 = isSelect && rows.some((it) => it.avatar);
|
|
2317
|
+
const chosen = marked2 ? value != null ? rows.find((it) => it.label === value) : picked ?? given : void 0;
|
|
2278
2318
|
const selectedOf = (it) => pickedKey != null ? it.disabled ? !!it.selected : keyOf(it) === pickedKey : !!it.selected;
|
|
2279
2319
|
const hiddenBy = (it) => Boolean(sx) && !dropdownMatch(it.label, query);
|
|
2280
2320
|
const filtering = Boolean(sx) && dropdownFiltering(query);
|
|
@@ -2506,7 +2546,7 @@ function Dropdown({
|
|
|
2506
2546
|
};
|
|
2507
2547
|
function renderRow(entry, key) {
|
|
2508
2548
|
if (!isRow(entry)) {
|
|
2509
|
-
return /* @__PURE__ */
|
|
2549
|
+
return /* @__PURE__ */ jsx21("div", { className: "ui-dropdown__sep", role: "separator", hidden: filtering || void 0 }, key);
|
|
2510
2550
|
}
|
|
2511
2551
|
const disabled2 = !!entry.disabled;
|
|
2512
2552
|
const selected = selectedOf(entry);
|
|
@@ -2528,23 +2568,23 @@ function Dropdown({
|
|
|
2528
2568
|
...asLink ? { href: entry.href, ...entry.target ? { target: entry.target } : null } : null,
|
|
2529
2569
|
...sx ? { id: rowIds.get(entry), hidden: hiddenBy(entry) || void 0 } : null,
|
|
2530
2570
|
onClick: (e) => choose(entry, e),
|
|
2531
|
-
children: /* @__PURE__ */
|
|
2532
|
-
entry.icon && /* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2534
|
-
/* @__PURE__ */
|
|
2535
|
-
entry.description && /* @__PURE__ */
|
|
2571
|
+
children: /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
2572
|
+
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" }),
|
|
2573
|
+
/* @__PURE__ */ jsxs17("span", { className: "ui-dropdown__main", children: [
|
|
2574
|
+
/* @__PURE__ */ jsx21("span", { className: "ui-dropdown__label", children: entry.label }),
|
|
2575
|
+
entry.description && /* @__PURE__ */ jsx21("span", { className: "ui-dropdown__desc", children: entry.description })
|
|
2536
2576
|
] }),
|
|
2537
|
-
entry.badge ? /* @__PURE__ */
|
|
2538
|
-
asOption && /* @__PURE__ */
|
|
2577
|
+
entry.badge ? /* @__PURE__ */ jsx21(RowBadge, { badge: entry.badge }) : null,
|
|
2578
|
+
asOption && /* @__PURE__ */ jsx21(Glyph2, { name: "check", className: "ui-dropdown__tick", hidden: true })
|
|
2539
2579
|
] })
|
|
2540
2580
|
};
|
|
2541
|
-
if (row) return /* @__PURE__ */
|
|
2581
|
+
if (row) return /* @__PURE__ */ jsx21(Fragment5, { children: row(entry, props) }, key);
|
|
2542
2582
|
const Tag = asLink ? "a" : "div";
|
|
2543
|
-
return /* @__PURE__ */
|
|
2583
|
+
return /* @__PURE__ */ jsx21(Tag, { ...props }, key);
|
|
2544
2584
|
}
|
|
2545
2585
|
const body = sections?.length ? sections.map((section, si) => {
|
|
2546
2586
|
const gone = filtering && !(section.items || []).some((it) => isRow(it) && !hiddenBy(it));
|
|
2547
|
-
return /* @__PURE__ */
|
|
2587
|
+
return /* @__PURE__ */ jsxs17(
|
|
2548
2588
|
"div",
|
|
2549
2589
|
{
|
|
2550
2590
|
className: "ui-dropdown__section",
|
|
@@ -2552,7 +2592,7 @@ function Dropdown({
|
|
|
2552
2592
|
"aria-label": section.label || void 0,
|
|
2553
2593
|
hidden: gone || void 0,
|
|
2554
2594
|
children: [
|
|
2555
|
-
section.label && /* @__PURE__ */
|
|
2595
|
+
section.label && /* @__PURE__ */ jsx21("div", { className: "ui-dropdown__group", role: "presentation", children: section.label }),
|
|
2556
2596
|
(section.items || []).map((entry, i) => renderRow(entry, `s${si}-${i}`))
|
|
2557
2597
|
]
|
|
2558
2598
|
},
|
|
@@ -2560,12 +2600,12 @@ function Dropdown({
|
|
|
2560
2600
|
);
|
|
2561
2601
|
}) : (items || []).map((entry, i) => renderRow(entry, `i${i}`));
|
|
2562
2602
|
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__ */
|
|
2603
|
+
const none = sx && filtering && !visible.length ? /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
2604
|
+
/* @__PURE__ */ jsx21("span", { className: "ui-dropdown__none-title", children: sx.empty.replace("{q}", () => query.trim()) }),
|
|
2605
|
+
/* @__PURE__ */ jsx21("span", { className: "ui-dropdown__none-hint", children: sx.hint })
|
|
2566
2606
|
] }) : null;
|
|
2567
|
-
return /* @__PURE__ */
|
|
2568
|
-
/* @__PURE__ */
|
|
2607
|
+
return /* @__PURE__ */ jsxs17("div", { className: cx6("ui-dropdown", open && "open"), id, ref: root, onKeyDown, children: [
|
|
2608
|
+
/* @__PURE__ */ jsxs17(
|
|
2569
2609
|
"button",
|
|
2570
2610
|
{
|
|
2571
2611
|
type: "button",
|
|
@@ -2585,15 +2625,16 @@ function Dropdown({
|
|
|
2585
2625
|
setOpen(!open);
|
|
2586
2626
|
},
|
|
2587
2627
|
children: [
|
|
2588
|
-
triggerContent != null ? triggerContent : /* @__PURE__ */
|
|
2589
|
-
|
|
2590
|
-
/* @__PURE__ */
|
|
2628
|
+
triggerContent != null ? triggerContent : /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
2629
|
+
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 })),
|
|
2630
|
+
label && /* @__PURE__ */ jsx21("span", { className: "ui-dropdown__pre", children: label }),
|
|
2631
|
+
/* @__PURE__ */ jsx21("span", { className: cx6("ui-dropdown__value", marked2 && !chosen && "is-placeholder"), children: shown != null ? shown : placeholder })
|
|
2591
2632
|
] }),
|
|
2592
|
-
chevron && /* @__PURE__ */
|
|
2633
|
+
chevron && /* @__PURE__ */ jsx21("span", { className: "ui-dropdown__chevron", "aria-hidden": "true" })
|
|
2593
2634
|
]
|
|
2594
2635
|
}
|
|
2595
2636
|
),
|
|
2596
|
-
/* @__PURE__ */
|
|
2637
|
+
/* @__PURE__ */ jsxs17(
|
|
2597
2638
|
"div",
|
|
2598
2639
|
{
|
|
2599
2640
|
className: cx6(
|
|
@@ -2614,10 +2655,10 @@ function Dropdown({
|
|
|
2614
2655
|
onMouseMove,
|
|
2615
2656
|
children: [
|
|
2616
2657
|
header,
|
|
2617
|
-
sx ? /* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2619
|
-
/* @__PURE__ */
|
|
2620
|
-
/* @__PURE__ */
|
|
2658
|
+
sx ? /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
2659
|
+
/* @__PURE__ */ jsxs17("div", { className: "ui-dropdown__search", children: [
|
|
2660
|
+
/* @__PURE__ */ jsx21(Glyph2, { name: "search", className: "ui-dropdown__search-ic", hidden: true }),
|
|
2661
|
+
/* @__PURE__ */ jsx21(
|
|
2621
2662
|
"input",
|
|
2622
2663
|
{
|
|
2623
2664
|
className: "ui-dropdown__search-input",
|
|
@@ -2641,8 +2682,8 @@ function Dropdown({
|
|
|
2641
2682
|
}
|
|
2642
2683
|
)
|
|
2643
2684
|
] }),
|
|
2644
|
-
/* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2685
|
+
/* @__PURE__ */ jsx21("div", { className: "ui-dropdown__list", role: "listbox", id: listId, "aria-label": name, style: cap, children: body }),
|
|
2686
|
+
/* @__PURE__ */ jsx21(
|
|
2646
2687
|
"div",
|
|
2647
2688
|
{
|
|
2648
2689
|
className: "ui-dropdown__none",
|
|
@@ -2667,7 +2708,7 @@ function strip(o) {
|
|
|
2667
2708
|
}
|
|
2668
2709
|
|
|
2669
2710
|
// src/BackLink.tsx
|
|
2670
|
-
import { jsx as
|
|
2711
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2671
2712
|
var BARE = "Back";
|
|
2672
2713
|
var SCRIPTED = /^javascript:/i;
|
|
2673
2714
|
var LEADING = /^[\u0000-\u0020]+/;
|
|
@@ -2686,7 +2727,7 @@ function BackLink({
|
|
|
2686
2727
|
const name = text(label).replace(SAID, "");
|
|
2687
2728
|
const bare = !name || name.toLowerCase() === BARE.toLowerCase();
|
|
2688
2729
|
const Tag = as ?? "a";
|
|
2689
|
-
return /* @__PURE__ */
|
|
2730
|
+
return /* @__PURE__ */ jsxs18(
|
|
2690
2731
|
Tag,
|
|
2691
2732
|
{
|
|
2692
2733
|
className: ["ui-back", className].filter(Boolean).join(" "),
|
|
@@ -2694,8 +2735,8 @@ function BackLink({
|
|
|
2694
2735
|
"aria-label": bare ? void 0 : `${BARE} to ${name}`,
|
|
2695
2736
|
...rest,
|
|
2696
2737
|
children: [
|
|
2697
|
-
/* @__PURE__ */
|
|
2698
|
-
/* @__PURE__ */
|
|
2738
|
+
/* @__PURE__ */ jsx22(Icon, { name: "chevronLeft" }),
|
|
2739
|
+
/* @__PURE__ */ jsx22("span", { className: "ui-back__label", children: bare ? BARE : name })
|
|
2699
2740
|
]
|
|
2700
2741
|
}
|
|
2701
2742
|
);
|
|
@@ -2703,41 +2744,41 @@ function BackLink({
|
|
|
2703
2744
|
|
|
2704
2745
|
// src/TableValues.tsx
|
|
2705
2746
|
import { formatNumericValue, formatDeltaValue } from "@apliteni/apliteni-ui";
|
|
2706
|
-
import { jsx as
|
|
2747
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2707
2748
|
function NumericValue(props) {
|
|
2708
2749
|
const value = formatNumericValue(props);
|
|
2709
|
-
return /* @__PURE__ */
|
|
2750
|
+
return /* @__PURE__ */ jsx23("span", { children: /* @__PURE__ */ jsxs19("span", { className: "ui-value", "aria-label": value.missing, children: [
|
|
2710
2751
|
value.text,
|
|
2711
|
-
value.unit && /* @__PURE__ */
|
|
2752
|
+
value.unit && /* @__PURE__ */ jsx23("span", { className: "ui-value__unit", children: value.unit })
|
|
2712
2753
|
] }) });
|
|
2713
2754
|
}
|
|
2714
2755
|
function DeltaValue(props) {
|
|
2715
2756
|
const value = formatDeltaValue(props);
|
|
2716
|
-
return /* @__PURE__ */
|
|
2757
|
+
return /* @__PURE__ */ jsx23("span", { children: /* @__PURE__ */ jsx23("span", { className: value.className, "aria-describedby": value.basisId || void 0, children: value.text }) });
|
|
2717
2758
|
}
|
|
2718
2759
|
function RowIdentity({ symbol, name, logo, href }) {
|
|
2719
2760
|
const Tag = href ? "a" : "span";
|
|
2720
|
-
return /* @__PURE__ */
|
|
2721
|
-
/* @__PURE__ */
|
|
2722
|
-
/* @__PURE__ */
|
|
2723
|
-
logo && /* @__PURE__ */
|
|
2761
|
+
return /* @__PURE__ */ jsxs19(Tag, { className: "ui-identity", href, children: [
|
|
2762
|
+
/* @__PURE__ */ jsxs19("span", { className: "ui-identity__logo", "aria-hidden": "true", children: [
|
|
2763
|
+
/* @__PURE__ */ jsx23("span", { children: symbol.slice(0, 1) }),
|
|
2764
|
+
logo && /* @__PURE__ */ jsx23("img", { src: logo, alt: "", onLoad: (e) => {
|
|
2724
2765
|
e.currentTarget.hidden = false;
|
|
2725
2766
|
}, onError: (e) => {
|
|
2726
2767
|
e.currentTarget.hidden = true;
|
|
2727
2768
|
} })
|
|
2728
2769
|
] }),
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
/* @__PURE__ */
|
|
2770
|
+
/* @__PURE__ */ jsx23("span", { className: "ui-identity__symbol", children: symbol }),
|
|
2771
|
+
/* @__PURE__ */ jsx23("span", { className: "ui-identity__name", children: name })
|
|
2731
2772
|
] });
|
|
2732
2773
|
}
|
|
2733
2774
|
|
|
2734
2775
|
// src/Segmented.tsx
|
|
2735
2776
|
import { segmentedNextIndex } from "@apliteni/apliteni-ui";
|
|
2736
|
-
import { jsx as
|
|
2777
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2737
2778
|
function Segmented({ options, value, onChange, label, appearance = "pill", size, block = false, disabled = false }) {
|
|
2738
2779
|
const enabled = options.filter((o) => !o.disabled);
|
|
2739
2780
|
const tabValue = enabled.some((o) => o.value === value) ? value : enabled[0]?.value;
|
|
2740
|
-
return /* @__PURE__ */
|
|
2781
|
+
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
2782
|
"button",
|
|
2742
2783
|
{
|
|
2743
2784
|
type: "button",
|
|
@@ -2763,17 +2804,17 @@ function Segmented({ options, value, onChange, label, appearance = "pill", size,
|
|
|
2763
2804
|
}
|
|
2764
2805
|
|
|
2765
2806
|
// src/FilterBar.tsx
|
|
2766
|
-
import { useRef as useRef12, useState as
|
|
2807
|
+
import { useRef as useRef12, useState as useState9 } from "react";
|
|
2767
2808
|
import { filterChipText, filterChipName, filterChipUnset, filterChipItems, focusNextStop } from "@apliteni/apliteni-ui";
|
|
2768
|
-
import { Fragment as Fragment7, jsx as
|
|
2809
|
+
import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2769
2810
|
var SEARCH_AT = 10;
|
|
2770
2811
|
var isRow2 = (entry) => entry !== "---" && !entry.separator;
|
|
2771
2812
|
function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clearVariant = "ghost", add, addLabel = "Filter", disabled = false, busy = false, onRemove, onClear, onChange, onAdd }) {
|
|
2772
2813
|
const bar = useRef12(null);
|
|
2773
2814
|
const focused = useRef12(null);
|
|
2774
2815
|
const landing = useRef12(null);
|
|
2775
|
-
const [opened, setOpened] =
|
|
2776
|
-
const [adding, setAdding] =
|
|
2816
|
+
const [opened, setOpened] = useState9({});
|
|
2817
|
+
const [adding, setAdding] = useState9(false);
|
|
2777
2818
|
const blocked = disabled || busy;
|
|
2778
2819
|
const offer = (add || []).filter((entry) => !filters.some((filter) => filter.id === entry.id));
|
|
2779
2820
|
const source = /* @__PURE__ */ new Map();
|
|
@@ -2808,7 +2849,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2808
2849
|
if (target) target.focus();
|
|
2809
2850
|
else focusNextStop(bar.current);
|
|
2810
2851
|
});
|
|
2811
|
-
return /* @__PURE__ */
|
|
2852
|
+
return /* @__PURE__ */ jsx25("div", { children: /* @__PURE__ */ jsxs20(
|
|
2812
2853
|
"fieldset",
|
|
2813
2854
|
{
|
|
2814
2855
|
ref: bar,
|
|
@@ -2821,8 +2862,8 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2821
2862
|
if (event.relatedTarget && !event.currentTarget.contains(event.relatedTarget)) focused.current = null;
|
|
2822
2863
|
},
|
|
2823
2864
|
children: [
|
|
2824
|
-
/* @__PURE__ */
|
|
2825
|
-
filters.map((filter, index) => /* @__PURE__ */
|
|
2865
|
+
/* @__PURE__ */ jsx25("legend", { className: "ui-filter-bar__legend", children: label }),
|
|
2866
|
+
filters.map((filter, index) => /* @__PURE__ */ jsxs20(
|
|
2826
2867
|
"fieldset",
|
|
2827
2868
|
{
|
|
2828
2869
|
className: "ui-filter-bar__chip",
|
|
@@ -2832,14 +2873,14 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2832
2873
|
focused.current = { id: filter.id, index };
|
|
2833
2874
|
},
|
|
2834
2875
|
children: [
|
|
2835
|
-
/* @__PURE__ */
|
|
2836
|
-
/* @__PURE__ */
|
|
2876
|
+
/* @__PURE__ */ jsx25("legend", { className: "ui-filter-bar__legend", children: filter.label }),
|
|
2877
|
+
/* @__PURE__ */ jsx25(
|
|
2837
2878
|
Dropdown,
|
|
2838
2879
|
{
|
|
2839
2880
|
items: filterChipItems(filter),
|
|
2840
2881
|
variant: "select",
|
|
2841
2882
|
ariaLabel: filterChipName(filter),
|
|
2842
|
-
triggerContent: /* @__PURE__ */
|
|
2883
|
+
triggerContent: /* @__PURE__ */ jsx25("span", { className: filterChipUnset(filter) ? "ui-dropdown__value is-placeholder" : "ui-dropdown__value", children: filterChipText(filter) }),
|
|
2843
2884
|
open: !blocked && !filter.disabled && (opened[filter.id] && opened[filter.id].against === filter.open ? opened[filter.id].open : !!filter.open),
|
|
2844
2885
|
onOpenChange: (open) => setOpened((previous) => ({ ...previous, [filter.id]: { open, against: filter.open } })),
|
|
2845
2886
|
onSelect: (value) => {
|
|
@@ -2847,7 +2888,7 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2847
2888
|
}
|
|
2848
2889
|
}
|
|
2849
2890
|
),
|
|
2850
|
-
/* @__PURE__ */
|
|
2891
|
+
/* @__PURE__ */ jsx25(
|
|
2851
2892
|
"button",
|
|
2852
2893
|
{
|
|
2853
2894
|
type: "button",
|
|
@@ -2864,16 +2905,16 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2864
2905
|
},
|
|
2865
2906
|
filter.id
|
|
2866
2907
|
)),
|
|
2867
|
-
offering && /* @__PURE__ */
|
|
2908
|
+
offering && /* @__PURE__ */ jsx25("div", { "data-filter-add": "", onFocus: () => {
|
|
2868
2909
|
focused.current = null;
|
|
2869
|
-
}, children: /* @__PURE__ */
|
|
2910
|
+
}, children: /* @__PURE__ */ jsx25(
|
|
2870
2911
|
Dropdown,
|
|
2871
2912
|
{
|
|
2872
2913
|
variant: "menu",
|
|
2873
2914
|
sections,
|
|
2874
2915
|
ariaLabel: addLabel,
|
|
2875
|
-
triggerContent: /* @__PURE__ */
|
|
2876
|
-
/* @__PURE__ */
|
|
2916
|
+
triggerContent: /* @__PURE__ */ jsxs20(Fragment7, { children: [
|
|
2917
|
+
/* @__PURE__ */ jsx25(Icon, { name: "plus" }),
|
|
2877
2918
|
addLabel
|
|
2878
2919
|
] }),
|
|
2879
2920
|
search: options >= SEARCH_AT && { label: `Search ${label.toLowerCase()}` },
|
|
@@ -2887,9 +2928,9 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2887
2928
|
}
|
|
2888
2929
|
}
|
|
2889
2930
|
) }),
|
|
2890
|
-
filters.length > 0 && /* @__PURE__ */
|
|
2931
|
+
filters.length > 0 && /* @__PURE__ */ jsx25("span", { "data-filter-clear": "", onFocus: () => {
|
|
2891
2932
|
focused.current = { id: null, index: 0 };
|
|
2892
|
-
}, children: /* @__PURE__ */
|
|
2933
|
+
}, children: /* @__PURE__ */ jsx25(Button, { size: "sm", variant: clearVariant, onClick: () => {
|
|
2893
2934
|
if (!blocked) onClear();
|
|
2894
2935
|
}, children: clearLabel }) })
|
|
2895
2936
|
]
|
|
@@ -2898,34 +2939,34 @@ function FilterBar({ filters, label = "Filters", clearLabel = "Clear all", clear
|
|
|
2898
2939
|
}
|
|
2899
2940
|
|
|
2900
2941
|
// src/KeyValueList.tsx
|
|
2901
|
-
import { jsx as
|
|
2942
|
+
import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2902
2943
|
function detail({ value, redacted }) {
|
|
2903
|
-
if (redacted) return /* @__PURE__ */
|
|
2904
|
-
/* @__PURE__ */
|
|
2944
|
+
if (redacted) return /* @__PURE__ */ jsxs21("span", { className: "ui-kv__hidden", children: [
|
|
2945
|
+
/* @__PURE__ */ jsx26(Icon, { name: "eyeOff" }),
|
|
2905
2946
|
"Hidden"
|
|
2906
2947
|
] });
|
|
2907
2948
|
if (value == null) return "\u2014";
|
|
2908
2949
|
return typeof value === "boolean" ? String(value) : value;
|
|
2909
2950
|
}
|
|
2910
2951
|
function KeyValueList({ rows, columns = 1, className, ...rest }) {
|
|
2911
|
-
return /* @__PURE__ */
|
|
2912
|
-
/* @__PURE__ */
|
|
2913
|
-
/* @__PURE__ */
|
|
2952
|
+
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: [
|
|
2953
|
+
/* @__PURE__ */ jsx26("dt", { children: row.label }),
|
|
2954
|
+
/* @__PURE__ */ jsx26("dd", { children: detail(row) })
|
|
2914
2955
|
] }, index)) });
|
|
2915
2956
|
}
|
|
2916
2957
|
function DrawerSection({ title, headingLevel = 3, className, children, ...rest }) {
|
|
2917
2958
|
const Heading = `h${headingLevel}`;
|
|
2918
|
-
return /* @__PURE__ */
|
|
2919
|
-
title != null && /* @__PURE__ */
|
|
2959
|
+
return /* @__PURE__ */ jsxs21("section", { ...rest, className: ["ui-drawer__section", className].filter(Boolean).join(" "), children: [
|
|
2960
|
+
title != null && /* @__PURE__ */ jsx26(Heading, { className: "ui-drawer__section-title", children: title }),
|
|
2920
2961
|
children
|
|
2921
2962
|
] });
|
|
2922
2963
|
}
|
|
2923
2964
|
|
|
2924
2965
|
// src/Snippet.tsx
|
|
2925
|
-
import { useEffect as useEffect8, useRef as useRef13, useState as
|
|
2926
|
-
import { Fragment as Fragment8, jsx as
|
|
2966
|
+
import { useEffect as useEffect8, useRef as useRef13, useState as useState10 } from "react";
|
|
2967
|
+
import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2927
2968
|
function Snippet({ label = "shell", code = "", children, copy = true, reveal = false, copyLabel = "Copy code" }) {
|
|
2928
|
-
const [status, setStatus] =
|
|
2969
|
+
const [status, setStatus] = useState10("idle");
|
|
2929
2970
|
const request = useRef13(0);
|
|
2930
2971
|
const timer = useRef13(void 0);
|
|
2931
2972
|
useEffect8(() => {
|
|
@@ -2948,11 +2989,11 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
2948
2989
|
if (current === request.current) setStatus("failed");
|
|
2949
2990
|
}
|
|
2950
2991
|
}
|
|
2951
|
-
return /* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
2953
|
-
/* @__PURE__ */
|
|
2954
|
-
copy && /* @__PURE__ */
|
|
2955
|
-
/* @__PURE__ */
|
|
2992
|
+
return /* @__PURE__ */ jsxs22("div", { className: reveal ? "ui-snippet ui-snippet--reveal" : "ui-snippet", children: [
|
|
2993
|
+
/* @__PURE__ */ jsxs22("div", { className: "ui-snippet__bar", children: [
|
|
2994
|
+
/* @__PURE__ */ jsx27("span", { children: label }),
|
|
2995
|
+
copy && /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
2996
|
+
/* @__PURE__ */ jsx27(
|
|
2956
2997
|
"button",
|
|
2957
2998
|
{
|
|
2958
2999
|
type: "button",
|
|
@@ -2960,20 +3001,20 @@ function Snippet({ label = "shell", code = "", children, copy = true, reveal = f
|
|
|
2960
3001
|
"aria-label": copyLabel,
|
|
2961
3002
|
title: copyLabel,
|
|
2962
3003
|
onClick: handleCopy,
|
|
2963
|
-
children: /* @__PURE__ */
|
|
3004
|
+
children: /* @__PURE__ */ jsx27(Icon, { name: status === "idle" ? "copy" : "check" })
|
|
2964
3005
|
}
|
|
2965
3006
|
),
|
|
2966
|
-
/* @__PURE__ */
|
|
3007
|
+
/* @__PURE__ */ jsx27("span", { className: "ui-sr ui-snippet__status", role: "status", "aria-live": "polite", children: status === "copied" ? "Copied" : status === "failed" ? "Copy failed" : "" })
|
|
2967
3008
|
] })
|
|
2968
3009
|
] }),
|
|
2969
|
-
/* @__PURE__ */
|
|
3010
|
+
/* @__PURE__ */ jsx27("pre", { children: children ?? code })
|
|
2970
3011
|
] });
|
|
2971
3012
|
}
|
|
2972
3013
|
|
|
2973
3014
|
// src/Tabs.tsx
|
|
2974
3015
|
import { useEffect as useEffect9, useId as useId9, useRef as useRef14 } from "react";
|
|
2975
3016
|
import { playEntrance } from "@apliteni/apliteni-ui/motion";
|
|
2976
|
-
import { Fragment as Fragment9, jsx as
|
|
3017
|
+
import { Fragment as Fragment9, jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2977
3018
|
function Tabs({ items, value, onChange, label }) {
|
|
2978
3019
|
const id = useId9();
|
|
2979
3020
|
const previous = useRef14(value);
|
|
@@ -2983,8 +3024,8 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
2983
3024
|
if (previous.current !== value) playEntrance(activePanel.current);
|
|
2984
3025
|
previous.current = value;
|
|
2985
3026
|
}, [value]);
|
|
2986
|
-
return /* @__PURE__ */
|
|
2987
|
-
/* @__PURE__ */
|
|
3027
|
+
return /* @__PURE__ */ jsxs23("div", { className: "ui-tabs", children: [
|
|
3028
|
+
/* @__PURE__ */ jsx28("div", { className: "ui-tabs__list", role: "tablist", "aria-label": label, children: items.map((item, i) => /* @__PURE__ */ jsxs23(
|
|
2988
3029
|
"button",
|
|
2989
3030
|
{
|
|
2990
3031
|
type: "button",
|
|
@@ -3022,7 +3063,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3022
3063
|
},
|
|
3023
3064
|
children: [
|
|
3024
3065
|
item.label,
|
|
3025
|
-
item.count != null && /* @__PURE__ */
|
|
3066
|
+
item.count != null && /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
3026
3067
|
" ",
|
|
3027
3068
|
item.count
|
|
3028
3069
|
] })
|
|
@@ -3030,7 +3071,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3030
3071
|
},
|
|
3031
3072
|
item.value
|
|
3032
3073
|
)) }),
|
|
3033
|
-
/* @__PURE__ */
|
|
3074
|
+
/* @__PURE__ */ jsx28("div", { className: "ui-tabs__panels", children: items.map((item, i) => /* @__PURE__ */ jsx28(
|
|
3034
3075
|
"div",
|
|
3035
3076
|
{
|
|
3036
3077
|
className: "ui-tabs__panel",
|
|
@@ -3050,7 +3091,7 @@ function Tabs({ items, value, onChange, label }) {
|
|
|
3050
3091
|
// src/Timeline.tsx
|
|
3051
3092
|
import { useEffect as useEffect10, useRef as useRef15 } from "react";
|
|
3052
3093
|
import { playEntrance as playEntrance2, prefersReducedMotion } from "@apliteni/apliteni-ui/motion";
|
|
3053
|
-
import { jsx as
|
|
3094
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3054
3095
|
var kindIcons = { person: "user", rule: "bolt", reversal: "refresh" };
|
|
3055
3096
|
function Timeline({ events, className, ...rest }) {
|
|
3056
3097
|
const previousIds = useRef15(new Set(events.map((event) => event.id)));
|
|
@@ -3067,7 +3108,7 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3067
3108
|
}
|
|
3068
3109
|
previousIds.current = new Set(events.map((event) => event.id));
|
|
3069
3110
|
}, [events]);
|
|
3070
|
-
return /* @__PURE__ */
|
|
3111
|
+
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
3112
|
"li",
|
|
3072
3113
|
{
|
|
3073
3114
|
className: "ui-timeline__event",
|
|
@@ -3076,20 +3117,20 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3076
3117
|
else rows.current.delete(event.id);
|
|
3077
3118
|
},
|
|
3078
3119
|
children: [
|
|
3079
|
-
/* @__PURE__ */
|
|
3120
|
+
/* @__PURE__ */ jsx29("span", { "aria-hidden": "true", className: [
|
|
3080
3121
|
"ui-timeline__marker",
|
|
3081
3122
|
event.kind && "ui-timeline__marker--kind",
|
|
3082
3123
|
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__ */
|
|
3124
|
+
].filter(Boolean).join(" "), children: event.kind && /* @__PURE__ */ jsx29(Icon, { name: kindIcons[event.kind] }) }),
|
|
3125
|
+
/* @__PURE__ */ jsxs24("div", { className: "ui-timeline__head", children: [
|
|
3126
|
+
/* @__PURE__ */ jsx29("span", { className: "ui-timeline__actor", children: event.actor }),
|
|
3127
|
+
/* @__PURE__ */ jsx29("time", { dateTime: event.dateTime, children: event.timestamp }),
|
|
3128
|
+
index === events.length - 1 && event.relativeTimestamp && /* @__PURE__ */ jsx29("span", { className: "ui-timeline__relative", children: event.relativeTimestamp })
|
|
3088
3129
|
] }),
|
|
3089
|
-
/* @__PURE__ */
|
|
3090
|
-
(event.meta != null || event.undo) && /* @__PURE__ */
|
|
3091
|
-
event.meta != null && /* @__PURE__ */
|
|
3092
|
-
event.undo && /* @__PURE__ */
|
|
3130
|
+
/* @__PURE__ */ jsx29("p", { className: "ui-timeline__description", children: event.description }),
|
|
3131
|
+
(event.meta != null || event.undo) && /* @__PURE__ */ jsxs24("div", { className: "ui-timeline__meta", children: [
|
|
3132
|
+
event.meta != null && /* @__PURE__ */ jsx29("span", { children: event.meta }),
|
|
3133
|
+
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
3134
|
] })
|
|
3094
3135
|
]
|
|
3095
3136
|
},
|
|
@@ -3098,29 +3139,29 @@ function Timeline({ events, className, ...rest }) {
|
|
|
3098
3139
|
}
|
|
3099
3140
|
|
|
3100
3141
|
// 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
|
|
3142
|
+
import { forwardRef as forwardRef6, useEffect as useEffect11, useId as useId10, useRef as useRef16, useState as useState11 } from "react";
|
|
3143
|
+
import { esc, icon as icon5 } from "@apliteni/apliteni-ui";
|
|
3144
|
+
import { jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3104
3145
|
function messages(id, hint, error) {
|
|
3105
3146
|
return [error && `${id}-error`, hint && `${id}-hint`].filter(Boolean).join(" ") || void 0;
|
|
3106
3147
|
}
|
|
3107
3148
|
function Frame({ id, labelId, label, hint, error, required, children }) {
|
|
3108
|
-
return /* @__PURE__ */
|
|
3109
|
-
/* @__PURE__ */
|
|
3149
|
+
return /* @__PURE__ */ jsxs25("div", { className: "ui-field", children: [
|
|
3150
|
+
/* @__PURE__ */ jsxs25("label", { className: "ui-field__label", id: labelId, htmlFor: id, children: [
|
|
3110
3151
|
label,
|
|
3111
|
-
required && /* @__PURE__ */
|
|
3152
|
+
required && /* @__PURE__ */ jsx30("span", { className: "ui-field__req", "aria-hidden": "true", children: "*" })
|
|
3112
3153
|
] }),
|
|
3113
3154
|
children,
|
|
3114
|
-
error && /* @__PURE__ */
|
|
3155
|
+
error && /* @__PURE__ */ jsx30(
|
|
3115
3156
|
"div",
|
|
3116
3157
|
{
|
|
3117
3158
|
id: `${id}-error`,
|
|
3118
3159
|
className: "ui-field__error",
|
|
3119
3160
|
role: "alert",
|
|
3120
|
-
dangerouslySetInnerHTML: { __html:
|
|
3161
|
+
dangerouslySetInnerHTML: { __html: icon5("alert") + esc(error) }
|
|
3121
3162
|
}
|
|
3122
3163
|
),
|
|
3123
|
-
hint && /* @__PURE__ */
|
|
3164
|
+
hint && /* @__PURE__ */ jsx30("div", { id: `${id}-hint`, className: "ui-field__hint", children: hint })
|
|
3124
3165
|
] });
|
|
3125
3166
|
}
|
|
3126
3167
|
function wiring(id, hint, error) {
|
|
@@ -3130,13 +3171,13 @@ function Field({ id: suppliedId, label, hint, error, required, children }) {
|
|
|
3130
3171
|
const generatedId = useId10();
|
|
3131
3172
|
const id = suppliedId ?? generatedId;
|
|
3132
3173
|
const labelId = `${id}-label`;
|
|
3133
|
-
return /* @__PURE__ */
|
|
3174
|
+
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
3175
|
}
|
|
3135
3176
|
var TextField = forwardRef6(function TextField2({ label, hint, error, required, type = "text", unit, icon: glyph, className = "", ...props }, ref) {
|
|
3136
3177
|
const id = useId10();
|
|
3137
3178
|
const hasUnit = type === "number" && !!unit;
|
|
3138
3179
|
const describedBy = [messages(id, hint, error), hasUnit ? `${id}-unit` : ""].filter(Boolean).join(" ") || void 0;
|
|
3139
|
-
const control = /* @__PURE__ */
|
|
3180
|
+
const control = /* @__PURE__ */ jsx30(
|
|
3140
3181
|
"input",
|
|
3141
3182
|
{
|
|
3142
3183
|
ref,
|
|
@@ -3149,19 +3190,19 @@ var TextField = forwardRef6(function TextField2({ label, hint, error, required,
|
|
|
3149
3190
|
className: `ui-input${error ? " is-invalid" : ""} ${className}`
|
|
3150
3191
|
}
|
|
3151
3192
|
);
|
|
3152
|
-
const unitSpan = hasUnit ? /* @__PURE__ */
|
|
3153
|
-
return /* @__PURE__ */
|
|
3154
|
-
/* @__PURE__ */
|
|
3193
|
+
const unitSpan = hasUnit ? /* @__PURE__ */ jsx30("span", { id: `${id}-unit`, className: "ui-field-number__unit", children: unit }) : null;
|
|
3194
|
+
return /* @__PURE__ */ jsx30(Frame, { ...{ id, label, hint, error, required }, children: glyph ? /* @__PURE__ */ jsxs25("div", { className: `ui-input-group${hasUnit ? " ui-field-number" : ""}`, children: [
|
|
3195
|
+
/* @__PURE__ */ jsx30("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon5(glyph) } }),
|
|
3155
3196
|
control,
|
|
3156
3197
|
unitSpan
|
|
3157
|
-
] }) : hasUnit ? /* @__PURE__ */
|
|
3198
|
+
] }) : hasUnit ? /* @__PURE__ */ jsxs25("div", { className: "ui-field-number", children: [
|
|
3158
3199
|
control,
|
|
3159
3200
|
unitSpan
|
|
3160
3201
|
] }) : control });
|
|
3161
3202
|
});
|
|
3162
3203
|
function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
3163
3204
|
const id = useId10();
|
|
3164
|
-
return /* @__PURE__ */
|
|
3205
|
+
return /* @__PURE__ */ jsx30(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx30(
|
|
3165
3206
|
"textarea",
|
|
3166
3207
|
{
|
|
3167
3208
|
rows: 4,
|
|
@@ -3174,7 +3215,7 @@ function TextArea({ label, hint, error, required, className = "", ...props }) {
|
|
|
3174
3215
|
}
|
|
3175
3216
|
function SelectField({ label, hint, error, required, className = "", children, ...props }) {
|
|
3176
3217
|
const id = useId10();
|
|
3177
|
-
return /* @__PURE__ */
|
|
3218
|
+
return /* @__PURE__ */ jsx30(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsx30(
|
|
3178
3219
|
"select",
|
|
3179
3220
|
{
|
|
3180
3221
|
...props,
|
|
@@ -3188,8 +3229,8 @@ function SelectField({ label, hint, error, required, className = "", children, .
|
|
|
3188
3229
|
function FileField({ label, hint, error, required, disabled, onFileChange, className = "", ...props }) {
|
|
3189
3230
|
const id = useId10();
|
|
3190
3231
|
const input = useRef16(null);
|
|
3191
|
-
const [file, setFile] =
|
|
3192
|
-
const [dragging, setDragging] =
|
|
3232
|
+
const [file, setFile] = useState11(null);
|
|
3233
|
+
const [dragging, setDragging] = useState11(false);
|
|
3193
3234
|
useEffect11(() => {
|
|
3194
3235
|
const form = input.current?.form;
|
|
3195
3236
|
const reset = () => {
|
|
@@ -3203,7 +3244,7 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3203
3244
|
setFile(next);
|
|
3204
3245
|
onFileChange?.(next);
|
|
3205
3246
|
};
|
|
3206
|
-
return /* @__PURE__ */
|
|
3247
|
+
return /* @__PURE__ */ jsx30(Frame, { ...{ id, label, hint, error, required }, children: /* @__PURE__ */ jsxs25(
|
|
3207
3248
|
"div",
|
|
3208
3249
|
{
|
|
3209
3250
|
className: `ui-file${dragging && !disabled ? " is-dragging" : ""}${file ? " has-file" : ""}${error ? " is-invalid" : ""}${disabled ? " is-disabled" : ""}`,
|
|
@@ -3224,12 +3265,12 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3224
3265
|
update(transfer.files[0]);
|
|
3225
3266
|
},
|
|
3226
3267
|
children: [
|
|
3227
|
-
/* @__PURE__ */
|
|
3228
|
-
/* @__PURE__ */
|
|
3229
|
-
/* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3231
|
-
/* @__PURE__ */
|
|
3232
|
-
/* @__PURE__ */
|
|
3268
|
+
/* @__PURE__ */ jsx30("span", { className: "ui-file__glyph", children: /* @__PURE__ */ jsx30(Icon, { name: "upload" }) }),
|
|
3269
|
+
/* @__PURE__ */ jsx30("div", { "aria-live": "polite", children: file ? file.name : "Drop a file here" }),
|
|
3270
|
+
/* @__PURE__ */ jsx30("div", { children: "or choose one from your device" }),
|
|
3271
|
+
/* @__PURE__ */ jsxs25("span", { className: "ui-file__choose", children: [
|
|
3272
|
+
/* @__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" }),
|
|
3273
|
+
/* @__PURE__ */ jsx30(
|
|
3233
3274
|
"input",
|
|
3234
3275
|
{
|
|
3235
3276
|
...props,
|
|
@@ -3249,8 +3290,8 @@ function FileField({ label, hint, error, required, disabled, onFileChange, class
|
|
|
3249
3290
|
}
|
|
3250
3291
|
|
|
3251
3292
|
// src/FileDrop.tsx
|
|
3252
|
-
import { useRef as useRef17, useState as
|
|
3253
|
-
import { Fragment as Fragment10, jsx as
|
|
3293
|
+
import { useRef as useRef17, useState as useState12 } from "react";
|
|
3294
|
+
import { Fragment as Fragment10, jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3254
3295
|
var MARKS = {
|
|
3255
3296
|
uploading: "clock",
|
|
3256
3297
|
done: "circleCheck",
|
|
@@ -3284,7 +3325,7 @@ function FileDrop({
|
|
|
3284
3325
|
className
|
|
3285
3326
|
}) {
|
|
3286
3327
|
const input = useRef17(null);
|
|
3287
|
-
const [over, setOver] =
|
|
3328
|
+
const [over, setOver] = useState12(false);
|
|
3288
3329
|
const status = file?.status ?? "uploading";
|
|
3289
3330
|
const word = status === "error" ? file?.error ?? WORDS.error : file?.state ?? WORDS[status];
|
|
3290
3331
|
const [stem, ext] = splitName(file?.name ?? "");
|
|
@@ -3295,7 +3336,7 @@ function FileDrop({
|
|
|
3295
3336
|
const take = (chosen) => {
|
|
3296
3337
|
if (chosen && !disabled) onFile?.(chosen);
|
|
3297
3338
|
};
|
|
3298
|
-
return /* @__PURE__ */
|
|
3339
|
+
return /* @__PURE__ */ jsxs26(
|
|
3299
3340
|
"div",
|
|
3300
3341
|
{
|
|
3301
3342
|
className: cx7("ui-drop", disabled && "is-disabled", className),
|
|
@@ -3315,16 +3356,16 @@ function FileDrop({
|
|
|
3315
3356
|
},
|
|
3316
3357
|
children: [
|
|
3317
3358
|
children,
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
file ? /* @__PURE__ */
|
|
3320
|
-
/* @__PURE__ */
|
|
3321
|
-
/* @__PURE__ */
|
|
3322
|
-
/* @__PURE__ */
|
|
3323
|
-
/* @__PURE__ */
|
|
3359
|
+
/* @__PURE__ */ jsxs26("div", { className: "ui-drop__row", children: [
|
|
3360
|
+
file ? /* @__PURE__ */ jsxs26("div", { className: cx7("ui-drop__file", status === "error" && "ui-drop__file--failed"), children: [
|
|
3361
|
+
/* @__PURE__ */ jsxs26("div", { className: "ui-drop__line", children: [
|
|
3362
|
+
/* @__PURE__ */ jsxs26("span", { className: "ui-drop__name", title: file.name, children: [
|
|
3363
|
+
/* @__PURE__ */ jsx31("span", { className: "ui-drop__stem", children: stem }),
|
|
3364
|
+
/* @__PURE__ */ jsx31("span", { className: "ui-drop__ext", children: ext })
|
|
3324
3365
|
] }),
|
|
3325
|
-
(onRemove || status === "error" && onRetry) && /* @__PURE__ */
|
|
3326
|
-
status === "error" && onRetry && /* @__PURE__ */
|
|
3327
|
-
onRemove && /* @__PURE__ */
|
|
3366
|
+
(onRemove || status === "error" && onRetry) && /* @__PURE__ */ jsxs26("span", { className: "ui-drop__actions", children: [
|
|
3367
|
+
status === "error" && onRetry && /* @__PURE__ */ jsx31(Button, { size: "sm", icon: "refresh", onClick: onRetry, disabled, children: retryLabel }),
|
|
3368
|
+
onRemove && /* @__PURE__ */ jsx31(
|
|
3328
3369
|
Button,
|
|
3329
3370
|
{
|
|
3330
3371
|
variant: "ghost",
|
|
@@ -3336,21 +3377,21 @@ function FileDrop({
|
|
|
3336
3377
|
)
|
|
3337
3378
|
] })
|
|
3338
3379
|
] }),
|
|
3339
|
-
(showSize || showWord) && /* @__PURE__ */
|
|
3380
|
+
(showSize || showWord) && /* @__PURE__ */ jsxs26(
|
|
3340
3381
|
"div",
|
|
3341
3382
|
{
|
|
3342
3383
|
className: cx7("ui-drop__facts", status === "error" && "ui-drop__error"),
|
|
3343
3384
|
role: status === "error" ? "alert" : void 0,
|
|
3344
3385
|
children: [
|
|
3345
|
-
showSize && /* @__PURE__ */
|
|
3346
|
-
showWord && /* @__PURE__ */
|
|
3347
|
-
/* @__PURE__ */
|
|
3348
|
-
/* @__PURE__ */
|
|
3386
|
+
showSize && /* @__PURE__ */ jsx31("span", { className: "ui-drop__size", children: file.size }),
|
|
3387
|
+
showWord && /* @__PURE__ */ jsxs26("span", { className: "ui-drop__state", children: [
|
|
3388
|
+
/* @__PURE__ */ jsx31(Icon, { name: MARKS[status] }),
|
|
3389
|
+
/* @__PURE__ */ jsx31("span", { className: "ui-drop__word", title: word, children: word })
|
|
3349
3390
|
] })
|
|
3350
3391
|
]
|
|
3351
3392
|
}
|
|
3352
3393
|
),
|
|
3353
|
-
hasBar && /* @__PURE__ */
|
|
3394
|
+
hasBar && /* @__PURE__ */ jsx31(
|
|
3354
3395
|
"span",
|
|
3355
3396
|
{
|
|
3356
3397
|
className: "ui-drop__bar",
|
|
@@ -3359,11 +3400,11 @@ function FileDrop({
|
|
|
3359
3400
|
"aria-valuenow": file.progress,
|
|
3360
3401
|
"aria-valuemin": 0,
|
|
3361
3402
|
"aria-valuemax": 100,
|
|
3362
|
-
children: /* @__PURE__ */
|
|
3403
|
+
children: /* @__PURE__ */ jsx31("span", { style: { width: `${file.progress}%` } })
|
|
3363
3404
|
}
|
|
3364
3405
|
)
|
|
3365
|
-
] }) : /* @__PURE__ */
|
|
3366
|
-
/* @__PURE__ */
|
|
3406
|
+
] }) : /* @__PURE__ */ jsxs26(Fragment10, { children: [
|
|
3407
|
+
/* @__PURE__ */ jsx31(
|
|
3367
3408
|
Button,
|
|
3368
3409
|
{
|
|
3369
3410
|
size: "sm",
|
|
@@ -3373,9 +3414,9 @@ function FileDrop({
|
|
|
3373
3414
|
children: label
|
|
3374
3415
|
}
|
|
3375
3416
|
),
|
|
3376
|
-
note && /* @__PURE__ */
|
|
3417
|
+
note && /* @__PURE__ */ jsx31("p", { className: "ui-drop__note", children: note })
|
|
3377
3418
|
] }),
|
|
3378
|
-
/* @__PURE__ */
|
|
3419
|
+
/* @__PURE__ */ jsx31(
|
|
3379
3420
|
"input",
|
|
3380
3421
|
{
|
|
3381
3422
|
ref: input,
|
|
@@ -3391,7 +3432,7 @@ function FileDrop({
|
|
|
3391
3432
|
}
|
|
3392
3433
|
)
|
|
3393
3434
|
] }),
|
|
3394
|
-
showTarget && /* @__PURE__ */
|
|
3435
|
+
showTarget && /* @__PURE__ */ jsx31("div", { className: "ui-drop__target", "aria-hidden": "true", children: dropLabel })
|
|
3395
3436
|
]
|
|
3396
3437
|
}
|
|
3397
3438
|
);
|
|
@@ -3399,12 +3440,12 @@ function FileDrop({
|
|
|
3399
3440
|
|
|
3400
3441
|
// src/SearchField.tsx
|
|
3401
3442
|
import { forwardRef as forwardRef7 } from "react";
|
|
3402
|
-
import { icon as
|
|
3403
|
-
import { jsx as
|
|
3443
|
+
import { icon as icon6 } from "@apliteni/apliteni-ui";
|
|
3444
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3404
3445
|
var SearchField = forwardRef7(function SearchField2({ ariaLabel, className, ...props }, ref) {
|
|
3405
|
-
return /* @__PURE__ */
|
|
3406
|
-
/* @__PURE__ */
|
|
3407
|
-
/* @__PURE__ */
|
|
3446
|
+
return /* @__PURE__ */ jsxs27("div", { className: "ui-input-group", children: [
|
|
3447
|
+
/* @__PURE__ */ jsx32("span", { className: "ui-input-group__icon", dangerouslySetInnerHTML: { __html: icon6("search") } }),
|
|
3448
|
+
/* @__PURE__ */ jsx32(
|
|
3408
3449
|
"input",
|
|
3409
3450
|
{
|
|
3410
3451
|
ref,
|
|
@@ -3418,9 +3459,9 @@ var SearchField = forwardRef7(function SearchField2({ ariaLabel, className, ...p
|
|
|
3418
3459
|
});
|
|
3419
3460
|
|
|
3420
3461
|
// src/Toast.tsx
|
|
3421
|
-
import { createContext as createContext3, useCallback as
|
|
3462
|
+
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
3463
|
import { createPortal as createPortal4 } from "react-dom";
|
|
3423
|
-
import { jsx as
|
|
3464
|
+
import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
3424
3465
|
var Context = createContext3(null);
|
|
3425
3466
|
var glyphs = { success: "circleCheck", danger: "circleX", warn: "circleAlert", info: "info", neutral: "bolt" };
|
|
3426
3467
|
function useToast() {
|
|
@@ -3430,14 +3471,16 @@ function useToast() {
|
|
|
3430
3471
|
}
|
|
3431
3472
|
function Notice({ notice, remove }) {
|
|
3432
3473
|
const root = useRef18(null);
|
|
3433
|
-
const [leaving2, setLeaving] =
|
|
3474
|
+
const [leaving2, setLeaving] = useState13(false);
|
|
3434
3475
|
const dismissed = useRef18(false);
|
|
3435
|
-
const
|
|
3436
|
-
const [
|
|
3437
|
-
const [focused, setFocused] = useState12(false);
|
|
3476
|
+
const [hovered, setHovered] = useState13(false);
|
|
3477
|
+
const [focused, setFocused] = useState13(false);
|
|
3438
3478
|
const paused = hovered || focused;
|
|
3439
3479
|
const tone = notice.tone ?? "success";
|
|
3440
|
-
const
|
|
3480
|
+
const timed = !notice.action && notice.timer !== false && notice.timer !== 0;
|
|
3481
|
+
const duration = typeof notice.timer === "number" ? notice.timer * 1e3 : 5e3;
|
|
3482
|
+
const remaining = useRef18(duration);
|
|
3483
|
+
const dismiss = useCallback6(() => {
|
|
3441
3484
|
if (dismissed.current) return;
|
|
3442
3485
|
dismissed.current = true;
|
|
3443
3486
|
if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches) remove();
|
|
@@ -3458,19 +3501,19 @@ function Notice({ notice, remove }) {
|
|
|
3458
3501
|
}
|
|
3459
3502
|
}, [leaving2, remove]);
|
|
3460
3503
|
useEffect12(() => {
|
|
3461
|
-
if (leaving2 ||
|
|
3504
|
+
if (leaving2 || !timed || paused) return;
|
|
3462
3505
|
const started = Date.now();
|
|
3463
3506
|
const timer = setTimeout(dismiss, remaining.current);
|
|
3464
3507
|
return () => {
|
|
3465
3508
|
clearTimeout(timer);
|
|
3466
3509
|
remaining.current = Math.max(0, remaining.current - (Date.now() - started));
|
|
3467
3510
|
};
|
|
3468
|
-
}, [dismiss, leaving2,
|
|
3469
|
-
return /* @__PURE__ */
|
|
3511
|
+
}, [dismiss, leaving2, paused, timed]);
|
|
3512
|
+
return /* @__PURE__ */ jsxs28(
|
|
3470
3513
|
"div",
|
|
3471
3514
|
{
|
|
3472
3515
|
ref: root,
|
|
3473
|
-
className: `ui-toast ui-toast--${tone} ui-toast--soft${leaving2 ? " is-leaving" : ""}`,
|
|
3516
|
+
className: `ui-toast ui-toast--${tone} ui-toast--soft${notice.compact ? " ui-toast--compact" : ""}${leaving2 ? " is-leaving" : ""}`,
|
|
3474
3517
|
role: tone === "danger" ? "alert" : "status",
|
|
3475
3518
|
"aria-live": tone === "danger" ? "assertive" : "polite",
|
|
3476
3519
|
onMouseEnter: () => setHovered(true),
|
|
@@ -3480,12 +3523,12 @@ function Notice({ notice, remove }) {
|
|
|
3480
3523
|
if (!event.currentTarget.contains(event.relatedTarget)) setFocused(false);
|
|
3481
3524
|
},
|
|
3482
3525
|
children: [
|
|
3483
|
-
/* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
3485
|
-
/* @__PURE__ */
|
|
3486
|
-
notice.text && /* @__PURE__ */
|
|
3526
|
+
/* @__PURE__ */ jsx33("span", { className: "ui-toast__icon", children: /* @__PURE__ */ jsx33(Icon, { name: glyphs[tone] }) }),
|
|
3527
|
+
/* @__PURE__ */ jsxs28("div", { className: "ui-toast__body", children: [
|
|
3528
|
+
/* @__PURE__ */ jsx33("div", { className: "ui-toast__title", children: notice.title }),
|
|
3529
|
+
!notice.compact && notice.text && /* @__PURE__ */ jsx33("div", { className: "ui-toast__text", children: notice.text })
|
|
3487
3530
|
] }),
|
|
3488
|
-
notice.action && /* @__PURE__ */
|
|
3531
|
+
notice.action && /* @__PURE__ */ jsx33(
|
|
3489
3532
|
"button",
|
|
3490
3533
|
{
|
|
3491
3534
|
type: "button",
|
|
@@ -3500,13 +3543,13 @@ function Notice({ notice, remove }) {
|
|
|
3500
3543
|
children: notice.action.label
|
|
3501
3544
|
}
|
|
3502
3545
|
),
|
|
3503
|
-
/* @__PURE__ */
|
|
3504
|
-
|
|
3546
|
+
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" }) }),
|
|
3547
|
+
timed && /* @__PURE__ */ jsx33(
|
|
3505
3548
|
"span",
|
|
3506
3549
|
{
|
|
3507
3550
|
className: "ui-toast__timer is-running",
|
|
3508
3551
|
"aria-hidden": "true",
|
|
3509
|
-
style: { animationPlayState: paused ? "paused" : "running" }
|
|
3552
|
+
style: { animationDuration: `${duration}ms`, animationPlayState: paused ? "paused" : "running" }
|
|
3510
3553
|
}
|
|
3511
3554
|
)
|
|
3512
3555
|
]
|
|
@@ -3534,40 +3577,40 @@ function usePublishedReach(stack2, count) {
|
|
|
3534
3577
|
}, [stack2, count]);
|
|
3535
3578
|
}
|
|
3536
3579
|
function Toast({ children }) {
|
|
3537
|
-
const [entries, setEntries] =
|
|
3580
|
+
const [entries, setEntries] = useState13([]);
|
|
3538
3581
|
const nextId = useRef18(0);
|
|
3539
3582
|
const stack2 = useRef18(null);
|
|
3540
|
-
const push =
|
|
3583
|
+
const push = useCallback6((notice) => {
|
|
3541
3584
|
const id = nextId.current++;
|
|
3542
3585
|
const remove = () => setEntries((current) => current.filter((entry) => entry.id !== id));
|
|
3543
3586
|
setEntries((current) => [...current, { id, notice, remove }]);
|
|
3544
3587
|
}, []);
|
|
3545
3588
|
usePublishedReach(stack2, entries.length);
|
|
3546
|
-
return /* @__PURE__ */
|
|
3589
|
+
return /* @__PURE__ */ jsxs28(Context.Provider, { value: push, children: [
|
|
3547
3590
|
children,
|
|
3548
3591
|
typeof document !== "undefined" && createPortal4(
|
|
3549
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__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)) }),
|
|
3550
3593
|
document.body
|
|
3551
3594
|
)
|
|
3552
3595
|
] });
|
|
3553
3596
|
}
|
|
3554
3597
|
|
|
3555
3598
|
// src/AppShell.tsx
|
|
3556
|
-
import { useEffect as useEffect14, useId as useId12, useRef as useRef19, useState as
|
|
3599
|
+
import { useEffect as useEffect14, useId as useId12, useRef as useRef19, useState as useState15 } from "react";
|
|
3557
3600
|
import { paletteHotkey, prism, railCollapsed } from "@apliteni/apliteni-ui";
|
|
3558
3601
|
|
|
3559
3602
|
// src/SidebarNav.tsx
|
|
3560
|
-
import { forwardRef as forwardRef8, useEffect as useEffect13, useId as useId11, useState as
|
|
3603
|
+
import { forwardRef as forwardRef8, useEffect as useEffect13, useId as useId11, useState as useState14 } from "react";
|
|
3561
3604
|
import { ENTRANCE_FALLBACK_MS } from "@apliteni/apliteni-ui/motion";
|
|
3562
|
-
import { Fragment as Fragment11, jsx as
|
|
3605
|
+
import { Fragment as Fragment11, jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3563
3606
|
var badgeText = (badge) => typeof badge === "object" ? badge.text : badge;
|
|
3564
3607
|
function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
3565
3608
|
const uid = useId11();
|
|
3566
3609
|
const group = !sub && !!item.items?.length;
|
|
3567
3610
|
const childActive = group && item.items.some((child) => child.id === active);
|
|
3568
|
-
const [expanded, setExpanded] =
|
|
3611
|
+
const [expanded, setExpanded] = useState14();
|
|
3569
3612
|
const open = expanded ?? item.defaultOpen ?? childActive;
|
|
3570
|
-
const [entering, setEntering] =
|
|
3613
|
+
const [entering, setEntering] = useState14(false);
|
|
3571
3614
|
useEffect13(() => {
|
|
3572
3615
|
if (!entering) return;
|
|
3573
3616
|
const timer = setTimeout(() => setEntering(false), ENTRANCE_FALLBACK_MS);
|
|
@@ -3585,15 +3628,15 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
3585
3628
|
item.disabled && "is-disabled",
|
|
3586
3629
|
item.danger && "is-danger"
|
|
3587
3630
|
].filter(Boolean).join(" ");
|
|
3588
|
-
const children = /* @__PURE__ */
|
|
3589
|
-
(item.leading ?? item.icon) && /* @__PURE__ */
|
|
3590
|
-
/* @__PURE__ */
|
|
3591
|
-
count != null && count !== "" && /* @__PURE__ */
|
|
3592
|
-
group && /* @__PURE__ */
|
|
3631
|
+
const children = /* @__PURE__ */ jsxs29(Fragment11, { children: [
|
|
3632
|
+
(item.leading ?? item.icon) && /* @__PURE__ */ jsx34("span", { className: "ui-nav__ic", children: item.leading ?? /* @__PURE__ */ jsx34(Icon, { name: item.icon }) }),
|
|
3633
|
+
/* @__PURE__ */ jsx34("span", { className: "ui-nav__label", children: item.label }),
|
|
3634
|
+
count != null && count !== "" && /* @__PURE__ */ jsx34("span", { className: `ui-nav__badge is-${typeof item.badge === "object" ? item.badge.tone ?? "neutral" : "neutral"}`, children: count }),
|
|
3635
|
+
group && /* @__PURE__ */ jsx34("span", { className: "ui-nav__caret", "aria-hidden": "true" })
|
|
3593
3636
|
] });
|
|
3594
3637
|
const common = { className, "aria-label": name, title: collapsed ? name : void 0, children };
|
|
3595
|
-
if (group) return /* @__PURE__ */
|
|
3596
|
-
/* @__PURE__ */
|
|
3638
|
+
if (group) return /* @__PURE__ */ jsxs29("li", { className: `ui-nav__group${open ? " is-open" : ""}`, children: [
|
|
3639
|
+
/* @__PURE__ */ jsx34(
|
|
3597
3640
|
"button",
|
|
3598
3641
|
{
|
|
3599
3642
|
...common,
|
|
@@ -3607,22 +3650,22 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
3607
3650
|
}
|
|
3608
3651
|
}
|
|
3609
3652
|
),
|
|
3610
|
-
/* @__PURE__ */
|
|
3653
|
+
/* @__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)) })
|
|
3611
3654
|
] });
|
|
3612
|
-
if (item.disabled) return /* @__PURE__ */
|
|
3655
|
+
if (item.disabled) return /* @__PURE__ */ jsx34("li", { children: /* @__PURE__ */ jsx34("span", { ...common, role: "link", "aria-disabled": "true" }) });
|
|
3613
3656
|
const props = {
|
|
3614
3657
|
...common,
|
|
3615
3658
|
href: item.href ?? `#${item.id}`,
|
|
3616
3659
|
target: item.target,
|
|
3617
3660
|
"aria-current": isActive ? activeIs === "section" ? "true" : "page" : void 0
|
|
3618
3661
|
};
|
|
3619
|
-
return /* @__PURE__ */
|
|
3662
|
+
return /* @__PURE__ */ jsx34("li", { children: renderLink ? renderLink(item, props) : /* @__PURE__ */ jsx34("a", { ...props }) });
|
|
3620
3663
|
}
|
|
3621
3664
|
function Section({ section, ...props }) {
|
|
3622
3665
|
const uid = useId11();
|
|
3623
|
-
return /* @__PURE__ */
|
|
3624
|
-
section.label && /* @__PURE__ */
|
|
3625
|
-
/* @__PURE__ */
|
|
3666
|
+
return /* @__PURE__ */ jsxs29("div", { className: "ui-nav__section", children: [
|
|
3667
|
+
section.label && /* @__PURE__ */ jsx34("div", { className: "ui-nav__cap", id: uid, "aria-hidden": props.collapsed || void 0, children: section.label }),
|
|
3668
|
+
/* @__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)) })
|
|
3626
3669
|
] });
|
|
3627
3670
|
}
|
|
3628
3671
|
var SidebarNav = forwardRef8(function SidebarNav2({
|
|
@@ -3637,8 +3680,8 @@ var SidebarNav = forwardRef8(function SidebarNav2({
|
|
|
3637
3680
|
"aria-label": label = "Sidebar",
|
|
3638
3681
|
...rest
|
|
3639
3682
|
}, ref) {
|
|
3640
|
-
return /* @__PURE__ */
|
|
3641
|
-
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */
|
|
3683
|
+
return /* @__PURE__ */ jsxs29("nav", { ...rest, ref, "aria-label": label, className: ["ui-nav", "ui-nav--side", collapsed && "is-collapsed", className].filter(Boolean).join(" "), children: [
|
|
3684
|
+
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */ jsx34(
|
|
3642
3685
|
Section,
|
|
3643
3686
|
{
|
|
3644
3687
|
section,
|
|
@@ -3649,14 +3692,14 @@ var SidebarNav = forwardRef8(function SidebarNav2({
|
|
|
3649
3692
|
},
|
|
3650
3693
|
index
|
|
3651
3694
|
)),
|
|
3652
|
-
footer && /* @__PURE__ */
|
|
3695
|
+
footer && /* @__PURE__ */ jsx34("div", { className: "ui-nav__foot", children: footer })
|
|
3653
3696
|
] });
|
|
3654
3697
|
});
|
|
3655
3698
|
|
|
3656
3699
|
// src/ThemeToggle.tsx
|
|
3657
3700
|
import { useSyncExternalStore } from "react";
|
|
3658
3701
|
import { themeIcon } from "@apliteni/apliteni-ui";
|
|
3659
|
-
import { jsx as
|
|
3702
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3660
3703
|
var STORAGE_KEY = "apliteni-strategy-theme";
|
|
3661
3704
|
var CHOICE_EVENT = "apliteni-theme-choice";
|
|
3662
3705
|
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')})()`;
|
|
@@ -3714,10 +3757,10 @@ function ThemeToggle({ labelled = false }) {
|
|
|
3714
3757
|
}
|
|
3715
3758
|
window.dispatchEvent(new Event(CHOICE_EVENT));
|
|
3716
3759
|
};
|
|
3717
|
-
const button = /* @__PURE__ */
|
|
3718
|
-
return labelled ? /* @__PURE__ */
|
|
3760
|
+
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) } }) });
|
|
3761
|
+
return labelled ? /* @__PURE__ */ jsxs30("span", { className: "ui-theme-toggle", children: [
|
|
3719
3762
|
button,
|
|
3720
|
-
/* @__PURE__ */
|
|
3763
|
+
/* @__PURE__ */ jsxs30("span", { children: [
|
|
3721
3764
|
label,
|
|
3722
3765
|
" theme"
|
|
3723
3766
|
] })
|
|
@@ -3725,7 +3768,7 @@ function ThemeToggle({ labelled = false }) {
|
|
|
3725
3768
|
}
|
|
3726
3769
|
|
|
3727
3770
|
// src/AppShell.tsx
|
|
3728
|
-
import { Fragment as Fragment12, jsx as
|
|
3771
|
+
import { Fragment as Fragment12, jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3729
3772
|
var path = (value) => value.split(/[?#]/)[0].replace(/\/+$/, "") || "/";
|
|
3730
3773
|
function AppShell({
|
|
3731
3774
|
sections,
|
|
@@ -3749,9 +3792,9 @@ function AppShell({
|
|
|
3749
3792
|
renderLink
|
|
3750
3793
|
}) {
|
|
3751
3794
|
const uid = useId12();
|
|
3752
|
-
const [collapsed, setCollapsed] =
|
|
3753
|
-
const [search, setSearch] =
|
|
3754
|
-
const [menu, setMenu] =
|
|
3795
|
+
const [collapsed, setCollapsed] = useState15(defaultCollapsed);
|
|
3796
|
+
const [search, setSearch] = useState15(false);
|
|
3797
|
+
const [menu, setMenu] = useState15(false);
|
|
3755
3798
|
const menuButton = useRef19(null);
|
|
3756
3799
|
const current = path(pathname);
|
|
3757
3800
|
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];
|
|
@@ -3790,7 +3833,7 @@ function AppShell({
|
|
|
3790
3833
|
} catch {
|
|
3791
3834
|
}
|
|
3792
3835
|
};
|
|
3793
|
-
const sidebar = (label) => /* @__PURE__ */
|
|
3836
|
+
const sidebar = (label) => /* @__PURE__ */ jsx36(
|
|
3794
3837
|
SidebarNav,
|
|
3795
3838
|
{
|
|
3796
3839
|
"aria-label": label,
|
|
@@ -3802,34 +3845,33 @@ function AppShell({
|
|
|
3802
3845
|
const linkProps = { ...props, onClick: (event) => {
|
|
3803
3846
|
if (!event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) setMenu(false);
|
|
3804
3847
|
} };
|
|
3805
|
-
return renderLink ? renderLink(section, linkProps) : /* @__PURE__ */
|
|
3848
|
+
return renderLink ? renderLink(section, linkProps) : /* @__PURE__ */ jsx36("a", { ...linkProps });
|
|
3806
3849
|
}
|
|
3807
3850
|
}
|
|
3808
3851
|
);
|
|
3809
3852
|
const foldLabel = collapsed ? "Expand sidebar" : "Collapse sidebar";
|
|
3810
3853
|
const navigable = sections.length > 1 || Boolean(back);
|
|
3811
|
-
const
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
/* @__PURE__ */ jsx35("span", { children: word })
|
|
3854
|
+
const lockup = /* @__PURE__ */ jsxs31("a", { className: "ui-app__brand", href: brandHref, "aria-label": word, children: [
|
|
3855
|
+
brand ?? /* @__PURE__ */ jsx36("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(uid, 24) } }),
|
|
3856
|
+
/* @__PURE__ */ jsx36("span", { children: word })
|
|
3815
3857
|
] });
|
|
3816
|
-
return /* @__PURE__ */
|
|
3817
|
-
navigable && /* @__PURE__ */
|
|
3818
|
-
/* @__PURE__ */
|
|
3858
|
+
return /* @__PURE__ */ jsxs31("div", { className: `ui-app ui-app--topbar ui-react-app${collapsed ? " is-collapsed" : ""}`, children: [
|
|
3859
|
+
navigable && /* @__PURE__ */ jsxs31("div", { className: "ui-app__rail", role: "region", "aria-label": "Sidebar", children: [
|
|
3860
|
+
/* @__PURE__ */ jsx36("div", { className: "ui-app__head", children: lockup }),
|
|
3819
3861
|
sidebar("Sections"),
|
|
3820
|
-
/* @__PURE__ */
|
|
3821
|
-
/* @__PURE__ */
|
|
3822
|
-
/* @__PURE__ */
|
|
3823
|
-
/* @__PURE__ */
|
|
3824
|
-
/* @__PURE__ */
|
|
3862
|
+
/* @__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: [
|
|
3863
|
+
/* @__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: [
|
|
3864
|
+
/* @__PURE__ */ jsx36("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
3865
|
+
/* @__PURE__ */ jsx36("path", { className: "ui-app__fold-seam", d: "M9 3v18" }),
|
|
3866
|
+
/* @__PURE__ */ jsx36("path", { className: "ui-app__fold-arrow", d: "m16 15-3-3 3-3" })
|
|
3825
3867
|
] }) }),
|
|
3826
|
-
/* @__PURE__ */
|
|
3868
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-nav__label", children: foldLabel })
|
|
3827
3869
|
] }) }) })
|
|
3828
3870
|
] }),
|
|
3829
|
-
/* @__PURE__ */
|
|
3830
|
-
/* @__PURE__ */
|
|
3831
|
-
navigable && /* @__PURE__ */
|
|
3832
|
-
/* @__PURE__ */
|
|
3871
|
+
/* @__PURE__ */ jsxs31("div", { className: "ui-app__well", children: [
|
|
3872
|
+
/* @__PURE__ */ jsxs31("header", { className: "ui-app__bar", children: [
|
|
3873
|
+
navigable && /* @__PURE__ */ jsxs31(Fragment12, { children: [
|
|
3874
|
+
/* @__PURE__ */ jsx36(
|
|
3833
3875
|
Button,
|
|
3834
3876
|
{
|
|
3835
3877
|
ref: menuButton,
|
|
@@ -3843,19 +3885,19 @@ function AppShell({
|
|
|
3843
3885
|
onClick: () => setMenu(true)
|
|
3844
3886
|
}
|
|
3845
3887
|
),
|
|
3846
|
-
/* @__PURE__ */
|
|
3888
|
+
/* @__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) } }) })
|
|
3847
3889
|
] }),
|
|
3848
3890
|
!navigable && lockup,
|
|
3849
|
-
/* @__PURE__ */
|
|
3850
|
-
/* @__PURE__ */
|
|
3851
|
-
/* @__PURE__ */
|
|
3852
|
-
/* @__PURE__ */
|
|
3853
|
-
/* @__PURE__ */
|
|
3891
|
+
/* @__PURE__ */ jsxs31("button", { type: "button", className: "ui-app__search", "aria-haspopup": "dialog", onClick: () => setSearch(true), children: [
|
|
3892
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-app__search-ic", children: /* @__PURE__ */ jsx36(Icon, { name: "search" }) }),
|
|
3893
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-app__search-txt", children: searchLabel }),
|
|
3894
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-app__search-short", "aria-hidden": "true", children: searchShortLabel }),
|
|
3895
|
+
/* @__PURE__ */ jsx36("kbd", { className: "ui-cmdk__key", children: paletteHotkey() })
|
|
3854
3896
|
] }),
|
|
3855
|
-
/* @__PURE__ */
|
|
3856
|
-
bandControl && /* @__PURE__ */
|
|
3857
|
-
/* @__PURE__ */
|
|
3858
|
-
/* @__PURE__ */
|
|
3897
|
+
/* @__PURE__ */ jsx36("span", { className: "ui-app__bar-gap" }),
|
|
3898
|
+
bandControl && /* @__PURE__ */ jsx36("span", { className: "ui-react-app__band-control", children: bandControl }),
|
|
3899
|
+
/* @__PURE__ */ jsx36(ThemeToggle, {}),
|
|
3900
|
+
/* @__PURE__ */ jsx36("div", { className: "ui-app__user ui-app__user--bar", children: /* @__PURE__ */ jsx36(
|
|
3859
3901
|
Dropdown,
|
|
3860
3902
|
{
|
|
3861
3903
|
variant: "menu",
|
|
@@ -3864,57 +3906,57 @@ function AppShell({
|
|
|
3864
3906
|
ariaLabel: `Signed in as ${account.name}, ${account.email}`,
|
|
3865
3907
|
triggerClass: "ui-app__user-trigger",
|
|
3866
3908
|
panelClass: "ui-app__user-panel",
|
|
3867
|
-
triggerContent: /* @__PURE__ */
|
|
3868
|
-
header: /* @__PURE__ */
|
|
3869
|
-
/* @__PURE__ */
|
|
3870
|
-
/* @__PURE__ */
|
|
3909
|
+
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 }) }),
|
|
3910
|
+
header: /* @__PURE__ */ jsxs31("div", { className: "ui-dropdown__head", children: [
|
|
3911
|
+
/* @__PURE__ */ jsx36("b", { children: account.name }),
|
|
3912
|
+
/* @__PURE__ */ jsx36("span", { children: account.email })
|
|
3871
3913
|
] }),
|
|
3872
3914
|
items: [{ label: "Sign out", icon: "logout", danger: true }],
|
|
3873
3915
|
onSelect: onSignOut
|
|
3874
3916
|
}
|
|
3875
3917
|
) })
|
|
3876
3918
|
] }),
|
|
3877
|
-
/* @__PURE__ */
|
|
3878
|
-
back && /* @__PURE__ */
|
|
3879
|
-
/* @__PURE__ */
|
|
3880
|
-
lede && /* @__PURE__ */
|
|
3881
|
-
actions && /* @__PURE__ */
|
|
3882
|
-
/* @__PURE__ */
|
|
3919
|
+
/* @__PURE__ */ jsxs31("main", { className: `ui-app__main${width === "wide" ? " ui-app__main--wide" : ""}`, children: [
|
|
3920
|
+
back && /* @__PURE__ */ jsx36(BackLink, { ...back }),
|
|
3921
|
+
/* @__PURE__ */ jsx36("h1", { children: title }),
|
|
3922
|
+
lede && /* @__PURE__ */ jsx36("p", { className: "ui-app__sub", children: lede }),
|
|
3923
|
+
actions && /* @__PURE__ */ jsx36("div", { className: "ui-react-app__actions", children: actions }),
|
|
3924
|
+
/* @__PURE__ */ jsx36("div", { className: "ui-app__body", children })
|
|
3883
3925
|
] })
|
|
3884
3926
|
] }),
|
|
3885
|
-
navigable && /* @__PURE__ */
|
|
3886
|
-
/* @__PURE__ */
|
|
3927
|
+
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") }) }),
|
|
3928
|
+
/* @__PURE__ */ jsx36(CommandPalette, { ...palette ?? { groups: [{ items: sections.map((section) => ({ id: section.href, ...section })) }] }, open: search, onClose: () => setSearch(false) })
|
|
3887
3929
|
] });
|
|
3888
3930
|
}
|
|
3889
3931
|
|
|
3890
3932
|
// src/EmptyState.tsx
|
|
3891
3933
|
import { icon as kitIcon2, illo } from "@apliteni/apliteni-ui";
|
|
3892
|
-
import { jsx as
|
|
3934
|
+
import { jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3893
3935
|
var cases = {
|
|
3894
3936
|
"first-run": { title: "Nothing needs you yet", sub: "New items will appear here when they need your attention.", icon: "check" },
|
|
3895
3937
|
"no-matches": { title: "No results in this view", sub: "Try another search or clear your filters.", icon: "search" },
|
|
3896
3938
|
"not-found": { title: "We can't find that page", sub: "Check the address or return to the home page.", icon: "folder" },
|
|
3897
3939
|
"not-yet-built": { title: "This ships later", sub: "This screen is not available yet. Check back later.", icon: "clock" }
|
|
3898
3940
|
};
|
|
3899
|
-
function EmptyState({ variant = "first-run", title, sub, icon:
|
|
3941
|
+
function EmptyState({ variant = "first-run", title, sub, icon: icon8, art, actions }) {
|
|
3900
3942
|
const preset = cases[variant];
|
|
3901
3943
|
const heading = title ?? preset.title;
|
|
3902
3944
|
const guidance = sub ?? preset.sub;
|
|
3903
|
-
const glyph =
|
|
3904
|
-
return /* @__PURE__ */
|
|
3905
|
-
art ? typeof art === "string" ? /* @__PURE__ */
|
|
3906
|
-
heading && /* @__PURE__ */
|
|
3907
|
-
guidance && /* @__PURE__ */
|
|
3908
|
-
actions && /* @__PURE__ */
|
|
3945
|
+
const glyph = icon8 ?? preset.icon;
|
|
3946
|
+
return /* @__PURE__ */ jsxs32("div", { className: "ui-empty", children: [
|
|
3947
|
+
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,
|
|
3948
|
+
heading && /* @__PURE__ */ jsx37("div", { className: "ui-empty__title", children: heading }),
|
|
3949
|
+
guidance && /* @__PURE__ */ jsx37("div", { className: "ui-empty__sub", children: guidance }),
|
|
3950
|
+
actions && /* @__PURE__ */ jsx37("div", { className: "ui-empty__actions", children: actions })
|
|
3909
3951
|
] });
|
|
3910
3952
|
}
|
|
3911
3953
|
|
|
3912
3954
|
// src/Success.tsx
|
|
3913
|
-
import { forwardRef as forwardRef9, useEffect as useEffect15, useRef as useRef20, useState as
|
|
3914
|
-
import { jsx as
|
|
3955
|
+
import { forwardRef as forwardRef9, useEffect as useEffect15, useRef as useRef20, useState as useState16 } from "react";
|
|
3956
|
+
import { jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3915
3957
|
var SuccessCheck = forwardRef9(function SuccessCheck2({ variant = "line", className, ...rest }, ref) {
|
|
3916
3958
|
const circled = variant === "circled";
|
|
3917
|
-
return /* @__PURE__ */
|
|
3959
|
+
return /* @__PURE__ */ jsxs33(
|
|
3918
3960
|
"svg",
|
|
3919
3961
|
{
|
|
3920
3962
|
...rest,
|
|
@@ -3926,18 +3968,18 @@ var SuccessCheck = forwardRef9(function SuccessCheck2({ variant = "line", classN
|
|
|
3926
3968
|
"aria-hidden": "true",
|
|
3927
3969
|
focusable: "false",
|
|
3928
3970
|
children: [
|
|
3929
|
-
circled && /* @__PURE__ */
|
|
3930
|
-
/* @__PURE__ */
|
|
3971
|
+
circled && /* @__PURE__ */ jsx38("path", { className: "ui-sx__circle", d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
3972
|
+
/* @__PURE__ */ jsx38("path", { className: "ui-sx__tick", d: circled ? "M22 4L12 14.01l-3-3" : "M20 6L9 17l-5-5" })
|
|
3931
3973
|
]
|
|
3932
3974
|
}
|
|
3933
3975
|
);
|
|
3934
3976
|
});
|
|
3935
3977
|
var SuccessPanel = forwardRef9(function SuccessPanel2({ title = "Done", sub, check = "line", className, ...rest }, ref) {
|
|
3936
3978
|
const circled = check === "circled";
|
|
3937
|
-
return /* @__PURE__ */
|
|
3938
|
-
/* @__PURE__ */
|
|
3939
|
-
/* @__PURE__ */
|
|
3940
|
-
sub && /* @__PURE__ */
|
|
3979
|
+
return /* @__PURE__ */ jsxs33("div", { ...rest, ref, className: ["ui-success", className].filter(Boolean).join(" "), children: [
|
|
3980
|
+
/* @__PURE__ */ jsx38("div", { className: ["ui-success__check", circled && "ui-success__check--circled"].filter(Boolean).join(" "), children: /* @__PURE__ */ jsx38(SuccessCheck, { variant: circled ? "circled" : "line" }) }),
|
|
3981
|
+
/* @__PURE__ */ jsx38("div", { className: "ui-success__title", children: title }),
|
|
3982
|
+
sub && /* @__PURE__ */ jsx38("div", { className: "ui-success__sub", children: sub })
|
|
3941
3983
|
] });
|
|
3942
3984
|
});
|
|
3943
3985
|
var pieces = [
|
|
@@ -3957,7 +3999,7 @@ var pieces = [
|
|
|
3957
3999
|
[80, 0.36, -20, "c", 1.05]
|
|
3958
4000
|
];
|
|
3959
4001
|
function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
3960
|
-
const [remaining, setRemaining] =
|
|
4002
|
+
const [remaining, setRemaining] = useState16(seconds);
|
|
3961
4003
|
const callback = useRef20(onDone);
|
|
3962
4004
|
useEffect15(() => {
|
|
3963
4005
|
callback.current = onDone;
|
|
@@ -3974,12 +4016,12 @@ function Countdown({ seconds, label = "Redirecting", onDone }) {
|
|
|
3974
4016
|
}, 1e3);
|
|
3975
4017
|
return () => clearInterval(timer);
|
|
3976
4018
|
}, [seconds]);
|
|
3977
|
-
return /* @__PURE__ */
|
|
3978
|
-
/* @__PURE__ */
|
|
3979
|
-
/* @__PURE__ */
|
|
4019
|
+
return /* @__PURE__ */ jsxs33("div", { className: "ui-sx__count", "data-sx-count": "", style: { "--sx-secs": `${seconds}s` }, children: [
|
|
4020
|
+
/* @__PURE__ */ jsx38("span", { className: "ui-sx__count-ring", "aria-hidden": "true" }),
|
|
4021
|
+
/* @__PURE__ */ jsxs33("span", { className: "ui-sx__count-text", children: [
|
|
3980
4022
|
label,
|
|
3981
4023
|
" in ",
|
|
3982
|
-
/* @__PURE__ */
|
|
4024
|
+
/* @__PURE__ */ jsx38("b", { "data-sx-num": "", children: remaining }),
|
|
3983
4025
|
"s"
|
|
3984
4026
|
] })
|
|
3985
4027
|
] });
|
|
@@ -4006,7 +4048,7 @@ var Success = forwardRef9(function Success2({
|
|
|
4006
4048
|
const seconds = countdown?.seconds;
|
|
4007
4049
|
const duration = seconds != null && Number.isFinite(seconds) && seconds >= 1 ? Math.floor(seconds) : 5;
|
|
4008
4050
|
const mark = check === "circled" ? "circled" : "line";
|
|
4009
|
-
return /* @__PURE__ */
|
|
4051
|
+
return /* @__PURE__ */ jsxs33(
|
|
4010
4052
|
"div",
|
|
4011
4053
|
{
|
|
4012
4054
|
role: "status",
|
|
@@ -4015,16 +4057,16 @@ var Success = forwardRef9(function Success2({
|
|
|
4015
4057
|
ref,
|
|
4016
4058
|
className: ["ui-sx", `ui-sx--${layout}`, `ui-sx--check-${mark}`, confetti && "ui-sx--confetti", className].filter(Boolean).join(" "),
|
|
4017
4059
|
children: [
|
|
4018
|
-
confetti && /* @__PURE__ */
|
|
4019
|
-
([x, d, r, t, s], index) => /* @__PURE__ */
|
|
4060
|
+
confetti && /* @__PURE__ */ jsx38("div", { className: "ui-sx__confetti", "aria-hidden": "true", children: pieces.map(
|
|
4061
|
+
([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)
|
|
4020
4062
|
) }),
|
|
4021
|
-
/* @__PURE__ */
|
|
4022
|
-
/* @__PURE__ */
|
|
4023
|
-
/* @__PURE__ */
|
|
4024
|
-
/* @__PURE__ */
|
|
4025
|
-
body && /* @__PURE__ */
|
|
4026
|
-
hasActions && /* @__PURE__ */
|
|
4027
|
-
countdown && /* @__PURE__ */
|
|
4063
|
+
/* @__PURE__ */ jsxs33("div", { className: "ui-sx__inner", children: [
|
|
4064
|
+
/* @__PURE__ */ jsx38("div", { className: "ui-sx__visual", children: /* @__PURE__ */ jsx38(SuccessCheck, { variant: mark }) }),
|
|
4065
|
+
/* @__PURE__ */ jsxs33("div", { className: "ui-sx__content", children: [
|
|
4066
|
+
/* @__PURE__ */ jsx38(Heading, { className: "ui-sx__title", children: title }),
|
|
4067
|
+
body && /* @__PURE__ */ jsx38("p", { className: "ui-sx__body", children: body }),
|
|
4068
|
+
hasActions && /* @__PURE__ */ jsx38("div", { className: "ui-sx__actions", children: actions }),
|
|
4069
|
+
countdown && /* @__PURE__ */ jsx38(Countdown, { seconds: duration, label: countdown.label, onDone: onCountdownEnd }, duration)
|
|
4028
4070
|
] })
|
|
4029
4071
|
] })
|
|
4030
4072
|
]
|
|
@@ -4034,16 +4076,16 @@ var Success = forwardRef9(function Success2({
|
|
|
4034
4076
|
|
|
4035
4077
|
// src/Chart.tsx
|
|
4036
4078
|
import {
|
|
4037
|
-
useCallback as
|
|
4079
|
+
useCallback as useCallback7,
|
|
4038
4080
|
useEffect as useEffect16,
|
|
4039
4081
|
useId as useId13,
|
|
4040
4082
|
useLayoutEffect as useLayoutEffect5,
|
|
4041
4083
|
useMemo as useMemo4,
|
|
4042
4084
|
useRef as useRef21,
|
|
4043
|
-
useState as
|
|
4085
|
+
useState as useState17
|
|
4044
4086
|
} from "react";
|
|
4045
4087
|
import { CHART_FLOOR, bridgeWalk, chartScale, pointTarget } from "@apliteni/apliteni-ui";
|
|
4046
|
-
import { Fragment as Fragment13, jsx as
|
|
4088
|
+
import { Fragment as Fragment13, jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4047
4089
|
var HEIGHT = { months: 216, bridge: 216, spark: 32 };
|
|
4048
4090
|
var PAD = 2;
|
|
4049
4091
|
var ZERO_INSET = 1.5;
|
|
@@ -4081,7 +4123,7 @@ function barPath(m) {
|
|
|
4081
4123
|
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";
|
|
4082
4124
|
}
|
|
4083
4125
|
function useTapFloor() {
|
|
4084
|
-
const [floor, setFloor] =
|
|
4126
|
+
const [floor, setFloor] = useState17(TARGET);
|
|
4085
4127
|
useEffect16(() => {
|
|
4086
4128
|
const query = typeof window === "undefined" ? null : window.matchMedia?.(`(max-width: ${PHONE_MAX2}px) and (pointer: coarse)`);
|
|
4087
4129
|
if (!query) return;
|
|
@@ -4216,11 +4258,11 @@ function Chart(props) {
|
|
|
4216
4258
|
const opening = useRef21(false);
|
|
4217
4259
|
const pointerFocus = useRef21(false);
|
|
4218
4260
|
const floor = useTapFloor();
|
|
4219
|
-
const [width, setWidth] =
|
|
4220
|
-
const [openId, setOpenId] =
|
|
4221
|
-
const [rawCursor, setCursor] =
|
|
4222
|
-
const [said, setSaid] =
|
|
4223
|
-
const [ownPick, setOwnPick] =
|
|
4261
|
+
const [width, setWidth] = useState17(0);
|
|
4262
|
+
const [openId, setOpenId] = useState17(null);
|
|
4263
|
+
const [rawCursor, setCursor] = useState17(0);
|
|
4264
|
+
const [said, setSaid] = useState17("");
|
|
4265
|
+
const [ownPick, setOwnPick] = useState17(null);
|
|
4224
4266
|
const pick = selected === void 0 ? ownPick : selected;
|
|
4225
4267
|
const steps = props.variant === "bridge" ? props.steps : void 0;
|
|
4226
4268
|
const bridgeTones = props.variant === "bridge" ? props.tones : void 0;
|
|
@@ -4235,7 +4277,7 @@ function Chart(props) {
|
|
|
4235
4277
|
const boxHeight = Math.max(plotHeight, floor);
|
|
4236
4278
|
const boxTop = -(boxHeight - plotHeight) / 2;
|
|
4237
4279
|
const span = scale.max - scale.min || 1;
|
|
4238
|
-
const y =
|
|
4280
|
+
const y = useCallback7(
|
|
4239
4281
|
(value) => PAD + (scale.max - value) / span * (plotHeight - PAD * 2),
|
|
4240
4282
|
[scale.max, span, plotHeight]
|
|
4241
4283
|
);
|
|
@@ -4248,7 +4290,7 @@ function Chart(props) {
|
|
|
4248
4290
|
cap * lanes + LANE_GAP * (lanes - 1)
|
|
4249
4291
|
));
|
|
4250
4292
|
const barWidth = (groupWidth - LANE_GAP * (lanes - 1)) / lanes;
|
|
4251
|
-
const centre =
|
|
4293
|
+
const centre = useCallback7((column) => column * colWidth + colWidth / 2, [colWidth]);
|
|
4252
4294
|
const marks = useMemo4(() => {
|
|
4253
4295
|
const out = frame.bars.map((bar) => {
|
|
4254
4296
|
let top = Math.min(y(bar.from), y(bar.to));
|
|
@@ -4322,7 +4364,7 @@ function Chart(props) {
|
|
|
4322
4364
|
return [...out, ...dots];
|
|
4323
4365
|
}, [frame, lines, keys, columns, centre, barWidth, groupWidth, y, floor, colWidth, plotWidth, boxTop, boxHeight]);
|
|
4324
4366
|
const byId = useMemo4(() => new Map(marks.map((m) => [m.id, m])), [marks]);
|
|
4325
|
-
const lead =
|
|
4367
|
+
const lead = useCallback7((column) => marks.find((m) => m.column === column), [marks]);
|
|
4326
4368
|
const open = openId ? byId.get(openId) : void 0;
|
|
4327
4369
|
useEffect16(() => {
|
|
4328
4370
|
const el = plot.current;
|
|
@@ -4334,7 +4376,7 @@ function Chart(props) {
|
|
|
4334
4376
|
observer.observe(el);
|
|
4335
4377
|
return () => observer.disconnect();
|
|
4336
4378
|
}, []);
|
|
4337
|
-
const syncEdges =
|
|
4379
|
+
const syncEdges = useCallback7(() => {
|
|
4338
4380
|
const el = scroller.current;
|
|
4339
4381
|
if (!el) return;
|
|
4340
4382
|
const last = el.scrollWidth - el.clientWidth;
|
|
@@ -4375,7 +4417,7 @@ function Chart(props) {
|
|
|
4375
4417
|
setOpenId(id);
|
|
4376
4418
|
};
|
|
4377
4419
|
const markAt = (target) => target.closest?.("[data-mark]")?.getAttribute("data-mark") ?? null;
|
|
4378
|
-
const announce =
|
|
4420
|
+
const announce = useCallback7((column, picked = pick) => {
|
|
4379
4421
|
const where = columns[column];
|
|
4380
4422
|
if (!where) return;
|
|
4381
4423
|
const values = marks.filter((m) => m.column === column).map((m) => `${m.name} ${format(m.value)}`).join(". ") || "No value";
|
|
@@ -4419,7 +4461,7 @@ function Chart(props) {
|
|
|
4419
4461
|
const estimated = columns.filter((c) => c.estimated);
|
|
4420
4462
|
const estimatedTone = marks.find((m) => m.estimated && m.kind === "bar")?.tone ?? keys[0]?.tone ?? "neutral";
|
|
4421
4463
|
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) };
|
|
4422
|
-
return /* @__PURE__ */
|
|
4464
|
+
return /* @__PURE__ */ jsxs34(
|
|
4423
4465
|
"div",
|
|
4424
4466
|
{
|
|
4425
4467
|
className: cx8("ui-chart", `ui-chart--${variant}`, selectable && "ui-chart--pick", className),
|
|
@@ -4430,9 +4472,9 @@ function Chart(props) {
|
|
|
4430
4472
|
"--ui-chart-pad": `${PAD}px`
|
|
4431
4473
|
},
|
|
4432
4474
|
children: [
|
|
4433
|
-
!spark && keys.length > 0 && /* @__PURE__ */
|
|
4434
|
-
keys.map((key) => /* @__PURE__ */
|
|
4435
|
-
key.shape === "line" ? /* @__PURE__ */
|
|
4475
|
+
!spark && keys.length > 0 && /* @__PURE__ */ jsxs34("ul", { className: "ui-chart__legend", children: [
|
|
4476
|
+
keys.map((key) => /* @__PURE__ */ jsxs34("li", { className: cx8("ui-chart__key", `ui-chart__tone--${key.tone}`), children: [
|
|
4477
|
+
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(
|
|
4436
4478
|
"rect",
|
|
4437
4479
|
{
|
|
4438
4480
|
className: "ui-chart__key-swatch",
|
|
@@ -4445,12 +4487,12 @@ function Chart(props) {
|
|
|
4445
4487
|
) }),
|
|
4446
4488
|
key.name
|
|
4447
4489
|
] }, key.id)),
|
|
4448
|
-
estimated.length > 0 && /* @__PURE__ */
|
|
4449
|
-
/* @__PURE__ */
|
|
4490
|
+
estimated.length > 0 && /* @__PURE__ */ jsxs34("li", { className: cx8("ui-chart__key", `ui-chart__tone--${estimatedTone}`), children: [
|
|
4491
|
+
/* @__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" }) }),
|
|
4450
4492
|
"Estimated"
|
|
4451
4493
|
] })
|
|
4452
4494
|
] }),
|
|
4453
|
-
/* @__PURE__ */
|
|
4495
|
+
/* @__PURE__ */ jsxs34(
|
|
4454
4496
|
"div",
|
|
4455
4497
|
{
|
|
4456
4498
|
ref: frameEl,
|
|
@@ -4474,8 +4516,8 @@ function Chart(props) {
|
|
|
4474
4516
|
setSaid("");
|
|
4475
4517
|
},
|
|
4476
4518
|
children: [
|
|
4477
|
-
!spark && scale.ticks.length > 0 && /* @__PURE__ */
|
|
4478
|
-
/* @__PURE__ */
|
|
4519
|
+
!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)) }),
|
|
4520
|
+
/* @__PURE__ */ jsx39("div", { ref: scroller, className: "ui-chart__scroll", tabIndex: -1, onScroll: () => {
|
|
4479
4521
|
syncEdges();
|
|
4480
4522
|
const anchor = [...svgEl.current?.querySelectorAll("[data-anchor]") ?? []].find((el) => el.getAttribute("data-anchor") === openId);
|
|
4481
4523
|
if (!anchor || !scroller.current || !frameEl.current || !tipEl.current) return;
|
|
@@ -4483,8 +4525,8 @@ function Chart(props) {
|
|
|
4483
4525
|
const view = scroller.current.getBoundingClientRect();
|
|
4484
4526
|
if (mark.right <= view.left || mark.left >= view.right) setOpenId(null);
|
|
4485
4527
|
else placeTip(frameEl.current, anchor, tipEl.current, frameEl.current);
|
|
4486
|
-
}, children: /* @__PURE__ */
|
|
4487
|
-
/* @__PURE__ */
|
|
4528
|
+
}, children: /* @__PURE__ */ jsxs34("div", { ref: plot, className: "ui-chart__plot", children: [
|
|
4529
|
+
/* @__PURE__ */ jsxs34(
|
|
4488
4530
|
"svg",
|
|
4489
4531
|
{
|
|
4490
4532
|
ref: svgEl,
|
|
@@ -4544,7 +4586,7 @@ function Chart(props) {
|
|
|
4544
4586
|
announce(mark.column, selectable ? mark.column : pick);
|
|
4545
4587
|
},
|
|
4546
4588
|
children: [
|
|
4547
|
-
!spark && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */
|
|
4589
|
+
!spark && pick !== null && pick >= 0 && pick < count && /* @__PURE__ */ jsx39(
|
|
4548
4590
|
"rect",
|
|
4549
4591
|
{
|
|
4550
4592
|
className: "ui-chart__band",
|
|
@@ -4557,7 +4599,7 @@ function Chart(props) {
|
|
|
4557
4599
|
frame.links && frame.bars.slice(0, -1).map((bar, i) => {
|
|
4558
4600
|
const from = byId.get(bar.id);
|
|
4559
4601
|
const to = byId.get(frame.bars[i + 1].id);
|
|
4560
|
-
return from && to ? /* @__PURE__ */
|
|
4602
|
+
return from && to ? /* @__PURE__ */ jsx39(
|
|
4561
4603
|
"line",
|
|
4562
4604
|
{
|
|
4563
4605
|
className: "ui-chart__carry",
|
|
@@ -4569,7 +4611,7 @@ function Chart(props) {
|
|
|
4569
4611
|
`carry-${bar.id}`
|
|
4570
4612
|
) : null;
|
|
4571
4613
|
}),
|
|
4572
|
-
!spark && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */
|
|
4614
|
+
!spark && scale.ticks.filter((tick) => tick !== 0).map((tick) => /* @__PURE__ */ jsx39(
|
|
4573
4615
|
"line",
|
|
4574
4616
|
{
|
|
4575
4617
|
className: "ui-chart__grid",
|
|
@@ -4580,7 +4622,7 @@ function Chart(props) {
|
|
|
4580
4622
|
},
|
|
4581
4623
|
`grid-${tick}`
|
|
4582
4624
|
)),
|
|
4583
|
-
!spark && scale.ticks.includes(0) && /* @__PURE__ */
|
|
4625
|
+
!spark && scale.ticks.includes(0) && /* @__PURE__ */ jsx39(
|
|
4584
4626
|
"line",
|
|
4585
4627
|
{
|
|
4586
4628
|
className: "ui-chart__zero",
|
|
@@ -4590,7 +4632,7 @@ function Chart(props) {
|
|
|
4590
4632
|
y2: px(y(0))
|
|
4591
4633
|
}
|
|
4592
4634
|
),
|
|
4593
|
-
marks.filter((m) => m.kind === "bar").map((mark) => /* @__PURE__ */
|
|
4635
|
+
marks.filter((m) => m.kind === "bar").map((mark) => /* @__PURE__ */ jsx39(
|
|
4594
4636
|
"path",
|
|
4595
4637
|
{
|
|
4596
4638
|
className: cx8(
|
|
@@ -4603,7 +4645,7 @@ function Chart(props) {
|
|
|
4603
4645
|
`bar-${mark.id}`
|
|
4604
4646
|
)),
|
|
4605
4647
|
["casing", "stroke"].map((layer) => lines.flatMap(
|
|
4606
|
-
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */
|
|
4648
|
+
(line) => line.values.slice(1).map((value, i) => Number.isFinite(value) && Number.isFinite(line.values[i]) ? /* @__PURE__ */ jsx39(
|
|
4607
4649
|
"line",
|
|
4608
4650
|
{
|
|
4609
4651
|
className: layer === "casing" ? "ui-chart__line-casing" : cx8(
|
|
@@ -4619,7 +4661,7 @@ function Chart(props) {
|
|
|
4619
4661
|
`${line.id}-${layer}-${i}`
|
|
4620
4662
|
) : null)
|
|
4621
4663
|
)),
|
|
4622
|
-
lines.flatMap((line) => line.values.map((value, i) => Number.isFinite(value) && !Number.isFinite(line.values[i - 1]) && !Number.isFinite(line.values[i + 1]) ? /* @__PURE__ */
|
|
4664
|
+
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(
|
|
4623
4665
|
"circle",
|
|
4624
4666
|
{
|
|
4625
4667
|
className: cx8("ui-chart__isolated", `ui-chart__tone--${line.tone}`),
|
|
@@ -4629,8 +4671,8 @@ function Chart(props) {
|
|
|
4629
4671
|
},
|
|
4630
4672
|
`isolated-${line.id}-${i}`
|
|
4631
4673
|
) : null)),
|
|
4632
|
-
marks.map((mark) => /* @__PURE__ */
|
|
4633
|
-
mark.kind === "bar" ? /* @__PURE__ */
|
|
4674
|
+
marks.map((mark) => /* @__PURE__ */ jsxs34("g", { "data-mark": mark.id, children: [
|
|
4675
|
+
mark.kind === "bar" ? /* @__PURE__ */ jsx39(
|
|
4634
4676
|
"rect",
|
|
4635
4677
|
{
|
|
4636
4678
|
className: "ui-chart__hit",
|
|
@@ -4639,7 +4681,7 @@ function Chart(props) {
|
|
|
4639
4681
|
y: px(hitBand(mark.band).y),
|
|
4640
4682
|
height: px(hitBand(mark.band).h)
|
|
4641
4683
|
}
|
|
4642
|
-
) : /* @__PURE__ */
|
|
4684
|
+
) : /* @__PURE__ */ jsx39(
|
|
4643
4685
|
"rect",
|
|
4644
4686
|
{
|
|
4645
4687
|
className: "ui-chart__hit",
|
|
@@ -4649,7 +4691,7 @@ function Chart(props) {
|
|
|
4649
4691
|
height: px(mark.hit?.h ?? TARGET)
|
|
4650
4692
|
}
|
|
4651
4693
|
),
|
|
4652
|
-
/* @__PURE__ */
|
|
4694
|
+
/* @__PURE__ */ jsx39(
|
|
4653
4695
|
"rect",
|
|
4654
4696
|
{
|
|
4655
4697
|
"data-anchor": mark.id,
|
|
@@ -4664,7 +4706,7 @@ function Chart(props) {
|
|
|
4664
4706
|
]
|
|
4665
4707
|
}
|
|
4666
4708
|
),
|
|
4667
|
-
!spark && /* @__PURE__ */
|
|
4709
|
+
!spark && /* @__PURE__ */ jsx39("div", { className: "ui-chart__periods", "aria-hidden": "true", children: columns.map((column, i) => /* @__PURE__ */ jsx39(
|
|
4668
4710
|
"span",
|
|
4669
4711
|
{
|
|
4670
4712
|
className: cx8("ui-chart__period", pick === i && "is-selected"),
|
|
@@ -4673,35 +4715,35 @@ function Chart(props) {
|
|
|
4673
4715
|
`${column.label}-${i}`
|
|
4674
4716
|
)) })
|
|
4675
4717
|
] }) }),
|
|
4676
|
-
/* @__PURE__ */
|
|
4677
|
-
/* @__PURE__ */
|
|
4678
|
-
/* @__PURE__ */
|
|
4679
|
-
(stateOf(columns[open.column]) || open.detail) && /* @__PURE__ */
|
|
4718
|
+
/* @__PURE__ */ jsx39("span", { ref: tipEl, className: cx8("ui-tip", openId && "is-open"), role: open ? "tooltip" : void 0, children: open && /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
4719
|
+
/* @__PURE__ */ jsx39("span", { className: "ui-tip__label", children: spark ? columns[open.column]?.label : `${open.name}, ${columns[open.column]?.label}` }),
|
|
4720
|
+
/* @__PURE__ */ jsx39("span", { className: "ui-tip__value", children: format(open.value) }),
|
|
4721
|
+
(stateOf(columns[open.column]) || open.detail) && /* @__PURE__ */ jsx39("span", { className: "ui-tip__detail", children: stateOf(columns[open.column]) || open.detail })
|
|
4680
4722
|
] }) })
|
|
4681
4723
|
]
|
|
4682
4724
|
}
|
|
4683
4725
|
),
|
|
4684
|
-
/* @__PURE__ */
|
|
4685
|
-
showTable && /* @__PURE__ */
|
|
4686
|
-
/* @__PURE__ */
|
|
4687
|
-
/* @__PURE__ */
|
|
4726
|
+
/* @__PURE__ */ jsx39("div", { className: "ui-sr", role: "status", children: said }),
|
|
4727
|
+
showTable && /* @__PURE__ */ jsxs34("details", { className: "ui-chart__data", children: [
|
|
4728
|
+
/* @__PURE__ */ jsx39("summary", { className: "ui-focusable", children: "Values as a table" }),
|
|
4729
|
+
/* @__PURE__ */ jsx39(
|
|
4688
4730
|
"div",
|
|
4689
4731
|
{
|
|
4690
4732
|
className: "ui-table-scroll",
|
|
4691
4733
|
role: "region",
|
|
4692
4734
|
tabIndex: 0,
|
|
4693
4735
|
"aria-label": `${title}, as a table. Scroll for more columns.`,
|
|
4694
|
-
children: /* @__PURE__ */
|
|
4695
|
-
/* @__PURE__ */
|
|
4696
|
-
/* @__PURE__ */
|
|
4697
|
-
/* @__PURE__ */
|
|
4736
|
+
children: /* @__PURE__ */ jsxs34("table", { className: "ui-table", "aria-label": title, children: [
|
|
4737
|
+
/* @__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)) }) }),
|
|
4738
|
+
/* @__PURE__ */ jsx39("tbody", { children: tableRows.map((row, i) => /* @__PURE__ */ jsxs34("tr", { "aria-current": pick === i ? true : void 0, children: [
|
|
4739
|
+
/* @__PURE__ */ jsxs34("th", { scope: "row", children: [
|
|
4698
4740
|
row.column.label,
|
|
4699
|
-
row.column.estimated && /* @__PURE__ */
|
|
4741
|
+
row.column.estimated && /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
4700
4742
|
" ",
|
|
4701
|
-
/* @__PURE__ */
|
|
4743
|
+
/* @__PURE__ */ jsx39("span", { className: "ui-chart__state", children: stateOf(row.column) })
|
|
4702
4744
|
] })
|
|
4703
4745
|
] }),
|
|
4704
|
-
row.cells.map((cell, j) => /* @__PURE__ */
|
|
4746
|
+
row.cells.map((cell, j) => /* @__PURE__ */ jsx39("td", { className: "ui-table__num", children: cell }, tableHead[j + 1]))
|
|
4705
4747
|
] }, `${row.column.label}-${i}`)) })
|
|
4706
4748
|
] })
|
|
4707
4749
|
}
|
|
@@ -4715,7 +4757,7 @@ function Chart(props) {
|
|
|
4715
4757
|
// src/AccentPicker.tsx
|
|
4716
4758
|
import { forwardRef as forwardRef10 } from "react";
|
|
4717
4759
|
import { ACCENTS, accentSwatchStyle } from "@apliteni/apliteni-ui";
|
|
4718
|
-
import { jsx as
|
|
4760
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
4719
4761
|
var AccentPicker = forwardRef10(function AccentPicker2({
|
|
4720
4762
|
value,
|
|
4721
4763
|
onChange,
|
|
@@ -4724,7 +4766,7 @@ var AccentPicker = forwardRef10(function AccentPicker2({
|
|
|
4724
4766
|
"aria-label": label = "Accent",
|
|
4725
4767
|
...rest
|
|
4726
4768
|
}, ref) {
|
|
4727
|
-
return /* @__PURE__ */
|
|
4769
|
+
return /* @__PURE__ */ jsx40(
|
|
4728
4770
|
"div",
|
|
4729
4771
|
{
|
|
4730
4772
|
...rest,
|
|
@@ -4735,7 +4777,7 @@ var AccentPicker = forwardRef10(function AccentPicker2({
|
|
|
4735
4777
|
"aria-label": label,
|
|
4736
4778
|
children: options.map((accent) => {
|
|
4737
4779
|
const title = accent.charAt(0).toUpperCase() + accent.slice(1);
|
|
4738
|
-
return /* @__PURE__ */
|
|
4780
|
+
return /* @__PURE__ */ jsx40(
|
|
4739
4781
|
"button",
|
|
4740
4782
|
{
|
|
4741
4783
|
type: "button",
|
|
@@ -4756,7 +4798,7 @@ var AccentPicker = forwardRef10(function AccentPicker2({
|
|
|
4756
4798
|
// src/NavTabs.tsx
|
|
4757
4799
|
import { Fragment as Fragment14, forwardRef as forwardRef11, useEffect as useEffect17, useRef as useRef22, useImperativeHandle as useImperativeHandle2 } from "react";
|
|
4758
4800
|
import { safeUrl, observeNavFit, revealCurrentNav, revealFocusedNav } from "@apliteni/apliteni-ui";
|
|
4759
|
-
import { Fragment as Fragment15, jsx as
|
|
4801
|
+
import { Fragment as Fragment15, jsx as jsx41, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
4760
4802
|
var NavTabs = forwardRef11(function NavTabs2({
|
|
4761
4803
|
items,
|
|
4762
4804
|
active,
|
|
@@ -4774,7 +4816,7 @@ var NavTabs = forwardRef11(function NavTabs2({
|
|
|
4774
4816
|
useEffect17(() => {
|
|
4775
4817
|
if (navRef.current) revealCurrentNav(navRef.current);
|
|
4776
4818
|
}, [active, signature]);
|
|
4777
|
-
return /* @__PURE__ */
|
|
4819
|
+
return /* @__PURE__ */ jsx41(
|
|
4778
4820
|
"nav",
|
|
4779
4821
|
{
|
|
4780
4822
|
...rest,
|
|
@@ -4787,11 +4829,11 @@ var NavTabs = forwardRef11(function NavTabs2({
|
|
|
4787
4829
|
},
|
|
4788
4830
|
children: items.map((item) => {
|
|
4789
4831
|
const badge = item.badge != null && typeof item.badge === "object" ? item.badge : { text: item.badge, tone: void 0 };
|
|
4790
|
-
const inner = /* @__PURE__ */
|
|
4791
|
-
/* @__PURE__ */
|
|
4792
|
-
badge.text != null && badge.text !== "" && /* @__PURE__ */
|
|
4832
|
+
const inner = /* @__PURE__ */ jsxs35(Fragment15, { children: [
|
|
4833
|
+
/* @__PURE__ */ jsx41("span", { className: "ui-nav__tab-label", children: item.label }),
|
|
4834
|
+
badge.text != null && badge.text !== "" && /* @__PURE__ */ jsx41("span", { className: `ui-nav__badge is-${badge.tone || "neutral"}`, children: badge.text })
|
|
4793
4835
|
] });
|
|
4794
|
-
if (item.disabled) return /* @__PURE__ */
|
|
4836
|
+
if (item.disabled) return /* @__PURE__ */ jsx41("span", { className: "ui-nav__tab is-disabled", "aria-disabled": "true", children: inner }, item.id);
|
|
4795
4837
|
const current = item.id === active;
|
|
4796
4838
|
const linkProps = {
|
|
4797
4839
|
className: ["ui-nav__tab", current && "is-active"].filter(Boolean).join(" "),
|
|
@@ -4800,7 +4842,7 @@ var NavTabs = forwardRef11(function NavTabs2({
|
|
|
4800
4842
|
"aria-current": current ? "page" : void 0,
|
|
4801
4843
|
children: inner
|
|
4802
4844
|
};
|
|
4803
|
-
return /* @__PURE__ */
|
|
4845
|
+
return /* @__PURE__ */ jsx41(Fragment14, { children: renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx41("a", { ...linkProps }) }, item.id);
|
|
4804
4846
|
})
|
|
4805
4847
|
}
|
|
4806
4848
|
);
|
|
@@ -4808,8 +4850,8 @@ var NavTabs = forwardRef11(function NavTabs2({
|
|
|
4808
4850
|
|
|
4809
4851
|
// src/Breadcrumbs.tsx
|
|
4810
4852
|
import { forwardRef as forwardRef12 } from "react";
|
|
4811
|
-
import { icon as
|
|
4812
|
-
import { Fragment as Fragment16, jsx as
|
|
4853
|
+
import { icon as icon7, safeUrl as safeUrl2 } from "@apliteni/apliteni-ui";
|
|
4854
|
+
import { Fragment as Fragment16, jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4813
4855
|
var Breadcrumbs = forwardRef12(function Breadcrumbs2({
|
|
4814
4856
|
items,
|
|
4815
4857
|
renderLink,
|
|
@@ -4817,21 +4859,21 @@ var Breadcrumbs = forwardRef12(function Breadcrumbs2({
|
|
|
4817
4859
|
"aria-label": ariaLabel = "Breadcrumb",
|
|
4818
4860
|
...rest
|
|
4819
4861
|
}, ref) {
|
|
4820
|
-
return /* @__PURE__ */
|
|
4862
|
+
return /* @__PURE__ */ jsx42(
|
|
4821
4863
|
"nav",
|
|
4822
4864
|
{
|
|
4823
4865
|
...rest,
|
|
4824
4866
|
ref,
|
|
4825
4867
|
className: ["ui-nav", "ui-nav--crumbs", className].filter(Boolean).join(" "),
|
|
4826
4868
|
"aria-label": ariaLabel,
|
|
4827
|
-
children: /* @__PURE__ */
|
|
4869
|
+
children: /* @__PURE__ */ jsx42("ol", { className: "ui-nav__crumbs", children: items.map((item, index) => {
|
|
4828
4870
|
const current = index === items.length - 1;
|
|
4829
|
-
const inner = /* @__PURE__ */
|
|
4830
|
-
item.icon && /* @__PURE__ */
|
|
4831
|
-
/* @__PURE__ */
|
|
4871
|
+
const inner = /* @__PURE__ */ jsxs36(Fragment16, { children: [
|
|
4872
|
+
item.icon && /* @__PURE__ */ jsx42("span", { className: "ui-nav__ic", dangerouslySetInnerHTML: { __html: icon7(item.icon) } }),
|
|
4873
|
+
/* @__PURE__ */ jsx42("span", { className: "ui-nav__crumb-label", children: item.label })
|
|
4832
4874
|
] });
|
|
4833
4875
|
const linkProps = !current && item.href ? { className: "ui-nav__crumb", href: safeUrl2(item.href), target: item.target, children: inner } : null;
|
|
4834
|
-
return /* @__PURE__ */
|
|
4876
|
+
return /* @__PURE__ */ jsx42("li", { className: "ui-nav__crumb-item", children: linkProps ? renderLink ? renderLink(item, linkProps) : /* @__PURE__ */ jsx42("a", { ...linkProps }) : /* @__PURE__ */ jsx42(
|
|
4835
4877
|
"span",
|
|
4836
4878
|
{
|
|
4837
4879
|
className: ["ui-nav__crumb", current && "is-current"].filter(Boolean).join(" "),
|
|
@@ -4850,6 +4892,7 @@ var DEFAULT_PAGE_SIZE3 = KIT_DEFAULT_PAGE_SIZE;
|
|
|
4850
4892
|
export {
|
|
4851
4893
|
AccentPicker,
|
|
4852
4894
|
AppShell,
|
|
4895
|
+
Avatar,
|
|
4853
4896
|
BackLink,
|
|
4854
4897
|
Badge,
|
|
4855
4898
|
Breadcrumbs,
|